|
@@ -2,7 +2,7 @@
|
|
|
<ele-modal
|
|
<ele-modal
|
|
|
custom-class="ele-dialog-form long-dialog-form"
|
|
custom-class="ele-dialog-form long-dialog-form"
|
|
|
:centered="true"
|
|
:centered="true"
|
|
|
- :visible.sync="addAccountDialogFlag"
|
|
|
|
|
|
|
+ :visible="addAccountDialogFlag"
|
|
|
:title="title"
|
|
:title="title"
|
|
|
:append-to-body="true"
|
|
:append-to-body="true"
|
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
@@ -19,12 +19,20 @@
|
|
|
:datasource.sync="datasource"
|
|
:datasource.sync="datasource"
|
|
|
:contactData="contactData"
|
|
:contactData="contactData"
|
|
|
:saleOrderData="saleOrderData"
|
|
:saleOrderData="saleOrderData"
|
|
|
- :recorpayList.sync="recorpayList"
|
|
|
|
|
:dialogType="dialogType"
|
|
:dialogType="dialogType"
|
|
|
ref="saleFormRef"
|
|
ref="saleFormRef"
|
|
|
></sale-form>
|
|
></sale-form>
|
|
|
|
|
+ <headerTitle title="应收信息" style="margin-top: 30px"></headerTitle>
|
|
|
|
|
+ <receivable-info
|
|
|
|
|
+ :dataForm.sync="dataForm"
|
|
|
|
|
+ :receivableList.sync="receivableList"
|
|
|
|
|
+ :dialogType="dialogType"
|
|
|
|
|
+ @addAdvanceReceipt="addAdvanceReceipt"
|
|
|
|
|
+ ref="receivableInfoRef"
|
|
|
|
|
+ ></receivable-info>
|
|
|
|
|
+
|
|
|
<headerTitle title="对账明细" style="margin-top: 30px">
|
|
<headerTitle title="对账明细" style="margin-top: 30px">
|
|
|
- <template v-slot>
|
|
|
|
|
|
|
+ <!-- <template v-slot>
|
|
|
<el-row style="font-weight: 700; color: red">
|
|
<el-row style="font-weight: 700; color: red">
|
|
|
<span>订单总金额:</span>
|
|
<span>订单总金额:</span>
|
|
|
<span>{{ isNonDirectionalSale ? '--' : dataForm.orderTotalAmount || 0 }}</span>
|
|
<span>{{ isNonDirectionalSale ? '--' : dataForm.orderTotalAmount || 0 }}</span>
|
|
@@ -38,7 +46,7 @@
|
|
|
<span>本次对账总金额:</span>
|
|
<span>本次对账总金额:</span>
|
|
|
<span>{{ dataForm.amountTotalPrice || 0 }}</span>
|
|
<span>{{ dataForm.amountTotalPrice || 0 }}</span>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
- </template>
|
|
|
|
|
|
|
+ </template> -->
|
|
|
</headerTitle>
|
|
</headerTitle>
|
|
|
<!-- <recorpayTableList
|
|
<!-- <recorpayTableList
|
|
|
ref="recorpayListRef"
|
|
ref="recorpayListRef"
|
|
@@ -46,14 +54,20 @@
|
|
|
:recorpayList.sync="recorpayList"
|
|
:recorpayList.sync="recorpayList"
|
|
|
:dialogType="dialogType"
|
|
:dialogType="dialogType"
|
|
|
></recorpayTableList> -->
|
|
></recorpayTableList> -->
|
|
|
- <inventoryTable
|
|
|
|
|
- ref="inventoryTableref"
|
|
|
|
|
- :dataForm="dataForm"
|
|
|
|
|
|
|
+ <account-detail-table
|
|
|
|
|
+ ref="accountDetailTableRef"
|
|
|
:datasource.sync="datasource"
|
|
:datasource.sync="datasource"
|
|
|
:dialogType="dialogType"
|
|
:dialogType="dialogType"
|
|
|
- @changeDiscountPrice="changeDiscountPrice"
|
|
|
|
|
- ></inventoryTable>
|
|
|
|
|
|
|
+ :queryDimension="dataForm.queryDimension"
|
|
|
|
|
+ @totalChange="handleTotalChange"
|
|
|
|
|
+ @countChange="handleCountChange"
|
|
|
|
|
+ ></account-detail-table>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <advance-receipt-select-dialog
|
|
|
|
|
+ ref="advanceReceiptSelectRef"
|
|
|
|
|
+ :contactId="dataForm.contactId"
|
|
|
|
|
+ @changeParent="onAdvanceReceiptSelected"
|
|
|
|
|
+ ></advance-receipt-select-dialog>
|
|
|
<div slot="footer" class="footer">
|
|
<div slot="footer" class="footer">
|
|
|
<el-button
|
|
<el-button
|
|
|
v-if="dialogType !== 'view'"
|
|
v-if="dialogType !== 'view'"
|
|
@@ -81,8 +95,9 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- import InventoryTable from './inventoryTable.vue';
|
|
|
|
|
- import recorpayTableList from './recorpayTableList.vue';
|
|
|
|
|
|
|
+ import AccountDetailTable from './accountDetailTable.vue';
|
|
|
|
|
+ import ReceivableInfo from './receivableInfo.vue';
|
|
|
|
|
+ import AdvanceReceiptSelectDialog from './advanceReceiptSelectDialog.vue';
|
|
|
|
|
|
|
|
import saleForm from './saleForm.vue';
|
|
import saleForm from './saleForm.vue';
|
|
|
import {
|
|
import {
|
|
@@ -95,14 +110,16 @@
|
|
|
accountstatementUpdateAPI
|
|
accountstatementUpdateAPI
|
|
|
} from '@/api/saleManage/accountstatement';
|
|
} from '@/api/saleManage/accountstatement';
|
|
|
import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
|
|
import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
|
|
|
|
|
+ import { paymentTypeOp } from '@/enum/dict';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'addAccountDialog',
|
|
name: 'addAccountDialog',
|
|
|
components: {
|
|
components: {
|
|
|
processSubmitDialog,
|
|
processSubmitDialog,
|
|
|
- InventoryTable,
|
|
|
|
|
- saleForm,
|
|
|
|
|
- recorpayTableList
|
|
|
|
|
|
|
+ AccountDetailTable,
|
|
|
|
|
+ ReceivableInfo,
|
|
|
|
|
+ AdvanceReceiptSelectDialog,
|
|
|
|
|
+ saleForm
|
|
|
},
|
|
},
|
|
|
//客户管理数据
|
|
//客户管理数据
|
|
|
props: {
|
|
props: {
|
|
@@ -125,11 +142,13 @@
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ paymentTypeOp,
|
|
|
fullscreen: false,
|
|
fullscreen: false,
|
|
|
loading: false,
|
|
loading: false,
|
|
|
saveLoading: false,
|
|
saveLoading: false,
|
|
|
datasource: [],
|
|
datasource: [],
|
|
|
recorpayList: [],
|
|
recorpayList: [],
|
|
|
|
|
+ receivableList: [],
|
|
|
dataForm: {
|
|
dataForm: {
|
|
|
sourceType: 1,
|
|
sourceType: 1,
|
|
|
dateType: 1,
|
|
dateType: 1,
|
|
@@ -149,7 +168,14 @@
|
|
|
id: '',
|
|
id: '',
|
|
|
startDate: '',
|
|
startDate: '',
|
|
|
endDate: '',
|
|
endDate: '',
|
|
|
- repliedFiles: []
|
|
|
|
|
|
|
+ repliedFiles: [],
|
|
|
|
|
+ // 应收信息字段
|
|
|
|
|
+ fundType: 2,
|
|
|
|
|
+ transactionMethod: 1,
|
|
|
|
|
+ collectionTerms: '',
|
|
|
|
|
+ receiptStatus: 0,
|
|
|
|
|
+ totalAdvanceConfirmAmount: 0,
|
|
|
|
|
+ totalReceivableAmount: 0
|
|
|
},
|
|
},
|
|
|
title: '',
|
|
title: '',
|
|
|
processSubmitDialogFlag: false,
|
|
processSubmitDialogFlag: false,
|
|
@@ -159,17 +185,36 @@
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
isNonDirectionalSale() {
|
|
isNonDirectionalSale() {
|
|
|
- return this.datasource.some(item => item.orderCategory == 4);
|
|
|
|
|
|
|
+ return this.datasource.some((item) => item.orderCategory == 4);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- changeDiscountPrice(price, tableIndex) {
|
|
|
|
|
- console.log('price~~~', price, tableIndex)
|
|
|
|
|
- this.datasource[tableIndex].statementAmount = price;
|
|
|
|
|
- this.datasource[tableIndex].unStatementAmount = price;
|
|
|
|
|
- console.log('this.datasource', this.datasource)
|
|
|
|
|
- this.dataForm.amountTotalPrice = this.datasource.reduce((pre, cur) => pre + Math.round(+cur.statementAmount * 100), 0) / 100;
|
|
|
|
|
- this.dataForm.amountUnCompletePrice = this.datasource.reduce((pre, cur) => pre + Math.round(+cur.unStatementAmount * 100), 0) / 100;
|
|
|
|
|
|
|
+ handleTotalChange(total) {
|
|
|
|
|
+ this.dataForm.amountTotalPrice = total;
|
|
|
|
|
+ },
|
|
|
|
|
+ handleCountChange(count) {
|
|
|
|
|
+ this.dataForm.totalStatementCount = count;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 新增预收款:打开预收款选择弹窗
|
|
|
|
|
+ addAdvanceReceipt() {
|
|
|
|
|
+ this.$refs.advanceReceiptSelectRef.open();
|
|
|
|
|
+ },
|
|
|
|
|
+ // 预收款选择器回调:将选中的预收款映射为应收信息行
|
|
|
|
|
+ onAdvanceReceiptSelected(row) {
|
|
|
|
|
+ this.receivableList.push({
|
|
|
|
|
+ saleOrderNo: row.saleOrderNo || '',
|
|
|
|
|
+ advanceReceiptCode: row.advanceReceiptCode || '',
|
|
|
|
|
+ fundTypeName: this.fundTypeLabel(row.fundType),
|
|
|
|
|
+ unConfirmAmount: +row.unConfirmAmount || 0,
|
|
|
|
|
+ // 本次对账预收款确收金额上限取「未对账确收金额」
|
|
|
|
|
+ statementAmount: +row.unConfirmAmount || 0,
|
|
|
|
|
+ currentConfirmAmount: 0,
|
|
|
|
|
+ currentReceivableAmount: 0
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ fundTypeLabel(val) {
|
|
|
|
|
+ const item = (this.paymentTypeOp || []).find((i) => i.value === val);
|
|
|
|
|
+ return item ? item.label : val != null && val !== '' ? String(val) : '';
|
|
|
},
|
|
},
|
|
|
open(dialogType, row, type = '') {
|
|
open(dialogType, row, type = '') {
|
|
|
this.dialogType = dialogType;
|
|
this.dialogType = dialogType;
|
|
@@ -196,39 +241,66 @@
|
|
|
//获取对账单详情
|
|
//获取对账单详情
|
|
|
async getInfo(row) {
|
|
async getInfo(row) {
|
|
|
let data = await accountstatementInfoAPI(row.id);
|
|
let data = await accountstatementInfoAPI(row.id);
|
|
|
- console.log('data~~~', data)
|
|
|
|
|
|
|
+ console.log('data~~~', data);
|
|
|
// this.recorpayList = data.recorpayList || [];
|
|
// 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;
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ 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.orderList || [];
|
|
this.datasource = data.orderList || [];
|
|
|
- this.dataForm = data;
|
|
|
|
|
|
|
+ this.receivableList = data.receivableList || [];
|
|
|
|
|
+ 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
|
|
|
|
|
+ };
|
|
|
switch (this.dataForm.dateType) {
|
|
switch (this.dataForm.dateType) {
|
|
|
case 1:
|
|
case 1:
|
|
|
// this.dataForm.year = this.dataForm.dateValue;
|
|
// this.dataForm.year = this.dataForm.dateValue;
|
|
|
this.$set(this.dataForm, 'year', this.dataForm.dateValue);
|
|
this.$set(this.dataForm, 'year', this.dataForm.dateValue);
|
|
|
break;
|
|
break;
|
|
|
- case 2:
|
|
|
|
|
|
|
+ case 2: {
|
|
|
//2023年-四季度
|
|
//2023年-四季度
|
|
|
let data = this.dataForm.dateValue.split('年-');
|
|
let data = this.dataForm.dateValue.split('年-');
|
|
|
|
|
|
|
|
this.$set(this.dataForm, 'year', data[0]);
|
|
this.$set(this.dataForm, 'year', data[0]);
|
|
|
this.$set(this.dataForm, 'quarter', data[1]);
|
|
this.$set(this.dataForm, 'quarter', data[1]);
|
|
|
break;
|
|
break;
|
|
|
|
|
+ }
|
|
|
case 3:
|
|
case 3:
|
|
|
this.$set(this.dataForm, 'month', this.dataForm.dateValue);
|
|
this.$set(this.dataForm, 'month', this.dataForm.dateValue);
|
|
|
|
|
|
|
@@ -264,18 +336,18 @@
|
|
|
let data = await getStatementRecordListAPI(searchQuery);
|
|
let data = await getStatementRecordListAPI(searchQuery);
|
|
|
console.log(data, 'data');
|
|
console.log(data, 'data');
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
- data = data.map(item => {
|
|
|
|
|
- item.deliveryProducts = item.deliveryProducts.map(i => {
|
|
|
|
|
|
|
+ data = data.map((item) => {
|
|
|
|
|
+ item.deliveryProducts = item.deliveryProducts.map((i) => {
|
|
|
return {
|
|
return {
|
|
|
...i,
|
|
...i,
|
|
|
taxRate: i.taxRate || 0,
|
|
taxRate: i.taxRate || 0,
|
|
|
discountRatio: i.discountRatio || 100,
|
|
discountRatio: i.discountRatio || 100,
|
|
|
singlePrice: i.singlePrice || 0,
|
|
singlePrice: i.singlePrice || 0,
|
|
|
originalTotalCount: i.totalCount // 保存原始数量值用于校验
|
|
originalTotalCount: i.totalCount // 保存原始数量值用于校验
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
return item;
|
|
return item;
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
this.datasource = data || [];
|
|
this.datasource = data || [];
|
|
|
|
|
|
|
|
console.log(this.datasource, 'this.datasource~~~');
|
|
console.log(this.datasource, 'this.datasource~~~');
|
|
@@ -287,10 +359,26 @@
|
|
|
// amountTotalPrice: data.amountTotalPrice,
|
|
// amountTotalPrice: data.amountTotalPrice,
|
|
|
// amountPayablePass: data.amountPayablePass,
|
|
// amountPayablePass: data.amountPayablePass,
|
|
|
// amountReceivablePass: data.amountReceivablePass
|
|
// 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
|
|
|
|
|
|
|
+ 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();
|
|
this.$forceUpdate();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -302,18 +390,34 @@
|
|
|
async save(is) {
|
|
async save(is) {
|
|
|
if (!this.datasource.length)
|
|
if (!this.datasource.length)
|
|
|
return this.$message.warning('暂无对账信息');
|
|
return this.$message.warning('暂无对账信息');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
- // 校验 inventoryTableref 组件的表单
|
|
|
|
|
- await this.$refs.inventoryTableref.getValidForm();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 校验明细表与应收信息表单
|
|
|
|
|
+ await this.$refs.accountDetailTableRef.getValidForm();
|
|
|
|
|
+ await this.$refs.receivableInfoRef.validate();
|
|
|
|
|
+
|
|
|
let api =
|
|
let api =
|
|
|
this.dialogType == 'add'
|
|
this.dialogType == 'add'
|
|
|
? createAccountStatementAPI
|
|
? createAccountStatementAPI
|
|
|
: accountstatementUpdateAPI;
|
|
: accountstatementUpdateAPI;
|
|
|
|
|
+ const totalAdvanceConfirmAmount =
|
|
|
|
|
+ this.receivableList.reduce(
|
|
|
|
|
+ (pre, cur) =>
|
|
|
|
|
+ pre + Math.round((+cur.currentConfirmAmount || 0) * 100),
|
|
|
|
|
+ 0
|
|
|
|
|
+ ) / 100;
|
|
|
|
|
+ const totalReceivableAmount =
|
|
|
|
|
+ Math.round(
|
|
|
|
|
+ ((+this.dataForm.amountTotalPrice || 0) -
|
|
|
|
|
+ totalAdvanceConfirmAmount) *
|
|
|
|
|
+ 100
|
|
|
|
|
+ ) / 100;
|
|
|
let params = {
|
|
let params = {
|
|
|
...this.dataForm,
|
|
...this.dataForm,
|
|
|
|
|
+ totalAdvanceConfirmAmount,
|
|
|
|
|
+ totalReceivableAmount,
|
|
|
orderList: this.datasource,
|
|
orderList: this.datasource,
|
|
|
|
|
+ receivableList: this.receivableList
|
|
|
// recorpayList: this.recorpayList
|
|
// recorpayList: this.recorpayList
|
|
|
};
|
|
};
|
|
|
this.saveLoading = true;
|
|
this.saveLoading = true;
|