收银台

This commit is contained in:
cun-nan 2023-11-20 19:53:05 +08:00
parent 6ecbe933fe
commit 7ec55c0386
10 changed files with 468 additions and 33 deletions

View File

@ -64,7 +64,7 @@ public class HangBillController extends BaseController {
* @return * @return
*/ */
@PostMapping @PostMapping
public ResponseObject add(@Validated @RequestBody HangBill hangBill){ public ResponseObject add(@Validated @RequestBody HangBillVo hangBill){
return getSuccessResult(hangBillService.insertHangBill(hangBill)); return getSuccessResult(hangBillService.insertHangBill(hangBill));
} }

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.order.mapper.HangBillMapper"> <mapper namespace="com.fuint.business.order.mapper.HangBillMapper">
<sql id="selectHangBill"> <sql id="selectHangBill">
select hb.*,ms.real_name,ms.mobile,cu.unit_name,cu.person_credit,cu.contact_mobile select hb.*,ms.real_name,ms.mobile,cu.unit_name,cu.person_credit,cu.contact_mobile,cu.credit_limit
from hang_bill hb from hang_bill hb
inner join mt_staff ms on hb.staff_id = ms.id inner join mt_staff ms on hb.staff_id = ms.id
inner join credit_unit cu on hb.credit_unit_id = cu.id inner join credit_unit cu on hb.credit_unit_id = cu.id

View File

@ -15,10 +15,23 @@ public interface CreditUnitService extends IService<CreditUnit> {
*/ */
public List<CreditUnit> selectCreditUnitList(); public List<CreditUnit> selectCreditUnitList();
/**
* 根据id查询挂账单位信息
* @return
*/
public CreditUnit selectCreditUnitListById(int id);
/** /**
* 添加挂账单位信息 * 添加挂账单位信息
* @param creditUnit * @param creditUnit
* @return * @return
*/ */
public int insertCreditUnit(CreditUnit creditUnit); public int insertCreditUnit(CreditUnit creditUnit);
/**
* 修改挂账单位信息
* @param creditUnit
* @return
*/
public int updateCreditUnit(CreditUnit creditUnit);
} }

View File

