|
|
@@ -1,27 +1,41 @@
|
|
|
<!-- 预收款新增/编辑弹窗 -->
|
|
|
<template>
|
|
|
<ele-modal
|
|
|
- width="1100px"
|
|
|
+ width="70%"
|
|
|
:visible="visible"
|
|
|
+ :maxable="true"
|
|
|
:append-to-body="true"
|
|
|
:close-on-click-modal="false"
|
|
|
custom-class="ele-dialog-form"
|
|
|
- :title="isDetail ? '预收款详情' : (isUpdate ? '修改预收款' : '新增预收款')"
|
|
|
+ :title="isDetail ? '预收款详情' : isUpdate ? '修改预收款' : '新增预收款'"
|
|
|
@update:visible="updateVisible"
|
|
|
>
|
|
|
+ <div class="switch_left" v-if="isDetail">
|
|
|
+ <ul>
|
|
|
+ <li
|
|
|
+ v-for="item in tabOptions"
|
|
|
+ :key="item.key"
|
|
|
+ :class="{ active: activeComp == item.key }"
|
|
|
+ @click="activeComp = item.key"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
<el-form
|
|
|
ref="form"
|
|
|
:model="form"
|
|
|
:rules="rules"
|
|
|
label-width="120px"
|
|
|
+ v-show="activeComp == 'main'"
|
|
|
>
|
|
|
<!-- 基本信息 -->
|
|
|
<headerTitle title="基本信息" size="16px"></headerTitle>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="预收日期:" prop="receiptDate">
|
|
|
+ <el-form-item label="预收日期:" prop="advanceDate">
|
|
|
<el-date-picker
|
|
|
- v-model="form.receiptDate"
|
|
|
+ v-model="form.advanceDate"
|
|
|
type="date"
|
|
|
placeholder="请选择"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
@@ -31,9 +45,9 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="预收金额:" prop="amount">
|
|
|
+ <el-form-item label="预收金额:" prop="advanceTotalPrice">
|
|
|
<el-input
|
|
|
- v-model="form.amount"
|
|
|
+ v-model="form.advanceTotalPrice"
|
|
|
placeholder="请输入"
|
|
|
:disabled="isDetail"
|
|
|
>
|
|
|
@@ -42,36 +56,35 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="会计科目:" prop="accountSubject">
|
|
|
- <el-select
|
|
|
- v-model="form.accountSubject"
|
|
|
- placeholder="请选择"
|
|
|
- style="width: 100%"
|
|
|
+ <el-form-item label="会计科目:" prop="accountingSubjectId">
|
|
|
+ <ele-tree-select
|
|
|
+ clearable
|
|
|
:disabled="isDetail"
|
|
|
- >
|
|
|
- <el-option label="预收款项" value="预收款项"></el-option>
|
|
|
- </el-select>
|
|
|
+ filterable
|
|
|
+ ref="treeSelect"
|
|
|
+ :data="accountingSubjectList"
|
|
|
+ v-model="form.accountingSubjectId"
|
|
|
+ valueKey="id"
|
|
|
+ labelKey="name"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="changeSubjectInfo"
|
|
|
+ default-expand-all
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="客户名称:" prop="customerName">
|
|
|
- <el-select
|
|
|
- v-model="form.customerName"
|
|
|
+ <el-form-item label="客户名称:" prop="contactName">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="form.contactName"
|
|
|
+ @click.native="$refs.parentRef.open()"
|
|
|
placeholder="请选择"
|
|
|
- style="width: 100%"
|
|
|
+ readonly
|
|
|
:disabled="isDetail"
|
|
|
- filterable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in customerOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
@@ -82,26 +95,21 @@
|
|
|
style="width: 100%"
|
|
|
:disabled="isDetail"
|
|
|
>
|
|
|
- <el-option label="销售订单" value="销售订单"></el-option>
|
|
|
+ <el-option label="销售订单" :value="3"></el-option>
|
|
|
+ <el-option label="合同" :value="2"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="来源编码:" prop="sourceCode">
|
|
|
- <el-select
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
v-model="form.sourceCode"
|
|
|
+ @click.native="openSource"
|
|
|
placeholder="请选择"
|
|
|
- style="width: 100%"
|
|
|
:disabled="isDetail"
|
|
|
- filterable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in sourceCodeOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ readonly
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -109,20 +117,19 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="款项类型:" prop="fundType">
|
|
|
- <el-select
|
|
|
+ <DictSelection
|
|
|
+ dictName="预收款款项类型"
|
|
|
+ clearable
|
|
|
v-model="form.fundType"
|
|
|
- placeholder="请选择"
|
|
|
- style="width: 100%"
|
|
|
:disabled="isDetail"
|
|
|
>
|
|
|
- <el-option label="预付款" value="预付款"></el-option>
|
|
|
- </el-select>
|
|
|
+ </DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="收款条件:" prop="collectionTerms">
|
|
|
+ <el-form-item label="收款条件:" prop="collectionConditionId">
|
|
|
<el-select
|
|
|
- v-model="form.collectionTerms"
|
|
|
+ v-model="form.collectionConditionId"
|
|
|
placeholder="请选择"
|
|
|
style="width: 100%"
|
|
|
:disabled="isDetail"
|
|
|
@@ -149,14 +156,21 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="附件:" prop="attachment">
|
|
|
- <fileMain v-model="form.attachment" :disabled="isDetail"></fileMain>
|
|
|
+ <el-form-item label="附件:" prop="files">
|
|
|
+ <fileMain
|
|
|
+ v-model="form.files"
|
|
|
+ :type="isDetail ? 'view' : 'add'"
|
|
|
+ ></fileMain>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
<!-- 物品清单 -->
|
|
|
- <headerTitle title="物品清单" size="16px" style="margin-top: 20px"></headerTitle>
|
|
|
+ <headerTitle
|
|
|
+ title="物品清单"
|
|
|
+ size="16px"
|
|
|
+ style="margin-top: 20px"
|
|
|
+ ></headerTitle>
|
|
|
<inventoryTableDetails
|
|
|
ref="inventoryTableDetailsRef"
|
|
|
:isAllPrice="false"
|
|
|
@@ -164,6 +178,31 @@
|
|
|
:isSelected="false"
|
|
|
cacheKeyUrl="eos-advanceReceipt-inventoryTableDetails"
|
|
|
></inventoryTableDetails>
|
|
|
+ <!-- 收款信息 -->
|
|
|
+ <div v-if="isDetail">
|
|
|
+ <headerTitle title="收款信息"></headerTitle>
|
|
|
+ <div style="margin: 10px 0; font-size: 14px; color: #606266">
|
|
|
+ <span>预收金额:{{ form.advanceTotalPrice || 0 }} 元</span>
|
|
|
+ <span style="margin-left: 20px"
|
|
|
+ >已收金额:{{ receivedAmount }} 元</span
|
|
|
+ >
|
|
|
+ <span style="margin-left: 20px"
|
|
|
+ >未收金额:{{ unreceivedAmount }} 元</span
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :needPage="false"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="form.detailList"
|
|
|
+ :toolkit="[]"
|
|
|
+ >
|
|
|
+ <template v-slot:attachment="{ row: r }">
|
|
|
+ <fileMain v-model="r.attachment" type="view" :limit="1"></fileMain>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </div>
|
|
|
</el-form>
|
|
|
|
|
|
<template v-slot:footer>
|
|
|
@@ -177,23 +216,106 @@
|
|
|
<el-button @click="updateVisible(false)">取消</el-button>
|
|
|
</template>
|
|
|
</template>
|
|
|
+ <parentList ref="parentRef" @changeParent="changeParent"></parentList>
|
|
|
+ <contractListDialog
|
|
|
+ ref="selectContractRef"
|
|
|
+ @changeParent="changeContract"
|
|
|
+ :isChange="true"
|
|
|
+ :contactData="{
|
|
|
+ id: form.contactId
|
|
|
+ }"
|
|
|
+ ></contractListDialog>
|
|
|
+ <!-- 销售订单 -->
|
|
|
+ <saleOrderListDialog
|
|
|
+ ref="saleOrderListDialogRef"
|
|
|
+ :contactData="{
|
|
|
+ id: form.contactId
|
|
|
+ }"
|
|
|
+ @changeParent="changeOrder"
|
|
|
+ ></saleOrderListDialog>
|
|
|
+ <bpmDetail
|
|
|
+ v-if="activeComp === 'bpm' && form.processInstanceId"
|
|
|
+ :id="form.processInstanceId"
|
|
|
+ ></bpmDetail>
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import headerTitle from '@/components/header-title';
|
|
|
import inventoryTableDetails from '@/BIZComponents/inventoryTableDetails.vue';
|
|
|
- import fileMain from '@/components/addDoc/index.vue';
|
|
|
- import { addAdvanceReceipt, updateAdvanceReceipt } from '@/api/financialManage/advanceReceipt';
|
|
|
-
|
|
|
+ import bpmDetail from '@/views/bpm/processInstance/detail.vue';
|
|
|
+ import { getDetail } from '@/api/contractManage/contractBook';
|
|
|
+ import {
|
|
|
+ addAdvanceReceipt,
|
|
|
+ updateAdvanceReceipt,
|
|
|
+ getAdvanceReceiptInfo
|
|
|
+ } from '@/api/financialManage/advanceReceipt';
|
|
|
+ import { getTreeByPid } from '@/api/classifyManage';
|
|
|
+ import parentList from '@/views/saleManage/contact/components/parentList.vue';
|
|
|
+ import contractListDialog from '@/views/saleManage/saleOrder/components/contractListDialog.vue';
|
|
|
+ import saleOrderListDialog from '@/views/saleManage/saleOrder/invoice/components/orderListDialog.vue'; //销售订单
|
|
|
+ import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
|
|
|
export default {
|
|
|
components: {
|
|
|
headerTitle,
|
|
|
inventoryTableDetails,
|
|
|
- fileMain
|
|
|
+ contractListDialog,
|
|
|
+ saleOrderListDialog,
|
|
|
+ parentList,
|
|
|
+ bpmDetail
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ activeComp: 'main',
|
|
|
+
|
|
|
+ tabOptions: [
|
|
|
+ { key: 'main', name: '预收款项' },
|
|
|
+ { key: 'bpm', name: '流程详情' }
|
|
|
+ ],
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ type: 'index',
|
|
|
+ label: '序号',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'collectTime',
|
|
|
+ label: '收款时间',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 160,
|
|
|
+ slot: 'collectTime'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'collectAmount',
|
|
|
+ label: '已收金额',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 140,
|
|
|
+ slot: 'collectAmount'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'payType',
|
|
|
+ label: '支付类型',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 140,
|
|
|
+ slot: 'payType'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'attachment',
|
|
|
+ label: '附件',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 120,
|
|
|
+ slot: 'attachment'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'remark',
|
|
|
+ label: '备注',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 140,
|
|
|
+ slot: 'remark'
|
|
|
+ }
|
|
|
+ ],
|
|
|
visible: false,
|
|
|
loading: false,
|
|
|
isUpdate: false,
|
|
|
@@ -201,31 +323,65 @@
|
|
|
customerOptions: [],
|
|
|
sourceCodeOptions: [],
|
|
|
collectionTermsOptions: [],
|
|
|
+ accountingSubjectList: [],
|
|
|
form: {
|
|
|
id: null,
|
|
|
code: '',
|
|
|
- receiptDate: '',
|
|
|
- amount: '',
|
|
|
- accountSubject: '预收款项',
|
|
|
- customerName: '',
|
|
|
- sourceType: '销售订单',
|
|
|
+ advanceDate: '',
|
|
|
+ advanceTotalPrice: '',
|
|
|
+ accountingSubjectId: '1779719367139792005',
|
|
|
+ accountingSubjectCode: '2203',
|
|
|
+ contactName: '',
|
|
|
+ contactId: '',
|
|
|
+ sourceType: 3,
|
|
|
sourceCode: '',
|
|
|
- fundType: '预付款',
|
|
|
- collectionTerms: '',
|
|
|
+ fundType: '1',
|
|
|
+ collectionConditionId: '',
|
|
|
remark: '',
|
|
|
- attachment: []
|
|
|
+ files: [],
|
|
|
+ detailList: []
|
|
|
},
|
|
|
rules: {
|
|
|
- receiptDate: [{ required: true, message: '请选择预收日期', trigger: 'change' }],
|
|
|
- amount: [{ required: true, message: '请输入预收金额', trigger: 'blur' }],
|
|
|
- accountSubject: [{ required: true, message: '请选择会计科目', trigger: 'change' }],
|
|
|
- customerName: [{ required: true, message: '请选择客户名称', trigger: 'change' }],
|
|
|
- sourceType: [{ required: true, message: '请选择来源类型', trigger: 'change' }],
|
|
|
- sourceCode: [{ required: true, message: '请选择来源编码', trigger: 'change' }],
|
|
|
- fundType: [{ required: true, message: '请选择款项类型', trigger: 'change' }]
|
|
|
+ advanceDate: [
|
|
|
+ { required: true, message: '请选择预收日期', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ advanceTotalPrice: [
|
|
|
+ { required: true, message: '请输入预收金额', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ accountingSubjectId: [
|
|
|
+ { required: true, message: '请选择会计科目', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ contactName: [
|
|
|
+ { required: true, message: '请选择客户名称', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ sourceType: [
|
|
|
+ { required: true, message: '请选择来源类型', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ sourceCode: [
|
|
|
+ { required: true, message: '请选择来源编码', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ fundType: [
|
|
|
+ { required: true, message: '请选择款项类型', trigger: 'change' }
|
|
|
+ ]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ receivedAmount() {
|
|
|
+ const list = this.form.detailList || [];
|
|
|
+ return list
|
|
|
+ .reduce((sum, item) => {
|
|
|
+ const val = parseFloat(item.collectAmount);
|
|
|
+ return sum + (isNaN(val) ? 0 : val);
|
|
|
+ }, 0)
|
|
|
+ .toFixed(2);
|
|
|
+ },
|
|
|
+ unreceivedAmount() {
|
|
|
+ const total = parseFloat(this.form.advanceTotalPrice) || 0;
|
|
|
+ const received = parseFloat(this.receivedAmount) || 0;
|
|
|
+ return (total - received).toFixed(2);
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
generateCode() {
|
|
|
const now = new Date();
|
|
|
@@ -236,15 +392,20 @@
|
|
|
this.form.code = `YSK${year}${month}${day}${random}`;
|
|
|
},
|
|
|
|
|
|
- open(type, row) {
|
|
|
+ async open(type, row) {
|
|
|
this.visible = true;
|
|
|
+ this.activeComp = 'main';
|
|
|
+ await this.getClassifyList(24, 'accountingSubjectList');
|
|
|
this.isUpdate = type === 'edit';
|
|
|
this.isDetail = type === 'detail';
|
|
|
if ((this.isUpdate || this.isDetail) && row) {
|
|
|
- this.form = { ...row };
|
|
|
+ this.form = await getAdvanceReceiptInfo(row.id);
|
|
|
+
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.inventoryTableDetailsRef &&
|
|
|
- this.$refs.inventoryTableDetailsRef.putTableValue(row.productList || []);
|
|
|
+ this.$refs.inventoryTableDetailsRef.putTableValue(
|
|
|
+ this.form.productList || []
|
|
|
+ );
|
|
|
});
|
|
|
} else {
|
|
|
this.resetForm();
|
|
|
@@ -253,26 +414,80 @@
|
|
|
this.$refs.inventoryTableDetailsRef &&
|
|
|
this.$refs.inventoryTableDetailsRef.putTableValue([]);
|
|
|
});
|
|
|
+ this.form.accountingSubjectId = '1779719367139792005';
|
|
|
+ this.form.accountingSubjectCode = '2203';
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.form && this.$refs.form.clearValidate();
|
|
|
});
|
|
|
},
|
|
|
+ changeSubjectInfo(val) {
|
|
|
+ const { code } = this.$refs.treeSelect.getNodeByValue(val);
|
|
|
+ this.form.accountingSubjectCode = code;
|
|
|
+ },
|
|
|
+ //获取分类管理中的数据
|
|
|
+ async getClassifyList(id, listName) {
|
|
|
+ let res = await getTreeByPid(id);
|
|
|
+ this[listName] = res.data;
|
|
|
+ },
|
|
|
+ async changeParent(obj) {
|
|
|
+ this.form.contactName = obj.name;
|
|
|
+ this.form.contactId = obj.id;
|
|
|
+ },
|
|
|
+
|
|
|
+ openSource() {
|
|
|
+ if (!this.form.contactName) {
|
|
|
+ this.$message.error('请选择客户');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.form.sourceType) {
|
|
|
+ this.$message.error('请选择来源类型');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.form.sourceType == 3) {
|
|
|
+ this.$refs.saleOrderListDialogRef.open();
|
|
|
+ } else {
|
|
|
+ this.$refs.selectContractRef.open();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async changeOrder(row) {
|
|
|
+ this.form.sourceCode = row.orderNo;
|
|
|
+ this.form.sourceId = row.id;
|
|
|
+ const { productList, receiptPaymentList, payAmount } =
|
|
|
+ await getSaleOrderDetail(row.id);
|
|
|
|
|
|
+ this.$refs.inventoryTableDetailsRef.putTableValue({ productList });
|
|
|
+ this.form.advanceTotalPrice = payAmount;
|
|
|
+ },
|
|
|
+ async changeContract(row) {
|
|
|
+ console.log(row, 'dadas');
|
|
|
+ this.form.sourceCode = row.contractNumber;
|
|
|
+ this.form.sourceId = row.id;
|
|
|
+ const { productList, receiptPaymentList, contractVO } = await getDetail(
|
|
|
+ row.id
|
|
|
+ );
|
|
|
+
|
|
|
+ this.$refs.inventoryTableDetailsRef.putTableValue({ productList });
|
|
|
+ this.form.advanceTotalPrice = contractVO.discountTotalPrice;
|
|
|
+ },
|
|
|
resetForm() {
|
|
|
this.form = {
|
|
|
id: null,
|
|
|
code: '',
|
|
|
- receiptDate: '',
|
|
|
- amount: '',
|
|
|
- accountSubject: '预收款项',
|
|
|
- customerName: '',
|
|
|
- sourceType: '销售订单',
|
|
|
+ advanceDate: '',
|
|
|
+ advanceTotalPrice: '',
|
|
|
+ accountingSubjectId: '1779719367139792005',
|
|
|
+ accountingSubjectCode: '2203',
|
|
|
+ contactName: '',
|
|
|
+ contactId: '',
|
|
|
+ sourceType: 3,
|
|
|
sourceCode: '',
|
|
|
- fundType: '预付款',
|
|
|
- collectionTerms: '',
|
|
|
+ sourceId: '',
|
|
|
+ fundType: '1',
|
|
|
+ collectionConditionId: '',
|
|
|
remark: '',
|
|
|
- attachment: []
|
|
|
+ files: [],
|
|
|
+ detailList: []
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -281,13 +496,10 @@
|
|
|
if (!valid) return;
|
|
|
this.loading = true;
|
|
|
|
|
|
- const productList = this.$refs.inventoryTableDetailsRef
|
|
|
- ? this.$refs.inventoryTableDetailsRef.getTableValue()
|
|
|
- : [];
|
|
|
- const params = { ...this.form, productList };
|
|
|
-
|
|
|
- const saveOrUpdate = this.isUpdate ? updateAdvanceReceipt : addAdvanceReceipt;
|
|
|
- saveOrUpdate(params)
|
|
|
+ const saveOrUpdate = this.isUpdate
|
|
|
+ ? updateAdvanceReceipt
|
|
|
+ : addAdvanceReceipt;
|
|
|
+ saveOrUpdate(this.form)
|
|
|
.then(() => {
|
|
|
this.loading = false;
|
|
|
this.$message.success(this.isUpdate ? '修改成功' : '新增成功');
|