From 58db28edfb8c84b8246c71746c48d0adec5872c2 Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Wed, 22 Nov 2023 18:10:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HangBillServiceImpl.java | 5 +- .../views/cashier/NewComponents/credit.vue | 98 ++- .../views/cashier/NewComponents/homeindex.vue | 588 +++++++++--------- 3 files changed, 375 insertions(+), 316 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HangBillServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HangBillServiceImpl.java index dc997e33c..0248e0566 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HangBillServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HangBillServiceImpl.java @@ -115,6 +115,9 @@ public class HangBillServiceImpl extends ServiceImpl i @Override public HangBill updateHangBill(Map map) { + HangBill hangBill1 = this.selectHangBillByOrderNo(map.get("orderNo")); + hangBill1.setPayStatus("unpaid"); + baseMapper.updateById(hangBill1); String payType = map.get("payType"); // 调用支付接口 this.pay(map); @@ -214,7 +217,7 @@ public class HangBillServiceImpl extends ServiceImpl i map1.put("publicKey",merchantConfig.getPublicKey()); map1.put("privateKey",merchantConfig.getPrivateKey()); try { - fyPayService.pay(map); + fyPayService.pay(map1); }catch (Exception e){ e.printStackTrace(); } diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue index 6f8103070..d019a52c5 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue @@ -1,6 +1,6 @@ + + - - {{ item.dictLabel }} - + + + + + + + + {{ item.dictLabel }} @@ -416,23 +427,39 @@ ¥{{ payAmount }}
请自行核实归还金额,提交完成后将自动处理
-
- - - - - +
+
+ + + + + +
+
+
+ +
+
-
-
- +
+
+ + +
+
+ 应找零 + ¥{{ seekZero }}
@@ -562,7 +589,8 @@ - + { + console.log(response) if (response.data==null){ }else { @@ -848,7 +894,7 @@ import {getDicts} from "@/api/dict/data"; _this.isPay = false; clearInterval(_this.timer); } - },500) + },1000) setTimeout(function (){ _this.loading = false; clearInterval(timer); diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index 485ea47cd..5d6205b9b 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -66,7 +66,7 @@
{{item.type}}
-
-¥{{ fullReduction }}
+
-¥{{ item.reduce }}
满{{ item.full }}元,打{{ item.discount }}折
满{{ item.full }}元,减{{ item.reduce }}元
@@ -103,46 +103,25 @@
-¥{{ oilDiscount }}
消费满{{ item.full }}元,立减{{ item.reduce }}元
-
消费满{{ item.full }}元,每升优惠{{ item.reduce }}元
+
消费满{{ item.full }}元,每升优惠{{ item.liters }}元
- - + 等级优惠
-
-¥{{ oilDiscount + goodsDiscount }}
+
-¥{{ oilDiscount }}
- - - - - - - - - - - - - - - - - - - - - @@ -158,27 +137,6 @@
- - - - - - - - - - - - - - - - - - - - - @@ -187,14 +145,14 @@
-¥{{ consumeAmount }}
-
+
- +
{{item.name}}
@@ -207,10 +165,10 @@
- - + 优惠券
@@ -248,7 +206,7 @@
¥{{ oilActualPay + goodsActualPay }}
优惠合计:{{ oilDiscount + goodsDiscount }}元/{{consumeRefuelMoney}}L
-
立即结算
+ 立即结算
@@ -282,22 +240,30 @@ {{ item.tankName }}
+ + + + + + + +
-
-
11
+ + -
1号枪
-
- - - - - - - -
-
+ + + + + + + + + + + @@ -863,8 +829,10 @@ seekZero:0, // 等待中 loading:false, - // 油品类型 + // 油号 oilType:'', + // 油品类型 + type:"", // 取单列表 takeList:[], // 挂单备注检索 @@ -912,7 +880,7 @@ // 查询的商品信息 goods:"", select:"元", - form:{ amount : 0 }, + form:{ amount : 0,exist:false }, form1:{}, form2:{ unitName:"", @@ -1044,6 +1012,9 @@ isUseFull:false, // 是否为储值卡互斥 isUseBalance:false, + // 互斥限制 -1没有限制 0满减互斥 1储值卡互斥 + exclusion:-1, + isExistOilOrder:false, // 查询优惠活动信息所需参数 preferentialData:{ userId:"", @@ -1194,64 +1165,86 @@ }, // 选择优惠信息 handleCheckAllChange1(val) { + if (this.exclusion == 0){ + if (val){ + this.checkAll5 = false; + this.couponAmount = 0; + } + } let list = [] this.fullReduceDiscount.forEach(item => { list.push(item.type) }) if (val){ + this.fullReduction = 0; this.fullReduceDiscount.forEach(item => { - if (item.discount!=0){ - this.fullReduction = this.oilAmount - (this.oilAmount * item.discount).toFixed(2) - }else { - this.fullReduction = item.reduce - } + this.fullReduction += item.reduce }) - + this.isUseFull = false; }else { this.fullReduction = 0; - this.getGrade(this.member.id) + this.isUseFull = true; } this.checkedCities1 = val ? list : []; this.isIndeterminate1 = false; + this.isExclusion(); }, handleCheckedCitiesChange1(value) { + this.fullReduction = 0; + this.fullReduceDiscount.forEach(item => { + let reduces = 0 + for (let i = 0; i < value.length; i++){ + if (item.type == value[i]){ + reduces = item.reduce + } + } + this.fullReduction += reduces + }) let checkedCount = value.length; this.checkAll1 = checkedCount === this.fullReduceDiscount.length; this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.fullReduceDiscount.length; + this.isExclusion(); }, handleCheckAllChange2(val) { let list = [] this.gradeDiscount.forEach(item => { list.push(item.type) }) + if (val){ + this.gradeDiscount.forEach(item => { + this.oilDiscount += +item.reduce + }) + }else { + this.oilDiscount = 0 + } this.checkedCities2 = val ? list : []; this.isIndeterminate2 = false; + this.isExclusion(); }, handleCheckedCitiesChange2(value) { + this.oilDiscount = 0 + this.gradeDiscount.forEach(item => { + let reduces = 0 + for (let i = 0; i < value.length; i++){ + if (item.type == value[i]){ + reduces = item.reduce + } + } + this.oilDiscount += +reduces + }) let checkedCount = value.length; this.checkAll2 = checkedCount === this.gradeDiscount.length; this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length; + this.isExclusion(); }, handleCheckAllChange3(val) { if (val==false){ - this.consumeAmount = 0; - if (this.isUseFull){ - this.countAmountFull() - return; - }else { - this.countAmountBalance() - return; - } - if (this.isUseBalance){ - this.countAmountUnBalance() - return; - }else { - this.countAmountBalance() - return; - } + this.consumeRefuelMoney = 0; + this.hoardAmount = 0; }else { this.changeRefuelMoney() } + this.isExclusion(); }, handleCheckedCitiesChange3(value) { let checkedCount = value.length; @@ -1261,21 +1254,11 @@ handleCheckAllChange4(val) { if (val==false){ this.consumeAmount = 0; - if (this.isUseFull){ - this.countAmountFull() - return; - }else { - this.countAmountBalance() - return; - } - if (this.isUseBalance){ - this.countAmountUnBalance() - return; - }else { - this.countAmountBalance() - return; - } + this.isUseBalance = true; + }else { + this.isUseBalance = false; } + this.isExclusion(); }, handleCheckedCitiesChange4(value) { let checkedCount = value.length; @@ -1283,6 +1266,23 @@ this.isIndeterminate4 = checkedCount > 0 && checkedCount < this.cities4.length; }, handleCheckAllChange5(val) { + if (this.exclusion == 0){ + if (val){ + this.checkAll1 = false; + this.fullReduction = 0; + this.isUseFull = true; + }else { + this.isUseFull = false; + } + }else if (this.exclusion == 0){ + if (val){ + this.checkAll4 = false; + this.consumeAmount = 0; + this.isUseBalance = true; + }else { + this.isUseBalance = false; + } + } let list = [] this.couponDiscount.forEach(item => { list.push(item.name) @@ -1297,17 +1297,23 @@ } this.checkedCities5 = val ? list : []; this.isIndeterminate5 = false; + this.isExclusion(); }, handleCheckedCitiesChange5(value) { this.couponAmount = 0; - for (let i = 0; i < this.couponDiscount.length; i++){ - if (this.couponDiscount[i].name == value[i]){ - this.couponAmount += this.couponDiscount[i].reduce + this.couponDiscount.forEach(item => { + let reduces = 0 + for (let i = 0; i < value.length; i++){ + if (item.name == value[i]){ + reduces = item.reduce + } } - } + this.couponAmount += reduces + }) let checkedCount = value.length; this.checkAll5 = checkedCount === this.couponDiscount.length; this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.couponDiscount.length; + this.isExclusion(); }, // 模糊查询商品信息 querySearch(queryString, cb) { @@ -1391,65 +1397,73 @@ let gasolineDiscount = 0; let dieselDiscount = 0; let naturalGasDiscount = 0; + _this.gradeDiscount = []; _this.oilOrder.forEach(item => { - if (item.oilType == "汽油"){ + let discount = {type:"",full:0,reduce:0,liters:0} + if (item.type == "汽油"){ let gasolineRule = JSON.parse(response.data.gasolineRule); if (response.data.preferential == '自定义优惠' && response.data.status == 'qy'){ if (response.data.gasolineDiscount=="满减优惠"){ let oilDiscount = 0; - let discount = {type:"满减优惠",full:0,reduce:0} + discount.type = "满减优惠" for (let i = 1; i <= gasolineRule.length; i++){ // 将满减条件加入等级优惠列表 - discount.full = gasolineRule[i-1].gasolineRule1 if (gasolineRule.length>1){ if (item.amount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ - oilDiscount = (item.amount/gasolineRule[gasolineRule.length-1].gasolineRule1 * - gasolineRule[gasolineRule.length-1].gasolineRule2).toFixed(2); - discount.reduce = gasolineRule[i-1].gasolineRule2 + discount.full = gasolineRule[gasolineRule.length-1].gasolineRule1 + oilDiscount = gasolineRule[gasolineRule.length-1].gasolineRule2 + discount.reduce = gasolineRule[gasolineRule.length-1].gasolineRule2 break; } if (item.amount >= gasolineRule[i-1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1){ - oilDiscount = (item.amount/gasolineRule[i-1].gasolineRule1 * gasolineRule[i-1].gasolineRule2).toFixed(2) + discount.full = gasolineRule[i-1].gasolineRule1 + oilDiscount = gasolineRule[i-1].gasolineRule2 discount.reduce = gasolineRule[i-1].gasolineRule2 } }else { if (item.amount >= gasolineRule[i-1].gasolineRule1){ - oilDiscount = (item.amount/gasolineRule[i-1].gasolineRule1 * gasolineRule[i-1].gasolineRule2).toFixed(2); + discount.full = gasolineRule[i-1].gasolineRule1 + oilDiscount = gasolineRule[i-1].gasolineRule2 discount.reduce = gasolineRule[i-1].gasolineRule2 } } } if (discount.reduce!=0){ _this.gradeDiscount.push(discount) - _this.checkedCities2 = ['满减优惠'] + _this.checkedCities2.push('满减优惠') } gasolineDiscount += +oilDiscount }else if (response.data.gasolineDiscount=="每升优惠"){ - let discount = {type:"每升优惠",full:0,reduce:0} + discount.type = "每升优惠" let oilDiscount = 0; for (let i = 1; i <= gasolineRule.length; i++){ // 将满减条件加入等级优惠列表 - discount.full = gasolineRule[i-1].gasolineRule1 if (gasolineRule.length>1){ if (item.amount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ + discount.full = gasolineRule[gasolineRule.length-1].gasolineRule1 oilDiscount = (item.liters * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2); - discount.reduce = gasolineRule[i-1].gasolineRule3 + discount.reduce = (item.liters * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2); + discount.liters = gasolineRule[i-1].gasolineRule3 break; } if (item.amount >= gasolineRule[i-1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1){ + discount.full = gasolineRule[i-1].gasolineRule1 oilDiscount = (item.liters * gasolineRule[i-1].gasolineRule3).toFixed(2) - discount.reduce = gasolineRule[i-1].gasolineRule3 + discount.reduce = (item.liters * gasolineRule[i-1].gasolineRule3).toFixed(2) + discount.liters = gasolineRule[i-1].gasolineRule3 } }else { if (item.amount >= gasolineRule[i-1].gasolineRule1){ + discount.full = gasolineRule[i-1].gasolineRule1 oilDiscount = (item.liters * gasolineRule[i-1].gasolineRule3).toFixed(2) - discount.reduce = gasolineRule[i-1].gasolineRule3 + discount.reduce = (item.liters * gasolineRule[i-1].gasolineRule3).toFixed(2) + discount.liters = gasolineRule[i-1].gasolineRule3 } } } if (discount.reduce!=0){ _this.gradeDiscount.push(discount) - _this.checkedCities2 = ['每升优惠'] + _this.checkedCities2.push('每升优惠') } gasolineDiscount += +oilDiscount }else { @@ -1457,65 +1471,70 @@ } } } - if (item.oilType == "柴油"){ + if (item.type == "柴油"){ let dieselRule = JSON.parse(response.data.dieselRule); if (response.data.preferential == '自定义优惠' && response.data.status == 'qy'){ if (response.data.dieselDiscount=="满减优惠"){ let oilDiscount = 0; - let discount = {type:"满减优惠",full:0,reduce:0} + discount.type = "满减优惠" for (let i = 1; i <= dieselRule.length; i++){ // 将满减条件加入等级优惠列表 - discount.full = dieselRule[i-1].dieselRule1 if (dieselRule.length>1){ if (item.amount >= dieselRule[dieselRule.length-1].dieselRule1){ - oilDiscount = (item.amount/dieselRule[dieselRule.length-1].dieselRule1 * - dieselRule[dieselRule.length-1].dieselRule2).toFixed(2); - discount.reduce = dieselRule[i-1].dieselRule2 + discount.full = dieselRule[dieselRule.length-1].dieselRule1 + oilDiscount = dieselRule[dieselRule.length-1].dieselRule2 + discount.reduce = dieselRule[dieselRule.length-1].dieselRule2 break; } if (item.amount >= dieselRule[i-1].dieselRule1 && item.amount < dieselRule[i].dieselRule1){ - oilDiscount = (item.amount/dieselRule[i-1].dieselRule1 * dieselRule[i-1].dieselRule2).toFixed(2); + discount.full = dieselRule[i-1].dieselRule1 + oilDiscount = dieselRule[i-1].dieselRule2 discount.reduce = dieselRule[i-1].dieselRule2 } }else { + discount.full = dieselRule[i-1].dieselRule1 if (item.amount >= dieselRule[i-1].dieselRule1){ - oilDiscount = (item.amount/dieselRule[i-1].dieselRule1 * dieselRule[i-1].dieselRule2).toFixed(2); + oilDiscount = dieselRule[i-1].dieselRule2 discount.reduce = dieselRule[i-1].dieselRule2 } } } if (discount.reduce!=0){ _this.gradeDiscount.push(discount) - _this.checkedCities2 = ['满减优惠'] + _this.checkedCities2.push('满减优惠') } dieselDiscount += +oilDiscount }else if (response.data.dieselDiscount=="每升优惠"){ let oilDiscount = 0; - let discount = {type:"每升优惠",full:0,reduce:0} for (let i = 1; i <= dieselRule.length; i++){ + discount.type = "每升优惠" // 将满减条件加入等级优惠列表 - discount.full = dieselRule[i-1].dieselRule1 - _this.gradeDiscount.push(discount) if (dieselRule.length>1){ if (item.amount >= dieselRule[dieselRule.length-1].dieselRule1){ - oilDiscount = (item.liters * dieselRule[gasolineRule.length-1].dieselRule3).toFixed(2); - discount.reduce = dieselRule[i-1].dieselRule3 + discount.full = dieselRule[dieselRule.length-1].dieselRule1 + oilDiscount = (item.liters * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2); + discount.reduce = (item.liters * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2); + discount.liters = dieselRule[dieselRule.length-1].dieselRule3 break; } if (item.amount >= dieselRule[i-1].dieselRule1 && item.amount < dieselRule[i].dieselRule1){ + discount.full = dieselRule[i-1].dieselRule1 oilDiscount = (item.liters * dieselRule[i-1].dieselRule3).toFixed(2) - discount.reduce = dieselRule[i-1].dieselRule3 + discount.reduce = (item.liters * dieselRule[i-1].dieselRule3).toFixed(2) + discount.liters = dieselRule[i-1].dieselRule3 } }else { + discount.full = dieselRule[i-1].dieselRule1 if (item.amount >= dieselRule[i-1].dieselRule1){ oilDiscount = (item.liters * dieselRule[i-1].dieselRule3).toFixed(2) - discount.reduce = dieselRule[i-1].dieselRule3 + discount.reduce = (item.liters * dieselRule[i-1].dieselRule3).toFixed(2) + discount.liters = dieselRule[i-1].dieselRule3 } } } if (discount.reduce!=0){ _this.gradeDiscount.push(discount) - _this.checkedCities2 = ['每升优惠'] + _this.checkedCities2.push('每升优惠') } dieselDiscount += +oilDiscount }else { @@ -1523,64 +1542,70 @@ } } } - if (item.oilType == "天然气"){ + if (item.type == "天然气"){ let naturalGasRule = JSON.parse(response.data.naturalGasRule); if (response.data.preferential == '自定义优惠' && response.data.status == 'qy'){ if (response.data.naturalGasDiscount=="满减优惠"){ let oilDiscount = 0; - let discount = {type:"满减优惠",full:0,reduce:0} + discount.type = "满减优惠" for (let i = 1; i <= naturalGasRule.length; i++){ // 将满减条件加入等级优惠列表 - discount.full = naturalGasRule[i-1].naturalGasRule1 if (naturalGasRule.length>1){ if (item.amount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ - oilDiscount = (item.amount/naturalGasRule[naturalGasRule.length-1].naturalGasRule1 * - naturalGasRule[naturalGasRule.length-1].naturalGasRule2).toFixed(2); - discount.reduce = naturalGasRule[i-1].naturalGasRule2 + discount.full = naturalGasRule[naturalGasRule.length-1].naturalGasRule1 + oilDiscount = naturalGasRule[naturalGasRule.length-1].naturalGasRule2; + discount.reduce = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 break; } if (item.amount >= naturalGasRule[i-1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1){ - oilDiscount = (item.amount/naturalGasRule[i-1].naturalGasRule1 * naturalGasRule[i-1].naturalGasRule2).toFixed(2); + discount.full = naturalGasRule[i-1].naturalGasRule1 + oilDiscount = naturalGasRule[i-1].naturalGasRule2 discount.reduce = naturalGasRule[i-1].naturalGasRule2 } }else { if (item.amount >= naturalGasRule[i-1].naturalGasRule1){ - oilDiscount = (item.amount/naturalGasRule[i-1].naturalGasRule1 * naturalGasRule[i-1].naturalGasRule2).toFixed(2); + discount.full = naturalGasRule[i-1].naturalGasRule1 + oilDiscount = naturalGasRule[i-1].naturalGasRule2 discount.reduce = naturalGasRule[i-1].naturalGasRule2 } } } if (discount.reduce!=0){ _this.gradeDiscount.push(discount) - _this.checkedCities2 = ['满减优惠'] + _this.checkedCities2.push('满减优惠') } naturalGasDiscount += +oilDiscount }else if (response.data.naturalGasDiscount=="每单位优惠"){ let oilDiscount = 0; - let discount = {type:"每单位优惠",full:0,reduce:0} + discount.type = "每单位优惠" for (let i = 1; i <= naturalGasRule.length; i++){ // 将满减条件加入等级优惠列表 - discount.full = naturalGasRule[i-1].naturalGasRule1 if (naturalGasRule.length>1){ if (item.amount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ + discount.full = naturalGasRule[naturalGasRule.length-1].naturalGasRule1 oilDiscount = (item.liters * naturalGasRule[gasolineRule.length-1].naturalGasRule3).toFixed(2) - discount.reduce = naturalGasRule[i-1].naturalGasRule3 + discount.reduce = (item.liters * naturalGasRule[gasolineRule.length-1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[naturalGasRule.length-1].naturalGasRule3 break; } if (item.amount >= naturalGasRule[i-1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1){ + discount.full = naturalGasRule[i-1].naturalGasRule1 oilDiscount = (item.liters * naturalGasRule[i-1].naturalGasRule3).toFixed(2) - discount.reduce = naturalGasRule[i-1].naturalGasRule3 + discount.reduce = (item.liters * naturalGasRule[i-1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[i-1].naturalGasRule3 } }else { if (item.amount >= naturalGasRule[i-1].naturalGasRule1){ + discount.full = naturalGasRule[i-1].naturalGasRule1 oilDiscount = (item.liters * naturalGasRule[i-1].naturalGasRule3).toFixed(2) - discount.reduce = naturalGasRule[i-1].naturalGasRule3 + discount.reduce = (item.liters * naturalGasRule[i-1].naturalGasRule3).toFixed(2) + discount.liters = naturalGasRule[i-1].naturalGasRule3 } } } if (discount.reduce!=0){ _this.gradeDiscount.push(discount) - _this.checkedCities2 = ['每单位优惠'] + _this.checkedCities2.push('每单位优惠') } naturalGasDiscount += +oilDiscount }else { @@ -1590,31 +1615,9 @@ } }) - // let oilActualPay = _this.oilActualPay; _this.oilDiscount = gasolineDiscount + dieselDiscount + naturalGasDiscount - // _this.oilActualPay = oilActualPay - _this.oilDiscount; - // 储值卡余额 - // 如果总金额为0 则表示没有使用囤油卡 - // if (oilActualPay == 0){ - // oilActualPay = _this.oilAmount - _this.oilDiscount - _this.fullReduction; - // } - // if (_this.balance>=(_this.oilAmount - _this.oilDiscount)){ - // _this.consumeAmount = _this.oilAmount - _this.oilDiscount - _this.fullReduction; - // _this.oilActualPay = 0; - // }else { - // _this.consumeAmount = _this.balance; - // _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.balance - _this.fullReduction; - // } - if (_this.isUseFull){ - _this.countAmountFull() - }else { - _this.countAmountBalance() - } - if (_this.isUseBalance){ - _this.countAmountUnBalance() - }else { - _this.countAmountBalance() - } + _this.checkAll2 = true; + _this.isExclusion(); }) }, // 选择会员 @@ -1644,10 +1647,10 @@ _this.preferentialData.oilLiters = item1.liters; _this.couponDiscount =[]; selectCoupon(_this.preferentialData).then(response => { - let couponAmount = 0; + _this.couponAmount = 0; if (response.data.length>0){ response.data.forEach(item => { - let discount = {type:item.type,discountType:item.discountType,name:item.name,full:0,reduce:0,discount:0} + let discount = {type:item.type,discountType:item.discountType,name:item.name,oilName:item1.oilName,full:0,reduce:0,discount:0} discount.full = item.satisfiedAmount if (item.type==0){ // 油品券 @@ -1681,8 +1684,17 @@ } } if (discount.reduce!=0){ - _this.couponDiscount.push(discount) - _this.checkedCities5.push(item.name) + if (_this.couponDiscount.length!=0){ + _this.couponDiscount.forEach(item2 => { + if (item2.oilName!=discount.oilName) { + _this.couponDiscount.push(discount) + _this.checkedCities5.push(item.name) + } + }) + }else { + _this.couponDiscount.push(discount) + _this.checkedCities5.push(item.name) + } } if (item.exclusiveFunction == 0){ // 满减互斥 @@ -1697,26 +1709,16 @@ _this.consumeAmount = 0; _this.isUseBalance = true; } + _this.exclusion = item.exclusiveFunction }) } + let couponAmount = 0; _this.couponDiscount.forEach(item2 => { - couponAmount = item2.reduce - _this.couponAmount += couponAmount + couponAmount += item2.reduce + _this.checkAll5 = true; }) - if (_this.isUseFull){ - _this.countAmountFull() - return; - }else { - _this.countAmountBalance() - return; - } - if (_this.isUseBalance){ - _this.countAmountUnBalance() - return; - }else { - _this.countAmountBalance() - return; - } + _this.couponAmount = couponAmount + _this.isExclusion(); }) }) }, @@ -1735,13 +1737,14 @@ this.oilActualPay = this.oilAmount - this.oilDiscount } }, - // 使用优惠券不使用储值卡 + // 使用优惠券和满减不使用储值卡 countAmountUnBalance(){ if (this.isMember){ - this.oilActualPay = this.oilOrder - this.fullReduction - this.oilDiscount - this.couponAmount - this.hoardAmount + this.oilActualPay = this.oilAmount - this.fullReduction - this.oilDiscount - this.couponAmount - this.hoardAmount }else { this.oilActualPay = this.oilAmount - this.oilDiscount } + this.consumeAmount = 0 }, // 使用储值卡不使用优惠券 || 使用满减不使用优惠券 countAmountBalance(){ @@ -1757,6 +1760,41 @@ this.oilActualPay = this.oilAmount - this.oilDiscount } }, + // 判断互斥限制 + isExclusion(){ + if (this.exclusion == 1){ + // 储值卡互斥 + if (this.isUseBalance){ + this.countAmountUnBalance() + return; + }else { + this.countAmountBalance() + return; + } + }else if (this.exclusion == 0){ + // 满减互斥 + if (this.isUseFull){ + this.countAmountFull() + return; + }else { + this.countAmountBalance() + return; + } + }else { + // 无互斥 + // 不使用储值卡 + if (this.isUseBalance){ + this.countAmountUnBalance() + return; + } + // 不使用满减 + if (this.isUseBalance){ + this.countAmountFull() + return; + } + this.countAmountBalance(); + } + }, // 调用优惠参数接口 preferential(){ let _this = this; @@ -1769,6 +1807,7 @@ _this.preferentialData.oilLiters = item1.liters; selectPreferential(_this.preferentialData).then( response => { if (response.data.length>0){ + _this.fullReduceDiscount = [] response.data.forEach(item => { let discount = {type:item.name,full:0,reduce:0,discount:0} let activeList = item.activeDiscountChildList; @@ -1779,9 +1818,8 @@ if (item1.amount>=activeList[0].amount){ discount.full = activeList[0].amount; discount.discount = activeList[0].discount; + discount.reduce = item1.amount - (item1.amount * (activeList[0].discount / 10)).toFixed(2) fullReduction = item1.amount - (item1.amount * (activeList[0].discount / 10)).toFixed(2); - }else { - fullReduction = 0 } }else { // 满减 @@ -1789,81 +1827,40 @@ discount.full = activeList[0].amount; discount.reduce = activeList[0].deductionAmount; fullReduction = activeList[0].deductionAmount; - }else { - fullReduction = 0 } } - }else { - _this.fullReduction = 0; - // _this.countAmountBalance(); - // _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction - _this.balance } } - if (discount.reduce!=0 || discount.discount!=0){ + if (activeList.length==0){ + fullReduction = 0 + } + if (discount.reduce!=0){ _this.fullReduceDiscount.push(discount) - _this.checkedCities1 = [item.name] + _this.checkedCities1.push(item.name) _this.checkAll1 = true; } + _this.fullReduction += +fullReduction }) } - _this.fullReduction += +fullReduction if (_this.isUseFull){ - _this.countAmountFull() - return; - }else { - _this.countAmountBalance() - return; - } - if (_this.isUseBalance){ - _this.countAmountUnBalance() - return; - }else { - _this.countAmountBalance() - return; + _this.checkAll1 = false; + _this.checkedCities1 = [] + _this.fullReduction = 0 } + _this.isExclusion(); + // if (_this.isUseFull){ + // _this.checkAll1 = false; + // _this.fullReduction = 0; + // _this.checkedCities1 = [] + // _this.countAmountFull() + // return; + // }else { + // _this.countAmountBalance() + // return; + // } // _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction - _this.balance }) }) - // selectPreferential(data).then( response => { - // _this.oilOrder.forEach(item1 => { - // if (response.data.length>0){ - // response.data.forEach(item => { - // let discount = {type:item.name,full:0,reduce:0,discount:0} - // let activeList = item.activeDiscountChildList; - // for (let i = 1;i<=activeList.length;i++){ - // if (activeList.length>0){ - // if (activeList[0].discount != null){ - // // 折扣营销 - // if (item1.amount>=activeList[0].amount){ - // discount.full = activeList[0].amount; - // discount.discount = activeList[0].discount; - // fullReduction = item1.amount - item1.amount * (activeList[0].discount / 10); - // }else { - // fullReduction = 0 - // } - // }else { - // // 满减 - // if (item1.amount>=activeList[0].amount){ - // discount.full = activeList[0].amount; - // discount.reduce = activeList[0].deductionAmount; - // fullReduction = activeList[0].deductionAmount; - // }else { - // fullReduction = 0 - // } - // } - // } - // } - // if (discount.reduce!=0 || discount.discount!=0){ - // _this.fullReduceDiscount.push(discount) - // _this.checkedCities1 = [item.name] - // } - // }) - // } - // _this.fullReduction += +fullReduction - // }) - // let oilActualPay = _this.oilActualPay - // _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction - // }) }, // 选择会员信息 handleChoose(data){ @@ -1954,6 +1951,10 @@ this.consumeRefuelMoney = 0; this.fullReduction = 0; this.couponAmount = 0; + this.fullReduceDiscount = []; + this.gradeDiscount = []; + this.couponDiscount = []; + if (this.member.refuelMoney!=null){ this.refuelMoney = JSON.parse(this.member.refuelMoney) } @@ -1969,6 +1970,7 @@ getOilOrder(){ this.dialogVisibleamount = false this.form.oilType = this.oilType; + this.form.type = this.type; // 计算油的升数 if (this.select == "元"){ let num = this.form.amount/this.form.oilPrice @@ -1977,30 +1979,28 @@ this.form.liters = this.form.amount this.form.amount = (this.form.oilPrice * this.form.amount).toFixed(2) } - // 获取油号信息 - // let name1 = this.getName(this.oilNameList,this.form.oilName); - // this.form.oilType = name1; - this.oilOrder.push(this.form) - - if (this.select == "元"){ - this.oilAmount = +this.form.amount + this.oilAmount; - // if (this.balance!=0){ - // if (this.balance>=(this.oilAmount - this.oilDiscount)){ - // this.consumeAmount = this.oilAmount - this.oilDiscount; - // this.oilActualPay = 0; - // }else { - // this.consumeAmount = this.balance; - // this.oilActualPay = this.oilAmount - this.oilDiscount - this.balance; - // } - // }else { - // this.oilActualPay = this.oilAmount - this.oilDiscount; - // } + // 判断此油品是否被加购 + if (this.isExistOilOrder){ + for (let i = 0; i { + this.oilAmount += +item.amount + }) - this.oilTotal += 1; + // if (this.select == "元"){ + // this.oilAmount = +this.form.amount + this.oilAmount; + // }else { + // this.oilAmount = this.form.amount + this.oilAmount; + // } + this.oilActualPay = this.oilAmount - this.oilDiscount; + this.oilTotal = this.oilOrder.length; this.select = "元"; if (this.isMember){ this.getGrade(this.member.gradeId) @@ -2047,6 +2047,7 @@ oilActPay += +oilActualPay _this.hoardAmount += +hoardAmount }) + _this.isExclusion(); }, // 选择“元”或“L” changeSelect(){ @@ -2079,16 +2080,19 @@ // 获取油号名称 getName(oilNameList,id){ let name = "" + let oilType = "" let _this = this; if(oilNameList!=null && oilNameList!=""){ oilNameList.forEach(item => { if (item.id == id){ name = item.oilName; + oilType = item.oilType; _this.oilType = item.oilName; + _this.type = item.oilType; } }) } - return name; + return oilType+" "+name; }, // 获取油号信息 getOilName(){ @@ -2130,17 +2134,23 @@ ]; this.amount = 0 this.dialogVisibleamount = true; + let result = false // 判断是否存在此油品的数据 this.oilOrder.forEach(item => { - // if (item.==data.){ - // this.form = item - // } - // return; + if (item.id==data.id){ + this.amount = item.amount + result = true + this.isExistOilOrder = true; + } }) + if (result){ + return; + } getOilNumberById(data.numberId).then( response => { this.form = response.data; this.gunList.forEach(item => { if (item.id==data.id){ + this.form.id = item.id this.form.gunName = item.gunName } })