【个人中心】

1、完成订单中心的接入
pull/1/MERGE
YunaiV 2023-08-19 16:04:25 +08:00
parent 330e508900
commit e42f376bc2
3 changed files with 38 additions and 44 deletions

View File

@ -6,6 +6,10 @@ export function getAfterSale(id) {
}); });
} }
export function getApplyingAfterSaleCount() {
return request.get("app-api/trade/after-sale/get-applying-count");
}
export function getAfterSalePage(data) { export function getAfterSalePage(data) {
return request.get("app-api/trade/after-sale/page", data); return request.get("app-api/trade/after-sale/page", data);
} }

View File

@ -51,6 +51,8 @@
</view> </view>
<view class="sign" @click="goSignIn"></view> <view class="sign" @click="goSignIn"></view>
</view> </view>
<!-- 订单中心 -->
<view class="order-wrapper"> <view class="order-wrapper">
<view class="order-hd flex"> <view class="order-hd flex">
<view class="left">订单中心</view> <view class="left">订单中心</view>
@ -121,13 +123,13 @@
</view> </view>
</template> </template>
<script> <script>
let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px'; let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
import Cache from '@/utils/cache'; import Cache from '@/utils/cache';
import { BACK_URL } from '@/config/cache'; import { BACK_URL } from '@/config/cache';
import { orderData } from '@/api/order.js';
import { toLogin } from '@/libs/login.js'; import { toLogin } from '@/libs/login.js';
import { getCity } from '@/api/api.js';
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import * as TradeOrderApi from '@/api/trade/order.js';
import * as AfterSaleApi from '@/api/trade/afterSale.js';
import * as DecorateApi from '@/api/promotion/decorate.js'; import * as DecorateApi from '@/api/promotion/decorate.js';
const app = getApp(); const app = getApp();
export default { export default {
@ -172,10 +174,10 @@
circular: true, circular: true,
interval: 3000, interval: 3000,
duration: 500, duration: 500,
autoplay: true,
menus: [], // menus: [], //
orderStatusNum: {},
servicePic: '/static/images/customer.png', servicePic: '/static/images/customer.png',
sysHeight: sysHeight, sysHeight: sysHeight,
// #ifdef MP // #ifdef MP
pageHeight: '100%', pageHeight: '100%',
@ -190,15 +192,13 @@
// #ifdef H5 // #ifdef H5
toLogin() toLogin()
// #endif // #endif
return
} }
// #ifdef H5 // #ifdef H5
this.$set(this, 'pageHeight', app.globalData.windowHeight); this.$set(this, 'pageHeight', app.globalData.windowHeight);
// #endif // #endif
this.$set(this, 'menus', app.globalData.MyMenus); this.$set(this, 'menus', app.globalData.MyMenus);
if (!this.$Cache.has('cityList')) {
this.getCityList();
}
}, },
onShow: function() { onShow: function() {
let that = this; let that = this;
@ -232,29 +232,32 @@
location.href = this.chatUrl; location.href = this.chatUrl;
}, },
getOrderData() { getOrderData() {
let that = this; TradeOrderApi.getOrderCount().then(res => {
orderData().then(res => { this.orderMenu.forEach((item) => {
that.orderMenu.forEach((item, index) => { switch (item.title) {
switch (item.title) { case '待付款':
case '待付款': item.num = res.data.unpaidCount
item.num = res.data.unPaidCount break
break case '待发货':
case '待发货': item.num = res.data.undeliveredCount
item.num = res.data.unShippedCount break
break case '待收货':
case '待收货': item.num = res.data.deliveredCount
item.num = res.data.receivedCount break
break case '待评价':
case '待评价': item.num = res.data.uncommentedCount
item.num = res.data.evaluatedCount break
break }
case '售后/退款': })
item.num = res.data.refundCount this.$set(this, 'orderMenu', this.orderMenu);
break })
} AfterSaleApi.getApplyingAfterSaleCount().then(res => {
}) const afterSaleOrderMenu = this.orderMenu.filter(item => item.title === '售后/退款')
that.$set(that, 'orderMenu', that.orderMenu); if (afterSaleOrderMenu) {
}) afterSaleOrderMenu[0].num = res.data
this.$set(this, 'orderMenu', this.orderMenu);
}
})
}, },
// //
openAuto() { openAuto() {
@ -314,18 +317,6 @@
this.openAuto() this.openAuto()
// #endif // #endif
} }
},
//
getCityList: function() {
let that = this;
getCity().then(res => {
let oneDay = 24 * 3600 * 1000;
this.$Cache.setItem({
name: 'cityList',
value: res.data,
expires: oneDay * 7
}); //
})
} }
} }
} }

View File

@ -79,7 +79,6 @@
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import * as TradeOrderApi from '@/api/trade/order.js'; import * as TradeOrderApi from '@/api/trade/order.js';
import * as AfterSaleApi from '@/api/trade/afterSale.js'; import * as AfterSaleApi from '@/api/trade/afterSale.js';
import {createAfterSale} from "../../../api/trade/afterSale";
export default { export default {
data() { data() {
return { return {