修复购物车在更新最新后端代码的时候导致的bug
parent
09ec1e8c06
commit
896749d812
|
@ -303,11 +303,11 @@
|
|||
<view class="spec">
|
||||
<!-- 促销弹窗 -->
|
||||
<u-popup
|
||||
v-model="promotionFlag"
|
||||
v-model="promotionShow"
|
||||
:height="setup.height"
|
||||
:mode="setup.mode"
|
||||
:border-radius="setup.radius"
|
||||
@close="promotionFlag = false"
|
||||
@close="promotionShow = false"
|
||||
:mask-close-able="setup.close"
|
||||
closeable
|
||||
>
|
||||
|
@ -404,7 +404,8 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
setup,
|
||||
promotionFlag: false,
|
||||
promotionShow: false, //弹窗开关
|
||||
promotionFlag: true, //活动开关
|
||||
// #ifdef H5
|
||||
navbarListX: 110, //导航栏列表栏x轴
|
||||
navbarListY: 80, //导航栏列表栏y轴
|
||||
|
@ -914,13 +915,13 @@ export default {
|
|||
* 规格弹窗开关
|
||||
*/
|
||||
shutMask(flag, buyFlag, type) {
|
||||
this.promotionFlag = false;
|
||||
this.promotionShow = false;
|
||||
this.buyMask = false;
|
||||
this.addressFlag = false;
|
||||
if (flag) {
|
||||
switch (flag) {
|
||||
case 1: //优惠券弹窗
|
||||
this.promotionFlag = true;
|
||||
this.promotionShow = true;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<u-popup class="popup" v-model="addressFlag" :height="setup.height" :mode="setup.mode" :border-radius="setup.radius" @close="closeAddress()" :mask-close-able="setup.close" closeable>
|
||||
<u-popup class="popup" v-model="addressFlag" :height="setup.height" :mode="setup.mode" :border-radius="setup.radius" @close="closeAddress()" closeable>
|
||||
<view class="header-title">选择地址</view>
|
||||
<view class="view-box" v-if="addressDetail">
|
||||
<view class="view-item" v-for="(item, index) in addressDetail" :key="index" @click="clickAddress(item)">
|
||||
|
|
|
@ -39,9 +39,8 @@
|
|||
ref="swiperAction" class="cart-item" v-for="(skuItem, i) in item.skuList" :index="i" :key="skuItem.goodsSku.id"
|
||||
@click="changeActionTab(skuItem)" @longpress="changeActionTab(skuItem)">
|
||||
<!-- 满减活动 -->
|
||||
<div v-if="skuItem.promotions" v-for="(fullDiscount,fullDiscountIndex) in skuItem.promotions"
|
||||
:key="fullDiscountIndex">
|
||||
<div v-if="fullDiscount.promotionType == 'FULL_DISCOUNT'">
|
||||
<div v-if="Object.keys(skuItem.promotionMap).length != 0">
|
||||
<div v-if="getPromotion(skuItem).includes('FULL_DISCOUNT')">
|
||||
<div class="promotion-notice" v-if="item.promotionNotice">
|
||||
<span class="tips">满减</span>
|
||||
<span style="flex:10;">{{item.promotionNotice}}</span>
|
||||
|
@ -76,7 +75,7 @@
|
|||
<p class="sp-type">{{skuItem.goodsSku.simpleSpecs}}</p>
|
||||
<p class="sp-number">
|
||||
<view class="sp-price">
|
||||
<div class="default-color" :class="{'main-color':skuItem.promotions.length ==0 }">
|
||||
<div class="default-color" :class="{'main-color':Object.keys(skuItem.promotionMap).length ==0 }">
|
||||
|
||||
¥<span>{{ formatPrice(skuItem.goodsSku.price)[0] }}</span>
|
||||
<span>.{{ formatPrice(skuItem.goodsSku.price)[1] }}</span>
|
||||
|
@ -95,9 +94,9 @@
|
|||
</view>
|
||||
<!-- 如果当有促销并且促销是 限时抢购 -->
|
||||
<!-- promotions -->
|
||||
<div class="promotions-list" v-if="skuItem.promotions"
|
||||
v-for="(seckill,seckillIndex) in skuItem.promotions" :key="seckillIndex">
|
||||
<div class="promotions-item-seckill" v-if="seckill.promotionType == 'SECKILL'">
|
||||
<div class="promotions-list" v-if="Object.keys(skuItem.promotionMap).length != 0"
|
||||
>
|
||||
<div class="promotions-item-seckill" v-if="getPromotion(skuItem).includes('SECKILL')">
|
||||
距秒杀结束: <u-count-down show-border :hide-zero-day="true" :color="$mainColor" border-color="#ededed"
|
||||
font-size="24" :timestamp="getCountDownTime(seckill.endTime)">
|
||||
</u-count-down>
|
||||
|
@ -106,7 +105,7 @@
|
|||
|
||||
<!-- 如果有活动 并且是选中的状态,显示预估到手价格 -->
|
||||
<div class="priceDetail-flowPrice" :class="{'main-color':skuItem.priceDetailDTO}"
|
||||
v-if="skuItem.priceDetailDTO && skuItem.invalid == 0 && skuItem.promotions.length!=0 && skuItem.checked && skuItem.checked">
|
||||
v-if="skuItem.priceDetailDTO && skuItem.invalid == 0 && Object.keys(skuItem.promotionMap).length != 0 && skuItem.checked && skuItem.checked">
|
||||
预估到手价 ¥<span>{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
|
||||
<span>.{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
|
||||
</div>
|
||||
|
@ -490,6 +489,13 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 数据去重一下
|
||||
getPromotion(item) {
|
||||
return Object.keys(item.promotionMap).map((child) => {
|
||||
return child.split("-")[0]
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取购物车数据
|
||||
*/
|
||||
|
@ -512,12 +518,16 @@ export default {
|
|||
// 如果有拼团活动顺便删除
|
||||
item.skuList &&
|
||||
item.skuList.forEach((sku) => {
|
||||
sku.promotions &&
|
||||
sku.promotions.forEach((pro, proIndex) => {
|
||||
if (pro.promotionType == "PINTUAN") {
|
||||
sku.promotions.splice(proIndex, 1);
|
||||
if(Object.keys(sku.promotionMap).length != 0)
|
||||
{
|
||||
Object.keys(sku.promotionMap).forEach((pro, proIndex) => {
|
||||
pro = pro.split('-')[0]
|
||||
if (pro == "PINTUAN" ) {
|
||||
Object.keys(sku.promotionMap).splice(proIndex, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
|
|
Loading…
Reference in New Issue