前端小程序
这个提交包含在:
@@ -0,0 +1,227 @@
|
||||
<!-- 商品列表 -->
|
||||
<template>
|
||||
<view class="list-box">
|
||||
<!-- 倒计时 -->
|
||||
<u-sticky ref="uSticky" bgColor="#F5F7FA" offsetTop="0">
|
||||
<view class="tip-list-box">
|
||||
<view class="tip-list u-flex-col u-flex-1 u-p-30">
|
||||
<view class="count-down-box u-flex u-col-center">
|
||||
<view class="u-m-r-10">{{ timeRule.title }}</view>
|
||||
<u-count-down
|
||||
v-if="timeRule.time"
|
||||
class="count-down-demo"
|
||||
:timestamp="timeRule.time / 1000"
|
||||
separator-color="#333 "
|
||||
bg-color="#1677FF"
|
||||
ref="uCountDown"
|
||||
color="#fff"
|
||||
@end="getTime"
|
||||
autoplay
|
||||
></u-count-down>
|
||||
</view>
|
||||
<view class="u-flex u-flex-1 u-col-center modal-item u-flex-wrap u-m-t-10" v-if="activityInfo.tags">
|
||||
<view class="title-tag cu-tag bg-red sm radius u-m-r-10 u-m-t-10" >{{ activityInfo.title }}</view>
|
||||
<view class="tag-box cu-tag line-red sm radius u-m-r-10 u-m-t-10" v-for="(tag, index) in activityInfo.tags" :key="tag">{{ tag }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<!-- 商品列表 -->
|
||||
<view class="u-waterfall u-p-16" v-if="!isEmpty">
|
||||
<view id="u-left-column" class="u-column">
|
||||
<view class="goods-item u-m-b-16 u-flex u-row-center u-col-center" v-for="leftGoods in leftList" :key="leftGoods.id">
|
||||
<shopro-goods-card
|
||||
:detail="leftGoods"
|
||||
:type="leftGoods.activity_type"
|
||||
:image="leftGoods.image"
|
||||
:title="leftGoods.title"
|
||||
:subtitle="leftGoods.subtitle"
|
||||
:price="leftGoods.price"
|
||||
:originPrice="leftGoods.original_price"
|
||||
:sales="leftGoods.sales"
|
||||
:tagTextList="leftGoods.activity_discounts_tags"
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: leftGoods.id } })"
|
||||
></shopro-goods-card>
|
||||
</view>
|
||||
</view>
|
||||
<view id="u-right-column" class="u-column">
|
||||
<view class="goods-item u-m-b-16 u-flex u-row-center u-col-center" v-for="rightGoods in rightList" :key="rightGoods.id">
|
||||
<shopro-goods-card
|
||||
:detail="rightGoods"
|
||||
:type="rightGoods.activity_type"
|
||||
:image="rightGoods.image"
|
||||
:title="rightGoods.title"
|
||||
:subtitle="rightGoods.subtitle"
|
||||
:price="rightGoods.price"
|
||||
:originPrice="rightGoods.original_price"
|
||||
:sales="rightGoods.sales"
|
||||
:tagTextList="rightGoods.activity_discounts_tags"
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: rightGoods.id } })"
|
||||
></shopro-goods-card>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 缺省页 -->
|
||||
<shopro-empty v-if="isEmpty" :image="$IMG_URL + '/imgs/empty/empty_goods.png'" tipText="暂无该商品,还有更多好货等着你噢~"></shopro-empty>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<u-loadmore v-show="goodsList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
|
||||
|
||||
<!-- 登录弹窗 -->
|
||||
<shopro-auth-modal></shopro-auth-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapMutations, mapActions, mapState } from 'vuex';
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
activityInfo: {},
|
||||
timeRule: {
|
||||
title: '',
|
||||
time: 0
|
||||
},
|
||||
isEmpty: false,
|
||||
goodsList: [],
|
||||
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
|
||||
lastPage: 1,
|
||||
currentPage: 1,
|
||||
|
||||
// 瀑布流 350-330
|
||||
addTime: 100, //排序间隙时间
|
||||
leftHeight: 0,
|
||||
rightHeight: 0,
|
||||
leftList: [],
|
||||
rightList: [],
|
||||
tempList: []
|
||||
};
|
||||
},
|
||||
// 触底加载更多
|
||||
onReachBottom() {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.activityInfo = this.$Route.query;
|
||||
this.getGoodsList();
|
||||
this.getCartList();
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.getTime();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getCartList']),
|
||||
// 瀑布流相关
|
||||
async splitData() {
|
||||
if (!this.tempList.length) return;
|
||||
let item = this.tempList[0];
|
||||
if (!item) return;
|
||||
|
||||
// 分左右
|
||||
if (this.leftHeight < this.rightHeight) {
|
||||
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
|
||||
this.leftList.push(item);
|
||||
} else if (this.leftHeight > this.rightHeight) {
|
||||
this.rightHeight += item.activity_discounts_tags.length ? 350 : 330;
|
||||
this.rightList.push(item);
|
||||
} else {
|
||||
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
|
||||
this.leftList.push(item);
|
||||
}
|
||||
|
||||
// 移除临时列表的第一项,如果临时数组还有数据,继续循环
|
||||
this.tempList.splice(0, 1);
|
||||
if (this.tempList.length) {
|
||||
setTimeout(() => {
|
||||
this.splitData();
|
||||
}, this.addTime);
|
||||
}
|
||||
},
|
||||
clear() {
|
||||
this.leftList = [];
|
||||
this.rightList = [];
|
||||
this.leftHeight = 0;
|
||||
this.rightHeight = 0;
|
||||
this.tempList = [];
|
||||
},
|
||||
|
||||
// 计算倒计时
|
||||
getTime() {
|
||||
let nowTime = new Date().getTime();
|
||||
let { endtime, starttime } = this.activityInfo;
|
||||
endtime = endtime * 1000;
|
||||
starttime = starttime * 1000;
|
||||
// 当前时间小于开始时间,未开始
|
||||
if (nowTime < starttime) {
|
||||
this.timeRule.title = '距开始';
|
||||
this.timeRule.time = starttime - nowTime;
|
||||
}
|
||||
// 当前时间大于开始时间,小于结束时间,进行中
|
||||
if (nowTime > starttime && nowTime < endtime) {
|
||||
this.timeRule.title = '距结束';
|
||||
this.timeRule.time = endtime - nowTime;
|
||||
}
|
||||
// 当前时间大于结束时间,已结束
|
||||
if (nowTime > endtime) {
|
||||
this.timeRule.title = '已结束';
|
||||
this.timeRule.time = 0;
|
||||
}
|
||||
},
|
||||
// 商品列表
|
||||
getGoodsList() {
|
||||
let that = this;
|
||||
that.loadStatus = 'loading';
|
||||
that.$http('goods.lists', {
|
||||
goods_ids: that.activityInfo.goods_ids,
|
||||
page: that.currentPage
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
that.goodsList = [...that.goodsList, ...res.data.data];
|
||||
that.isEmpty = !that.goodsList.length;
|
||||
that.lastPage = res.data.last_page;
|
||||
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
that.tempList = res.data.data;
|
||||
that.splitData();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@mixin vue-flex($direction: row) {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-direction: $direction;
|
||||
/* #endif */
|
||||
}
|
||||
.u-waterfall {
|
||||
@include vue-flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.u-column {
|
||||
@include vue-flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
height: auto;
|
||||
}
|
||||
.tip-list-box {
|
||||
background-color: $brand-page-bg;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.tip-list {
|
||||
font-size: 28rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -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: $brand-price;
|
||||
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: $brand-text;
|
||||
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>
|
||||
@@ -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: $brand-header-gradient;
|
||||
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, #1677FF 0%, #4096FF 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: $brand-price;
|
||||
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="#F5F7FA" 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: $brand-price;
|
||||
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 $brand-gold;
|
||||
border-radius: 33rpx;
|
||||
font-size: 26rpx;
|
||||
color: $brand-gold;
|
||||
padding: 0;
|
||||
margin-right: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,278 @@
|
||||
<!-- 促销列表 -->
|
||||
<template>
|
||||
<view class="page_box seckill-list-wrap">
|
||||
<!-- tab栏 -->
|
||||
<view class="tab-box u-flex">
|
||||
<view class="tab-item u-flex-col u-row-center u-col-center" @tap="onTab(tab.id)" v-for="tab in tabList"
|
||||
:key="tab.id">
|
||||
<text class="tab-title u-m-b-20" :class="{ 'tab-active': tabCurrent === tab.id }">{{ tab.title }}</text>
|
||||
<text v-show="tabCurrent === tab.id" class="tab-line"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表 -->
|
||||
<view class="content_box">
|
||||
<scroll-view scroll-y="true" enable-back-to-top @scrolltolower="loadMore" class="scroll-box">
|
||||
<view class="goods-item u-m-b-16" v-for="item in goodsList" :key="item.id"
|
||||
@tap="toSeckillDetail(item.id)">
|
||||
<view class="big-goods u-flex u-p-20 u-col-top ">
|
||||
<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-yellow 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="cu-progress round sm" style="width:210rpx;">
|
||||
<view :style="[{ width: item.percent + '%',backgroundColor:'#1677FF' }]"></view>
|
||||
</view>
|
||||
<view class="progress-text">已售出{{ item.sales }}件</view>
|
||||
</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.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="isEmpty" tipText="暂无促销商品,敬请期待~"
|
||||
:image="$IMG_URL + '/imgs/empty/empty_goods.png'"></shopro-empty>
|
||||
<!-- 加载更多 -->
|
||||
<u-loadmore v-if="!isEmpty" 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,
|
||||
tabCurrent: 'ing',
|
||||
goodsList: [],
|
||||
tabList: [{
|
||||
id: 'ing',
|
||||
title: '促销进行中'
|
||||
},
|
||||
{
|
||||
id: 'nostart',
|
||||
title: '即将开始'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
onLoad() {
|
||||
this.getGoodsList();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.lastPage = 1;
|
||||
this.currentPage = 1;
|
||||
this.goodsList = [];
|
||||
this.getGoodsList();
|
||||
},
|
||||
methods: {
|
||||
onTab(id) {
|
||||
if (this.tabCurrent !== id) {
|
||||
this.tabCurrent = id;
|
||||
this.goodsList = [];
|
||||
this.currentPage = 1;
|
||||
this.lastPage = 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
toSeckillDetail(id) {
|
||||
this.$Router.push({
|
||||
path: '/pages/goods/detail',
|
||||
query: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
},
|
||||
// 加载更多
|
||||
loadMore() {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
// 秒杀列表
|
||||
getGoodsList() {
|
||||
let that = this;
|
||||
that.loadStatus = 'loading';
|
||||
that.$http(
|
||||
'goods.promoteList', {
|
||||
type: that.tabCurrent,
|
||||
page: that.currentPage
|
||||
},
|
||||
'加载中...'
|
||||
).then(res => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.code === 1) {
|
||||
that.goodsList = [...that.goodsList, ...res.data.data];
|
||||
that.goodsList.map(item => {
|
||||
item.percent = item.stock + item.sales > 0 ? ((item.sales / (item.sales + item
|
||||
.stock)) * 100).toFixed(2) : 0;
|
||||
});
|
||||
that.isEmpty = !that.goodsList.length;
|
||||
that.lastPage = res.data.last_page;
|
||||
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.seckill-list-wrap {
|
||||
background: url($IMG_URL+'/imgs/seckill/sekill_list_head_bg.png') no-repeat;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
|
||||
.bg-yellow {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
// tab
|
||||
.tab-box {
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
height: 140rpx;
|
||||
color: rgba(#fff, 0.4);
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
|
||||
.tab-line {
|
||||
width: 50rpx;
|
||||
height: 8rpx;
|
||||
background: #fff;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-active {
|
||||
color: rgba(#fff, 1);
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box {
|
||||
background: $brand-header-gradient;
|
||||
width: 710rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
// 列表
|
||||
.goods-item {
|
||||
|
||||
// 大商品卡片
|
||||
.big-goods {
|
||||
width: 710rpx;
|
||||
height: 260rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 7rpx 8rpx 1rpx rgba(254, 76, 29, 0.05);
|
||||
border-radius: 20rpx;
|
||||
|
||||
.goods-img {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.card-right {
|
||||
width: 430rpx;
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
width: 400rpx;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 22rpx;
|
||||
width: 400rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #d6ac62, #fac973);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
color: #c4c4c4;
|
||||
font-size: 20rpx;
|
||||
margin-left: 25rpx;
|
||||
}
|
||||
|
||||
// 价格
|
||||
.price {
|
||||
color: $brand-price;
|
||||
font-weight: 600;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price {
|
||||
color: #c4c4c4;
|
||||
font-size: 24rpx;
|
||||
text-decoration: line-through;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-end,
|
||||
.btn-nostart {
|
||||
background: rgba(238, 238, 238, 1);
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.btn-ing {
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,274 @@
|
||||
<!-- 秒杀列表 -->
|
||||
<template>
|
||||
<view class="page_box seckill-list-wrap">
|
||||
<!-- tab栏 -->
|
||||
<view class="tab-box u-flex">
|
||||
<view class="tab-item u-flex-col u-row-center u-col-center" @tap="onTab(tab.id)" v-for="tab in tabList"
|
||||
:key="tab.id">
|
||||
<text class="tab-title u-m-b-20" :class="{ 'tab-active': tabCurrent === tab.id }">{{ tab.title }}</text>
|
||||
<text v-show="tabCurrent === tab.id" class="tab-line"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表 -->
|
||||
<view class="content_box">
|
||||
<scroll-view scroll-y="true" enable-back-to-top @scrolltolower="loadMore" class="scroll-box">
|
||||
<view class="goods-item u-m-b-16" v-for="item in goodsList" :key="item.id"
|
||||
@tap="toSeckillDetail(item.id)">
|
||||
<view class="big-goods u-flex u-p-20 u-col-top ">
|
||||
<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-red 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="cu-progress round sm" style="width:210rpx;">
|
||||
<view :style="[{ width: item.percent + '%',backgroundColor:'#1677FF' }]"></view>
|
||||
</view>
|
||||
<view class="progress-text">已售出{{ item.sales }}件</view>
|
||||
</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.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="isEmpty" tipText="暂无秒杀商品,敬请期待~"
|
||||
:image="$IMG_URL + '/imgs/empty/empty_goods.png'"></shopro-empty>
|
||||
<!-- 加载更多 -->
|
||||
<u-loadmore v-if="!isEmpty" 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,
|
||||
tabCurrent: 'ing',
|
||||
goodsList: [],
|
||||
tabList: [{
|
||||
id: 'ing',
|
||||
title: '抢购进行中'
|
||||
},
|
||||
{
|
||||
id: 'nostart',
|
||||
title: '即将开始'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
onLoad() {
|
||||
this.getGoodsList();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.lastPage = 1;
|
||||
this.currentPage = 1;
|
||||
this.goodsList = [];
|
||||
this.getGoodsList();
|
||||
},
|
||||
methods: {
|
||||
onTab(id) {
|
||||
if (this.tabCurrent !== id) {
|
||||
this.tabCurrent = id;
|
||||
this.goodsList = [];
|
||||
this.currentPage = 1;
|
||||
this.lastPage = 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
toSeckillDetail(id) {
|
||||
this.$Router.push({
|
||||
path: '/pages/goods/detail',
|
||||
query: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
},
|
||||
// 加载更多
|
||||
loadMore() {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
// 秒杀列表
|
||||
getGoodsList() {
|
||||
let that = this;
|
||||
that.loadStatus = 'loading';
|
||||
that.$http(
|
||||
'goods.robbuyList', {
|
||||
type: that.tabCurrent,
|
||||
page: that.currentPage
|
||||
},
|
||||
'加载中...'
|
||||
).then(res => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.code === 1) {
|
||||
that.goodsList = [...that.goodsList, ...res.data.data];
|
||||
that.goodsList.map(item => {
|
||||
item.percent = item.stock + item.sales > 0 ? ((item.sales / (item.sales + item
|
||||
.stock)) * 100).toFixed(2) : 0;
|
||||
});
|
||||
that.isEmpty = !that.goodsList.length;
|
||||
that.lastPage = res.data.last_page;
|
||||
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.seckill-list-wrap {
|
||||
background: url($IMG_URL+'/imgs/seckill/sekill_list_head_bg.png') no-repeat;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
|
||||
// tab
|
||||
.tab-box {
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
height: 140rpx;
|
||||
color: rgba(#fff, 0.4);
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
|
||||
.tab-line {
|
||||
width: 50rpx;
|
||||
height: 8rpx;
|
||||
background: #fff;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-active {
|
||||
color: rgba(#fff, 1);
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box {
|
||||
background: $brand-header-gradient;
|
||||
width: 710rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
// 列表
|
||||
.goods-item {
|
||||
|
||||
// 大商品卡片
|
||||
.big-goods {
|
||||
width: 710rpx;
|
||||
height: 260rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 7rpx 8rpx 1rpx rgba(254, 76, 29, 0.05);
|
||||
border-radius: 20rpx;
|
||||
|
||||
.goods-img {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.card-right {
|
||||
width: 430rpx;
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
width: 400rpx;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 22rpx;
|
||||
width: 400rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
color: #c4c4c4;
|
||||
font-size: 20rpx;
|
||||
margin-left: 25rpx;
|
||||
}
|
||||
|
||||
// 价格
|
||||
.price {
|
||||
color: $brand-price;
|
||||
font-weight: 600;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price {
|
||||
color: #c4c4c4;
|
||||
font-size: 24rpx;
|
||||
text-decoration: line-through;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-end,
|
||||
.btn-nostart {
|
||||
background: rgba(238, 238, 238, 1);
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.btn-ing {
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,248 @@
|
||||
<!-- 秒杀列表 -->
|
||||
<template>
|
||||
<view class="page_box seckill-list-wrap">
|
||||
<!-- tab栏 -->
|
||||
<view class="tab-box u-flex">
|
||||
<view class="tab-item u-flex-col u-row-center u-col-center" @tap="onTab(tab.id)" v-for="tab in tabList" :key="tab.id">
|
||||
<text class="tab-title u-m-b-20" :class="{ 'tab-active': tabCurrent === tab.id }">{{ tab.title }}</text>
|
||||
<text v-show="tabCurrent === tab.id" class="tab-line"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表 -->
|
||||
<view class="content_box">
|
||||
<scroll-view scroll-y="true" enable-back-to-top @scrolltolower="loadMore" class="scroll-box">
|
||||
<view class="goods-item u-m-b-16" v-for="item in goodsList" :key="item.id" @tap="toSeckillDetail(item.id)">
|
||||
<view class="big-goods u-flex u-p-20 u-col-top ">
|
||||
<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-red 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="cu-progress round sm" style="width:210rpx;"><view :style="[{ width: item.percent + '%',backgroundColor:'#1677FF' }]"></view></view>
|
||||
<view class="progress-text">已售出{{ item.sales }}件</view>
|
||||
</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.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="isEmpty" tipText="暂无秒杀商品,敬请期待~" :image="$IMG_URL + '/imgs/empty/empty_goods.png'"></shopro-empty>
|
||||
<!-- 加载更多 -->
|
||||
<u-loadmore v-if="!isEmpty" 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,
|
||||
tabCurrent: 'ing',
|
||||
goodsList: [],
|
||||
tabList: [
|
||||
{
|
||||
id: 'ing',
|
||||
title: '秒杀进行中'
|
||||
},
|
||||
{
|
||||
id: 'nostart',
|
||||
title: '即将开始'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
onLoad() {
|
||||
this.getGoodsList();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.lastPage = 1;
|
||||
this.currentPage = 1;
|
||||
this.goodsList = [];
|
||||
this.getGoodsList();
|
||||
},
|
||||
methods: {
|
||||
onTab(id) {
|
||||
if (this.tabCurrent !== id) {
|
||||
this.tabCurrent = id;
|
||||
this.goodsList = [];
|
||||
this.currentPage = 1;
|
||||
this.lastPage = 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
toSeckillDetail(id) {
|
||||
this.$Router.push({ path: '/pages/goods/detail', query: { id: id } });
|
||||
},
|
||||
// 加载更多
|
||||
loadMore() {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
// 秒杀列表
|
||||
getGoodsList() {
|
||||
let that = this;
|
||||
that.loadStatus = 'loading';
|
||||
that.$http(
|
||||
'goods.seckillList',
|
||||
{
|
||||
type: that.tabCurrent,
|
||||
page: that.currentPage
|
||||
},
|
||||
'加载中...'
|
||||
).then(res => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.code === 1) {
|
||||
that.goodsList = [...that.goodsList, ...res.data.data];
|
||||
that.goodsList.map(item => {
|
||||
item.percent = item.stock + item.sales > 0 ? ((item.sales / (item.sales + item.stock)) * 100).toFixed(2) : 0;
|
||||
});
|
||||
that.isEmpty = !that.goodsList.length;
|
||||
that.lastPage = res.data.last_page;
|
||||
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.seckill-list-wrap {
|
||||
background: url($IMG_URL+'/imgs/seckill/sekill_list_head_bg.png') no-repeat;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
// tab
|
||||
.tab-box {
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
height: 140rpx;
|
||||
color: rgba(#fff, 0.4);
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
.tab-line {
|
||||
width: 50rpx;
|
||||
height: 8rpx;
|
||||
background: #fff;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-active {
|
||||
color: rgba(#fff, 1);
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box {
|
||||
background: $brand-header-gradient;
|
||||
width: 710rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
// 列表
|
||||
.goods-item {
|
||||
// 大商品卡片
|
||||
.big-goods {
|
||||
width: 710rpx;
|
||||
height: 260rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 7rpx 8rpx 1rpx rgba(254, 76, 29, 0.05);
|
||||
border-radius: 20rpx;
|
||||
.goods-img {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.card-right {
|
||||
width: 430rpx;
|
||||
height: 220rpx;
|
||||
}
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
width: 400rpx;
|
||||
color: #000000;
|
||||
}
|
||||
.subtitle-text {
|
||||
font-size: 22rpx;
|
||||
width: 400rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
.progress-text {
|
||||
color: #c4c4c4;
|
||||
font-size: 20rpx;
|
||||
margin-left: 25rpx;
|
||||
}
|
||||
// 价格
|
||||
.price {
|
||||
color: $brand-price;
|
||||
font-weight: 600;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
.origin-price {
|
||||
color: #c4c4c4;
|
||||
font-size: 24rpx;
|
||||
text-decoration: line-through;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
.btn-end,
|
||||
.btn-nostart {
|
||||
background: rgba(238, 238, 238, 1);
|
||||
color: #999999;
|
||||
}
|
||||
.btn-ing {
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,361 @@
|
||||
<!-- 签到 -->
|
||||
<template>
|
||||
<view class="sign-wrap">
|
||||
<view class="calendar">
|
||||
<!-- 每日签到 -->
|
||||
<view class="sign-everyday u-flex u-row-between u-p-30">
|
||||
<text class="sign-everyday-title">每日签到</text>
|
||||
<view class="sign-num-box">
|
||||
已连续签到
|
||||
<text class="sign-num">{{ cuntinueDays }}</text>
|
||||
天
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 切换年月 -->
|
||||
<view class="bar u-flex u-row-center">
|
||||
<view class="previous" @tap="handleCalendar(0)">
|
||||
<button class="u-reset-button bar-btn u-p-r-30"><view class="u-iconfont uicon-arrow-left" style="color:#c4c4c4 ;font-size:28rpx ;"></view></button>
|
||||
</view>
|
||||
<view class="date">{{ cur_year || '--' }} 年 {{ cur_month || '--' }} 月</view>
|
||||
<view class="next" @tap="handleCalendar(1)">
|
||||
<button class="u-reset-button bar-btn u-p-l-30"><view class="u-iconfont uicon-arrow-right" style="color:#c4c4c4 ;font-size:28rpx ;"></view></button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 显示星期 -->
|
||||
<view class="week u-flex">
|
||||
<view class="week-item u-flex u-row-center" v-for="(item, index) in weeks_ch" :key="index">{{ item }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 日历表 -->
|
||||
<view class="myDateTable">
|
||||
<view v-for="(item, j) in days" :key="j" class="dateCell u-flex u-row-center u-col-center">
|
||||
<!-- 空格 -->
|
||||
<view v-if="!item.date" class="cell"><text :decode="true"> </text></view>
|
||||
<view v-else>
|
||||
<!-- 已签到日期 -->
|
||||
<view v-if="item.is_sign" class="cell is-sign">
|
||||
<text>{{ item.day }}</text>
|
||||
</view>
|
||||
<!-- 未签到日期 -->
|
||||
<view class="cell" v-else>
|
||||
<text>{{ item.day }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 签到按钮 -->
|
||||
<view class="u-flex u-col-center u-row-center sign-box">
|
||||
<button :disabled="isPresentMonth || isSign" @tap="onSign" class="u-reset-button sign-btn">{{ isSign ? '已签到' : '签到' }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-modal" :class="{ show: showSign }" @tap="showSign = false">
|
||||
<view class="sign-modal-box cu-dialog" style="width: 610rpx;">
|
||||
<view class="modal-head u-flex-col u-col-center">
|
||||
<image class="modal-bg" :src="$IMG_URL + '/imgs/modal/sign_modal_bg.jpg'" mode=""></image>
|
||||
<image class="sign-tag" :src="$IMG_URL + '/imgs/modal/sign_modal_succeed.png'" mode=""></image>
|
||||
<view class="sign-num-box">
|
||||
已连续打卡
|
||||
<text class="sign-num">{{ cuntinueDays }}</text>
|
||||
天
|
||||
</view>
|
||||
</view>
|
||||
<view class="modal-content u-flex-col u-col-center">
|
||||
<view class="sign-success">签到成功</view>
|
||||
<view class="sign-score">恭喜您获得{{ score || '0' }}积分</view>
|
||||
</view>
|
||||
<view class="modal-bottom u-flex u-row-center"><button class="u-reset-button confirem-btn" @tap="showSign = false">确认</button></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapMutations, mapActions, mapState } from 'vuex';
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
days: [], //日历
|
||||
cuntinueDays: 0, //签到天数
|
||||
score: '', //签到获得的积分
|
||||
cur_year: 0, //当前选的年
|
||||
cur_month: 0, //当前选的月
|
||||
cur_day: 0, //当前选择的天
|
||||
today: parseInt(new Date().getDate()), //本日
|
||||
toMonth: parseInt(new Date().getMonth() + 1), //本月
|
||||
toYear: parseInt(new Date().getFullYear()), //本年
|
||||
weeks_ch: ['日', '一', '二', '三', '四', '五', '六'], //星期
|
||||
isPresentMonth: false, //是否可签到
|
||||
isSign: false,
|
||||
showSign: false
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
onLoad() {
|
||||
this.cur_year = this.toYear;
|
||||
this.cur_month = this.toMonth;
|
||||
this.cur_day = this.today;
|
||||
this.getSignList();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getUserInfo']),
|
||||
// 当前签到记录
|
||||
getSignList() {
|
||||
let that = this;
|
||||
let month = that.cur_month < 10 ? '0' + that.cur_month : that.cur_month;
|
||||
let query = `${that.cur_year}-${month}`;
|
||||
that.$http('user.signList', {
|
||||
month: query
|
||||
}).then(res => {
|
||||
if (res.code == 1) {
|
||||
let emptyDays = that.calculateEmptyGrids();
|
||||
that.cuntinueDays = that.cuntinueDays === 0 ? res.data.cuntinue_days : that.cuntinueDays;
|
||||
that.days = [...emptyDays, ...res.data.days];
|
||||
that.selSign();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 选中日期
|
||||
selSign() {
|
||||
let that = this;
|
||||
let selToday = `${that.toYear}-${that.toMonth.toString().padStart(2, '0')}-${that.today.toString().padStart(2, '0')}`;
|
||||
let newDay = `${that.cur_year}-${that.cur_month.toString().padStart(2, '0')}-${that.cur_day.toString().padStart(2, '0')}`;
|
||||
if (selToday === newDay) {
|
||||
let day = that.days.find(item => {
|
||||
return item.date === selToday;
|
||||
});
|
||||
that.isSign = day.is_sign;
|
||||
}
|
||||
},
|
||||
// 计算当月1号前空了几个格子
|
||||
calculateEmptyGrids() {
|
||||
let that = this;
|
||||
let emptyDays = [];
|
||||
const firstDayOfWeek = new Date(Date.UTC(that.cur_year, that.cur_month - 1, 1)).getDay();
|
||||
if (firstDayOfWeek > 0) {
|
||||
for (let i = 0; i < firstDayOfWeek; i++) {
|
||||
let obj = {
|
||||
day: null,
|
||||
is_sign: false
|
||||
};
|
||||
emptyDays.push(obj);
|
||||
}
|
||||
}
|
||||
return emptyDays;
|
||||
},
|
||||
//签到
|
||||
onSign() {
|
||||
let that = this;
|
||||
let month = that.cur_month.toString().padStart(2, '0');
|
||||
let query = `${that.cur_year}-${month}`;
|
||||
that.$http(
|
||||
'user.sign',
|
||||
{
|
||||
month: query
|
||||
},
|
||||
'签到中...'
|
||||
).then(res => {
|
||||
if (res.code == 1) {
|
||||
that.getSignList();
|
||||
that.score = res.data.score;
|
||||
that.getUserInfo();
|
||||
that.showSign = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 切换控制年月,上一个月,下一个月
|
||||
handleCalendar(type) {
|
||||
const cur_year = parseInt(this.cur_year);
|
||||
const cur_month = parseInt(this.cur_month);
|
||||
let newMonth = cur_month;
|
||||
let newYear = cur_year;
|
||||
switch (type) {
|
||||
case 0:
|
||||
//上个月
|
||||
this.isPresentMonth = true;
|
||||
newMonth = cur_month - 1;
|
||||
if (newMonth < 1) {
|
||||
newYear = cur_year - 1;
|
||||
newMonth = 12;
|
||||
}
|
||||
if (newYear < this.toYear || (newYear === this.toYear && newMonth <= this.toMonth)) {
|
||||
this.isPresentMonth = false;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
newMonth = cur_month + 1;
|
||||
if (newMonth > 12) {
|
||||
newYear = cur_year + 1;
|
||||
newMonth = 1;
|
||||
}
|
||||
|
||||
if (newYear > this.toYear || (newYear === this.toYear && newMonth > this.toMonth)) {
|
||||
this.isPresentMonth = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.cur_year = newYear;
|
||||
this.cur_month = newMonth;
|
||||
this.getSignList();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// 日历
|
||||
.calendar {
|
||||
background: #fff;
|
||||
.sign-everyday {
|
||||
height: 100rpx;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
border: 1rpx solid rgba(223, 223, 223, 0.4);
|
||||
.sign-everyday-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
.sign-num-box {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
.sign-num {
|
||||
font-weight: 600;
|
||||
color: $brand-gold;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 年月日
|
||||
.bar {
|
||||
height: 100rpx;
|
||||
.date {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
// 星期
|
||||
.week {
|
||||
.week-item {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
// 日历表
|
||||
.myDateTable {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.dateCell {
|
||||
width: calc(750rpx/7);
|
||||
height: 80rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
.cell {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.is-sign {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: linear-gradient(132deg, rgba(243, 223, 177, 1), rgba(243, 223, 177, 1), rgba(236, 190, 96, 1));
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($brand-gold, 0.4);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
// 签到按钮
|
||||
.sign-box {
|
||||
height: 140rpx;
|
||||
width: 100%;
|
||||
.sign-btn {
|
||||
width: 219rpx;
|
||||
line-height: 70rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
}
|
||||
|
||||
.sign-modal-box {
|
||||
width: 520rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
position: relative;
|
||||
|
||||
.modal-head {
|
||||
height: 320rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
.modal-bg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.sign-tag {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
position: absolute;
|
||||
top: 50rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.sign-num-box {
|
||||
font-size: 30rpx;
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: 150rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
.sign-num {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.modal-content {
|
||||
padding: 30rpx 0;
|
||||
.sign-success {
|
||||
font-size: 34rpx;
|
||||
|
||||
font-weight: bold;
|
||||
color: rgba(227, 173, 91, 1);
|
||||
}
|
||||
.sign-score {
|
||||
font-size: 26rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
padding-top: 16rpx;
|
||||
}
|
||||
}
|
||||
.modal-bottom {
|
||||
padding-bottom: 47rpx;
|
||||
.confirem-btn {
|
||||
width: 300rpx;
|
||||
line-height: 70rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 35rpx;
|
||||
padding: 0;
|
||||
font-size: 28rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,248 @@
|
||||
<!-- 秒杀列表 -->
|
||||
<template>
|
||||
<view class="page_box seckill-list-wrap">
|
||||
<!-- tab栏 -->
|
||||
<view class="tab-box u-flex">
|
||||
<view class="tab-item u-flex-col u-row-center u-col-center" @tap="onTab(tab.id)" v-for="tab in tabList" :key="tab.id">
|
||||
<text class="tab-title u-m-b-20" :class="{ 'tab-active': tabCurrent === tab.id }">{{ tab.title }}</text>
|
||||
<text v-show="tabCurrent === tab.id" class="tab-line"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表 -->
|
||||
<view class="content_box">
|
||||
<scroll-view scroll-y="true" enable-back-to-top @scrolltolower="loadMore" class="scroll-box">
|
||||
<view class="goods-item u-m-b-16" v-for="item in goodsList" :key="item.id" @tap="toSeckillDetail(item.id)">
|
||||
<view class="big-goods u-flex u-p-20 u-col-top ">
|
||||
<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-red 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="cu-progress round sm" style="width:210rpx;"><view :style="[{ width: item.percent + '%',backgroundColor:'#1677FF' }]"></view></view>
|
||||
<view class="progress-text">已售出{{ item.sales }}件</view>
|
||||
</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.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="isEmpty" tipText="暂无秒杀商品,敬请期待~" :image="$IMG_URL + '/imgs/empty/empty_goods.png'"></shopro-empty>
|
||||
<!-- 加载更多 -->
|
||||
<u-loadmore v-if="!isEmpty" 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,
|
||||
tabCurrent: 'ing',
|
||||
goodsList: [],
|
||||
tabList: [
|
||||
{
|
||||
id: 'ing',
|
||||
title: '抢购进行中'
|
||||
},
|
||||
{
|
||||
id: 'nostart',
|
||||
title: '即将开始'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
onLoad() {
|
||||
this.getGoodsList();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.lastPage = 1;
|
||||
this.currentPage = 1;
|
||||
this.goodsList = [];
|
||||
this.getGoodsList();
|
||||
},
|
||||
methods: {
|
||||
onTab(id) {
|
||||
if (this.tabCurrent !== id) {
|
||||
this.tabCurrent = id;
|
||||
this.goodsList = [];
|
||||
this.currentPage = 1;
|
||||
this.lastPage = 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
toSeckillDetail(id) {
|
||||
this.$Router.push({ path: '/pages/goods/detail', query: { id: id } });
|
||||
},
|
||||
// 加载更多
|
||||
loadMore() {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
// 秒杀列表
|
||||
getGoodsList() {
|
||||
let that = this;
|
||||
that.loadStatus = 'loading';
|
||||
that.$http(
|
||||
'goods.timeSeckillList',
|
||||
{
|
||||
type: that.tabCurrent,
|
||||
page: that.currentPage
|
||||
},
|
||||
'加载中...'
|
||||
).then(res => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.code === 1) {
|
||||
that.goodsList = [...that.goodsList, ...res.data.data];
|
||||
that.goodsList.map(item => {
|
||||
item.percent = item.stock + item.sales > 0 ? ((item.sales / (item.sales + item.stock)) * 100).toFixed(2) : 0;
|
||||
});
|
||||
that.isEmpty = !that.goodsList.length;
|
||||
that.lastPage = res.data.last_page;
|
||||
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.seckill-list-wrap {
|
||||
background: url($IMG_URL+'/imgs/seckill/sekill_list_head_bg.png') no-repeat;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
// tab
|
||||
.tab-box {
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
height: 140rpx;
|
||||
color: rgba(#fff, 0.4);
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
.tab-line {
|
||||
width: 50rpx;
|
||||
height: 8rpx;
|
||||
background: #fff;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-active {
|
||||
color: rgba(#fff, 1);
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box {
|
||||
background: $brand-header-gradient;
|
||||
width: 710rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
// 列表
|
||||
.goods-item {
|
||||
// 大商品卡片
|
||||
.big-goods {
|
||||
width: 710rpx;
|
||||
height: 260rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 7rpx 8rpx 1rpx rgba(254, 76, 29, 0.05);
|
||||
border-radius: 20rpx;
|
||||
.goods-img {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.card-right {
|
||||
width: 430rpx;
|
||||
height: 220rpx;
|
||||
}
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
width: 400rpx;
|
||||
color: #000000;
|
||||
}
|
||||
.subtitle-text {
|
||||
font-size: 22rpx;
|
||||
width: 400rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
.progress-text {
|
||||
color: #c4c4c4;
|
||||
font-size: 20rpx;
|
||||
margin-left: 25rpx;
|
||||
}
|
||||
// 价格
|
||||
.price {
|
||||
color: $brand-price;
|
||||
font-weight: 600;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
.origin-price {
|
||||
color: #c4c4c4;
|
||||
font-size: 24rpx;
|
||||
text-decoration: line-through;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
.btn-end,
|
||||
.btn-nostart {
|
||||
background: rgba(238, 238, 238, 1);
|
||||
color: #999999;
|
||||
}
|
||||
.btn-ing {
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户