zs 2 år sedan
förälder
incheckning
0f70fd5612
2 ändrade filer med 42 tillägg och 19 borttagningar
  1. 18 15
      pages/my/index.vue
  2. 24 4
      pagesMy/order/after.vue

+ 18 - 15
pages/my/index.vue

@@ -28,10 +28,10 @@
 			<view class="two">
 				<view class="two_1">
 					<view class="title">我的订单</view>
-					<!-- 	<view class="title">
+					<view class="title">
 						<text @click="toOrder({route:'pagesMy/order/index',type:'order',status:'-0'})">全部订单</text>
 						<text class="iconfont icon-jiantouyou"></text>
-					</view> -->
+					</view>
 				</view>
 				<view class="two_2">
 					<view class="orderList" v-for="(item, index) in orderList" :key="index" @click="toOrder(item)">
@@ -155,19 +155,22 @@
 					key: 'token',
 					success: async (res) => {
 						let user = that.$jwt(res.data);
-						const arr = await that.$api(`/user/${user.id}`, 'GET');
-						if (arr.errcode == '0') that.$set(that, `user`, arr.data);
-						const market = await that.$api(`/storeGoods`, 'GET', {
-							customer: user._id
-						})
-						if (market.errcode == '0') {
-							that.$set(that, `market_num`, market.total)
-						}
-						const shop = await that.$api(`/storeShop`, 'GET', {
-							customer: user._id
-						})
-						if (shop.errcode == '0') {
-							that.$set(that, `shop_num`, shop.total)
+						that.$set(that, `user`, user);
+						if (user && user._id) {
+							let arr;
+							// 查询用户信息
+							arr = await that.$api(`/user/${user._id}`, 'GET');
+							if (arr.errcode == '0') that.$set(that, `user`, arr.data);
+							// 查询收藏商品
+							arr = await that.$api(`/storeGoods`, 'GET', {
+								customer: user._id
+							})
+							if (arr.errcode == '0') that.$set(that, `market_num`, arr.total);
+							// 查询收藏店铺
+							arr = await that.$api(`/storeShop`, 'GET', {
+								customer: user._id
+							})
+							if (arr.errcode == '0') that.$set(that, `shop_num`, arr.total);
 						}
 					},
 					fail: (err) => {}

+ 24 - 4
pagesMy/order/after.vue

@@ -14,7 +14,7 @@
 									<text>{{item.shop.name}}</text>
 								</view>
 								<view class="type">
-									{{item.type=='0'?'退款':item.type=='1'?'换货':'维修'}}
+									{{item.zhType||'暂无'}}
 								</view>
 							</view>
 							<view class="list_2">
@@ -40,7 +40,8 @@
 							</view>
 							<view class="btn">
 								<button type="default" size="mini" @click="toCancel(item)">取消售后</button>
-								<button v-if="item.type!='0'" type="default" size="mini" @click="toRevise(item)">维护信息</button>
+								<button v-if="item.type!='0'" type="default" size="mini"
+									@click="toRevise(item)">维护信息</button>
 							</view>
 						</view>
 					</view>
@@ -56,16 +57,20 @@
 			return {
 				user: {},
 				list: [],
+				typeList: [],
 				total: 0,
 				skip: 0,
 				limit: 5,
 				page: 0
 			};
 		},
-		onShow: function() {
+		onShow: async function() {
 			const that = this;
 			that.clearPage();
-			that.watchLogin();
+			// 查询其他信息
+			await that.searchOther();
+			// 监听用户登录
+			await that.watchLogin();
 		},
 		methods: {
 			// 维护信息
@@ -126,6 +131,10 @@
 				});
 				if (arr.errcode == '0') {
 					let list = [...that.list, ...arr.data];
+					for (let val of list) {
+						let type = that.typeList.find(i => i.value == val.type)
+						if (status) val.zhType = status.label;
+					}
 					that.$set(that, `list`, list)
 					that.$set(that, `total`, arr.total)
 				} else {
@@ -134,6 +143,17 @@
 					});
 				}
 			},
+			// 查询其他信息
+			async searchOther() {
+				const that = this;
+				let res;
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "afterSale_type"
+				});
+				if (res.errcode == '0') {
+					that.$set(that, `typeList`, res.data)
+				}
+			},
 			// 分页
 			toPage(e) {
 				const that = this;