From 5ac1b1e31939e9af2ce01d77b0d05fb842278850 Mon Sep 17 00:00:00 2001 From: xyc <3422692813@qq.com> Date: Tue, 2 Sep 2025 17:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B00902?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/partner/workOrder.vue | 67 +++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/src/views/partner/workOrder.vue b/src/views/partner/workOrder.vue index 0c1f5aa..f38668a 100644 --- a/src/views/partner/workOrder.vue +++ b/src/views/partner/workOrder.vue @@ -490,20 +490,29 @@ append-to-body > - + {{ goodsPrice / 100 }} + 单位:元 - + + + :min="0" + :max="goodsPrice / 100" + @change="jisuan" + placeholder="请输入优惠金额"> + +
+ 可输入范围:0 - {{ goodsPrice / 100 }} 元 +
- - + + + + @@ -1009,14 +1018,21 @@ - + + @change="batchJisuan" + style="width: 100%;" + > + + +
+ 可输入范围:0 - {{ settleForm.goodsPrice }} 元 +
this.goodsPrice / 100) { - this.reduceMoney = this.goodsPrice / 100; + // 修复后的计算逻辑 + const goodsPriceYuan = this.goodsPrice / 100; + + // 确保优惠金额不超过商品价格 + if (this.reduceMoney > goodsPriceYuan) { + this.reduceMoney = goodsPriceYuan; } - this.payMoney = this.goodsPrice / 100 - this.reduceMoney; + + // 计算实付金额,确保不低于0 + this.payMoney = Math.max(0, goodsPriceYuan - this.reduceMoney); }, jisuanSetlementMoney() { console.log('执行了算') @@ -1564,11 +1586,18 @@ export default { this.settlementForm.settlementAmount = this.settlementForm.goodsPrice / 100 - this.settlementForm.settlementReduceMoney; }, batchJisuan() { + // 确保优惠金额不超过商品价格 if (this.settleForm.reduceMoney > this.settleForm.goodsPrice) { this.settleForm.reduceMoney = this.settleForm.goodsPrice; } - this.settleForm.realPayMoney = - this.settleForm.goodsPrice - this.settleForm.reduceMoney; + + // 计算实付金额 + this.settleForm.realPayMoney = this.settleForm.goodsPrice - this.settleForm.reduceMoney; + + // 确保实付金额不为负数 + if (this.settleForm.realPayMoney < 0) { + this.settleForm.realPayMoney = 0; + } }, tijiao() { console.log(this.fileUrls);