|
|
@@ -25,35 +25,13 @@
|
|
|
<headerTitle title="应收信息" style="margin-top: 30px"></headerTitle>
|
|
|
<receivable-info
|
|
|
:dataForm.sync="dataForm"
|
|
|
- :receivableList.sync="receivableList"
|
|
|
+ :receivableList="receivableList"
|
|
|
:dialogType="dialogType"
|
|
|
@addAdvanceReceipt="addAdvanceReceipt"
|
|
|
ref="receivableInfoRef"
|
|
|
></receivable-info>
|
|
|
|
|
|
- <headerTitle title="对账明细" style="margin-top: 30px">
|
|
|
- <!-- <template v-slot>
|
|
|
- <el-row style="font-weight: 700; color: red">
|
|
|
- <span>订单总金额:</span>
|
|
|
- <span>{{ isNonDirectionalSale ? '--' : dataForm.orderTotalAmount || 0 }}</span>
|
|
|
- <el-divider direction="vertical"></el-divider>
|
|
|
- <span>已对账金额:</span>
|
|
|
- <span>{{ dataForm.amountCompletePrice || 0 }}</span>
|
|
|
- <el-divider direction="vertical"></el-divider>
|
|
|
- <span>未对账金额:</span>
|
|
|
- <span>{{ dataForm.amountUnCompletePrice || 0 }}</span>
|
|
|
- <el-divider direction="vertical"></el-divider>
|
|
|
- <span>本次对账总金额:</span>
|
|
|
- <span>{{ dataForm.amountTotalPrice || 0 }}</span>
|
|
|
- </el-row>
|
|
|
- </template> -->
|
|
|
- </headerTitle>
|
|
|
- <!-- <recorpayTableList
|
|
|
- ref="recorpayListRef"
|
|
|
- :dataForm="dataForm"
|
|
|
- :recorpayList.sync="recorpayList"
|
|
|
- :dialogType="dialogType"
|
|
|
- ></recorpayTableList> -->
|
|
|
+ <headerTitle title="对账明细" style="margin-top: 30px"></headerTitle>
|
|
|
<account-detail-table
|
|
|
ref="accountDetailTableRef"
|
|
|
:datasource.sync="datasource"
|
|
|
@@ -61,13 +39,9 @@
|
|
|
:queryDimension="dataForm.queryDimension"
|
|
|
@totalChange="handleTotalChange"
|
|
|
@countChange="handleCountChange"
|
|
|
+ @statementAmountChange="handleStatementAmountChange"
|
|
|
></account-detail-table>
|
|
|
</div>
|
|
|
- <advance-receipt-select-dialog
|
|
|
- ref="advanceReceiptSelectRef"
|
|
|
- :contactId="dataForm.contactId"
|
|
|
- @changeParent="onAdvanceReceiptSelected"
|
|
|
- ></advance-receipt-select-dialog>
|
|
|
<div slot="footer" class="footer">
|
|
|
<el-button
|
|
|
v-if="dialogType !== 'view'"
|
|
|
@@ -97,15 +71,11 @@
|
|
|
<script>
|
|
|
import AccountDetailTable from './accountDetailTable.vue';
|
|
|
import ReceivableInfo from './receivableInfo.vue';
|
|
|
- import AdvanceReceiptSelectDialog from './advanceReceiptSelectDialog.vue';
|
|
|
|
|
|
import saleForm from './saleForm.vue';
|
|
|
import {
|
|
|
getStatementRecordSummaryAPI,
|
|
|
- infoAccountStatementAPI,
|
|
|
- saveAccountStatementAPI,
|
|
|
createAccountStatementAPI,
|
|
|
- updateAccountStatementAPI,
|
|
|
accountstatementInfoAPI,
|
|
|
accountstatementUpdateAPI
|
|
|
} from '@/api/saleManage/accountstatement';
|
|
|
@@ -118,7 +88,6 @@
|
|
|
processSubmitDialog,
|
|
|
AccountDetailTable,
|
|
|
ReceivableInfo,
|
|
|
- AdvanceReceiptSelectDialog,
|
|
|
saleForm
|
|
|
},
|
|
|
//客户管理数据
|
|
|
@@ -147,35 +116,23 @@
|
|
|
loading: false,
|
|
|
saveLoading: false,
|
|
|
datasource: [],
|
|
|
- recorpayList: [],
|
|
|
receivableList: [],
|
|
|
+ statReceipt: null,
|
|
|
dataForm: {
|
|
|
sourceType: 1,
|
|
|
dateType: 1,
|
|
|
queryDimension: 1,
|
|
|
dateValue: '',
|
|
|
- contactId: '',
|
|
|
- contactName: '',
|
|
|
- sourceName: '',
|
|
|
- sourceId: '',
|
|
|
- type: '',
|
|
|
+ type: 1,
|
|
|
year: '',
|
|
|
quarter: '',
|
|
|
month: '',
|
|
|
dateTimeRange: [],
|
|
|
- orderNo: '',
|
|
|
- orderId: '',
|
|
|
id: '',
|
|
|
startDate: '',
|
|
|
endDate: '',
|
|
|
- repliedFiles: [],
|
|
|
- // 应收信息字段
|
|
|
- fundType: 2,
|
|
|
- transactionMethod: 1,
|
|
|
- collectionTerms: '',
|
|
|
- receiptStatus: 0,
|
|
|
- totalAdvanceConfirmAmount: 0,
|
|
|
- totalReceivableAmount: 0
|
|
|
+ statReceipt: {},
|
|
|
+ productList: []
|
|
|
},
|
|
|
title: '',
|
|
|
processSubmitDialogFlag: false,
|
|
|
@@ -195,13 +152,19 @@
|
|
|
handleCountChange(count) {
|
|
|
this.dataForm.totalStatementCount = count;
|
|
|
},
|
|
|
+ // 明细表本次对账金额变化时,按销售单号同步到应收信息对应行
|
|
|
+ handleStatementAmountChange(summaryMap) {
|
|
|
+ if (this.$refs.receivableInfoRef) {
|
|
|
+ this.$refs.receivableInfoRef.syncStatementAmount(summaryMap);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 新增预收款:打开预收款选择弹窗
|
|
|
addAdvanceReceipt() {
|
|
|
this.$refs.advanceReceiptSelectRef.open();
|
|
|
},
|
|
|
- // 预收款选择器回调:将选中的预收款映射为应收信息行(字段对齐接口 statReceiptDetailList
|
|
|
+ // 预收款选择器回调:将选中的预收款映射为应收信息行,交给 receivableInfo 本地维护
|
|
|
onAdvanceReceiptSelected(row) {
|
|
|
- this.receivableList.push({
|
|
|
+ const receivableRow = {
|
|
|
advanceId: row.id,
|
|
|
advanceCode: row.advanceReceiptCode || '',
|
|
|
salesCode: row.saleOrderNo || '',
|
|
|
@@ -213,7 +176,10 @@
|
|
|
statementAdvanceConfirmAmount: 0,
|
|
|
transactionMode: this.dataForm.transactionMethod || 1,
|
|
|
currentReceivableAmount: 0
|
|
|
- });
|
|
|
+ };
|
|
|
+ if (this.$refs.receivableInfoRef) {
|
|
|
+ this.$refs.receivableInfoRef.addReceivableRow(receivableRow);
|
|
|
+ }
|
|
|
},
|
|
|
fundTypeLabel(val) {
|
|
|
const item = (this.paymentTypeOp || []).find((i) => i.value === val);
|
|
|
@@ -245,52 +211,15 @@
|
|
|
async getInfo(row) {
|
|
|
let data = await accountstatementInfoAPI(row.id);
|
|
|
console.log('data~~~', data);
|
|
|
- // this.recorpayList = data.recorpayList || [];
|
|
|
- // 解决小数精度丢失问题,使用分进行计算
|
|
|
- data.orderTotalAmount =
|
|
|
- data.orderList.reduce(
|
|
|
- (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
|
|
|
- 0
|
|
|
- ) / 100;
|
|
|
- data.amountTotalPrice =
|
|
|
- data.orderList.reduce(
|
|
|
- (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
|
|
|
- 0
|
|
|
- ) / 100;
|
|
|
- data.amountCompletePrice =
|
|
|
- data.orderList.reduce(
|
|
|
- (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
|
|
|
- 0
|
|
|
- ) / 100;
|
|
|
- data.amountUnCompletePrice =
|
|
|
- data.orderList.reduce(
|
|
|
- (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
|
|
|
- 0
|
|
|
- ) / 100;
|
|
|
- // data.orderList = data.orderList.map((item) => {
|
|
|
- // item.deliveryProducts = item.deliveryProducts.map((i) => {
|
|
|
- // return {
|
|
|
- // ...i,
|
|
|
- // taxRate: i.taxRate || 0,
|
|
|
- // discountRatio: i.discountRatio || 100,
|
|
|
- // singlePrice: i.singlePrice || 0,
|
|
|
- // originalTotalCount: i.totalCount // 保存原始数量值用于校验
|
|
|
- // };
|
|
|
- // });
|
|
|
- // return item;
|
|
|
- // });
|
|
|
+
|
|
|
this.datasource = data.productList || [];
|
|
|
this.receivableList =
|
|
|
(data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
|
|
|
+ // 保存查询到的完整 statReceipt 对象,作为提交入参
|
|
|
+ this.statReceipt = data.statReceipt || null;
|
|
|
this.dataForm = {
|
|
|
...this.dataForm,
|
|
|
...data,
|
|
|
- fundType: data.fundType || 2,
|
|
|
- transactionMethod: data.transactionMethod || 1,
|
|
|
- collectionTerms: data.collectionTerms || '',
|
|
|
- receiptStatus: data.receiptStatus || 0,
|
|
|
- totalAdvanceConfirmAmount: data.totalAdvanceConfirmAmount || 0,
|
|
|
- totalReceivableAmount: data.totalReceivableAmount || 0
|
|
|
};
|
|
|
|
|
|
console.log('this.dataForm~~~', this.dataForm, this.receivableList);
|
|
|
@@ -343,63 +272,16 @@
|
|
|
console.log(data, 'data');
|
|
|
this.loading = false;
|
|
|
|
|
|
- this.datasource = data.productList || [];
|
|
|
+ this.datasource = data.productList || [];
|
|
|
this.receivableList =
|
|
|
(data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
|
|
|
+ // 保存查询到的完整 statReceipt 对象,作为提交入参
|
|
|
+ this.statReceipt = data.statReceipt || null;
|
|
|
this.dataForm = {
|
|
|
...this.dataForm,
|
|
|
...data,
|
|
|
- fundType: data.fundType || 2,
|
|
|
- transactionMethod: data.transactionMethod || 1,
|
|
|
- collectionTerms: data.collectionTerms || '',
|
|
|
- receiptStatus: data.receiptStatus || 0,
|
|
|
- totalAdvanceConfirmAmount: data.totalAdvanceConfirmAmount || 0,
|
|
|
- totalReceivableAmount: data.totalReceivableAmount || 0
|
|
|
}
|
|
|
- // data = data.map((item) => {
|
|
|
- // item.deliveryProducts = item.deliveryProducts.map((i) => {
|
|
|
- // return {
|
|
|
- // ...i,
|
|
|
- // taxRate: i.taxRate || 0,
|
|
|
- // discountRatio: i.discountRatio || 100,
|
|
|
- // singlePrice: i.singlePrice || 0,
|
|
|
- // originalTotalCount: i.totalCount // 保存原始数量值用于校验
|
|
|
- // };
|
|
|
- // });
|
|
|
- // return item;
|
|
|
- // });
|
|
|
- // this.datasource = data || [];
|
|
|
|
|
|
- // console.log(this.datasource, 'this.datasource~~~');
|
|
|
- // this.recorpayList = data.recorpayList || [];
|
|
|
- // this.dataForm = {
|
|
|
- // ...this.dataForm,
|
|
|
- // // amountPayablePrice: data.amountPayablePrice,
|
|
|
- // // amountReceivablePrice: data.amountReceivablePrice,
|
|
|
- // // amountTotalPrice: data.amountTotalPrice,
|
|
|
- // // amountPayablePass: data.amountPayablePass,
|
|
|
- // // amountReceivablePass: data.amountReceivablePass
|
|
|
- // orderTotalAmount:
|
|
|
- // data.reduce(
|
|
|
- // (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
|
|
|
- // 0
|
|
|
- // ) / 100,
|
|
|
- // amountTotalPrice:
|
|
|
- // data.reduce(
|
|
|
- // (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
|
|
|
- // 0
|
|
|
- // ) / 100,
|
|
|
- // amountCompletePrice:
|
|
|
- // data.reduce(
|
|
|
- // (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
|
|
|
- // 0
|
|
|
- // ) / 100,
|
|
|
- // amountUnCompletePrice:
|
|
|
- // data.reduce(
|
|
|
- // (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
|
|
|
- // 0
|
|
|
- // ) / 100
|
|
|
- // };
|
|
|
this.$forceUpdate();
|
|
|
} catch (error) {
|
|
|
this.loading = false;
|
|
|
@@ -420,26 +302,29 @@
|
|
|
this.dialogType == 'add'
|
|
|
? createAccountStatementAPI
|
|
|
: accountstatementUpdateAPI;
|
|
|
- const totalAdvanceConfirmAmount =
|
|
|
- this.receivableList.reduce(
|
|
|
- (pre, cur) =>
|
|
|
- pre + Math.round((+cur.statementAdvanceConfirmAmount || 0) * 100),
|
|
|
- 0
|
|
|
- ) / 100;
|
|
|
- const totalReceivableAmount =
|
|
|
- Math.round(
|
|
|
- ((+this.dataForm.amountTotalPrice || 0) -
|
|
|
- totalAdvanceConfirmAmount) *
|
|
|
- 100
|
|
|
- ) / 100;
|
|
|
+ // 提交时由应收信息组件一次性取回整个表单(本地明细 + 汇总),不再实时回写
|
|
|
+ const receivableData = this.$refs.receivableInfoRef.getSubmitData();
|
|
|
+ // statReceipt 为完整数据容器,保存时以它为基准组装应收明细与汇总
|
|
|
+
|
|
|
+ let statReceipt = {
|
|
|
+ statReceiptDetailList: receivableData.receivableList,
|
|
|
+ statementAdvanceTotalPrice:
|
|
|
+ receivableData.statementAdvanceTotalPrice,
|
|
|
+ receivedTotalPrice: receivableData.receivedTotalPrice
|
|
|
+ };
|
|
|
+ this.statReceipt = statReceipt;
|
|
|
+
|
|
|
+ const statementAdvanceTotalPrice =
|
|
|
+ receivableData.statementAdvanceTotalPrice;
|
|
|
+ const receivedTotalPrice = receivableData.receivedTotalPrice;
|
|
|
let params = {
|
|
|
...this.dataForm,
|
|
|
- totalAdvanceConfirmAmount,
|
|
|
- totalReceivableAmount,
|
|
|
+ statementAdvanceTotalPrice,
|
|
|
+ receivedTotalPrice,
|
|
|
+ totalAdvanceConfirmAmount: statementAdvanceTotalPrice,
|
|
|
+ totalReceivableAmount: receivedTotalPrice,
|
|
|
productList: this.datasource,
|
|
|
- receivableList: this.receivableList,
|
|
|
- statReceipt: this.statReceipt
|
|
|
- // recorpayList: this.recorpayList
|
|
|
+ statReceipt
|
|
|
};
|
|
|
this.saveLoading = true;
|
|
|
let data = await api(params);
|