Ver Fonte

促销活动,修复BUG

zhengjinyi há 4 anos atrás
pai
commit
6fb3324be1

+ 3 - 1
components/cm-module/listTemplate/buyagainList.vue

@@ -16,7 +16,9 @@
 									<text class="iconfont icon-wenhao" @click.stop="repurchModel"></text>
 								</view>
 								<view class="list-price" v-else>
-									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">¥{{item.retailPrice | NumFormat}}</text>
+									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+										¥{{ (PromotionsFormat(item.promotions) ? item.price1 : item.retailPrice) | NumFormat }}
+									</text>
 								</view>
 							</view>
 							<button class="add-cart-btn" @click.stop="operationHanld(item)">数量</button>

+ 14 - 4
components/cm-module/listTemplate/classifyProductList.vue

@@ -12,7 +12,7 @@
 					<view class="list-details-price">
 						<view class="floor-item-act" v-if="item.actStatus==1">
 							<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-								{{item.promotions.name}}<text v-if="hasLogin">:¥{{ item.price | NumFormat }}</text>
+								{{item.promotions.name}}<text v-if="hasLogin && item.price1TextFlag != '1'">:¥{{ item.price | NumFormat }}</text>
 							</view>
 							<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
 						</view>
@@ -21,7 +21,9 @@
 						</view>
 						<view v-if="hasLogin" class="list-price">
 							<view v-if="userIdentity == 1">
-								<text>¥<text class="price-larger">{{item.retailPrice | NumFormat}}</text></text>
+								<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+								  ¥{{ (PromotionsFormat(item.promotions) ? item.price1 : item.retailPrice) | NumFormat }}
+								</text>
 							</view>	
 							<view v-if="userIdentity == 4">
 								<view class="price-larger" v-if="item.price1TextFlag == '1'">
@@ -31,14 +33,22 @@
 									<view class="price-larger" v-if="item.price1TextFlag == '2'">
 										<text class="txt">¥价格仅会员可见</text>
 									</view>
-									<text v-else class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">¥{{item.retailPrice | NumFormat}}</text>
+									<template v-else>
+										<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+										  ¥{{ (PromotionsFormat(item.promotions) ? item.price1 : item.retailPrice) | NumFormat }}
+										</text>
+									</template>
 								</view>
 							</view>
 							<view v-if="userIdentity == 2">
 								<view class="price-larger" v-if="item.price1TextFlag == '1'">
 									<text class="txt">¥未公开价格</text>
 								</view>
-								<text v-else class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">¥{{item.retailPrice | NumFormat}}</text>
+								<template v-else>
+									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+									  ¥{{ (PromotionsFormat(item.promotions) ? item.price1 : item.retailPrice) | NumFormat }}
+									</text>
+								</template>
 							</view>
 						</view>	
 						<view  v-else class="list-login-now">

+ 19 - 9
components/cm-module/listTemplate/commodityList.vue

@@ -12,7 +12,7 @@
 					<view class="list-details-price">
 						<view class="floor-item-act" v-if="item.actStatus==1">
 							<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-								{{item.promotions.name}}<text v-if="hasLogin">:¥{{ item.price | NumFormat }}</text>
+								{{item.promotions.name}}<text v-if="hasLogin && item.p_price_flag != '1'">:¥{{ item.price | NumFormat }}</text>
 							</view>
 							<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
 						</view>
@@ -22,26 +22,36 @@
 						<view v-if="hasLogin" class="list-price">
 							<view v-if="userIdentity == 1">
 								<text v-if="priceLoading" class="price-larger small">正在获取价格...</text>
-								<text v-else class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">¥{{ item.price | NumFormat }}</text>
+								<template v-else>
+									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+										¥{{ (PromotionsFormat(item.promotions) ? item.normalPrice : item.price) | NumFormat}}
+									</text>
+								</template>
 							</view>	
 							<view v-if="userIdentity == 4">
 								<view class="price-larger" v-if="item.p_price_flag == '1'">
 									<text class="txt">¥未公开价格</text>
 								</view>
