From 8a4189a7781d6e05b113c480aeed31a5c3111d9d Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Tue, 15 Oct 2024 16:09:34 +0800 Subject: [PATCH] 10.15 --- .../views/cashier/NewComponents/newHome.vue | 255 ++++++++++++------ .../newHomeComponents/accountPending.vue | 2 +- 2 files changed, 175 insertions(+), 82 deletions(-) diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue index 0ab93fd53..80fc3ea87 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 @@ 关闭 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + 取 消 - 确 定 + 确 定 -
@@ -559,9 +560,10 @@ import { getCheckTheStatusOfYourPaymentApi, rechargeCard } from "@/api/cashier/cardSet"; -import { getReturnCode, printOilOrderReport } from '@/api/print' +import {getReturnCode, printOilOrderReport} from '@/api/print' import {addLJGoods, scanAppletQrCode} from "@/api/cashier/oilorder"; -import { cashierOrderByOrderNo } from '@/api/cashier/cashierorder' +import {cashierOrderByOrderNo} from '@/api/cashier/cashierorder' +import {addHangBill} from "../../../api/cashier/hangbill"; export default { dicts: ['CardCoupon_type'], @@ -618,7 +620,7 @@ export default { oilGun: '', //油枪结算 容器 oilGunClearing: { - amount:0 + amount: 0 }, //商品列表 goodsList: [], @@ -665,6 +667,8 @@ export default { pickUpTheOrder: false, accountPending: false, memberRecharge: false, + // 挂账订单信息 + credit: {}, //会员搜索列表 vipUserList: [], chooseVipUser: {}, @@ -699,12 +703,12 @@ export default { realAmount: { handler(newVal) { console.log("结算金额", newVal); - // 判断是否有结算金额 - if (this.realAmount > 0){ - this.isClickable = true - }else { - this.isClickable = false - } + // 判断是否有结算金额 + if (this.realAmount > 0) { + this.isClickable = true + } else { + this.isClickable = false + } }, }, @@ -795,8 +799,8 @@ export default { }, computed: { - getChangeShould(){ - return this.payForm.authCode-this.realAmount + getChangeShould() { + return this.payForm.authCode - this.realAmount }, getGoodsItem() { if (this.oilGunClearing.amount && this.oilGunClearing.amount !== undefined) { @@ -832,8 +836,8 @@ export default { methods: { //结算弹窗 监听关闭 清除表单 - onDialogClose(){ - this.payForm.authCode=null + onDialogClose() { + this.payForm.authCode = null }, sendCouponClick() { @@ -913,10 +917,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 @@ -1065,17 +1069,17 @@ export default { //this.getCode(this.realyPayBills, this.flag) }, // 打印商品支付后的订单 - oilOrderReport () { + oilOrderReport() { //现在油品只有一个了 let oilOrderR = [ { - oilName : this.oilGunClearing.name, - amount : this.oilGunClearing.amount + '', + oilName: this.oilGunClearing.name, + amount: this.oilGunClearing.amount + '', } ] let goodsOrderR = [] - if (this.goodsOrder && this.goodsOrder.length>0) { + if (this.goodsOrder && this.goodsOrder.length > 0) { this.goodsOrder.forEach(order => { let o = { oilName: order.name, @@ -1099,52 +1103,52 @@ export default { }; let payTypeText = payTypeMap[this.payType] || '小程序码'; - let f ={ - oilOrder:oilOrderR, - goodsOrder:goodsOrderR, - payType:payTypeText, - unitName:"", // 挂账单位 + let f = { + oilOrder: oilOrderR, + goodsOrder: goodsOrderR, + payType: payTypeText, + unitName: "", // 挂账单位 // consumeAmount:this.consumeAmount, - creditAmount: (this.oilAmount+(+this.goodsAmount)).toFixed(2),//挂账金额 + creditAmount: (this.oilAmount + (+this.goodsAmount)).toFixed(2),//挂账金额 // 优惠合计 - discount:(this.oilDiscount + this.goodsDiscount + this.fullReduction + this.couponAmount).toFixed(2), // 油惠合计 + discount: (this.oilDiscount + this.goodsDiscount + this.fullReduction + this.couponAmount).toFixed(2), // 油惠合计 // 储值卡付款 - consumeAmount:this.consumeAmount, + consumeAmount: this.consumeAmount, // 屯油卡付款 - consumeRefuelMoney:this.consumeRefuelMoney ? this.consumeRefuelMoney.toFixed(2) : 0, + consumeRefuelMoney: this.consumeRefuelMoney ? this.consumeRefuelMoney.toFixed(2) : 0, // 实付款 - actualPay : ((+this.oilActualPay)+(+this.goodsActualPay)).toFixed(2), + actualPay: ((+this.oilActualPay) + (+this.goodsActualPay)).toFixed(2), // 找零 - seekZero:this.seekZero ? this.seekZero.toFixed(2) : 0, + seekZero: this.seekZero ? this.seekZero.toFixed(2) : 0, } if (this.form1 && this.form1.unitName) f.unitName = this.form1.unitName - printOilOrderReport(f).then(res=>{ - console.log(res,1121) + printOilOrderReport(f).then(res => { + console.log(res, 1121) }) }, //表单重置 - resetting1(){ + resetting1() { //请输入手机号输入框重置 - this.userMobile=null + this.userMobile = null //油枪重置 - this.oilGunClearing={} + this.oilGunClearing = {} //商品重置 - this.goodsList=[] + this.goodsList = [] - this.userInfo=false + this.userInfo = false //支付方式 默认 支付宝 this.payType = "ALIPAY" }, // 查询订单支付状态 - queryPayStatus(){ + queryPayStatus() { let _this = this; - let timer = setInterval(function (){ + let timer = setInterval(function () { // "234520231228115544f073f4" - cashierOrderByOrderNo({orderNo:_this.orderNo}).then( response => { - if (response.data){ - if (response.data.status == "paid"){ + cashierOrderByOrderNo({orderNo: _this.orderNo}).then(response => { + if (response.data) { + if (response.data.status == "paid") { _this.isPay = true; _this.isPaySuccess = true; _this.isQuery = false; @@ -1156,7 +1160,7 @@ export default { _this.resetting1(); - if (response.data.oilOrderAmount>0){ + 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 @@ -1169,7 +1173,7 @@ export default { } clearInterval(timer); } - if (response.data.status == "payFail"){ + if (response.data.status == "payFail") { _this.isPaySuccess = false; // _this.isPay = true; _this.isQuery = false; @@ -1177,14 +1181,14 @@ export default { _this.loading = false; clearInterval(timer); } - if (response.data.status == "unpaid"){ + if (response.data.status == "unpaid") { _this.isQuery = true; _this.dialogVisiblejLoading = true } } // _this.resetting1(); }) - },1000) + }, 1000) // 如果是为支付状态15后打开去订单页查询的接口 // if (_this.isQuery){ @@ -1319,7 +1323,7 @@ export default { // 活动id // 活动类型 - if (this.oilGunClearing){ + if (this.oilGunClearing) { this.payForm.oilOrder = JSON.stringify({ oilPrice: this.oilGunClearing.oilPrice, oils: this.oilGunClearing.oilNameId, @@ -1328,7 +1332,7 @@ export default { activeId: this.chooseAct.hasOwnProperty('actId') ? this.chooseAct.activeId : null, activeType: this.chooseAct.hasOwnProperty('type') ? this.chooseAct.activeType : null, }) - }else { + } else { this.payForm.oilOrder = null } @@ -1382,7 +1386,7 @@ export default { console.log('支付类型', this.payForm.paymentType) //支付弹窗 相关 - this.payForm.realyPayBills= this.realAmount + this.payForm.realyPayBills = this.realAmount this.isPay = true; this.openConfirm = true; this.flag = 3 @@ -1805,26 +1809,115 @@ export default { } }, - changeAmount(val){ - console.log(val,1807) + changeAmount(val) { + console.log(val, 1807) + this.credit = val + }, + // 添加挂账记录 + addHangbill() { + addHangBill(this.credit).then(async response => { + if (response.data == 1) { + await this.addOrder(); + this.$modal.msgSuccess("挂账记录添加成功"); + this.accountPending = false; + // this.printLocally() + this.oilOrderReport() + + this.payType = "WECHAT" + this.restVipUser(); + this.resetting1(); + } else { + this.$modal.msgError("挂账单位可用额度不足,无法进行挂账"); + } + }) + }, + // 添加挂账订单信息 + async addOrder() { + if (this.oilGunClearing) { + this.payForm.oilOrder = JSON.stringify({ + oilPrice: this.oilGunClearing.oilPrice, + oils: this.oilGunClearing.oilNameId, + oilGunNum: this.oilGunClearing.id, + tankId: this.oilGunClearing.tankId, + 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) + //支付方式 + this.payForm.payType = this.payType + //油品订单金额 + this.payForm.oilAmount = this.oilGunClearing.amount || 0 + //商品订单金额 + this.payForm.goodsAmount = this.getGoodsNum + //油品实付金额 + this.payForm.oilActualPay = this.oilGunClearing.amount || 0 + //商品实付金额 + this.payForm.goodsActualPay = this.getGoodsNum + //油枪id + this.payForm.oilGunId = this.oilGunClearing.id + //活动营销优惠金额 + this.payForm.activeAmount = this.chooseAct.disAmount || 0.0 + + //优惠卷类型 + 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 + //油品优惠金额 + this.payForm.oilDiscount = 0; + //商品优惠金额 + this.payForm.goodsDiscount = 0; + + //会员消费金额 (储值卡需要减少的金额) + this.payForm.consumeAmount = this.realAmount; + //会员id + this.payForm.userId = this.chooseVipUser.id + //终端 默认传PC + this.payForm.terminal = "PC" + //商品 ids + // 将集合内 所有id 拼接 , 隔开 this.goodsList + this.payForm.goodsIds = this.goodsList.map(item => item.id).join(",") + //购买商品的总数量 计算属性 + this.payForm.goodsNum = this.getGoodsListNum + //油品 + 商品 的实付总额 + this.payForm.allAmount = this.realAmount + + + this.payForm.paymentType = this.payType + + console.log('支付类型', this.payForm.paymentType) + + //支付弹窗 相关 + this.payForm.realyPayBills = this.realAmount + await addLJGoods(this.payForm).then(response => { + + }) }, /** * 设置选中的支付方式 * @param value */ setindex(value) { - if (value=='after_pay'){ - if (this.getGoodsNum>0){ + if (value == 'after_pay') { + if (this.getGoodsNum > 0) { this.$message.error("商品订单不支持挂账") return } - if (this.oilGunClearing.amount<=0){ + if (this.oilGunClearing.amount <= 0) { this.$message.error("请选择挂账订单") return; } this.accountPending = true } - console.log('支付方式',value); + console.log('支付方式', value); this.payType = value //支付方式发生变化,查询可用优惠券和优惠活动 this.getActivity() diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHomeComponents/accountPending.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHomeComponents/accountPending.vue index 333e0b883..d6ecbb154 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/newHomeComponents/accountPending.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/newHomeComponents/accountPending.vue @@ -127,7 +127,7 @@ export default { - +