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

订单待支付数量显示
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>

View File

@@ -6,7 +6,7 @@
1.长按识别下方二维码添加店铺福利群
</text>
<view class='divider' style='margin-top: 28rpx' />
<image :src=' companyConfigInfo.regqrcode' show-menu-by-longpress />
<image :src=' companyConfigInfo.groupqrcode' show-menu-by-longpress />
<text class='step-title'>
2.识别店铺福利群发您的二维码即可入群
</text>

View File

@@ -26,7 +26,7 @@
<view class='c-flex-row'>
<text style='flex: 1'>{{ goodsBean?.name }}</text>
<view class='share-button c-flex-column'>
<view class='share-button'>
<image :src='assetsUrl("ic_share.png")'></image>
<button class='btn' plain open-type='share'>分享</button>
</view>
@@ -56,8 +56,8 @@
<view class='recommend-item c-flex-column'>
<image :src='item.images||defaultImage' />
<text>{{ item.goodsName || '未知' }}</text>
<text class='goods-price'>{{ (item.price * ((userInfo.levelEntity.discount || 100) / 100)).toFixed(2) }}
<text v-if='userInfo.levelEntity.discount>0'
<text class='goods-price'>{{ (item.price * ((userInfo.levelEntity?.discount || 100) / 100)).toFixed(2) }}
<text v-if='userInfo.levelEntity?.discount>0'
style='text-decoration: line-through;font-size: 25rpx;color: #999999'>{{ item.price }}
</text>
</text>
@@ -175,7 +175,6 @@ const addShoppingCart = () => {
const placeOrder = () => {
showSkuDialog((e: GoodsBean) => {
console.log(e);
const orderBean = {
totalPrice: (e.consumePrice * e.checkedStock.count).toFixed(2),
orderGoods: [e]
@@ -264,6 +263,8 @@ const placeOrder = () => {
}
.share-button {
display: flex;
flex-direction: column;
align-items: center;
image {

View File

@@ -45,7 +45,7 @@
<view v-for='(item,index) in orderActionList' :key='index' @click.stop='gotoPath(item.path)'>
<image :src='item.icon' />
<text>{{ item.title }}</text>
<text v-if='index==0&&userInfo?.orderNum>0'>{{ userInfo?.orderNum }}</text>
<text v-if='index==0&&unPaidOrderCount>0'>{{ unPaidOrderCount }}</text>
</view>
</view>
@@ -67,6 +67,8 @@
<script setup lang='ts'>
import { assetsUrl, defaultAvatar } from '@/utils/assets';
import { goLogin, goPath, isLogin } from '@/utils';
import { isPending } from '@/utils/order';
import { getOrderList } from '@/api/order';
import OfficialAccountDialog from '@/components/official-account-dialog.vue';
import { useUserStore } from '@/store';
@@ -124,6 +126,8 @@ title.value = import.meta.env.VITE_APP_TITLE;
const store = useUserStore();
const { userInfo, companyConfigInfo } = storeToRefs(store);
const unPaidOrderCount = ref(0);
onLoad(() => {
if(!isLogin()) {
goLogin();
@@ -131,6 +135,15 @@ onLoad(() => {
}
});
onShow(async () => {
const { list } = await getOrderList({
pageNum: 1,
pageSize: 9999,
obj: { payStatus: 1 }
});
unPaidOrderCount.value = list.filter((item: any) => isPending(item))?.length || 0;
});
const gotoPath = (path: string) => {
if(path === 'follow_official_account') {
showOfficialAccountDialog();

View File

@@ -16,7 +16,8 @@ const useUserStore = defineStore('user', {
goodsstockzero: 0,
mallopen: 0,
regqrcode: undefined,
userbgcover: undefined
userbgcover: undefined,
groupqrcode: undefined
},
deliveryAddress: {
addrid: '',