zs 2 年之前
父節點
當前提交
2bd315882b
共有 5 個文件被更改,包括 250 次插入53 次删除
  1. 5 1
      common/api.js
  2. 215 46
      pagesMy/logistics/index.vue
  3. 1 1
      pagesMy/order/afterInfo.vue
  4. 3 3
      pagesMy/order/index.vue
  5. 26 2
      pagesMy/order/info.vue

+ 5 - 1
common/api.js

@@ -4,7 +4,11 @@ const getDomain = (uri, method, type) => {
 	let system = config.system;
 	let system = config.system;
 	let url = config.serverUrl;
 	let url = config.serverUrl;
 	if (type && type == 'file') return url + `/files` + uri;
 	if (type && type == 'file') return url + `/files` + uri;
-	if (type && type == 'integral') return url + `/point/zr/v1/api` + uri;
+	if (type && type == 'integral') {
+		let integral_1 = `/point/zr/v1/api` + uri;
+		if (config.wx_dev) return url + `${config.wx_dev}` + integral_1;
+		else return url + integral_1;
+	}
 	if (uri.startsWith('/wechat/api')) return url + uri;
 	if (uri.startsWith('/wechat/api')) return url + uri;
 	else {
 	else {
 		if (system.uniPlatform == 'app') {
 		if (system.uniPlatform == 'app') {

+ 215 - 46
pagesMy/logistics/index.vue

@@ -1,35 +1,84 @@
 <template>
 <template>
 	<mobile-frame>
 	<mobile-frame>
 		<view class="main">
 		<view class="main">
-			<view class="one"></view>
-			<view class="two">
-				<view class="two_1">
-					<view class="two_1_1">
-						<text>订单状态:</text>
-						<text>{{is_check}}</text>
-					</view>
-					<view class="two_1_1">
-						<text>物流单号:</text>
-						<text>{{no}}</text>
-					</view>
+			<!-- 已收货查看选择商品物流 -->
+			<view class="first" v-if="type!='afterSale'&&type != 'integral'">
+				<view class="first_1">
+					<picker class="picker" mode="selector" :range="info.goods" @change="goodsChange"
+						range-key="goods_name">
+						<view>{{goods_name||'请选择查看物流的商品'}}</view>
+					</picker>
 				</view>
 				</view>
-				<view class="two_2">
-					<uni-section title="物流记录" type="line" padding>
-						<uni-steps :options="list" active-color="#007AFF" :active="active" direction="column" />
-					</uni-section>
+				<view class="first_2" v-if="goods_name">
+					<image class="image" :src="goods.goods_file&&goods.goods_file.length>0?goods.goods_file[0].url:''"
+						mode="">
+						<view class="other">
+							<view class="name textOver">
+								{{goods.goods_name}}
+							</view>
+							<view class="other_1 textOver">
+								<text>规格:</text>
+								<text>{{goods.name}}</text>
+							</view>
+							<view class="other_1 textOver">
+								<text>金额:</text>
+								<text>¥{{info.type=='0'?goods.sell_money:goods.group_config.money}}</text>
+							</view>
+							<view class="other_1 textOver">
+								<text>数量:</text>
+								<text>×{{goods.buy_num}}</text>
+							</view>
+						</view>
+					</image>
 				</view>
 				</view>
 			</view>
 			</view>
+			<!-- 售后,尊荣商品查看物流 -->
+			<view class="first" v-else></view>
+			<view class="second">
+				<tabs :tabs="tabs" @tabsChange="tabsChange">
+					<view class="tabsList">
+						<view class="second_1">
+							<view class="second_1_1">
+								<text>订单状态:</text>
+								<text>{{is_check}}</text>
+							</view>
+							<view class="second_1_1">
+								<text>物流单号:</text>
+								<text>{{no}}</text>
+							</view>
+						</view>
+						<view class="second_2">
+							<uni-section title="物流记录" type="line" padding>
+								<uni-steps :options="list" active-color="#007AFF" :active="active" direction="column" />
+							</uni-section>
+						</view>
+					</view>
+				</tabs>
+			</view>
 		</view>
 		</view>
 		</view>
 		</view>
 	</mobile-frame>
 	</mobile-frame>
 </template>
 </template>
 
 
 <script>
 <script>
+	import tabs from '@/components/tabs/index.vue';
 	export default {
 	export default {
+		components: {
+			tabs
+		},
 		data() {
 		data() {
 			return {
 			return {
 				id: '',
 				id: '',
+				// 类型
 				type: '',
 				type: '',
+				// 商品选择
+				goods_name: '',
+				goods: {},
+				// 标签页
+				tabs: {
+					active: '',
+					menu: []
+				},
 				user: {},
 				user: {},
 				info: {},
 				info: {},
 				is_check: '',
 				is_check: '',
@@ -55,6 +104,7 @@
 					}
 					}
 				})
 				})
 			},
 			},
+			// 查商品详情
 			async searchInfo() {
 			async searchInfo() {
 				const that = this;
 				const that = this;
 				if (that.id) {
 				if (that.id) {
@@ -63,12 +113,26 @@
 						res = await that.$api(`/zrOrder/${that.id}`, `GET`, {}, `integral`)
 						res = await that.$api(`/zrOrder/${that.id}`, `GET`, {}, `integral`)
 					} else if (that.type == 'afterSale') {
 					} else if (that.type == 'afterSale') {
 						res = await that.$api(`/afterSale/${that.id}`, `GET`)
 						res = await that.$api(`/afterSale/${that.id}`, `GET`)
+						that.$set(that.tabs, `active`, 'shop')
+						that.$set(that.tabs, `menu`, [{
+							title: '店铺物流',
+							active: 'shop',
+						}, {
+							title: '用户物流',
+							active: 'customer',
+						}])
 					} else {
 					} else {
 						res = await that.$api(`/orderDetail/${that.id}`, 'GET')
 						res = await that.$api(`/orderDetail/${that.id}`, 'GET')
 					}
 					}
 					if (res.errcode == '0') {
 					if (res.errcode == '0') {
+						if (that.type != 'afterSale' && that.type != 'integral') {
+							for (let val of res.data.goods) {
+								val.goods_name = val.goods.name;
+								val.goods_file = val.goods.file;
+							}
+						}
 						that.$set(that, `info`, res.data);
 						that.$set(that, `info`, res.data);
-						that.search();
+						if (that.type == 'afterSale' || that.type == 'integral') that.search();
 					} else {
 					} else {
 						uni.showToast({
 						uni.showToast({
 							title: res.errmsg,
 							title: res.errmsg,
@@ -77,18 +141,29 @@
 					}
 					}
 				}
 				}
 			},
 			},
+			// 查物流信息
 			async search() {
 			async search() {
 				const that = this;
 				const that = this;
 				if (that.type == 'afterSale') {
 				if (that.type == 'afterSale') {
 					let arr = await that.$api(`/afterSale/getTransportInfo/${that.info.id}`, `GET`)
 					let arr = await that.$api(`/afterSale/getTransportInfo/${that.info.id}`, `GET`)
 					if (arr.errcode == '0') {
 					if (arr.errcode == '0') {
-						that.$set(that, `is_check`, arr.data.shop.is_check);
-						let list = arr.data.shop.list.map((i) => ({
-							desc: i.time,
-							title: i.context
-						}))
-						that.$set(that, `list`, list);
-						that.$set(that, `no`, arr.data.shop.no);
+						if (that.tabs.active == 'shop') {
+							that.$set(that, `is_check`, arr.data?.shop.is_check);
+							let list = arr.data?.shop.list.map((i) => ({
+								desc: i.time,
+								title: i.context
+							}))
+							that.$set(that, `list`, list);
+							that.$set(that, `no`, arr.data?.shop.no);
+						} else {
+							that.$set(that, `is_check`, arr.data?.customer.is_check);
+							let list = arr.data?.customer.list.map((i) => ({
+								desc: i.time,
+								title: i.context
+							}))
+							that.$set(that, `list`, list);
+							that.$set(that, `no`, arr.data?.customer.no);
+						}
 					} else {
 					} else {
 						uni.showToast({
 						uni.showToast({
 							title: res.errmsg,
 							title: res.errmsg,
@@ -96,28 +171,73 @@
 						})
 						})
 					}
 					}
 				} else {
 				} else {
-					let res;
 					if (that.type == 'integral') {
 					if (that.type == 'integral') {
-						res = await that.$api(`/zrOrder/sot/${that.info._id}`, `GET`, {}, `integral`);
+						let res = await that.$api(`/zrOrder/sot/${that.info._id}`, `GET`, {}, `integral`);
+						if (res.errcode == '0') {
+							that.$set(that, `is_check`, res.data.is_check);
+							let list = res.data.list.map((i) => ({
+								desc: i.time,
+								title: i.context
+							}))
+							that.$set(that, `list`, list);
+							that.$set(that, `no`, res.data.no);
+						} else {
+							uni.showToast({
+								title: res.errmsg,
+								icon: 'none'
+							})
+						}
 					} else {
 					} else {
-						res = await that.$api(`/orderDetail/sot/${that.info._id}`, `GET`);
+						let data = that.tabs.menu.find((i) => i.no == that.tabs.active);
+						if (data) {
+							that.$set(that, `is_check`, data.is_check);
+							let list = data.list.map((i) => ({
+								desc: i.time,
+								title: i.context
+							}))
+							that.$set(that, `list`, list);
+							that.$set(that, `no`, data.no);
+						} else {
+							uni.showToast({
+								title: '暂无物流信息!',
+								icon: 'none'
+							})
+						}
 					}
 					}
-					if (res.errcode == '0') {
-						that.$set(that, `is_check`, res.data.is_check);
-						let list = res.data.list.map((i) => ({
-							desc: i.time,
-							title: i.context
-						}))
-						that.$set(that, `list`, list);
-						that.$set(that, `no`, res.data.no);
-					} else {
-						uni.showToast({
-							title: res.errmsg,
-							icon: 'none'
-						})
+
+				}
+			},
+			// 选择指定商品查信息
+			async goodsChange(e) {
+				const that = this;
+				let data = that.info.goods[e.detail.value];
+				that.$set(that, `goods`, data);
+				that.$set(that, `goods_name`, data.goods_name);
+				let res = await that.$api(`/orderDetail/sot`, `POST`, {
+					id: that.info._id,
+					goods_id: data._id
+				});
+				if (res.errcode == '0') {
+					for (let [index, item] of res.data.entries()) {
+						item.title = `物流` + index
+						item.active = item.no
 					}
 					}
+					that.$set(that.tabs, `active`, res?.data[0]?.no)
+					that.$set(that.tabs, `menu`, res.data)
+					that.search();
+				} else {
+					uni.showToast({
+						title: res.errmsg,
+						icon: 'none'
+					})
 				}
 				}
-			}
+			},
+			// 选择选项卡
+			tabsChange(e) {
+				const that = this;
+				that.$set(that.tabs, `active`, e.active)
+				that.search()
+			},
 		}
 		}
 	}
 	}
 </script>
 </script>
@@ -129,14 +249,61 @@
 		width: 100vw;
 		width: 100vw;
 		height: 100vh;
 		height: 100vh;
 
 
-		.one {
+		.first {
 			position: relative;
 			position: relative;
 			width: 100vw;
 			width: 100vw;
 			height: 100vh;
 			height: 100vh;
 			background-color: #ff0000;
 			background-color: #ff0000;
+
+			.first_1 {
+				width: 96vw;
+				padding: 2vw;
+
+				.picker {
+					border: 1px solid #3333;
+					border-radius: 5px;
+					padding: 2vw;
+					background: #fff;
+				}
+			}
+
+			.first_2 {
+				display: flex;
+				width: 92vw;
+				background-color: #fff;
+				padding: 2vw;
+				margin: 0 2vw;
+				border-radius: 7px;
+
+				.image {
+					width: 22vw;
+					height: 22vw;
+				}
+
+				.other {
+					width: 65vw;
+					padding: 0 0 0 2vw;
+
+					.name {
+						font-size: 16px;
+						font-weight: bold;
+					}
+
+					.other_1 {
+						text {
+							font-size: 13px;
+							color: #858585;
+						}
+
+						text:last-child {
+							color: #000000;
+						}
+					}
+				}
+			}
 		}
 		}
 
 
-		.two {
+		.second {
 			position: absolute;
 			position: absolute;
 			bottom: 0;
 			bottom: 0;
 			width: 92vw;
 			width: 92vw;
@@ -148,11 +315,13 @@
 			border-top-right-radius: 5px;
 			border-top-right-radius: 5px;
 			padding: 2vw;
 			padding: 2vw;
 
 
-			.two_1 {
-				margin: 0 0 2vw 0;
+			.tabsList {
+				.second_1 {
+					margin: 0 0 2vw 0;
 
 
-				.two_1_1 {
-					padding: 1vw 0;
+					.second_1_1 {
+						padding: 1vw 0;
+					}
 				}
 				}
 			}
 			}
 		}
 		}

+ 1 - 1
pagesMy/order/afterInfo.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
 	<mobile-frame>
 	<mobile-frame>
 		<view class="main">
 		<view class="main">
-			<view class="goods">
+			<view class="goods" v-if="info.goods">
 				<view class="url">
 				<view class="url">
 					<image class="image"
 					<image class="image"
 						:src="info.goods.goods.file&&info.goods.goods.file.length>0?info.goods.goods.file[0].url:''"
 						:src="info.goods.goods.file&&info.goods.goods.file.length>0?info.goods.goods.file[0].url:''"

+ 3 - 3
pagesMy/order/index.vue

@@ -105,12 +105,12 @@
 										<button v-if="item.status=='0'" size="mini" @tap.stop="toPay(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"
 										<button v-if="item.status=='1'&&item.is_afterSale!=true" size="mini"
 											@tap.stop="toCancels(item)">取消订单</button>
 											@tap.stop="toCancels(item)">取消订单</button>
-										<button v-if="item.status=='2'||item.status=='3'" size="mini"
+										<button v-if="item.status=='2'||item.status=='3'||item.status=='2-'" size="mini"
 											@tap.stop="toLogi(item)">查看物流</button>
 											@tap.stop="toLogi(item)">查看物流</button>
 										<button v-if="item.status=='2'&&item.is_afterSale!=true" size="mini"
 										<button v-if="item.status=='2'&&item.is_afterSale!=true" size="mini"
 											@tap.stop="toConfirm(item)">确认收货</button>
 											@tap.stop="toConfirm(item)">确认收货</button>
-										<button v-if="item.status=='2'&&item.is_afterSale!=true" size="mini"
-											@tap.stop="toReject(item)">拒收</button>
+										<button v-if="item.status=='2'||item.status=='2-'&&item.is_afterSale!=true"
+											size="mini" @tap.stop="toReject(item)">拒收</button>
 										<button v-if="item.status=='3'" size="mini"
 										<button v-if="item.status=='3'" size="mini"
 											@tap.stop="toAfter(item)">申请售后</button>
 											@tap.stop="toAfter(item)">申请售后</button>
 										<button v-if="item.status=='3'" type="default" size="mini"
 										<button v-if="item.status=='3'" type="default" size="mini"

+ 26 - 2
pagesMy/order/info.vue

@@ -103,7 +103,7 @@
 							</view>
 							</view>
 							<view class="thr_1">
 							<view class="thr_1">
 								<text>实付金额</text>
 								<text>实付金额</text>
-								<text>¥{{info.total_detail.freight_total+info.total_detail.goods_total}}</text>
+								<text>¥{{info.goods_total}}</text>
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="four">
 						<view class="four">
@@ -129,7 +129,7 @@
 			</view>
 			</view>
 			<view class="zero_1">
 			<view class="zero_1">
 				<text>合计</text>
 				<text>合计</text>
-				<text>¥{{info.total_detail.freight_total+info.total_detail.goods_total}}</text>
+				<text>¥{{info.goods_total}}</text>
 			</view>
 			</view>
 		</view>
 		</view>
 	</mobile-frame>
 	</mobile-frame>
@@ -171,6 +171,30 @@
 				if (res.errcode == '0') {
 				if (res.errcode == '0') {
 					let status = that.statusList.find(i => i.value == res.data.status)
 					let status = that.statusList.find(i => i.value == res.data.status)
 					if (status) res.data.zhStatus = status.label;
 					if (status) res.data.zhStatus = status.label;
+					// 计算优惠劵
+					if (res.data?.total_detail?.discount_detail) {
+						// 有优惠券
+						var key = Object.keys(res.data.total_detail.discount_detail);
+						var discount_detail = 0;
+						for (let val of key) {
+							for (let var1 in res.data.total_detail.discount_detail[val]) {
+								// object取key和value
+								if (Object.hasOwnProperty.call(res.data.total_detail.discount_detail[val], var1)) {
+									var value = res.data.total_detail.discount_detail[val][var1]
+									discount_detail = that.$plus(discount_detail, value)
+								}
+							}
+						}
+						// 运费总数和商品总数相加
+						let total = that.$plus(res.data.total_detail.freight_total, res.data.total_detail
+							.goods_total)
+						// 优惠劵相减
+						res.data.goods_total = that.$minus(total, discount_detail);
+					} else {
+						// 无优惠劵
+						res.data.goods_total = that.$plus(res.data.total_detail.freight_total, res.data.total_detail
+							.goods_total)
+					}
 					that.$set(that, `info`, res.data);
 					that.$set(that, `info`, res.data);
 					uni.hideLoading();
 					uni.hideLoading();
 				}
 				}