zhangbs 2 years ago
parent
commit
ac3d857f78
2 changed files with 135 additions and 213 deletions
  1. 1 1
      pagesMy/order/after.vue
  2. 134 212
      pagesMy/order/all.vue

+ 1 - 1
pagesMy/order/after.vue

@@ -242,7 +242,7 @@
 			// 售后详细信息
 			toView(item) {
 				uni.navigateTo({
-					url: `/pagesMy/order/afterInfo?id=${item._id}$status=${'0'}`
+					url: `/pagesMy/order/afterInfo?id=${item._id}&status=${'0'}`
 				})
 			},
 			// 订单详细

+ 134 - 212
pagesMy/order/all.vue

@@ -10,79 +10,30 @@
 									<button size="mini" @tap="toDislog">查询条件</button>
 								</view>
 								<view class="one_2">
-									<view class="list" v-for="(item, index) in list" :key="index">
+									<view class="list" v-for="(item, index) in list" :key="index" @tap="toView(item)">
 										<view class="list_1" v-if="tabs.active=='0'">
-											<view class="first_1" v-if="item.status=='-1'">
-												<view class="goods">
-													<view class="goodsList" v-for="(tag,indexs) in item.goods"
-														:key="indexs">
-														<view class="shopname">
-															<view class="shop">
-																<text class="iconfont icon-shangdian"></text>
-																<text>{{tag.shop_name}}</text>
-															</view>
-															<view class="status">
-																{{item.zhStatus}}
-															</view>
-														</view>
-														<view class="goodsList_1">
-															<view class="market" v-for="(tags,indexss) in tag.goods"
-																:key="indexss">
-																<view class="market_1">
-																	<image class="image"
-																		:src="tags.goods.file&&tags.goods.file.length>0?tags.goods.file[0].url:''"
-																		mode=""></image>
-																</view>
-																<view class="market_2">
-																	<view class="goodsname textOver">
-																		{{tags.goods.name}}
-																	</view>
-																	<view class="specs">
-																		{{tags.name}}
-																	</view>
-																	<text v-if="tags.gift.length>0"
-																		class="gift">赠品</text>
-																	<text v-if="tags.sp_price" class="act">特价</text>
-																</view>
-																<view class="market_3">
-																	<view v-if="item.type=='0'" class="price">
-																		¥{{tags.price||tags.sell_money}}
-																	</view>
-																	<view v-else class="price">
-																		¥{{tags.group_config.money}}
-																	</view>
-																	<view class="num">
-																		×{{tags.buy_num}}
-																	</view>
-																</view>
-															</view>
-														</view>
-													</view>
-												</view>
-												<view class="other">
-													<text>共{{item.buy_num_total}}件商品</text>
-													<text>实付款¥{{item.real_pay}}</text>
-												</view>
-											</view>
-											<view class="second_2" v-else>
-												<view class="second_2_1">
-													<view class="shopname">
+											<view class="goodsList">
+												<view class="shopname">
+													<view class="shop">
 														<text class="iconfont icon-shangdian"></text>
-														<text>{{tag.shop_name}}</text>
+														<text>{{item.shop.name}}</text>
 													</view>
 													<view class="status">
 														{{item.zhStatus}}
 													</view>
 												</view>
-												<view class="second_2_2">
-													<view class="goods" v-for="(tag,indexs) in item.goods"
-														:key="indexs">
-														<view class="goods_1">
-															<image class="image"
+												<view class="goodsList_1">
+													<view class="market" v-for="(tag,indexs) in item.spec"
+														:key="indexss">
+														<view class="market_1">
+															<image class="image" v-if="tag.file&&tag.file.length>0"
+																:src="tag.file&&tag.file.length>0?tag.file[0].url:''"
+																mode=""></image>
+															<image class="image" v-else
 																:src="tag.goods.file&&tag.goods.file.length>0?tag.goods.file[0].url:''"
 																mode=""></image>
 														</view>
-														<view class="goods_2">
+														<view class="market_2">
 															<view class="goodsname textOver">
 																{{tag.goods.name}}
 															</view>
