From ed5f152af2e247e1b7b1e713af919dcc1a524766 Mon Sep 17 00:00:00 2001
From: xy <271556543@qq.com>
Date: Wed, 31 Jan 2024 17:34:53 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=E4=BB=98?=
=?UTF-8?q?=E6=AC=BE=E8=AE=A1=E5=88=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../contract/components/contractSign.vue | 150 +++++++++++++++++-
.../finance/components/addPropertyPlan.vue | 33 ++++
2 files changed, 181 insertions(+), 2 deletions(-)
diff --git a/src/views/contract/components/contractSign.vue b/src/views/contract/components/contractSign.vue
index 4626353..ed8851c 100644
--- a/src/views/contract/components/contractSign.vue
+++ b/src/views/contract/components/contractSign.vue
@@ -46,7 +46,7 @@
*合同金额
-
+
@@ -57,7 +57,7 @@
+ range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="dateRangePick">
@@ -142,6 +142,7 @@
+
+
+
+
+
合同总金额
+
{{ form.money }}
+
+
+
+
+
+
+
+
+
+
生成付款日期
+
+
{{ planMonthLists }}
+
+
+
+
+
+
+
+
+
@@ -235,6 +274,51 @@
},
data() {
return {
+ isShowAddManyPlan: false,
+ manySetting: {
+ day: 1,
+ lastMonth: 1,
+ startMonth: ''
+ },
+ manyForm: [],
+ manyTable: [
+ {
+ prop: "date",
+ label: "付款日期",
+ width: 160,
+ customFn:row => {
+ return (
+
+ )
+ }
+ },
+ {
+ prop: "money",
+ label: "金额",
+ width: 180,
+ customFn:row => {
+ return (
+
+ )
+ }
+ },
+ {
+ prop: "operate",
+ label: "操作",
+ customFn:(row,{ $index }) => {
+ return (
+
+ )
+ }
+ }
+ ],
+
form: {
number: '',
supply: '',
@@ -357,6 +441,18 @@
}
},
methods: {
+ dateRangePick (e) {
+ if (e[0] && e[1]) {
+ this.manySetting.startMonth = e[0] ? e[0] : '';
+ this.manySetting.lastMonth = this.$moment(e[1]).diff(this.$moment(e[0]),'months')
+ } else {
+ this.manySetting.startMonth = '';
+ this.manySetting.lastMonth = 1;
+ }
+
+ this.planMonthLists();
+ },
+
//合同签订
sign() {
if (this.signList.length == 0) {
@@ -367,6 +463,15 @@
return false;
}
+ const signMoneyTotal = this.signList.reduce((pre, cur) => (pre + Number(cur.money || 0)),0)
+ if (signMoneyTotal !== this.form.money) {
+ Message({
+ type: 'warning',
+ message: '付款计划总金额与合同总金额不相等~'
+ })
+ return
+ }
+
editorContract({
id: this.contractId,
number: this.form.number,
@@ -479,8 +584,38 @@
}
+ },
+
+
+ planMonthLists () {
+ const [startDate,endDate] = this.form.time;
+ const actStartDate = this.manySetting.startMonth;
+ const actStartYear = new Date(actStartDate).getFullYear();
+ const actStartMonth = new Date(actStartDate).getMonth();
+ let dates = [];
+ if (actStartDate && this.manySetting.day) {
+ let index = 0;
+ let nowDate = this.$moment(new Date(actStartYear,actStartMonth,this.manySetting.day)).add(index,'months')
+
+ while ((nowDate.valueOf() <= this.$moment(endDate).valueOf())) {
+ if (nowDate.valueOf() >= this.$moment(actStartDate).valueOf()) {
+ dates.push(nowDate.format('YYYY-MM-DD'));
+ }
+ index++;
+ nowDate = this.$moment(new Date(actStartYear,actStartMonth,this.manySetting.day)).add(index,'months');
+ }
+
+ let returnRes = dates.slice(0,this.manySetting.lastMonth)
+ this.manyForm = returnRes.map(i => ({
+ money: (Number(this.form.money || 0) / returnRes.length).toFixed(2),
+ date: i,
+ content: ""
+ }))
+ }
}
},
+ computed: {
+ },
watch: {
async contractId() {
await this.getContractSignList()
@@ -492,6 +627,17 @@