收银台

This commit is contained in:
cun-nan 2023-11-21 18:18:35 +08:00
parent b51938071a
commit f0a970479f
4 changed files with 434 additions and 153 deletions

View File

@ -8,3 +8,12 @@ export function getOilNumberById(id) {
// data: data // data: data
}) })
} }
// 查询所有油号
export function oilNumberList() {
return request({
url: '/business/petrolStationManagement/oilNumber/getList',
method: 'get',
// data: data
})
}

View File

@ -8,3 +8,12 @@ export function selectPreferential(data) {
params: data params: data
}) })
} }
// 查询优惠券信息
export function selectCoupon(data) {
return request({
url: '/business/marketingActivity/activeExchange/selectCardFavorableList',
method: 'get',
params: data
})
}

View File

@ -808,6 +808,7 @@ import {getDicts} from "@/api/dict/data";
this.dialogVisiblej = false; this.dialogVisiblej = false;
this.open2 = false; this.open2 = false;
this.open4 = false; this.open4 = false;
this.getList();
}, },
// //
collection(){ collection(){

View File

@ -60,31 +60,36 @@
width="400" width="400"
trigger="click"> trigger="click">
<div> <div>
<el-checkbox-group v-model="checkedCities1" @change="handleCheckedCitiesChange1"> <div v-if="fullReduceDiscount.length>0">
<el-checkbox v-for="(item,index) in fullReduceDiscount" :label="item.type" :key="index"> <el-checkbox-group v-model="checkedCities1" @change="handleCheckedCitiesChange1">
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <el-checkbox v-for="(item,index) in fullReduceDiscount" :label="item.type" :key="index">
<div style="width: 200px">{{item.type}}</div> <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <div style="width: 200px">{{item.type}}</div>
<div style="color: red">-{{ fullReduction }}</div> <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: grey" v-if="item.discount!=0">{{ item.full }}{{ item.discount }}</div> <div style="color: red">-{{ fullReduction }}</div>
<div style="color: grey" v-else>{{ item.full }}{{ item.reduce }}</div> <div style="color: grey" v-if="item.discount!=0">{{ item.full }}{{ item.discount }}</div>
<div style="color: grey" v-else>{{ item.full }}{{ item.reduce }}</div>
</div>
</div> </div>
</div> </el-checkbox>
</el-checkbox> </el-checkbox-group>
</el-checkbox-group> </div>
<div v-else>
暂无满减油品信息
</div>
</div> </div>
<div slot="reference"> <div slot="reference">
<el-checkbox :indeterminate="isIndeterminate1" <el-checkbox :disabled="fullReduceDiscount.length==0"
style="color: black;font-size: 16px" style="color: black;font-size: 16px"
v-model="checkAll1" @change="handleCheckAllChange1"> v-model="checkAll1" @change="handleCheckAllChange1">
</el-checkbox> </el-checkbox><!--:indeterminate="isIndeterminate1"-->
满减活动 满减活动
</div> </div>
</el-popover> </el-popover>
</div> </div>
<div>-{{ fullReduction + goodsDiscount }}</div> <div>-{{ fullReduction }}</div>
</div> </div>
<div class="center-left-hj" v-show="isMember"> <div class="center-left-hj" v-show="isMember && gradeDiscount.length>0">
<div> <div>
<el-popover <el-popover
placement="bottom-start" placement="bottom-start"
@ -117,67 +122,68 @@
</div> </div>
<div class="center-left-hj" v-show="isMember && refuelMoney!=null"> <div class="center-left-hj" v-show="isMember && refuelMoney!=null">
<div> <div>
<el-popover <!-- <el-popover-->
placement="bottom-start" <!-- placement="bottom-start"-->
width="400" <!-- width="400"-->
trigger="click"> <!-- trigger="click">-->
<div> <!-- <div>-->
<el-checkbox-group v-model="checkedCities3" @change="handleCheckedCitiesChange3"> <!-- <el-checkbox-group v-model="checkedCities3" @change="handleCheckedCitiesChange3">-->
<el-checkbox v-for="city in cities3" :label="city" :key="city"> <!-- <el-checkbox v-for="city in cities3" :label="city" :key="city">-->
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <!-- <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">-->
<div style="width: 200px">{{city}}</div> <!-- <div style="width: 200px">{{city}}</div>-->
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <!-- <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">-->
<div style="color: red">-1.56</div> <!-- <div style="color: red">-1.56</div>-->
<div style="color: grey">满100元每升优惠0.2</div> <!-- <div style="color: grey">满100元每升优惠0.2</div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</el-checkbox> <!-- </el-checkbox>-->
</el-checkbox-group> <!-- </el-checkbox-group>-->
</div> <!-- </div>-->
<div slot="reference"> <!-- <div slot="reference">-->
<el-checkbox :indeterminate="isIndeterminate3" <!-- -->
style="color: black;font-size: 16px" <!-- </div>-->
v-model="checkAll3" @change="handleCheckAllChange3"> <!-- </el-popover>-->
</el-checkbox> <el-checkbox
囤油卡 style="color: black;font-size: 16px"
<div style="margin: 5px 0" v-for="(item,index) in refuelMoney" :key="index"> v-model="checkAll3" @change="handleCheckAllChange3">
{{ item.type }} </el-checkbox><!--:indeterminate="isIndeterminate3"-->
<span style="color: #00afff">{{ item.oilType }}</span> 囤油卡
余额{{ item.refuelMoney }}L <div style="margin: 5px 0" v-for="(item,index) in refuelMoney" :key="index">
</div> {{ item.type }}
</div> <span style="color: #00afff">{{ item.oilType }}</span>
</el-popover> 余额{{ item.refuelMoney }}L
</div>
</div> </div>
<div>- {{ consumeRefuelMoney }}L</div> <div>- {{ consumeRefuelMoney }}L</div>
</div> </div>
<div class="center-left-hj" v-show="isMember"> <div class="center-left-hj" v-show="isMember">
<div> <div>
<el-popover <!-- <el-popover-->
placement="bottom-start" <!-- placement="bottom-start"-->
width="400" <!-- width="400"-->
trigger="click"> <!-- trigger="click">-->
<div> <!-- <div>-->
<el-checkbox-group v-model="checkedCities4" @change="handleCheckedCitiesChange4"> <!-- <el-checkbox-group v-model="checkedCities4" @change="handleCheckedCitiesChange4">-->
<el-checkbox v-for="city in cities4" :label="city" :key="city"> <!-- <el-checkbox v-for="city in cities4" :label="city" :key="city">-->
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <!-- <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">-->
<div style="width: 200px">{{city}}</div> <!-- <div style="width: 200px">{{city}}</div>-->
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <!-- <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">-->
<div style="color: red">-1.56</div> <!-- <div style="color: red">-1.56</div>-->
<div style="color: grey">满100元每升优惠0.2</div> <!-- <div style="color: grey">满100元每升优惠0.2</div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</el-checkbox> <!-- </el-checkbox>-->
</el-checkbox-group> <!-- </el-checkbox-group>-->
</div> <!-- </div>-->
<div slot="reference"> <!-- <div slot="reference">-->
<el-checkbox :indeterminate="isIndeterminate4" <!-- -->
style="color: black;font-size: 16px" <!-- </div>-->
v-model="checkAll4" @change="handleCheckAllChange4"> <!-- </el-popover>-->
</el-checkbox> <el-checkbox style="color: black;font-size: 16px"
储值卡 v-model="checkAll4" @change="handleCheckAllChange4">
<span>账户余额{{ balance }}</span> </el-checkbox>
</div> 储值卡
</el-popover> <span>账户余额{{ balance }}</span>
</div> </div>
<div>-{{ consumeAmount }}</div> <div>-{{ consumeAmount }}</div>
</div> </div>
@ -188,13 +194,13 @@
width="400" width="400"
trigger="click"> trigger="click">
<div> <div>
<el-checkbox-group v-model="checkedCities5" @change="handleCheckedCitiesChange5"> <el-checkbox-group v-model="checkedCities5 && couponDiscount.length>0" @change="handleCheckedCitiesChange5">
<el-checkbox v-for="city in cities5" :label="city" :key="city"> <el-checkbox v-for="(item,index) in couponDiscount" :label="item.name" :key="index">
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
<div style="width: 200px">{{city}}</div> <div style="width: 200px">{{item.name}}</div>
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: red">-1.56</div> <div style="color: red">-{{ item.reduce }}</div>
<div style="color: grey">100元每升优惠0.2</div> <div style="color: grey">{{ item.full }}{{ item.reduce }}</div>
</div> </div>
</div> </div>
</el-checkbox> </el-checkbox>
@ -242,7 +248,7 @@
<div class="bottom-price">{{ oilActualPay + goodsActualPay }}</div> <div class="bottom-price">{{ oilActualPay + goodsActualPay }}</div>
<div class="price-red">优惠合计{{ oilDiscount + goodsDiscount }}/{{consumeRefuelMoney}}L</div> <div class="price-red">优惠合计{{ oilDiscount + goodsDiscount }}/{{consumeRefuelMoney}}L</div>
</div> </div>
<div class="center-left-lv" @click="settlement">立即结算</div> <div class="center-left-lv" @click="settlement" :disabled="(oilActualPay + goodsActualPay)==0">立即结算</div>
</div> </div>
</div> </div>
@ -267,8 +273,9 @@
<div class="of-box" v-for="(item,index) in gunList" :key="index" <div class="of-box" v-for="(item,index) in gunList" :key="index"
:style="{'background-color': colorList[index%5].color}" :style="{'background-color': colorList[index%5].color}"
@click="refuel(item)"> @click="refuel(item)">
<!-- <div>{{ getName(oilNameList,item.oilName) }}</div>--> <div>{{ getName(oilNameList,getOilNames(oilNumberList,item.numberId)) }}</div>
<div>{{ item.oilNumber }}</div> <!-- <div>{{ getOilNames(oilNumberList,item.numberId) }}</div>-->
<!-- <div>{{ item.oilNumber }}</div>-->
<div class="of-title" >{{item.gunName}}</div> <div class="of-title" >{{item.gunName}}</div>
<div style="display: flex;justify-content: space-between"> <div style="display: flex;justify-content: space-between">
@ -276,16 +283,21 @@
<span style="font-size: 12px">{{ item.tankName }}</span> <span style="font-size: 12px">{{ item.tankName }}</span>
</div> </div>
</div> </div>
<!-- <div class="of-box" v-for="(item,index) in oilNumGunList" :key="index"--> <!-- 点击之后样式测试-->
<!-- :style="{'background-color': colorList[index%5].color}"--> <div class="after-box">
<!-- @click="refuel(item.id)">--> <div>11</div>
<!-- <div>{{ getName(oilNameList,item.oilName) }}</div>-->
<!-- <div class="of-title" >{{item.oilGunNum}}号枪</div>--> <div class="of-title" >1号枪</div>
<!-- <div>--> <div>
<!-- <img src="../../../assets/images/jya.png" style="width: 18px;height: 18px;">--> <!-- <img src="../../../assets/images/jya.png" style="width: 18px;height: 18px;">-->
<!-- </div>--> <span>
<!-- </div>--> <svg t="1700561564710" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9686" width="16" height="16"><path d="M661.8 868.4V455.8h27.9c15.3-0.1 27.8 12.3 27.9 27.6V746c-0.1 67.5 54.5 122.3 121.9 122.4S961.9 813.9 962 746.5V241.6c0.1-25.4-10.1-49.8-28.3-67.5l-99.4-98.5c-18-18-47.2-18-65.2 0s-18 47.2 0 65.2l64.3 64.8-47.7 49.5c-15.8 16-15.8 41.6 0 57.6 7.4 7.8 17.6 12.2 28.3 12.1h54v422.1c0 15.4-12.5 27.9-27.9 27.9-15.4 0-27.9-12.5-27.9-27.9V484.1c0.1-67.3-54.3-121.8-121.6-121.9H662.3v-225c-0.1-41.5-33.7-75.1-75.1-75.1H193.4c-41.5 0.1-75.1 33.7-75.1 75.1v731.2h-9.4c-25.8 0-46.8 21-46.8 46.8C62 941 83 962 108.8 962h562.5c25.8 0 46.8-20.9 46.8-46.8 0-25.8-20.9-46.8-46.8-46.8h-9.5zM253.2 155.6h273.6c22.8 0 41.3 18.4 41.4 41.2v199.1c0 22.8-18.4 41.3-41.2 41.4H253.2c-22.8 0-41.3-18.4-41.4-41.2V197c0-22.8 18.4-41.3 41.2-41.4h0.2z" fill="#FFFFFF" p-id="9687"></path></svg>
</span>
<span style="margin-right: 10px">
<svg t="1700561410052" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5197" width="16" height="16"><path d="M365.714286 365.714286h109.714285v365.714285H365.714286V365.714286z m182.857143 0H658.285714v365.714285H548.571429V365.714286z m329.142857-36.571429v438.857143A182.857143 182.857143 0 0 1 694.857143 950.857143h-365.714286A182.857143 182.857143 0 0 1 146.285714 768v-438.857143h109.714286v416.256c0 45.129143 47.104 95.744 93.037714 95.744h326.217143c57.563429 0 92.745143-52.370286 92.745143-95.744V329.142857H877.714286zM676.571429 146.285714h182.857142a54.857143 54.857143 0 0 1 54.857143 54.857143v54.857143h-804.571428v-54.857143A54.857143 54.857143 0 0 1 164.571429 146.285714h182.857142l38.4-51.2a54.857143 54.857143 0 0 1 43.885715-21.942857h164.571428a54.857143 54.857143 0 0 1 43.885715 21.942857l38.4 51.2z" fill="#FFFFFF" p-id="5198"></path></svg>
</span>
</div>
</div>
</div> </div>
</div> </div>
@ -465,7 +477,7 @@
<el-table-column label="数量" align="center" prop="num"/> <el-table-column label="数量" align="center" prop="num"/>
<el-table-column label="金额" align="center"> <el-table-column label="金额" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.retailPrice * scope.row.num }}</span> <span>{{ (scope.row.retailPrice * scope.row.num).toFixed(2) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -795,8 +807,8 @@
import {getUserGrade, listUserGrade} from "@/api/cashier/usergrade"; import {getUserGrade, listUserGrade} from "@/api/cashier/usergrade";
import {getOilGun} from "@/api/cashier/oilGuns"; import {getOilGun} from "@/api/cashier/oilGuns";
import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord"; import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
import {getOilNumberById} from "@/api/cashier/oilnumber"; import {getOilNumberById, oilNumberList} from "@/api/cashier/oilnumber";
import {selectPreferential} from "@/api/cashier/preferential"; import {selectCoupon, selectPreferential} from "@/api/cashier/preferential";
import {addHangBill} from "@/api/cashier/hangbill"; import {addHangBill} from "@/api/cashier/hangbill";
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit"; import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
@ -818,20 +830,21 @@
cities2: cityOptions, cities2: cityOptions,
gradeDiscount: [], gradeDiscount: [],
// //
checkAll3: false, checkAll3: true,
isIndeterminate3: true, isIndeterminate3: true,
checkedCities3: ['上海'], checkedCities3: [],
cities3: cityOptions, cities3: cityOptions,
// //
checkAll4: false, checkAll4: true,
isIndeterminate4: true, isIndeterminate4: true,
checkedCities4: ['上海'], checkedCities4: [],
cities4: cityOptions, cities4: cityOptions,
// //
checkAll5: false, checkAll5: false,
isIndeterminate5: true, isIndeterminate5: true,
checkedCities5: ['上海'], checkedCities5: [],
cities5: cityOptions, cities5: cityOptions,
couponDiscount: [],
// //
couponList:[], couponList:[],
// //
@ -870,6 +883,8 @@
oilActualPay:0, oilActualPay:0,
// //
oilDiscount:0, oilDiscount:0,
//
hoardAmount:0,
// //
goodsDiscount:0, goodsDiscount:0,
// //
@ -1019,10 +1034,16 @@
isQuery:true, isQuery:true,
// //
gunList:[], gunList:[],
//
oilNumberList:[],
// //
isSure:true, isSure:true,
// //
couponAmount:0, couponAmount:0,
//
isUseFull:false,
//
isUseBalance:false,
// //
preferentialData:{ preferentialData:{
userId:"", userId:"",
@ -1060,6 +1081,19 @@
this.getUnitList(); this.getUnitList();
}, },
methods:{ 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(){ addCredits(){
this.dialogVisibleCredit = true this.dialogVisibleCredit = true
@ -1164,6 +1198,19 @@
this.fullReduceDiscount.forEach(item => { this.fullReduceDiscount.forEach(item => {
list.push(item.type) 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.checkedCities1 = val ? list : [];
this.isIndeterminate1 = false; this.isIndeterminate1 = false;
}, },
@ -1186,8 +1233,25 @@
this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length; this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length;
}, },
handleCheckAllChange3(val) { handleCheckAllChange3(val) {
this.checkedCities3 = val ? cityOptions : []; if (val==false){
this.isIndeterminate3 = 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) { handleCheckedCitiesChange3(value) {
let checkedCount = value.length; let checkedCount = value.length;
@ -1195,8 +1259,23 @@
this.isIndeterminate3 = checkedCount > 0 && checkedCount < this.cities3.length; this.isIndeterminate3 = checkedCount > 0 && checkedCount < this.cities3.length;
}, },
handleCheckAllChange4(val) { handleCheckAllChange4(val) {
this.checkedCities4 = val ? cityOptions : []; if (val==false){
this.isIndeterminate4 = 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) { handleCheckedCitiesChange4(value) {
let checkedCount = value.length; let checkedCount = value.length;
@ -1204,13 +1283,31 @@
this.isIndeterminate4 = checkedCount > 0 && checkedCount < this.cities4.length; this.isIndeterminate4 = checkedCount > 0 && checkedCount < this.cities4.length;
}, },
handleCheckAllChange5(val) { 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; this.isIndeterminate5 = false;
}, },
handleCheckedCitiesChange5(value) { 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; let checkedCount = value.length;
this.checkAll5 = checkedCount === this.cities5.length; this.checkAll5 = checkedCount === this.couponDiscount.length;
this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.cities5.length; this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.couponDiscount.length;
}, },
// //
querySearch(queryString, cb) { querySearch(queryString, cb) {
@ -1280,7 +1377,7 @@
this.oilDiscount = 0; this.oilDiscount = 0;
this.goodsDiscount = 0; this.goodsDiscount = 0;
this.userNo = ""; this.userNo = "";
this.oilActualPay = this.oilAmount - this.oilDiscount - this.couponAmount this.oilActualPay = this.oilAmount - this.oilDiscount
this.goodsActualPay = this.goodsAmount - this.goodsDiscount this.goodsActualPay = this.goodsAmount - this.goodsDiscount
this.isSure = true; this.isSure = true;
this.handleChange(); this.handleChange();
@ -1493,20 +1590,30 @@
} }
}) })
let oilActualPay = _this.oilActualPay; // let oilActualPay = _this.oilActualPay;
_this.oilDiscount = gasolineDiscount + dieselDiscount + naturalGasDiscount _this.oilDiscount = gasolineDiscount + dieselDiscount + naturalGasDiscount
_this.oilActualPay = oilActualPay - _this.oilDiscount; // _this.oilActualPay = oilActualPay - _this.oilDiscount;
// //
// 0 使 // 0 使
if (oilActualPay == 0){ // if (oilActualPay == 0){
oilActualPay = _this.oilAmount - _this.oilDiscount; // oilActualPay = _this.oilAmount - _this.oilDiscount - _this.fullReduction;
} // }
if (_this.balance>=(_this.oilAmount - _this.oilDiscount)){ // if (_this.balance>=(_this.oilAmount - _this.oilDiscount)){
_this.consumeAmount = _this.oilAmount - _this.oilDiscount; // _this.consumeAmount = _this.oilAmount - _this.oilDiscount - _this.fullReduction;
_this.oilActualPay = 0; // _this.oilActualPay = 0;
// }else {
// _this.consumeAmount = _this.balance;
// _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.balance - _this.fullReduction;
// }
if (_this.isUseFull){
_this.countAmountFull()
}else { }else {
_this.consumeAmount = _this.balance; _this.countAmountBalance()
_this.oilActualPay = oilActualPay - _this.oilDiscount - _this.balance; }
if (_this.isUseBalance){
_this.countAmountUnBalance()
}else {
_this.countAmountBalance()
} }
}) })
}, },
@ -1524,12 +1631,130 @@
this.preferentialData.userId = data.id; this.preferentialData.userId = data.id;
this.preferentialData.gradeId = data.gradeId; this.preferentialData.gradeId = data.gradeId;
if (this.oilOrder.length>0){ 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.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; let _this = this;
// _this.fullReduction = 0; // _this.fullReduction = 0;
let fullReduction = 0; let fullReduction = 0;
let oilActualPay = _this.oilActualPay
_this.fullReduction = 0; _this.fullReduction = 0;
_this.oilOrder.forEach(item1 => { _this.oilOrder.forEach(item1 => {
_this.preferentialData.oilName = item1.oilName; _this.preferentialData.oilName = item1.oilName;
@ -1555,7 +1779,7 @@
if (item1.amount>=activeList[0].amount){ if (item1.amount>=activeList[0].amount){
discount.full = activeList[0].amount; discount.full = activeList[0].amount;
discount.discount = activeList[0].discount; 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 { }else {
fullReduction = 0 fullReduction = 0
} }
@ -1571,17 +1795,33 @@
} }
}else { }else {
_this.fullReduction = 0; _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){ if (discount.reduce!=0 || discount.discount!=0){
_this.fullReduceDiscount.push(discount) _this.fullReduceDiscount.push(discount)
_this.checkedCities1 = [item.name] _this.checkedCities1 = [item.name]
_this.checkAll1 = true;
} }
}) })
} }
_this.fullReduction += +fullReduction _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 => { // selectPreferential(data).then( response => {
@ -1624,10 +1864,6 @@
// let oilActualPay = _this.oilActualPay // let oilActualPay = _this.oilActualPay
// _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction // _this.oilActualPay = oilActualPay - _this.oilDiscount - _this.fullReduction
// }) // })
},
// 使
queryCoupon(list,id){
}, },
// //
handleChoose(data){ handleChoose(data){
@ -1669,9 +1905,9 @@
let amount = 0; let amount = 0;
for (let i = 0; i<goods.length; i++){ for (let i = 0; i<goods.length; i++){
if (_this.isMember){ if (_this.isMember){
amount += goods[i].memberPrice * goods[i].num amount += (goods[i].memberPrice * goods[i].num).toFixed(2)
}else { }else {
amount += goods[i].retailPrice * goods[i].num amount += (goods[i].retailPrice * goods[i].num).toFixed(2)
} }
if (goods[i].id == val.id){ if (goods[i].id == val.id){
goods[i].num = goods[i].num + 1; goods[i].num = goods[i].num + 1;
@ -1717,6 +1953,7 @@
this.consumeAmount = 0; this.consumeAmount = 0;
this.consumeRefuelMoney = 0; this.consumeRefuelMoney = 0;
this.fullReduction = 0; this.fullReduction = 0;
this.couponAmount = 0;
if (this.member.refuelMoney!=null){ if (this.member.refuelMoney!=null){
this.refuelMoney = JSON.parse(this.member.refuelMoney) this.refuelMoney = JSON.parse(this.member.refuelMoney)
} }
@ -1738,7 +1975,7 @@
this.form.liters = (Math.ceil(num*100)/100).toFixed(2) this.form.liters = (Math.ceil(num*100)/100).toFixed(2)
}else { }else {
this.form.liters = this.form.amount this.form.liters = this.form.amount
this.form.amount = this.form.oilPrice * this.form.amount this.form.amount = (this.form.oilPrice * this.form.amount).toFixed(2)
} }
// //
// let name1 = this.getName(this.oilNameList,this.form.oilName); // let name1 = this.getName(this.oilNameList,this.form.oilName);
@ -1747,21 +1984,21 @@
if (this.select == "元"){ if (this.select == "元"){
this.oilAmount = +this.form.amount + this.oilAmount; this.oilAmount = +this.form.amount + this.oilAmount;
if (this.balance!=0){ // if (this.balance!=0){
if (this.balance>=(this.oilAmount - this.oilDiscount)){ // if (this.balance>=(this.oilAmount - this.oilDiscount)){
this.consumeAmount = this.oilAmount - this.oilDiscount; // this.consumeAmount = this.oilAmount - this.oilDiscount;
this.oilActualPay = 0; // this.oilActualPay = 0;
}else { // }else {
this.consumeAmount = this.balance; // this.consumeAmount = this.balance;
this.oilActualPay = this.oilAmount - this.oilDiscount - this.balance; // this.oilActualPay = this.oilAmount - this.oilDiscount - this.balance;
} // }
}else { // }else {
this.oilActualPay = this.oilAmount - this.oilDiscount; // this.oilActualPay = this.oilAmount - this.oilDiscount;
} // }
}else { }else {
this.oilAmount = this.form.amount + this.oilAmount; this.oilAmount = this.form.amount + this.oilAmount;
this.oilActualPay = this.oilAmount - this.oilDiscount;
} }
this.oilActualPay = this.oilAmount - this.oilDiscount;
this.oilTotal += 1; this.oilTotal += 1;
this.select = "元"; this.select = "元";
@ -1769,12 +2006,8 @@
this.getGrade(this.member.gradeId) this.getGrade(this.member.gradeId)
this.changeRefuelMoney(); this.changeRefuelMoney();
if (this.oilOrder.length>0){ 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.preferential();
this.getCoupon();
} }
} }
}, },
@ -1783,9 +2016,12 @@
let _this = this; let _this = this;
_this.consumeRefuelMoney = 0; _this.consumeRefuelMoney = 0;
_this.oilActualPay = 0; _this.oilActualPay = 0;
let oilActPay = 0;
_this.hoardAmount = 0;
_this.oilOrder.forEach(item => { _this.oilOrder.forEach(item => {
let conRefMon = 0; let conRefMon = 0;
let oilActualPay = 0; let oilActualPay = 0;
let hoardAmount = 0;
if (_this.refuelMoney!=null){ if (_this.refuelMoney!=null){
let result = false; let result = false;
for (let i = 0;i < _this.refuelMoney.length;i++){ for (let i = 0;i < _this.refuelMoney.length;i++){
@ -1797,6 +2033,7 @@
}else { }else {
conRefMon = _this.refuelMoney[i].refuelMoney conRefMon = _this.refuelMoney[i].refuelMoney
oilActualPay = item.amount - (_this.refuelMoney[i].refuelMoney * item.oilPrice).toFixed(2) oilActualPay = item.amount - (_this.refuelMoney[i].refuelMoney * item.oilPrice).toFixed(2)
hoardAmount = (_this.refuelMoney[i].refuelMoney * item.oilPrice).toFixed(2)
} }
result = true; result = true;
}else { }else {
@ -1807,7 +2044,8 @@
} }
} }
_this.consumeRefuelMoney += +conRefMon _this.consumeRefuelMoney += +conRefMon
_this.oilActualPay += +oilActualPay oilActPay += +oilActualPay
_this.hoardAmount += +hoardAmount
}) })
}, },
// L // L
@ -1846,7 +2084,7 @@
oilNameList.forEach(item => { oilNameList.forEach(item => {
if (item.id == id){ if (item.id == id){
name = item.oilName; name = item.oilName;
_this.oilType = item.oilType; _this.oilType = item.oilName;
} }
}) })
} }
@ -1884,8 +2122,21 @@
// //
refuel(data){ refuel(data){
this.select = "元"; this.select = "元";
this.rise = [
{value:"¥100"},
{value:"¥150"},
{value:"¥200"},
{value:"¥300"},
];
this.amount = 0 this.amount = 0
this.dialogVisibleamount = true; this.dialogVisibleamount = true;
//
this.oilOrder.forEach(item => {
// if (item.==data.){
// this.form = item
// }
// return;
})
getOilNumberById(data.numberId).then( response => { getOilNumberById(data.numberId).then( response => {
this.form = response.data; this.form = response.data;
this.gunList.forEach(item => { this.gunList.forEach(item => {
@ -1894,9 +2145,6 @@
} }
}) })
}) })
// getOilNumGunById(id).then( response => {
// this.form = response.data;
// })
}, },
// //
collection(){ collection(){
@ -2102,9 +2350,9 @@
goods.forEach(item => { goods.forEach(item => {
num += item.num num += item.num
if (_this.isMember){ if (_this.isMember){
amount += item.memberPrice*item.num; amount += (item.memberPrice*item.num).toFixed(2);
}else { }else {
amount += item.retailPrice*item.num; amount += (item.retailPrice*item.num).toFixed(2);
} }
}) })
this.goodsTotal = num; this.goodsTotal = num;
@ -2147,6 +2395,9 @@
getOilGun({numberId:numberId}).then(response => { getOilGun({numberId:numberId}).then(response => {
this.gunList = response.data.records; this.gunList = response.data.records;
}) })
oilNumberList().then(response => {
this.oilNumberList = response.data.records;
})
}, },
}, },
@ -2154,6 +2405,17 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.after-box{
width: 31%;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px;
box-sizing: border-box;
background-color: #0270ff;
height: 110px;
padding: 10px;
color: white;
}
.but{ .but{
width: 150px; width: 150px;
height: 50px; height: 50px;