LAPTOP-FO2T5SIU\35838 9 months ago
parent
commit
7c759e9f81

+ 3 - 1
src/views/invoice/components/addInvoice.vue

@@ -190,7 +190,9 @@ export default {
             this.baseRequest('getById', postData).then(res => {
                 if (res.data) {
                     this.form = res.data
-                    this.getBankTaxRateByFloor()
+                    if (res.data.sendStatus == '0') {
+                        this.getBankTaxRateByFloor()
+                    }
                 }
             }).catch(err => {
                 this.$message.error(err)

+ 384 - 0
src/views/invoice/components/batchInvoice.vue

@@ -0,0 +1,384 @@
+<template>
+  <div v-loading="loading">
+    <el-row class="handle-box">
+      <el-col :span="24">
+        批量操作:
+        <el-select
+          v-model="batchInvoiceSellerBank"
+          filterable
+          size="small"
+          placeholder="销方开户行、账号"
+          :popper-append-to-body="false"
+          @change="batchBankChange"
+        >
+          <el-option
+            v-for="item in bankOptions"
+            :key="item.id"
+            :label="item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber"
+            :title="'适用楼盘:' + (item.suitFloorStr?item.suitFloorStr:'无') + ' 适用费用类型:' + (item.suitCostType?item.suitCostType:'无')"
+            :value="item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber"
+          >
+            <div class="my-select">
+              <span>{{ item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber }}</span>
+              <span style="color: #8492a6; font-size: 13px;padding-left: 10px">
+                {{ ' 适用楼盘:' + (item.suitFloorStr?item.suitFloorStr:'无') + ' 适用费用类型:' + (item.suitCostType?item.suitCostType:'无') }}
+              </span>
+            </div>
+          </el-option>
+        </el-select>
+        <el-select
+          v-model="batchInvoiceTax"
+          filterable
+          size="small"
+          placeholder="税率"
+          @change="batchTaxChange"
+        >
+          <el-option
+            v-for="item in dc_data.invoice_tax"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+        <el-select
+          v-model="batchInvoiceType"
+          filterable
+          size="small"
+          placeholder="发票类型"
+          @change="batchTypeChange"
+        >
+          <el-option
+            v-for="item in invoiceTypeOptions"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+      </el-col>
+    </el-row>
+    <el-row class="handle-box">
+      <el-col :span="24">
+        <el-table
+          :data="batchInvoiceData"
+          :row-style="checkRow"
+        >
+          <el-table-column align="center" label="操作" width="180">
+            <template v-slot="scope">
+              <el-button size="mini" type="danger" @click="delRow(scope.$index)">移除</el-button>
+            </template>
+          </el-table-column>
+          <el-table-column align="center" label="发票抬头" prop="invoiceHeaderName" />
+          <el-table-column align="center" label="税号" prop="invoiceHeaderNumber" />
+          <el-table-column align="center" label="项目名称" prop="invoiceGoodsName" />
+          <el-table-column align="center" label="规格" prop="specifications" />
+          <el-table-column align="center" label="单位">
+            <span>平方米</span>
+          </el-table-column>
+          <el-table-column align="center" label="数量" prop="invoiceCount" />
+          <el-table-column align="center" label="金额" prop="invoiceAmount" />
+          <el-table-column align="center" label="销方开户行、账号" min-width="150">
+            <template v-slot="scope">
+              <el-select
+                v-model="scope.row.invoiceSellerBank"
+                filterable
+                size="small"
+                placeholder="请选择"
+                style="width: 80%"
+                :popper-append-to-body="false"
+                @change="(val) => bankChange(val,scope.$index)"
+              >
+                <el-option
+                  v-for="item in bankOptions"
+                  :key="item.id"
+                  :label="item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber"
+                  :title="'适用楼盘:' + (item.suitFloorStr?item.suitFloorStr:'无') + ' 适用费用类型:' + (item.suitCostType?item.suitCostType:'无')"
+                  :value="item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber"
+                >
+                  <div class="my-select">
+                    <span>{{ item.bankName + (item.bankBranchName?item.bankBranchName:'') + item.bankNumber }}</span>
+                    <span style="color: #8492a6; font-size: 13px;padding-left: 10px">
+                      {{ ' 适用楼盘:' + (item.suitFloorStr?item.suitFloorStr:'无') + ' 适用费用类型:' + (item.suitCostType?item.suitCostType:'无') }}
+                    </span>
+                  </div>
+                </el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column align="center" label="税率" min-width="150">
+            <template v-slot="scope">
+              <el-select
+                v-model="scope.row.invoiceTax"
+                filterable
+                size="small"
+                placeholder="请选择"
+                style="width: 80%"
+              >
+                <el-option
+                  v-for="item in dc_data.invoice_tax"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                />
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column align="center" label="开票备注" min-width="200">
+            <template v-slot="scope">
+              <el-input v-model="scope.row.remark" type="textarea" autosize />
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-col>
+    </el-row>
+    <div slot="footer" style="text-align: right">
+      <el-button @click="handleClose">关 闭</el-button>
+      <el-button type="primary" @click="confirmSubmit()">提 交</el-button>
+    </div>
+  </div>
+</template>
+<script>
+import Base from '@/views/base/base'
+export default {
+    name: 'BatchInvoice',
+    components: { },
+    mixins: [Base],
+    data() {
+        return {
+            dc_key: ['invoice_tax'],
+            batchInvoiceData: [],
+            bankOptions: [],
+            loading: false,
+            dialogVisible: false,
+            batchInvoiceSellerBank: '',
+            batchInvoiceTax: '',
+            batchInvoiceType: '',
+            targetIndex: '',
+            invoiceTypeOptions: [
+                { label: '全电发票(增值税专用发票)', value: '01' },
+                { label: '全电发票(普通发票)', value: '02' }
+                // { label: '增值税电子发票', value: '026' },
+                // { label: '增值税普通发票', value: '007' },
+                // { label: '增值税电子专用发票', value: '028' },
+                // { label: '增值税专用发票', value: '004' }
+            ]
+        }
+    },
+    methods: {
+        initData(data) {
+            this.getBankOptions()
+            this.initDict(this.dc_key).then(() => {
+                this.batchInvoiceData = []
+                this.loading = true
+                const ids = data.map((obj, index) => {
+                    return obj.id
+                }).join(',')
+                this.baseRequest('batchListVo', { invoiceManages: ids }).then(res => {
+                    this.batchInvoiceData = res.data || []
+                    this.loading = false
+                }).catch((err) => {
+                    console.log(err)
+                    this.loading = false
+                })
+            })
+        },
+        editHeader(headerId) {
+            if (!headerId) {
+                this.$message.warning('请先选择发票抬头')
+                return
+            }
+            this.dialogVisible = true
+            this.dialogTitle = '编辑'
+            this.$nextTick(() => {
+                this.$refs.invoiceHeaderEdit.initData(headerId, false)
+            })
+        },
+        handleHeaderClose(refresh) {
+            this.dialogVisible = false
+            if (refresh) {
+                this.batchInvoiceData.forEach(item => {
+                    item.headerOptions = []
+                    this.headerRequest('listVoAll', { companyId: item.companyId }).then(res => {
+                        const data = res.data || []
+                        data.forEach(x => {
+                            if (x.invoiceName) {
+                                item.headerOptions.push(x)
+                            }
+                        })
+                        if (item.headerOptions.length && item.headerOptions.length === 1) {
+                            const obj = item.headerOptions[0]
+                            if (obj) {
+                                item.invoiceHeaderId = obj.id
+                                item.invoiceHeaderName = obj.invoiceName
+                                item.invoiceHeaderNumber = obj.invoiceNumber
+                                item.invoiceHeaderAddress = obj.address
+                                item.invoiceHeaderBank = obj.bank
+                                item.invoiceEmail = obj.email
+                                item.invoicePhone = obj.mobilePhone
+                            }
+                        }
+                    })
+                })
+            }
+        },
+        delRow(rowIndex) {
+            this.batchInvoiceData.splice(rowIndex, 1)
+        },
+        headerChange(val, index, row) {
+            if (val && (index === 0 || index)) {
+                const obj = this.batchInvoiceData[index].headerOptions.find(x => x.id === val)
+                if (obj) {
+                    this.batchInvoiceData[index].invoiceHeaderName = obj.invoiceName
+                    this.batchInvoiceData[index].invoiceHeaderNumber = obj.invoiceNumber
+                    this.batchInvoiceData[index].invoiceHeaderAddress = obj.address
+                    this.batchInvoiceData[index].invoiceHeaderBank = obj.bank
+                    // this.batchInvoiceData[index].invoiceHeaderBankNumber = obj.bankNumber
+                    // this.batchInvoiceData[index].invoiceHeaderPhone = obj.phone
+                    this.batchInvoiceData[index].invoiceEmail = obj.email
+                    this.batchInvoiceData[index].invoicePhone = obj.mobilePhone
+                    this.batchInvoiceData[index].invoiceType = obj.invoiceType
+                } else {
+                    this.batchInvoiceData[index].invoiceHeaderName = ''
+                    this.batchInvoiceData[index].invoiceHeaderNumber = ''
+                    this.batchInvoiceData[index].invoiceHeaderAddress = ''
+                    this.batchInvoiceData[index].invoiceHeaderBank = ''
+                    // this.batchInvoiceData[index].invoiceHeaderBankNumber = ''
+                    // this.batchInvoiceData[index].invoiceHeaderPhone = ''
+                    this.batchInvoiceData[index].invoiceEmail = ''
+                    this.batchInvoiceData[index].invoicePhone = ''
+                    this.batchInvoiceData[index].invoiceType = obj.invoiceType
+                }
+            }
+
+            const postData = Object.assign({}, row)
+            this.baseRequest('getContent', postData).then(res => {
+                this.batchInvoiceData[index].remark = res.data
+                this.$forceUpdate()
+            })
+        },
+        getBankOptions() {
+            this.bankRequest('listAll', {}).then(res => {
+                this.bankOptions = res.data || []
+            })
+        },
+        bankChange(val, index) {
+        },
+        batchBankChange() {
+            this.batchInvoiceData.forEach(item => {
+                item.invoiceSellerBank = this.batchInvoiceSellerBank
+            })
+        },
+        batchTaxChange() {
+            this.batchInvoiceData.forEach(item => {
+                item.invoiceTax = this.batchInvoiceTax
+            })
+        },
+        batchTypeChange() {
+            this.batchInvoiceData.forEach(item => {
+                item.invoiceType = this.batchInvoiceType
+            })
+        },
+        confirmSubmit() {
+            if (!this.batchInvoiceData.length) {
+                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.loading = false
+                    if (res.data.key === 200) {
+                        this.$message.success('提交成功')
+                        if (returnList.length) {
+                            this.batchInvoiceData = returnList
+                        } else {
+                            this.$emit('editClose', true)
+                        }
+                    } else if (res.data.key === 504) {
+                        this.$message.error(res.data.msg)
+                        this.$emit('editClose', true)
+                    } else {
+                        this.$message.error(res.data.msg)
+                    }
+                })
+            }).catch(() => {
+            })
+        },
+        handleClose() {
+            this.$emit('editClose')
+        },
+        checkRow({ row, rowIndex }) {
+            if (!row.invoiceEmail || !row.invoicePhone || !row.invoiceHeaderId || !row.invoiceContent ||
+              !row.invoiceType || !row.invoiceSellerBank || !row.invoiceTax) {
+                return {
+                    backgroundColor: '#FFF3F3',
+                    color: 'black',
+                    fontSize: '16px'
+                }
+            }
+        },
+        bankRequest(opUrl, postData) {
+            return this.$channel.globeRequest('InvoiceBankController', opUrl, postData, 'project')
+        },
+        mnpCompanyRequest(opUrl, postData) {
+            return this.$channel.globeRequest('MnpCompanyController', opUrl, postData, 'project')
+        },
+        headerRequest(opUrl, postData) {
+            return this.$channel.globeRequest('InvoiceHeaderController', opUrl, postData, 'project')
+        },
+        baseRequest(opUrl, postData) {
+            return this.$channel.globeRequest('InvoiceManageController', opUrl, postData, 'project')
+        }
+    }
+}
+</script>
+
+<style scoped>
+.my-select {
+  width: 25vw;
+  display: inline-block;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+  .ch-input .el-input__inner {
+      border-color: #32323A;
+  }
+  .ch-input-size {
+      width: 150px;
+  }
+  .ch-button {
+      border-color: #32323A;
+      background-color: #32323A;
+      color: #fff;
+  }
+  .ch-button-warning {
+      margin-left: 10px;
+      border-color: #E6A23C;
+      background-color: #E6A23C;
+      color: #fff;
+  }
+  .ch-button-export {
+      margin-left: 10px;
+      border-color: #98CC1F;
+      background-color: #98CC1F;
+      color: #fff;
+  }
+  /deep/.el-dialog__header {
+      padding: 10px 20px;
+  }
+  /deep/.el-dialog__body {
+      padding: 10px 20px;
+  }
+</style>

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

@@ -168,7 +168,9 @@ export default {
             this.baseRequest('getById', postData).then(res => {
                 if (res.data) {
                     this.form = res.data
-                    this.getBankTaxRateByFloor()
+                    if (res.data.sendStatus == '0') {
+                        this.getBankTaxRateByFloor()
+                    }
                 }
             }).catch(err => {
                 this.$message.error(err)

+ 31 - 13
src/views/invoice/formalInvoiceManage.vue

@@ -99,7 +99,7 @@
         <el-button size="small" class="ch-button-warning" @click="handleReset()"><i class="el-icon-refresh" />&nbsp;重置</el-button>
         <el-button size="small" class="ch-button" @click="handleSearch()"><i class="el-icon-search" />&nbsp;查询</el-button>
         <el-button size="small" class="ch-button-export" @click="batchInvoice()">批量开票</el-button>
-<!--        <el-button size="small" type="danger" @click="handleBatchBadDebt()">红冲</el-button>-->
+        <!--        <el-button size="small" type="danger" @click="handleBatchBadDebt()">红冲</el-button>-->
         <el-button size="small" class="ch-button-export" :loading="excelFlag" @click="handleExportAll()">导出</el-button>
       </el-col>
     </el-row>
@@ -189,17 +189,34 @@
       <formal-invoice-manage-edit v-if="dialogVisible" ref="editInvoice" @cancel="cancel" />
     </el-dialog>
 
+    <!-- 批量开票 -->
+    <el-dialog
+      :title="dialogBatchTitle"
+      :visible.sync="dialogBatchVisible"
+      width="75%"
+      top="50px"
+      :close-on-press-escape="false"
+      :close-on-click-modal="false"
+      class="statistic_base"
+      :append-to-body="true"
+      :modal-append-to-body="true"
+      custom-class="tagdialog"
+      @close="handleBatchClose"
+    >
+      <batch-invoice v-if="dialogBatchVisible" ref="batchInvoice" @editClose="handleBatchClose" />
+    </el-dialog>
+
   </div>
 </template>
 <script>
 import Base from '@/views/base/base'
 import BaseData from '@/views/base/baseData'
 import FormalInvoiceManageEdit from '@/views/invoice/components/formalInvoiceManageEdit.vue'
-import constant from '@/static/utils/constant'
+import BatchInvoice from '@/views/invoice/components/batchInvoice.vue'
 
 export default {
     name: 'FormalInvoiceManage',
-    components: { FormalInvoiceManageEdit },
+    components: { FormalInvoiceManageEdit,BatchInvoice },
     mixins: [Base, BaseData],
     data() {
         return {
@@ -212,18 +229,14 @@ export default {
             // 弹框相关
             dialogVisible: false,
             dialogTitle: '新增',
-            sendStatusOption: [],
-            invoiceStatusOption: [],
             selected: [],
-            excelFlag: false
+            excelFlag: false,
+            dialogBatchVisible: false,
+            dialogBatchTitle: ''
         }
     },
     mounted() {
         this.initDict(this.dc_key).then((res) => {
-            console.log('dc_data.INVOICE_STATUS', this.dc_data.INVOICE_STATUS)
-            console.log('dc_data.SEND_STATUS', this.dc_data.SEND_STATUS)
-            // this.sendStatusOption = this.dc_data.SEND_STATUS
-            // this.invoiceStatusOption = this.dc_data.INVOICE_STATUS
             this.getData()
         })
     },
@@ -300,18 +313,17 @@ export default {
             }
             let check = true
             this.selected.forEach(item => {
-                if (item.invoiceStatus !== '0' && item.invoiceStatus !== '2') {
+                if (item.sendStatus !== '0') {
                     check = false
                 }
             })
             if (!check) {
-                this.$message.warning('仅可对待开票和已发票作废的账单进行批量开票')
+                this.$message.warning('仅可对待推送的数据进行批量开票')
                 return
             }
             this.dialogBatchVisible = true
             this.dialogBatchTitle = '批量开票'
             this.$nextTick(() => {
-                // this.$refs.batchInvoice.initData(JSON.stringify(this.selected))
                 this.$refs.batchInvoice.initData(this.selected)
             })
         },
@@ -324,6 +336,12 @@ export default {
         cancel: function() {
             this.dialogVisible = false
         },
+        handleBatchClose(refresh) {
+            this.dialogBatchVisible = false
+            if (refresh) {
+                this.getData()
+            }
+        },
         baseRequest(opUrl, postData) {
             return this.$channel.globeRequest('InvoiceManageController', opUrl, postData, 'project')
         }

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

@@ -207,16 +207,10 @@ export default {
             // 弹框相关
             dialogVisible: false,
             dialogTitle: '新增',
-            sendStatusOption: [],
-            invoiceStatusOption: []
         }
     },
     mounted() {
         this.initDict(this.dc_key).then((res) => {
-            console.log('dc_data.INVOICE_STATUS', this.dc_data.INVOICE_STATUS)
-            console.log('dc_data.SEND_STATUS', this.dc_data.SEND_STATUS)
-            // this.sendStatusOption = this.dc_data.SEND_STATUS
-            // this.invoiceStatusOption = this.dc_data.INVOICE_STATUS
             this.getData()
         })
     },