收银台

This commit is contained in:
cun-nan 2023-11-13 18:59:13 +08:00
parent 22aee4bb01
commit f72db0c784
13 changed files with 497 additions and 26 deletions

View File

@ -23,3 +23,29 @@ export function oilConfigInfo(id) {
method: 'get',
})
}
// 添加支付配置信息
export function addOilConfig(data) {
return request({
url: '/api/oilConfig',
method: 'post',
data: data,
})
}
// 修改支付配置信息
export function editOilConfig(data) {
return request({
url: '/api/oilConfig',
method: 'put',
data: data,
})
}
// 删除支付配置信息
export function delOilConfig(id) {
return request({
url: '/api/oilConfig/'+id,
method: 'delete',
})
}

View File

@ -68,7 +68,7 @@
</div>
<div class="cont-box" >
<div><el-button type="primary" icon="el-icon-plus" @click="dialogFormVisible = true">添加规则</el-button></div>
<div><el-button type="primary" icon="el-icon-plus" @click="addOil">添加规则</el-button></div>
<div><el-button type="success" icon="el-icon-s-promotion" @click="open">发布规则</el-button></div>
</div>
<div class="hangbox" v-for="(item,index) in oilConfigList" :key="item.id">
@ -83,7 +83,7 @@
<div class="jiaong"> 不固定次数 </div>
<el-button type="primary" icon="el-icon-edit" @click="editOilConfig(item.id)">编辑</el-button>
<el-button type="danger" icon="el-icon-close">删除</el-button>
<el-button type="danger" icon="el-icon-close" @click="deleteOilConfig(item.id)">删除</el-button>
</div>
<!-- <div class="hangbox" v-for="(item,index) in 3" :key="index">-->
<!-- <div>{{index + 1}}.通道</div>-->
@ -102,19 +102,24 @@
<div class="hsize">:规则按照顺序进行处理并自动更换支付通道新增或变更规则后需要发布当前规则才生效,发布生效后的规则将从序号1的配置生效</div>
<el-dialog title="编辑通道规则" :visible.sync="dialogFormVisible">
<el-form :model="form">
<el-form :model="form" ref="form">
<el-form-item label="支付通道" :label-width="formLabelWidth" width="300px">
<el-select v-model="form.merchConfigId" placeholder="请选择活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
<el-select v-model="form.merchConfigId"
@change="changeMerch"
:disabled="isDis" placeholder="请选择商户信息">
<el-option v-for="item in merchantList" :key="item.id"
:label="item.merchantName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="商户号" :label-width="formLabelWidth">
<el-input v-model="form.mchntCd" autocomplete="off"></el-input>
<el-input v-model="form.mchntCd" disabled autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="消费满笔数" :label-width="formLabelWidth">
<el-input v-model="form.proportion" autocomplete="off"></el-input>
<el-input v-model="form.proportion" autocomplete="off">
<template slot="append">%</template>
</el-input>
<div>消费笔数满足后切换到下一个支付通道</div>
</el-form-item>
<el-form-item label="参与次数" :label-width="formLabelWidth">
@ -133,8 +138,8 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="dialogFormVisible = false"> </el-button>
<el-button @click="clearOil"> </el-button>
<el-button type="primary" @click="submitOilConfig"> </el-button>
</div>
</el-dialog>
@ -143,12 +148,22 @@
<script>
import {editMerchant, listMerchant} from "@/api/payConfig/merchantconfig";
import {isOpenOilConfig, listOilConfig, oilConfigInfo} from "@/api/payConfig/oilconfig";
import {
addOilConfig,
delOilConfig,
editOilConfig,
isOpenOilConfig,
listOilConfig,
oilConfigInfo
} from "@/api/payConfig/oilconfig";
import {addUser, getUserMobile, updateUser} from "@/api/staff/user/user";
export default {
name: 'peizhi',
data(){
return{
//
isDis:false,
//
merchantList:[],
//
@ -175,12 +190,81 @@ export default {
this.getList();
},
methods:{
//
deleteOilConfig(id){
this.$confirm('确认删除此通道规则吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delOilConfig(id).then( response => {})
this.$message({
type: 'success',
message: '规则数据删除成功'
});
this.getList();
}).catch(() => {});
},
//
addOil(){
this.dialogFormVisible = true;
this.form = {
name: '',
region: '',
date1: '',
date2: '',
num: 1,
delivery: false,
type: [],
resource: '',
desc: ''
}
},
//
changeMerch(val){
this.merchantList.forEach(item => {
if (item.id == val){
this.form.mchntCd = item.mchntCd
}
})
},
//
submitOilConfig(){
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id) {
editOilConfig(this.form).then(response => {
this.$modal.msgSuccess("修改会员成功");
this.getList();
this.dialogFormVisible = false;
this.isDis = false;
});
} else {
addOilConfig(this.form).then( response => {
if (response.data==0){
this.$modal.msgError("已存在当前通道商户号的规则");
}else {
this.$modal.msgSuccess("新增会员成功");
this.getList();
this.dialogFormVisible = false;
this.isDis = false;
}
})
}
}
});
},
//
clearOil(){
this.dialogFormVisible = false;
this.isDis = false;
},
//
editOilConfig(id){
this.isDis = true;
this.dialogFormVisible = true;
oilConfigInfo(id).then( response => {
this.form = response.data
console.log(response)
})
},
//

