shish 2 месяцев назад
Родитель
Сommit
3360f2626b

+ 34 - 1
hdPad/src/pages/home/components/console.vue

@@ -84,7 +84,15 @@
 
 	<!-- 直接收款 -->
 	<uni-popup ref="gatheringRef" background-color="#fff" type="center" :animation="false">
-		<selectPrice :balance="balance" :custom-id="customId" :custom-name="customName" @zjGathering="zjGathering" @cancelSelectPrice="cancelSelectPrice"></selectPrice>
+		<selectPrice
+			ref="gatheringSelectPriceRef"
+			:balance="balance"
+			:custom-id="customId"
+			:custom-name="customName"
+			@suggestBalancePay="onSuggestBalancePay"
+			@zjGathering="zjGathering"
+			@cancelSelectPrice="cancelSelectPrice"
+		></selectPrice>
 	</uni-popup>
 
 	<!-- 开单选花材输入数量和金额 -->
@@ -103,6 +111,16 @@
 		</view>
 	</uni-popup>
 
+	<uni-popup ref="balancePaySuggestRef" type="dialog">
+		<view style="width:60vw;height:70vh;background-color: white;padding:70upx 20upx 0 20upx;">
+			<view style="margin-bottom:40upx;text-align: center;font-size:24upx;">客户余额充值,是否使用余额支付</view>
+			<view style="text-align:center;">
+				<button class="admin-button-com mini-btn default" @click="cancelSuggestBalancePay">取消</button>
+				<button class="admin-button-com mini-btn default" @click="confirmSuggestBalancePay" style="margin-left:30upx;">确认</button>
+			</view>
+		</view>
+	</uni-popup>
+
 </view>
 </template>
 <script>
@@ -316,6 +334,21 @@ export default {
 				}
 			})
 		},
+		onSuggestBalancePay() {
+			this.$refs.balancePaySuggestRef.open('center')
+		},
+		cancelSuggestBalancePay() {
+			this.$util.hitVoice()
+			this.$refs.balancePaySuggestRef.close()
+		},
+		confirmSuggestBalancePay() {
+			this.$util.hitVoice()
+			this.$refs.balancePaySuggestRef.close()
+			const sp = this.$refs.gatheringSelectPriceRef
+			if (sp && typeof sp.submitWithForcedBalancePay === 'function') {
+				sp.submitWithForcedBalancePay()
+			}
+		},
 		showCustomPop(){
 			this.$util.hitVoice()
 			this.$emit('showCustomPop')

+ 29 - 4
hdPad/src/pages/home/components/selectPrice.vue

@@ -961,6 +961,9 @@ export default {
             }
             this.pushHistorySnapshot(total, { source: 'stash', orderOnly })
             this.$msg('已暂存')
+            this.clearStack()
+            this.keyboardTarget = 'calc'
+            this.checkType = 3
         },
         clearStack() {
             this.tokens = []
@@ -1050,10 +1053,9 @@ export default {
                 return
             }
             if (action === 'calc-clear') {
-                if (!this.ensureCalcModeForOps()) {
-                    return
-                }
                 this.clearStack()
+                this.keyboardTarget = 'calc'
+                this.checkType = 3
                 return
             }
             if (action === 'backspace') {
@@ -1131,7 +1133,17 @@ export default {
             this.checkType = 0
         },
         submitCashierPay() {
+            this._submitCashierPayCore(false)
+        },
+        /** 父级确认「使用余额支付」后调用,跳过余额引导弹框 */
+        submitWithForcedBalancePay() {
             this.tapVoice()
+            this._submitCashierPayCore(true)
+        },
+        _submitCashierPayCore(forceBalancePay) {
+            if (!forceBalancePay) {
+                this.tapVoice()
+            }
             if (this.keyboardTarget === 'calc') {
                 const st = this.stackTotal
                 if (!Number.isFinite(st) || isNaN(st)) {
@@ -1163,7 +1175,7 @@ export default {
             const hasCalc =
                 this.tokens.length > 0 ||
                 (this.calcInput != null && !this.$util.isEmpty(this.calcInput))
-            const cashSubmit = this.showCashPayCols ? (Number(this.cash) || 0) : 0
+            let cashSubmit = this.showCashPayCols ? (Number(this.cash) || 0) : 0
             /** 现金不足:与结算选「扫码」一致,走后端 pending 收款并打开扫码付款页(mainPay/status) */
             const cashShortToScan = this.showCashPayCols && Number(this.zl) < 0
             let emitHasPay = this.selHasPay
@@ -1172,6 +1184,19 @@ export default {
                 emitHasPay = 0
                 emitPayWay = 0
             }
+            if (forceBalancePay) {
+                emitHasPay = 4
+                emitPayWay = 0
+                cashSubmit = 0
+            } else if (
+                !cashShortToScan &&
+                Number(this.customId) > 0 &&
+                Number(this.balance) >= Number(p) &&
+                emitHasPay !== 4
+            ) {
+                this.$emit('suggestBalancePay')
+                return
+            }
             this.pushHistorySnapshot(p, {
                 source: 'submit',
                 orderOnly: !hasCalc,