@ -46,7 +46,7 @@ public interface HangBillService extends IService<HangBill> {
* @param hangBill * @param hangBill
* @return * @return
*/ */
public int insertHangBill(HangBill hangBill); public int insertHangBill(HangBillVo hangBill);
/** /**
* 修改挂账记录 并收款 * 修改挂账记录 并收款

View File

@ -19,9 +19,21 @@ public class CreditUnitServiceImpl extends ServiceImpl<CreditUnitMapper, CreditU
return list; return list;
} }
@Override
public CreditUnit selectCreditUnitListById(int id) {
CreditUnit creditUnit = baseMapper.selectById(id);
return creditUnit;
}
@Override @Override
public int insertCreditUnit(CreditUnit creditUnit) { public int insertCreditUnit(CreditUnit creditUnit) {
int row = baseMapper.insert(creditUnit); int row = baseMapper.insert(creditUnit);
return row; return row;
} }
@Override
public int updateCreditUnit(CreditUnit creditUnit) {
int row = baseMapper.updateById(creditUnit);
return row;
}
} }

View File

@ -11,8 +11,10 @@ import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService; import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.service.OilConfigService; import com.fuint.api.fuyou.service.OilConfigService;
import com.fuint.business.order.entity.CreditUnit;
import com.fuint.business.order.entity.HangBill; import com.fuint.business.order.entity.HangBill;
import com.fuint.business.order.mapper.HangBillMapper; import com.fuint.business.order.mapper.HangBillMapper;
import com.fuint.business.order.service.CreditUnitService;
import com.fuint.business.order.service.HangBillService; import com.fuint.business.order.service.HangBillService;
import com.fuint.business.order.vo.HangBillVo; import com.fuint.business.order.vo.HangBillVo;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
@ -28,6 +30,9 @@ import java.util.*;
*/ */
@Service @Service
public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> implements HangBillService { public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> implements HangBillService {
@Autowired
private CreditUnitService creditUnitService;
@Override @Override
public IPage<HangBillVo> selectHangBillList(Page page, HangBillVo hangBill) { public IPage<HangBillVo> selectHangBillList(Page page, HangBillVo hangBill) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
@ -60,9 +65,25 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
} }
@Override @Override
public int insertHangBill(HangBill hangBill) { public int insertHangBill(HangBillVo hangBillVo) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId(); Integer storeId = nowAccountInfo.getStoreId();
// 根据挂账单位id查询挂账单位信息
CreditUnit creditUnit = creditUnitService.selectCreditUnitListById(hangBillVo.getCreditUnitId());
// 挂账单位限额的数据删减
if (creditUnit.getCreditLimit()!=0){
Double creditLimit = creditUnit.getCreditLimit();
// 判断修改之后的挂账单位限额金额是否小于0
if (creditLimit-hangBillVo.getAmount()>=0){
creditUnit.setCreditLimit(creditLimit-hangBillVo.getAmount());
creditUnitService.updateCreditUnit(creditUnit);
}else {
return 0;
}
}
// 创建挂账记录对象
HangBill hangBill = new HangBill();
hangBill.setStoreId(storeId); hangBill.setStoreId(storeId);
// 根据日期生成订单号 // 根据日期生成订单号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
@ -70,10 +91,17 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
String orderNo = timestamp+randomString; String orderNo = timestamp+randomString;
Integer staffId = nowAccountInfo.getStaffId(); Integer staffId = nowAccountInfo.getStaffId();
hangBill.setStaffId(staffId); hangBill.setStaffId(staffId);
hangBill.setOrderNo(orderNo); hangBill.setOrderNo(orderNo);
hangBill.setOutstandAmount(hangBill.getAmount()); hangBill.setOutstandAmount(hangBillVo.getAmount());
hangBill.setRepaidAmount(0.0); hangBill.setRepaidAmount(0.0);
hangBill.setCreditUnitId(hangBillVo.getCreditUnitId());
hangBill.setStatus("0");
hangBill.setReturnType("0");
hangBill.setAmount(hangBillVo.getAmount());
hangBill.setRemark(hangBillVo.getRemark());
hangBill.setPayStatus("unpaid");
int row = baseMapper.insert(hangBill); int row = baseMapper.insert(hangBill);
return row; return row;
} }
@ -96,6 +124,14 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
if (payType.equals("CASH")){ if (payType.equals("CASH")){
hangBill.setPayStatus("paid"); hangBill.setPayStatus("paid");
} }
// 根据挂账单位id查询挂账单位信息
CreditUnit creditUnit = creditUnitService.selectCreditUnitListById(hangBill.getCreditUnitId());
if (creditUnit.getCreditLimit()!=0){
Double creditLimit = creditUnit.getCreditLimit();
creditUnit.setCreditLimit(creditLimit+Double.valueOf(map.get("repaidAmount")));
}
int row = 0; int row = 0;
hangBill.setRemark(map.get("remark")); hangBill.setRemark(map.get("remark"));
// 支付成功后修改挂账信息 // 支付成功后修改挂账信息
@ -114,6 +150,8 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
}else { }else {
hangBill.setStatus("2"); hangBill.setStatus("2");
} }
// 修改挂账单位余额信息
creditUnitService.updateCreditUnit(creditUnit);
} }
row = baseMapper.updateById(hangBill); row = baseMapper.updateById(hangBill);
return baseMapper.selectById(Integer.parseInt(map.get("id"))); return baseMapper.selectById(Integer.parseInt(map.get("id")));
@ -127,6 +165,7 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
for (JSONObject jsonObject : jsonObjects) { for (JSONObject jsonObject : jsonObjects) {
// 现将需要修改的支付状态改为未支付 // 现将需要修改的支付状态改为未支付
HangBill hangBill1 = baseMapper.selectById((Integer) jsonObject.get("id")); HangBill hangBill1 = baseMapper.selectById((Integer) jsonObject.get("id"));
hangBill1.setPayStatus("unpaid"); hangBill1.setPayStatus("unpaid");
baseMapper.updateById(hangBill1); baseMapper.updateById(hangBill1);
HangBill hangBill = baseMapper.selectById((Integer) jsonObject.get("id")); HangBill hangBill = baseMapper.selectById((Integer) jsonObject.get("id"));
@ -196,6 +235,14 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
}else { }else {
hangBill.setStatus("2"); hangBill.setStatus("2");
} }
// 根据挂账单位id查询挂账单位信息
CreditUnit creditUnit = creditUnitService.selectCreditUnitListById(hangBill.getCreditUnitId());
if (creditUnit.getCreditLimit()!=0){
Double creditLimit = creditUnit.getCreditLimit();
creditUnit.setCreditLimit(creditLimit+repaidAmount1);
}
// 修改挂账单位余额信息
creditUnitService.updateCreditUnit(creditUnit);
return hangBill; return hangBill;
} }
} }

