前端小程序

这个提交包含在:
可乐加冰
2026-09-14 17:24:53 +08:00
父节点 bb69a43a0f
当前提交 019630f12c
共有 2629 个文件被更改,包括 403657 次插入 和 0 次删除

查看文件

@@ -0,0 +1,157 @@
<template>
<view class="sh-activity-box">
<view class="u-flex activity-box u-col-top">
<view class="title">优惠</view>
<view class="activity-content u-flex-1">
<view class="tip-list u-flex u-flex-1 u-col-center" v-for="item in detail" :key="item.id" @tap="showActivity(item.type)">
<view class="u-flex u-flex-1 u-col-center">
<view class="title-tag cu-tag bg-red sm radius u-m-r-10">{{ item.title }}</view>
<view class="tag-box cu-tag line-red sm radius u-m-r-10" v-if="index < 3" v-for="(tag, index) in item.tags" :key="tag">{{ tag }}</view>
</view>
<view class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;font-size: 28rpx;"></view>
</view>
</view>
</view>
<!-- 活动弹窗 -->
<u-popup v-if="showModal" v-model="showModal" @close="onClose" mode="bottom" border-radius="30" :closeable="true" close-icon-pos="top-right">
<view class="activity-modal-box page_box">
<view class="modal-head u-flex u-row-center u-col-center">
<text class="head-title">{{ activityMap[activityType].title }}</text>
</view>
<view class="modal-content content_box">
<view class="tip-list u-flex u-flex-1 u-col-center" @tap="toSelGoods">
<view class="u-flex u-flex-1 modal-item u-row-between u-col-center">
<view class="title-tag cu-tag bg-red sm radius u-m-r-10">{{ activityMap[activityType].title }}</view>
<view class="u-flex u-col-center">
<view class="tag-box cu-tag line-red sm radius u-m-r-10" v-for="(tag, index) in activityMap[activityType].tags" :key="tag">{{ tag }}</view>
</view>
</view>
<view class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;font-size: 28rpx;"></view>
</view>
<view class="all-goods-num">共有{{ activityMap[activityType].num }}件商品参加此活动</view>
</view>
<view class="modal-foot u-flex u-row-center u-col-center"><button class=" u-reset-button serve-btn" @tap="toSelGoods">去凑单</button></view>
</view>
</u-popup>
</view>
</template>
<script>
/**
* 参与优惠活动卡片
* @property {Array} detail - 优惠活动详情列表
* @property {Boolean} showModal- 显隐
*/
export default {
components: {},
data() {
return {
showModal: false,
activityType: ''
};
},
props: {
detail: {
type: Array,
default: () => []
}
},
created() {},
computed: {
activityMap() {
let obj = {};
this.detail.forEach(item => {
obj[item.type] = item;
obj[item.type].num = item.goods_ids.split(',').length;
});
return obj;
}
},
methods: {
// 显示
showActivity(type) {
this.activityType = type;
this.showModal = true;
},
// 关闭
onClose() {
this.activityType = '';
this.showModal = false;
},
// 去凑单
toSelGoods() {
this.$Router.push({
path: '/pages/activity/discounts/list',
query: this.activityMap[this.activityType]
});
this.activityType = '';
this.showModal = false;
}
}
};
</script>
<style lang="scss">
.activity-box {
background: #fff;
padding: 30rpx 20rpx 0;
margin: 10rpx 0;
.title {
font-size: 28rpx;
color: #999;
margin-right: 20rpx;
}
.activity-content {
.tip-list {
font-size: 28rpx;
width: 100%;
padding-bottom: 30rpx;
}
}
}
// 弹窗
.activity-modal-box {
width: 750rpx;
min-height: 700rpx;
border-radius: 30rpx 30rpx 0 0;
background: #fff;
padding: 30rpx;
.serve-btn {
width: 690rpx;
line-height: 80rpx;
background: linear-gradient(90deg, rgba(240, 199, 133, 1), rgba(246, 214, 157, 1));
border-radius: 40rpx;
font-size: 30rpx;
color: rgba(#fff, 0.9);
margin-top: 40rpx;
}
.modal-head {
margin-bottom: 30rpx;
position: relative;
.head-title {
font-size: 32rpx;
font-weight: bold;
}
}
.modal-content {
overflow-y: auto;
.tip-list {
font-size: 28rpx;
width: 100%;
padding: 20rpx 0;
border-bottom: 1rpx solid #eeeeee;
}
.all-goods-num {
font-size: 28rpx;
font-weight: 500;
color: #333333;
padding: 20rpx 0;
}
}
}
</style>

查看文件

@@ -0,0 +1,100 @@
<template>
<view class="comment-box">
<view class="head u-flex u-row-between">
<view class="u-flex">
<image class="avatar" :src="comment.user ? comment.user.avatar : $IMG_URL + '/imgs/base_avatar.png'" mode="aspectFill"></image>
<view class="user-name u-ellipsis-1">{{ comment.user ? comment.user.nickname : '***' }}</view>
<u-rate :value="comment.level" disabled></u-rate>
</view>
<text class="time">{{ $u.timeFormat(comment.createtime, 'yyyy-mm-dd hh:MM') }}</text>
</view>
<view class="detail">{{ comment.content }}</view>
<view class="img-box u-flex u-row-center u-col-center">
<view class="nav u-flex u-flex-wrap">
<image
v-for="(img, index) in comment.images"
:key="index"
@tap.stop="tools.previewImage(comment.images, index)"
class="comment-img"
:src="img"
mode="aspectFill"
></image>
</view>
</view>
</view>
</template>
<script>
/**
* 评论信息卡片
* @property {Object} comment - 评论信息
*/
export default {
components: {},
data() {
return {};
},
props: {
comment: {}
},
computed: {},
methods: {}
};
</script>
<style lang="scss">
.comment-box {
padding: 30rpx 20rpx;
border-bottom: 1rpx solid #eee;
background: #fff;
.head {
margin-bottom: 20rpx;
.avatar {
width: 52rpx;
height: 52rpx;
border-radius: 50%;
background: #ccc;
}
.user-name {
font-size: 26rpx;
color: #999;
width: 140rpx;
margin: 0 20rpx;
}
.time {
font-size: 24rpx;
color: #c4c4c4;
}
}
.detail {
font-size: 26rpx;
font-weight: 500;
color: rgba(102, 102, 102, 1);
line-height: 42rpx;
}
.img-box {
margin-top: 30rpx;
position: relative;
.nav {
width: 670rpx;
}
.comment-img {
width: 160rpx;
height: 160rpx;
background: #ccc;
margin-right: 10rpx;
margin-bottom: 10rpx;
border-radius: 6rpx;
&:nth-child(4n) {
margin-right: 0;
}
}
}
}
</style>

查看文件

@@ -0,0 +1,81 @@
<template>
<view class="category-box u-m-b-10">
<swiper class="swiper-box" @change="onSwiper" circular :autoplay="false" :interval="3000" :duration="1000">
<swiper-item v-for="(c, index) in couponList" :key="c.id">
<view class="tab-list u-flex u-row-center u-col-center">
<shopro-coupon :couponData="c":state="0"></shopro-coupon>
</view>
</swiper-item>
</swiper>
<view class="category-dots">
<text :class="categoryCurrent === index ? 'category-dot-active' : 'category-dot'"
v-for="(dot, index) in couponList.length" :key="index"></text>
</view>
</view>
</template>
<script>
/**
* 详情优惠券轮播 - 详情专用
* @property {Object} couponList - 优惠劵列表
*/
export default {
components: {},
data() {
return {
categoryCurrent: 0 //分类轮播下标
};
},
props: {
couponList: {}
},
computed: {},
methods: {
// 轮播
onSwiper(e) {
this.categoryCurrent = e.detail.current;
}
}
};
</script>
<style lang="scss">
.category-box {
padding-top: 20rpx;
background: #fff;
height: 230rpx;
position: relative;
.swiper-box {
height: 210rpx;
.tab-list {
::v-deep .coupon-wrap {
width: 710rpx;
}
}
}
.category-dots {
display: flex;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 15rpx;
.category-dot {
width: 40rpx;
height: 3rpx;
background: #eeeeee;
margin-right: 10rpx;
}
.category-dot-active {
width: 40rpx;
height: 3rpx;
background: $brand-gold-gradient;
margin-right: 10rpx;
}
}
}
</style>

查看文件

@@ -0,0 +1,168 @@
<template>
<view class="filter-box">
<view class="cu-modal" style="z-index: -1;" :class="{ show: showSel }" @tap="hideModal"></view>
<view class="navbar">
<view class="sel-box u-flex-col" v-show="showSel">
<view class="sel-item" @tap="onSel(0)" :class="{ 'sel-active': defaultOrder === 0 && filterIndex === 0 }">综合</view>
<view class="sel-item" @tap="onSel(1)" :class="{ 'sel-active': defaultOrder === 1 && filterIndex === 0 }">扩展自定义排序</view>
</view>
<view class="nav-item u-flex-col" :class="{ current: filterIndex === 0 }" @tap="tabClick(0)">
<view class="title-box u-flex u-col-center">
<text class="filter-title">{{ defaultOrder === 1 ? '自定义' : '综合' }}</text>
<view class="p-box"><text style="font-size: 22rpx;" :class="{ active: filterIndex === 0 }" class="u-iconfont uicon-arrow-up u-m-l-6"></text></view>
</view>
<view class="line" :class="{ 'line-active': filterIndex === 0 }"></view>
</view>
<view class="nav-item u-flex-col" :class="{ current: filterIndex === 1 }" @tap="tabClick(1)">
<view class="title-box u-flex"><text class="filter-title">销量</text></view>
<view class="line" :class="{ 'line-active': filterIndex === 1 }"></view>
</view>
<view class="nav-item u-flex-col" :class="{ current: filterIndex === 2 }" @tap="tabClick(2)">
<view class="title-box u-flex">
<text class="filter-title">价格</text>
<view class="p-box u-flex-col u-m-l-6">
<view
class="u-iconfont uicon-arrow-up"
:style="{ fontSize: '20rpx', lineHeight: '18rpx', color: priceOrder === 1 && filterIndex === 2 ? '#1677FF' : '#333' }"
></view>
<view
class="u-iconfont uicon-arrow-down"
:style="{ fontSize: '20rpx', lineHeight: '18rpx', color: priceOrder === 2 && filterIndex === 2 ? '#1677FF' : '#333' }"
></view>
</view>
</view>
<view class="line" :class="{ 'line-active': filterIndex === 2 }"></view>
</view>
<view class="nav-item u-flex-col" :class="{ current: filterIndex === 3 }" @tap="tabClick(3)">
<view class="title-box"><text class="filter-title">新品优先</text></view>
<view class="line" :class="{ 'line-active': filterIndex === 3 }"></view>
</view>
</view>
</view>
</template>
<script>
/**
* 商品筛选组件
*
*/
import { mapState, mapActions, mapMutations } from 'vuex';
export default {
components: {},
props: {},
data() {
return {
filterIndex: 0,
showSel: false, //综合选择
defaultOrder: 0, //综合
priceOrder: 0, //价格
salesOrder: 0, //销量
newProdcutOrder: 0 //新品优先
};
},
computed: {
filterData() {
const data = {
defaultOrder: this.defaultOrder,
priceOrder: this.priceOrder,
salesOrder: this.salesOrder,
newProdcutOrder: this.newProdcutOrder
};
return data;
}
},
onLoad() {},
methods: {
//筛选
tabClick(index) {
this.filterIndex = index;
index === 0 ? (this.showSel = !this.showSel) : (this.showSel = false);
index === 1 ? (this.salesOrder = 1) : (this.salesOrder = 0);
index === 2 ? (this.priceOrder = this.priceOrder === 1 ? 2 : 1) : (this.priceOrder = 0);
index === 3 ? (this.newProdcutOrder = 1) : (this.newProdcutOrder = 0);
this.$emit('change', this.filterData);
},
onSel(dot) {
this.defaultOrder = dot;
this.$emit('change', this.filterData);
this.showSel = false;
},
hideModal() {
this.showSel = false;
}
}
};
</script>
<style lang="scss">
.sel-box {
position: absolute;
width: 750rpx;
height: 140rpx;
background: rgba(246, 246, 246, 1);
border-radius: 0px 0px 20rpx 20rpx;
z-index: 999;
left: 50%;
transform: translateX(-50%);
bottom: -138rpx;
transition: all ease-out 0.2s;
.sel-item {
color: #333;
padding: 20rpx 40rpx 0;
font-size: 24rpx;
font-weight: 500;
}
.sel-active {
color: #1677FF;
font-size: 26rpx;
font-weight: 600;
}
}
.filter-box {
width: 750rpx;
}
.navbar {
display: flex;
width: 750rpx;
height: 95rpx;
background: #fff;
border-bottom: 1upx solid #e6e6e6;
position: relative;
z-index: 999;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 30rpx;
position: relative;
.filter-title {
font-size: 28rpx;
color: #333;
font-weight: 600;
}
.line {
width: 110rpx;
height: 4rpx;
background: transparent;
position: absolute;
bottom: 0;
z-index: 2;
}
.line-active {
background: $brand-primary;
}
.p-box {
display: flex;
flex-direction: column;
}
}
}
.current {
color: #1677FF;
}
</style>

