fix: 预售商品时间问题
This commit is contained in:
parent
ee68f341a1
commit
adb0cb4f2c
|
@ -54,7 +54,7 @@
|
||||||
></el-col>
|
></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="预计发货时间:"
|
label="可预约发货时间:"
|
||||||
prop="estimatedStartDeliveryTime"
|
prop="estimatedStartDeliveryTime"
|
||||||
>
|
>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -67,9 +67,10 @@
|
||||||
range-separator="至"
|
range-separator="至"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
:picker-options="pickerOptions"
|
:picker-options="pickerOptions3"
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
|
<div style="color: red;">顾客支付定金时、可对此区间的日期进行预约,卖家须在顾客已选预约日进行发货</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="定金可退:" prop="isRefundEarnestMoney">
|
<el-form-item label="定金可退:" prop="isRefundEarnestMoney">
|
||||||
<el-radio v-model="ruleForm.isRefundEarnestMoney" :label="1"
|
<el-radio v-model="ruleForm.isRefundEarnestMoney" :label="1"
|
||||||
|
@ -378,6 +379,7 @@
|
||||||
<script>
|
<script>
|
||||||
import commodity from './commodity.vue'
|
import commodity from './commodity.vue'
|
||||||
import { debounce, cloneDeep } from 'lodash'
|
import { debounce, cloneDeep } from 'lodash'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
export default {
|
export default {
|
||||||
components: { commodity },
|
components: { commodity },
|
||||||
props: {
|
props: {
|
||||||
|
@ -408,7 +410,7 @@ export default {
|
||||||
},
|
},
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
return time.getTime() < Date.now()
|
return time.getTime() <= dayjs().subtract(1, 'day').valueOf()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
orderTime: [], //订单支付时间
|
orderTime: [], //订单支付时间
|
||||||
|
@ -420,7 +422,17 @@ export default {
|
||||||
console.log(that.ruleForm.startTime)
|
console.log(that.ruleForm.startTime)
|
||||||
date = new Date(that.ruleForm.startTime).getTime()
|
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: [], //发货时间
|
delivery: [], //发货时间
|
||||||
|
@ -630,6 +642,10 @@ export default {
|
||||||
this.$refs.ruleForm.validate(valid => {
|
this.$refs.ruleForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
console.log(valid)
|
console.log(valid)
|
||||||
|
if (dayjs(this.ruleForm.startTime).isAfter(dayjs(this.ruleForm.balancePaymentStartTime))) {
|
||||||
|
this.$message.error('付尾款开始时间必须大于等于定金开始时间')
|
||||||
|
return
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
this.ruleForm.productList &&
|
this.ruleForm.productList &&
|
||||||
this.ruleForm.productList.length === 0
|
this.ruleForm.productList.length === 0
|
||||||
|
@ -638,6 +654,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let pass = true
|
let pass = true
|
||||||
|
let moneyPass = true
|
||||||
let count = 0
|
let count = 0
|
||||||
this.ruleForm.productList.forEach(product => {
|
this.ruleForm.productList.forEach(product => {
|
||||||
if (
|
if (
|
||||||
|
@ -660,6 +677,9 @@ export default {
|
||||||
if (!spec.advanceSellStockNum) {
|
if (!spec.advanceSellStockNum) {
|
||||||
pass = false
|
pass = false
|
||||||
}
|
}
|
||||||
|
if (spec.presalePrice >= spec.earnestMoney) {
|
||||||
|
moneyPass = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -672,6 +692,10 @@ export default {
|
||||||
this.$message.error('请填写预售价、定金、预售库存')
|
this.$message.error('请填写预售价、定金、预售库存')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!moneyPass) {
|
||||||
|
this.$message.error('定金必须小于预售价')
|
||||||
|
return
|
||||||
|
}
|
||||||
this.$api.preSale
|
this.$api.preSale
|
||||||
.addPreSaleProducts(this.ruleForm)
|
.addPreSaleProducts(this.ruleForm)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
@ -683,6 +707,10 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$refs.ruleForm.validate(valid => {
|
this.$refs.ruleForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
if (dayjs(this.ruleForm.startTime).isAfter(dayjs(this.ruleForm.balancePaymentStartTime))) {
|
||||||
|
this.$message.error('付尾款开始时间必须大于等于定金开始时间')
|
||||||
|
return
|
||||||
|
}
|
||||||
console.log(valid)
|
console.log(valid)
|
||||||
if (
|
if (
|
||||||
this.ruleForm.productSpecificationList &&
|
this.ruleForm.productSpecificationList &&
|
||||||
|
@ -692,6 +720,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let pass = true
|
let pass = true
|
||||||
|
let moneyPass = true
|
||||||
let count = this.ruleForm.productSpecificationList.filter(
|
let count = this.ruleForm.productSpecificationList.filter(
|
||||||
spec => spec.isAdvanceSell
|
spec => spec.isAdvanceSell
|
||||||
).length
|
).length
|
||||||
|
@ -706,6 +735,9 @@ export default {
|
||||||
if (!spec.advanceSellStockNum) {
|
if (!spec.advanceSellStockNum) {
|
||||||
pass = false
|
pass = false
|
||||||
}
|
}
|
||||||
|
if (spec.presalePrice >= spec.earnestMoney) {
|
||||||
|
moneyPass = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!count) {
|
if (!count) {
|
||||||
|
@ -716,6 +748,10 @@ export default {
|
||||||
this.$message.error('请填写预售价、定金、预售库存')
|
this.$message.error('请填写预售价、定金、预售库存')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!moneyPass) {
|
||||||
|
this.$message.error('定金必须小于预售价')
|
||||||
|
return
|
||||||
|
}
|
||||||
this.$api.preSale
|
this.$api.preSale
|
||||||
.updatePreSaleProducts(this.ruleForm)
|
.updatePreSaleProducts(this.ruleForm)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
Loading…
Reference in New Issue