收银台

This commit is contained in:
cun-nan 2023-11-17 16:33:36 +08:00
parent 22ce14d906
commit b9b49fcb62
7 changed files with 434 additions and 201 deletions

View File

@ -64,7 +64,7 @@ public class OilOrder extends BaseEntity implements Serializable {
/**
* 油枪号
*/
private Integer oilGunNum;
private String oilGunNum;
/**
* 油品数量
*/

View File

@ -209,7 +209,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
order.setStaffId(staffId);
order.setTerminal(terminal);
order.setOils((String) jsonObjects.get(i).get("oilName"));
order.setOilGunNum(Integer.valueOf(jsonObjects.get(i).get("oilGunNum").toString()));
order.setOilGunNum(jsonObjects.get(i).get("gunName").toString());
order.setOilNum(oilNum);
order.setDiscountAmount(oilDiscount);
order.setPayUser(payUser);

View File

@ -29,11 +29,12 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="OilGunMap">
select
og.id, og.gun_name, og.tank_id, og.status, og.store_id, og.create_time,og.update_time, og.create_by, og.update_by, ot.oil_number, ot.number_id
og.id, og.gun_name, og.tank_id, og.status, og.store_id, og.create_time,og.update_time, og.create_by,
og.update_by, ot.oil_number, ot.number_id, ot.tank_name
from oil_gun og
left join oil_tank ot on og.tank_id = ot.id
<where>
og.store_id = #{oilGun.storeId}
og.store_id = #{oilGun.storeId} and og.status = '启用'
<if test="oilGun.numberId != null">
and ot.number_id = #{oilGun.numberId}

View File

@ -40,7 +40,7 @@
<!-- from oil_number-->
<select id="selectOilNumberById" resultType="com.fuint.business.petrolStationManagement.entity.OilNumber">
<include refid="selectOilNumber"></include>
where number_id = #{numberId}
where number_id = #{id}
</select>
<insert id="insertOilNumber">
insert into oil_number

View File

@ -1,5 +1,14 @@
import request from "@/utils/request";
// 查询油枪列表信息
export function getOilGun(data) {
return request({
url: '/business/petrolStationManagement/oilGun/queryByPage',
method: 'get',
params: data
})
}
// 查询油罐列表
export function getGunApi(data) {
return request({
@ -8,6 +17,7 @@ export function getGunApi(data) {
params: data
})
}
// 新增有关信息
export function insertGunApi(data) {
return request({

View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 根据id查询油号油枪列表
export function getOilNumberById(id) {
return request({
url: '/business/petrolStationManagement/oilNumber/' +id ,
method: 'get',
// data: data
})
}

View File

@ -54,31 +54,162 @@
<div class="hj-box" style="justify-content: flex-end">合计: {{ oilAmount + goodsAmount }}</div>
</div>
<div class="center-left-hj">
<div>满减活动</div>
<div>-{{ oilDiscount + goodsDiscount }}</div>
<div>
<el-popover
placement="bottom-start"
width="400"
trigger="click">
<div>
<el-checkbox-group v-model="checkedCities1" @change="handleCheckedCitiesChange1">
<el-checkbox v-for="city in cities1" :label="city" :key="city">
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
<div style="width: 200px">{{city}}</div>
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: red">-1.56</div>
<div style="color: grey">满100元每升优惠0.2</div>
</div>
</div>
</el-checkbox>
</el-checkbox-group>
</div>
<div slot="reference">
<el-checkbox :indeterminate="isIndeterminate1"
style="color: black;font-size: 16px"
v-model="checkAll1" @change="handleCheckAllChange1">
</el-checkbox>
满减活动
</div>
</el-popover>
</div>
<div>-{{ fullReduction + goodsDiscount }}</div>
</div>
<div class="center-left-hj" v-show="isMember">
<div>充值优惠</div>
<div>-0</div>
<div>
<el-popover
placement="bottom-start"
width="400"
trigger="click">
<div>
<el-checkbox-group v-model="checkedCities2" @change="handleCheckedCitiesChange2">
<el-checkbox v-for="(item,index) in gradeDiscount" :label="item.type" :key="index">
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
<div style="width: 200px">{{item.type}}</div>
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: red">-{{ oilDiscount }}</div>
<div v-if="item.type=='满减优惠'" style="color: grey">消费满{{ item.full }}立减{{ item.reduce }}</div>
<div v-else style="color: grey">消费满{{ item.full }}每升优惠{{ item.reduce }}</div>
</div>
</div>
</el-checkbox>
</el-checkbox-group>
</div>
<div slot="reference">
<el-checkbox :indeterminate="isIndeterminate2"
style="color: black;font-size: 16px"
v-model="checkAll2" @change="handleCheckAllChange2">
</el-checkbox>
等级优惠
</div>
</el-popover>
</div>
<div>-{{ oilDiscount + goodsDiscount }}</div>
</div>
<div class="center-left-hj" v-show="isMember && refuelMoney!=null">
<div>
囤油卡
<div style="margin: 5px 0" v-for="(item,index) in refuelMoney" :key="index">
{{ item.type }}
<span style="color: #00afff">{{ item.oilType }}</span>
余额{{ item.refuelMoney }}L
</div>
<el-popover
placement="bottom-start"
width="400"
trigger="click">
<div>
<el-checkbox-group v-model="checkedCities3" @change="handleCheckedCitiesChange3">
<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="width: 200px">{{city}}</div>
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: red">-1.56</div>
<div style="color: grey">满100元每升优惠0.2</div>
</div>
</div>
</el-checkbox>
</el-checkbox-group>
</div>
<div slot="reference">
<el-checkbox :indeterminate="isIndeterminate3"
style="color: black;font-size: 16px"
v-model="checkAll3" @change="handleCheckAllChange3">
</el-checkbox>
囤油卡
<div style="margin: 5px 0" v-for="(item,index) in refuelMoney" :key="index">
{{ item.type }}
<span style="color: #00afff">{{ item.oilType }}</span>
余额{{ item.refuelMoney }}L
</div>
</div>
</el-popover>
</div>
<div>- {{ consumeRefuelMoney }}L</div>
</div>
<div class="center-left-hj" v-show="isMember">
<div>
储值卡
<span>账户余额{{ balance }}</span>
<el-popover
placement="bottom-start"
width="400"
trigger="click">
<div>
<el-checkbox-group v-model="checkedCities4" @change="handleCheckedCitiesChange4">
<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="width: 200px">{{city}}</div>
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: red">-1.56</div>
<div style="color: grey">满100元每升优惠0.2</div>
</div>
</div>
</el-checkbox>
</el-checkbox-group>
</div>
<div slot="reference">
<el-checkbox :indeterminate="isIndeterminate4"
style="color: black;font-size: 16px"
v-model="checkAll4" @change="handleCheckAllChange4">
</el-checkbox>
储值卡
<span>账户余额{{ balance }}</span>
</div>
</el-popover>
</div>
<div>-{{ consumeAmount }}</div>
</div>
<div class="center-left-hj" v-show="isMember">
<div>
<el-popover
placement="bottom-start"
width="400"
trigger="click">
<div>
<el-checkbox-group v-model="checkedCities5" @change="handleCheckedCitiesChange5">
<el-checkbox v-for="city in cities5" :label="city" :key="city">
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
<div style="width: 200px">{{city}}</div>
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: red">-1.56</div>
<div style="color: grey">满100元每升优惠0.2</div>
</div>
</div>
</el-checkbox>
</el-checkbox-group>
</div>
<div slot="reference">
<el-checkbox :indeterminate="isIndeterminate5"
style="color: black;font-size: 16px"
v-model="checkAll5" @change="handleCheckAllChange5">
</el-checkbox>
优惠券
</div>
</el-popover>
</div>
<div>-{{ couponAmount }}</div>
</div>
<div class="center-left-th">
<div class="th-box">
<div>扫码支付</div>
@ -86,7 +217,7 @@
</div>
<div class="th-box">
<div>找零</div>
<div class="bule">0</div>
<div class="bule">{{ seekZero }}</div>
</div>
<div class="th-box">
<div @click="dialogVisible = true">加油员</div>
@ -129,6 +260,18 @@
<div class="center-top-data">
<div class="center-top-of">
<div class="wrap-wrap">
<div class="of-box" v-for="(item,index) in gunList" :key="index"
:style="{'background-color': colorList[index%5].color}"
@click="refuel(item)">
<!-- <div>{{ getName(oilNameList,item.oilName) }}</div>-->
<div>{{ item.oilNumber }}</div>
<div class="of-title" >{{item.gunName}}</div>
<div style="display: flex;justify-content: space-between">
<img src="../../../assets/images/jya.png" style="width: 18px;height: 18px;">
<span style="font-size: 12px">{{ item.tankName }}</span>
</div>
</div>
<!-- <div class="of-box" v-for="(item,index) in oilNumGunList" :key="index"-->
<!-- :style="{'background-color': colorList[index%5].color}"-->
<!-- @click="refuel(item.id)">-->
@ -139,16 +282,6 @@
<!-- <img src="../../../assets/images/jya.png" style="width: 18px;height: 18px;">-->
<!-- </div>-->
<!-- </div>-->
<div class="of-box" v-for="(item,index) in oilNumGunList" :key="index"
:style="{'background-color': colorList[index%5].color}"
@click="refuel(item.id)">
<div>{{ getName(oilNameList,item.oilName) }}</div>
<div class="of-title" >{{item.oilGunNum}}号枪</div>
<div>
<img src="../../../assets/images/jya.png" style="width: 18px;height: 18px;">
</div>
</div>
</div>
</div>
@ -359,18 +492,19 @@
<div style="text-align: center;margin-bottom: 10px">
合计金额{{ oilAmount + goodsAmount }}优惠合计{{ oilDiscount + goodsDiscount }}
</div>
<div>
<el-input v-model="authCode"
autofocus="autofocus"
@keydown.enter.native="collection"
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
<i
slot="suffix">
<svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"><path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path></svg>
</i>
</el-input>
</div>
<div class="demo-image">
<div v-if="map.payType != 'CASH'">
<div>
<el-input v-model="authCode"
autofocus="autofocus"
@keydown.enter.native="collection"
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
<i
slot="suffix">
<svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"><path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path></svg>
</i>
</el-input>
</div>
<div class="demo-image"></div>
<div class="block" style="text-align: center">
<el-image
style="width: 200px; height: 200px"
@ -378,6 +512,20 @@
src="https://oil.wudb.cn/static/img/scan-demo.fcb8b1ab.png"></el-image>
</div>
</div>
<div v-else>
<div>
<el-input v-model="authCode"
autofocus="autofocus"
@input="changeSeekZero"
@keydown.enter.native="collection"
placeholder="请输入收款金额">
</el-input>
</div>
<div style="text-align: right;margin: 10px 0">
<span>应找零</span>
<span style="color: red;font-size: 18px"> {{ seekZero }}</span>
</div>
</div>
<el-divider></el-divider>
<span slot="footer" class="dialog-footer" style="display: flex;justify-content: space-around">
<el-button @click="dialogVisiblej = false" class="but"> </el-button>
@ -430,7 +578,7 @@
<el-descriptions-item label="会员备注">{{member.remark ? member.remark : "--"}}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="会员等级">
<el-descriptions-item label="等级名称">{{member.gradeId ? member.gradeId : "--"}}</el-descriptions-item>
<el-descriptions-item label="等级名称">{{member.gradeId ? getGradeName(gradeList,member.gradeId) : "--"}}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="储值余额">
<template slot="extra">
@ -442,7 +590,7 @@
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisiblevip = false"> </el-button>
<el-button type="primary" @click="chooseUser(member)"> </el-button>
<el-button type="primary" :disabled="isSure" @click="chooseUser(member)"> </el-button>
</span>
</el-dialog>
@ -458,7 +606,7 @@
</div>
<div class="amount">
<span>已选油枪</span>
<span class="amountBlue">{{ form.oilGunNum }}号枪</span>
<span class="amountBlue">{{ form.gunName }}</span>
</div>
<div class="amount">
<span>油品单价</span>
@ -527,26 +675,58 @@
import {getUserVoMobile, getUserVoName} from "@/api/cashier/user";
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
import {addLJGoods, goodsOrder, oilOrder} from "@/api/cashier/oilorder";
import {getUserGrade} from "@/api/cashier/usergrade";
import {getGunApi} from "@/api/cashier/oilGuns";
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";
const cityOptions = ['上海', '北京'];
export default {
name: "homeindex",
data(){
return{
//
checkAll1: false,
isIndeterminate1: true,
checkedCities1: ['上海'],
cities1: cityOptions,
//
checkAll2: false,
isIndeterminate2: true,
checkedCities2: [],
cities2: cityOptions,
gradeDiscount: [],
//
checkAll3: false,
isIndeterminate3: true,
checkedCities3: ['上海'],
cities3: cityOptions,
//
checkAll4: false,
isIndeterminate4: true,
checkedCities4: ['上海'],
cities4: cityOptions,
//
checkAll5: false,
isIndeterminate5: true,
checkedCities5: ['上海'],
cities5: cityOptions,
//
couponList:[],
//
consumeRefuelMoney:0,
//
fullReduction:0,
//
refuelMoney:null,
//
consumeAmount:0,
//
balance:0,
//
//
amount:0,
//
seekZero:0,
//
loading:false,
//
@ -591,7 +771,7 @@
//
memberList:[],
select1:'会员手机号',
//
//
userNo:"",
//
goods:"",
@ -653,7 +833,7 @@
//
goodsOrder:"",
//
payType:"WECHAT",
payType:"CASH",
//
oilAmount:0,
//
@ -688,16 +868,29 @@
consumeAmount:0,
// json
refuelMoney:"",
//
seekZero:0,
},
//
gradeName:"",
//
gradeList:"",
menu:1,
index:0,
//
isPay:true,
isPaySuccess:false,
//
orderNo:'',
timer: null,
//
isQuery:true,
//
gunList:[],
//
isSure:true,
//
couponAmount:0,
}
},
created() {
@ -710,6 +903,71 @@
this.getCouponList();
},
methods:{
//
changeSeekZero(){
this.seekZero = this.authCode - this.oilActualPay - this.goodsActualPay
},
// id
getGradeName(list,id){
let name = "";
list.forEach(item => {
if (item.id == id){
name = item.name
}
})
this.gradeName = name;
return name;
},
//
handleCheckAllChange1(val) {
this.checkedCities1 = val ? cityOptions : [];
this.isIndeterminate1 = false;
},
handleCheckedCitiesChange1(value) {
let checkedCount = value.length;
this.checkAll1 = checkedCount === this.cities1.length;
this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.cities1.length;
},
handleCheckAllChange2(val) {
let list = []
this.gradeDiscount.forEach(item => {
list.push(item.type)
})
this.checkedCities2 = val ? list : [];
this.isIndeterminate2 = false;
},
handleCheckedCitiesChange2(value) {
let checkedCount = value.length;
this.checkAll2 = checkedCount === this.gradeDiscount.length;
this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length;
},
handleCheckAllChange3(val) {
this.checkedCities3 = val ? cityOptions : [];
this.isIndeterminate3 = false;
},
handleCheckedCitiesChange3(value) {
let checkedCount = value.length;
this.checkAll3 = checkedCount === this.cities3.length;
this.isIndeterminate3 = checkedCount > 0 && checkedCount < this.cities3.length;
},
handleCheckAllChange4(val) {
this.checkedCities4 = val ? cityOptions : [];
this.isIndeterminate4 = false;
},
handleCheckedCitiesChange4(value) {
let checkedCount = value.length;
this.checkAll4 = checkedCount === this.cities4.length;
this.isIndeterminate4 = checkedCount > 0 && checkedCount < this.cities4.length;
},
handleCheckAllChange5(val) {
this.checkedCities5 = val ? cityOptions : [];
this.isIndeterminate5 = false;
},
handleCheckedCitiesChange5(value) {
let checkedCount = value.length;
this.checkAll5 = checkedCount === this.cities5.length;
this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.cities5.length;
},
//
querySearch(queryString, cb) {
let _this = this;
@ -778,14 +1036,16 @@
this.oilDiscount = 0;
this.goodsDiscount = 0;
this.userNo = "";
this.oilActualPay = this.oilAmount - this.oilDiscount
this.oilActualPay = this.oilAmount - this.oilDiscount - this.couponAmount
this.goodsActualPay = this.goodsAmount - this.goodsDiscount
this.isSure = true;
this.handleChange();
},
//
getGrade(id){
let _this = this;
this.oilDiscount = 0;
this.gradeDiscount = [];
getUserGrade(id).then( response => {
let gasolineDiscount = 0;
let dieselDiscount = 0;
@ -796,40 +1056,58 @@
if (response.data.preferential == '自定义优惠' && response.data.status == 'qy'){
if (response.data.gasolineDiscount=="满减优惠"){
let oilDiscount = 0;
let discount = {type:"满减优惠",full:0,reduce: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){
oilDiscount = (item.amount/gasolineRule[gasolineRule.length-1].gasolineRule1 *
gasolineRule[gasolineRule.length-1].gasolineRule2).toFixed(2);
discount.reduce = gasolineRule[i-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.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.reduce = gasolineRule[i-1].gasolineRule2
}
}
}
if (discount.reduce!=0){
_this.gradeDiscount.push(discount)
}
gasolineDiscount += +oilDiscount
}else if (response.data.gasolineDiscount=="每升优惠"){
let discount = {type:"每升优惠",full:0,reduce:0}
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){
oilDiscount = (item.liters * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2);
discount.reduce = gasolineRule[i-1].gasolineRule3
break;
}
if (item.amount >= gasolineRule[i-1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1){
oilDiscount = (item.liters * gasolineRule[i-1].gasolineRule3).toFixed(2)
discount.reduce = gasolineRule[i-1].gasolineRule3
}
}else {
if (item.amount >= gasolineRule[i-1].gasolineRule1){
oilDiscount = (item.liters * gasolineRule[i-1].gasolineRule3).toFixed(2)
discount.reduce = gasolineRule[i-1].gasolineRule3
}
}
}
if (discount.reduce!=0){
_this.gradeDiscount.push(discount)
}
gasolineDiscount += +oilDiscount
}else {
gasolineDiscount = 0;
@ -841,40 +1119,60 @@
if (response.data.preferential == '自定义优惠' && response.data.status == 'qy'){
if (response.data.dieselDiscount=="满减优惠"){
let oilDiscount = 0;
let discount = {type:"满减优惠",full:0,reduce:0}
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
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.reduce = dieselRule[i-1].dieselRule2
}
}else {
if (item.amount >= dieselRule[i-1].dieselRule1){
oilDiscount = (item.amount/dieselRule[i-1].dieselRule1 * dieselRule[i-1].dieselRule2).toFixed(2);
discount.reduce = dieselRule[i-1].dieselRule2
}
}
}
if (discount.reduce!=0){
_this.gradeDiscount.push(discount)
_this.checkedCities2 = ['满减优惠']
}
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.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
break;
}
if (item.amount >= dieselRule[i-1].dieselRule1 && item.amount < dieselRule[i].dieselRule1){
oilDiscount = (item.liters * dieselRule[i-1].dieselRule3).toFixed(2)
discount.reduce = dieselRule[i-1].dieselRule3
}
}else {
if (item.amount >= dieselRule[i-1].dieselRule1){
oilDiscount = (item.liters * dieselRule[i-1].dieselRule3).toFixed(2)
discount.reduce = dieselRule[i-1].dieselRule3
}
}
}
if (discount.reduce!=0){
_this.gradeDiscount.push(discount)
}
dieselDiscount += +oilDiscount
}else {
dieselDiscount = 0;
@ -886,40 +1184,58 @@
if (response.data.preferential == '自定义优惠' && response.data.status == 'qy'){
if (response.data.naturalGasDiscount=="满减优惠"){
let oilDiscount = 0;
let discount = {type:"满减优惠",full:0,reduce:0}
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
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.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.reduce = naturalGasRule[i-1].naturalGasRule2
}
}
}
if (discount.reduce!=0){
_this.gradeDiscount.push(discount)
}
naturalGasDiscount += +oilDiscount
}else if (response.data.naturalGasDiscount=="每单位优惠"){
let oilDiscount = 0;
let discount = {type:"每单位优惠",full:0,reduce:0}
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.liters * naturalGasRule[gasolineRule.length-1].naturalGasRule3).toFixed(2)
discount.reduce = naturalGasRule[i-1].naturalGasRule3
break;
}
if (item.amount >= naturalGasRule[i-1].naturalGasRule1 && item.amount < naturalGasRule[i].naturalGasRule1){
oilDiscount = (item.liters * naturalGasRule[i-1].naturalGasRule3).toFixed(2)
discount.reduce = naturalGasRule[i-1].naturalGasRule3
}
}else {
if (item.amount >= naturalGasRule[i-1].naturalGasRule1){
oilDiscount = (item.liters * naturalGasRule[i-1].naturalGasRule3).toFixed(2)
discount.reduce = naturalGasRule[i-1].naturalGasRule3
}
}
}
if (discount.reduce!=0){
_this.gradeDiscount.push(discount)
}
naturalGasDiscount += +oilDiscount
}else {
naturalGasDiscount = 0;
@ -927,143 +1243,15 @@
}
}
})
// if (_this.oilType == ""){
// let gasolineRule = JSON.parse(response.data.gasolineRule);
// if (response.data.preferential == '' && response.data.status == 'qy'){
// _this.oilOrder.forEach(item => {
// if (response.data.gasolineDiscount==""){
// let oilDiscount = 0;
// for (let i = 0; i < gasolineRule.length; i++){
// if (gasolineRule.length>1){
// if (item.amount >= gasolineRule[i].gasolineRule1 && item.amount < gasolineRule[i+1].gasolineRule1){
// oilDiscount = item.amount/gasolineRule[i].gasolineRule1 * gasolineRule[i].gasolineRule2
// }
// if (item.amount >= gasolineRule[gasolineRule.length-1].gasolineRule1){
// oilDiscount = item.amount/gasolineRule[gasolineRule.length-1].gasolineRule1 * gasolineRule[gasolineRule.length-1].gasolineRule2
// }
// }else {
// if (item.amount >= gasolineRule[i].gasolineRule1){
// oilDiscount = item.amount/gasolineRule[i].gasolineRule1 * gasolineRule[i].gasolineRule2
// }
// }
// }
// gasolineDiscount += oilDiscount
// }else if (response.data.gasolineDiscount==""){
// let oilDiscount = 0;
// for (let i = 0; i < gasolineRule.length; i++){
// if (gasolineRule.length>1){
// if (item.amount >= gasolineRule[i].gasolineRule1 && item.amount < gasolineRule[i+1].gasolineRule1){
// oilDiscount = item.liters * gasolineRule[i].gasolineRule3
// }
// if (item.amount >= gasolineRule[gasolineRule.length-1].gasolineRule1){
// oilDiscount = item.liters * gasolineRule[i].gasolineRule3
// }
// }else {
// if (item.amount >= gasolineRule[i].gasolineRule1){
// oilDiscount = item.liters * gasolineRule[i].gasolineRule3
// }
// }
// }
// gasolineDiscount += oilDiscount
// }else {
// gasolineDiscount = 0;
// }
// })
// }
// }
// if (_this.oilType == ""){
// let dieselRule = JSON.parse(response.data.dieselRule);
// if (response.data.preferential == '' && response.data.status == 'qy'){
// _this.oilOrder.forEach(item => {
// if (response.data.dieselDiscount==""){
// let oilDiscount = 0;
// for (let i = 0; i < dieselRule.length; i++){
// if (dieselRule.length>1){
// if (item.amount >= dieselRule[i].dieselRule1 && item.amount < dieselRule[i+1].dieselRule1){
// oilDiscount = item.amount/dieselRule[i].dieselRule1 * dieselRule[i].dieselRule2
// }
// if (item.amount >= dieselRule[dieselRule.length-1].dieselRule1){
// oilDiscount = item.amount/dieselRule[dieselRule.length-1].dieselRule1 * dieselRule[dieselRule.length-1].dieselRule2
// }
// }else {
// if (item.amount >= dieselRule[i].dieselRule1){
// oilDiscount = item.amount/dieselRule[i].dieselRule1 * dieselRule[i].dieselRule2
// }
// }
// }
// dieselDiscount += oilDiscount
// }else if (response.data.dieselDiscount==""){
// let oilDiscount = 0;
// for (let i = 0; i < dieselRule.length; i++){
// if (dieselRule.length>1){
// if (item.amount >= dieselRule[i].dieselRule1 && item.amount < dieselRule[i+1].dieselRule1){
// oilDiscount = item.liters * dieselRule[i].dieselRule3
// }
// if (item.amount >= dieselRule[dieselRule.length-1].dieselRule1){
// oilDiscount = item.liters * dieselRule[i].dieselRule3
// }
// }else {
// if (item.amount >= dieselRule[i].dieselRule1){
// oilDiscount = item.liters * dieselRule[i].dieselRule3
// }
// }
// }
// dieselDiscount += oilDiscount
// }else {
// dieselDiscount = 0;
// }
// })
// }
// }
// if (_this.oilType == ""){
// let naturalGasRule = JSON.parse(response.data.naturalGasRule);
// if (response.data.preferential == '' && response.data.status == 'qy'){
// _this.oilOrder.forEach(item => {
// if (response.data.naturalGasDiscount==""){
// let oilDiscount = 0;
// for (let i = 0; i < naturalGasRule.length; i++){
// if (naturalGasRule.length>1){
// if (item.amount >= naturalGasRule[i].naturalGasRule1 && item.amount < naturalGasRule[i+1].naturalGasRule1){
// oilDiscount = item.amount/naturalGasRule[i].naturalGasRule1 * naturalGasRule[i].naturalGasRule2
// }
// if (item.amount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){
// oilDiscount = item.amount/naturalGasRule[naturalGasRule.length-1].naturalGasRule1 * naturalGasRule[naturalGasRule.length-1].naturalGasRule2
// }
// }else {
// if (item.amount >= naturalGasRule[i].naturalGasRule1){
// oilDiscount = item.amount/naturalGasRule[i].naturalGasRule1 * naturalGasRule[i].naturalGasRule2
// }
// }
// }
// naturalGasDiscount += oilDiscount
// }else if (response.data.naturalGasDiscount==""){
// let oilDiscount = 0;
// for (let i = 0; i < naturalGasRule.length; i++){
// if (naturalGasRule.length>1){
// if (item.amount >= naturalGasRule[i].naturalGasRule1 && item.amount < naturalGasRule[i+1].naturalGasRule1){
// oilDiscount = item.liters * naturalGasRule[i].naturalGasRule3
// }
// if (item.amount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){
// oilDiscount = item.liters * naturalGasRule[i].naturalGasRule3
// }
// }else {
// if (item.amount >= naturalGasRule[i].naturalGasRule1){
// oilDiscount = item.liters * naturalGasRule[i].naturalGasRule3
// }
// }
// }
// naturalGasDiscount += oilDiscount
// }else {
// naturalGasDiscount = 0;
// }
// })
// }
// }
let oilActualPay = _this.oilActualPay;
_this.oilDiscount = gasolineDiscount + dieselDiscount + naturalGasDiscount
_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;
@ -1083,19 +1271,22 @@
this.getGrade(data.gradeId)
this.changeRefuelMoney();
this.handleChange();
this.queryCoupon(this.couponList,data.id);
},
// 使
queryCoupon(list,id){
let result = false;
list.forEach(item => {
if (item.mtUserId==id){
}
})
// let result = false;
// list.forEach(item => {
// if (item.mtUserId==id){
// let startTime = item.startTime;
// let endTime = item.endTime;
// let date = new Date();
// let sysDate = `${date.getFullYear()}-${date.getMonth() - 1}-${date.getDate()}`
// }
// })
},
//
handleChoose(data){
this.isSure = false;
this.member = data;
this.refuelMoney = JSON.parse(data.refuelMoney)
this.dialogVisibleMember = false;
@ -1166,6 +1357,8 @@
},
//
settlement(){
this.authCode = ""
this.seekZero = 0;
this.isPay = true
this.dialogVisiblej = true
},
@ -1199,8 +1392,8 @@
this.form.amount = this.form.oilPrice * this.form.amount
}
//
let name1 = this.getName(this.oilNameList,this.form.oilName);
this.form.oilType = name1;
// let name1 = this.getName(this.oilNameList,this.form.oilName);
// this.form.oilType = name1;
this.oilOrder.push(this.form)
if (this.select == "元"){
@ -1228,6 +1421,7 @@
this.changeRefuelMoney();
}
},
//
changeRefuelMoney(){
let _this = this;
_this.consumeRefuelMoney = 0;
@ -1331,17 +1525,26 @@
})
},
//
refuel(id){
refuel(data){
this.select = "元";
this.amount = 0
this.dialogVisibleamount = true;
getOilNumGunById(id).then( response => {
getOilNumberById(data.numberId).then( response => {
this.form = response.data;
this.gunList.forEach(item => {
if (item.id==data.id){
this.form.gunName = item.gunName
}
})
})
// getOilNumGunById(id).then( response => {
// this.form = response.data;
// })
},
//
collection(){
// JSON.parse()
this.map.seekZero = this.seekZero;
this.map.oilAmount = this.oilAmount;
this.map.goodsAmount = this.goodsAmount;
this.map.oilActualPay = this.oilActualPay;
@ -1500,8 +1703,10 @@
this.goodsActualPay = 0;
this.goodsDiscount = 0;
this.consumeAmount = 0;
this.consumeRefuelMoney = 0;
this.oilTotal = 0;
this.goodsTotal = 0;
this.isMember = false;
}
this.isPay = true;
this.dialogVisiblej = false
@ -1557,11 +1762,12 @@
}
})
if (tab.label == "全部"){
oilNum = "全部"
oilNum = ""
}
getOilNumGun({oilNum : oilNum}).then( response => {
this.oilNumGunList = response.data
})
this.getList(oilNum)
// getOilNumGun({oilNum : oilNum}).then( response => {
// this.oilNumGunList = response.data
// })
},
gocomponents(index){
this.leftindex = index
@ -1571,12 +1777,18 @@
listCardFavorableRecord().then(response => {
this.couponList = response.data.records
})
let map = {
page:1,
pageSize:20,
}
listUserGrade(map).then(response => {
this.gradeList = response.data.records
})
},
//
getList(){
getGunApi().then(response => {
this.gunList = response.data;
// console.log(this.gunList)
//
getList(numberId){
getOilGun({numberId:numberId}).then(response => {
this.gunList = response.data.records;
})
},
},