查看文件

@@ -0,0 +1,220 @@
<template>
<view class="group-people">
<block v-if="grouponTeamList.length">
<view class="into-title u-flex u-row-between">
<text>已有{{ grouponData.sales }}人参与活动</text>
<view class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;font-size: 28rpx;" @tap="onMoreGrouponTeam"></view>
</view>
<view class="into-item u-flex u-row-between" v-for="(g, index) in grouponTeamList" :key="g.id" v-if="index < 2">
<view class="u-flex">
<image class="into-img" :src="g.leader.user_avatar" mode="aspectFill"></image>
<text class="into-name">{{ g.leader.user_nickname }}</text>
</view>
<view class="u-flex">
<view class="">
<view class="num">
还差
<text class="num-color">{{ g.num - g.current_num }}人</text>
成团
</view>
<view class="time" v-if="g.expiretime && g.time">剩余时间{{ g.time.h }}:{{ g.time.m }}:{{ g.time.s }}</view>
</view>
<button class="u-reset-button join-btn" @tap="jump('/pages/activity/groupon/detail', { id: g.id })">去参团</button>
</view>
</view>
</block>
<!-- 弹窗 -->
<u-popup v-model="showModal" mode="bottom" :closeable="true" close-icon-pos="top-right">
<view class="modal-box page_box">
<view class="modal-head u-flex u-row-center">
<text class="head-title">正在拼团</text>
</view>
<view class="modal-content content_box y-f">
<view class="into-item u-flex u-row-between" v-for="g in grouponTeamList" :key="g.id">
<view class="u-flex">
<image class="into-img" :src="g.leader.user_avatar" mode="aspectFill"></image>
<text class="into-name">{{ g.leader.user_nickname }}</text>
</view>
<view class="u-flex">
<view class="y-end">
<view class="num">
还差
<text class="num-color">{{ g.num - g.current_num }}人</text>
成团
</view>
<view class="time" v-if="g.expiretime && g.time">剩余时间{{ g.time.h }}:{{ g.time.m }}:{{ g.time.s }}</view>
</view>
<button class="u-reset-button join-btn" @tap="joinTeam('/pages/activity/groupon/detail', { id: g.id })">去参团</button>
</view>
</view>
</view>
<view class="modal-foot u-flex u-row-center u-col-center">仅显示10个正在拼团的人</view>
</view>
</u-popup>
</view>
</template>
<script>
/**
* 商品已拼团卡片
* @property {Object} grouponData - 商品已拼团信息
*/
let timer;
export default {
components: {},
data() {
return {
grouponTeamList: [], //原数组
showModal: false
};
},
props: {
grouponData: {}
},
computed: {},
beforeDestroy() {
clearInterval(timer);
timer=null
},
created() {
this.getGrouponItem();
let that = this;
timer = setInterval(() => {
that.grouponTeamList.forEach((item, index) => {
let nowTime = new Date().getTime();
let endTime = item.expiretime * 1000;
let t = (endTime - nowTime) / 1000;
let time = that.$tools.format(t);
that.$set(that.grouponTeamList[index], 'time', time);
});
}, 1000);
},
methods: {
hideModal() {
this.showModal = false;
},
jump(path, parmas) {
this.$Router.push({
path: path,
query: parmas
});
},
joinTeam(path, parmas) {
this.showModal = false;
this.$Router.push({
path: path,
query: parmas
});
},
onMoreGrouponTeam() {
this.showModal = true;
},
// 拼购人
getGrouponItem() {
let that = this;
that.$http('goods.grouponItem', {
goods_id: that.grouponData.id,
activity_id: that.grouponData.activity.id
}).then(res => {
if (res.code === 1) {
that.grouponTeamList = res.data;
}
});
}
}
};
</script>
<style lang="scss">
// 弹窗
.modal-box {
width: 750rpx;
height: 800rpx;
border-radius: 30rpx 30rpx 0 0;
background: #fff;
.modal-head {
height: 92rpx;
border-bottom: 1px solid rgba(223, 223, 223, 0.5);
padding: 0 30rpx;
.head-title {
font-size: 32rpx;
font-weight: bold;
}
}
.modal-content {
padding: 0 30rpx;
}
.modal-foot {
font-size: 24rpx;
font-weight: 500;
color: rgba(153, 153, 153, 1);
height: 80rpx;
border-top: 1px solid rgba(223, 223, 223, 0.5);
}
}
// 拼团人数
.group-people {
background-color: #fff;
padding: 0 20rpx;
margin-top: 10rpx;
.into-title {
height: 80rpx;
font-size: 26rpx;
font-weight: bold;
}
}
.into-item {
height: 120rpx;
width: 100%;
border-bottom: 1rpx solid #eee;
.into-img {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
margin-right: 23rpx;
background-color: #ccc;
}
.into-name {
font-size: 28rpx;
font-weight: 500;
color: rgba(102, 102, 102, 1);
}
.num {
font-size: 26rpx;
color: #666;
.num-color {
font-size: 24rpx;
color: $brand-price;
}
}
.time {
font-size: 22rpx;
margin-top: 10rpx;
color: #999;
}
.join-btn {
width: 140rpx;
line-height: 60rpx;
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: 30rpx;
padding: 0;
font-size: 26rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
margin-left: 40rpx;
}
}
</style>

