From 288bcbc078a540f0d42e33e7ec66924a8b7536a8 Mon Sep 17 00:00:00 2001 From: bb_pan Date: Sat, 8 Feb 2025 16:50:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/index.vue | 19 ++++++++++++++++++- src/pages/index/index.vue | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pages/cart/index.vue b/src/pages/cart/index.vue index 82d28aa..136162b 100644 --- a/src/pages/cart/index.vue +++ b/src/pages/cart/index.vue @@ -405,6 +405,23 @@ const onSelectTime = (type, index, goodsI) => { } const onConfirm = () => { if (timeType.value === 1) { + if ( + cartList.value[activeIndex.value].devInfoVoList[goodsIndex.value].rentEndTime && + moment(leaseTime.value.join('-')).isAfter( + moment( + cartList.value[activeIndex.value].devInfoVoList[goodsIndex.value].rentEndTime, + ), + ) + ) { + showFailToast('租赁开始日期不能晚于租赁结束日期') + return + } + // 清除结束日期 + cartList.value[activeIndex.value].devInfoVoList[goodsIndex.value].rentEndTime = '' + // 清除天数 + cartList.value[activeIndex.value].devInfoVoList[goodsIndex.value].days = 0 + // 清除费用 + cartList.value[activeIndex.value].devInfoVoList[goodsIndex.value].costs = 0 cartList.value[activeIndex.value].devInfoVoList[goodsIndex.value].rentBeginTime = leaseTime.value.join('-') } else { @@ -415,7 +432,7 @@ const onConfirm = () => { ), ) ) { - showFailToast('租赁结束日期不能小于租赁开始日期') + showFailToast('租赁结束日期不能早于租赁开始日期') return } else { cartList.value[activeIndex.value].devInfoVoList[goodsIndex.value].rentEndTime = diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 6116ac7..4e43440 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -116,6 +116,7 @@ +