View File

@ -1,14 +1,14 @@
package com.fuint.api.fuyou.controller;
import com.fuint.api.fuyou.entity.OilConfig;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.service.OilConfigService;
import com.fuint.api.fuyou.vo.OilConfigVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 支付配置信息 controller层
@ -54,4 +54,35 @@ public class OilConfigController extends BaseController {
public ResponseObject oilConfigInfo(@PathVariable Integer id){
return getSuccessResult(oilConfigService.selectOilConfigById(id));
}
/**
* 添加支付配置信息
* @param oilConfig
* @return
*/
@PostMapping
public ResponseObject add(@Validated @RequestBody OilConfigVo oilConfig){
return getSuccessResult(oilConfigService.insertOilConfig(oilConfig));
}
/**
* 修改支付配置信息
* @param oilConfig
* @return
*/
@PutMapping
public ResponseObject edit(@Validated @RequestBody OilConfig oilConfig){
return getSuccessResult(oilConfigService.updateOilConfig(oilConfig));
}
/**
* 删除支付配置信息
* @param id
* @return
*/
@DeleteMapping("/{id}")
public ResponseObject delete(@PathVariable Integer id){
oilConfigService.delOilConfig(id);
return getSuccessResult(1);
}
}

View File

@ -1,7 +1,11 @@
package com.fuint.api.fuyou.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ -13,11 +17,14 @@ import java.io.Serializable;
@Data
@TableName("oil_config")
@ApiModel(value = "OilConfig对象", description = "支付配置规则表")
public class OilConfig implements Serializable {
private static final long serialVersionUID = -72940523083738137L;
public class OilConfig extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 油站id

View File

@ -27,4 +27,24 @@ public interface OilConfigService extends IService<OilConfig> {
* @return
*/
public OilConfigVo selectOilConfigById(int id);
/**
* 添加支付配置信息
* @param oilConfig
* @return
*/
public int insertOilConfig(OilConfigVo oilConfig);
/**
* 修改支付配置信息
* @param oilConfig
* @return
*/
public int updateOilConfig(OilConfig oilConfig);
/**
* 根据id删除支付配置信息
* @param id
*/
public void delOilConfig(int id);
}

View File

@ -1,5 +1,7 @@
package com.fuint.api.fuyou.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.entity.OilConfig;
@ -7,6 +9,8 @@ import com.fuint.api.fuyou.mapper.OilConfigMapper;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.service.OilConfigService;
import com.fuint.api.fuyou.vo.OilConfigVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -63,4 +67,36 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
OilConfigVo oilConfigVo = baseMapper.selectOilConfigById(id);
return oilConfigVo;
}
@Override
public int insertOilConfig(OilConfigVo oilConfig) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
OilConfig config = new OilConfig();
config.setMerchConfigId(oilConfig.getMerchConfigId());
config.setStoreId(storeId);
config.setProportion(oilConfig.getProportion());
config.setKeyStr(oilConfig.getKeyStr());
config.setValueStr(oilConfig.getValueStr());
config.setMerchConfigId(oilConfig.getMerchConfigId());
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("merch_config_id",oilConfig.getMerchConfigId());
OilConfig oilConfig1 = baseMapper.selectOne(queryWrapper);
if (!ObjectUtil.isEmpty(oilConfig1)){
return 0;
}
int row = baseMapper.insert(config);
return row;
}
@Override
public int updateOilConfig(OilConfig oilConfig) {
int row = baseMapper.updateById(oilConfig);
return row;
}
@Override
public void delOilConfig(int id) {
baseMapper.deleteById(id);
}
}

View File

