Przeglądaj źródła

申领订单弹窗修改

gongwencan 1 miesiąc temu
rodzic
commit
e1c839699a

+ 1 - 1
src/components/DialogAddTagNullify.vue

@@ -93,7 +93,7 @@ export default {
           message: '作废数量需大于0',
           position: 'bottom-right'
         })
-        this.isSave = true
+        this.isSave = false
       }
     }
   }

+ 32 - 4
src/components/DialogTagApplyDetail.vue

@@ -155,8 +155,8 @@
       <template #footer v-if="oData && oData.tagApplyStateId === '0'">
         <div class="flex center dialog-footer">
           <el-button
-            @click="onCloseBtnClick"
-          >导入</el-button>
+            @click="onImportOrUpdateBtnClick"
+          >{{ isAuto ? '导入' : '修改' }}</el-button>
           <el-button
             v-if="oData && oData.tagApplyStateId === '0'"
             type="primary"
@@ -188,7 +188,8 @@ export default {
   },
   data: () => ({
     visible: false,
-    oData: null
+    oData: null,
+    isAuto: false // flag=true 标识导入订单后自动弹出,false标识从详情弹出
   }),
   computed: {
     formattedTitle () {
@@ -196,12 +197,14 @@ export default {
     }
   },
   methods: {
-    open (data) {
+    open (data, flag) {
+      this.isAuto = flag
       this.oData = data
       this.visible = true
       this.list = data.details
     },
     close () {
+      this.isAuto = false
       this.oData = null
       this.visible = false
       this.list = Object.freeze([])
@@ -254,6 +257,31 @@ export default {
     onCloseBtnClick () {
       this.close()
     },
+    onImportOrUpdateBtnClick () {
+      if (this.oData && this.oData.details && this.oData.details.length > 0) {
+        const datas = this.oData.details.filter(item => item.number && item.number > 0)
+        if (datas.length !== this.oData.details.length) {
+          this.$notify.error({
+            title: '失败',
+            message: '标签数量需大于0',
+            position: 'bottom-right'
+          })
+          return
+        }
+        this.$$request(this.api, this.oData).then((flag) => {
+          if (flag) {
+            this.$notify({
+              title: '成功',
+              message: '操作成功',
+              type: 'success',
+              position: 'bottom-right'
+            })
+            this.close()
+            this.$emit('saved')
+          }
+        }).catch(console.error).finally(() => {})
+      }
+    },
     onOkBtnClick () {
       this.$$request(this.api, this.oData).then((flag) => {
         if (flag) {

+ 9 - 2
src/components/DialogTagPurchase.vue

@@ -61,7 +61,7 @@
     <template #footer>
       <div class="flex center dialog-footer">
         <el-button @click="onCloseBtnClick">取消</el-button>
-        <el-button type="primary" @click="onSavePurchaseBtnClick">确定</el-button>
+        <el-button :disabled="!visible || isSave" type="primary" @click="onSavePurchaseBtnClick">确定</el-button>
       </div>
     </template>
   </el-dialog>
@@ -84,6 +84,9 @@ export default {
       type: Object
     }
   },
+  data: () => ({
+    isSave: false
+  }),
   methods: {
     tagNumberValidator (rule, value, callback) {
       value = parseFloat(value)
@@ -97,6 +100,9 @@ export default {
       return callback()
     },
     onSavePurchaseBtnClick () {
+      if (this.isSave) {
+        return
+      }
       const saveData = {
         receiveDate: new Date(this.data.dataTime).format('YYYY/MM/DD HH:mm:ss'),
         providerId: this.data.providerId,
@@ -110,10 +116,11 @@ export default {
         })
         return
       }
+      this.isSave = true
       this.$$request(this.api, saveData).then(() => {
         this.close()
         this.$emit('saved')
-      }).catch(console.error).finally(() => {})
+      }).catch(console.error).finally(() => { this.isSave = false })
     }
   }
 }

+ 2 - 2
src/views/TagApply.vue

@@ -243,7 +243,7 @@ export default {
     onDataImported (data) {
       if (data) {
         this.loadList()
-        this.$refs.tagApplyDetailDialog.open(data)
+        this.$refs.tagApplyDetailDialog.open(data, true)
       }
     },
     async onExportOrderBtnClick () {
@@ -288,7 +288,7 @@ export default {
     onOpenDetailEditorBtnClick (data) {
       this.$$request(TagApply.$$api.getDetail, data, this)
         .then(data => {
-          this.$refs.tagApplyDetailDialog.open(data)
+          this.$refs.tagApplyDetailDialog.open(data, false)
         }).catch(console.error).finally(() => {})
     },
     onConfirmOrderBtnClick () {