@@ -92,7 +43,7 @@
 															<text v-if="tag.gift.length>0" class="gift">赠品</text>
 															<text v-if="tag.sp_price" class="act">特价</text>
 														</view>
-														<view class="goods_3">
+														<view class="market_3">
 															<view v-if="item.type=='0'" class="price">
 																¥{{tag.price||tag.sell_money}}
 															</view>
@@ -105,14 +56,14 @@
 														</view>
 													</view>
 												</view>
-												<view class="other">
-													<text>共{{item.buy_num_total||0}}件商品</text>
-													<text>实付款¥{{item.real_pay}}</text>
-												</view>
+											</view>
+											<view class="other">
+												<text>共{{item.buy_num_total}}件商品</text>
+												<text>实付款¥{{item.real_pay}}</text>
 											</view>
 											<view class="btn">
 												<button v-if="item.status=='0'" size="mini"
-													@tap.stop="toCancel(item)">取消订单</button>
+													@tap.stop="toCancel_order(item)">取消订单</button>
 												<button v-if="item.status=='0'" size="mini"
 													@tap.stop="toPay(item)">支付</button>
 												<button v-if="item.status=='1'&&item.is_afterSale!=true" size="mini"
@@ -174,21 +125,19 @@
 												<text>实付款¥{{item.pay}}</text>
 											</view>
 											<view class="btn">
-												<button type="default" size="mini"
-													@tap.stop="toView(item,'group_order')">详细信息</button>
 												<button v-if="item.status=='0'||item.status=='1'" size="mini"
 													@tap.stop="toCancel(item)">取消订单</button>
 												<button v-if="item.status=='0'" size="mini"
-													@tap.stop="toPay(item)">支付</button>
+													@tap.stop="toPay(item,'group_order')">支付</button>
 												<button v-if="item.status=='2'||item.status=='3'||item.status=='2-'"
 													size="mini" @tap.stop="toLogi(item,'group_order')">查看物流</button>
 												<button v-if="item.status=='2'&&item.is_afterSale!=true" size="mini"
 													@tap.stop="toConfirm(item,'group_order')">确认收货</button>
 												<button
 													v-if="item.status=='2'||item.status=='2-'&&item.is_afterSale!=true"
-													size="mini" @tap.stop="toReject(item)">拒收</button>
+													size="mini" @tap.stop="toReject(item,'group_order')">拒收</button>
 												<button v-if="item.status=='3'" size="mini"
-													@tap.stop="toAfter(item)">申请售后</button>
+													@tap.stop="toAfter(item,'group_order')">申请售后</button>
 											</view>
 										</view>
 									</view>
@@ -201,20 +150,12 @@
 			<view class="dialog" v-if="dialog.show==true">
 				<view class="dialog_1" v-if="dialog.type=='1'">
 					<uni-forms ref="form" :modelValue="searchInfo" :rules="rules" label-width="auto">
-						<uni-forms-item v-if="tabs.active!='-1'" label="商品名称查询" name="goods">
+						<uni-forms-item label="商品名称查询" name="goods">
 							<uni-easyinput type="text" v-model="searchInfo.goods" placeholder="请输入商品名称" />
 						</uni-forms-item>
 						<uni-forms-item label="状态" name="status">
-							<picker v-if="tabs.active=='0'" class="picker" mode="selector" :range="ostatusList"
-								@change="statusChange" range-key="label">
-								<view>{{status_name||'请选择状态'}}</view>
-							</picker>
-							<picker v-else-if="tabs.active=='-1'" class="picker" mode="selector" :range="astatusList"
-								@change="statusChange" range-key="label">
-								<view>{{status_name||'请选择状态'}}</view>
-							</picker>
-							<picker v-else-if="tabs.active=='1'" class="picker" mode="selector" :range="gstatusList"
-								@change="statusChange" range-key="label">
+							<picker class="picker" mode="selector" :range="statusList" @change="statusChange"
+								range-key="label">
 								<view>{{status_name||'请选择状态'}}</view>
 							</picker>
 						</uni-forms-item>
