zs %!s(int64=2) %!d(string=hai) anos
pai
achega
a6e31c7a1f
Modificáronse 2 ficheiros con 47 adicións e 3 borrados
  1. 1 1
      pages/index/index.vue
  2. 46 2
      pagesMy/order/service.vue

+ 1 - 1
pages/index/index.vue

@@ -47,7 +47,7 @@
 							data: res,
 							success: function() {
 								uni.redirectTo({
-									// url: `/pages/home/index`
+									url: `/pages/home/index`
 									// url: `/pagesMy/order/info`
 								})
 							}

+ 46 - 2
pagesMy/order/service.vue

@@ -24,6 +24,12 @@
 							<view class="num">
 								×{{info.buy_num}}
 							</view>
+							<!-- <view class="num">
+								{{moneyInfo.goodsTotal}}
+							</view>
+							<view class="num">
+								{{moneyInfo.buy_num}}
+							</view> -->
 						</view>
 					</view>
 				</view>
@@ -36,11 +42,18 @@
 							<view>{{form.goods_name||'请选择退款商品'}}</view>
 						</picker>
 					</uni-forms-item>
-					<uni-forms-item label="售后类型" name="type">
+					<uni-forms-item label="售后类型" name="type" v-if="info._id">
 						<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="money" v-if="form.type=='0'||form.type=='2'">
+						<view class="money">
+							最大退款金额不能超过{{moneyInfo.payTotal||'暂无'}}
+						</view>
+						<uni-easyinput type="digit" v-model="form.money" @input="toMoney" aceholder="请输入退款金额">
+						</uni-easyinput>
+					</uni-forms-item>
 					<uni-forms-item label="申请理由" name="reason">
 						<picker class="picker" mode="selector" :range="reasonList" @change="reasonChange"
 							range-key="label">
@@ -75,6 +88,7 @@
 				// 商品详情
 				info: {},
 				form: {},
+				moneyInfo: {},
 				// 退货商品
 				goodsList: [],
 				icon: [],
@@ -113,14 +127,44 @@
 			await that.watchLogin();
 		},
 		methods: {
+			// 退款金额
+			toMoney(e) {
+				const that = this;
+				let input = e.detail.value
+				let money = that.moneyInfo.payTotal
+				if (input < money) {
+					uni.showToast({
+						title: '可以'
+					})
+				} else {
+					uni.showToast({
+						title: '不可以'
+					})
+				}
+			},
 			// 选择售后类型
-			typeChange(e) {
+			async typeChange(e) {
 				const that = this;
 				let data = that.typeList[e.detail.value];
 				if (data) {
 					that.$set(that.form, `type`, data.value);
 					that.$set(that.form, `type_name`, data.label);
 				}
+				if (data.value != '2') {
+					const arr = await that.$api(`/afterSale/cgfr`, 'POST', {
+						order_detail: that.id,
+						goods_id: that.info._id
+					});
+					if (arr.errcode == '0') {
+						that.$set(that, `moneyInfo`, arr.data);
+					} else {
+						uni.showToast({
+							title: arr.errmsg,
+							icon: 'none',
+						})
+					}
+				}
+
 			},
 			// 退款商品
 			goodsChange(e) {