-								<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
-								<view v-else>
-									<view class="price-larger" v-if="item.p_price_flag == '2'">
-										<text class="txt">¥价格仅会员可见</text>
-									</view>
-									<text v-else class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">¥{{item.price | NumFormat}}</text>
+								<view class="price-larger" v-if="item.p_price_flag == '2'">
+									<text class="txt">¥价格仅会员可见</text>
 								</view>
+								<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
+								<template v-else>
+									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+										¥{{ (PromotionsFormat(item.promotions) ? item.normalPrice : item.price) | NumFormat}}
+									</text>
+								</template>
 							</view>
 							<view v-if="userIdentity == 2">
 								<view class="price-larger" v-if="item.p_price_flag == '1'">
 									<text class="txt">¥未公开价格</text>
 								</view>
 								<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
-								<text v-else class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''" >¥{{item.price | NumFormat}}</text>
+								<template v-else>
+									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+										¥{{ (PromotionsFormat(item.promotions) ? item.originalPrice : item.price) | NumFormat}}
+									</text>
+								</template>
 							</view>
 						</view>	
 						<view  v-else class="list-login-now">

+ 3 - 1
components/cm-module/listTemplate/immediatelyList.vue

@@ -47,7 +47,9 @@
 								<template v-else>
 									<view class="list-shop">
 										<view class="list-price">
-											<text class="price-larger" :class="item.promotions.type == 1 && item.promotions.mode==1 ? 'none' : ''">¥{{item.price | NumFormat}}</text>
+											<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+												¥{{ PromotionsFormat(item.promotions) ? (item.originalPrice | NumFormat) : (item.price | NumFormat)}}
+											</text>
 										</view>
 									</view>
 									<button class="add-cart-btn" @click.stop="operationHanld(item)">数量</button>

+ 5 - 2
components/cm-module/listTemplate/productList.vue

@@ -19,7 +19,9 @@
 									<text class="iconfont icon-wenhao" @click.stop="repurchModel"></text>
 								</view>
 								<view class="list-price" v-else>
-									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">¥{{item.retailPrice | NumFormat}}</text>
+									<text class="price-larger" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
+										¥{{ (PromotionsFormat(item.promotions) ? item.price1 : item.retailPrice) | NumFormat }}
+									</text>
 								</view>
 							</view>
 							<button class="add-cart-btn" @click.stop="operationHanld(item)">数量</button>
@@ -27,7 +29,7 @@
 						<view class="list-details-price" v-if="item.actStatus==1">
 							<view class="floor-item-act">
 								<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-									{{item.promotions.name}}<text>:¥{{ item.retailPrice | NumFormat }}</text>
+									{{item.promotions.name}}<text v-if="item.price1TextFlag != 1">:¥{{ item.retailPrice | NumFormat }}</text>
 								</view>
 								<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
 							</view>