@@ -378,7 +319,7 @@
 			toView(item, type) {
 				const that = this;
 				that.clearPage();
-				if (type == 'group_order') {
+				if (that.tabs.active == '1') {
 					uni.navigateTo({
 						url: `/pagesMy/dough/info?id=${item._id}`
 					})
@@ -443,8 +384,65 @@
 					}
 				});
 			},
+			// 取消订单-已支付
+			toCancels(e) {
+				const that = this;
+				uni.showModal({
+					title: '提示',
+					content: '确定取消订单吗?',
+					success: async function(res) {
+						if (res.confirm) {
+							let arr = await that.$api(`/afterSale`, 'POST', {
+								order_detail: e._id,
+								type: '4'
+							})
+							if (arr.errcode == '0') {
+								uni.showToast({
+									title: '申请取消订单完成',
+									icon: 'none'
+								})
+								that.clearPage();
+								that.search();
+							} else {
+								uni.showToast({
+									title: arr.errmsg,
+									icon: 'none'
+								})
+							}
+						}
+					}
+				});
+			},
+			// 取消订单-未支付
+			toCancel_order(e) {
+				const that = this;
+				uni.showModal({
+					title: '提示',
+					content: '确定取消订单吗?',
+					success: async function(res) {
+						if (res.confirm) {
+							const arr = await that.$api(`/order/cancel`, 'POST', {
+								order_id: e._id
+							});
+							if (arr.errcode == '0') {
+								uni.showToast({
+									title: '申请取消订单完成',
+									icon: 'none'
+								})
+								that.clearPage();
+								that.search();
+							} else {
+								uni.showToast({
+									title: arr.errmsg,
+									icon: 'none'
+								})
+							}
+						}
+					}
+				});
+			},
 			// 支付
