diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/controller/CashRegisterGoodsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/controller/CashRegisterGoodsController.java index da2196ecc..03e84d613 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/controller/CashRegisterGoodsController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/controller/CashRegisterGoodsController.java @@ -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 map = new HashMap<>(); - map.put("store_id", TokenUtil.getNowAccountInfo().getStoreId()); - List mtGoods = cashRegisterGoodsService.selectListByMap(map); + map.put("god.store_id", TokenUtil.getNowAccountInfo().getStoreId()); + List mtGoods = cashRegisterGoodsService.selectListByMap(map); return getSuccessResult(mtGoods); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/entity/MtGoodsVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/entity/MtGoodsVo.java new file mode 100644 index 000000000..69fc0a598 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/entity/MtGoodsVo.java @@ -0,0 +1,9 @@ +package com.fuint.business.cashierGoods.entity; + +import lombok.Data; + +@Data +public class MtGoodsVo extends MtGoods { + + private String supplierName; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/CashRegisterGoodsMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/CashRegisterGoodsMapper.java index f249d9edd..88f8faee2 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/CashRegisterGoodsMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/CashRegisterGoodsMapper.java @@ -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 { + List selectListByMap(@Param("map") Map columnMap); + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/xml/MtGoodsMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/xml/MtGoodsMapper.xml index aa5827cc4..9d9fdb841 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/xml/MtGoodsMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/xml/MtGoodsMapper.xml @@ -312,5 +312,19 @@ where store_id = #{storeId} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/CashRegisterGoodsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/CashRegisterGoodsService.java index 846a4ad9d..b84edb72d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/CashRegisterGoodsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/CashRegisterGoodsService.java @@ -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 selectListByMap(Map columnMap); + List selectListByMap(Map columnMap); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/impl/CashRegisterGoodsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/impl/CashRegisterGoodsServiceImpl.java index b46099094..436affafa 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/impl/CashRegisterGoodsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/impl/CashRegisterGoodsServiceImpl.java @@ -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 implements CashRegisterGoodsService { - +//supplier @Override - public List selectListByMap(Map columnMap) { + public List selectListByMap(Map columnMap) { - List mtGoods = super.baseMapper.selectByMap(columnMap); + List mtGoods = super.baseMapper.selectListByMap(columnMap); return mtGoods; } diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue index e2a42e6e3..c8e0fbcea 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue @@ -131,7 +131,7 @@
¥{{ realAmount }}
优惠合计:¥{{ disTotal }}
-
立即结算
+
立即结算
@@ -314,29 +314,29 @@ 关闭 - -
-
应收款: ¥98.00
- - - - - - -
- 应找零:¥20.00 -
-
-
- - 确定收款 - -
+ + + + + + + + + + + + + + + + + + + + + + + - +
@@ -458,7 +459,7 @@
@@ -484,18 +485,18 @@
-
应找零 - ¥{{ payForm.seekZero }} + ¥{{ getChangeShould }}
@@ -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 {