LAPTOP-FO2T5SIU\35838 7 miesięcy temu
rodzic
commit
8242c25a51

+ 14 - 5
src/views/invoice/components/addInvoice.vue

@@ -5,7 +5,7 @@
         <el-col style="padding-bottom: 10px">
           <span class="card_title">开票信息</span>
           <el-card shadow="always" style="padding-top: 10px">
-            <el-row>
+            <el-row v-if="!id">
               <el-col :span="4" class="col-txt"><span>*签约信息</span></el-col>
               <el-col :span="20" class="col-input">
                 <el-form-item>
@@ -131,7 +131,7 @@
     </el-form>
     <div style="text-align: right">
       <el-button @click="cancel">取 消</el-button>
-      <el-button v-if="!isView" type="primary" @click="confirmSubmit()">确 定</el-button>
+      <el-button v-if="!isView" type="primary" :loading="loadingFlag" @click="confirmSubmit()">确 定</el-button>
     </div>
 
     <el-dialog
@@ -168,7 +168,9 @@ export default {
             dialogVisible: false,
             dialogTitle: '',
             isView: false,
-            bankOptions: []
+            bankOptions: [],
+            loadingFlag: false,
+            id: ''
         }
     },
     mounted() {
@@ -177,6 +179,7 @@ export default {
     },
     methods: {
         initData(data) {
+            this.id = data.id
             this.isView = data.isView
             this.getBankOptions()
             if (data) {
@@ -217,7 +220,11 @@ export default {
         },
         confirmSubmit() {
             const _this = this
-            const soaUrl = 'add'
+            _this.loadingFlag = true
+            let soaUrl = 'add'
+            if (this.id) {
+                soaUrl = 'sendInvoice'
+            }
             const extraData = {
                 type: '1'
             }
@@ -229,8 +236,10 @@ export default {
                 } else {
                     this.$message.error(res.data.msg)
                 }
+                _this.loadingFlag = false
             }).catch(err => {
-                this.$message.error(err)
+                // this.$message.error(err)
+                _this.loadingFlag = false
             })
         },
         getChildrenData(data) {

+ 5 - 14
src/views/invoice/components/batchInvoice.vue

@@ -282,29 +282,17 @@ export default {
                 this.$message.warning('无数据')
                 return
             }
-            const returnList = this.batchInvoiceData.filter(x => !x.invoiceEmail || !x.invoicePhone ||
-              !x.invoiceHeaderId || !x.invoiceContent || !x.invoiceType || !x.invoiceSellerBank || !x.invoiceTax)
-            const passList = this.batchInvoiceData.filter(x => x.invoiceEmail &&
-              x.invoiceHeaderId && x.invoiceContent && x.invoiceType && x.invoiceSellerBank && x.invoiceTax)
-            if (!passList.length) {
-                this.$message.warning('无符合提交条件的数据,请确认发票发送邮箱是否为空')
-                return
-            }
             this.$confirm('是否确定提交?', '提示', {
                 confirmButtonText: '确定',
                 cancelButtonText: '取消',
                 type: 'warning'
             }).then(() => {
                 this.loading = true
-                this.baseRequest('batchInvoice', { data: JSON.stringify(passList) }).then(res => {
+                this.baseArrRequest('batchSendInvoice', this.batchInvoiceData, true).then(res => {
                     this.loading = false
                     if (res.data.key === 200) {
                         this.$message.success('提交成功')
-                        if (returnList.length) {
-                            this.batchInvoiceData = returnList
-                        } else {
-                            this.$emit('editClose', true)
-                        }
+                        this.$emit('editClose', true)
                     } else if (res.data.key === 504) {
                         this.$message.error(res.data.msg)
                         this.$emit('editClose', true)
@@ -339,6 +327,9 @@ export default {
         },
         baseRequest(opUrl, postData) {
             return this.$channel.globeRequest('InvoiceManageController', opUrl, postData, 'project')
+        },
+        baseArrRequest(opUrl, postData, isArr) {
+            return this.$channel.globeRequest('InvoiceManageController', opUrl, postData, 'project', isArr)
         }
     }
 }

+ 7 - 3
src/views/invoice/components/formalInvoiceManageEdit.vue

@@ -123,7 +123,7 @@
     </el-form>
     <div style="text-align: right">
       <el-button @click="cancel">取 消</el-button>
-      <el-button v-if="!isView" type="primary" @click="confirmSubmit()">确 定</el-button>
+      <el-button v-if="!isView" :loading="loadingFlag" type="primary" @click="confirmSubmit()">确 定</el-button>
     </div>
 
   </div>
@@ -145,7 +145,8 @@ export default {
             dialogVisible: false,
             dialogTitle: '',
             isView: false,
-            bankOptions: []
+            bankOptions: [],
+            loadingFlag: false
         }
     },
     mounted() {
@@ -194,6 +195,7 @@ export default {
         },
         confirmSubmit() {
             const _this = this
+            _this.loadingFlag = true
             const soaUrl = 'sendInvoice'
             const extraData = {
                 type: '1'
@@ -206,8 +208,10 @@ export default {
                 } else {
                     this.$message.error(res.data.msg)
                 }
+                _this.loadingFlag = false
             }).catch(err => {
-                this.$message.error(err)
+                // this.$message.error(err)
+                _this.loadingFlag = false
             })
         },
         getChildrenData(data) {

+ 10 - 0
src/views/invoice/invoiceManage.vue

@@ -152,6 +152,7 @@
           </el-table-column>
           <el-table-column header-align="center" label="操作" width="180">
             <template scope="scope">
+              <el-button v-if="scope.row.sendStatus === '0'" type="text" size="mini" @click="handleInvoice(scope.row)">推送</el-button>
               <el-button size="mini" type="text" @click="handleView(scope.row)">查看</el-button>
             </template>
           </el-table-column>
@@ -271,6 +272,15 @@ export default {
                 this.$refs.addInvoice.initData(val)
             })
         },
+        handleInvoice(row) {
+            this.dialogVisible = true
+            this.dialogTitle = ''
+            row.isView = false
+            // 新vue时调用的方法
+            this.$nextTick(() => {
+                this.$refs.addInvoice.initData(row)
+            })
+        },
         handleView(val) {
             this.dialogVisible = true
             this.dialogTitle = ''