【修改】到账开票批量开票 修改
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-row>
|
||||
@@ -43,11 +43,11 @@
|
||||
<a-col :xl="12" :sm="24" v-if="isFinancial">
|
||||
<a-form-item label="邮寄联系人" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<select-contacts
|
||||
placeholder="请选择邮寄联系人"
|
||||
v-decorator="['contactId',validatorRules.contactId]"
|
||||
v-bind="$attrs"
|
||||
:maxLength='50'
|
||||
@change="postContactChange"></select-contacts>
|
||||
placeholder="请选择邮寄联系人"
|
||||
v-decorator="['contactId',validatorRules.contactId]"
|
||||
v-bind="$attrs"
|
||||
:maxLength='50'
|
||||
@change="postContactChange"></select-contacts>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -73,13 +73,13 @@
|
||||
</a-form>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
class="j-table-force-nowrap">
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
class="j-table-force-nowrap">
|
||||
<template slot="text" slot-scope="text">
|
||||
<j-ellipsis :value="text" :length="18"></j-ellipsis>
|
||||
</template>
|
||||
@@ -92,6 +92,11 @@
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
|
||||
</template>
|
||||
|
||||
<!-- 税率-->
|
||||
<template slot="tax-rate" slot-scope="text,record">
|
||||
<j-dict-select-tag style="width: 100%" @input="changeRate(record)" placeholder="请选择税率" dict-code="rate" v-model="record.taxRate"></j-dict-select-tag>
|
||||
</template>
|
||||
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
@@ -99,16 +104,16 @@
|
||||
|
||||
<script>
|
||||
import JDate from '../../../components/tools/JDate'
|
||||
import { money } from '../../../utils/validate'
|
||||
import { addZero } from '../../../utils/util'
|
||||
import { addPayBill } from '../../../api/incomePaymentsApi'
|
||||
import {money} from '../../../utils/validate'
|
||||
import {addZero} from '../../../utils/util'
|
||||
import {addPayBill} from '../../../api/incomePaymentsApi'
|
||||
import SelectContacts from '../../../components/company/SelectContacts'
|
||||
import { getContactsById } from '../../../api/api'
|
||||
import {getContactsById} from '../../../api/api'
|
||||
import pick from 'lodash.pick'
|
||||
|
||||
export default {
|
||||
name: 'BatchInvoicingModule',
|
||||
components: { JDate, SelectContacts },
|
||||
components: {JDate, SelectContacts},
|
||||
props: {
|
||||
// 选中的项目信息
|
||||
selectedData: {
|
||||
@@ -151,24 +156,24 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
title: '批量开票',
|
||||
width: 1000,
|
||||
width: 1200,
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 6 }
|
||||
xs: {span: 24},
|
||||
sm: {span: 6}
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
xs: {span: 24},
|
||||
sm: {span: 18}
|
||||
},
|
||||
remarksLabelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 3 }
|
||||
xs: {span: 24},
|
||||
sm: {span: 3}
|
||||
},
|
||||
remarksWrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 21 }
|
||||
xs: {span: 24},
|
||||
sm: {span: 21}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
@@ -184,55 +189,77 @@ export default {
|
||||
title: '打包项目名称',
|
||||
align: 'center',
|
||||
dataIndex: 'chargeProject',
|
||||
scopedSlots: { customRender: 'text' }
|
||||
scopedSlots: {customRender: 'text'}
|
||||
}, {
|
||||
title: '应收金额',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dataIndex: 'receivableAmount'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
title: '已开票金额',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dataIndex: 'invoiceAmount'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
title: '本次开票金额',
|
||||
align: 'center',
|
||||
width: 140,
|
||||
dataIndex: 'thisInvoicingAmount'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
title: '税率',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
dataIndex: 'taxRate',
|
||||
scopedSlots: {customRender: 'tax-rate'}
|
||||
},
|
||||
{
|
||||
title: '税额',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dataIndex: 'tax',
|
||||
},
|
||||
{
|
||||
title: '未税额',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dataIndex: 'noTaxAmount',
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
align: 'center',
|
||||
width: 200,
|
||||
dataIndex: 'remark',
|
||||
scopedSlots: { customRender: 'input-text' }
|
||||
scopedSlots: {customRender: 'input-text'}
|
||||
}
|
||||
],
|
||||
dataSource: [],
|
||||
remarkList: [], // 备注列表
|
||||
validatorRules: {
|
||||
invoiceAmount: {
|
||||
rules: [{ required: true, validator: this.checkMoney }],
|
||||
rules: [{required: true, validator: this.checkMoney}],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
billNo: {
|
||||
rules: [{ required: true, message: '请输入开票号' }],
|
||||
rules: [{required: true, message: '请输入开票号'}],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
billDate: {
|
||||
rules: [{ required: true, message: '请选择开票时间' }],
|
||||
rules: [{required: true, message: '请选择开票时间'}],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
contactId: {
|
||||
rules: [{ required: true, message: '请选择邮寄联系人' }],
|
||||
rules: [{required: true, message: '请选择邮寄联系人'}],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
postalCode: {
|
||||
rules: [{ required: true, message: '请输入邮政编码' }],
|
||||
rules: [{required: true, message: '请输入邮政编码'}],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
contactAddress: {
|
||||
rules: [{ required: true, message: '请输入通讯地址' }],
|
||||
rules: [{required: true, message: '请输入通讯地址'}],
|
||||
validateTrigger: 'blur'
|
||||
}
|
||||
},
|
||||
@@ -246,6 +273,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
addZero,
|
||||
/**
|
||||
* 计算本项目开票金额的税额与未税额
|
||||
* */
|
||||
changeRate(record){
|
||||
// 获取本次开票金额 税率
|
||||
let {thisInvoicingAmount,taxRate} = record
|
||||
// 计算本次开票金额的 税额与未税额
|
||||
if(!thisInvoicingAmount) return
|
||||
record.noTaxAmount = (thisInvoicingAmount / (1 + taxRate * 1)).toFixed(2)
|
||||
record.tax = (thisInvoicingAmount - record.noTaxAmount).toFixed(2)
|
||||
},
|
||||
/**
|
||||
* 获取补0的数据
|
||||
* @param value
|
||||
@@ -266,8 +304,13 @@ export default {
|
||||
let amountOwed = Number(item.receivableAmount) - Number(item.invoiceAmount)
|
||||
item.amountOwed = this.getAddZero(amountOwed)
|
||||
item.thisInvoicingAmount = 0
|
||||
// 清空上一次的税额 未税额
|
||||
item.tax = ''
|
||||
item.noTaxAmount = ''
|
||||
this.sumAmountOwed += Number(item.amountOwed)
|
||||
this.sumInvoiceAmount += Number(item.invoiceAmount)
|
||||
// 设置默认税率 0.06
|
||||
item.taxRate = '0.06'
|
||||
})
|
||||
this.$forceUpdate()
|
||||
},
|
||||
@@ -289,7 +332,7 @@ export default {
|
||||
console.log(value)
|
||||
// value不为undefined
|
||||
if (value) {
|
||||
getContactsById({ id: value }).then(res => {
|
||||
getContactsById({id: value}).then(res => {
|
||||
let obj = {
|
||||
postalCode: res.result.postalCode,
|
||||
contactAddress: res.result.contactAddress
|
||||
@@ -323,6 +366,7 @@ export default {
|
||||
* 计算此次开票信息
|
||||
*/
|
||||
calculateThisTimeAmount() {
|
||||
console.log(123)
|
||||
// if (this.inputInvoicingAmount === null) {
|
||||
// this.$message.warn('开票金额不得为0')
|
||||
// return
|
||||
@@ -386,7 +430,12 @@ export default {
|
||||
}
|
||||
this.$set(this.dataSource, i, item)
|
||||
}
|
||||
|
||||
}
|
||||
// 计算税额 与未税额
|
||||
this.dataSource.forEach(m => {
|
||||
this.changeRate(m)
|
||||
})
|
||||
// this.dataSource.forEach((item, index) => {
|
||||
// // 当前项目欠款是否 >0
|
||||
// if (Number(item.amountOwed) > 0 && Number(item.amountOwed) !== Number(item.invoiceAmount)) {
|
||||
@@ -432,6 +481,9 @@ export default {
|
||||
invoiceAmount: item.thisInvoicingAmount,
|
||||
projectId: item.id,
|
||||
projectType: item.projectType,
|
||||
tax:item.tax,
|
||||
taxRate:item.taxRate,
|
||||
noTaxAmount:item.noTaxAmount,
|
||||
remark: this.remarkList[index]
|
||||
}
|
||||
bmpList.push(obj)
|
||||
@@ -463,7 +515,7 @@ export default {
|
||||
this.close()
|
||||
},
|
||||
open() {
|
||||
this.dataSource = this.selectedData
|
||||
this.dataSource = [...this.selectedData]
|
||||
this.dataSource.forEach(() => {
|
||||
this.remarkList.push('')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user