@@ -294,6 +296,7 @@
 	.list-details-price {
 		width: 100%;
 		line-height: 54rpx;
+		float: left;
 		.floor-item-act{
 			height: 54rpx;
 			text-align: center;

+ 22 - 14
components/cm-module/productDetails/cm-price.vue

@@ -23,9 +23,9 @@
 			<!-- 协销  -->
 			<template  v-if="userIdentity == 1">
 				<view class="wrap-main-item">
-					<view class="p-price tui-skeleton-fillet" :class="product.promotions.type == 1 && product.promotions.mode == 1 ? 'none' : ''">
+					<view class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
 						<text class="txt sm">¥</text>
-						<text class="txt big">{{product.retailPrice | NumFormat}}</text>
+						<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
 					</view>
 					<view v-if="product.actStatus==1" class="floor-item-act">
 						<view v-if="product.promotions.type == 1 && product.promotions.mode == 1"  class="floor-tags" @click.stop="clickPopupShow(1)">
@@ -40,17 +40,15 @@
 			</template>	
 			<!-- 会员机构  -->
 			<template v-if="userIdentity == 2">
-				<view v-if="product.price1TextFlag == '1'" class="wrap-main-pricenone">
-					<view class="wrap-main-text">¥未公开价格</view>
-				</view>
-				<view v-else class="wrap-main-item">
-					<view class="p-price tui-skeleton-fillet" :class="product.promotions.type == 1 && product.promotions.mode==1 ? 'none' : ''">
+				<view class="wrap-main-item">
+					<view v-if="product.price1TextFlag == '1'" class="wrap-main-text">¥未公开价格</view>
+					<view v-else class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
 						<text class="txt sm">¥</text>
-						<text class="txt big">{{product.retailPrice | NumFormat}}</text>
+						<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
 					</view>
 					<view v-if="product.actStatus==1" class="floor-item-act">
 						<view v-if="product.promotions.type == 1 && product.promotions.mode == 1"  class="floor-tags" @click.stop="clickPopupShow(1)">
-							{{product.promotions.name}}<text v-if="hasLogin">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
+							{{product.promotions.name}}<text v-if="hasLogin && product.price1TextFlag != '1'">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
 						</view>
 						<view v-else class="floor-tags" @click.stop="clickPopupShow()">{{product.promotions.name}}</view>	
 					</view>
@@ -72,13 +70,13 @@
 				</template>
 				<template v-if="product.price1TextFlag == '0'">
 					<view class="wrap-main-item">
-						<view class="p-price tui-skeleton-fillet" :class="product.promotions.type == 1 && product.promotions.mode == 1 ? 'none' : ''">
+						<view class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
 							<text class="txt sm">¥</text>
-							<text class="txt big">{{product.retailPrice | NumFormat}}</text>
+							<text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
 						</view>
 						<view v-if="product.actStatus==1" class="floor-item-act">
 							<view v-if="product.promotions.type == 1 && product.promotions.mode == 1"  class="floor-tags" @click.stop="clickPopupShow(1)">
-								{{product.promotions.name}}<text v-if="hasLogin">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
+								{{product.promotions.name}}<text v-if="hasLogin && product.price1TextFlag != '1'">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
 							</view>
 							<view v-else class="floor-tags" @click.stop="clickPopupShow()">{{product.promotions.name}}</view>	
 						</view>
@@ -113,12 +111,12 @@
 								<text class="txt" v-else>{{ product.promotions.beginTime }} ~ {{ product.promotions.endTime }}</text>
 							</view>
 							<view class="box-title" v-show="product.promotions.mode ==2">
-								<text>购买凑单商品,满</text>
+								<text>购买{{ product.promotions.name }}商品,满</text>
 								<text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>减
 								<text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.reducedPrice | NumFormat }}</text>
 							</view>
 							<view class="box-title" v-show="product.promotions.mode==3">
-								<text>购买购买凑单商品,满</text>
+								<text>购买{{ product.promotions.name }}商品,满</text>
 								<text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>赠送商品
 							</view>
 							<view class="box-product" v-show="product.promotions.mode==3">
@@ -189,6 +187,16 @@
 			hidePopup(){
 				this.popupShow = false
 			},
+			PromotionsFormat(promo){//促销活动类型数据处理
+				if(promo!=null){
+					if(promo.type == 1 && promo.mode == 1){
+						return true
+					}else{
+						return false
+					}
+				}
+				return false
+			},
 			goUpgradeApply(){
 				this.$api.navigateTo('/pages/login/apply')
 			},

+ 10 - 2
pages/goods/cart.vue

@@ -38,7 +38,8 @@
 											<view class="productprice">
 												<!--使用过滤器对总价改变-->
 												<view class="price" :class="PromotionsFormat(pros.promotions) ? 'disabled' : ''">
-													<text>¥</text>{{pros.price | NumFormat}}
+													<text>¥</text>
+													{{ (PromotionsFormat(pros.promotions) ? pros.originalPrice : pros.price)  | NumFormat }}
 												</view>
 												<view class="count" v-if="pros.validFlag == 2 "  :class="[isshowDelbtn ? 'none':'show']">
 													<text class="count-tips" v-if="pros.number<pros.min">起订量:{{pros.min}}</text>
@@ -152,6 +153,7 @@
 	import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
 	import tuiNomore from "@/components/tui-components/nomore/nomore"
 	import headerNavbar from "@/components/cm-module/headerNavbar/headerNavbar.vue" //顶部自定义胶囊'
