diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue index 6293c83bc..2a1da26ea 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue @@ -113,7 +113,7 @@
-
{{ item.dictLabel }}
@@ -552,6 +552,7 @@ import { rechargeCard } from "@/api/cashier/cardSet"; import {getReturnCode} from "@/api/print"; +import {addLJGoods, scanAppletQrCode} from "@/api/cashier/oilorder"; export default { dicts: ['CardCoupon_type'], @@ -577,7 +578,7 @@ export default { //选中的优惠券对象 chooseCoupon:{}, //支付方式--默认支付宝 - payWay: "ALIPAY", + payType: "ALIPAY", //订单总金额 orderAmount:0.00, //加油升数 @@ -1006,10 +1007,129 @@ export default { this.isPay = true //this.getCode(this.realyPayBills, this.flag) }, + // 确定收款 + async collection(){ + if (this.payForm.payType=="CASH"){ + if (this.payForm.authCode<((+this.oilActualPay) + (+this.goodsActualPay)) || this.seekZero<0){ + this.$modal.msgError("请输入正确的金额"); + return; + } + if (!this.payForm.authCode && ((+this.oilActualPay) + (+this.goodsActualPay))>0){ + this.$modal.msgError("请输入正确的金额"); + return; + } + } + if (!this.payForm.authCode && ((+this.oilActualPay) + (+this.goodsActualPay))>0){ + this.$modal.msgError("请先扫码"); + return; + } + this.loading = true; + let _this = this; + //小程序码付款 + if (this.payForm.payType=="APPLET_CODE"){ + if (this.goodsList.length>0){ + this.$modal.msgError("非油商品不可使用小程序码支付") + return; + } + await scanAppletQrCode(_this.payForm).then( resp => { + if (resp.data.success=='success'){ + setTimeout(function (){ + _this.loading = false; + _this.isPaySuccess = true; + _this.isPay = true; + // _this.printLocally() + _this.oilOrderReport() + _this.resetting1(); + },3000) + }else { + setTimeout(function (){ + _this.loading = false; + _this.isPaySuccess = false; + _this.isPay = true; + _this.resetting1(); + this.$modal.msgError(resp.data.error) + },3000) + } + }) + return; + } + + let isPaySuccess = false; + + await addLJGoods(_this.map).then( async response => { + _this.orderNo = response.data.orderNo; + if (response.data.oilOrder != null) { + if (response.data.oilOrder.orderStatus == "paid") { + + _this.isPaySuccess = true; + isPaySuccess = true + _this.isPay = true; + _this.loading = false; + + _this.printLocally() + _this.oilOrderReport() + + _this.resetting1() + return; + } + } + if (response.data.goodsOrder != null) { + if (response.data.goodsOrder.status == "paid") { + _this.isPaySuccess = true; + isPaySuccess = true + _this.isPay = true; + _this.loading = false; + _this.printLocally() + _this.oilOrderReport() + + _this.resetting1() + return; + } + } + if (response.data.error == 1) { + this.$modal.msgError("商品库存不足,请重新选择商品") + this.loading = false; + this.autofocus = false + this.dialogVisiblej = false; + return; + } + if (response.data.error == "请先配置支付通道") { + this.$modal.msgError(response.data.error) + this.loading = false; + // this.dialogVisiblej = false; + return; + } + }) + this.loading = true; + if ( !isPaySuccess ){ + await _this.queryPayStatus(); + + _this.resetting1(); + } + }, // 立即结算 async settlement(){ + this.payForm.oilOrder = this.oilGunClearing + this.payForm.goodsOrder = this.goodsList + //油品订单金额 + this.payForm.oilAmount = this.oilGunClearing.amount + //商品订单金额 + this.payForm.goodsAmount = this.getGoodsNum + //油品实付金额 + this.payForm.oilActualPay = this.oilGunClearing.amount + //商品实付金额 + this.payForm.goodsActualPay = this.getGoodsNum + //油枪Id + this.payForm.oilGunId + this.payForm.oilOrder = this.oilGunClearing + this.payForm.oilOrder = this.oilGunClearing + this.payForm.oilOrder = this.oilGunClearing + this.payForm.oilOrder = this.oilGunClearing + this.payForm.realyPayBills = this.realAmount - this.payForm.paymentType = this.payWay + this.payForm.payType = this.payType + //找零金额 + this.payForm.seekZero = this.seekZero; this.flag = 3 this.openConfirm = true; this.isPay = true @@ -1054,7 +1174,7 @@ export default { oilPrice:this.oilGunClearing.oilPrice, oilAmount: this.oilGunClearing.amount, orderAmount: this.orderAmount, - payWay: this.payWay, + payWay: this.payType, oilLiter: this.oilLiter } getActivityList(dataObj).then(res => { @@ -1079,7 +1199,7 @@ export default { //已选择会员且(选了商品或者加了油) let dataObj = { userId: this.chooseVipUser.id, - payWay: this.payWay + payWay: this.payType } if(this.oilGunClearing!='' && this.oilGunClearing.hasOwnProperty("oilNameId")){ //加油油枪有值 @@ -1435,7 +1555,7 @@ export default { * @param value */ setindex(value) { - this.payWay = value + this.payType = value //支付方式发生变化,查询可用优惠券和优惠活动 this.getActivity() this.getCoupon()