|
|
@@ -8,6 +8,7 @@
|
|
|
:close-on-click-modal="false"
|
|
|
width="70%"
|
|
|
append-to-body
|
|
|
+ destroy-on-close
|
|
|
@close="cancel"
|
|
|
:maxable="true"
|
|
|
:resizable="true"
|
|
|
@@ -21,7 +22,7 @@
|
|
|
>
|
|
|
<headerTitle title="合同信息"></headerTitle>
|
|
|
<el-row>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="8">
|
|
|
<el-form-item label="合同类型" prop="type">
|
|
|
<el-select
|
|
|
v-model="form.type"
|
|
|
@@ -199,23 +200,22 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="合同名称" prop="contractName">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- v-model="form.contractName"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="合同编号" prop="contractNumber">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- v-model="form.contractNumber"
|
|
|
- placeholder="请输入"
|
|
|
+ <el-form-item
|
|
|
+ :label="form.type == 2 ? '采购员' : '业务员'"
|
|
|
+ prop="businessUserId"
|
|
|
+ >
|
|
|
+ <personSelect
|
|
|
+ ref="businessDirectorRef"
|
|
|
+ v-model="form.businessUserId"
|
|
|
+ @selfChange="businessUserChange"
|
|
|
+ :init="false"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item prop="contractFile" label="合同附件">
|
|
|
<fileMain v-model="form.fileId"></fileMain>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<!-- <el-form-item prop="productionRequirements" label="生产要求">
|
|
|
<el-input
|
|
|
clearable
|
|
|
@@ -225,7 +225,7 @@
|
|
|
/>
|
|
|
</el-form-item> -->
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="8">
|
|
|
<el-form-item label="合同分类" prop="categoryId" style="width: 100%">
|
|
|
<el-select
|
|
|
v-model="form.categoryId"
|
|
|
@@ -243,15 +243,6 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="结算方式" prop="settlementMode">
|
|
|
- <DictSelection
|
|
|
- dictName="结算方式"
|
|
|
- clearable
|
|
|
- v-model="form.settlementMode"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- </DictSelection>
|
|
|
- </el-form-item>
|
|
|
<el-form-item
|
|
|
label="核价清单"
|
|
|
prop="HJQD"
|
|
|
@@ -274,6 +265,31 @@
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <el-form-item label="结束日期" prop="contractEndDate">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.contractEndDate"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="合同名称" prop="contractName">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="form.contractName"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="合同编号" prop="contractNumber">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="form.contractNumber"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item
|
|
|
label="需求人"
|
|
|
prop="requireUserId"
|
|
|
@@ -286,28 +302,107 @@
|
|
|
:init="false"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <el-form-item
|
|
|
- :label="form.type == 2 ? '采购员' : '业务员'"
|
|
|
- prop="businessUserId"
|
|
|
- >
|
|
|
- <personSelect
|
|
|
- ref="businessDirectorRef"
|
|
|
- v-model="form.businessUserId"
|
|
|
- @selfChange="businessUserChange"
|
|
|
- :init="false"
|
|
|
- />
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="交易方式" prop="transactionMode">
|
|
|
+ <el-select
|
|
|
+ v-model="form.transactionMode"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="transactionModeChange"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in transactionMethodsOp"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="结束日期" prop="contractEndDate">
|
|
|
+ <el-form-item :label="form.type == 2 ? '收货模式' : '发货模式'" prop="deliveryMode">
|
|
|
+ <el-select
|
|
|
+ v-model="form.deliveryMode"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="deliveryModeChange"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in shippingModeOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="结算方式" prop="settlementMode">
|
|
|
+ <DictSelection
|
|
|
+ dictName="结算方式"
|
|
|
+ clearable
|
|
|
+ v-model="form.settlementMode"
|
|
|
+ style="width: 100%"
|
|
|
+ @itemChange="settlementModeChange"
|
|
|
+ >
|
|
|
+ </DictSelection>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="form.settlementMode == 1" label="结算日期范围" prop="settlementDate">
|
|
|
+ <!-- <el-date-picker
|
|
|
+ v-model="form.contractStartDate"
|
|
|
+ @change="setDeliveryDays"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ </el-date-picker> -->
|
|
|
<el-date-picker
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="form.settlementDate"
|
|
|
+ type="daterange"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ @change="settlementDateChange">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item v-if="form.settlementMode == 2" label="结算月份范围" prop="settlementDate">
|
|
|
+ <!-- <el-date-picker
|
|
|
v-model="form.contractEndDate"
|
|
|
type="date"
|
|
|
placeholder="选择日期"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
+ </el-date-picker> -->
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.settlementDate"
|
|
|
+ type="monthrange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始月份"
|
|
|
+ end-placeholder="结束月份"
|
|
|
+ value-format="yyyy-MM"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="settlementDateChange"
|
|
|
+ >
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item v-if="form.settlementMode == 2" label="收款日期" prop="receiptDate">
|
|
|
+ <el-input type="number" :min="1" :max="31" placeholder="请输入" v-model="form.receiptDate" @input="receiptDateChange">
|
|
|
+ <template slot="prepend">每月</template>
|
|
|
+ <template slot="append">日</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="期数"
|
|
|
+ prop="issueNumber"
|
|
|
+ >
|
|
|
+ <el-input type="number" :min="1" v-model="form.issueNumber" @input="issueNumberChange">
|
|
|
+ <template slot="append">
|
|
|
+ <span>期</span>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<headerTitle title="基本信息"></headerTitle>
|
|
|
@@ -594,10 +689,16 @@
|
|
|
</el-tabs>
|
|
|
|
|
|
<headerTitle
|
|
|
- :title="form.type == '2' ? '付款方式' : '收款方式'"
|
|
|
+ :title="form.type == '2' ? '付款计划' : '收款计划'"
|
|
|
style="margin-top: 30px"
|
|
|
></headerTitle>
|
|
|
- <paymentList ref="paymentListTable" />
|
|
|
+ <!-- <paymentList ref="paymentListTable" /> -->
|
|
|
+ <PaymentCollectionPlan
|
|
|
+ ref="paymentCollectionPlanRef"
|
|
|
+ :menu="form.type == '2' ? 'purchase' : 'sale'"
|
|
|
+ :info="form"
|
|
|
+ @getIssueNumber="setIssueNumber"
|
|
|
+ ></PaymentCollectionPlan>
|
|
|
</el-form>
|
|
|
|
|
|
<div slot="footer" class="footer">
|
|
|
@@ -678,7 +779,7 @@
|
|
|
import { emailReg, telReg } from 'ele-admin';
|
|
|
import { acceptUnpackoptions } from '@/enum/dict';
|
|
|
import inventoryTable from './inventoryTable.vue';
|
|
|
- import inventoryTable1 from '@/BIZComponents//inventoryTable.vue';
|
|
|
+ import inventoryTable1 from '@/BIZComponents/inventoryTable.vue';
|
|
|
import inquiryList from './inquiryList.vue';
|
|
|
import quotationList from './quotationList.vue';
|
|
|
// import fileMain from '@/components/addDoc/index';
|
|
|
@@ -722,6 +823,8 @@
|
|
|
import { listCode, getCode } from '@/components/addDoc/api/index.js';
|
|
|
import saleOrderListDialog from '@/views/saleManage/saleOrder/invoice/components/orderListDialog.vue'; //销售订单
|
|
|
import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
|
|
|
+ import PaymentCollectionPlan from '@/BIZComponents/paymentCollectionPlan/Index.vue'
|
|
|
+ import { shippingModeOp, shippingModePurchaseOp, transactionMethodsOp } from '@/enum/dict.js';
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
|
@@ -768,7 +871,8 @@
|
|
|
// fileMain,
|
|
|
inventoryTable1,
|
|
|
personSelect,
|
|
|
- saleOrderListDialog
|
|
|
+ saleOrderListDialog,
|
|
|
+ PaymentCollectionPlan
|
|
|
},
|
|
|
data() {
|
|
|
let formDef = {
|
|
|
@@ -807,7 +911,7 @@
|
|
|
partbLinkName: '',
|
|
|
partbName: '',
|
|
|
partbTel: '',
|
|
|
- settlementModeName: '结算方式',
|
|
|
+ settlementModeName: '分期付款',
|
|
|
settlementMode: '4',
|
|
|
pricingWay: 1,
|
|
|
customerMark: '',
|
|
|
@@ -825,10 +929,19 @@
|
|
|
requireDeptName: '',
|
|
|
type: '', //1=销售合同 2=采购合同
|
|
|
typeName: '',
|
|
|
- fileId: [] //附件集合
|
|
|
+ fileId: [], //附件集合
|
|
|
+ issueNumber: 1,
|
|
|
+ transactionMode: 1,
|
|
|
+ deliveryMode: 1,
|
|
|
+ receiptDate: 1,
|
|
|
+ settlementDate: [],
|
|
|
+ endSettlementDate: '',
|
|
|
+ startSettlementDate: ''
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
+ shippingModeOp,
|
|
|
+ transactionMethodsOp,
|
|
|
fullscreen: false,
|
|
|
requirementSourceType,
|
|
|
cacheKeyUrl: 'eos-contractManage-contractBook-inventoryTabl',
|
|
|
@@ -932,6 +1045,9 @@
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
+ shippingModeOptions() {
|
|
|
+ return this.form.type == 2 ? shippingModePurchaseOp : shippingModeOp;
|
|
|
+ },
|
|
|
rules() {
|
|
|
let isRequired = this.isRequired;
|
|
|
return {
|
|
|
@@ -1037,7 +1153,8 @@
|
|
|
setDiscountTotalPrice(val) {
|
|
|
this.form.discountTotalPrice = val;
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.paymentListTable.setDiscountAmount(val);
|
|
|
+ // this.$refs.paymentListTable.setDiscountAmount(val);
|
|
|
+ this.$refs.paymentCollectionPlanRef.setDiscountAmount(val);
|
|
|
});
|
|
|
},
|
|
|
// 获取公司数据
|
|
|
@@ -1152,6 +1269,9 @@
|
|
|
this.$set(this.form, 'contractNumber', '');
|
|
|
}
|
|
|
},
|
|
|
+ setIssueNumber(len) {
|
|
|
+ this.form.issueNumber = len;
|
|
|
+ },
|
|
|
//获取详情
|
|
|
async getDetailData(id) {
|
|
|
this.businessId = id;
|
|
|
@@ -1159,6 +1279,7 @@
|
|
|
this.loading = true;
|
|
|
const data = await getDetail(id);
|
|
|
let { contractVO } = data;
|
|
|
+ contractVO.settlementDate = contractVO.startSettlementDate ? [contractVO.startSettlementDate, contractVO.endSettlementDate] : [];
|
|
|
this.form = contractVO;
|
|
|
|
|
|
this.loading = false;
|
|
|
@@ -1176,14 +1297,20 @@
|
|
|
|
|
|
this.$refs.inventoryTable &&
|
|
|
this.$refs.inventoryTable.putTableValue(data);
|
|
|
- this.$refs.paymentListTable &&
|
|
|
- this.$refs.paymentListTable.putTableValue(
|
|
|
- data.receiptPaymentList
|
|
|
- );
|
|
|
- this.$refs.paymentListTable &&
|
|
|
- this.$refs.paymentListTable.setDiscountAmount(
|
|
|
- contractVO.discountTotalPrice
|
|
|
- );
|
|
|
+ // this.$refs.paymentListTable &&
|
|
|
+ // this.$refs.paymentListTable.putTableValue(
|
|
|
+ // data.receiptPaymentList
|
|
|
+ // );
|
|
|
+ // this.$refs.paymentListTable &&
|
|
|
+ // this.$refs.paymentListTable.setDiscountAmount(
|
|
|
+ // contractVO.discountTotalPrice
|
|
|
+ // );
|
|
|
+
|
|
|
+ const receiptData = {
|
|
|
+ receiptPaymentList: data.receiptPaymentList,
|
|
|
+ payAmount: contractVO.discountTotalPrice
|
|
|
+ }
|
|
|
+ this.$refs.paymentCollectionPlanRef && this.$refs.paymentCollectionPlanRef.putTableValue(receiptData);
|
|
|
this.$refs.rawDetailListRef &&
|
|
|
this.$refs.rawDetailListRef.putTableValueNew(contractVO.rawList); //原料
|
|
|
this.$refs.outputDetailListRef &&
|
|
|
@@ -1221,8 +1348,9 @@
|
|
|
|
|
|
//选择合同类型
|
|
|
dictChange(val, type) {
|
|
|
+ console.log('val~~~', val);
|
|
|
this.categoryList = copyObj(
|
|
|
- this.contractBookTypeList.find((item) => item.code == val).children
|
|
|
+ this.contractBookTypeList?.find((item) => item.code == val)?.children
|
|
|
);
|
|
|
if (type == 'init') {
|
|
|
return;
|
|
|
@@ -1230,7 +1358,7 @@
|
|
|
let typeName = '';
|
|
|
if (val)
|
|
|
typeName =
|
|
|
- this.contractBookTypeList.find((item) => item.code == val)?.name ||
|
|
|
+ this.contractBookTypeList?.find((item) => item.code == val)?.name ||
|
|
|
'';
|
|
|
this.form = Object.assign({}, this.form, {
|
|
|
typeName: typeName || val.dictValue,
|
|
|
@@ -1265,8 +1393,18 @@
|
|
|
businessDeptName: this.form.type == 2 ? this.companyInfo.name : '',
|
|
|
businessUserId: this.form.type == 2 ? this.$store.state.user.info?.id : '',
|
|
|
businessUserName: this.form.type == 2 ? this.$store.state.user.info?.name : '',
|
|
|
+ transactionMode: 1,
|
|
|
+ settlementDate: [],
|
|
|
+ issueNumber: 1,
|
|
|
+ deliveryMode: 1,
|
|
|
+ receiptDate: 1,
|
|
|
+ endSettlementDate: '',
|
|
|
+ startSettlementDate: ''
|
|
|
});
|
|
|
- this.getBusinessUser(this.form.businessDeptId)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.getBusinessUser(this.form.businessDeptId)
|
|
|
+ })
|
|
|
+
|
|
|
console.log('form~~~', this.form);
|
|
|
this.getEnterprise();
|
|
|
this.changePersonel();
|
|
|
@@ -1344,6 +1482,32 @@
|
|
|
this.form[keyArr[4]] || this.enterprisePage[0].address;
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ // 交易方式改变
|
|
|
+ transactionModeChange(v) {
|
|
|
+
|
|
|
+ },
|
|
|
+ // 配送方式改变
|
|
|
+ deliveryModeChange(v) {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ // 结算方式改变
|
|
|
+ settlementModeChange(v) {
|
|
|
+ console.log('v~~~', v.dictCode);
|
|
|
+ this.form.settlementModeName = v.dictValue;
|
|
|
+ // this.$set(this.form, 'issueNumber', 1);
|
|
|
+ this.$set(this.form, 'settlementDate', []);
|
|
|
+ this.$set(this.form, 'receiptDate', 1);
|
|
|
+
|
|
|
+ if(v.dictCode == 3) {
|
|
|
+ this.$set(this.form, 'issueNumber', 2);
|
|
|
+ } else {
|
|
|
+ this.$set(this.form, 'issueNumber', 1);
|
|
|
+ }
|
|
|
+ this.$refs.paymentCollectionPlanRef.defaultList(v.dictCode, this.form.issueNumber);
|
|
|
+ },
|
|
|
+
|
|
|
//选择合同分类
|
|
|
// treeChange(val) {
|
|
|
// //这里eladmin组件有bug,要手动验证下
|
|
|
@@ -1475,6 +1639,7 @@
|
|
|
},
|
|
|
|
|
|
async open(type, row, create = false, source) {
|
|
|
+ console.log('row~~~', row)
|
|
|
this.title = type === 'add' ? '新增' : '修改';
|
|
|
this.activeName = '1';
|
|
|
this.row = row;
|
|
|
@@ -1482,7 +1647,7 @@
|
|
|
this.create = create;
|
|
|
this.source = source;
|
|
|
this.contractBookTypeList = copyObj(this.categoryTreeList[0].children);
|
|
|
-
|
|
|
+ console.log('contractBookTypeList!!!', this.contractBookTypeList)
|
|
|
if (type == 'add') {
|
|
|
let userInfo = this.$store.getters.user.info;
|
|
|
this.isUpdate = false;
|
|
|
@@ -1506,9 +1671,13 @@
|
|
|
}
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.paymentListTable.defaultList();
|
|
|
+ // this.$refs.paymentListTable.defaultList();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.issueNumberChange(this.form.issueNumber);
|
|
|
+ })
|
|
|
});
|
|
|
if (this.curNodeData?.id) {
|
|
|
+ console.log('44444444', this.curNodeData)
|
|
|
this.form.type =
|
|
|
this.curNodeData.parentCode || this.curNodeData.code;
|
|
|
this.dictChange(this.form.type);
|
|
|
@@ -1570,7 +1739,14 @@
|
|
|
contractVO.contractStartDate || this.form.contractStartDate,
|
|
|
contractEndDate:
|
|
|
contractVO.contractEndDate || this.form.contractEndDate,
|
|
|
- pricingWay: 1
|
|
|
+ pricingWay: 1,
|
|
|
+ transactionMode: contractVO.transactionMode || this.form.transactionMode,
|
|
|
+ settlementDate: contractVO.settlementDate || this.form.settlementDate,
|
|
|
+ issueNumber: contractVO.issueNumber || this.form.issueNumber,
|
|
|
+ deliveryMode: contractVO.deliveryMode || this.form.deliveryMode,
|
|
|
+ receiptDate: contractVO.receiptDate || this.form.receiptDate,
|
|
|
+ endSettlementDate: contractVO.endSettlementDate || this.form.endSettlementDate,
|
|
|
+ startSettlementDate: contractVO.startSettlementDate || this.form.startSettlementDate
|
|
|
};
|
|
|
|
|
|
row.productList = row.productList.map((item) => {
|
|
|
@@ -1591,12 +1767,17 @@
|
|
|
|
|
|
this.form = contractVO;
|
|
|
this.form.HJQD = this.form.partbName;
|
|
|
+ this.issueNumberChange(this.form.issueNumber)
|
|
|
this.$refs.inventoryTable &&
|
|
|
this.$refs.inventoryTable.putTableValue(row);
|
|
|
- this.$refs.paymentListTable &&
|
|
|
- this.$refs.paymentListTable.putTableValue(row.receiptPaymentList);
|
|
|
- this.$refs.paymentListTable &&
|
|
|
- this.$refs.paymentListTable.setDiscountAmount(
|
|
|
+ // const receiptData = {
|
|
|
+ // receiptPaymentList: row.receiptPaymentList,
|
|
|
+ // payAmount: contractVO.discountTotalPrice
|
|
|
+ // }
|
|
|
+ // this.$refs.paymentCollectionPlanRef &&
|
|
|
+ // this.$refs.paymentCollectionPlanRef.putTableValue(receiptData);
|
|
|
+ this.$refs.paymentCollectionPlanRef &&
|
|
|
+ this.$refs.paymentCollectionPlanRef.setDiscountAmount(
|
|
|
contractVO.discountTotalPrice
|
|
|
);
|
|
|
this.getEnterprise();
|
|
|
@@ -1699,8 +1880,17 @@
|
|
|
}
|
|
|
});
|
|
|
}),
|
|
|
+ // new Promise((resolve, reject) => {
|
|
|
+ // this.$refs.paymentListTable.validateForm((valid) => {
|
|
|
+ // if (!valid) {
|
|
|
+ // reject(false);
|
|
|
+ // } else {
|
|
|
+ // resolve(true);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }),
|
|
|
new Promise((resolve, reject) => {
|
|
|
- this.$refs.paymentListTable.validateForm((valid) => {
|
|
|
+ this.$refs.paymentCollectionPlanRef.validateForm((valid) => {
|
|
|
if (!valid) {
|
|
|
reject(false);
|
|
|
} else {
|
|
|
@@ -1753,16 +1943,33 @@
|
|
|
let commitData = Object.assign(
|
|
|
{},
|
|
|
{
|
|
|
- contract: this.form,
|
|
|
+ contract: {
|
|
|
+ ...this.form,
|
|
|
+ endSettlementDate: this.form.settlementDate.length ?this.form.settlementDate[1] : '',
|
|
|
+ startSettlementDate: this.form.settlementDate.length ? this.form.settlementDate[0] : ''
|
|
|
+ },
|
|
|
productList: [
|
|
|
...this.$refs.inventoryTable.getTableValue(),
|
|
|
...rawDetailList,
|
|
|
...outputDetailList
|
|
|
],
|
|
|
- receiptPaymentList: this.$refs.paymentListTable.getTableValue()
|
|
|
+ receiptPaymentList: this.$refs.paymentCollectionPlanRef.getTableValue()
|
|
|
}
|
|
|
);
|
|
|
|
|
|
+ const receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
|
|
|
+ console.log('receiptPaymentListSum~~~', receiptPaymentListSum, commitData.contract.discountTotalPrice)
|
|
|
+ if(+receiptPaymentListSum != +commitData.contract.discountTotalPrice){
|
|
|
+ this.$message.error('计划收款金额合计与优惠后金额不一致');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
|
|
|
+ if(+ratioSum != 100){
|
|
|
+ this.$message.error('比例合计必须为100%');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// commitData.productList.forEach((item) => {
|
|
|
// if (!item.productCode) {
|
|
|
// isTemporary.push(item.productName);
|
|
|
@@ -2139,7 +2346,107 @@
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
- }
|
|
|
+ },
|
|
|
+ // 日期范围变化
|
|
|
+ settlementDateChange(val) {
|
|
|
+ console.log(val, this.form.settlementDate);
|
|
|
+ let dateRange = [];
|
|
|
+ if(this.form.settlementMode == 1) {
|
|
|
+ // // this.transformDays(val)
|
|
|
+ dateRange = this.transformDaysFun(val);
|
|
|
+ }
|
|
|
+ if(this.form.settlementMode == 2) {
|
|
|
+ // // this.transformMonth(val)
|
|
|
+ dateRange = this.transformMonthFun(val, this.form.receiptDate);
|
|
|
+ }
|
|
|
+ // console.log('dateRange~~~', dateRange);
|
|
|
+ this.$set(this.form, 'issueNumber', dateRange.length);
|
|
|
+ // this.setDefaultList(dateRange)
|
|
|
+ this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);
|
|
|
+ },
|
|
|
+ // 收款日变化
|
|
|
+ receiptDateChange(v) {
|
|
|
+ console.log('v~~~', v, this.form.settlementDate, this.form.issueNumber);
|
|
|
+ // this.transformMonth(this.form.settlementDate)
|
|
|
+ if(this.form.settlementDate.length > 0 && this.form.issueNumber) {
|
|
|
+ const dateRange = this.transformMonthFun(this.form.settlementDate, v);
|
|
|
+ this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 期数变化
|
|
|
+ issueNumberChange(v) {
|
|
|
+ let dateRange = [];
|
|
|
+ if(this.form.settlementMode == 1) {
|
|
|
+ dateRange = this.transformDaysFun(this.form.settlementDate, v);
|
|
|
+ this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v, dateRange);
|
|
|
+ } else if(this.form.settlementMode == 2) {
|
|
|
+ dateRange = this.transformMonthFun(this.form.settlementDate, v);
|
|
|
+ this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v, dateRange);
|
|
|
+ } else {
|
|
|
+ this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ transformDaysFun(date) {
|
|
|
+ const startDate = new Date(date[0]);
|
|
|
+ const endDate = new Date(date[1]);
|
|
|
+ // 计算毫秒差并转换为天数,使用Math.ceil确保结果为整数
|
|
|
+ const days = Math.ceil((endDate - startDate) / (1000 * 60 * 60 * 24)) + 1;
|
|
|
+ console.log('包含两头的天数:', days);
|
|
|
+
|
|
|
+ // 生成包括头尾在内的所有日期
|
|
|
+ const allDates = [];
|
|
|
+ const current = new Date(startDate);
|
|
|
+
|
|
|
+ // 遍历从开始日期到结束日期的所有天数
|
|
|
+ while (current <= endDate) {
|
|
|
+ // 格式化日期为YYYY-MM-dd
|
|
|
+ const year = current.getFullYear();
|
|
|
+ const month = current.getMonth() + 1; // 月份从0开始,需要+1
|
|
|
+ const day = current.getDate();
|
|
|
+
|
|
|
+ const formattedMonth = String(month).padStart(2, '0');
|
|
|
+ const formattedDay = String(day).padStart(2, '0');
|
|
|
+ const formattedDateStr = `${year}-${formattedMonth}-${formattedDay}`;
|
|
|
+
|
|
|
+ allDates.push(formattedDateStr);
|
|
|
+
|
|
|
+ // 移动到下一天
|
|
|
+ current.setDate(current.getDate() + 1);
|
|
|
+ }
|
|
|
+ return allDates;
|
|
|
+ },
|
|
|
+ transformMonthFun(date, day) {
|
|
|
+ console.log('date~~~', date, day);
|
|
|
+ // 处理月份数据(转换为Date对象)
|
|
|
+ const parseMonthDate = (dateStr) => {
|
|
|
+ return dateStr instanceof Date ? dateStr : new Date(dateStr + '-01');
|
|
|
+ };
|
|
|
+
|
|
|
+ const start = parseMonthDate(date[0]);
|
|
|
+ const end = parseMonthDate(date[1]);
|
|
|
+
|
|
|
+ // 先生成所有月份的日期数组
|
|
|
+ const allMonthDates = [];
|
|
|
+ const currentDate = new Date(start);
|
|
|
+
|
|
|
+ // 遍历从开始月份到结束月份的所有月份
|
|
|
+ while (currentDate <= end) {
|
|
|
+ const year = currentDate.getFullYear();
|
|
|
+ const month = currentDate.getMonth() + 1; // 月份从0开始,需要+1
|
|
|
+ const receiptDate = day;
|
|
|
+
|
|
|
+ // 格式化日期为YYYY-MM-dd
|
|
|
+ const formattedMonth = String(month).padStart(2, '0');
|
|
|
+ const formattedDate = String(receiptDate).padStart(2, '0');
|
|
|
+ const deadLine = receiptDate ? `${year}-${formattedMonth}-${formattedDate}` : '';
|
|
|
+
|
|
|
+ allMonthDates.push(deadLine);
|
|
|
+
|
|
|
+ // 使用Date对象的setMonth方法正确移动到下一个月(自动处理年份变化)
|
|
|
+ currentDate.setMonth(currentDate.getMonth() + 1);
|
|
|
+ }
|
|
|
+ return allMonthDates;
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|