This commit is contained in:
gyq
2025-09-26 14:21:51 +08:00
parent 56436617f9
commit c0f250789d
3 changed files with 21 additions and 4 deletions

View File

@@ -41,8 +41,7 @@
<view class="time">
<view class="row">
<text class="t">
有效期至{{ 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') }}
</text>
</view>
</view>
@@ -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;