+	import activiPopup from "@/components/cm-module/productDetails/cm-activipopu"
 	import modalLayer from "@/components/modal-layer"
 	import { mapState,mapMutations } from 'vuex';
 	
@@ -161,7 +163,8 @@
 			tuiLoadmore,
 			tuiNomore,
 			modalLayer,
-			headerNavbar
+			headerNavbar,
+			activiPopup
 		},
 		data(){
 			return{
@@ -407,6 +410,7 @@
 								item.reducedPrice = item.promotions.reducedPrice
 								item.totalOriginalPrice = totalOriginalPrice
 							}else{
+								item.reducedPrice = 0  //统计合计价格
 								item.totalPrice = prosPrice
 							}
 						})
@@ -424,6 +428,7 @@
 								}
 								_totalPrice +=  _price
 							}else{
+								_reducedPrice = 0
 								_totalPrice += pros.price*pros.number;
 							}
 						})
@@ -464,6 +469,7 @@
 									totalOriginalPrice += pros.originalPrice*pros.number //统计原商品价格
 									reducedPrice += item.promotions.reducedPrice	//统计总减金额
 								}else{
+									reducedPrice = 0  //统计合计价格
 									totalPrice += prosPrice	//未达满减的统计合计价格
 								}
 							}else if(pros.promotions && pros.promotions.mode == 2){//以下为计算除店铺满减以外的单品满减以及正常商品
@@ -472,6 +478,8 @@
 								if(_price >= pros.promotions.touchPrice){//判断如果商品合计价格已满足满减活动,计算价格
 									_price = _price - pros.promotions.reducedPrice //商品满减后价格
 									_reducedPrice += pros.promotions.reducedPrice //统计总减金额
+								}else{
+									_reducedPrice = 0  //将满减金额置为0
 								}
 								_totalPrice +=  _price //统计合计价格
 							}else{

+ 1 - 1
pages/goods/product.vue

@@ -677,7 +677,7 @@
 				overflow: hidden;
 			}
 			.wrap-main-text{
-				line-height: 44rpx;
+				line-height: 56rpx;
 				color: #FF2A2A;
 				font-size: $font-size-26;
 				display: block;

+ 4 - 1
pages/tabBar/cart/cart.vue

@@ -34,7 +34,8 @@
 											<view class="productprice">
 												<!--使用过滤器对总价改变-->
 												<view class="price" :class="PromotionsFormat(pros.promotions) ? 'disabled' : ''">
-													<text>¥</text>{{pros.price | NumFormat}}
+													<text>¥</text>
+													{{ (PromotionsFormat(pros.promotions) ? pros.originalPrice : pros.price)  | NumFormat }}
 												</view>
 												<view class="count" v-if="pros.validFlag == 2 "  :class="[isshowDelbtn ? 'none':'show']">
 													<text class="count-tips" v-if="pros.number<pros.min">起订量:{{pros.min}}</text>
@@ -399,6 +400,7 @@
 								item.reducedPrice = item.promotions.reducedPrice
 								item.totalOriginalPrice = totalOriginalPrice
 							}else{
+								item.reducedPrice = 0  //统计合计价格
 								item.totalPrice = prosPrice
 							}
 						})
@@ -416,6 +418,7 @@
 								}
 								_totalPrice +=  _price
 							}else{
+								_reducedPrice = 0;
 								_totalPrice += pros.price*pros.number;
 							}
 						})

+ 17 - 5
pages/tabBar/home/home.vue

@@ -67,7 +67,9 @@
 								</view>
 								<view class="floor-item-act">
 									<template v-if="item.actStatus==1">
-										<view class="floor-tags" v-if="item.promotions.type == 1 && item.promotions.mode==1">{{item.promotions.name}}<text v-if="hasLogin">:¥{{item.price | NumFormat}}</text></view>
+										<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+											{{item.promotions.name}}<text v-if="hasLogin && item.price1TextFlag != '1'">:¥{{item.price | NumFormat}}</text>
+										</view>
 										<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
 									</template>
 									<template v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
@@ -83,18 +85,18 @@
 											<text class="p big">¥价格仅会员可见</text>
 											<text class="p btn" @click.stop="this.$api.navigateTo(`/pages/login/apply?clubStatus=${clubStatus}`)">去升级</text>
 										</view>
