Sfoglia il codice sorgente

重复调用两次支付接口bug修改

licc 2 mesi fa
parent
commit
a8ca173d70
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 5 3
      src/views/order/console.vue

+ 5 - 3
src/views/order/console.vue

@@ -468,11 +468,12 @@ const handleScanInput = (event: KeyboardEvent) => {
 
   console.log("event.key", event.key)
   if (event.key === 'Enter') {
-    document.removeEventListener('keydown', handleScanInput)
     if (!data.canScan) {
       feedback.notifyWarning('正在处理支付,请勿重复扫码')
       return
     }
+    data.canScan = false
+    document.removeEventListener('keydown', handleScanInput)
     const code = scanCode.value
     console.log('扫码内容:', code)
     payingDialogVisible.value = true // 显示支付中对话框
@@ -788,7 +789,7 @@ const clickSortButton = (name: any) => {
 const toEmpty = () => {
     if (data.selectGoods.length != 0) {
         orderLoading.value = true
-        toEmptyy({ id: params.number }).finally(() => {
+        toEmptyy({ id: params.number }).then(() => {
             //清空未出单的餐品-保留出单餐品
             data.selectGoods = []
             orderData.sumPriceSum = data.selectGoods.reduce(
@@ -818,7 +819,8 @@ const toEmpty = () => {
                 orderData.sumPriceSum -
                     (params.couponAmount === '-' ? 0 : Number(params.couponAmount))
             ).toFixed(2)
-            orderLoading.value = false
+        }).finally(()=>{
+          orderLoading.value = false
         })
     }
 }