Skip to content

Commit cdef709

Browse files
committed
代码提交:
1.针对小程序中的退款数量改变时上传错误的修改提交
1 parent 67d8bb0 commit cdef709

File tree

1 file changed

+102
-114
lines changed
  • CoreCms.Net.Uni-App/CoreShop/pages/member/afterSales/submit

1 file changed

+102
-114
lines changed

CoreCms.Net.Uni-App/CoreShop/pages/member/afterSales/submit/submit.vue

Lines changed: 102 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313
<form @submit="submit">
1414
<view class="coreshop-content-top">
1515
<view class="img-list">
16-
<checkbox-group class="cart-checkbox" v-for="(item, key) in items" :key="key" @click="clickCheckBox(item)">
16+
<checkbox-group class="cart-checkbox" v-for="(item, key) in items" :key="key"
17+
@click="clickCheckBox(item)">
1718
<view class="cart-checkbox-item">
1819
<label class="uni-list-cell uni-list-cell-pd">
1920
<view class="cart-checkbox-c">
20-
<checkbox :value='item.id' :checked="item.checked"
21-
color="#FF7159" v-if="item.disabled" :disabled="item.disabled"
22-
class="checkboxNo" />
23-
<checkbox :value='item.id' :checked="item.checked"
24-
color="#FF7159" v-else />
21+
<checkbox :value='item.id' :checked="item.checked" color="#FF7159"
22+
v-if="item.disabled" :disabled="item.disabled" class="checkboxNo" />
23+
<checkbox :value='item.id' :checked="item.checked" color="#FF7159" v-else />
2524
</view>
2625
<view class="img-list-item">
2726
<u-avatar :src="item.imageUrl" mode="square" size="150" class="img-list-item-l">
@@ -321,7 +320,7 @@
321320
322321
this.itemIds = this.itemIds.concat({
323322
id: checkbox.id,
324-
nums: checkbox.nums
323+
nums: checkbox.returnNums
325324
});
326325
console.log("添加")
327326
}
@@ -359,8 +358,7 @@
359358
if (this.checkedItems.indexOf(item.id) == -1) {
360359
this.checkedItems.push(item.id)
361360
}
362-
this.items[key].checked = true;
363-
this.getReturnData();
361+
364362
},
365363
//处理退款金额光标事件
366364
refundFocus(e) {
@@ -415,126 +413,116 @@
415413
nums: nums
416414
});
417415
}
418-
if (num1 == 0) {
419-
420-
this.itemIds = this.itemIds.concat({
421-
id: k,
422-
nums: nums
423-
});
424-
425-
console.log(this.itemIds);
416+
417+
}else {
418+
this.$u.toast("您填写的数量不对!")
419+
return;
426420
}
427-
428-
429-
430-
} else {
431-
this.$u.toast("您填写的数量不对!")
432-
return;
433-
}
434421
}
422+
}
435423
}
436424
}
437-
}
438-
},
425+
},
439426
440-
//提交
441-
submit(e) {
427+
//提交
428+
submit(e) {
442429
443-
let _that = this;
444-
this.submitStatus = true;
430+
let _that = this;
431+
this.submitStatus = true;
445432
446-
//判断退款金额
447-
let reg = /^[0-9]+(.[0-9]{1,2})?$/;
448-
if (!reg.test(this.refund)) {
449-
this.$u.toast('请输入正确金额');
450-
this.submitStatus = false;
451-
return false;
452-
} else {
453-
if (this.refund > this.refundShow) {
454-
this.$u.toast('退款金额过大');
455-
this.submitStatus = false;
456-
return false;
457-
}
458-
}
459-
if (!this.isFlag) {
460-
this.$u.toast('您填写的数量不对!');
461-
this.submitStatus = false;
462-
return false;
463-
}
464-
console.log(this.itemIds)
465-
if (this.itemIds.length <= 0) {
466-
this.$u.toast('请选择要售后的商品');
467-
this.submitStatus = false;
468-
return false;
469-
}
470-
//组装数据,提交数据
471-
let data = {
472-
orderId: _that.orderId,
473-
type: _that.aftersaleType,
474-
items: _that.itemIds,
475-
images: _that.images,
476-
refund: _that.refund,
477-
reason: _that.reason
478-
};
479-
_that.$u.api.addAfterSales(data).then(res => {
480-
_that.submitStatus = false;
481-
if (res.status) {
482-
_that.$refs.uToast.show({
483-
title: '提交成功',
484-
type: 'success',
485-
callback: function() {
486-
_that.$u.route("/pages/member/order/detail/detail?orderId=" + _that
487-
.orderId)
433+
//判断退款金额
434+
let reg = /^[0-9]+(.[0-9]{1,2})?$/;
435+
if (!reg.test(this.refund)) {
436+
this.$u.toast('请输入正确金额');
437+
this.submitStatus = false;
438+
return false;
439+
} else {
440+
if (this.refund > this.refundShow) {
441+
this.$u.toast('退款金额过大');
442+
this.submitStatus = false;
443+
return false;
488444
}
489-
})
490-
} else {
491-
_that.$u.toast(res.msg);
492-
}
493-
});
494-
},
445+
}
446+
if (!this.isFlag) {
447+
this.$u.toast('您填写的数量不对!');
448+
this.submitStatus = false;
449+
return false;
450+
}
451+
console.log(this.itemIds)
452+
if (this.itemIds.length <= 0) {
453+
this.$u.toast('请选择要售后的商品');
454+
this.submitStatus = false;
455+
return false;
456+
}
457+
//组装数据,提交数据
458+
let data = {
459+
orderId: _that.orderId,
460+
type: _that.aftersaleType,
461+
items: _that.itemIds,
462+
images: _that.images,
463+
refund: _that.refund,
464+
reason: _that.reason
465+
};
466+
_that.$u.api.addAfterSales(data).then(res => {
467+
_that.submitStatus = false;
468+
if (res.status) {
469+
_that.$refs.uToast.show({
470+
title: '提交成功',
471+
type: 'success',
472+
callback: function() {
473+
_that.$u.route("/pages/member/order/detail/detail?orderId=" +
474+
_that
475+
.orderId)
476+
}
477+
})
478+
} else {
479+
_that.$u.toast(res.msg);
480+
}
481+
});
482+
},
495483
496-
//上传图片
497-
upImage() {
498-
let num = this.imageMax - this.images.length;
499-
if (num > 0) {
500-
this.$upload.uploadImage(num, res => {
501-
if (res.status) {
502-
this.images.push(res.data.src);
503-
this.$refs.uToast.show({
504-
title: res.msg,
505-
type: 'success',
506-
back: false
484+
//上传图片
485+
upImage() {
486+
let num = this.imageMax - this.images.length;
487+
if (num > 0) {
488+
this.$upload.uploadImage(num, res => {
489+
if (res.status) {
490+
this.images.push(res.data.src);
491+
this.$refs.uToast.show({
492+
title: res.msg,
493+
type: 'success',
494+
back: false
495+
});
496+
} else {
497+
this.$u.toast(res.msg);
498+
}
507499
});
508-
} else {
509-
this.$u.toast(res.msg);
510500
}
511-
});
512-
}
513-
},
514-
//删除图片
515-
delImage(e) {
516-
let newImages = [];
517-
for (var i = 0; i < this.images.length; i++) {
518-
if (this.images[i].image_id != e.image_id) {
519-
newImages.push(this.images[i]);
501+
},
502+
//删除图片
503+
delImage(e) {
504+
let newImages = [];
505+
for (var i = 0; i < this.images.length; i++) {
506+
if (this.images[i].image_id != e.image_id) {
507+
newImages.push(this.images[i]);
508+
}
509+
}
510+
this.images = newImages;
511+
},
512+
// 图片点击放大
513+
clickImg(img) {
514+
// 预览图片
515+
uni.previewImage({
516+
urls: img.split()
517+
});
520518
}
521-
}
522-
this.images = newImages;
523519
},
524-
// 图片点击放大
525-
clickImg(img) {
526-
// 预览图片
527-
uni.previewImage({
528-
urls: img.split()
529-
});
520+
onLoad(e) {
521+
this.orderId = e.orderId;
522+
this.getOrderInfo();
523+
this.getReturnData()
530524
}
531-
},
532-
onLoad(e) {
533-
this.orderId = e.orderId;
534-
this.getOrderInfo();
535-
this.getReturnData()
536525
}
537-
}
538526
</script>
539527

540528
<style lang="scss" scoped>

0 commit comments

Comments
 (0)