371
pages/activity/groupon/detail.vue
普通文件
371
pages/activity/groupon/detail.vue
普通文件
@@ -0,0 +1,371 @@
|
||||
<!-- 拼团详情 -->
|
||||
<template>
|
||||
<view class="page_box">
|
||||
<!-- 商品卡片 -->
|
||||
<view class="head_box">
|
||||
<view class="goods-card u-p-x-20 u-p-y-40" v-if="grouponDetail.id">
|
||||
<shopro-mini-card
|
||||
:title="grouponDetail.goods.title"
|
||||
:image="grouponDetail.goods.image"
|
||||
:subtitle="grouponDetail.goods.subtitle"
|
||||
:price="grouponDetail.goods.groupon_price"
|
||||
:originPrice="grouponDetail.goods.original_price"
|
||||
>
|
||||
<template #describe>
|
||||
<view class="u-flex u-m-b-20">
|
||||
<view class="sell-box">
|
||||
<text class=" hot-icon iconfont icon-icon-test"></text>
|
||||
<text class="sell-num">已拼{{ grouponDetail.goods.sales }}件</text>
|
||||
</view>
|
||||
<text class="group-num">{{ grouponDetail.num || 0 }}人团</text>
|
||||
</view>
|
||||
</template>
|
||||
</shopro-mini-card>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content_box">
|
||||
<view class="u-flex-col u-row-between group-box">
|
||||
<!-- 拼团成功 -->
|
||||
<view class="u-flex u-row-center u-col-center" v-if="grouponDetail.status === 'finish' || grouponDetail.status === 'finish-fictitious'">
|
||||
<view class="tip-box u-flex" v-if="grouponDetail.my">
|
||||
<view class="u-iconfont uicon-checkmark-circle-fill u-m-r-10" style="color:#42B111;font-size:34rpx ;"></view>
|
||||
<text>恭喜您~拼团成功!</text>
|
||||
</view>
|
||||
<view class="tip-box u-flex" v-else>
|
||||
<view class="u-iconfont uicon-close-circle-fill u-m-r-10" style="color:#E1212B;font-size:34rpx ;"></view>
|
||||
<text>对不起~您来晚了,该团已满</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 拼团失败-->
|
||||
<view class="u-flex u-row-center u-col-center" v-if="grouponDetail.status === 'invalid'">
|
||||
<view class="tip-box u-flex">
|
||||
<view class="u-iconfont uicon-close-circle-fill u-m-r-10" style="color:#E1212B;font-size:34rpx ;"></view>
|
||||
<text>{{ grouponDetail.my ? '对不起~拼团已过期!已全额退款' : '对不起~拼团已过期!您来晚了~' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 拼团中 -->
|
||||
<view class="title-box u-flex u-row-center u-col-center" v-if="grouponDetail.status === 'ing'">
|
||||
<!-- 活动结束 -->
|
||||
<view class="" v-if="grouponDetail.activity_status === 'ended'">
|
||||
<view class="tip-box u-flex u-col-center">
|
||||
<view class="u-iconfont uicon-close-circle-fill u-m-r-10" style="color:#E1212B;font-size:34rpx ;"></view>
|
||||
<text>对不起~拼团活动已结束!您来晚了~</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="u-flex u-col-center">
|
||||
<view class="title-text">
|
||||
待成团,还差
|
||||
<text class="group-num">{{ grouponDetail.num - grouponDetail.current_num }}</text>
|
||||
人拼团成功
|
||||
</view>
|
||||
<view class="count-down u-flex" v-if="time">
|
||||
<text class="count-down-tip">倒计时</text>
|
||||
<view class="time-box u-flex">
|
||||
<view class="count-text">{{ time.h || '00' }}</view>
|
||||
:
|
||||
<view class="count-text">{{ time.m || '00' }}</view>
|
||||
:
|
||||
<view class="count-text">{{ time.s || '00' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 拼团人 -->
|
||||
<view class="group-people u-flex u-row-center">
|
||||
<view class="img-box" v-for="(team, index) in grouponDetail.groupon_log" :key="team.user_avatar">
|
||||
<view class="tag" v-if="index == 0">团长</view>
|
||||
<image class="avatar" :class="{ leader: index == 0 }" :src="team.user_avatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="img-box" v-for="(base, index) in surplusNum" :key="base" v-if="index < 100">
|
||||
<image class="avatar" :src="$IMG_URL + '/imgs/group/base_group_avatar.png'" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="btn-box u-flex u-row-center u-col-center">
|
||||
<!-- 拼团中 -->
|
||||
<view v-if="grouponDetail.status === 'ing'">
|
||||
<block v-if="grouponDetail.activity_status === 'ended'">
|
||||
<button class="u-reset-button btn2" v-if="grouponDetail.my" @tap.stop="jump('/pages/order/detail', { id: grouponDetail.my.order_id })">查看订单</button>
|
||||
</block>
|
||||
<block v-else>
|
||||
<button class="u-reset-button btn1" v-if="grouponDetail.my" @tap="showShare = true">邀请好友参团</button>
|
||||
<button class="u-reset-button btn1" v-else @tap="showSku = true">立即参团</button>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 拼团成功/失败-->
|
||||
<view v-if="grouponDetail.status === 'finish' || grouponDetail.status === 'finish-fictitious' || grouponDetail.status === 'invalid'">
|
||||
<button class="u-reset-button btn2" v-if="grouponDetail.my" @tap.stop="jump('/pages/order/detail', { id: grouponDetail.my.order_id })">查看订单</button>
|
||||
<button class="u-reset-button btn1" v-else @tap="jump('/pages/goods/detail', { id: grouponDetail.goods_id })">我要开团</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 玩法 -->
|
||||
<view v-if="activity && activity.id" class="groupon-play u-flex u-row-between u-col-center" @tap="jump('/pages/public/richtext', { id: activity.richtext_id })">
|
||||
<text class="title">玩法</text>
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="description u-ellipsis-1">{{ activity.richtext_title || '开团/参团·邀请好友·人满发货(不满退款' }}</view>
|
||||
<view class="u-iconfont uicon-arrow-right u-m-r-10" style="color:#999;font-size:28rpx ;"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 邀请好友 -->
|
||||
<shopro-share v-model="showShare" :posterInfo="grouponDetail" :posterType="'groupon'"></shopro-share>
|
||||
<!-- 规格弹窗 -->
|
||||
|
||||
<shopro-sku
|
||||
v-if="grouponDetail.goods"
|
||||
v-model="showSku"
|
||||
:activityRules="{ status: grouponDetail.status }"
|
||||
:goodsInfo="grouponDetail.goods"
|
||||
:grouponId="grouponDetail.id"
|
||||
buyType="buy"
|
||||
grouponBuyType="groupon"
|
||||
></shopro-sku>
|
||||
|
||||
<!-- 登录提示 -->
|
||||
<shopro-auth-modal></shopro-auth-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let timer = null;
|
||||
import share from '@/shopro/share';
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
time: 0,
|
||||
grouponDetail: {},
|
||||
showShare: false,
|
||||
showSku: false,
|
||||
activity: {},
|
||||
surplusNum: 0 //剩余拼团人数、
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
onLoad() {
|
||||
this.getGrouponDetail();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.getGrouponDetail();
|
||||
},
|
||||
onHide() {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
},
|
||||
onUnload() {
|
||||
share.setShareInfo();
|
||||
},
|
||||
methods: {
|
||||
// 路由跳转
|
||||
jump(path, parmas) {
|
||||
this.$Router.push({
|
||||
path: path,
|
||||
query: parmas
|
||||
});
|
||||
},
|
||||
|
||||
// 倒计时
|
||||
countDown(t) {
|
||||
const that = this;
|
||||
timer = setInterval(() => {
|
||||
if (t > 0) {
|
||||
that.time = that.$tools.format(t);
|
||||
t--;
|
||||
} else {
|
||||
clearInterval(timer);
|
||||
that.time = false;
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
// 拼团详情
|
||||
getGrouponDetail() {
|
||||
let that = this;
|
||||
that.$http('goods.grouponDetail', {
|
||||
id: that.$Route.query.id
|
||||
}).then(res => {
|
||||
uni.stopPullDownRefresh();
|
||||
that.grouponDetail = res.data;
|
||||
that.activity = res.data.activity;
|
||||
if (that.activity) {
|
||||
that.activity.richtext_id = parseInt(that.activity.richtext_id);
|
||||
}
|
||||
that.surplusNum = res.data.num - res.data.current_num;
|
||||
|
||||
let newTime = new Date().getTime();
|
||||
let endTime = res.data.expiretime * 1000;
|
||||
let t = endTime - newTime;
|
||||
that.countDown(t / 1000);
|
||||
|
||||
// 设置分享信息
|
||||
share.setShareInfo({
|
||||
title: that.grouponDetail.goods.title,
|
||||
desc: that.grouponDetail.goods.subtitle,
|
||||
image: that.grouponDetail.goods.image,
|
||||
params: {
|
||||
page: 3,
|
||||
pageId: that.$Route.query.id
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// 商品卡片
|
||||
.head_box {
|
||||
background: url($IMG_URL+'/imgs/group/group_detail_bg.png') no-repeat;
|
||||
background-size: 100% 316rpx;
|
||||
padding: 60rpx 20rpx 20rpx;
|
||||
.goods-card {
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
.group-num {
|
||||
font-size: 24rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
.sell-box {
|
||||
line-height: 32rpx;
|
||||
background: rgba(255, 224, 226, 0.3);
|
||||
border-radius: 16rpx;
|
||||
padding: 0 10rpx;
|
||||
|
||||
.hot-icon {
|
||||
font-size: 26rpx;
|
||||
color: #e1212b;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.sell-num {
|
||||
font-size: 20rpx;
|
||||
color: #f7979c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 拼团人
|
||||
.group-box {
|
||||
background: #fff;
|
||||
padding: 40rpx 0;
|
||||
min-height: 370rpx;
|
||||
justify-content: center;
|
||||
.tip-box {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.title-box {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
.group-num {
|
||||
color: #f8002c;
|
||||
}
|
||||
.count-down-tip {
|
||||
font-size: 24rpx;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
.time-box {
|
||||
font-size: 18rpx;
|
||||
.count-text {
|
||||
display: inline-block;
|
||||
background-color: #383a46;
|
||||
color: #fff;
|
||||
font-size: 18rpx;
|
||||
border-radius: 2rpx;
|
||||
padding: 0 5rpx;
|
||||
height: 28rpx;
|
||||
text-align: center;
|
||||
line-height: 28rpx;
|
||||
margin: 0 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.group-people {
|
||||
flex-wrap: wrap;
|
||||
padding: 50rpx;
|
||||
.img-box {
|
||||
position: relative;
|
||||
margin-right: 30rpx;
|
||||
&:nth-child(6n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
.tag {
|
||||
position: absolute;
|
||||
line-height: 36rpx;
|
||||
background: linear-gradient(132deg, rgba(243, 223, 177, 1), rgba(243, 223, 177, 1), rgba(236, 190, 96, 1));
|
||||
border-radius: 14rpx;
|
||||
padding: 0 10rpx;
|
||||
white-space: nowrap;
|
||||
font-size: 24rpx;
|
||||
color: #784f06;
|
||||
z-index: 2;
|
||||
top: -20rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
background: #ccc;
|
||||
}
|
||||
.leader {
|
||||
border: 4rpx solid rgba(237, 195, 108, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn-box {
|
||||
width: 750rpx;
|
||||
.btn1 {
|
||||
width: 690rpx;
|
||||
line-height: 70rpx;
|
||||
background: linear-gradient(90deg, rgba(254, 131, 42, 1), rgba(255, 102, 0, 1));
|
||||
box-shadow: 0px 7rpx 6rpx 0px rgba(255, 104, 4, 0.22);
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
.btn2 {
|
||||
width: 690rpx;
|
||||
line-height: 70rpx;
|
||||
border: 1rpx solid rgba(223, 223, 223, 1);
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
.groupon-play {
|
||||
height: 94rpx;
|
||||
border-top: 1rpx solid rgba(#dfdfdf, 0.5);
|
||||
padding: 0 20rpx;
|
||||
background: #fff;
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
.description {
|
||||
font-size: 28rpx;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
246
pages/activity/groupon/list.vue
普通文件
246
pages/activity/groupon/list.vue
普通文件
@@ -0,0 +1,246 @@
|
||||
<!-- 拼购列表 -->
|
||||
<template>
|
||||
<view class="groupon-wrap">
|
||||
<view class="group-head u-flex u-row-between">
|
||||
<text class="group-head__title"></text>
|
||||
<text class="group-head__notice">省钱省心限时拼</text>
|
||||
</view>
|
||||
<view class="group-box">
|
||||
<view class="goods-item u-m-b-16" v-for="(item, index) in grouponList" :key="item.id" @tap="$Router.push({ path: '/pages/goods/detail', query: { id: item.id } })">
|
||||
<view class="big-goods u-p-20 u-flex u-col-top">
|
||||
<image v-if="index < 3" class="top-tag" :src="tagMap[index]" mode=""></image>
|
||||
<image class="goods-img" lazy-load fade-show :src="item.image" mode="aspectFill"></image>
|
||||
<view class=" card-right u-m-l-20 u-flex-col u-row-between">
|
||||
<view class="">
|
||||
<view class="goods-title u-ellipsis-1 u-m-t-10 u-m-b-10">
|
||||
<view class="title-tag cu-tag bg-orange sm radius u-m-r-10">拼团</view>
|
||||
{{ item.title }}
|
||||
</view>
|
||||
<view v-show="item.subtitle" class="subtitle-text u-m-b-10 u-ellipsis-1">{{ item.subtitle }}</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-m-y-20">
|
||||
<view class="sell-box">
|
||||
<text class=" hot-icon iconfont icon-icon-test"></text>
|
||||
<text class="sell-num">已拼{{ item.sales }}件</text>
|
||||
</view>
|
||||
<text class="group-num">{{ item.activity.rules.team_num || 0 }}人团</text>
|
||||
</view>
|
||||
|
||||
<view class=" u-flex u-row-between u-col-center">
|
||||
<view class="u-flex u-col-bottom font-OPPOSANS">
|
||||
<view class="price u-m-r-10">{{ item.groupon_price }}</view>
|
||||
<view class="origin-price">{{ item.original_price }}</view>
|
||||
</view>
|
||||
<button class="u-reset-button buy-btn">马上拼</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 空白 -->
|
||||
<shopro-empty
|
||||
v-if="!grouponList.length && !isLoading"
|
||||
style="padding-top: 200rpx;"
|
||||
marginTop="0"
|
||||
:image="$IMG_URL + '/imgs/empty/empty_goods.png'"
|
||||
tipText="暂无拼团商品,敬请期待~"
|
||||
></shopro-empty>
|
||||
<!-- 加载更多 -->
|
||||
</view>
|
||||
|
||||
<u-loadmore v-if="grouponList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
tagMap: {
|
||||
0: this.$IMG_URL + '/imgs/group/groupon_top1.png',
|
||||
1: this.$IMG_URL + '/imgs/group/groupon_top2.png',
|
||||
2: this.$IMG_URL + '/imgs/group/groupon_top3.png'
|
||||
},
|
||||
isLoading: true,
|
||||
loadStatus: 'loadmore', //loadmore:加载前的状态,loading:加载中的状态,nomore:没有更多的状态
|
||||
lastPage: 1,
|
||||
currentPage: 1,
|
||||
grouponList: []
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.getGrouponList();
|
||||
},
|
||||
onReachBottom() {
|
||||
this.loadMore();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.currentPage = 1;
|
||||
this.lastPage = 1;
|
||||
this.grouponList = [];
|
||||
this.getGrouponList();
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
// 路由跳转
|
||||
jump(path, parmas) {
|
||||
this.$Router.push({
|
||||
path: path,
|
||||
query: parmas
|
||||
});
|
||||
},
|
||||
// 加载更多
|
||||
loadMore() {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getGrouponList();
|
||||
}
|
||||
},
|
||||
// 拼团列表
|
||||
getGrouponList() {
|
||||
let that = this;
|
||||
that.isLoading = true;
|
||||
that.loadStatus = 'loading';
|
||||
that.$http('goods.grouponList', {
|
||||
page: that.currentPage
|
||||
}).then(res => {
|
||||
that.isLoading = false;
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.code === 1) {
|
||||
that.grouponList = [...that.grouponList, ...res.data.data];
|
||||
that.lastPage = res.data.last_page;
|
||||
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// 背景
|
||||
.groupon-wrap {
|
||||
background: url($IMG_URL+'/imgs/group/group_list_bg.png') no-repeat;
|
||||
background-size: 100% 374rpx;
|
||||
}
|
||||
.group-head {
|
||||
padding: 0 25rpx;
|
||||
height: 100rpx;
|
||||
.group-head__title {
|
||||
font-size: 32rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
.group-head__notice {
|
||||
font-size: 26rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
|
||||
.group-box {
|
||||
width: 710rpx;
|
||||
background: linear-gradient(#fff, #f5f5f5);
|
||||
border-radius: 20rpx;
|
||||
margin: 0 auto;
|
||||
min-height: 800rpx;
|
||||
.goods-item {
|
||||
border-radius: 20rpx;
|
||||
background-color: #fff;
|
||||
// 大商品卡片
|
||||
.big-goods {
|
||||
width: 710rpx;
|
||||
height: 260rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 7rpx 8rpx 1rpx rgba(254, 76, 29, 0.05);
|
||||
border-radius: 20rpx;
|
||||
position: relative;
|
||||
.goods-img {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.top-tag {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
top: 20rpx;
|
||||
left: 20rpx;
|
||||
width: 84rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
.card-right {
|
||||
width: 430rpx;
|
||||
height: 220rpx;
|
||||
}
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
width: 400rpx;
|
||||
color: #000000;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.subtitle-text {
|
||||
font-size: 22rpx;
|
||||
width: 400rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
// 拼团
|
||||
.sell-box {
|
||||
background: rgba(#f9efd6, 0.3);
|
||||
border-radius: 16rpx;
|
||||
line-height: 32rpx;
|
||||
.sell-num {
|
||||
font-size: 20rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: #ff6904;
|
||||
}
|
||||
|
||||
.hot-icon {
|
||||
font-size: 26rpx;
|
||||
color: #ff6904;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
.group-num {
|
||||
font-size: 20rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
// 价格
|
||||
.price {
|
||||
color: #ff0000;
|
||||
font-weight: 600;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
.origin-price {
|
||||
color: #c4c4c4;
|
||||
font-size: 24rpx;
|
||||
text-decoration: line-through;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,247 @@
|
||||
<!-- 我的拼团 -->
|
||||
<template>
|
||||
<view class="page_box">
|
||||
<!-- tab -->
|
||||
<view class="head_box">
|
||||
<view class="order-nav u-flex">
|
||||
<view class="nav-item u-flex-col u-flex-1 u-row-center u-col-center" v-for="nav in groupState" :key="nav.id" @tap="onNav(nav.id)">
|
||||
<view class="item-title">{{ nav.title }}</view>
|
||||
<text class="nav-line" :class="{ 'line-active': stateId === nav.id }"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content_box">
|
||||
<scroll-view scroll-y="true" enable-back-to-top @scrolltolower="loadMore" refresher-background="#f5f5f5" class="scroll-box">
|
||||
<block v-for="groupon in myGrouponList" :key="groupon.id">
|
||||
<view class="group-card">
|
||||
<image v-if="stateId !== 'ing'" class="group-state" :src="grouponStatus[groupon.groupon.status]" mode=""></image>
|
||||
<view class="goods-content">
|
||||
<shopro-mini-card
|
||||
:title="groupon.goods.title"
|
||||
:image="groupon.goods.image"
|
||||
:subtitle="groupon.goods.subtitle"
|
||||
:price="groupon.goods.price"
|
||||
:originPrice="groupon.goods.original_price"
|
||||
@click="jump('/pages/goods/detail', { id: groupon.goods.id })"
|
||||
>
|
||||
<template #describe>
|
||||
<view class="u-flex u-m-b-20">
|
||||
<view class="sell-box">
|
||||
<text class="iconfont icon-fire"></text>
|
||||
<text class="sell-num">已拼{{ groupon.goods.sales }}件</text>
|
||||
</view>
|
||||
<text class="group-num">{{ groupon.groupon.num || 0 }}人团</text>
|
||||
</view>
|
||||
</template>
|
||||
</shopro-mini-card>
|
||||
</view>
|
||||
<view class="btn-box u-flex">
|
||||
<button class="u-reset-button invite-btn" @tap="jump('/pages/activity/groupon/detail', { id: groupon.groupon_id })">拼团详情</button>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 空白页 -->
|
||||
<shopro-empty
|
||||
v-if="isEmpty"
|
||||
:image="$IMG_URL + '/imgs/empty/empty_groupon.png'"
|
||||
tipText="暂无拼团商品,更多拼团好货等着你噢~"
|
||||
btnText="去首页逛逛"
|
||||
@click="$Router.pushTab('/pages/index/index')"
|
||||
></shopro-empty>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<u-loadmore v-if="myGrouponList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
isEmpty: false,
|
||||
loadStatus: 'loadmore', //loadmore:加载前的状态,loading:加载中的状态,nomore-没有更多的状态
|
||||
lastPage: 1,
|
||||
currentPage: 1,
|
||||
stateId: 'all',
|
||||
grouponStatus: {
|
||||
finish: this.$IMG_URL + '/imgs/group/group_state_succeed.png',
|
||||
'finish-fictitious': this.$IMG_URL + '/imgs/group/group_state_succeed.png',
|
||||
invalid: this.$IMG_URL + '/imgs/group/group_state_failed.png'
|
||||
},
|
||||
myGrouponList: [], //我的拼团列表。
|
||||
groupState: [
|
||||
{
|
||||
id: 'all', //0
|
||||
title: '全部'
|
||||
},
|
||||
{
|
||||
id: 'ing', //1
|
||||
title: '进行中'
|
||||
},
|
||||
{
|
||||
id: 'finish', //2
|
||||
title: '成功'
|
||||
},
|
||||
{
|
||||
id: 'invalid', //3
|
||||
title: '失败'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
onLoad() {
|
||||
this.getMyGroupon();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.lastPage = 1;
|
||||
this.currentPage = 1;
|
||||
this.myGrouponList = [];
|
||||
this.getMyGroupon();
|
||||
},
|
||||
methods: {
|
||||
onNav(id) {
|
||||
if (this.stateId !== id) {
|
||||
this.stateId = id;
|
||||
this.myGrouponList = [];
|
||||
this.currentPage = 1;
|
||||
this.getMyGroupon();
|
||||
}
|
||||
},
|
||||
|
||||
jump(path, parmas) {
|
||||
this.$Router.push({
|
||||
path: path,
|
||||
query: parmas
|
||||
});
|
||||
},
|
||||
|
||||
// 加载更多
|
||||
loadMore() {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getMyGroupon();
|
||||
}
|
||||
},
|
||||
|
||||
// 我的拼团
|
||||
getMyGroupon() {
|
||||
let that = this;
|
||||
that.loadStatus = 'loading';
|
||||
that.$http(
|
||||
'goods.myGroupon',
|
||||
{
|
||||
type: that.stateId,
|
||||
page: that.currentPage
|
||||
},
|
||||
'加载中'
|
||||
).then(res => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.code === 1) {
|
||||
that.myGrouponList = [...that.myGrouponList, ...res.data.data];
|
||||
that.isEmpty = !that.myGrouponList.length;
|
||||
that.lastPage = res.data.last_page;
|
||||
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// tab
|
||||
.order-nav {
|
||||
background: #fff;
|
||||
height: 80rpx;
|
||||
|
||||
.nav-item {
|
||||
flex: 1;
|
||||
|
||||
.item-title {
|
||||
font-size: 30rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
line-height: 76rpx;
|
||||
}
|
||||
|
||||
.nav-line {
|
||||
width: 120rpx;
|
||||
height: 4rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.line-active {
|
||||
background: rgba(230, 184, 115, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 拼团卡片
|
||||
.group-card {
|
||||
background: #fff;
|
||||
margin-top: 20rpx;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
.group-state {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: -20rpx;
|
||||
right: -20rpx;
|
||||
width: 126rpx;
|
||||
height: 126rpx;
|
||||
}
|
||||
|
||||
.goods-content {
|
||||
padding: 20rpx;
|
||||
position: relative;
|
||||
.group-num {
|
||||
font-size: 24rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
.sell-box {
|
||||
line-height: 32rpx;
|
||||
background: rgba(255, 224, 226, 0.3);
|
||||
border-radius: 16rpx;
|
||||
padding: 0 10rpx;
|
||||
|
||||
.icon-fire {
|
||||
color: #e1212b;
|
||||
font-size: 26rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.sell-num {
|
||||
font-size: 20rpx;
|
||||
color: #f7979c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
height: 95rpx;
|
||||
border-top: 1px solid rgba(223, 223, 223, 0.5);
|
||||
justify-content: flex-end;
|
||||
.invite-btn {
|
||||
width: 210rpx;
|
||||
line-height: 65rpx;
|
||||
border: 1rpx solid #4C7AF3;
|
||||
border-radius: 33rpx;
|
||||
font-size: 26rpx;
|
||||
color: #4C7AF3;
|
||||
padding: 0;
|
||||
margin-right: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户