helongyang
2026-03-31 8fcd7a67e4391a5f1fbdb590c2a3f913aeb2a0a0
´úÂë¹ÜÀí/»´°²PDA/pages/stash/ProEmptyBack.vue
@@ -11,7 +11,16 @@
                  @input="addressInput" />
            </uni-forms-item>
            <uni-forms-item>
               <button @click="InEmpty" type="primary" size="default" style="margin-top: 2%;">空框回库</button>
               <!-- ç©ºæ¡†å›žåº“按钮添加禁用状态和文字提示 -->
               <button
                  @click="InEmpty"
                  type="primary"
                  size="default"
                  style="margin-top: 2%;"
                  :disabled="isSubmitting"
               >
                  {{ isSubmitting ? '提交中...' : '空框回库' }}
               </button>
            </uni-forms-item>
         </uni-forms>
      </view>
@@ -28,7 +37,9 @@
            focusStart:false,
            barcode: "",
            address: "",
            WarehouseId: ""
            WarehouseId: "",
            // æ–°å¢žï¼šé˜²é‡å¤ç‚¹å‡»çŠ¶æ€å˜é‡
            isSubmitting: false
         }
      },
      onShow() {},
@@ -36,10 +47,6 @@
         
      },
      methods: {
         // voiceSpeech(src) {
         //    innerAudioContext.src = src; // '../../static/success.mp3';
         //    innerAudioContext.play();
         // },
         barcodeInput() {
            this.$nextTick(function(x) {
               if (this.barcode.length > 0) {
@@ -56,6 +63,7 @@
            })
         },
         InEmpty() {
            // 1. å‰ç½®æ ¡éªŒ
            if (this.barcode == "") {
               this.$refs.uToast.show({
                  title: "请扫描托盘码",
@@ -70,6 +78,13 @@
               })
               return;
            }
            // 2. é˜²æ­¢é‡å¤ç‚¹å‡»ï¼šè¯·æ±‚中则直接返回
            if (this.isSubmitting) return;
            // 3. æ ‡è®°ä¸ºè¯·æ±‚中,禁用按钮
            this.isSubmitting = true;
            this.$u.post('/api/Task/EmptyBackTask?barcode=' + this.barcode + '&startPoint=' + this.address).then(
               res => {
                  if (res.status) {
@@ -85,6 +100,15 @@
                        type: "error"
                     })
                  }
               }).catch(err => {
                  // æ•获请求异常,提示错误
                  this.$refs.uToast.show({
                     title: err.message || "请求失败",
                     type: "error"
                  })
               }).finally(() => {
                  // 4. è¯·æ±‚完成(成功/失败/异常)恢复按钮状态
                  this.isSubmitting = false;
               })
         }
      }