Files
suke-mp/src/pages/common/groupbuy/index.vue
2024-03-25 14:44:38 +08:00

192 lines
4.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class='content'>
<view class='tab c-flex-row'>
<text class='tab-item' :class='{"tab-item-active":tabIndex==0}' @click.stop='tabIndex=0'>团购中</text>
<text class='tab-item' :class='{"tab-item-active":tabIndex==1}' @click.stop='tabIndex=1'>即将开始</text>
</view>
<scroll-view class='scroll-view'>
<view class='c-flex-column' v-for='(item, index) in groupbuyList' :key='index'>
<view class='item c-flex-row' @click.stop='goPath("/pages/common/groupbuy/detail")'>
<image class='goods-image' :src='JSON.parse(item.content)[0].images' />
<view class='c-flex-column' style='flex: 1'>
<view class='goods-name'>{{ item.name }}</view>
<view class='middle-view c-flex-row'>
<text>原价{{ item.payPrice }}</text>
<view class='decline c-flex-row'>
<image :src='assetsUrl("ic_decline.png")' />
<text>直降{{ item.offsetPrice }}</text>
</view>
<text>即将恢复</text>
</view>
<view class='bottom-price c-flex-row' :class='{"bottom-price-disabled":tabIndex==1}'>
<text>41</text>
<text>团购</text>
</view>
</view>
</view>
<view class='divider' style='margin: 0 30rpx' />
</view>
</scroll-view>
</view>
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { getGroupBuyList } from '@/api/groupbuy';
import { goPath } from '@/utils';
const tabIndex = ref(0);
const groupbuyList = ref([]);
onLoad((e) => {
fetchData();
});
watch(() => tabIndex.value, () => {
fetchData();
});
const fetchData = async () => {
const { list } = await getGroupBuyList({
pageNum: 1,
pageSize: 100,
obj: {
status: tabIndex.value
}
});
groupbuyList.value = list;
};
</script>
<style lang='scss' scoped>
.content {
background: #F32B2B;
padding-top: 30rpx;
}
.tab {
height: 92rpx;
.tab-item:nth-of-type(1) {
border-radius: 30rpx 0 0 0;
}
.tab-item:nth-of-type(2) {
border-radius: 0 30rpx 0 0;
}
.tab-item {
display: flex;
flex: 1;
height: 100%;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 30rpx;
color: #999999;
background: #F2F2F2;
}
.tab-item-active {
@extend .tab-item;
background: #FFFFFF;
color: #333333;
}
}
.scroll-view {
background: #FFFFFF;
.item {
padding: 20rpx 30rpx 40rpx 30rpx;
background: #FFFFFF;
position: relative;
.goods-image {
width: 180rpx;
height: 180rpx;
border-radius: 10rpx;
margin-right: 20rpx;
}
.goods-name {
font-weight: bold;
font-size: 30rpx;
color: #333333;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
margin-top: 30rpx;
}
.middle-view {
justify-content: space-between;
margin-top: 16rpx;
text:nth-of-type(1) {
font-weight: bold;
font-size: 26rpx;
color: #333333;
}
.decline {
image {
width: 45rpx;
height: 45rpx;
}
text {
font-weight: bold;
font-size: 24rpx;
color: #AD6021;
}
}
text:nth-of-type(2) {
font-weight: 400;
font-size: 24rpx;
color: #AD6021;
}
}
.bottom-price {
display: flex;
width: 390rpx;
height: 83rpx;
margin-top: 20rpx;
align-self: flex-end;
background-image: url("../../../static/images/bg_groupbuy_price.png");
background-size: 100% 100%;
color: #FFFFFF;
justify-content: space-between;
text:nth-of-type(1) {
font-weight: bold;
font-size: 40rpx;
color: #FFFFFF;
margin-left: 40rpx;
margin-bottom: 5rpx;
}
text:nth-of-type(1):before {
content: "秒杀价 ¥ ";
font-size: 24rpx;
margin-bottom: 5rpx;
}
text:nth-of-type(2) {
font-weight: bold;
font-size: 30rpx;
color: #FFFFFF;
margin-right: 50rpx;
}
}
.bottom-price-disabled {
background-image: url("../../../static/images/bg_groupbuy_price_disabled.png");
}
}
}
</style>