-										<view class="price tui-skeleton-rect" v-show="item.price1TextFlag == '0'">
+										<view class="price tui-skeleton-rect" v-show="item.price1TextFlag == '0'" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
 											<text class="p sm">¥</text>
-											<text class="p big">{{ item.price | NumFormat}}</text>
+											<text class="p big">{{ (PromotionsFormat(item.promotions) ? item.originalPrice : item.price ) | NumFormat}}</text>
 										</view>
 									</view>
 									<view v-else>
 										<view class="title-none" v-if="item.price1TextFlag == '1'">
 											<text class="p big">未公开价格</text>
 										</view>
-										<view class="price tui-skeleton-rect" v-else :class="item.promotions.type == 1 && item.promotions.mode==1 ? 'none' : ''">
+										<view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.promotions) ? 'none' : ''">
 											<text class="p sm">¥</text>
-											<text class="p big">{{item.price | NumFormat}}</text>
+											<text class="p big">{{ (PromotionsFormat(item.promotions) ? item.originalPrice : item.price ) | NumFormat}}</text>
 										</view>
 									</view>
 								</view>
@@ -313,6 +315,16 @@
 				});
 				return NewArray
 			},
+			PromotionsFormat(promo){//促销活动类型数据处理
+				if(promo!=null){
+					if(promo.type == 1 && promo.mode == 1){
+						return true
+					}else{
+						return false
+					}
+				}
+				return false
+			},
 			//轮播图切换修改背景色
 			swiperChange(e) {
 				const index = e.detail.current;

+ 9 - 3
seller/pages/cart/cart.vue

@@ -40,7 +40,10 @@
 											</view>
 											<view class="productprice">
 												<!--使用过滤器对总价改变-->
-												<view class="price"><text>¥</text>{{ pros.retailPrice  |  NumFormat}}</view>
+												<view class="price" :class="PromotionsFormat(pros.promotions) ? 'disabled' : ''">
+													<text>¥</text>
+													{{ (PromotionsFormat(pros.promotions) ? pros.price1 : pros.retailPrice)  | NumFormat }}
+												</view>
 												<view class="count" :class="[isshowDelbtn ? 'none':'show']">
 													<text class="count-tips step" v-if="pros.isStep">购买量必须为起订量的整数倍</text>
 													<view class="number-box">
@@ -386,6 +389,7 @@
 								item.reducedPrice = item.promotions.reducedPrice
 								item.totalOriginalPrice = totalOriginalPrice
 							}else{
+								item.reducedPrice = 0
 								item.totalPrice = prosPrice
 							}
 						})
@@ -403,6 +407,7 @@
 								}
 								_totalPrice +=  _price							
 							}else{
+								_reducedPrice = 0;
 								_totalPrice += pros.retailPrice*pros.productCount;
 							}
 						})
@@ -443,17 +448,18 @@
 									totalPrice += prosPrice - item.promotions.reducedPrice  //统计合计价格
 									reducedPrice += item.promotions.reducedPrice	//统计总减金额
 								}else{
+									reducedPrice = 0  //将满减金额置为0
 									totalPrice += prosPrice	//未达满减的统计合计价格
 								}
-								console.log(totalOriginalPrice)
 							}else if(pros.promotions && pros.promotions.mode == 2){//以下为计算除店铺满减以外的单品满减以及正常商品
 								let _price = pros.retailPrice*pros.productCount
 								_totalOriginalPrice += pros.price1*pros.productCount; //统计原商品价格
 								if(_price >= pros.promotions.touchPrice){//判断如果商品合计价格已满足满减活动,计算价格
 									_price = _price - pros.promotions.reducedPrice //商品满减后价格
 									_reducedPrice += pros.promotions.reducedPrice //统计总减金额
+								}else{
+									_reducedPrice = 0  //将满减金额置为0
 								}
-								console.log(_totalOriginalPrice)
 								_totalPrice +=  _price //统计合计价格
 							}else{
 								_totalNonePrice += pros.retailPrice*pros.productCount; //正常商品的价格总计