View File

@ -15,4 +15,6 @@ public class HangBillVo extends HangBill {
private String personCredit; private String personCredit;
// 联系电话 // 联系电话
private String contactMobile; private String contactMobile;
// 挂账额度
private String creditLimit;
} }

View File

@ -1,6 +1,6 @@
import request from '@/utils/request' import request from '@/utils/request'
// 扫码支付接口 // 优惠活动信息
export function selectPreferential(data) { export function selectPreferential(data) {
return request({ return request({
url: '/business/marketingActivity/activeExchange/selectConsumptionList', url: '/business/marketingActivity/activeExchange/selectConsumptionList',

View File

@ -270,6 +270,11 @@
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div>
<el-tag style="width: 100%;height: 40px;line-height: 40px;padding-left: 30px" type="info">
当前挂账为普通挂账方式,如需挂账油品交易等信息的账目,请前往收银台挂账
</el-tag>
</div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="open = false"> </el-button> <el-button @click="open = false"> </el-button>
<el-button type="primary" @click="addHangbill"> </el-button> <el-button type="primary" @click="addHangbill"> </el-button>
@ -825,9 +830,13 @@ import {getDicts} from "@/api/dict/data";
_this.form2.repaidAmount = _this.payAmount; _this.form2.repaidAmount = _this.payAmount;
_this.form2.authCode = _this.authCode; _this.form2.authCode = _this.authCode;
editHangBill(this.form2).then(response => { editHangBill(this.form2).then(response => {
if (response.data.payStatus == 'paid'){ if (response.data==null){
_this.isPaySuccess = true;
_this.isPay = false; }else {
if (response.data.payStatus == 'paid'){
_this.isPaySuccess = true;
_this.isPay = false;
}
} }
}) })
_this.loading = true; _this.loading = true;

View File

@ -61,12 +61,13 @@
trigger="click"> trigger="click">
<div> <div>
<el-checkbox-group v-model="checkedCities1" @change="handleCheckedCitiesChange1"> <el-checkbox-group v-model="checkedCities1" @change="handleCheckedCitiesChange1">
<el-checkbox v-for="city in cities1" :label="city" :key="city"> <el-checkbox v-for="(item,index) in fullReduceDiscount" :label="item.type" :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.type}}</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">-{{ fullReduction }}</div>
<div style="color: grey">满100元每升优惠0.2</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>
@ -232,6 +233,9 @@
:value="item.dictValue"> :value="item.dictValue">
<span @click="payMethod(item.dictValue)">{{ item.dictLabel }}</span> <span @click="payMethod(item.dictValue)">{{ item.dictLabel }}</span>
</div> </div>
<div class="wrap-box" >
<span @click="addCredits">挂账</span>
</div>
</div> </div>
<div class="center-left-bottom"> <div class="center-left-bottom">
<div> <div>
@ -665,12 +669,125 @@
</el-table> </el-table>
</div> </div>
</el-dialog> </el-dialog>
<!-- 新增挂账信息-->
<el-dialog
title="挂账" width="700px"
:visible.sync="dialogVisibleCredit"
:close-on-click-modal="false">
<el-form ref="form" :model="form1" :rules="rules" label-width="120px">
<el-row>
<el-col :span="24">
<el-form-item label="挂账单位" prop="unitName" style="width: 420px">
<el-autocomplete
popper-class="my-autocomplete"
v-model="form1.unitName"
style="width: 180%"
:fetch-suggestions="querySearch1"
placeholder="请选择挂账单位"
@select="changeUnit">
<template slot-scope="{ item }">
<div style="display: flex;justify-content: space-between">
{{item.unitName}}{{item.personCredit}} {{item.contactMobile}}
</div>
</template>
<el-button slot="append" @click="open1 = true">新增挂账单位</el-button>
</el-autocomplete>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="可用额度" prop="creditLimit">
<el-input v-model="form1.creditLimit" placeholder="请先选择挂账单位" disabled>
<template slot="append"></template>
</el-input>
<span style="font-size: 12px;color: grey;">
可用额度为挂账人的最大可用额度,如挂账金额大于可用额度,将无法进行挂账,0为不限额
</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="挂账金额" prop="amount">
<el-input v-model="form1.amount" placeholder="请输入挂账金额" maxlength="30" >
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注信息" prop="remark">
<el-input v-model="form1.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleCredit = false"> </el-button>
<el-button type="primary" @click="addHangbill"> </el-button>
</span>
</el-dialog>
<!-- 新增挂账单位信息-->
<el-dialog title="新增挂账单位" :visible.sync="open1" width="700px" append-to-body>
<el-form ref="formName" :model="form2" :rules="rules1" label-width="120px">
<el-row>
<el-col :span="24">
<el-form-item label="挂账单位" prop="unitName">
<el-input v-model="form2.unitName" show-word-limit placeholder="请输入挂账单位名称" maxlength="50" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="负责人" prop="personCredit">
<el-input v-model="form2.personCredit" show-word-limit placeholder="请输入挂账单位负责人姓名" maxlength="10" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="联系电话" prop="contactMobile">
<el-input v-model="form2.contactMobile" show-word-limit placeholder="请输入挂账单位联系电话" maxlength="15" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="挂账额度" prop="creditLimit">
<el-input v-model="form2.creditLimit" placeholder="请输入挂账额度为0则不限额" maxlength="30">
<template slot="append"></template>
</el-input>
<span style="font-size: 12px;color: grey;">
0为不限额,额度为当前单位最大可挂账金额,如已挂账金额归还,额度将也同步返还
</span>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注信息" prop="remark">
<el-input v-model="form2.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
<el-row>
<el-col :span="24">
<el-form-item label="单位状态" prop="status">
<el-radio-group v-model="form2.status">
<el-radio label="qy" value="qy">启用</el-radio>
<el-radio label="jy" value="jy">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="open1 = false"> </el-button>
<el-button type="primary" @click="addCredit"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {getDicts} from "@/api/dict/data"; import {getDicts} from "@/api/dict/data";
import {getOilNameList, getOilNumGun, getOilNumGunById, listOilNumGun} from "@/api/cashier/oilnumgun"; import {getOilNameList, getOilNumGun, listOilNumGun} from "@/api/cashier/oilnumgun";
import {listgoods} from "@/api/cashier/ljgoods"; import {listgoods} from "@/api/cashier/ljgoods";
import {getUserVoMobile, getUserVoName} from "@/api/cashier/user"; import {getUserVoMobile, getUserVoName} from "@/api/cashier/user";
import {queryStaffs, staffInfo} from "@/api/cashier/staff"; import {queryStaffs, staffInfo} from "@/api/cashier/staff";
@ -679,6 +796,9 @@
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} from "@/api/cashier/oilnumber";
import {selectPreferential} from "@/api/cashier/preferential";
import {addHangBill} from "@/api/cashier/hangbill";
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
const cityOptions = ['上海', '北京']; const cityOptions = ['上海', '北京'];
export default { export default {
@ -688,8 +808,9 @@
// //
checkAll1: false, checkAll1: false,
isIndeterminate1: true, isIndeterminate1: true,
checkedCities1: ['上海'], checkedCities1: [],
cities1: cityOptions, cities1: cityOptions,
fullReduceDiscount: [],
// //
checkAll2: false, checkAll2: false,
isIndeterminate2: true, isIndeterminate2: true,
@ -777,6 +898,15 @@
goods:"", goods:"",
select:"元", select:"元",
form:{ amount : 0 }, form:{ amount : 0 },
form1:{},
form2:{
unitName:"",
personCredit:"",
contactMobile:"",
creditLimit:0,
remark:'',
status:'qy',
},
oilNumGunList:[], oilNumGunList:[],
authCode:'', authCode:'',
// //
@ -795,6 +925,8 @@
dialogRegistration:false, dialogRegistration:false,
dialogSuccess:false, dialogSuccess:false,
dialogTakeOrder:false, dialogTakeOrder:false,
dialogVisibleCredit:false,
open1:false,
activeName: '1', activeName: '1',
tabarr:[ tabarr:[
{name:'收银台',icon:'el-icon-s-platform'}, {name:'收银台',icon:'el-icon-s-platform'},
@ -891,6 +1023,30 @@
isSure:true, isSure:true,
// //
couponAmount:0, couponAmount:0,
//
preferentialData:{
userId:"",
storeId:"",
gradeId:"",
oilName:"",
oilPrice:"",
oilLiters:"",
},
//
unitList:[],
//
rules: {
unitName: [ { required: true, message: "请选择挂账单位", trigger: "blur" }, ],
amount: [{ required: true, message: "请输入挂账金额", trigger: "blur" }],
creditLimit: [{ required: true, message: "可用额度不可为空", trigger: "blur" }],
},
rules1: {
unitName: [ { required: true, message: "请填写挂账单位名称", trigger: "blur" }, ],
personCredit: [{ required: true, message: "请填写挂账单位负责人姓名", trigger: "blur" }],
contactMobile: [ { required: true, message: "请填写挂账单位联系电话", trigger: "blur" }, ],
creditLimit: [ { required: true, message: "请填写挂账额度", trigger: "blur" }, ],
status: [ { required: true, message: "请选择挂账单位状态", trigger: "blur" }, ],
},
} }
}, },
created() { created() {
@ -901,8 +1057,92 @@
this.getStaff(); this.getStaff();
this.getList(); this.getList();
this.getCouponList(); this.getCouponList();
this.getUnitList();
}, },
methods:{ methods:{
//
addCredits(){
this.dialogVisibleCredit = true
this.form1.amount = this.oilAmount + this.goodsAmount
},
//
getUnitList(){
let obj = {};
let _this = this;
listCreditUnit().then( response => {
response.data.forEach(item => {
obj = item;
obj.value = `${item.unitName}${item.personCredit} ${item.contactMobile}`
_this.unitList.push(obj)
})
})
},
//
addCredit(){
this.$refs["formName"].validate((valid) => {
if (valid) {
addCreditUnit(this.form2).then( response => {
this.$modal.msgSuccess("挂账单位信息创建成功");
this.open1 = false;
this.getUnitList();
})
}else {
return false;
}
})
},
//
addHangbill(){
this.$refs["form"].validate((valid) => {
if (valid) {
addHangBill(this.form1).then( response => {
if (response.data==0){
this.$modal.msgError("挂账单位可用额度不足,无法进行挂账");
}else {
this.$modal.msgSuccess("挂账记录添加成功");
this.dialogVisibleCredit = false;
this.resetMember();
this.resetting();
this.empty();
}
})
}else {
return false;
}
})
},
//
changeUnit(val){
this.form1.creditUnitId = val.id;
this.form1.creditLimit = val.creditLimit
return val.id
},
querySearch1(queryString, cb) {
let _this = this;
let obj = {};
let results = _this.unitList
if (queryString != "" && queryString!=undefined){
results = [];
_this.unitList.forEach(item => {
if (item.unitName.includes(queryString)){
obj = item;
obj.value = `${item.unitName}${item.personCredit} ${item.contactMobile}`
results.push(obj)
}
if (item.personCredit.includes(queryString)){
obj = item;
obj.value = `${item.unitName}${item.personCredit} ${item.contactMobile}`
results.push(obj)
}
if (item.contactMobile.includes(queryString)){
obj = item;
obj.value = `${item.unitName}${item.personCredit} ${item.contactMobile}`
results.push(obj)
}
})
}
cb(results);
},
// //
changeSeekZero(){ changeSeekZero(){
this.seekZero = this.authCode - this.oilActualPay - this.goodsActualPay this.seekZero = this.authCode - this.oilActualPay - this.goodsActualPay
@ -920,13 +1160,17 @@
}, },
// //
handleCheckAllChange1(val) { handleCheckAllChange1(val) {
this.checkedCities1 = val ? cityOptions : []; let list = []
this.fullReduceDiscount.forEach(item => {
list.push(item.type)
})
this.checkedCities1 = val ? list : [];
this.isIndeterminate1 = false; this.isIndeterminate1 = false;
}, },
handleCheckedCitiesChange1(value) { handleCheckedCitiesChange1(value) {
let checkedCount = value.length; let checkedCount = value.length;
this.checkAll1 = checkedCount === this.cities1.length; this.checkAll1 = checkedCount === this.fullReduceDiscount.length;
this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.cities1.length; this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.fullReduceDiscount.length;
}, },
handleCheckAllChange2(val) { handleCheckAllChange2(val) {
let list = [] let list = []
@ -1041,7 +1285,7 @@
this.isSure = true; this.isSure = true;
this.handleChange(); this.handleChange();
}, },
// //
getGrade(id){ getGrade(id){
let _this = this; let _this = this;
this.oilDiscount = 0; this.oilDiscount = 0;
@ -1080,6 +1324,7 @@
} }
if (discount.reduce!=0){ if (discount.reduce!=0){
_this.gradeDiscount.push(discount) _this.gradeDiscount.push(discount)
_this.checkedCities2 = ['满减优惠']
} }
gasolineDiscount += +oilDiscount gasolineDiscount += +oilDiscount
}else if (response.data.gasolineDiscount=="每升优惠"){ }else if (response.data.gasolineDiscount=="每升优惠"){
@ -1107,6 +1352,7 @@
} }
if (discount.reduce!=0){ if (discount.reduce!=0){
_this.gradeDiscount.push(discount) _this.gradeDiscount.push(discount)
_this.checkedCities2 = ['每升优惠']
} }
gasolineDiscount += +oilDiscount gasolineDiscount += +oilDiscount
}else { }else {
@ -1172,6 +1418,7 @@
} }
if (discount.reduce!=0){ if (discount.reduce!=0){
_this.gradeDiscount.push(discount) _this.gradeDiscount.push(discount)
_this.checkedCities2 = ['每升优惠']
} }
dieselDiscount += +oilDiscount dieselDiscount += +oilDiscount
}else { }else {
@ -1208,6 +1455,7 @@
} }
if (discount.reduce!=0){ if (discount.reduce!=0){
_this.gradeDiscount.push(discount) _this.gradeDiscount.push(discount)
_this.checkedCities2 = ['满减优惠']
} }
naturalGasDiscount += +oilDiscount naturalGasDiscount += +oilDiscount
}else if (response.data.naturalGasDiscount=="每单位优惠"){ }else if (response.data.naturalGasDiscount=="每单位优惠"){
@ -1235,6 +1483,7 @@
} }
if (discount.reduce!=0){ if (discount.reduce!=0){
_this.gradeDiscount.push(discount) _this.gradeDiscount.push(discount)
_this.checkedCities2 = ['每单位优惠']
} }
naturalGasDiscount += +oilDiscount naturalGasDiscount += +oilDiscount
}else { }else {
@ -1271,23 +1520,114 @@
this.getGrade(data.gradeId) this.getGrade(data.gradeId)
this.changeRefuelMoney(); this.changeRefuelMoney();
this.handleChange(); this.handleChange();
this.preferentialData.storeId = data.storeId;
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();
}
}, },
// //
preferential(){ preferential(){
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;
_this.preferentialData.oilPrice = item1.oilPrice;
_this.preferentialData.oilLiters = item1.liters;
selectPreferential(_this.preferentialData).then( response => {
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
}
}
}else {
_this.fullReduction = 0;
_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.fullReduction += +fullReduction
_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
// })
}, },
// 使 // 使
queryCoupon(list,id){ queryCoupon(list,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){ handleChoose(data){
@ -1367,7 +1707,7 @@
this.isPay = true this.isPay = true
this.dialogVisiblej = true this.dialogVisiblej = true
}, },
// //
resetting(){ resetting(){
this.oilOrder = []; this.oilOrder = [];
this.oilActualPay = 0; this.oilActualPay = 0;
@ -1376,7 +1716,10 @@
this.oilDiscount = 0; this.oilDiscount = 0;
this.consumeAmount = 0; this.consumeAmount = 0;
this.consumeRefuelMoney = 0; this.consumeRefuelMoney = 0;
this.refuelMoney = JSON.parse(this.member.refuelMoney) this.fullReduction = 0;
if (this.member.refuelMoney!=null){
this.refuelMoney = JSON.parse(this.member.refuelMoney)
}
this.amount = 0; this.amount = 0;
}, },
// //
@ -1391,7 +1734,8 @@
this.form.oilType = this.oilType; this.form.oilType = this.oilType;
// //
if (this.select == "元"){ if (this.select == "元"){
this.form.liters = (this.form.amount/this.form.oilPrice).toFixed(2) let num = this.form.amount/this.form.oilPrice
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
@ -1424,6 +1768,14 @@
if (this.isMember){ if (this.isMember){
this.getGrade(this.member.gradeId) this.getGrade(this.member.gradeId)
this.changeRefuelMoney(); 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();
}
} }
}, },
// //