diff --git a/components/coupon-modal.vue b/components/coupon-modal.vue index da316d8..06bfde7 100644 --- a/components/coupon-modal.vue +++ b/components/coupon-modal.vue @@ -41,8 +41,7 @@ - 有效期至:{{ dayjs(item.validStartTime || new Date()).format('YYYY.M.D') }} - - {{ dayjs(item.validEndTime || new Date()).format('YYYY.M.D') }} + 有效期至:{{ dayjs(val.validStartTime).format('YYYY.M.D') }}-{{ dayjs(val.validEndTime).format('YYYY.M.D') }} @@ -109,9 +108,20 @@ async function getCouponPopupAjax() { try { const res = await getCouponPopup({ getMode: props.getMode }); if (res.length) { + res.map((item) => { + if (item.validType == 'fixed') { + item.validStartTime = dayjs().add(item.daysToTakeEffect, 'day').format('YYYY-MM-DD HH:mm:ss'); + item.validEndTime = dayjs() + .add(+item.daysToTakeEffect + +item.validDays, 'day') + .format('YYYY-MM-DD HH:mm:ss'); + } + }); + + console.log('res===', res); show.value = true; couponCount.value = res.length; couponList.value = _.chunk(res, 3); + console.log('couponList.value===', couponList.value); } } catch (error) { console.log(error); @@ -152,7 +162,6 @@ onMounted(() => { display: flex; align-items: center; justify-content: center; - padding-top: 10vh; .content { width: 94vw; position: relative; @@ -209,6 +218,7 @@ onMounted(() => { flex-direction: column; justify-content: space-between; gap: 8upx; + padding-right: 20upx; .name { font-size: 32upx; font-weight: bold; diff --git a/pages/index/index.vue b/pages/index/index.vue index 18632b3..5af1803 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -126,10 +126,12 @@ --> +