收银台
This commit is contained in:
parent
6ecbe933fe
commit
7ec55c0386
@ -64,7 +64,7 @@ public class HangBillController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(@Validated @RequestBody HangBill hangBill){
|
||||
public ResponseObject add(@Validated @RequestBody HangBillVo hangBill){
|
||||
return getSuccessResult(hangBillService.insertHangBill(hangBill));
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!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">
|
||||
<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
|
||||
inner join mt_staff ms on hb.staff_id = ms.id
|
||||
inner join credit_unit cu on hb.credit_unit_id = cu.id
|
||||
|
@ -15,10 +15,23 @@ public interface CreditUnitService extends IService<CreditUnit> {
|
||||
*/
|
||||
public List<CreditUnit> selectCreditUnitList();
|
||||
|
||||
/**
|
||||
* 根据id查询挂账单位信息
|
||||
* @return
|
||||
*/
|
||||
public CreditUnit selectCreditUnitListById(int id);
|
||||
|
||||
/**
|
||||
* 添加挂账单位信息
|
||||
* @param creditUnit
|
||||
* @return
|
||||
*/
|
||||
public int insertCreditUnit(CreditUnit creditUnit);
|
||||
|
||||
/**
|
||||
* 修改挂账单位信息
|
||||
* @param creditUnit
|
||||
* @return
|
||||
*/
|
||||
public int updateCreditUnit(CreditUnit creditUnit);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public interface HangBillService extends IService<HangBill> {
|
||||
* @param hangBill
|
||||
* @return
|
||||
*/
|
||||
public int insertHangBill(HangBill hangBill);
|
||||
public int insertHangBill(HangBillVo hangBill);
|
||||
|
||||
/**
|
||||
* 修改挂账记录 并收款
|
||||
|
@ -19,9 +19,21 @@ public class CreditUnitServiceImpl extends ServiceImpl<CreditUnitMapper, CreditU
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreditUnit selectCreditUnitListById(int id) {
|
||||
CreditUnit creditUnit = baseMapper.selectById(id);
|
||||
return creditUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertCreditUnit(CreditUnit creditUnit) {
|
||||
int row = baseMapper.insert(creditUnit);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCreditUnit(CreditUnit creditUnit) {
|
||||
int row = baseMapper.updateById(creditUnit);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,10 @@ import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.service.FyPayService;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
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.mapper.HangBillMapper;
|
||||
import com.fuint.business.order.service.CreditUnitService;
|
||||
import com.fuint.business.order.service.HangBillService;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
@ -28,6 +30,9 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> implements HangBillService {
|
||||
@Autowired
|
||||
private CreditUnitService creditUnitService;
|
||||
|
||||
@Override
|
||||
public IPage<HangBillVo> selectHangBillList(Page page, HangBillVo hangBill) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -60,9 +65,25 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertHangBill(HangBill hangBill) {
|
||||
public int insertHangBill(HangBillVo hangBillVo) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
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);
|
||||
// 根据日期生成订单号
|
||||
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 orderNo = timestamp+randomString;
|
||||
Integer staffId = nowAccountInfo.getStaffId();
|
||||
|
||||
hangBill.setStaffId(staffId);
|
||||
hangBill.setOrderNo(orderNo);
|
||||
hangBill.setOutstandAmount(hangBill.getAmount());
|
||||
hangBill.setOutstandAmount(hangBillVo.getAmount());
|
||||
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);
|
||||
return row;
|
||||
}
|
||||
@ -96,6 +124,14 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
|
||||
if (payType.equals("CASH")){
|
||||
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;
|
||||
hangBill.setRemark(map.get("remark"));
|
||||
// 支付成功后修改挂账信息
|
||||
@ -114,6 +150,8 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
|
||||
}else {
|
||||
hangBill.setStatus("2");
|
||||
}
|
||||
// 修改挂账单位余额信息
|
||||
creditUnitService.updateCreditUnit(creditUnit);
|
||||
}
|
||||
row = baseMapper.updateById(hangBill);
|
||||
return baseMapper.selectById(Integer.parseInt(map.get("id")));
|
||||
@ -127,6 +165,7 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
// 现将需要修改的支付状态改为未支付
|
||||
HangBill hangBill1 = baseMapper.selectById((Integer) jsonObject.get("id"));
|
||||
|
||||
hangBill1.setPayStatus("unpaid");
|
||||
baseMapper.updateById(hangBill1);
|
||||
HangBill hangBill = baseMapper.selectById((Integer) jsonObject.get("id"));
|
||||
@ -196,6 +235,14 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
|
||||
}else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,6 @@ public class HangBillVo extends HangBill {
|
||||
private String personCredit;
|
||||
// 联系电话
|
||||
private String contactMobile;
|
||||
// 挂账额度
|
||||
private String creditLimit;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 扫码支付接口
|
||||
// 优惠活动信息
|
||||
export function selectPreferential(data) {
|
||||
return request({
|
||||
url: '/business/marketingActivity/activeExchange/selectConsumptionList',
|
||||
|
@ -270,6 +270,11 @@
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</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">
|
||||
<el-button @click="open = false">取 消</el-button>
|
||||
<el-button type="primary" @click="addHangbill">确 定</el-button>
|
||||
@ -825,10 +830,14 @@ import {getDicts} from "@/api/dict/data";
|
||||
_this.form2.repaidAmount = _this.payAmount;
|
||||
_this.form2.authCode = _this.authCode;
|
||||
editHangBill(this.form2).then(response => {
|
||||
if (response.data==null){
|
||||
|
||||
}else {
|
||||
if (response.data.payStatus == 'paid'){
|
||||
_this.isPaySuccess = true;
|
||||
_this.isPay = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
_this.loading = true;
|
||||
_this.queryPayStatus();
|
||||
|
@ -61,12 +61,13 @@
|
||||
trigger="click">
|
||||
<div>
|
||||
<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="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="color: red">-¥1.56</div>
|
||||
<div style="color: grey">满100元每升优惠0.2元</div>
|
||||
<div style="color: red">-¥{{ fullReduction }}</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>
|
||||
</el-checkbox>
|
||||
@ -232,6 +233,9 @@
|
||||
:value="item.dictValue">
|
||||
<span @click="payMethod(item.dictValue)">{{ item.dictLabel }}</span>
|
||||
</div>
|
||||
<div class="wrap-box" >
|
||||
<span @click="addCredits">挂账</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="center-left-bottom">
|
||||
<div>
|
||||
@ -665,12 +669,125 @@
|
||||
</el-table>
|
||||
</div>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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 {getUserVoMobile, getUserVoName} from "@/api/cashier/user";
|
||||
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
|
||||
@ -679,6 +796,9 @@
|
||||
import {getOilGun} from "@/api/cashier/oilGuns";
|
||||
import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
|
||||
import {getOilNumberById} from "@/api/cashier/oilnumber";
|
||||
import {selectPreferential} from "@/api/cashier/preferential";
|
||||
import {addHangBill} from "@/api/cashier/hangbill";
|
||||
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
|
||||
|
||||
const cityOptions = ['上海', '北京'];
|
||||
export default {
|
||||
@ -688,8 +808,9 @@
|
||||
// 满减全选
|
||||
checkAll1: false,
|
||||
isIndeterminate1: true,
|
||||
checkedCities1: ['上海'],
|
||||
checkedCities1: [],
|
||||
cities1: cityOptions,
|
||||
fullReduceDiscount: [],
|
||||
// 等级全选
|
||||
checkAll2: false,
|
||||
isIndeterminate2: true,
|
||||
@ -777,6 +898,15 @@
|
||||
goods:"",
|
||||
select:"元",
|
||||
form:{ amount : 0 },
|
||||
form1:{},
|
||||
form2:{
|
||||
unitName:"",
|
||||
personCredit:"",
|
||||
contactMobile:"",
|
||||
creditLimit:0,
|
||||
remark:'',
|
||||
status:'qy',
|
||||
},
|
||||
oilNumGunList:[],
|
||||
authCode:'',
|
||||
// 油号列表
|
||||
@ -795,6 +925,8 @@
|
||||
dialogRegistration:false,
|
||||
dialogSuccess:false,
|
||||
dialogTakeOrder:false,
|
||||
dialogVisibleCredit:false,
|
||||
open1:false,
|
||||
activeName: '1',
|
||||
tabarr:[
|
||||
{name:'收银台',icon:'el-icon-s-platform'},
|
||||
@ -891,6 +1023,30 @@
|
||||
isSure:true,
|
||||
// 优惠券消费金额
|
||||
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() {
|
||||
@ -901,8 +1057,92 @@
|
||||
this.getStaff();
|
||||
this.getList();
|
||||
this.getCouponList();
|
||||
this.getUnitList();
|
||||
},
|
||||
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(){
|
||||
this.seekZero = this.authCode - this.oilActualPay - this.goodsActualPay
|
||||
@ -920,13 +1160,17 @@
|
||||
},
|
||||
// 选择优惠信息
|
||||
handleCheckAllChange1(val) {
|
||||
this.checkedCities1 = val ? cityOptions : [];
|
||||
let list = []
|
||||
this.fullReduceDiscount.forEach(item => {
|
||||
list.push(item.type)
|
||||
})
|
||||
this.checkedCities1 = val ? list : [];
|
||||
this.isIndeterminate1 = false;
|
||||
},
|
||||
handleCheckedCitiesChange1(value) {
|
||||
let checkedCount = value.length;
|
||||
this.checkAll1 = checkedCount === this.cities1.length;
|
||||
this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.cities1.length;
|
||||
this.checkAll1 = checkedCount === this.fullReduceDiscount.length;
|
||||
this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.fullReduceDiscount.length;
|
||||
},
|
||||
handleCheckAllChange2(val) {
|
||||
let list = []
|
||||
@ -1041,7 +1285,7 @@
|
||||
this.isSure = true;
|
||||
this.handleChange();
|
||||
},
|
||||
// 获取会员等级信息
|
||||
// 根据会员等级信息获取等级优惠信息
|
||||
getGrade(id){
|
||||
let _this = this;
|
||||
this.oilDiscount = 0;
|
||||
@ -1080,6 +1324,7 @@
|
||||
}
|
||||
if (discount.reduce!=0){
|
||||
_this.gradeDiscount.push(discount)
|
||||
_this.checkedCities2 = ['满减优惠']
|
||||
}
|
||||
gasolineDiscount += +oilDiscount
|
||||
}else if (response.data.gasolineDiscount=="每升优惠"){
|
||||
@ -1107,6 +1352,7 @@
|
||||
}
|
||||
if (discount.reduce!=0){
|
||||
_this.gradeDiscount.push(discount)
|
||||
_this.checkedCities2 = ['每升优惠']
|
||||
}
|
||||
gasolineDiscount += +oilDiscount
|
||||
}else {
|
||||
@ -1172,6 +1418,7 @@
|
||||
}
|
||||
if (discount.reduce!=0){
|
||||
_this.gradeDiscount.push(discount)
|
||||
_this.checkedCities2 = ['每升优惠']
|
||||
}
|
||||
dieselDiscount += +oilDiscount
|
||||
}else {
|
||||
@ -1208,6 +1455,7 @@
|
||||
}
|
||||
if (discount.reduce!=0){
|
||||
_this.gradeDiscount.push(discount)
|
||||
_this.checkedCities2 = ['满减优惠']
|
||||
}
|
||||
naturalGasDiscount += +oilDiscount
|
||||
}else if (response.data.naturalGasDiscount=="每单位优惠"){
|
||||
@ -1235,6 +1483,7 @@
|
||||
}
|
||||
if (discount.reduce!=0){
|
||||
_this.gradeDiscount.push(discount)
|
||||
_this.checkedCities2 = ['每单位优惠']
|
||||
}
|
||||
naturalGasDiscount += +oilDiscount
|
||||
}else {
|
||||
@ -1271,23 +1520,114 @@
|
||||
this.getGrade(data.gradeId)
|
||||
this.changeRefuelMoney();
|
||||
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(){
|
||||
|
||||
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){
|
||||
// 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){
|
||||
@ -1367,7 +1707,7 @@
|
||||
this.isPay = true
|
||||
this.dialogVisiblej = true
|
||||
},
|
||||
// 新增订单(重置)
|
||||
// 重置油品订单
|
||||
resetting(){
|
||||
this.oilOrder = [];
|
||||
this.oilActualPay = 0;
|
||||
@ -1376,7 +1716,10 @@
|
||||
this.oilDiscount = 0;
|
||||
this.consumeAmount = 0;
|
||||
this.consumeRefuelMoney = 0;
|
||||
this.fullReduction = 0;
|
||||
if (this.member.refuelMoney!=null){
|
||||
this.refuelMoney = JSON.parse(this.member.refuelMoney)
|
||||
}
|
||||
this.amount = 0;
|
||||
},
|
||||
// 获取员工列表
|
||||
@ -1391,7 +1734,8 @@
|
||||
this.form.oilType = this.oilType;
|
||||
// 计算油的升数
|
||||
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 {
|
||||
this.form.liters = this.form.amount
|
||||
this.form.amount = this.form.oilPrice * this.form.amount
|
||||
@ -1424,6 +1768,14 @@
|
||||
if (this.isMember){
|
||||
this.getGrade(this.member.gradeId)
|
||||
this.changeRefuelMoney();
|
||||
if (this.oilOrder.length>0){
|
||||
// this.oilOrder.forEach(item => {
|
||||
// this.preferentialData.oilName = item.oilName;
|
||||
// this.preferentialData.oilPrice = item.oilPrice;
|
||||
// this.preferentialData.oilLiters = item.liters;
|
||||
// })
|
||||
this.preferential();
|
||||
}
|
||||
}
|
||||
},
|
||||
// 囤油卡变化后总金额的变化
|
||||
|
Loading…
Reference in New Issue
Block a user