Browse Source

Merge branch 'master' of http://git.cc-lotus.info/pointToNetwork/point-app

guhongwei 2 years ago
parent
commit
8cb9f4bc6a
4 changed files with 106 additions and 36 deletions
  1. 19 17
      pages/my/index.vue
  2. 26 5
      pagesMy/order/after.vue
  3. 60 13
      pagesMy/order/index.vue
  4. 1 1
      pagesMy/order/service.vue

+ 19 - 17
pages/my/index.vue

@@ -20,7 +20,7 @@
 					</view>
 					<text class="link">|</text>
 					<view class="one_2_1" @click="toCommon('pagesMy/collection/shop')">
-						<text v-if="user._id">{{shop_name||0}}</text>
+						<text v-if="user._id">{{shop_num||0}}</text>
 						<text>收藏的店铺</text>
 					</view>
 				</view>
@@ -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)">
@@ -136,7 +136,7 @@
 				// 收藏商品
 				market_num: '',
 				// 收藏店铺
-				shop_name: ''
+				shop_num: ''
 			};
 		},
 		onShow: async function() {
@@ -155,19 +155,21 @@
 					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)
+						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) => {}

+ 26 - 5
pagesMy/order/after.vue

@@ -14,11 +14,11 @@
 									<text>{{item.shop.name}}</text>
 								</view>
 								<view class="type">
-									{{item.type=='0'?'退款':item.type=='1'?'换货':'维修'}}
+									{{item.zhType||'暂无'}}
 								</view>
 							</view>
 							<view class="list_2">
-								<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
+								<image class="image" :src="item.url&&item.url.length>0?item.url[0].url:''" mode="">
 								</image>
 								<view class="other">
 									<view class="name">
@@ -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,11 @@
 				});
 				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 (type) val.zhType = type.label;
