zs 2 years ago
parent
commit
5320f50a00
1 changed files with 42 additions and 15 deletions
  1. 42 15
      pagesMy/order/service.vue

+ 42 - 15
pagesMy/order/service.vue

@@ -200,22 +200,49 @@
 			async onSubmit(ref) {
 				const that = this;
 				that.$refs[ref].validate().then(async params => {
-					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
-						})
+					if (params.type != '2') {
+						if (params.money) {
+							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',
+								})
+							}
+						} else {
+							uni.showToast({
+								title: `请输入退款金额`,
+								icon: 'none',
+							});
+						}
 					} else {
-						uni.showToast({
-							title: arr.errmsg,
-							icon: 'none',
-						})
+						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',
+							})
+						}
 					}
 				})
 			},