zs 2 роки тому
батько
коміт
ae0ef9d7c3
1 змінених файлів з 61 додано та 36 видалено
  1. 61 36
      pagesMy/order/service.vue

+ 61 - 36
pagesMy/order/service.vue

@@ -2,25 +2,27 @@
 	<mobile-frame>
 		<view class="main">
 			<view class="one">
-				<view class="list">
+				<view class="list" v-if="info._id">
 					<view class="list_1">
 						<text>退款商品</text>
 					</view>
 					<view class="list_2">
 						<view class="l">
-							<image class="image" :src="form.url&&form.url.length>0?form.url[0].url:''" mode=""></image>
+							<image class="image"
+								:src="info.goods.file&&info.goods.file.length>0?info.goods.file[0].url:''" mode="">
+							</image>
 						</view>
 						<view class="c">
 							<view class="name">
-								{{form.name}}
+								{{info.name}}
 							</view>
 						</view>
 						<view class="r">
 							<view class="price">
-								¥{{form.price}}
+								¥{{info.sell_money}}
 							</view>
 							<view class="num">
-								×{{form.buy_num}}
+								×{{info.buy_num}}
 							</view>
 						</view>
 					</view>
@@ -28,20 +30,29 @@
 			</view>
 			<view class="two">
 				<uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
+					<uni-forms-item label="退款商品" name="goods_id">
+						<picker class="picker" mode="selector" :range="goodsList" @change="goodsChange"
+							range-key="name">
+							<view>{{form.goods_name||'请选择退款商品'}}</view>
+						</picker>
+					</uni-forms-item>
 					<uni-forms-item label="售后类型" name="type">
 						<picker class="picker" mode="selector" :range="typeList" @change="typeChange" range-key="label">
-							<view>{{form.type_name||'请选择'}}</view>
+							<view>{{form.type_name||'请选择售后类型'}}</view>
 						</picker>
 					</uni-forms-item>
 					<uni-forms-item label="申请理由" name="reason">
 						<picker class="picker" mode="selector" :range="reasonList" @change="reasonChange"
 							range-key="label">
-							<view>{{form.reason_name||'请选择'}}</view>
+							<view>{{form.reason_name||'请选择申请理由'}}</view>
 						</picker>
 					</uni-forms-item>
 					<uni-forms-item v-if="form.type=='1'" label="维护快递单号" name="phone">
 						<uni-easyinput type="text" v-model="form.phone" placeholder="请输入维护快递单号" />
 					</uni-forms-item>
+					<uni-forms-item label="申请售后描述" name="desc">
+						<uni-easyinput type="textarea" v-model="form.desc" placeholder="请输入申请售后描述" />
+					</uni-forms-item>
 					<uni-forms-item label="附件" name="icon">
 						<upload :list="icon" name="icon" :count="1" @uplSuc="uplSuc" @uplDel="uplDel"></upload>
 					</uni-forms-item>
@@ -64,20 +75,11 @@
 			return {
 				id: '',
 				user: {},
-				form: {
-					shop: '官方自营店',
-					status: '3',
-					url: [{
-						name: "20220928155634.jpg",
-						uri: "/files/point/20220928155634.jpg",
-						url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
-					}],
-					name: '饮用水',
-					price: 58,
-					buy_num: 1,
-					market_num: 1,
-					money: 58
-				},
+				// 商品详情
+				info: {},
+				form: {},
+				// 退货商品
+				goodsList: [],
 				icon: [],
 				rules: {
 					type: {
@@ -86,6 +88,12 @@
 							errorMessage: '请选择售后类型',
 						}]
 					},
+					goods_id: {
+						rules: [{
+							required: true,
+							errorMessage: '请选择退款商品',
+						}]
+					},
 					reason: {
 						rules: [{
 							required: true,
@@ -93,7 +101,9 @@
 						}]
 					},
 				},
+				// 售后类型
 				typeList: [],
+				// 申请理由
 				reasonList: [],
 			};
 		},
@@ -115,6 +125,17 @@
 					that.$set(that.form, `type_name`, data.label);
 				}
 			},
+			// 退款商品
+			goodsChange(e) {
+				const that = this;
+				let data = that.goodsList[e.detail.value];
+				if (data) {
+					console.log(data);
+					that.$set(that, `info`, data);
+					that.$set(that.form, `goods_id`, data._id);
+					that.$set(that.form, `goods_name`, data.name);
+				}
+			},
 			// 选择申请理由
 			reasonChange(e) {
 				const that = this;
@@ -137,22 +158,26 @@
 				that.$set(that, `${e.name}`, arr)
 			},
 			// 提交保存
-			onSubmit(ref) {
+			async onSubmit(ref) {
 				const that = this;
 				that.$refs[ref].validate().then(async params => {
-					params.icon = that.icon
-					// const arr = await that.$api(`/user/${that.form.id}`, 'POST', params);
-					// if (arr.errcode == '0') {
-					// 	uni.showToast({
-					// 		title: `维护信息成功`,
-					// 		icon: 'success',
-					// 	});
-					// 	that.back();
-					// } else {
-					// 	uni.showToast({
-					// 		title: arr.errmsg,
-					// 	})
-					// }
+					params.file = that.icon;
+					params.order_detail = that.id;
+					const arr = await that.$api(`/afterSale`, 'POST', params);
+					if (arr.errcode == '0') {
+						uni.showToast({
+							title: `申请售后成功`,
+							icon: 'success',
+						});
+						uni.navigateBack({
+							detail: 1
+						})
+					} else {
+						uni.showToast({
+							title: arr.errmsg,
+							icon: 'none',
+						})
+					}
 				})
 			},
 			// 查询其他信息
@@ -184,7 +209,7 @@
 							if (that.id) {
 								let arr = await that.$api(`/orderDetail/${that.id}`, 'GET')
 								if (arr.errcode == '0') {
-									that.$set(that, `form`, arr.data)
+									that.$set(that, `goodsList`, arr.data.goods)
 								}
 							}
 						}