+						val.url = val?.goods?.goods?.file;
+					}
 					that.$set(that, `list`, list)
 					that.$set(that, `total`, arr.total)
 				} else {
@@ -134,6 +144,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;

+ 60 - 13
pagesMy/order/index.vue

@@ -12,7 +12,8 @@
 								<view class="list_1" v-if="tabs.active=='-0'">
 									全部订单
 								</view>
-								<view class="list_2" v-for="(item,index) in list" :key="index" v-else-if="tabs.active=='0'" @tap="toInfo(item)">
+								<view class="list_2" v-for="(item,index) in list" :key="index"
+									v-else-if="tabs.active=='0'" @tap="toInfo(item)">
 									<view class="status">
 										{{item.status=='0'?'待付款':item.status=='1'?'已支付':item.status=='-1'?'取消订单':item.status=='2'?'发货中':item.status=='-2'?'已退款':item.status=='3'?'已收货':item.status=='-3'?'申请售后':item.status=='-4'?'正在售后中':item.status=='-5'?'售后已结束':'未识别'}}
 									</view>
@@ -26,7 +27,9 @@
 										<view class="goods_2">
 											<view class="market" v-for="(tags,indexss) in tag.goods" :key="indexss">
 												<view class="url">
-													<image class="image" :src="tags.goods.file&&tags.goods.file.length>0?tags.goods.file[0].url:''" mode=""></image>
+													<image class="image"
+														:src="tags.goods.file&&tags.goods.file.length>0?tags.goods.file[0].url:''"
+														mode=""></image>
 												</view>
 												<view class="goodsname">
 													{{tags.name}}
@@ -47,13 +50,20 @@
 										<text>总价¥{{item.total_detail.goods_total}}</text>
 									</view>
 									<view class="btn">
-										<button class="toCancel" v-if="item.status=='0'" type="default" size="mini" @tap.stop="toCancel(item)">取消订单</button>
-										<button class="toPay" v-if="item.status=='0'" type="default" size="mini" @tap.stop="toPay(item)">付款</button>
-										<button class="toAfter" v-if="item.status!='0'" type="default" size="mini" @tap.stop="toAfter(item)">申请售后</button>
-										<button class="toAfter" v-if="item.status=='3'" type="default" size="mini" @tap.stop="toAfter(item)">申请退款</button>
+										<button class="toCancel" v-if="item.status=='0'" type="default" size="mini"
+											@tap.stop="toCancel(item)">取消订单</button>
+										<button class="toPay" v-if="item.status=='0'" type="default" size="mini"
+											@tap.stop="toPay(item)">付款</button>
+										<button class="toConfirm" v-if="item.status=='2'" type="default" size="mini"
+											@tap.stop="toConfirm(item)">确认收货</button>
+										<button class="toAfter" v-if="item.status!='0'" type="default" size="mini"
+											@tap.stop="toAfter(item)">申请售后</button>
+										<button class="toAfter" v-if="item.status=='3'" type="default" size="mini"
+											@tap.stop="toAfter(item)">申请退款</button>
 									</view>
 								</view>
-								<view class="list_2 list_3" v-for="(item,index) in list" :key="index" @tap="toInfo(item)" v-else>
+								<view class="list_2 list_3" v-for="(item,index) in list" :key="index"
+									@tap="toInfo(item)" v-else>
 									<view class="list_3_1">
 										<view class="goods_1">
 											<view class="shopname">
@@ -69,7 +79,9 @@
 										<view class="goods_2">
 											<view class="market">
 												<view class="url">
-													<image class="image" :src="tag.goods.file&&tag.goods.file.length>0?tag.goods.file[0].url:''" mode=""></image>
+													<image class="image"
+														:src="tag.goods.file&&tag.goods.file.length>0?tag.goods.file[0].url:''"
+														mode=""></image>
 												</view>
 												<view class="goodsname">
 													{{tag.name}}
@@ -90,11 +102,18 @@
 										<text>总价¥{{item.total_detail.goods_total}}</text>
 									</view>
 									<view class="btn">
-										<button class="toCancel" v-if="item.status=='2'||item.status=='3'" type="default" size="mini" @tap.stop="toLogi(item)">查看物流</button>
-										<button class="toCancel" v-if="item.status=='0'" type="default" size="mini" @tap.stop="toCancel(item)">取消订单</button>
-										<button class="toPay" v-if="item.status=='0'" type="default" size="mini" @tap.stop="toPay(item)">付款</button>
-										<button class="toAfter" v-if="item.status!='0'" type="default" size="mini" @tap.stop="toAfter(item)">申请售后</button>
-										<button class="toAfter" v-if="item.status=='3'" type="default" size="mini" @tap.stop="toAfter(item)">申请退款</button>
+										<button class="toCancel" v-if="item.status=='2'||item.status=='3'"
+											type="default" size="mini" @tap.stop="toLogi(item)">查看物流</button>
+										<button class="toCancel" v-if="item.status=='0'" type="default" size="mini"
+											@tap.stop="toCancel(item)">取消订单</button>
+										<button class="toPay" v-if="item.status=='0'" type="default" size="mini"
+											@tap.stop="toPay(item)">付款</button>
+										<button class="toConfirm" v-if="item.status=='2'" type="default" size="mini"
+											@tap.stop="toConfirm(item)">确认收货</button>
+										<button class="toAfter" v-if="item.status!='0'" type="default" size="mini"
+											@tap.stop="toAfter(item)">申请售后</button>
+										<button class="toAfter" v-if="item.status=='3'" type="default" size="mini"
+											@tap.stop="toAfter(item)">申请退款</button>
 									</view>
 								</view>
 							</view>
@@ -322,6 +341,34 @@
 					fail: function(err) {}
 				})
 			},
+			// 确认收货
+			toConfirm(e) {
+				const that = this;
+				uni.showModal({
+					title: '提示',
+					content: '确定确认收货吗?',
+					success: async function(res) {
+						if (res.confirm) {
+							const arr = await that.$api(`/orderDetail/${e._id}`, 'POST', {
+								status: '3'
+							});
+							if (arr.errcode == '0') {
+								uni.showToast({
+									title: '确认收货成功',
+									icon: 'none'
+								})
+								that.clearPage();
+								that.search();
+							} else {
+								uni.showToast({
+									title: arr.errmsg,
+									icon: 'none'
+								})
+							}
+						}
+					}
+				});
+			},
 			// 申请售后 申请退款
 			toAfter(e) {
 				if (e.status == '3') {

+ 1 - 1
pagesMy/order/service.vue

@@ -46,7 +46,7 @@
 							<view>{{form.type_name||'请选择售后类型'}}</view>
 						</picker>
 					</uni-forms-item>
-					<uni-forms-item label="退款金额" name="money" v-if="form.type=='0'||form.type=='2'">
+					<uni-forms-item label="退款金额" name="money" v-if="form.type=='0'||form.type=='1'">
 						<uni-easyinput type="digit" v-model="form.money" @input="toMoney" placeholder="请输入退款金额" />
 						<view>
 							最大退款金额不能超过{{moneyInfo.payTotal||'暂无'}}