Browse Source

Merge branch 'dev_v2' into feat-two

zh 2 năm trước cách đây
mục cha
commit
299e69a67a

+ 2 - 1
src/mixin/print.js

@@ -247,10 +247,11 @@ export default {
         this.clonelData = []
         return promise
       } catch (error) {
+
         // console.error('添加打印次数失败')
         this.clonelData = []
         // this.$errorMsg('添加打印次数失败' + JSON.stringify(requestParams))
-        return Promise.reject(error)
+        return Promise.reject('系统提示:单被商家取消预约,请刷新页面,重新选择打印')
       }
     },
     /**

+ 2 - 0
src/views/supply/apply/components/design/preview.vue

@@ -105,6 +105,8 @@ export default {
             this.$confirm(err, '提示', {
               confirmButtonText: '确定',
               showCancelButton: false,
+              showClose: false,
+
               type: 'warning',
               center: true
             }).then(() => {

+ 2 - 0
src/views/supply/deliver/components/design/preview.vue

@@ -105,6 +105,8 @@ export default {
             this.$confirm(err, '提示', {
               confirmButtonText: '确定',
               showCancelButton: false,
+              showClose: false,
+
               type: 'warning',
               center: true
             }).then(() => {

+ 13 - 7
src/views/supply/pickup/check.vue

@@ -419,7 +419,7 @@
         <el-button type="primary" @click="submitDialogForm">确 定</el-button>
       </div>
     </el-dialog>
-    <print-preview ref="preView" :add-print="addPrint" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :getNewDetailPrintDisString="getNewDetailPrintDisString"/>
+    <print-preview ref="preView" :add-print="addPrint" :get-oval-dateil="getOvalDateil" :get-new-detail-print-dis-string="getNewDetailPrintDisString" @refreshTableSelection="refreshTableSelection" @initPrint="handleInitPrint" @refreshList="handleRefreshList" />
 
     <!-- <PickupPrint :listItem="queryItem" v-if="isShowPrint" @backListFormDetail="backList" /> -->
   </div>
@@ -745,7 +745,7 @@ export default {
 
     // 点击打印
     async toPrint() {
-      const { data } = this.getNewDetailPrintDisString()
+      const { data } = await this.getNewDetailPrintDisString()
       if (data) {
         this.$confirm(<p class='text'>{data}</p>, '提示', {
           confirmButtonText: '确定',
@@ -759,13 +759,18 @@ export default {
           }
         })
       } else {
-        this.getDateil(this.tableSelection, 'getDtailPrintDis', this.check).then(res => {
-          this.tableSelection = []
-          this.$endLoading()
-          this.$refs.preView.show(this.hiprintTemplate, this.outputData)
-        })
+        this.getOvalDateil()
       }
     },
+    getOvalDateil() {
+      this.getDateil(this.tableSelection, 'getDtailPrintDis', this.check).then(res => {
+        this.$endLoading()
+        this.$refs.preView.show(this.hiprintTemplate, this.outputData)
+      })
+    },
+    refreshTableSelection() {
+      this.tableSelection = []
+    },
     async getNewDetailPrintDisString() {
       const params = []
       const len = this.tableSelection.length
@@ -776,6 +781,7 @@ export default {
           invoiceId: this.tableSelection[i - 1].invoiceId
         })
       }
+      console.log(params, this.tableSelection)
       return await getDetailPrintDisString(params)
     },
     // 关闭弹窗

+ 52 - 32
src/views/supply/pickup/components/design/preview.vue

@@ -40,7 +40,7 @@ export default {
       type: Function,
       default: null
     },
-    getNewDetailPrintDisString: {
+    getOvalDateil: {
       type: Function,
       default: null
     }
@@ -57,7 +57,8 @@ export default {
       hiprintTemplate: {},
       // 数据
       printData: {},
-      loading: true
+      loading: true,
+      flag: false
     }
   },
   computed: {},
@@ -72,6 +73,8 @@ export default {
       this.visible = false
       this.waitShowPrinter = false
       this.$emit('initPrint')
+      this.$emit('refreshTableSelection')
+      this.$emit('refreshList')
       // console.log(this.$parent);
     },
     show(hiprintTemplate, printData, width = '210') {
@@ -88,51 +91,68 @@ export default {
     },
     async print() {
       if (this.getNewDetailPrintDisString) {
-        const { data } = await this.getNewDetailPrintDisString()
-        if (data) {
-          try {
-            if (typeof this.addPrint === 'function') {
-              this.addPrint('getDtailPrintDis')
-                .then(res => {
-                  this.hiprintTemplate.print(
-                    this.printData,
-                    {},
-                    {
-                      callback: async() => {
-                        this.hiprintTemplate = {}
-                        setTimeout(() => {
-                          this.hideModal()
-                          this.$emit('refreshList')
-                        }, 1000)
+        try {
+          const { data } = await this.getNewDetailPrintDisString()
+
+          if (!data || this.flag) {
+            try {
+              if (typeof this.addPrint === 'function') {
+                this.addPrint('getDtailPrintDis')
+                  .then(res => {
+                    this.hiprintTemplate.print(
+                      this.printData,
+                      {},
+                      {
+                        callback: async() => {
+                          this.hiprintTemplate = {}
+                          setTimeout(() => {
+                            this.flag = false
+                            this.hideModal()
+                            this.$emit('refreshTableSelection')
+                            this.$emit('refreshList')
+                          }, 1000)
+                        }
                       }
-                    }
-                  )
-                })
-                .catch(err => {
-                  this.myConfirm(err)
-                })
-            } else {
-              console.log(333)
-            // throw new Error('加载失败,刷新重试')
+                    )
+                  })
+                  .catch(err => {
+                    this.myConfirm(err)
+                  })
+              } else {
+                console.log(333)
+                // throw new Error('加载失败,刷新重试')
+              }
+            } catch (e) {
+              this.$errorMsg(e)
+              // '调用打印次数接口失败'
             }
-          } catch (e) {
-            this.$errorMsg(e)
-          // '调用打印次数接口失败'
+          } else {
+            this.$confirm(data, '提示', {
+              showClose: false,
+              confirmButtonText: '确定',
+              showCancelButton: false,
+              type: 'warning',
+              center: true
+            }).then(() => {
+              this.getOvalDateil()
+              this.flag = true
+            })
           }
-        } else {
+        } catch (error) {
           this.myConfirm()
         }
       }
     },
     myConfirm(err) {
       this.$confirm(err || '系统提示:单被商家取消预约,请刷新页面,重新选择打印', '提示', {
-
+        showClose: false,
         confirmButtonText: '确定',
         showCancelButton: false,
         type: 'warning',
         center: true
       }).then(() => {
         this.hideModal()
+        this.$emit('refreshTableSelection')
         this.$emit('refreshList')
       })
     }