From adb0cb4f2c1be991c341499b340ae68fa1ebb8b1 Mon Sep 17 00:00:00 2001 From: lzhizhao <790086754@qq.com> Date: Wed, 30 Apr 2025 17:44:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A2=84=E5=94=AE=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presale/products/popup/add-or-update.vue | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/views/modules/presale/products/popup/add-or-update.vue b/src/views/modules/presale/products/popup/add-or-update.vue index bfe6498..bf9c47f 100644 --- a/src/views/modules/presale/products/popup/add-or-update.vue +++ b/src/views/modules/presale/products/popup/add-or-update.vue @@ -54,7 +54,7 @@ > + 顾客支付定金时、可对此区间的日期进行预约,卖家须在顾客已选预约日进行发货 import commodity from './commodity.vue' import { debounce, cloneDeep } from 'lodash' +import dayjs from 'dayjs' export default { components: { commodity }, props: { @@ -408,7 +410,7 @@ export default { }, pickerOptions: { disabledDate(time) { - return time.getTime() < Date.now() + return time.getTime() <= dayjs().subtract(1, 'day').valueOf() } }, orderTime: [], //订单支付时间 @@ -420,7 +422,17 @@ export default { console.log(that.ruleForm.startTime) date = new Date(that.ruleForm.startTime).getTime() } - return time.getTime() < date + return time.getTime() <= dayjs(date).subtract(1, 'day').valueOf() + } + }, + pickerOptions3: { + disabledDate(time) { + let date = Date.now() + if (that.ruleForm && that.ruleForm.balancePaymentEndTime) { + console.log(that.ruleForm.balancePaymentEndTime) + date = new Date(that.ruleForm.balancePaymentEndTime).getTime() + } + return time.getTime() <= dayjs(date).valueOf() } }, delivery: [], //发货时间 @@ -630,6 +642,10 @@ export default { this.$refs.ruleForm.validate(valid => { if (valid) { console.log(valid) + if (dayjs(this.ruleForm.startTime).isAfter(dayjs(this.ruleForm.balancePaymentStartTime))) { + this.$message.error('付尾款开始时间必须大于等于定金开始时间') + return + } if ( this.ruleForm.productList && this.ruleForm.productList.length === 0 @@ -638,6 +654,7 @@ export default { return } let pass = true + let moneyPass = true let count = 0 this.ruleForm.productList.forEach(product => { if ( @@ -660,6 +677,9 @@ export default { if (!spec.advanceSellStockNum) { pass = false } + if (spec.presalePrice >= spec.earnestMoney) { + moneyPass = false + } } }) } @@ -672,6 +692,10 @@ export default { this.$message.error('请填写预售价、定金、预售库存') return } + if (!moneyPass) { + this.$message.error('定金必须小于预售价') + return + } this.$api.preSale .addPreSaleProducts(this.ruleForm) .then(res => { @@ -683,6 +707,10 @@ export default { } else { this.$refs.ruleForm.validate(valid => { if (valid) { + if (dayjs(this.ruleForm.startTime).isAfter(dayjs(this.ruleForm.balancePaymentStartTime))) { + this.$message.error('付尾款开始时间必须大于等于定金开始时间') + return + } console.log(valid) if ( this.ruleForm.productSpecificationList && @@ -692,6 +720,7 @@ export default { return } let pass = true + let moneyPass = true let count = this.ruleForm.productSpecificationList.filter( spec => spec.isAdvanceSell ).length @@ -706,6 +735,9 @@ export default { if (!spec.advanceSellStockNum) { pass = false } + if (spec.presalePrice >= spec.earnestMoney) { + moneyPass = false + } } }) if (!count) { @@ -716,6 +748,10 @@ export default { this.$message.error('请填写预售价、定金、预售库存') return } + if (!moneyPass) { + this.$message.error('定金必须小于预售价') + return + } this.$api.preSale .updatePreSaleProducts(this.ruleForm) .then(res => {