|
@@ -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>
|