zs 2 years ago
parent
commit
163e8836fd
3 changed files with 106 additions and 51 deletions
  1. 45 39
      pagesMy/order/after.vue
  2. 39 0
      pagesMy/order/detail.vue
  3. 22 12
      pagesMy/order/index.vue

+ 45 - 39
pagesMy/order/after.vue

@@ -20,7 +20,8 @@
 										</view>
 									</view>
 									<view class="list_2">
-										<image class="image" :src="item.url&&item.url.length>0?item.url[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">
@@ -29,7 +30,7 @@
 											<view class="other_1">
 												商品规格:<text>{{item.goods.name||'暂无'}}</text>
 											</view>
-											<view class="other_1" v-if="item.type!='2'">
+											<view class="other_1" v-if="item.type!='3'">
 												退款:<text>¥{{item.money||0}}</text>
 											</view>
 											<view class="other_1">
@@ -38,13 +39,19 @@
 											<view class="other_1">
 												售后描述:<text>{{item.desc||'暂无'}}</text>
 											</view>
+											<view class="other_1">
+												售后类型:<text>{{item.zhStatus||'暂无'}}</text>
+											</view>
 											<view class="other_1">
 												售后处理人:<text>{{item.deal_person.name||'暂无'}}</text>
 											</view>
 										</view>
 									</view>
 									<view class="btn">
-										<button v-if="item.status=='0'||item.status=='1'" type="default" size="mini" @tap.stop="toCancel(item)">取消售后</button>
+										<button v-if="item.status=='0'" type="default" size="mini"
+											@tap.stop="toCancel(item)">取消售后</button>
+										<button v-if="item.type!='1'&&item.status=='-2'||item.status=='-3'"
+											type="default" size="mini" @tap.stop="toMaintain(item)">维护单号</button>
 									</view>
 								</view>
 								<view class="is_bottom" v-if="is_bottom">
@@ -70,41 +77,20 @@
 				// 系统设置
 				config: {},
 				user: {},
-				list: [],
+				// 售后类型
 				typeList: [],
+				// 售后状态
+				statusList: [],
+				tabs: {
+					active: '0',
+					menu: []
+				},
+				type: '1',
+				list: [],
 				total: 0,
 				skip: 0,
 				limit: 10,
 				page: 0,
-				tabs: {
-					active: '0',
-					menu: [{
-							title: '申请售后',
-							active: '0'
-						},
-						{
-							title: '正在处理退款',
-							active: '1'
-						},
-						{
-							title: '已退款',
-							active: '-1'
-						},
-						{
-							title: '已退货',
-							active: '-2'
-						},
-						{
-							title: '正在处理换货',
-							active: '3'
-						},
-						{
-							title: '已换货',
-							active: '-3'
-						}
-					]
-				},
-				status: '0',
 				// 数据是否触底
 				is_bottom: false,
 				scrollTop: 0,
@@ -160,16 +146,18 @@
 			async search() {
 				const that = this;
 				let user = that.user;
-				let status = that.status;
+				let type = that.type;
 				const arr = await that.$api(`/afterSale`, 'GET', {
 					customer: user._id,
-					status: that.status,
+					type: that.type,
 				});
 				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;
+						let status = that.statusList.find(i => i.value == val.status)
+						if (status) val.zhStatus = status.label;
 						val.url = val?.goods?.goods?.file;
 					}
 					that.$set(that, `list`, list)
@@ -189,6 +177,19 @@
 				});
 				if (res.errcode == '0') {
 					that.$set(that, `typeList`, res.data)
+					var menu = res.data.map((item) => {
+						return {
+							title: item.label,
+							active: item.value
+						}
+					})
+					that.$set(that.tabs, `menu`, menu)
+				}
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "afterSale_status"
+				});
+				if (res.errcode == '0') {
+					that.$set(that, `statusList`, res.data)
 				}
 			},
 			// 分页
@@ -220,7 +221,7 @@
 			tabsChange(e) {
 				const that = this;
 				that.$set(that.tabs, `active`, e.active)
-				that.$set(that, `status`, e.active);
+				that.$set(that, `type`, e.active);
 				that.clearPage();
 				that.search()
 			},
@@ -230,18 +231,24 @@
 					url: `/pagesMy/order/info?id=${item.order_detail._id}&status=${item.order_detail.status}`
 				})
 			},