-			async toPay(e) {
+			async toPay(e, type) {
 				const that = this;
 				let system = that.system;
 				if (system.uniPlatform == "mp-weixin") {
@@ -452,9 +450,14 @@
 						title: '加载中'
 					})
 					// 支付信息
-					let p2 = await that.$api('/orderDeal/pay', 'POST', {
+					let p2;
+					if (type == 'group_order') p2 = await that.$api('/orderDeal/pay', 'POST', {
 						order_id: e._id,
 					}, 'group')
+					else p2 = await that.$api('/pay/toPayOrder', 'POST', {
+						order_id: e,
+						type: '0'
+					})
 					if (p2.errcode == '0' && p2.data.paySign) {
 						uni.requestPayment({
 							"provider": "wxpay",
@@ -552,17 +555,25 @@
 				});
 			},
 			// 拒收
-			async toReject(e) {
+			async toReject(e, type) {
 				const that = this;
 				uni.showModal({
 					title: '提示',
 					content: '确定拒收快递吗?',
 					success: async function(res) {
 						if (res.confirm) {
-							let arr = await that.$api(`/groupAfterSale`, 'POST', {
-								order: e._id,
-								type: '5'
-							}, 'group')
+							let arr;
+							if (type == 'group_order') {
+								arr = await that.$api(`/groupAfterSale`, 'POST', {
+									order: e._id,
+									type: '5'
+								}, 'group')
+							} else {
+								arr = await that.$api(`/afterSale`, 'POST', {
+									order_detail: e._id,
+									type: '5'
+								})
+							}
 							if (arr.errcode == '0') {
 								uni.showToast({
 									title: '拒收申请完成',
@@ -589,13 +600,19 @@
 				})
 			},
 			// 申请售后
-			toAfter(e) {
+			toAfter(e, type) {
 				const that = this;
 				if (e.is_afterSale != true) {
 					that.clearPage();
-					uni.navigateTo({
-						url: `/pagesMy/order/service?id=${e._id}&status=${'-3'}`
-					})
+					if (type == 'group_order') {
+						uni.navigateTo({
+							url: `/pagesMy/order/service?id=${e._id}&status=${'-3'}`
+						})
+					} else {
+						uni.navigateTo({
+							url: `/pagesMy/order/service?id=${e._id}&status=${e.status}`
+						})
+					}
 				} else {
 					uni.showToast({
 						title: `该订单有售后处理中`,
@@ -694,128 +711,33 @@
 						border-radius: 5px;
 
 						.list_1 {
-							.first_1 {
-								.goods {
-									.goodsList {
-										border-bottom: 1px solid #f1f1f1;
-
-										.shopname {
-											display: flex;
-											justify-content: space-between;
-											margin: 0 0 2vw 0;
-
-											.shop {
-												text:last-child {
-													padding: 0 0 0 2vw;
-												}
-											}
-
-											.status {
-												text-align: right;
-												color: var(--ff0Color);
-												margin: 0 0 1vw 0;
-											}
-										}
-
-										.goodsList_1 {
-											.market {
-												display: flex;
-												padding: 0 0 2vw 0;
-
-												.market_1 {
-													width: 20vw;
-													height: 20vw;
-
-													.image {
-														width: 100%;
-														height: 100%;
-														border-radius: 5px;
-													}
-												}
-
-												.market_2 {
-													width: 55vw;
-													padding: 0 0 0 2vw;
-
-													.goodsname {
-														font-size: 16px;
-														margin: 0 0 1vw 0;
-													}
-
-													.specs {
-														font-size: 14px;
-														color: #858585;
-													}
-
-													.gift {
-														margin: 0 1vw 0 0;
-														font-size: 12px;
-														color: #FFA500;
-														border: 1px solid #FFA500;
-														border-radius: 5px;
-														padding: 0 1vw;
-													}
-
-													.act {
-														font-size: 12px;
-														border: 1px solid var(--fFB1Color);
-														color: var(--fFB1Color);
-														border-radius: 5px;
-														padding: 0 1vw;
-													}
-												}
-
-												.market_3 {
-													width: 15vw;
-													text-align: right;
-
-													.price {
-														color: #ff0000;
-													}
-												}
-											}
-										}
-									}
-								}
-
-								.other {
-									padding: 0 0 2vw 0;
-									margin: 2vw 0;
-									text-align: right;
-									border-bottom: 1px solid #f1f1f1;
-
-									text {
-										font-size: 14px;
-										padding: 0 0 0 2vw;
-									}
-								}
-							}
+							.goodsList {
+								border-bottom: 1px solid #f1f1f1;
 
-							.second_2 {
-								.second_2_1 {
+								.shopname {
 									display: flex;
 									justify-content: space-between;
 									margin: 0 0 2vw 0;
 
-									.shopname {
+									.shop {
 										text:last-child {
 											padding: 0 0 0 2vw;
 										}
 									}
 
 									.status {
+										text-align: right;
 										color: var(--ff0Color);
+										margin: 0 0 1vw 0;
 									}
 								}
 
-								.second_2_2 {
-									border-bottom: 1px solid #f1f1f1;
-
-									.goods {
+								.goodsList_1 {
+									.market {
 										display: flex;
 										padding: 0 0 2vw 0;
 
-										.goods_1 {
+										.market_1 {
 											width: 20vw;
 											height: 20vw;
 
@@ -826,7 +748,7 @@
 											}
 										}
 
-										.goods_2 {
+										.market_2 {
 											width: 55vw;
 											padding: 0 0 0 2vw;
 
@@ -858,7 +780,7 @@
 											}
 										}
 
-										.goods_3 {
+										.market_3 {
 											width: 15vw;
 											text-align: right;
 
@@ -868,17 +790,17 @@
 										}
 									}
 								}
+							}
 
-								.other {
-									padding: 0 0 2vw 0;
-									margin: 2vw 0;
-									text-align: right;
-									border-bottom: 1px solid #f1f1f1;
+							.other {
+								padding: 0 0 2vw 0;
+								margin: 2vw 0;
+								text-align: right;
+								border-bottom: 1px solid #f1f1f1;
 
-									text {
-										font-size: 14px;
-										padding: 0 0 0 2vw;
-									}
+								text {
+									font-size: 14px;
+									padding: 0 0 0 2vw;
 								}
 							}