@ -0,0 +1,192 @@
package com.fuint.business.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 挂账记录表(HangBill)实体类
*/
@Data
@TableName("hang_bill")
@ApiModel(value = "HangBill对象", description = "挂账记录表")
public class HangBill extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 店铺id
*/
private Integer storeId;
/**
* 订单号
*/
private String orderNo;
/**
* 单位名称
*/
private String unitName;
/**
* 挂账人
*/
private String personCredit;
/**
* 联系电话
*/
private String contactMobile;
/**
* 订单状态0未归还1已归还
*/
private String status;
/**
* 归还状态0挂账1归还
*/
private String returnType;
/**
* 挂账金额
*/
private String amount;
/**
* 操作员工id
*/
private Integer staffId;
/**
* 单据备注
*/
private String remark;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建用户
*/
private String createBy;
/**
* 修改用户
*/
private String updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getPersonCredit() {
return personCredit;
}
public void setPersonCredit(String personCredit) {
this.personCredit = personCredit;
}
public String getContactMobile() {
return contactMobile;
}
public void setContactMobile(String contactMobile) {
this.contactMobile = contactMobile;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public Integer getStaffId() {
return staffId;
}
public void setStaffId(Integer staffId) {
this.staffId = staffId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
}

View File

@ -0,0 +1,10 @@
package com.fuint.business.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.order.entity.HangBill;
/**
* 挂账记录表 mapper层
*/
public interface HangBillMapper extends BaseMapper<HangBill> {
}

View File

@ -0,0 +1,26 @@
package com.fuint.business.order.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.order.entity.HangBill;
/**
* 挂账记录信息 业务层
*/
public interface HangBillService extends IService<HangBill> {
/**
* 根据条件分页查询油品订单信息
* @param page
* @param hangBill
* @return
*/
public IPage<HangBill> selectHangBillList(Page page, HangBill hangBill);
/**
* 添加挂账记录
* @param hangBill
* @return
*/
public int insertHangBill(HangBill hangBill);
}

View File

@ -0,0 +1,31 @@
package com.fuint.business.order.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.order.entity.HangBill;
import com.fuint.business.order.mapper.HangBillMapper;
import com.fuint.business.order.service.HangBillService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
/**
* 挂账记录信息 业务层
*/
@Service
public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> implements HangBillService {
@Override
public IPage<HangBill> selectHangBillList(Page page, HangBill hangBill) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
hangBill.setStoreId(storeId);
return null;
}
@Override
public int insertHangBill(HangBill hangBill) {
int row = baseMapper.insert(hangBill);
return row;
}
}

View File

@ -325,7 +325,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Integer naturalGrowthValue = null;
// 根据id查询会员信息 获取会员当前成长值数据
LJUser user = userService.selectUserById(userid);
int growth = user.getGrowthValue();
UserBalance balance = userBalanceService.selectUserBalance(userid);
int growth = balance.getGrowthValue();
// 查询会员等级列表信息
Page page = new Page(1,20);
LJUserGrade ljUserGrade1 = new LJUserGrade();
@ -344,7 +345,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
user.setGradeId(records.get(records.size()-1).getId());
}
}
user.setGrowthValue(growthAfter);
balance.setGrowthValue(growthAfter);
}else if(oilName.getOilType().equals("柴油")){
dieselGrowthValue = Integer.valueOf(sysConfigService.getValueByKey("diesel_growth_value"));
Integer addVal = (int) (dieselGrowthValue * oilActualPay);
@ -358,7 +359,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
user.setGradeId(records.get(records.size()-1).getId());
}
}
user.setGrowthValue(growthAfter);
balance.setGrowthValue(growthAfter);
}else{
naturalGrowthValue = Integer.valueOf(sysConfigService.getValueByKey("natural_growth_value"));
Integer addVal = (int) (naturalGrowthValue * oilActualPay);
@ -372,10 +373,12 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
user.setGradeId(records.get(records.size()-1).getId());
}
}
user.setGrowthValue(growthAfter);
balance.setGrowthValue(growthAfter);
}
// 修改用户成长值
// 修改用户会员等级
userService.updateUser(user);
// 修改用户成长值
userBalanceService.updateUserBalance(balance);
}
}

View File

@ -0,0 +1,8 @@
package com.fuint.business.order.vo;
import com.fuint.business.order.entity.HangBill;
import lombok.Data;
@Data
public class HangBillVo extends HangBill {
}

View File

@ -60,9 +60,6 @@ public class LJUser extends BaseEntity implements Serializable {
@ApiModelProperty("等级ID")
private Integer gradeId;
@ApiModelProperty("成长值")
private Integer growthValue;
@ApiModelProperty("性别 1男,0女")
private Integer sex;