commit message

This commit is contained in:
Chopper
2021-05-13 11:03:32 +08:00
commit 23804939eb
2158 changed files with 149684 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
<template>
<view class="group-list">
<view class="group-name">拼购列表</view>
<view v-if="assembleOrder.length !=0">
<view class="group-item" v-for="(order,index) in assembleOrder" :key="index">
<view class="group-item-user">
<u-image shape="circle" width="40px" height="40px" :src="order.face"></u-image>
<span class="group-item-name">{{order.nickName | noPassByName}}</span>
</view>
<view>
<span class="group-item-name">还差{{ order.toBeGroupedNum}}人成团</span>
</view>
<view>
<u-button size="mini" :custom-style="customStyle" @click="buy(order)">去参团</u-button>
</view>
</view>
</view>
<view v-else class="nomore">
<u-empty text="暂无拼团信息" mode="list"></u-empty>
</view>
</view>
</template>
<script>
import * as API_Promotions from "@/api/promotions";
export default {
data() {
return {
customStyle: {
background: this.$lightColor,
color: "#fff",
},
/** 待成团订单 */
assembleOrder: "",
/** 查看更多待成团订单 */
assembleOrderAll: "",
};
},
props: ["res"],
watch: {
res: {
handler() {
if (this.res && this.res.length != 0) {
Object.keys(this.res).forEach((item) => {
let key = item.split("-");
if (key && key[0] == "PINTUAN") {
this.getAssembleInfo(item);
}
});
}
},
immediate: true,
},
// assembleOrder(val) {
// this.$emit("assembleOrder", val);
// },
},
computed: {},
mounted() {},
methods: {
// 获取此商品所有待成团的订单
getAssembleInfo(val) {
let id = this.res[val].id;
API_Promotions.getPromotionGroupMember(id).then((res) => {
if (res.data.success) {
console.warn(res.data.result);
this.assembleOrder = res.data.result;
}
});
},
buy(order) {
this.$emit("to-assemble-buy-now", order);
},
},
};
</script>
<style lang="scss" scoped>
@import "../product.scss";
.nomore {
padding: 10rpx 0;
}
.group-item {
margin: 30rpx 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.group-item-user {
display: flex;
align-items: center;
}
.group-item-name {
margin-left: 23rpx;
font-size: 24rpx;
color: #999999;
font-weight: 400;
}
</style>

View File

@@ -0,0 +1,131 @@
<template>
<view>
<div v-for="(promotion, promotion_index) in res" :key="promotion_index">
<div class="showBox" v-if="promotion.__key == 'SECKILL' || promotion.__key =='GROUPBUY' || promotion.__key == 'PINTUAN'">
<view class="group-wrapper">
<div class="u-group-row">
<view :span="8" class="showBox_L">
<view class="u-group-flex">
<!-- 限时抢购 -->
<view class="u-group-flex-left" v-if="promotion.__key == 'SECKILL' ">
<span class="u-group-flex-left-span" v-if="detail.promotionPrice!=undefined">
<span class="flex-price"> {{ Fixed(detail.promotionPrice)[0]}}.{{ Fixed(detail.promotionPrice)[1]}}</span>
</span>
<view class="u-group-flex" v-if="detail.price!=undefined">
<span class="old-price">{{ Fixed(detail.price)[0]}}.{{ Fixed(detail.price)[1]}}</span>
<view class="promotion">限时抢购</view>
</view>
</view>
<!-- 团购 -->
<view class="u-group-flex-left" v-if="promotion.__key == 'GROUPBUY' ">
<span class="u-group-flex-left-span">
<span class="flex-price"
v-if="promotion.groupbuy_goods_vo.price !=undefined">{{ Fixed(promotion.groupbuy_goods_vo.price )[0]}}.{{ Fixed(promotion.groupbuy_goods_vo.price )[1]}}</span>
<!-- <span v-if="promotion.point">+{{promotion.point}}积分</span> -->
</span>
<view class="u-group-flex">
<span class="old-price"
v-if="promotion.groupbuy_goods_vo.original_price!=undefined">{{ Fixed(promotion.groupbuy_goods_vo.original_price)[0]}}.{{ Fixed(promotion.groupbuy_goods_vo.original_price)[1]}}</span>
<view class="promotion">团购活动</view>
</view>
</view>
<view class="u-group-flex-left" v-if="promotion.__key == 'PINTUAN' ">
<span class="u-group-flex-left-span" v-if="detail.promotionPrice != undefined">
<span class="flex-price"> {{ Fixed(detail.promotionPrice)[0]}}.</span>{{ Fixed(detail.promotionPrice)[1]}}
</span>
<view class="u-group-flex" v-if="detail.price != undefined">
<span class="old-price">{{ Fixed(detail.price)[0]}}.{{ Fixed(detail.price)[1]}}</span>
<view class="promotion">拼团活动</view>
</view>
</view>
<!-- 拼团右侧 -->
<view class="u-group-flex-right" v-if="promotion.__key == 'PINTUAN' ">
<span class="group-bag">{{promotion.requiredNum}}人拼团 </span>
<span class="group-bag">限购{{promotion.limitNum}}</span>
</view>
</view>
</view>
<view class="showBox_R" v-if="promotion && promotion.endTime">
<u-tag :text="getIsTimer(promotion)" size="mini" type="error" />
<u-count-down :hide-zero-day="true" font-size="25" color="#fff" bg-color="#f71471" separator-size="25" separator-color="#f71471" :show-hours="true" :show-minutes="true"
:timestamp="getCountDownTime(promotion.endTime)"></u-count-down>
</view>
</div>
</view>
</div>
</div>
</view>
</template>
<script>
export default {
data() {
return {};
},
props: {
// 活动,促销数据
res: {
type: null,
default: {},
},
// 商品详情
detail: {
type: null,
default: {},
},
},
watch: {
res: {
handler() {
if (this.res && this.res.length != 0) {
Object.keys(this.res).forEach((item) => {
let key = item.split("-")[0];
this.res[item].__key = key;
// 针对现实向
});
}
},
immediate: true,
},
},
mounted() {},
methods: {
// 格式化金钱 1999 --> [1999,00]
Fixed(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
getCountDownTime(val) {
let date = new Date(val.replace(/-/g, "/"))
let timeSimple = new Date(date).getTime() / 1000;
console.log(timeSimple , timeSimple - new Date().getTime() / 1000)
return timeSimple - new Date().getTime() / 1000;
},
getIsTimer(val) {
var timestamp = new Date().getTime();
// console.log(timestamp);
if (timestamp < val.start_time) {
this.startTimer = true;
return "距离活动开始";
} else {
return "距离活动结束";
}
},
},
};
</script>
<style scoped lang="scss">
@import "./group.scss";
</style>

View File

@@ -0,0 +1,178 @@
<template>
<view class="wrapper">
<div class="coupon-empty" v-if="!res">暂无优惠券</div>
<view class="coupon-List" v-if="res && item.__key=='COUPON'" v-for="(item, index) in res" :key="index">
<view class="coupon-item">
<view class="top">
<div class="price">
<span v-if="item.couponType == 'DISCOUNT'">{{ item.couponDiscount }}</span>
<span v-if="item.couponType == 'PRICE'">{{ item.price | unitPrice }}</span>
</div>
<view class="text">
<div class="coupon-List-title">
<view v-if="item.scopeType">
<span v-if="item.scopeType == 'ALL' && item.id == 'platform'">全平台</span>
<span v-if="item.scopeType == 'PORTION_CATEGORY'">仅限品类</span>
<view v-else>{{ item.storeName == 'platform' ? '全平台' :item.storeName+'店铺' }}使用</view>
</view>
</div>
<div>{{ item.consumeThreshold | unitPrice }}可用</div>
</view>
<view class="lingqu-btn" @click="getCoupon(item)">
<div :class="yhqFlag ? 'cur' : ''">{{ yhqFlag ? '已领取或领完' : '立即领取' }}</div>
</view>
</view>
<view class="line"></view>
<view class="time">{{ item.startTime }} - {{item.endTime }}</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
yhqFlag: false, //获取优惠券判断是否点击
};
},
props: {
res: {
type: null,
default: "",
},
},
watch: {
res: {
handler() {
if (this.res && this.res.length != 0) {
Object.keys(this.res).forEach((item) => {
let key = item.split("-")[0];
this.res[item].__key = key;
});
}
},
immediate: true,
},
},
methods: {
// 提交优惠券
getCoupon(item) {
this.yhqFlag = true;
this.$emit("getCoupon", item);
},
},
};
</script>
<style lang="scss" scoped>
.coupon-item {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.coupon-List {
display: flex;
flex-direction: column;
height: 230rpx;
background: #e9ebfb;
margin: 30rpx 0;
padding: 10rpx 30rpx;
.line {
height: 1px;
background: #fff;
margin: 0 20rpx;
position: relative;
&:before,
&:after {
content: "";
display: block;
width: 15rpx;
height: 30rpx;
background: #fff;
position: absolute;
top: -15rpx;
}
&:before {
left: -50rpx;
}
&:after {
right: -50rpx;
}
}
.time {
flex: 1;
font-size: 24rpx;
align-items: center;
display: flex;
align-items: center;
}
}
.top {
height: 140rpx;
display: flex;
.price {
width: 33%;
justify-content: center;
color: #6772e5;
font-size: 40rpx;
display: flex;
height: 100%;
align-items: center;
span {
font-size: 50rpx;
}
}
.text {
width: 33%;
display: flex;
flex-direction: column;
justify-content: center;
font-size: 26rpx;
color: 333;
margin-left: 40rpx;
.coupon-List-title {
font-size: 30rpx;
font-weight: bold;
}
}
.lingqu-btn {
display: flex;
align-items: center;
margin-left: 40rpx;
text {
width: 140rpx;
height: 40rpx;
text-align: center;
line-height: 40rpx;
color: #fff;
background: #6772e5;
border-radius: 5px;
font-size: 26rpx;
&.cur {
background: none;
transform: rotate(45deg) translate(10rpx, -46rpx);
}
}
}
}
</style>

View File

@@ -0,0 +1,96 @@
<template>
<view class="wrapper" v-if="res">
<view v-for="(prom, index) in Object.keys(res)" :key="index">
<view>
<view v-if="prom.split('-')[0] == 'FULL_DISCOUNT'">
<div class="res_prom_item" v-if="res[prom].fullMinus">
<u-tag text="满减" type="error"></u-tag>
<span class="proText">{{ res[prom].fullMoney }}立减现金 <span class="price">{{ res[prom].fullMinus}}</span></span>
</div>
<div class="res_prom_item" v-if="res[prom].fullRate">
<u-tag text="打折" type="error"></u-tag>
<span class="proText">{{ res[prom].fullMoney }}立享<span class="price">{{ res[prom].fullRate }}</span>优惠</span>
</div>
</view>
<view v-if="prom.split('-')[0] == 'PINTUAN'">
<div class="res_prom_item" v-if="res[prom].requiredNum">
<u-tag text="拼团" type="error"></u-tag>
<span class="proText">{{ res[prom].requiredNum }}人拼团 限购<span class="price">{{ res[prom].limitNum}}</span></span>
</div>
</view>
<view v-if="prom.split('-')[0] == 'SECKILL'">
<div class="res_prom_item">
<u-tag text="限时抢购" type="error"></u-tag>
<span class="proText">限时抢购</span>
</div>
</view>
</view>
</view>
<view v-if="!res">暂无促销活动</view>
</view>
</template>
<script>
export default {
data() {
return {};
},
watch: {
res: {
handler(val) {
console.log(val);
// if (this.res && this.res.length != 0) {
// Object.keys(this.res).forEach((item) => {
// if (item != "COUPON") {
// let key = item.split("-")[0];
// this.res[item]._key = key;
// }
// });
// }
},
immediate: true,
},
},
props: {
// 父组件传递回来的数据
res: {
type: null,
default: "",
},
},
mounted() {},
methods: {},
};
</script>
<style lang="scss" scoped>
.proText {
font-size: 26rpx;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: 400;
text-align: left;
color: #333333;
margin-left: 20rpx;
}
.wrapper {
display: block;
}
/deep/ .u-mode-light-error {
border: none;
}
.res_prom_item {
margin: 20rpx 0;
}
.price_image {
display: block;
}
</style>

View File

@@ -0,0 +1,129 @@
<template>
<view>
<view v-for="(promotionItem,promotionIndex) in promotion" :key="promotionIndex" class="promotion_row" @click="shutMask(1)">
<view v-if="res!=null" v-for="(item, index) in Object.keys(res)" :key="index">
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'FULL_DISCOUNT'">
<!-- 满减折扣 -->
<div class="flex">
<view class="deg_tag">{{promotionItem.title}}</view>
<div class="text proText">{{ res[item].fullMoney }}立享优惠</div>
</div>
</div>
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'PINTUAN'">
<!-- 拼团 -->
<div class="flex">
<view class="deg_tag">{{promotionItem.title}}</view>
<div class="text proText">{{ res[item].promotionName }}</div>
</div>
</div>
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'SECKILL'">
<!-- 限时抢购 -->
<div class="flex">
<view class="deg_tag">{{promotionItem.title}}</view>
<div class="text proText">{{ res[item].promotionName }}</div>
</div>
</div>
</view>
<view class="promotion_row" style="display:inline;">
<view>
<div class="promotion_col coupon" v-if="couponList && promotionIndex ==1">
<!-- 优惠券 -->
<div>
<view class="deg_tag">优惠券</view>
</div>
</div>
</view>
</view>
</view>
<view v-if=" this.res != null && Object.keys(res).length == 0">
暂无促销信息
</view>
</view>
</template>
<script>
import promotion from "./promotion_type";
export default {
data() {
return {
promotion,
couponList: "",
};
},
props: {
// 父组件传递回来的数据
res: {
type: null,
default: {},
},
},
watch: {
res: {
handler() {
if (this.res && this.res.length != 0 && this.res != null) {
Object.keys(this.res).forEach((item) => {
let key = item.split("-")[0];
this.res[item].__key = key;
if (item.split("-")[0] == "COUPON") {
this.couponList = "COUPON";
}
});
}
},
immediate: true,
},
},
mounted() {},
methods: {
// 此方法条用父级方法
shutMask(val) {
this.$emit("shutMasks", val);
},
},
};
</script>
<style lang="scss" scoped>
.deg_tag {
color: $jd-color;
padding: 0 4rpx;
border: 2rpx solid $jd-color;
font-size: 22rpx;
}
.promotion_col {
/**/
// margin: 0 0 17rpx 0;
padding: 0 !important;
margin: 10rpx 0;
}
.promotion_row {
display: flex;
align-items: center;
}
.flex {
display: flex;
}
.proText {
font-size: 26rpx;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: 400;
text-align: left;
color: #333333;
margin-left: 20rpx;
}
/deep/ .u-mode-light-error {
border: none;
}
</style>

View File

@@ -0,0 +1,6 @@
### promotion 促销显示
### promotion-details 促销详情
### promotion-assemble-promotions 限时抢购,团购活动条
### promotion-assemble-group 拼团活动条
### promotion-assemble-list 拼团活动用户列表
### promotion-coupon 优惠券组件

View File

@@ -0,0 +1,80 @@
.group-wrapper {
background: url("/static/exchange.png");
background-size: cover;
}
.u-group-row {
width: 100%;
padding: 0 32rpx;
display: flex;
height: 100rpx;
align-items: center;
justify-content: space-between;
}
.showBox_L {
// background: #ff6262;
height: 100%;
color: #fff;
flex: 2;
}
.flex-price {
color: #fff;
font-size: 48rpx;
}
.u-group-flex-left {
display: flex;
flex-direction: column;
}
.u-group-flex-left-span {
line-height: 1.2;
font-size: 32rpx;
}
.showBox_R {
flex: 1;
height: 100%;
padding: 4rpx 0 !important;
background: #ffe7e6 !important;
text-align: center !important;
}
/deep/ .u-mode-light-error {
border: none;
}
.u-group-flex {
height: 100%;
align-items: center;
justify-content: space-between;
}
.u-group-flex,
.u-group-flex-right {
display: flex;
}
.u-group-flex-right {
height: 100%;
align-items: flex-end;
display: flex;
flex-direction: column;
justify-content: center;
}
.old-price {
color: #fff;
text-decoration: line-through;
font-size: 22rpx;
opacity: 0.8;
}
.u-group-flex-left {
height: 100%;
}
.group-bag {
font-size: 20rpx;
padding: 4rpx 20rpx;
border-radius: 6rpx;
margin-right: 20rpx;
}
.promotion {
font-size: 22rpx;
border: 2rpx solid $jd-light-color;
padding: 2rpx 6rpx;
margin-left: 10rpx;
line-height: 1;
}

View File

@@ -0,0 +1,49 @@
const promotion = [
{
title: "积分活动",
value: "POINT",
},
{
title: "单品立减",
value: "MINUS",
},
{
title: "团购",
value: "GROUPBUY",
},
{
title: "积分换购",
value: "EXCHANGE",
},
{
title: "第二件半价",
value: "HALF_PRICE",
},
{
title: "满减优惠",
value: "FULL_DISCOUNT",
},
{
title: "限时抢购",
value: "SECKILL",
},
{
title: "拼团",
value: "PINTUAN",
},
{
title: "优惠券",
value: "COUPON",
},
];
export default promotion
/**格式化 */
export function formatType(val){
if(val != undefined){
promotion.forEach(item=>{
if(val == item.value){
return item.title
}
})
}
}