|
|
@@ -44,44 +44,53 @@
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
<el-option v-for="item in sourceTypeOp" :label="item.label" :value="item.value" :key="item.value"></el-option>
|
|
|
- <el-option label="对账单" :value="1"></el-option>
|
|
|
+ <!-- <el-option label="对账单" :value="1"></el-option>
|
|
|
<el-option label="合同" :value="2"></el-option>
|
|
|
- <el-option label="订单" :value="3"></el-option>
|
|
|
+ <el-option label="订单" :value="3"></el-option> -->
|
|
|
<!-- <el-option label="收款计划" :value="1"></el-option> -->
|
|
|
- <el-option
|
|
|
+ <!-- <el-option
|
|
|
label="已收"
|
|
|
- :value="8"
|
|
|
+ :value="5"
|
|
|
v-if="form.type == 1"
|
|
|
></el-option>
|
|
|
<el-option
|
|
|
label="已付"
|
|
|
- :value="9"
|
|
|
+ :value="4"
|
|
|
v-if="form.type == 2"
|
|
|
></el-option>
|
|
|
- <el-option label="其他无订单无合同" :value="10"></el-option>
|
|
|
+ <el-option label="其他无订单无合同" :value="99"></el-option> -->
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="form.sourceType == 6">
|
|
|
- <el-form-item label="收款计划编码" prop="sourceCode">
|
|
|
+ <el-col :span="8" v-if="form.sourceType == 1">
|
|
|
+ <el-form-item label="对账单" prop="sourceCode">
|
|
|
+ <el-input
|
|
|
+ v-model="form.sourceCode"
|
|
|
+ readonly
|
|
|
+ @click.native="handleSelectAccount(1)"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="form.sourceType == 2">
|
|
|
+ <el-form-item label="合同" prop="sourceCode">
|
|
|
<el-input
|
|
|
v-model="form.sourceCode"
|
|
|
readonly
|
|
|
- @click.native="handleSelectAccount(6)"
|
|
|
+ @click.native="handleSelectAccount(2)"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="form.sourceType == 7">
|
|
|
- <el-form-item label="付款计划编码" prop="sourceCode">
|
|
|
+ <el-col :span="8" v-if="form.sourceType == 3">
|
|
|
+ <el-form-item label="订单" prop="sourceCode">
|
|
|
<el-input
|
|
|
v-model="form.sourceCode"
|
|
|
readonly
|
|
|
- @click.native="handleSelectAccount(7)"
|
|
|
+ @click.native="handleSelectAccount(3)"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" v-if="form.sourceType == 5">
|
|
|
- <el-form-item label="应收编码" prop="sourceCode">
|
|
|
+ <el-form-item label="已收" prop="sourceCode">
|
|
|
<el-input
|
|
|
v-model="form.sourceCode"
|
|
|
readonly
|
|
|
@@ -90,7 +99,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" v-if="form.sourceType == 4">
|
|
|
- <el-form-item label="应付编码" prop="sourceCode">
|
|
|
+ <el-form-item label="已付" prop="sourceCode">
|
|
|
<el-input
|
|
|
v-model="form.sourceCode"
|
|
|
readonly
|
|
|
@@ -277,13 +286,13 @@
|
|
|
</el-row>
|
|
|
|
|
|
<div class="payinfo" style="margin-top: 20px;">
|
|
|
- <headerTitle :title="form.type == 2 ? '付款计划信息' : '收款计划信息'"></headerTitle>
|
|
|
+ <headerTitle title="来源清单"></headerTitle>
|
|
|
<!-- <el-form ref="form" :model="tableForm"> -->
|
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
|
:needPage="false"
|
|
|
:columns="columns"
|
|
|
- :datasource="form.receiptPayments"
|
|
|
+ :datasource="form.relatedList"
|
|
|
row-key="id"
|
|
|
class="time-form"
|
|
|
>
|
|
|
@@ -294,7 +303,7 @@
|
|
|
<el-form-item
|
|
|
style="width: 100%;"
|
|
|
label-width="0"
|
|
|
- :prop="'receiptPayments.' + scope.$index + '.planPaymentAmount'"
|
|
|
+ :prop="'relatedList.' + scope.$index + '.planPaymentAmount'"
|
|
|
:rules="[
|
|
|
{
|
|
|
required: false,
|
|
|
@@ -311,7 +320,7 @@
|
|
|
<el-form-item
|
|
|
style="width: 100%;"
|
|
|
label-width="0"
|
|
|
- :prop="'receiptPayments.' + scope.$index + '.invoiceAmount'"
|
|
|
+ :prop="'relatedList.' + scope.$index + '.invoiceAmount'"
|
|
|
:rules="[
|
|
|
{
|
|
|
required: false,
|
|
|
@@ -378,6 +387,7 @@
|
|
|
@getAccountData="getAccountData"
|
|
|
:contactData="contactData"
|
|
|
:type="form.type"
|
|
|
+ :multiple="true"
|
|
|
>
|
|
|
</account-statement-dialog>
|
|
|
<!--采购订单-->
|
|
|
@@ -387,6 +397,7 @@
|
|
|
></purchasinOrderListDialog>
|
|
|
<!--销售订单-->
|
|
|
<saleOrderListDialog
|
|
|
+ :isAll="true"
|
|
|
ref="saleOrderListDialogref"
|
|
|
@changeParent="changeOrder"
|
|
|
></saleOrderListDialog>
|
|
|
@@ -395,6 +406,7 @@
|
|
|
ref="selectContractRef"
|
|
|
@changeParent="changeContract"
|
|
|
:type="form.type"
|
|
|
+ :multiple="true"
|
|
|
></contractListDialog>
|
|
|
<!-- 应收 -->
|
|
|
<receivableDialog
|
|
|
@@ -432,7 +444,8 @@
|
|
|
import {
|
|
|
invoiceApplyInfoV2API,
|
|
|
invoiceApplyCreateAPI,
|
|
|
- invoiceApplyUpdateV2API
|
|
|
+ invoiceApplyUpdateV2API,
|
|
|
+ initInvoiceByStatementId
|
|
|
} from '@/api/financialManage/invoiceManage';
|
|
|
import { getpurchaseorderDetail } from '@/api/purchasingManage/purchaseOrder';
|
|
|
import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
|
|
|
@@ -452,6 +465,7 @@
|
|
|
import { updateContractStatus } from '@/api/contractManage/contractBook';
|
|
|
import { getMergeInvoiceInfoAPI } from '@/api/financialManage/payAndCollectPlan';
|
|
|
import { paymentTypeOp } from '@/enum/dict';
|
|
|
+
|
|
|
|
|
|
const defForm = {
|
|
|
accountingSubjectCode: '',
|
|
|
@@ -488,7 +502,7 @@
|
|
|
salesCompanyBankBranchNo: '',
|
|
|
salesCompanyBankAccount: '',
|
|
|
category: 1,
|
|
|
- receiptPayments: [],
|
|
|
+ relatedList: [],
|
|
|
productMap: {}
|
|
|
};
|
|
|
export default {
|
|
|
@@ -531,118 +545,101 @@
|
|
|
computed: {
|
|
|
...mapGetters(['user']),
|
|
|
sourceTypeOp() {
|
|
|
- return this.form.type == 1 ? [{
|
|
|
- label: '收款计划',
|
|
|
- value: 6
|
|
|
- }, {
|
|
|
- label: '应收管理',
|
|
|
- value: 5
|
|
|
- }] : [{
|
|
|
- label: '付款计划',
|
|
|
- value: 7
|
|
|
- }, {
|
|
|
- label: '应付管理',
|
|
|
- value: 4
|
|
|
- }]
|
|
|
- },
|
|
|
- columns() {
|
|
|
- return [
|
|
|
+ return this.form.type == 1 ? [
|
|
|
{
|
|
|
- width: 45,
|
|
|
- type: 'index',
|
|
|
- columnKey: 'index',
|
|
|
- align: 'center',
|
|
|
- fixed: 'left'
|
|
|
+ label: '对账单',
|
|
|
+ value: 1
|
|
|
},
|
|
|
{
|
|
|
- width: 150,
|
|
|
- prop: 'sourceOrderDetailNo',
|
|
|
- label: this.form.type == 1 ? '收款计划编码' : '付款计划编码',
|
|
|
- align: 'center'
|
|
|
+ label: '合同',
|
|
|
+ value: 2
|
|
|
},
|
|
|
{
|
|
|
- width: 150,
|
|
|
- prop: 'relatedOrderNo',
|
|
|
- label: '订单编号',
|
|
|
- align: 'center'
|
|
|
+ label: '订单',
|
|
|
+ value: 3
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
- prop: 'relatedOrderType',
|
|
|
- label: '订单类型',
|
|
|
- align: 'center',
|
|
|
- formatter: (row) => {
|
|
|
- return row.relatedOrderType == 1 ? '销售订单' : '采购订单'
|
|
|
- }
|
|
|
+ label: '已收',
|
|
|
+ value: 5
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
- prop: 'contractNo',
|
|
|
- label: '合同编码',
|
|
|
- align: 'center'
|
|
|
+ label: '其他无订单无合同',
|
|
|
+ value: 99
|
|
|
+ }
|
|
|
+ ] : [
|
|
|
+ {
|
|
|
+ label: '对账单',
|
|
|
+ value: 1
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
- prop: 'contractCode',
|
|
|
- label: '合同编号',
|
|
|
- align: 'center'
|
|
|
+ label: '合同',
|
|
|
+ value: 2
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
- prop: 'contractName',
|
|
|
- label: '合同名称',
|
|
|
- align: 'center'
|
|
|
+ label: '订单',
|
|
|
+ value: 3
|
|
|
},
|
|
|
{
|
|
|
- prop: 'issueNumber',
|
|
|
- label: '期数',
|
|
|
- align: 'center'
|
|
|
+ label: '已付',
|
|
|
+ value: 4
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
- prop: 'paymentType',
|
|
|
- label: '款项类型',
|
|
|
+ label: '其他无订单无合同',
|
|
|
+ value: 99
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ columns() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'index',
|
|
|
+ columnKey: 'index',
|
|
|
align: 'center',
|
|
|
- formatter: (row) => {
|
|
|
- return this.paymentTypeOp.find(item => item.value == row.paymentType)?.label || ''
|
|
|
- }
|
|
|
+ fixed: 'left'
|
|
|
},
|
|
|
{
|
|
|
- prop: 'moneyName',
|
|
|
- label: '款项名称',
|
|
|
- align: 'center',
|
|
|
- width: 170
|
|
|
+ minWidth: 150,
|
|
|
+ prop: 'sourceCode',
|
|
|
+ label: '来源编码',
|
|
|
+ align: 'center'
|
|
|
},
|
|
|
+ // {
|
|
|
+ // width: 150,
|
|
|
+ // prop: 'relatedOrderNo',
|
|
|
+ // label: '来源编号',
|
|
|
+ // align: 'center'
|
|
|
+ // },
|
|
|
{
|
|
|
- width: 150,
|
|
|
- prop: 'paymentRatio',
|
|
|
- label: '比例',
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'sourceType',
|
|
|
+ label: '来源类型',
|
|
|
align: 'center',
|
|
|
formatter: (row) => {
|
|
|
- return row.paymentRatio ? row.paymentRatio + '%' : ''
|
|
|
+ return this.sourceTypeList.find(item => item.value == row.sourceType)?.label || ''
|
|
|
}
|
|
|
},
|
|
|
+ // {
|
|
|
+ // width: 170,
|
|
|
+ // prop: 'planPaymentAmount',
|
|
|
+ // label: this.form.type == 1 ? '计划收款金额' : '计划付款金额',
|
|
|
+ // align: 'center',
|
|
|
+ // slot: 'planPaymentAmount'
|
|
|
+ // },
|
|
|
{
|
|
|
- width: 170,
|
|
|
- prop: 'planPaymentAmount',
|
|
|
- label: this.form.type == 1 ? '计划收款金额' : '计划付款金额',
|
|
|
- align: 'center',
|
|
|
- slot: 'planPaymentAmount'
|
|
|
- },
|
|
|
- {
|
|
|
- width: 150,
|
|
|
+ minWidth: 150,
|
|
|
prop: 'unInvoiceAmount',
|
|
|
label: '未开票金额',
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- width: 150,
|
|
|
+ minWidth: 150,
|
|
|
prop: 'invoicedAmount',
|
|
|
label: '已开票金额',
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- width: 160,
|
|
|
+ minWidth: 160,
|
|
|
prop: 'invoiceAmount',
|
|
|
label: '本次开票金额',
|
|
|
align: 'center',
|
|
|
@@ -654,6 +651,34 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 1-对账单,2-合同,3-订单,4-应付,5-应收,99-其他无订单无合同
|
|
|
+ sourceTypeList: [
|
|
|
+ {
|
|
|
+ label: '对账单',
|
|
|
+ value: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '合同',
|
|
|
+ value: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '订单',
|
|
|
+ value: 3
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '已付',
|
|
|
+ value: 4
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '已收',
|
|
|
+ value: 5
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '其他无订单无合同',
|
|
|
+ value: 99
|
|
|
+ }
|
|
|
+ ],
|
|
|
+
|
|
|
businessId: '',
|
|
|
paymentTypeOp,
|
|
|
fullscreen: false,
|
|
|
@@ -664,6 +689,7 @@
|
|
|
processSubmitDialogFlag: false,
|
|
|
collectionPlanDialogFlag: false,
|
|
|
paymentListDialogFlag: false,
|
|
|
+ accountStatementDialogFlag: false,
|
|
|
enterprisePage: [],
|
|
|
totalInvoiceAmount: 0,
|
|
|
form: {
|
|
|
@@ -728,16 +754,19 @@
|
|
|
},
|
|
|
updateInvoiceAmount(row) {
|
|
|
// row.invoiceAmount = Number(row.invoiceAmount).toFixed(2);
|
|
|
- this.form.amount = this.form.receiptPayments.reduce((pre, cur) => {
|
|
|
+ this.form.amount = this.form.relatedList.reduce((pre, cur) => {
|
|
|
return pre + Number(cur.invoiceAmount);
|
|
|
}, 0);
|
|
|
- // this.$refs.tableInfoRef.setSinglePrice(row, this.form.receiptPayments);
|
|
|
+ // this.$refs.tableInfoRef.setSinglePrice(row, this.form.relatedList);
|
|
|
},
|
|
|
//来源类型
|
|
|
async handleSelectAccount(val) {
|
|
|
if (val == 6 || val == 7) {
|
|
|
this.collectionPlanDialogFlag = true;
|
|
|
}
|
|
|
+ if (val == 1) {
|
|
|
+ this.accountStatementDialogFlag = true;
|
|
|
+ }
|
|
|
if (val == 2) {
|
|
|
this.$refs.selectContractRef.open({}, 1, 1);
|
|
|
}
|
|
|
@@ -756,37 +785,42 @@
|
|
|
},
|
|
|
//合同回调
|
|
|
async changeContract(data) {
|
|
|
- const res = await getDetail(data.id);
|
|
|
- this.$set(this.form, 'sourceId', data.id);
|
|
|
- this.$set(this.form, 'sourceCode', data.contractNo);
|
|
|
- this.$set(
|
|
|
- this.form,
|
|
|
- 'amount',
|
|
|
- res.contractVO?.discountTotalPrice - res.contractVO?.invoiceAmount
|
|
|
- );
|
|
|
- this.$set(this.form, 'invoiceAmount', res.contractVO?.invoiceAmount);
|
|
|
- this.getContactDetail(
|
|
|
- this.form.type == 2
|
|
|
- ? res.contractVO?.partbId
|
|
|
- : res.contractVO?.partaId,
|
|
|
- res.contractVO
|
|
|
- );
|
|
|
+ console.log('changeOrder~~~', data);
|
|
|
+ const tempIds = data.map((item) => item.id);
|
|
|
+ const tempNames = data.map((item) => item.contractNo);
|
|
|
+ this.getPlanData(tempIds, tempNames);
|
|
|
+ // const res = await getDetail(data.id);
|
|
|
+ // this.$set(this.form, 'sourceId', data.id);
|
|
|
+ // this.$set(this.form, 'sourceCode', data.contractNo);
|
|
|
+ // this.$set(
|
|
|
+ // this.form,
|
|
|
+ // 'amount',
|
|
|
+ // res.contractVO?.discountTotalPrice - res.contractVO?.invoiceAmount
|
|
|
+ // );
|
|
|
+ // this.$set(this.form, 'invoiceAmount', res.contractVO?.invoiceAmount);
|
|
|
+ // this.getContactDetail(
|
|
|
+ // this.form.type == 2
|
|
|
+ // ? res.contractVO?.partbId
|
|
|
+ // : res.contractVO?.partaId,
|
|
|
+ // res.contractVO
|
|
|
+ // );
|
|
|
+
|
|
|
+ // res.productList.forEach((item) => {
|
|
|
+ // item.singlePrice =
|
|
|
+ // (item.discountSinglePrice &&
|
|
|
+ // Number(item.discountSinglePrice).toFixed(2)) ||
|
|
|
+ // item.singlePrice;
|
|
|
+ // item.totalPrice =
|
|
|
+ // (item.discountTotalPrice &&
|
|
|
+ // Number(item.discountTotalPrice).toFixed(2)) ||
|
|
|
+ // item.totalPrice;
|
|
|
+ // item.typeName = this.form.type == 1 ? '销售合同' : '采购合同';
|
|
|
+ // item.type = this.form.type == 1 ? '101' : '102';
|
|
|
+ // });
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs.table.setValue(res.productList);
|
|
|
+ // });
|
|
|
|
|
|
- res.productList.forEach((item) => {
|
|
|
- item.singlePrice =
|
|
|
- (item.discountSinglePrice &&
|
|
|
- Number(item.discountSinglePrice).toFixed(2)) ||
|
|
|
- item.singlePrice;
|
|
|
- item.totalPrice =
|
|
|
- (item.discountTotalPrice &&
|
|
|
- Number(item.discountTotalPrice).toFixed(2)) ||
|
|
|
- item.totalPrice;
|
|
|
- item.typeName = this.form.type == 1 ? '销售合同' : '采购合同';
|
|
|
- item.type = this.form.type == 1 ? '101' : '102';
|
|
|
- });
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.table.setValue(res.productList);
|
|
|
- });
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
async getContactDetail(id, data) {
|
|
|
@@ -846,38 +880,42 @@
|
|
|
},
|
|
|
//订单回调
|
|
|
async changeOrder(data) {
|
|
|
- this.$set(this.form, 'sourceId', data.id);
|
|
|
- this.$set(this.form, 'sourceCode', data.orderNo);
|
|
|
- let res = {};
|
|
|
- if (this.form.type == 2) {
|
|
|
- res = await getpurchaseorderDetail(data.id);
|
|
|
- } else {
|
|
|
- res = await getSaleOrderDetail(data.id);
|
|
|
- }
|
|
|
- this.$set(this.form, 'amount', res.payAmount - res.invoiceAmount);
|
|
|
- this.$set(this.form, 'invoiceAmount', res.invoiceAmount);
|
|
|
- this.getContactDetail(
|
|
|
- this.form.type == 2 ? res.partbId : res.partaId,
|
|
|
- res
|
|
|
- );
|
|
|
- res.productList.forEach((item) => {
|
|
|
- item.singlePrice =
|
|
|
- (item.discountSinglePrice &&
|
|
|
- Number(item.discountSinglePrice).toFixed(2)) ||
|
|
|
- item.singlePrice;
|
|
|
- item.totalPrice =
|
|
|
- (item.discountTotalPrice &&
|
|
|
- Number(item.discountTotalPrice).toFixed(2)) ||
|
|
|
- item.totalPrice;
|
|
|
- item.typeName = this.form.type == 1 ? '销售订单' : '采购订单';
|
|
|
- item.type = this.form.type == 1 ? '201' : '202';
|
|
|
- });
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.table.setValue(res.productList);
|
|
|
- });
|
|
|
- this.$forceUpdate();
|
|
|
+ console.log('changeOrder~~~', data);
|
|
|
+ const tempIds = data.map((item) => item.id);
|
|
|
+ const tempNames = data.map((item) => item.orderNo);
|
|
|
+ this.getPlanData(tempIds, tempNames);
|
|
|
+ // this.$set(this.form, 'sourceId', data.id);
|
|
|
+ // this.$set(this.form, 'sourceCode', data.orderNo);
|
|
|
+ // let res = {};
|
|
|
+ // if (this.form.type == 2) {
|
|
|
+ // res = await getpurchaseorderDetail(data.id);
|
|
|
+ // } else {
|
|
|
+ // res = await getSaleOrderDetail(data.id);
|
|
|
+ // }
|
|
|
+ // this.$set(this.form, 'amount', res.payAmount - res.invoiceAmount);
|
|
|
+ // this.$set(this.form, 'invoiceAmount', res.invoiceAmount);
|
|
|
+ // this.getContactDetail(
|
|
|
+ // this.form.type == 2 ? res.partbId : res.partaId,
|
|
|
+ // res
|
|
|
+ // );
|
|
|
+ // res.productList.forEach((item) => {
|
|
|
+ // item.singlePrice =
|
|
|
+ // (item.discountSinglePrice &&
|
|
|
+ // Number(item.discountSinglePrice).toFixed(2)) ||
|
|
|
+ // item.singlePrice;
|
|
|
+ // item.totalPrice =
|
|
|
+ // (item.discountTotalPrice &&
|
|
|
+ // Number(item.discountTotalPrice).toFixed(2)) ||
|
|
|
+ // item.totalPrice;
|
|
|
+ // item.typeName = this.form.type == 1 ? '销售订单' : '采购订单';
|
|
|
+ // item.type = this.form.type == 1 ? '201' : '202';
|
|
|
+ // });
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs.table.setValue(res.productList);
|
|
|
+ // });
|
|
|
+ // this.$forceUpdate();
|
|
|
|
|
|
- console.log(res);
|
|
|
+ // console.log(res);
|
|
|
},
|
|
|
|
|
|
//应收应付回调
|
|
|
@@ -901,28 +939,35 @@
|
|
|
this.getPlanData(data)
|
|
|
},
|
|
|
// 收/付款计划回调
|
|
|
- async getPlanData(data) {
|
|
|
- let tempIds = [];
|
|
|
- let tempNames = [];
|
|
|
- if(this.form.sourceType == 4 || this.form.sourceType == 5) {
|
|
|
- tempIds = data.map((item) => item.receiptPlanOrderId);
|
|
|
- tempNames = data.map((item) => item.code);
|
|
|
- } else {
|
|
|
- tempIds = data.map((item) => item.id);
|
|
|
- tempNames = data.map((item) => item.detailNo);
|
|
|
- }
|
|
|
+ async getPlanData(tempIds, tempNames) {
|
|
|
+ console.log('getPlanDatadata~~~', tempIds, tempNames);
|
|
|
+ // let tempIds = [];
|
|
|
+ // let tempNames = [];
|
|
|
+ // if(this.form.sourceType == 4 || this.form.sourceType == 5) {
|
|
|
+ // tempIds = data.map((item) => item.receiptPlanOrderId);
|
|
|
+ // tempNames = data.map((item) => item.code);
|
|
|
+ // } else {
|
|
|
+ // tempIds = data.map((item) => item.id);
|
|
|
+ // tempNames = data.map((item) => item.statementNo);
|
|
|
+ // }
|
|
|
|
|
|
this.form.sourceCode = tempNames.join(',');
|
|
|
|
|
|
- const res = await getMergeInvoiceInfoAPI(tempIds)
|
|
|
- res.receiptPayments = res.receiptPayments.map((item) => {
|
|
|
+ const res = await initInvoiceByStatementId(
|
|
|
+ {
|
|
|
+ sourceIds: tempIds,
|
|
|
+ sourceType: this.form.sourceType,
|
|
|
+ type: this.form.type
|
|
|
+ }
|
|
|
+ )
|
|
|
+ res.relatedList = res.relatedList.map((item) => {
|
|
|
item.invoiceAmount = item.unInvoiceAmount;
|
|
|
return item
|
|
|
})
|
|
|
-
|
|
|
- this.form.receiptPayments = res.receiptPayments;
|
|
|
+ this.form.sourceId = res.sourceId;
|
|
|
+ this.form.relatedList = res.relatedList;
|
|
|
this.form.productMap = res.productMap;
|
|
|
- const amount = this.form.receiptPayments.reduce((prev, cur) => prev +
|
|
|
+ const amount = this.form.relatedList.reduce((prev, cur) => prev +
|
|
|
+cur.invoiceAmount, 0) || 0;
|
|
|
this.form.amount = amount;
|
|
|
console.log('form~~~', this.form);
|
|
|
@@ -936,36 +981,45 @@
|
|
|
},
|
|
|
//对账单回调
|
|
|
async getAccountData(tableInfo) {
|
|
|
- let res = {};
|
|
|
- if (this.form.type == 2) {
|
|
|
- res = await getpurchaseorderDetail(tableInfo?.children?.orderId);
|
|
|
- } else {
|
|
|
- res = await getSaleOrderDetail(tableInfo?.children?.orderId);
|
|
|
- }
|
|
|
- this.getContactDetail(tableInfo.contactId, res);
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$set(this.form, 'sourceId', tableInfo?.children?.id);
|
|
|
- this.$set(this.form, 'sourceCode', tableInfo?.statementNo);
|
|
|
- this.$set(
|
|
|
- this.form,
|
|
|
- 'invoiceAmount',
|
|
|
- tableInfo?.children?.invoiceAmount
|
|
|
- );
|
|
|
+ // let res = {};
|
|
|
+ // if (this.form.type == 2) {
|
|
|
+ // res = await getpurchaseorderDetail(tableInfo?.children?.orderId);
|
|
|
+ // } else {
|
|
|
+ // res = await getSaleOrderDetail(tableInfo?.children?.orderId);
|
|
|
+ // }
|
|
|
+ // this.getContactDetail(tableInfo.contactId, res);
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$set(this.form, 'sourceId', tableInfo?.children?.id);
|
|
|
+ // this.$set(this.form, 'sourceCode', tableInfo?.statementNo);
|
|
|
+ // this.$set(
|
|
|
+ // this.form,
|
|
|
+ // 'invoiceAmount',
|
|
|
+ // tableInfo?.children?.invoiceAmount
|
|
|
+ // );
|
|
|
|
|
|
- this.$refs.table.getAccountData(tableInfo);
|
|
|
- });
|
|
|
+ // this.$refs.table.getAccountData(tableInfo);
|
|
|
+ // });
|
|
|
+ const tempIds = tableInfo.map((item) => item.id);
|
|
|
+ const tempNames = tableInfo.map((item) => item.statementNo);
|
|
|
+ this.getPlanData(tempIds, tempNames);
|
|
|
+ console.log(tableInfo);
|
|
|
+
|
|
|
+ // this.getPlanData(tableInfo)
|
|
|
},
|
|
|
//订单、合同列表
|
|
|
async createInvoice1(data, type, sourceType) {
|
|
|
console.log('createInvoice1~~~', data);
|
|
|
- // const tempIds = data.map((item) => item.id).join(',');
|
|
|
+
|
|
|
this.$set(this.form, 'type', type);
|
|
|
this.$set(this.form, 'sourceType', sourceType);
|
|
|
// this.$set(this.form, 'sourceCode', tempIds);
|
|
|
|
|
|
await this.init({}, 'add');
|
|
|
|
|
|
- this.getPlanData(data);
|
|
|
+ const tempIds = data.map((item) => item.id);
|
|
|
+ const tempNames = data.map((item) => item.statementNo);
|
|
|
+
|
|
|
+ this.getPlanData(tempIds, tempNames);
|
|
|
// if (sourceType == 2) {
|
|
|
// this.changeContract(data);
|
|
|
// }
|
|
|
@@ -1059,7 +1113,7 @@
|
|
|
if (val == 'isType') {
|
|
|
this.$set(this.form, 'sourceType', '');
|
|
|
}
|
|
|
- this.form.receiptPayments = [];
|
|
|
+ this.form.relatedList = [];
|
|
|
this.$refs.tableInfoRef.clearTable();
|
|
|
this.enterpriseChange(this.enterprisePage[0]?.name);
|
|
|
},
|
|
|
@@ -1088,7 +1142,7 @@
|
|
|
|
|
|
invoiceAmountChange(item, sum) {
|
|
|
console.log('item~~~', item, sum);
|
|
|
- const sameKeyItems = this.form.receiptPayments.filter((d) => d.relatedOrderNo === item.key)
|
|
|
+ const sameKeyItems = this.form.relatedList.filter((d) => d.sourceCode === item.key)
|
|
|
console.log('sameKeyItems~~~', sameKeyItems);
|
|
|
|
|
|
let remainingTotal = sum;
|
|
|
@@ -1117,10 +1171,10 @@
|
|
|
item.unInvoiceAmount = item.planPaymentAmount - item.invoicedAmount;
|
|
|
// 更新关联物品清单中的 defaultAmountTotalPrice
|
|
|
const tableInfoRef = this.$refs.tableInfoRef;
|
|
|
- if (tableInfoRef && item.relatedOrderNo) {
|
|
|
- const key = item.relatedOrderNo;
|
|
|
- const newTotal = this.form.receiptPayments
|
|
|
- .filter((d) => d.relatedOrderNo === key)
|
|
|
+ if (tableInfoRef && item.sourceCode) {
|
|
|
+ const key = item.sourceCode;
|
|
|
+ const newTotal = this.form.relatedList
|
|
|
+ .filter((d) => d.sourceCode === key)
|
|
|
.reduce((sum, d) => sum + (parseFloat(d.unInvoiceAmount) || 0), 0);
|
|
|
tableInfoRef.tableForm.detailList.forEach((detail) => {
|
|
|
if (detail.key === key) {
|
|
|
@@ -1192,7 +1246,8 @@
|
|
|
: invoiceApplyUpdateV2API;
|
|
|
const id = await API(this.form);
|
|
|
if (this.form.sourceType == 2) {
|
|
|
- updateContractStatus([this.form.sourceId]);
|
|
|
+ const idArr = this.form.sourceId?.split(',') || [];
|
|
|
+ updateContractStatus(idArr);
|
|
|
}
|
|
|
if (flag) {
|
|
|
await this.handleSub(id);
|
|
|
@@ -1231,7 +1286,8 @@
|
|
|
: invoiceApplyUpdateV2API;
|
|
|
const id = await API(this.form);
|
|
|
if (this.form.sourceType == 2) {
|
|
|
- updateContractStatus([this.form.sourceId]);
|
|
|
+ const idArr = this.form.sourceId?.split(',') || [];
|
|
|
+ updateContractStatus(idArr);
|
|
|
}
|
|
|
if (flag) {
|
|
|
await this.handleSub(id);
|