+			// 维护单号
+			toMaintain(item) {
+				uni.navigateTo({
+					url: `/pagesMy/order/detail?id=${item._id}`
+				})
+			},
 			// 取消售后
 			toCancel(e) {
 				const that = this;
 				uni.showModal({
 					title: '提示',
-					content: '确定删除售后申请吗?',
+					content: '确定取消售后申请吗?',
 					success: async function(res) {
 						if (res.confirm) {
 							const arr = await that.$api(`/afterSale/${e._id}`, 'DELETE');
 							if (arr.errcode == '0') {
 								uni.showToast({
-									title: '删除售后成功',
+									title: '取消售后成功',
 									icon: 'none'
 								})
 								that.clearPage();
@@ -277,7 +284,6 @@
 		height: 100vh;
 
 		.one {
-			// border-bottom: 1px solid var(--f85Color);
 			padding: 2vw;
 
 			input {

+ 39 - 0
pagesMy/order/detail.vue

@@ -3,6 +3,14 @@
 		<view class="info">
 			<view class="one">
 				<uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
+					<uni-forms-item label="快递类型" name="type">
+						<uni-easyinput type="text" @change="searchOther" v-model="form.type" placeholder="请输入快递类型" />
+					</uni-forms-item>
+					<uni-forms-item label="快递类型" name="customer_transport_type">
+						<picker class="picker" mode="selector" :range="typeList" @change="typeChange" range-key="label">
+							<view>{{form.type_name||'请选择快递类型'}}</view>
+						</picker>
+					</uni-forms-item>
 					<uni-forms-item label="维护快递单号" name="customer_transport_no">
 						<uni-easyinput type="text" v-model="form.customer_transport_no" placeholder="请输入快递单号" />
 					</uni-forms-item>
@@ -22,6 +30,12 @@
 				id: '',
 				form: {},
 				rules: {
+					customer_transport_type: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入快递类型',
+						}]
+					},
 					customer_transport_no: {
 						rules: [{
 							required: true,
@@ -29,6 +43,7 @@
 						}]
 					}
 				},
+				typeList: [],
 			};
 		},
 		onLoad: function(e) {
@@ -49,6 +64,12 @@
 					}
 				})
 			},
+			typeChange(e) {
+				const that = this;
+				let data = that.typeList[e.detail.value];
+				that.$set(that.form, `customer_transport_type`, data.code);
+				that.$set(that.form, `type_name`, data.label);
+			},
 			// 提交保存
 			async onSubmit(ref) {
 				const that = this;
@@ -56,6 +77,7 @@
 					let form = that.form;
 					let transport = {};
 					transport.customer_transport_no = params.customer_transport_no;
+					transport.customer_transport_type = params.customer_transport_type;
 					form.transport = transport;
 					const arr = await that.$api(`/afterSale/${that.id}`, 'POST', form);
 					if (arr.errcode == '0') {
@@ -73,6 +95,17 @@
 						})
 					}
 				})
+			},
+			// 查询其他信息
+			async searchOther(e) {
+				const that = this;
+				let res = await that.$api(`/dictData`, 'GET', {
+					code: "transport_type",
+					label: e
+				});
+				if (res.errcode == '0') {
+					that.$set(that, `typeList`, res.data);
+				}
 			}
 		}
 	}
@@ -94,6 +127,12 @@
 				border-radius: 1vw;
 			}
 
+			.picker {
+				border: 1px solid #3333;
+				border-radius: 5px;
+				padding: 2vw;
+			}
+
 			.btn {
 				text-align: center;
 

+ 22 - 12
pagesMy/order/index.vue

@@ -21,9 +21,12 @@
 													<text>{{tag.shop_name}}</text>
 												</view>
 												<view class="goodsList_1">
-													<view class="market" v-for="(tags,indexss) in tag.goods" :key="indexss">
+													<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>
+															<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">
@@ -95,13 +98,19 @@
 										</view>
 									</view>
 									<view class="btn">
-										<button v-if="item.status=='0'" size="mini" @tap.stop="toCancel(item)">取消订单</button>
+										<button v-if="item.status=='0'" size="mini"
+											@tap.stop="toCancel(item)">取消订单</button>
 										<button v-if="item.status=='0'" size="mini" @tap.stop="toPay(item)">支付</button>
-										<button v-if="item.status=='1'" size="mini" @tap.stop="toCancels(item)">取消订单</button>
-										<button v-if="item.status=='2'||item.status=='3'" size="mini" @tap.stop="toLogi(item)">查看物流</button>
-										<button v-if="item.status=='2'" size="mini" @tap.stop="toConfirm(item)">确认收货</button>
-										<button v-if="item.status=='2'" size="mini" @tap.stop="toReject(item)">拒收</button>
-										<button v-if="item.status=='3'" size="mini" @tap.stop="toAfter(item)">申请售后</button>
+										<button v-if="item.status=='1'" size="mini"
+											@tap.stop="toCancels(item)">取消订单</button>
+										<button v-if="item.status=='2'||item.status=='3'" size="mini"
+											@tap.stop="toLogi(item)">查看物流</button>
+										<button v-if="item.status=='2'" size="mini"
+											@tap.stop="toConfirm(item)">确认收货</button>
+										<button v-if="item.status=='2'" size="mini"
+											@tap.stop="toReject(item)">拒收</button>
+										<button v-if="item.status=='3'" size="mini"
+											@tap.stop="toAfter(item)">申请售后</button>
 									</view>
 								</view>
 								<view class="is_bottom" v-if="is_bottom">
@@ -180,13 +189,13 @@
 				statusList: []
 			};
 		},
-		onLoad: function(e) {
+		onLoad: async function(e) {
 			const that = this;
 			that.$set(that, `status`, e.status || '');
 			that.$set(that.tabs, `active`, e.status || '');
 			that.searchConfig();
-			that.searchOther();
-			that.watchlogin();
+			await that.searchOther();
+			await that.watchlogin();
 		},
 		onPullDownRefresh: async function() {
 			const that = this;
@@ -682,7 +691,8 @@
 								.goods_3 {
 									width: 15vw;
 									text-align: right;
-									.price{
+
+									.price {
 										color: #ff0000;
 									}
 								}