From f0a970479fbaff9afcf3eeaccdd38741f20db9ca Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Tue, 21 Nov 2023 18:18:35 +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 --- fuintCashierWeb/src/api/cashier/oilnumber.js | 9 + .../src/api/cashier/preferential.js | 9 + .../views/cashier/NewComponents/credit.vue | 1 + .../views/cashier/NewComponents/homeindex.vue | 568 +++++++++++++----- 4 files changed, 434 insertions(+), 153 deletions(-) diff --git a/fuintCashierWeb/src/api/cashier/oilnumber.js b/fuintCashierWeb/src/api/cashier/oilnumber.js index 71c64096f..a3c253db1 100644 --- a/fuintCashierWeb/src/api/cashier/oilnumber.js +++ b/fuintCashierWeb/src/api/cashier/oilnumber.js @@ -8,3 +8,12 @@ export function getOilNumberById(id) { // data: data }) } + +// 查询所有油号 +export function oilNumberList() { + return request({ + url: '/business/petrolStationManagement/oilNumber/getList', + method: 'get', + // data: data + }) +} diff --git a/fuintCashierWeb/src/api/cashier/preferential.js b/fuintCashierWeb/src/api/cashier/preferential.js index ec56b0b25..a55103428 100644 --- a/fuintCashierWeb/src/api/cashier/preferential.js +++ b/fuintCashierWeb/src/api/cashier/preferential.js @@ -8,3 +8,12 @@ export function selectPreferential(data) { params: data }) } + +// 查询优惠券信息 +export function selectCoupon(data) { + return request({ + url: '/business/marketingActivity/activeExchange/selectCardFavorableList', + method: 'get', + params: data + }) +} diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue index 09cc3d68f..6f8103070 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue @@ -808,6 +808,7 @@ import {getDicts} from "@/api/dict/data"; this.dialogVisiblej = false; this.open2 = false; this.open4 = false; + this.getList(); }, // 收款 collection(){ diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index 966e1e8b5..485ea47cd 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -60,31 +60,36 @@ width="400" trigger="click">
- - -
-
{{item.type}}
-
-
-¥{{ fullReduction }}
-
满{{ item.full }}元,打{{ item.discount }}折
-
满{{ item.full }}元,减{{ item.reduce }}元
+
+ + +
+
{{item.type}}
+
+
-¥{{ fullReduction }}
+
满{{ item.full }}元,打{{ item.discount }}折
+
满{{ item.full }}元,减{{ item.reduce }}元
+
-
- - + + +
+
+ 暂无满减油品信息 +
- - + 满减活动
-
-¥{{ fullReduction + goodsDiscount }}
+
-¥{{ fullReduction }}
-
+
- -
- - -
-
{{city}}
-
-
-¥1.56
-
满100元每升优惠0.2元
-
-
-
-
-
-
- - - 囤油卡 -
- ({{ item.type }}卡 - {{ item.oilType }} - 余额:{{ item.refuelMoney }}L) -
-
-
+ + + + + + + + + + + + + + + + + + + + + + + + 囤油卡 +
+ ({{ item.type }}卡 + {{ item.oilType }} + 余额:{{ item.refuelMoney }}L) +
- {{ consumeRefuelMoney }}L
- -
- - -
-
{{city}}
-
-
-¥1.56
-
满100元每升优惠0.2元
-
-
-
-
-
-
- - - 储值卡 - (账户余额:{{ balance }}元) -
-
+ + + + + + + + + + + + + + + + + + + + + + + + 储值卡 + (账户余额:{{ balance }}元)
-¥{{ consumeAmount }}
@@ -188,13 +194,13 @@ width="400" trigger="click">
- - + +
-
{{city}}
+
{{item.name}}
-
-¥1.56
-
满100元每升优惠0.2元
+
-¥{{ item.reduce }}
+
满{{ item.full }}元,减{{ item.reduce }}元
@@ -242,7 +248,7 @@
¥{{ oilActualPay + goodsActualPay }}
优惠合计:{{ oilDiscount + goodsDiscount }}元/{{consumeRefuelMoney}}L
-
立即结算
+
立即结算
@@ -267,8 +273,9 @@
- -
{{ item.oilNumber }}
+
{{ getName(oilNameList,getOilNames(oilNumberList,item.numberId)) }}
+ +
{{item.gunName}}
@@ -276,16 +283,21 @@ {{ item.tankName }}
- - - - + +
+
11
- - +
1号枪
+
- - + + + + + + +
+
@@ -465,7 +477,7 @@ @@ -795,8 +807,8 @@ import {getUserGrade, listUserGrade} from "@/api/cashier/usergrade"; import {getOilGun} from "@/api/cashier/oilGuns"; import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord"; - import {getOilNumberById} from "@/api/cashier/oilnumber"; - import {selectPreferential} from "@/api/cashier/preferential"; + import {getOilNumberById, oilNumberList} from "@/api/cashier/oilnumber"; + import {selectCoupon, selectPreferential} from "@/api/cashier/preferential"; import {addHangBill} from "@/api/cashier/hangbill"; import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit"; @@ -818,20 +830,21 @@ cities2: cityOptions, gradeDiscount: [], // 囤油卡全选 - checkAll3: false, + checkAll3: true, isIndeterminate3: true, - checkedCities3: ['上海'], + checkedCities3: [], cities3: cityOptions, // 储值卡全选 - checkAll4: false, + checkAll4: true, isIndeterminate4: true, - checkedCities4: ['上海'], + checkedCities4: [], cities4: cityOptions, // 优惠券全选 checkAll5: false, isIndeterminate5: true, - checkedCities5: ['上海'], + checkedCities5: [], cities5: cityOptions, + couponDiscount: [], // 优惠券列表 couponList:[], // 消费升数 @@ -870,6 +883,8 @@ oilActualPay:0, // 油品优惠金额 oilDiscount:0, + // 囤油卡消费金额 + hoardAmount:0, // 商品优惠金额 goodsDiscount:0, // 商品实付金额 @@ -1019,10 +1034,16 @@ isQuery:true, // 油枪列表 gunList:[], + // 油号列表 + oilNumberList:[], // 是否可以点会员确定按钮 isSure:true, // 优惠券消费金额 couponAmount:0, + // 是否为满减互斥 + isUseFull:false, + // 是否为储值卡互斥 + isUseBalance:false, // 查询优惠活动信息所需参数 preferentialData:{ userId:"", @@ -1060,6 +1081,19 @@ this.getUnitList(); }, methods:{ + getOilNames(list,id){ + let name = "" + let _this = this; + if(list!=null && list!=""){ + list.forEach(item => { + if (item.numberId == id){ + name = item.oilName; + // _this.oilType = item.oilName; + } + }) + } + return name; + }, // 挂账 addCredits(){ this.dialogVisibleCredit = true @@ -1164,6 +1198,19 @@ this.fullReduceDiscount.forEach(item => { list.push(item.type) }) + if (val){ + this.fullReduceDiscount.forEach(item => { + if (item.discount!=0){ + this.fullReduction = this.oilAmount - (this.oilAmount * item.discount).toFixed(2) + }else { + this.fullReduction = item.reduce + } + }) + + }else { + this.fullReduction = 0; + this.getGrade(this.member.id) + } this.checkedCities1 = val ? list : []; this.isIndeterminate1 = false; }, @@ -1186,8 +1233,25 @@ this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length; }, handleCheckAllChange3(val) { - this.checkedCities3 = val ? cityOptions : []; - this.isIndeterminate3 = false; + 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; + } + }else { + this.changeRefuelMoney() + } }, handleCheckedCitiesChange3(value) { let checkedCount = value.length; @@ -1195,8 +1259,23 @@ this.isIndeterminate3 = checkedCount > 0 && checkedCount < this.cities3.length; }, handleCheckAllChange4(val) { - this.checkedCities4 = val ? cityOptions : []; - this.isIndeterminate4 = false; + 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; + } + } }, handleCheckedCitiesChange4(value) { let checkedCount = value.length; @@ -1204,13 +1283,31 @@ this.isIndeterminate4 = checkedCount > 0 && checkedCount < this.cities4.length; }, handleCheckAllChange5(val) { - this.checkedCities5 = val ? cityOptions : []; + let list = [] + this.couponDiscount.forEach(item => { + list.push(item.name) + }) + if (val){ + this.couponAmount = 0 + this.couponDiscount.forEach(item2 => { + this.couponAmount += item2.reduce + }) + }else { + this.couponAmount = 0 + } + this.checkedCities5 = val ? list : []; this.isIndeterminate5 = false; }, 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 + } + } let checkedCount = value.length; - this.checkAll5 = checkedCount === this.cities5.length; - this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.cities5.length; + this.checkAll5 = checkedCount === this.couponDiscount.length; + this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.couponDiscount.length; }, // 模糊查询商品信息 querySearch(queryString, cb) { @@ -1280,7 +1377,7 @@ this.oilDiscount = 0; this.goodsDiscount = 0; this.userNo = ""; - this.oilActualPay = this.oilAmount - this.oilDiscount - this.couponAmount + this.oilActualPay = this.oilAmount - this.oilDiscount this.goodsActualPay = this.goodsAmount - this.goodsDiscount this.isSure = true; this.handleChange(); @@ -1493,20 +1590,30 @@ } }) - let oilActualPay = _this.oilActualPay; + // let oilActualPay = _this.oilActualPay; _this.oilDiscount = gasolineDiscount + dieselDiscount + naturalGasDiscount - _this.oilActualPay = oilActualPay - _this.oilDiscount; + // _this.oilActualPay = oilActualPay - _this.oilDiscount; // 储值卡余额 // 如果总金额为0 则表示没有使用囤油卡 - if (oilActualPay == 0){ - oilActualPay = _this.oilAmount - _this.oilDiscount; - } - if (_this.balance>=(_this.oilAmount - _this.oilDiscount)){ - _this.consumeAmount = _this.oilAmount - _this.oilDiscount; - _this.oilActualPay = 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.consumeAmount = _this.balance; - _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.balance; + _this.countAmountBalance() + } + if (_this.isUseBalance){ + _this.countAmountUnBalance() + }else { + _this.countAmountBalance() } }) }, @@ -1524,12 +1631,130 @@ this.preferentialData.userId = data.id; this.preferentialData.gradeId = data.gradeId; if (this.oilOrder.length>0){ - // this.oilOrder.forEach(item => { - // this.preferentialData.oilName = item.oilName; - // this.preferentialData.oilPrice = item.oilPrice; - // this.preferentialData.oilLiters = item.liters; - // }) this.preferential(); + this.getCoupon(); + } + }, + // 调用优惠券接口 + getCoupon(){ + let _this = this; + _this.oilOrder.forEach(item1 => { + _this.preferentialData.oilName = item1.oilName; + _this.preferentialData.oilPrice = item1.oilPrice; + _this.preferentialData.oilLiters = item1.liters; + _this.couponDiscount =[]; + selectCoupon(_this.preferentialData).then(response => { + let 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} + discount.full = item.satisfiedAmount + if (item.type==0){ + // 油品券 + if (item.discountType==0){ + // 满减券 + discount.reduce = item.discountAmount + }else { + // 折扣券 + discount.discount = item.specialDiscount + discount.reduce = item.discountOffset + } + }else if (item.type==1){ + // 商品券 + if (item.discountType==0){ + // 满减券 + discount.reduce = item.discountAmount + }else { + // 折扣券 + discount.discount = item.specialDiscount + discount.reduce = item.discountOffset + } + }else { + // 通用券 + if (item.discountType==0){ + // 满减券 + discount.reduce = item.discountAmount + }else { + // 折扣券 + discount.discount = item.specialDiscount + discount.reduce = item.discountOffset + } + } + if (discount.reduce!=0){ + _this.couponDiscount.push(discount) + _this.checkedCities5.push(item.name) + } + if (item.exclusiveFunction == 0){ + // 满减互斥 + _this.checkAll1 = false + _this.checkAll4 = true; + _this.fullReduction = 0 + _this.isUseFull = true; + }else { + // 储值卡付款互斥 + _this.checkAll1 = true + _this.checkAll4 = false; + _this.consumeAmount = 0; + _this.isUseBalance = true; + } + }) + } + _this.couponDiscount.forEach(item2 => { + couponAmount = item2.reduce + _this.couponAmount += couponAmount + }) + if (_this.isUseFull){ + _this.countAmountFull() + return; + }else { + _this.countAmountBalance() + return; + } + if (_this.isUseBalance){ + _this.countAmountUnBalance() + return; + }else { + _this.countAmountBalance() + return; + } + }) + }) + }, + // 使用优惠券不使用满减 + countAmountFull(){ + if (this.isMember){ + // 满减互斥 + if (this.balance >= (this.oilAmount - this.oilDiscount - this.couponAmount)){ + this.oilActualPay = 0 + this.consumeAmount = this.oilAmount - this.oilDiscount - this.couponAmount - this.hoardAmount + }else { + this.oilActualPay = this.oilAmount -this.balance - this.oilDiscount - this.couponAmount - this.hoardAmount + this.consumeAmount = this.balance + } + }else { + this.oilActualPay = this.oilAmount - this.oilDiscount + } + }, + // 使用优惠券不使用储值卡 + countAmountUnBalance(){ + if (this.isMember){ + this.oilActualPay = this.oilOrder - this.fullReduction - this.oilDiscount - this.couponAmount - this.hoardAmount + }else { + this.oilActualPay = this.oilAmount - this.oilDiscount + } + }, + // 使用储值卡不使用优惠券 || 使用满减不使用优惠券 + countAmountBalance(){ + if (this.isMember){ + if (this.balance >= (this.oilAmount - this.oilDiscount - this.fullReduction)){ + this.oilActualPay = 0 + this.consumeAmount = this.oilAmount - this.oilDiscount - this.fullReduction - this.hoardAmount + }else { + this.oilActualPay = this.oilAmount -this.balance - this.oilDiscount - this.fullReduction - this.hoardAmount + this.consumeAmount = this.balance + } + }else { + this.oilActualPay = this.oilAmount - this.oilDiscount } }, // 调用优惠参数接口 @@ -1537,7 +1762,6 @@ let _this = this; // _this.fullReduction = 0; let fullReduction = 0; - let oilActualPay = _this.oilActualPay _this.fullReduction = 0; _this.oilOrder.forEach(item1 => { _this.preferentialData.oilName = item1.oilName; @@ -1555,7 +1779,7 @@ 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); + fullReduction = item1.amount - (item1.amount * (activeList[0].discount / 10)).toFixed(2); }else { fullReduction = 0 } @@ -1571,17 +1795,33 @@ } }else { _this.fullReduction = 0; - _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction - _this.balance + // _this.countAmountBalance(); + // _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction - _this.balance } } if (discount.reduce!=0 || discount.discount!=0){ _this.fullReduceDiscount.push(discount) _this.checkedCities1 = [item.name] + _this.checkAll1 = true; } }) } _this.fullReduction += +fullReduction - _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction - _this.balance + if (_this.isUseFull){ + _this.countAmountFull() + return; + }else { + _this.countAmountBalance() + return; + } + if (_this.isUseBalance){ + _this.countAmountUnBalance() + return; + }else { + _this.countAmountBalance() + return; + } + // _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction - _this.balance }) }) // selectPreferential(data).then( response => { @@ -1624,10 +1864,6 @@ // let oilActualPay = _this.oilActualPay // _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction // }) - }, - // 查询该会员是否可使用优惠券 - queryCoupon(list,id){ - }, // 选择会员信息 handleChoose(data){ @@ -1669,9 +1905,9 @@ let amount = 0; for (let i = 0; i=(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.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; + // } }else { this.oilAmount = this.form.amount + this.oilAmount; - this.oilActualPay = this.oilAmount - this.oilDiscount; } + this.oilActualPay = this.oilAmount - this.oilDiscount; this.oilTotal += 1; this.select = "元"; @@ -1769,12 +2006,8 @@ this.getGrade(this.member.gradeId) this.changeRefuelMoney(); if (this.oilOrder.length>0){ - // this.oilOrder.forEach(item => { - // this.preferentialData.oilName = item.oilName; - // this.preferentialData.oilPrice = item.oilPrice; - // this.preferentialData.oilLiters = item.liters; - // }) this.preferential(); + this.getCoupon(); } } }, @@ -1783,9 +2016,12 @@ let _this = this; _this.consumeRefuelMoney = 0; _this.oilActualPay = 0; + let oilActPay = 0; + _this.hoardAmount = 0; _this.oilOrder.forEach(item => { let conRefMon = 0; let oilActualPay = 0; + let hoardAmount = 0; if (_this.refuelMoney!=null){ let result = false; for (let i = 0;i < _this.refuelMoney.length;i++){ @@ -1797,6 +2033,7 @@ }else { conRefMon = _this.refuelMoney[i].refuelMoney oilActualPay = item.amount - (_this.refuelMoney[i].refuelMoney * item.oilPrice).toFixed(2) + hoardAmount = (_this.refuelMoney[i].refuelMoney * item.oilPrice).toFixed(2) } result = true; }else { @@ -1807,7 +2044,8 @@ } } _this.consumeRefuelMoney += +conRefMon - _this.oilActualPay += +oilActualPay + oilActPay += +oilActualPay + _this.hoardAmount += +hoardAmount }) }, // 选择“元”或“L” @@ -1846,7 +2084,7 @@ oilNameList.forEach(item => { if (item.id == id){ name = item.oilName; - _this.oilType = item.oilType; + _this.oilType = item.oilName; } }) } @@ -1884,8 +2122,21 @@ // 加油金额 refuel(data){ this.select = "元"; + this.rise = [ + {value:"¥100"}, + {value:"¥150"}, + {value:"¥200"}, + {value:"¥300"}, + ]; this.amount = 0 this.dialogVisibleamount = true; + // 判断是否存在此油品的数据 + this.oilOrder.forEach(item => { + // if (item.==data.){ + // this.form = item + // } + // return; + }) getOilNumberById(data.numberId).then( response => { this.form = response.data; this.gunList.forEach(item => { @@ -1894,9 +2145,6 @@ } }) }) - // getOilNumGunById(id).then( response => { - // this.form = response.data; - // }) }, // 确定收款 collection(){ @@ -2102,9 +2350,9 @@ goods.forEach(item => { num += item.num if (_this.isMember){ - amount += item.memberPrice*item.num; + amount += (item.memberPrice*item.num).toFixed(2); }else { - amount += item.retailPrice*item.num; + amount += (item.retailPrice*item.num).toFixed(2); } }) this.goodsTotal = num; @@ -2147,6 +2395,9 @@ getOilGun({numberId:numberId}).then(response => { this.gunList = response.data.records; }) + oilNumberList().then(response => { + this.oilNumberList = response.data.records; + }) }, }, @@ -2154,6 +2405,17 @@