查看文件

@@ -0,0 +1,180 @@
<template>
<view class="sh-paramsr-box">
<view class="u-flex u-row-between params-box" @tap="showModal = true">
<view class="u-flex">
<text class="title">参数</text>
<view class="tip u-flex">
<view class="tip-list" v-for="(params, index) of paramsList" v-if="index < 2" :key="params.title">
<view class="">
<text>{{ params.title }}:{{ params.content }}</text>
</view>
</view>
</view>
</view>
<view class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;font-size: 28rpx;"></view>
</view>
<u-popup v-model="showModal" mode="bottom" :closeable="true" close-icon-pos="top-right">
<view class="paramsr-modal">
<view class="paramsr-modal-box page_box">
<view class="modal-head u-flex u-row-center u-col-center"><text class="head-title">商品参数</text>
</view>
<view class="modal-content content_box">
<scroll-view class="goods-size" scroll-y="true" >
<view class="table-box">
<view class="t-tr u-flex" v-for="t in paramsList" :key="t.title">
<view class="t-head u-flex">{{ t.title }}</view>
<view class="t-detail">{{ t.content }}</view>
</view>
</view>
</scroll-view>
</view>
<view class="modal-foot u-flex u-row-center u-col-center"><button class=" u-reset-button params-btn"
@tap="showModal = false">确定</button></view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
/**
* 商品参数卡片
* @property {Array} paramsList - 商品参数列表
* @property {Boolean} showModal- 显隐
*/
export default {
components: {},
data() {
return {
showModal: false
};
},
props: {
paramsList: {
type: Array,
default: () => []
}
},
computed: {},
methods: {}
};
</script>
<style lang="scss">
.goods-size {
height: 970rpx;
.table-box {
// width: 710rpx;
margin: auto;
background: rgba(255, 255, 255, 1);
border: 1rpx solid rgba(223, 223, 223, 1);
.t-tr {
border-bottom: 1rpx solid rgba(223, 223, 223, 1);
&:last-child {
border-bottom: none;
}
.t-head {
font-size: 26rpx;
color: #999;
flex: 2;
padding: 15rpx 20rpx;
height: 100%;
}
.t-detail {
font-size: 26rpx;
border-left: 1rpx solid rgba(223, 223, 223, 1);
flex: 2;
padding: 15rpx 20rpx;
height: 100%;
}
}
}
}
.params-box {
line-height: 82rpx;
background: #fff;
padding: 0 20rpx;
margin: 10rpx 0;
.title {
font-size: 28rpx;
color: #999;
margin-right: 20rpx;
}
.tip {
.tip-list {
font-size: 28rpx;
margin-right: 20rpx;
.tip-img {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
}
}
}
.paramsr-modal-box {
width: 750rpx;
height: 100%;
border-radius: 30rpx 30rpx 0 0;
background: #fff;
padding: 30rpx;
.params-btn {
width: 690rpx;
line-height: 80rpx;
background: linear-gradient(90deg, rgba(240, 199, 133, 1), rgba(246, 214, 157, 1));
border-radius: 40rpx;
font-size: 30rpx;
color: rgba(#fff, 0.9);
margin-top: 40rpx;
}
.modal-head {
margin-bottom: 30rpx;
position: relative;
.head-title {
font-size: 32rpx;
font-weight: bold;
}
}
.modal-content {
overflow-y: auto;
.params-list {
padding-bottom: 40rpx;
.title-tag {
width: 38rpx;
height: 38rpx;
margin-right: 20rpx;
}
.params-title {
font-size: 28rpx;
font-weight: bold;
}
.params-detail {
text-align: left;
font-size: 26rpx;
color: #999;
line-height: 42rpx;
padding-left: 58rpx;
margin-top: 20rpx;
}
}
}
}
</style>

查看文件

@@ -0,0 +1,601 @@
<template>
<view>
<!-- 正常商品 -->
<view class="normal-price-box" v-if="type !== 'score' && !detail.activity">
<view class="u-felx u-col-bottom price-top">
<text class="unit font-OPPOSANS">¥</text>
<text class="price font-OPPOSANS">{{ detail.price }}</text>
<text class="notice">优惠价</text>
</view>
<view class="u-flex u-row-left price-bottom-box">
<view class="u-flex">
<view class="original-price font-OPPOSANS">原价:¥{{ detail.original_price }}</view>
<text class="line"></text>
<view class="sold font-OPPOSANS">已售:{{ detail.sales }}件</view>
</view>
</view>
</view>
<!-- 积分商品 -->
<view class="score-price-card" v-if="type === 'score'">
<view class="u-flex u-col-bottom">
<image class="score-img" :src="$IMG_URL + '/imgs/score/score.png'" mode=""></image>
<text class="price">{{ detail.price }}</text>
</view>
<view class="u-felx u-col-bottom price-bottom-box">
<view class="u-flex">
<view class="original-price font-OPPOSANS">价值:¥{{ detail.original_price }}</view>
<text class="line"></text>
<view class="sold font-OPPOSANS">已兑换:{{ detail.sales }}件</view>
</view>
</view>
</view>
<!-- 团购商品 -->
<view class="groupon-price-box" v-if="detail.activity && detail.activity.type === 'groupon'">
<view class="u-flex u-col-bottom">
<text class="unit font-OPPOSANS">¥</text>
<text class="price font-OPPOSANS">{{ detail.activity_type === 'groupon' ? detail.groupon_price : detail.price }}</text>
<text class="notice font-OPPOSANS">{{ detail.activity.rules.team_num }}人团</text>
</view>
<view class="u-flex u-row-between price-bottom-box">
<view class="u-flex">
<view class="original-price font-OPPOSANS">原价:¥{{ detail.original_price }}</view>
<text class="line"></text>
<view class="sold font-OPPOSANS">已拼:{{ detail.sales }}件</view>
</view>
<view class="count-down font-OPPOSANS" v-show="activityRules.status !== 'end'">
<text class="u-p-r-10" v-show="activityRules.status === 'waiting'">距开始</text>
<text class="u-p-r-10" v-show="activityRules.status === 'ing'">距结束</text>
{{ activityRules.countDownTime.h || '00' }} : {{ activityRules.countDownTime.m || '00' }} : {{ activityRules.countDownTime.s || '00' }}
</view>
<view class="count-down" v-show="activityRules.status === 'end'">活动已结束</view>
</view>
</view>
<!-- 预约抢购商品 -->
<view class="robbuy-price-box " :class="activityRules.status !== 'end' ? 'robbuy-bg' : 'robbuyed-bg'" v-if="detail.activity && detail.activity.type === 'robbuy'">
<view class="u-flex u-row-between price-top-box">
<view class="u-flex">
<text class="unit font-OPPOSANS">¥</text>
<text class="price font-OPPOSANS">{{ detail.price }}</text>
<text class="notice">抢购价</text>
</view>
<view class="count-down font-OPPOSANS" v-show="activityRules.status !== 'end'">
<text class="u-p-r-10" v-show="activityRules.status === 'waiting'">距预约开始</text>
<text class="u-p-r-10" v-show="activityRules.status === 'ing'">距预约仅剩</text>
{{ activityRules.countDownTime.d || '00' }} 天 {{ activityRules.countDownTime.h || '00' }} : {{ activityRules.countDownTime.m || '00' }} : {{ activityRules.countDownTime.s || '00' }}
</view>
<view class="count-down" v-show="activityRules.status === 'end'">抢购开始</view>
</view>
<view class="u-flex u-row-between price-bottom-box">
<view class="u-flex">
<view class="original-price font-OPPOSANS">原价:¥{{ detail.original_price }}</view>
<text class="line"></text>
<view class="sold font-OPPOSANS">已售:{{ detail.sales }}件</view>
</view>
<view class="express">
<view class="u-flex">
<view style="width:100rpx;">
<u-line-progress height="14" :show-percent="false" :percent="percent" inactive-color="#a1071a" active-color="#fff"></u-line-progress>
</view>
<view class="progress-text" v-if="detail.stock > 0">仅剩{{ detail.stock }}件</view>
<view class="progress-text" v-else>已售罄</view>
</view>
</view>
</view>
</view>
<!-- 秒杀商品 -->
<view class="seckill-price-box " :class="activityRules.status !== 'end' ? 'seckill-bg' : 'seckilled-bg'" v-if="detail.activity && detail.activity.type === 'seckill' || detail.activity.type === 'timer'">
<view class="u-flex u-row-between price-top-box">
<view class="u-flex">
<text class="unit font-OPPOSANS">¥</text>
<text class="price font-OPPOSANS">{{ detail.price }}</text>
<text class="notice">秒杀价</text>
</view>
<view class="count-down font-OPPOSANS" v-show="activityRules.status !== 'end'">
<text class="u-p-r-10" v-show="activityRules.status === 'waiting'">距开始</text>
<text class="u-p-r-10" v-show="activityRules.status === 'ing'">距结束</text>
{{ activityRules.countDownTime.h || '00' }} : {{ activityRules.countDownTime.m || '00' }} : {{ activityRules.countDownTime.s || '00' }}
</view>
<view class="count-down" v-show="activityRules.status === 'end'">活动已结束</view>
</view>
<view class="u-flex u-row-between price-bottom-box">
<view class="u-flex">
<view class="original-price font-OPPOSANS">原价:¥{{ detail.original_price }}</view>
<text class="line"></text>
<view class="sold font-OPPOSANS">已售:{{ detail.sales }}件</view>
</view>
<view class="express">
<view class="u-flex">
<view style="width:100rpx;" v-show="activityRules.status !== 'end'">
<u-line-progress height="14" :show-percent="false" :percent="percent" inactive-color="#a1071a" active-color="#fff"></u-line-progress>
</view>
<view class="progress-text" v-if="detail.stock > 0">仅剩{{ detail.stock }}件</view>
<view class="progress-text" v-else>已售罄</view>
</view>
</view>
</view>
</view>
<!-- 限时促销 -->
<view class="promote-price-box" :class="activityRules.status !== 'end' ? 'promote-bg' : 'promoteed-bg'" v-if="detail.activity && detail.activity.type === 'promote'">
<view class="u-flex u-row-between price-top-box">
<view class="u-flex">
<text class="unit font-OPPOSANS">¥</text>
<text class="price font-OPPOSANS">{{ detail.price }}</text>
<text class="notice">促销价</text>
</view>
<view class="count-down font-OPPOSANS" v-show="activityRules.status !== 'end'">
<text class="u-p-r-10" v-show="activityRules.status === 'waiting'">距开始</text>
<text class="u-p-r-10" v-show="activityRules.status === 'ing'">距结束</text>
{{ activityRules.countDownTime.h || '00' }} : {{ activityRules.countDownTime.m || '00' }} : {{ activityRules.countDownTime.s || '00' }}
</view>
<view class="count-down" v-show="activityRules.status === 'end'">活动已结束</view>
</view>
<view class="u-flex u-row-between price-bottom-box">
<view class="u-flex">
<view class="original-price font-OPPOSANS">原价:¥{{ detail.original_price }}</view>
<text class="line"></text>
<view class="sold font-OPPOSANS">已售:{{ detail.sales }}件</view>
</view>
<view class="express">
<view class="u-flex">
<view style="width:100rpx;" v-show="activityRules.status !== 'end'">
<u-line-progress height="14" :show-percent="false" :percent="percent" inactive-color="#a1071a" active-color="#fff"></u-line-progress>
</view>
<view class="progress-text" v-if="detail.stock > 0">仅剩{{ detail.stock }}件</view>
<view class="progress-text" v-else>已售罄</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
/**
* 商品详情价格卡片
* @property {Object} detail - 商品详情
* @property {String} type - 商品分类
*/
let timer = null;
export default {
components: {},
data() {
return {
time: {}, // 倒计时
activityRules: {
startTime: 0,
endTime: 0,
status: '',
countDownTime: 0
}
};
},
props: {
detail: Object,
type: ''
},
created() {
if (this.detail.activity && this.detail.activity.type) {
this.doActivityRules();
}
},
beforeDestroy() {
clearInterval(timer);
timer = null;
},
computed: {
// 百分比
percent() {
let unit = 0;
if (this.detail.id) {
unit = this.detail.stock + this.detail.sales > 0 ? ((this.detail.sales / (this.detail.sales + this.detail.stock)) * 100).toFixed(2) : 0;
}
return Number(unit);
}
},
methods: {
// 触发活动规则
doActivityRules() {
let that = this;
switch (that.detail.activity.type) {
case 'seckill' :
case 'timer' :
case 'groupon' :
case 'robbuy' :
case 'promote' :
that.activityRules.startTime = that.detail.activity.starttime * 1000;
that.activityRules.endTime = that.detail.activity.endtime * 1000;
that.countDown();
break;
}
},
// 计时器
countDown() {
let that = this;
let t = 0;
timer = setInterval(() => {
let nowTime = new Date().getTime();
// 当前日期大于活动结束日期,活动结束
if (that.activityRules.endTime < nowTime) {
that.activityRules.status = 'end';
that.$emit('change', JSON.stringify(that.activityRules));
}
// 活动未结束
if (nowTime < that.activityRules.startTime) {
// 当前日期小于开始时间,活动未开始
that.activityRules.status = 'waiting';
t = that.activityRules.startTime - nowTime;
} else if (nowTime > that.activityRules.endTime) {
// 当前日期大于结束时间,活动结束
that.activityRules.status = 'end';
clearInterval(timer);
return;
} else {
// 活动进行中
that.activityRules.status = 'ing';
t = that.activityRules.endTime - nowTime;
}
that.activityRules.countDownTime = that.formatToHours(t / 1000);
t--;
that.$emit('change', JSON.stringify(that.activityRules));
}, 1000);
},
// 时间格式化(格式化最大为小时)
formatToHours(t) {
let format = {
d: '00',
h: '00',
m: '00',
s: '00'
};
if (t > 0) {
let d = ''
let h = '';
let m = '';
let s = '';
if (this.detail.activity.type == 'robbuy') {
d = Math.floor(t / (3600 * 24))
h = Math.floor((t % (3600 * 24)) / 3600);
m = Math.floor((t % 3600) / 60);
s = Math.floor(t % 60);
} else {
h = Math.floor(t / 3600);
m = Math.floor((t / 60) % 60);
s = Math.floor(t % 60);
}
format.d = d < 10 ? '0' + d : d;
format.h = h < 10 ? '0' + h : h;
format.m = m < 10 ? '0' + m : m;
format.s = s < 10 ? '0' + s : s;
}
return format;
}
}
};
</script>
<style lang="scss">
// 正常商品
.normal-price-box {
margin: 0 20rpx;
padding: 24rpx 28rpx;
border-radius: 20rpx;
background: linear-gradient(135deg, $brand-primary-light 0%, $brand-page-bg 100%);
border: 1rpx solid rgba(22, 119, 255, 0.25);
box-shadow: $brand-shadow;
.price-top {
align-items: baseline;
}
.unit {
font-size: 28rpx;
color: $brand-price;
font-weight: 600;
}
.notice {
font-size: 22rpx;
color: $brand-gold;
background: rgba(22, 119, 255, 0.12);
border-radius: 6rpx;
padding: 4rpx 12rpx;
margin-left: 8rpx;
}
.price {
font-size: 48rpx;
color: $brand-price;
font-weight: 700;
margin: 0 4rpx;
line-height: 1;
}
.price-bottom-box {
font-size: 24rpx;
color: $brand-text-muted;
font-weight: 400;
padding-top: 12rpx;
.original-price {
text-decoration: line-through;
color: $brand-text-muted;
}
.sold {
color: $brand-text-muted;
}
.line {
margin: 0 16rpx;
display: inline-block;
width: 2rpx;
height: 22rpx;
background-color: $brand-border;
}
}
}
// 团购商品
.groupon-price-box {
padding: 20rpx;
background: url($IMG_URL+'/imgs/detail/detail_group_price_bg.png') no-repeat;
background-size: 100% 100%;
.unit,
.notice {
font-size: 24rpx;
color: rgba(#fff, 0.9);
}
.notice {
line-height: 40rpx;
border: 1rpx solid rgba(255, 255, 255, 1);
border-radius: 6rpx;
padding: 0 10rpx;
}
.price {
font-size: 36rpx;
color: rgba(#fff, 0.9);
font-weight: bold;
margin: 0 10rpx;
}
.price-bottom-box {
font-size: 24rpx;
color: rgba(#fff, 0.9);
font-weight: 500;
padding-top: 10rpx;
.line {
margin: 0 20rpx;
display: inline-block;
width: 3rpx;
height: 24rpx;
background-color: #fff;
}
.count-down {
font-size: 24rpx;
color: rgba(#fff, 0.9);
}
}
}
// 积分商品价格卡片
.score-price-card {
padding: 20rpx;
background: url($IMG_URL+'/imgs/detail/detail_price_score_bg.png') no-repeat;
background-size: 100% 100%;
width: 750rpx;
.notice {
font-size: 24rpx;
color: #fff;
}
.score-img {
width: 36rpx;
height: 36rpx;
}
.price {
font-size: 36rpx;
color: #fff;
font-weight: bold;
margin: 0 10rpx;
}
.price-bottom-box {
font-size: 24rpx;
color: #fff;
font-weight: 500;
padding-top: 10rpx;
.original-price {
text-decoration: line-through;
}
.line {
margin: 0 20rpx;
display: inline-block;
width: 3rpx;
height: 24rpx;
background-color: #fff;
}
}
}
// 秒杀商品
.seckill-bg {
background: url($IMG_URL+'/imgs/detail/detail_price_seckill_bg.png') no-repeat;
background-size: 100% 100%;
}
.seckilled-bg {
background: url($IMG_URL+'/imgs/detail/detail_price_seckilled_bg.png') no-repeat;
background-size: 100% 100%;
}
.seckill-price-box {
padding: 20rpx;
.unit,
.notice,
.count-down {
font-size: 24rpx;
color: rgba(#fff, 0.9);
}
.notice {
line-height: 40rpx;
border: 1rpx solid rgba(255, 255, 255, 1);
border-radius: 6rpx;
padding: 0 10rpx;
margin-left: 10rpx;
}
.price {
font-size: 36rpx;
color: rgba(#fff, 0.9);
font-weight: bold;
margin: 0 10rpx;
}
.price-bottom-box {
font-size: 24rpx;
color: rgba(#fff, 0.9);
font-weight: 500;
padding-top: 10rpx;
.original-price {
text-decoration: line-through;
}
.express {
.progress-text {
color: rgba(#fff, 0.9);
font-size: 24rpx;
margin-left: 10rpx;
}
}
.line {
margin: 0 20rpx;
display: inline-block;
width: 3rpx;
height: 24rpx;
background-color: #fff;
}
}
}
// 抢购商品
.robbuy-bg {
background: url($IMG_URL+'/imgs/detail/detail_price_seckill_bg.png') no-repeat;
background-size: 100% 100%;
}
.robbuyed-bg {
background: url($IMG_URL+'/imgs/detail/detail_price_seckilled_bg.png') no-repeat;
background-size: 100% 100%;
}
.robbuy-price-box {
padding: 20rpx;
.unit,
.notice,
.count-down {
font-size: 24rpx;
color: rgba(#fff, 0.9);
}
.notice {
line-height: 40rpx;
border: 1rpx solid rgba(255, 255, 255, 1);
border-radius: 6rpx;
padding: 0 10rpx;
margin-left: 10rpx;
}
.price {
font-size: 36rpx;
color: rgba(#fff, 0.9);
font-weight: bold;
margin: 0 10rpx;
}
.price-bottom-box {
font-size: 24rpx;
color: rgba(#fff, 0.9);
font-weight: 500;
padding-top: 10rpx;
.original-price {
text-decoration: line-through;
}
.express {
.progress-text {
color: rgba(#fff, 0.9);
font-size: 24rpx;
margin-left: 10rpx;
}
}
.line {
margin: 0 20rpx;
display: inline-block;
width: 3rpx;
height: 24rpx;
background-color: #fff;
}
}
}
// 促销商品
.promote-bg {
background: url($IMG_URL+'/imgs/detail/detail_price_promote_bg.jpg') no-repeat;
background-size: 100% 100%;
}
.promoteed-bg {
background: url($IMG_URL+'/imgs/detail/detail_price_promoteed_bg.png') no-repeat;
background-size: 100% 100%;
}
.promote-price-box {
padding: 20rpx;
.unit,
.notice,
.count-down {
font-size: 24rpx;
color: rgba(#fff, 0.9);
}
.notice {
line-height: 40rpx;
border: 1rpx solid rgba(255, 255, 255, 1);
border-radius: 6rpx;
padding: 0 10rpx;
margin-left: 10rpx;
}
.price {
font-size: 36rpx;
color: rgba(#fff, 0.9);
font-weight: bold;
margin: 0 10rpx;
}
.price-bottom-box {
font-size: 24rpx;
color: rgba(#fff, 0.9);
font-weight: 500;
padding-top: 10rpx;
.original-price {
text-decoration: line-through;
}
.express {
.progress-text {
color: rgba(#fff, 0.9);
font-size: 24rpx;
margin-left: 10rpx;
}
}
.line {
margin: 0 20rpx;
display: inline-block;
width: 3rpx;
height: 24rpx;
background-color: #fff;
}
}
}
</style>

查看文件

@@ -0,0 +1,140 @@
<template>
<view class="sh-server-box">
<view class="u-flex u-row-between serve-box" @tap="showModal = true">
<view class="u-flex">
<text class="title">服务</text>
<view class="tip u-flex">
<view class="tip-list u-flex" v-for="(serve, index) in serveList" :key="serve.title">
<view class="u-flex" v-if="index < 3">
<image class="tip-img" :src="serve.image" mode=""></image>
<text>{{ serve.name }}</text>
</view>
</view>
</view>
</view>
<view class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;font-size: 28rpx;"></view>
</view>
<u-popup v-model="showModal" mode="bottom" :closeable="true" close-icon-pos="top-right">
<view class=" server-modal">
<view class="server-modal-box page_box">
<view class="modal-head u-flex u-row-center u-col-center"><text class="head-title">服务保障</text></view>
<view class="modal-content content_box">
<view class="serve-list" v-for="serve in serveList" :key="serve.title">
<view class="title-box u-flex">
<image class="title-tag" :src="serve.image" mode=""></image>
<text class="serve-title">{{ serve.name }}</text>
</view>
<view class="serve-detail">{{ serve.description }}</view>
</view>
</view>
<view class="modal-foot u-flex u-row-center u-col-center"><button class=" u-reset-button serve-btn" @tap="showModal = false">确定</button></view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
/**
* 商品服务卡片
* @property {Array} serveList - 商品服务列表
* @property {Boolean} showModal- 显隐
*/
export default {
components: {},
data() {
return {
showModal: false
};
},
props: {
serveList: {
type: Array,
default: () => []
}
},
computed: {},
methods: {}
};
</script>
<style lang="scss">
.serve-box {
line-height: 82rpx;
background: #fff;
padding: 0 20rpx;
margin: 10rpx 0;
.title {
font-size: 28rpx;
color: #999;
margin-right: 20rpx;
}
.tip {
.tip-list {
font-size: 28rpx;
margin-right: 20rpx;
.tip-img {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
}
}
}
.server-modal-box {
width: 750rpx;
height: 100%;
border-radius: 30rpx 30rpx 0 0;
background: #fff;
padding: 30rpx;
.serve-btn {
width: 690rpx;
line-height: 80rpx;
background: linear-gradient(90deg, rgba(240, 199, 133, 1), rgba(246, 214, 157, 1));
border-radius: 40rpx;
font-size: 30rpx;
color: rgba(#fff, 0.9);
margin-top: 40rpx;
}
.modal-head {
margin-bottom: 30rpx;
position: relative;
.head-title {
font-size: 32rpx;
font-weight: bold;
}
}
.modal-content {
overflow-y: auto;
.serve-list {
padding-bottom: 40rpx;
.title-tag {
width: 38rpx;
height: 38rpx;
margin-right: 20rpx;
}
.serve-title {
font-size: 28rpx;
font-weight: bold;
}
.serve-detail {
text-align: left;
font-size: 26rpx;
color: #999;
line-height: 42rpx;
padding-left: 58rpx;
margin-top: 20rpx;
}
}
}
}
</style>