团购已结束,未开始显示处理

订单待支付数量显示
This commit is contained in:
2024-04-16 16:52:20 +08:00
parent 32aa0eb971
commit b87c8e8292
6 changed files with 58 additions and 15 deletions

View File

@@ -19,7 +19,7 @@
<text>{{ groupBuyBean?.payPrice || 0 }}</text>
<text>{{ groupBuyBean?.price || 0 }}</text>
</view>
<view class='countdown-time c-flex-column'>
<view v-if='isPending()' class='countdown-time c-flex-column'>
<view class='c-flex-row'>{{ countdownTime?.days || 0 }}
<text class='time'>{{ countdownTime?.hours || '00' }}</text>
:
@@ -29,6 +29,11 @@
</view>
<text>距离活动结束仅剩</text>
</view>
<view v-else>
<text style='font-size: 35rpx;color: #FFFFFF'>
{{ isNotStated() ? '未开始' : '已结束' }}
</text>
</view>
</view>
<view class='goods-info-view c-flex-column'>
@@ -38,7 +43,7 @@
</view>
<view class='c-flex-row'>
<text style='flex: 1'>{{ groupBuyBean?.name }}</text>
<text style='flex: 1'>{{ groupBuyBean?.name || '未知' }}</text>
<view class='share-button c-flex-column'>
<image :src='assetsUrl("ic_share.png")'></image>
<button class='btn' plain open-type='share'>分享</button>
@@ -55,14 +60,14 @@
</view>
</view>
<view class='recommend-view c-flex-column' v-if='recommendList?.length>0'>
<view class='recommend-view c-flex-column' v-if='(recommendList?.length||0)>0'>
<text>浏览此商品的客户还浏览了</text>
<scroll-view scroll-x>
<view style='display: inline-block' v-for='(item, index) in recommendList'
:key='index'>
<view class='recommend-item c-flex-column'>
<image :src='item.images' />
<text>{{ item.goodsName }}</text>
<image :src='item.images||defaultImage' />
<text>{{ item.goodsName || '未知' }}</text>
<text class='goods-price'>{{ item.price }}</text>
</view>
</view>
@@ -122,7 +127,10 @@
</view>
<view class='bottom-view c-flex-row'>
<view class='place-order-button' @click.stop='placeOrder'>跟团购买</view>
<button v-if='isPending()' class='place-order-button' @click.stop='placeOrder'>跟团购买</button>
<button v-else class='place-order-button-disable' :plain='true' :disabled='true'>
{{ isNotStated() ? '即将开始' : '已结束' }}
</button>
</view>
</view>
<sku-dialog ref='skuDialogRef' :flash-price='Number(groupBuyBean?.payPrice) || 0' />
@@ -181,6 +189,19 @@ onUnload(() => {
}
});
const isNotStated = () => {
return dayjs(groupBuyBean.value?.startDate).isAfter(Date.now());
};
const isPending = () => {
return dayjs(groupBuyBean.value?.startDate).isBefore(Date.now()) && dayjs(groupBuyBean.value?.endDate).isAfter(Date.now());
;
};
const isEnded = () => {
return dayjs(groupBuyBean.value?.endDate).isBefore(Date.now());
};
const getStockColorCount = computed(() => {
const list = Array.from(new Set(groupBuyBean.value?.goods?.stocks?.map(item => item.colorName)))
.map(colorName => groupBuyBean.value?.goods?.stocks?.find(item => item.colorName === colorName)!);
@@ -194,7 +215,7 @@ const fetchRecommendList = async () => {
pageSize: 20,
bean: {
keyword: '',
typeIds: ['1724629185362591745']
typeIds: []
}
}
});
@@ -550,6 +571,13 @@ const placeOrder = async () => {
background: #F32B2B;
color: #FFFFFF;
border-radius: 40rpx;
border: none;
}
.place-order-button-disable {
@extend .place-order-button;
background: #b9b5b5;
color: #FFFFFF;
}
}

View File

@@ -19,7 +19,7 @@
<image :src='assetsUrl("ic_decline.png")' />
<text>直降¥{{ (item.price - item.payPrice).toFixed(2) }}</text>
</view>
<text>即将恢复</text>
<text>{{ tabIndex == 0 ? '即将恢复' : '即将开始'}}</text>
</view>
<view class='bottom-price c-flex-row' :class='{"bottom-price-disabled":tabIndex==1}'>
<text>{{ item.payPrice }}</text>