This commit is contained in:
zhaohengkun 2024-10-14 14:50:36 +08:00
parent 872cfdc423
commit dea17c543e
7 changed files with 334 additions and 64 deletions

View File

@ -2,6 +2,7 @@ package com.fuint.business.cashierGoods.controller;
import com.fuint.business.cashierGoods.entity.MtGoods;
import com.fuint.business.cashierGoods.entity.MtGoodsVo;
import com.fuint.business.cashierGoods.service.CashRegisterGoodsService;
import com.fuint.common.service.GoodsService;
import com.fuint.common.util.TokenUtil;
@ -42,8 +43,8 @@ public class CashRegisterGoodsController extends BaseController {
public ResponseObject list(HttpServletRequest request) throws BusinessCheckException {
HashMap<String, Object> map = new HashMap<>();
map.put("store_id", TokenUtil.getNowAccountInfo().getStoreId());
List<MtGoods> mtGoods = cashRegisterGoodsService.selectListByMap(map);
map.put("god.store_id", TokenUtil.getNowAccountInfo().getStoreId());
List<MtGoodsVo> mtGoods = cashRegisterGoodsService.selectListByMap(map);
return getSuccessResult(mtGoods);
}

View File

@ -0,0 +1,9 @@
package com.fuint.business.cashierGoods.entity;
import lombok.Data;
@Data
public class MtGoodsVo extends MtGoods {
private String supplierName;
}

View File

@ -2,13 +2,19 @@ package com.fuint.business.cashierGoods.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.cashierGoods.entity.MtGoods;
import com.fuint.business.cashierGoods.entity.MtGoodsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
// 如何集成mybatis plus 通用mapper
@Mapper
public interface CashRegisterGoodsMapper extends BaseMapper<MtGoods> {
List<MtGoodsVo> selectListByMap(@Param("map") Map<String, Object> columnMap);
}

View File

@ -312,5 +312,19 @@
where
store_id = #{storeId}
</select>
<select id="selectListByMap" resultType="com.fuint.business.cashierGoods.entity.MtGoodsVo" parameterType="map">
SELECT
god.*,sup.name AS supplierName
FROM
mt_goods god
left JOIN supplier sup on god.supplier_id = sup.id
<where>
<foreach collection="map" item="value" index="key" open="" close="" separator=" AND ">
<if test="value != null and value != ''">
${key} = #{value}
</if>
</foreach>
</where>
</select>
</mapper>

View File

@ -1,6 +1,7 @@
package com.fuint.business.cashierGoods.service;
import com.fuint.business.cashierGoods.entity.MtGoods;
import com.fuint.business.cashierGoods.entity.MtGoodsVo;
import java.util.List;
import java.util.Map;
@ -9,7 +10,7 @@ public interface CashRegisterGoodsService {
// 通用mapper条件查询
List<MtGoods> selectListByMap(Map<String, Object> columnMap);
List<MtGoodsVo> selectListByMap(Map<String, Object> columnMap);

View File

@ -2,6 +2,7 @@ package com.fuint.business.cashierGoods.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.cashierGoods.entity.MtGoods;
import com.fuint.business.cashierGoods.entity.MtGoodsVo;
import com.fuint.business.cashierGoods.mapper.CashRegisterGoodsMapper;
import com.fuint.business.cashierGoods.service.CashRegisterGoodsService;
import org.springframework.stereotype.Service;
@ -12,11 +13,11 @@ import java.util.Map;
@Service
public class CashRegisterGoodsServiceImpl extends ServiceImpl<CashRegisterGoodsMapper, MtGoods> implements CashRegisterGoodsService {
//supplier
@Override
public List<MtGoods> selectListByMap(Map<String, Object> columnMap) {
public List<MtGoodsVo> selectListByMap(Map<String, Object> columnMap) {
List<MtGoods> mtGoods = super.baseMapper.selectByMap(columnMap);
List<MtGoodsVo> mtGoods = super.baseMapper.selectListByMap(columnMap);
return mtGoods;
}

View File

@ -131,7 +131,7 @@
<div class="price_">{{ realAmount }}</div>
<div class="price_prefer">优惠合计:{{ disTotal }}</div>
</div>
<div class="anniu" @click="settlement()">立即结算</div>
<div class="anniu" @click="settlement()" :class="{ disabled: !isClickable }">立即结算</div>
</div>
</div>
@ -314,29 +314,29 @@
<el-button type="primary" @click="ScanCodePayment = false">关闭</el-button>
</span>
</el-dialog>
<el-dialog
title="现金支付"
:visible.sync="cashPayment"
width="439px"
center
>
<div class="tc-box">
<div class="title_">应收款 <span style="color: #F44522">¥98.00</span></div>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="收款金额" prop="name">
<el-input v-model="ruleForm.name">
<template slot="append"></template>
</el-input>
</el-form-item>
<div class="t-size">
应找零<span style="color: #F44522">¥20.00</span>
</div>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="cashPayment = false">确定收款</el-button>
</span>
</el-dialog>
<!-- <el-dialog-->
<!-- title="现金支付"-->
<!-- :visible.sync="cashPayment"-->
<!-- width="439px"-->
<!-- center-->
<!-- >-->
<!-- <div class="tc-box">-->
<!-- <div class="title_">应收款 <span style="color: #F44522">¥{{realAmount}}</span></div>-->
<!-- <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-width="100px" class="demo-ruleForm">-->
<!-- <el-form-item label="收款金额" prop="number">-->
<!-- <el-input v-model="ruleForm2.number">-->
<!-- <template slot="append"></template>-->
<!-- </el-input>-->
<!-- </el-form-item>-->
<!-- <div class="t-size">-->
<!-- 应找零<span style="color: #F44522">¥{{getChangeShould}}</span>-->
<!-- </div>-->
<!-- </el-form>-->
<!-- </div>-->
<!-- <span slot="footer" class="dialog-footer">-->
<!-- <el-button type="primary" @click="cashPaymentClick()">确定收款</el-button>-->
<!-- </span>-->
<!-- </el-dialog>-->
<el-dialog
title="挂单"
:visible.sync="hangingAnOrder"
@ -445,7 +445,8 @@
</el-dialog>
<!-- 确认充值-->
<el-dialog :close-on-click-modal="false" title="确认充值" :visible.sync="openConfirm" width="500px" append-to-body>
<el-dialog :close-on-click-modal="false" title="确认支付订单" :visible.sync="openConfirm" width="500px" append-to-body
@close="onDialogClose">
<div v-if="isPay"
v-loading="loading">
@ -458,7 +459,7 @@
<div v-if="payForm.paymentType !== 'CASH' ">
<div>
<el-input v-model="payForm.authCode"
v-focus ref="getFocus"
ref="getFocus"
autofocus
@keydown.enter.native="collection1"
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
@ -484,18 +485,18 @@
</div>
<div v-else>
<div>
<el-input v-model="payForm.authCode"
v-focus ref="getFocus"
<el-input v-model.number="payForm.authCode"
oninput="value=value.replace(/[^0-9]/g, '').slice(0, 10)"
type="number"
ref="getFocus"
autofocus maxlength="10"
@input="changeSeekZero1"
@keydown.enter.native="collection1"
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
placeholder="请输入收款金额">
</el-input>
</div>
<div style="text-align: right;margin: 10px 0">
<span>应找零</span>
<span style="color: red;font-size: 18px"> {{ payForm.seekZero }}</span>
<span style="color: red;font-size: 18px"> {{ getChangeShould }}</span>
</div>
</div>
<el-divider></el-divider>
@ -558,13 +559,15 @@ import {
getCheckTheStatusOfYourPaymentApi,
rechargeCard
} from "@/api/cashier/cardSet";
import {getReturnCode} from "@/api/print";
import { getReturnCode, printOilOrderReport } from '@/api/print'
import {addLJGoods, scanAppletQrCode} from "@/api/cashier/oilorder";
import { cashierOrderByOrderNo } from '@/api/cashier/cashierorder'
export default {
dicts: ['CardCoupon_type'],
data() {
return {
isClickable: false, //
payForm: {
realyPayBills: 0.00,
paymentType: 'ALIPAY',
@ -690,6 +693,19 @@ export default {
}
},
watch: {
//
chooseVipUser: {
handler(newVal) {
console.log("会员发生变化", newVal);
// name
if (this.chooseVipUser.hasOwnProperty("name")){
this.isClickable = true
}else {
this.isClickable = false
}
},
},
//
chooseActId: {
handler(newVal) {
@ -777,6 +793,9 @@ export default {
},
computed: {
getChangeShould(){
return this.payForm.authCode-this.realAmount
},
getGoodsItem() {
if (this.oilGunClearing.amount && this.oilGunClearing.amount !== undefined) {
//
@ -809,6 +828,12 @@ export default {
},
methods: {
//
onDialogClose(){
this.payForm.authCode=null
},
sendCouponClick() {
//this.sendCoupon this.chooseVipUser.id
this.sendCoupon.mtUserId = this.chooseVipUser.id
@ -886,10 +911,10 @@ export default {
},
//
handClose1() {
this.isPay = true,
this.isPay = true,
this.isPaySuccess = false,
this.isQuery = true
this.openConfirm = false
this.openConfirm = false
this.payForm.authCode = null
@ -919,8 +944,8 @@ export default {
}
},
async collection1() {
//
if (this.flag == 3) {
console.log(919)
this.collection()
return
}
@ -1037,6 +1062,212 @@ export default {
this.isPay = true
//this.getCode(this.realyPayBills, this.flag)
},
//
oilOrderReport () {
//
let oilOrderR = [
{
oilName : this.oilGunClearing.name,
amount : this.oilGunClearing.amount,
}
]
let goodsOrderR = []
this.goodsOrder.forEach(order=>{
let o = {
oilName : order.name,
unit : order.num+order.unit,
// amount : order.memberPrice.toString()
amount : order.retailPrice.toString()
}
goodsOrderR.push(o)
})
//
const payTypeMap = {
'CASH': '现金',
'WECHAT': '微信',
'ALIPAY': '支付宝',
'UNIONPAY': '银联二维码',
'credit': '挂账',
'oilCard': '囤油卡',
'balance': '储值卡'
};
let payTypeText = payTypeMap[this.payType] || '小程序码';
let f ={
oilOrder:oilOrderR,
goodsOrder:goodsOrderR,
payType:payTypeText,
unitName:this.form1.unitName, //
// consumeAmount:this.consumeAmount,
creditAmount: (this.oilAmount+(+this.goodsAmount)).toFixed(2),//
//
discount:(this.oilDiscount + this.goodsDiscount + this.fullReduction + this.couponAmount).toFixed(2), //
//
consumeAmount:this.consumeAmount,
//
consumeRefuelMoney:this.consumeRefuelMoney.toFixed(2),
//
actualPay : ((+this.oilActualPay)+(+this.goodsActualPay)).toFixed(2),
//
seekZero:this.seekZero.toFixed(2),
}
printOilOrderReport(f).then(res=>{
})
},
//
resetting1(){
let _this = this;
this.authCode = "";
if (_this.isPaySuccess == true){
// _this.isPay = false;
_this.oilAmount = 0;
_this.oilActualPay = 0;
_this.oilDiscount = 0;
_this.goodsAmount = 0;
_this.goodsActualPay = 0;
_this.goodsDiscount = 0;
_this.consumeAmount = 0;
_this.consumeRefuelMoney = 0;
_this.oilTotal = 0;
_this.goodsTotal = 0;
_this.oilCardAmount = 0;
_this.isMember = false;
_this.isSure = false;
_this.oilOrder = []
_this.goodsOrder = []
_this.amount = 0
_this.seekZero = 0;
_this.fullReduction = 0;
_this.fullReduceDiscount = []
_this.checkAll1 = false
_this.gradeDiscount = []
_this.checkAll2 = false
_this.checkAll3 = false
_this.checkAll4 = false
_this.checkAll5 = false
};
this.userNo = ""
this.map = {
allAmount:0,
//
authCode:'',
//
oilOrder:"",
//
goodsOrder:"",
//
payType:"WECHAT",
//
oilAmount:0,
//
goodsAmount:0,
//
oilActualPay:0,
//
goodsActualPay:0,
//
payUser:"",
//
oilDiscount:0,
//
goodsDiscount:0,
// id
couponId:"",
//
commissionAmount:0,
// 使
usePoint:0,
//
pointAmount:0,
//
terminal:"PC",
//
goodsNum:0,
//
consumeAmount:0,
typeIdex:'',
};
this.payType = "WECHAT"
},
//
queryPayStatus(){
let _this = this;
let timer = setInterval(function (){
// "234520231228115544f073f4"
cashierOrderByOrderNo({orderNo:_this.orderNo}).then( response => {
if (response.data){
if (response.data.status == "paid"){
_this.isPay = true;
_this.isPaySuccess = true;
_this.isQuery = false;
_this.amount = 0
_this.loading = false;
// _this.printLocally()
_this.oilOrderReport()
_this.resetting1();
if (response.data.oilOrderAmount>0){
// for (let i =0;i<_this.oilPreferentialData.length;i++){
// _this.oilPreferentialData[i].oilPreferential.storeId = response.data.storeId
// _this.oilPreferentialData[i].oilPreferential.orderAmount = response.data.oilOrderAmount
// _this.oilPreferentialData[i].oilPreferential.userId = response.data.userId
// _this.oilPreferentialData[i].oilPreferential.oilId = response.data.oils
// _this.oilPreferentialData[i].oilPreferential.mtUserLevel = _this.member.gradeId
// _this.oilPreferentialData[i].oilPreferential.cardFavorableId = _this.oilPreferentialData[_this.oilPreferentialData.length-1].cardFavorableId
// usePaymentActive(_this.oilPreferentialData[i].oilPreferential).then(res => {})
// }
}
clearInterval(timer);
}
if (response.data.status == "payFail"){
_this.isPaySuccess = false;
// _this.isPay = true;
_this.isQuery = false;
_this.loading = false;
clearInterval(timer);
}
if (response.data.status == "unpaid"){
_this.isQuery = true;
_this.dialogVisiblejLoading = true
}
}
// _this.resetting1();
})
},1000)
// 15
// if (_this.isQuery){
// setTimeout(function () {
// },10000)
// }
let timer2 = setInterval(function () {
if (!_this.isQuery || !_this.dialogVisiblej) {
_this.loading = false;
// _this.isPay = true;
// _this.countdown()
clearInterval(timer);
clearTimeout(timer3);
}
}, 1000)
var timer3 = setTimeout(function () {
clearInterval(timer2);
clearInterval(timer);
_this.loading = false;
_this.isPay = true;
this.isPaySuccess = false;
}, 15000)
},
//
async collection() {
if (this.payForm.payType == "CASH") {
@ -1086,8 +1317,13 @@ export default {
let isPaySuccess = false;
console.log(_this.payForm, 1089)
//
await addLJGoods(_this.payForm).then(async response => {
_this.orderNo = response.data.orderNo;
//
console.log("支付成功", response)
if (response.data.oilOrder != null) {
if (response.data.oilOrder.orderStatus == "paid") {
@ -1095,10 +1331,7 @@ export default {
isPaySuccess = true
_this.isPay = true;
_this.loading = false;
_this.printLocally()
_this.oilOrderReport()
_this.resetting1()
return;
}
@ -1109,9 +1342,7 @@ export default {
isPaySuccess = true
_this.isPay = true;
_this.loading = false;
_this.printLocally()
_this.oilOrderReport()
_this.resetting1()
return;
}
@ -1133,7 +1364,6 @@ export default {
this.loading = true;
if (!isPaySuccess) {
await _this.queryPayStatus();
_this.resetting1();
}
},
@ -1152,13 +1382,14 @@ export default {
oils: this.oilGunClearing.oilNameId,
oilGunNum: this.oilGunClearing.id,
tankId: this.oilGunClearing.tankId,
activeId: null,
activeType: null,
activeId: this.chooseAct.hasOwnProperty('actId') ? this.chooseAct.activeId : null,
activeType: this.chooseAct.hasOwnProperty('type') ? this.chooseAct.activeType : null,
})
}else {
this.payForm.oilOrder = null
}
//
this.payForm.goodsOrder = JSON.stringify(this.goodsList)
//
@ -1175,8 +1406,12 @@ export default {
this.payForm.oilGunId = this.oilGunClearing.id
//
this.payForm.activeAmount = this.chooseAct.disAmount || 0.0
//
this.payForm.couponType = this.chooseCoupon.type
this.payForm.couponType = this.chooseCoupon.hasOwnProperty('type') ? this.chooseCoupon.type : null
//id
this.payForm.couponId = this.chooseCoupon.hasOwnProperty('couponId') ? this.chooseCoupon.id : null
//
this.payForm.payUser = this.chooseVipUser.mobile
//
@ -1184,12 +1419,6 @@ export default {
//
this.payForm.goodsDiscount = 0;
// this.payForm.usePoint=0;
// this.payForm.pointAmount=0;
// this.payForm.balanceAmount=0;
// this.payForm.oilCardAmount=0;
// //id
// this.payForm.staffId = this.$store.getters.userId;
// ()
this.payForm.consumeAmount = this.realAmount;
//id
@ -1203,16 +1432,18 @@ export default {
this.payForm.goodsNum = this.getGoodsListNum
// +
this.payForm.allAmount = this.realAmount
//
if (this.payForm.payType == "CASH") {
this.authCode = this.realAmount
}
this.payForm.realyPayBills = this.realAmount
this.flag = 3
this.payForm.paymentType = this.payType
console.log('支付类型', this.payForm.paymentType)
//
this.payForm.realyPayBills= this.realAmount
this.isPay = true;
this.openConfirm = true;
this.isPay = true
console.log(this.payForm,1210)
this.flag = 3
},
//
getCode(amount, flag) {
@ -1636,6 +1867,7 @@ export default {
* @param value
*/
setindex(value) {
console.log('支付方式',value);
this.payType = value
//
this.getActivity()
@ -1779,6 +2011,12 @@ export default {
</script>
<style scoped lang="scss">
.disabled {
pointer-events: none; //
opacity: 0.6; //
}
input {
width: 100%;
border: none;