shish 2 месяцев назад
Родитель
Сommit
bdc0bd790e

+ 17 - 2
hdApp/src/admin/billing/affirmGhs.vue

@@ -20,8 +20,10 @@
 									<view class="item-row-top">
 										<text class="item-name">{{ item.itemName }}</text>
 										<view class="item-price-block">
-											<text class="price-current">{{ affirmCommodityPriceParts[index].main }}</text>
-											<text v-if="affirmCommodityPriceParts[index].showStrike" class="price-original">{{ affirmCommodityPriceParts[index].strike }}</text>
+											<view class="item-price-line">
+												<text class="price-current">{{ affirmCommodityPriceParts[index].main }}</text>
+												<text v-if="affirmCommodityPriceParts[index].showStrike" class="price-original">{{ affirmCommodityPriceParts[index].strike }}</text>
+											</view>
 										</view>
 									</view>
 									<view class="item-row-qty">
@@ -345,6 +347,7 @@
 			<view class="price-view">
 				<text class="price-title">合计</text>
 				<text class="price-number">¥<text class="large">{{ modifyPrice}}</text></text>
+				<text v-if="allReachDiscountAmount > 0" class="price-discount-tip">省¥{{ parseFloat(allReachDiscountAmount) }}</text>
 			</view>
 			<button class="admin-button-com blue big" @click="affirmFormSubmit(0)">提交</button>
 		</view>
@@ -1337,6 +1340,11 @@ export default {
 							align-items: baseline;
 							max-width: 48%;
 						}
+						.item-price-line {
+							display: flex;
+							flex-direction: row;
+							align-items: baseline;
+						}
 						.price-current {
 							font-size: 32upx;
 							font-weight: bold;
@@ -1346,6 +1354,7 @@ export default {
 						}
 						.price-original {
 							margin-left: 12upx;
+							margin-top: 0;
 							font-size: 26upx;
 							color: #999999;
 							text-decoration: line-through;
@@ -1502,6 +1511,12 @@ export default {
 					font-size: 40upx;
 				}
 			}
+			.price-discount-tip {
+				font-size: 28upx;
+				color: #ff7a00;
+				font-weight: bold;
+				white-space: nowrap;
+			}
 		}
 		.admin-button-com {
 			width: 200upx;

+ 32 - 7
hdApp/src/components/module/app-footer-cart.vue

@@ -6,10 +6,13 @@
 					<i class="iconfont icongouwuche"></i>
 				</view>
 				<view class="price" v-if="!offPrice">
-					<text v-if="count.bigLength>0 || count.smallLength>0">数量</text>
-					<text v-if="count.bigLength>0" style="margin-left:12upx;">{{count.bigLength}}</text>
-					<text v-if="count.smallLength>0" style="margin-left:12upx;">{{count.smallLength}}</text>
-					<text style="margin-left:15upx;">¥{{ price }}</text>
+					<text class="price-line">
+						<text v-if="count.bigLength>0 || count.smallLength>0">数量</text>
+						<text v-if="count.bigLength>0" class="price-gap">{{count.bigLength}}</text>
+						<text v-if="count.smallLength>0" class="price-gap">{{count.smallLength}}</text>
+						<text class="price-gap">¥{{ price }}</text>
+						<text v-if="Number(discountAmount) > 0" class="discount-tip">省¥{{ parseFloat(discountAmount) }}</text>
+					</text>
 				</view>
 			</view>
 			<view class="cart-rg_bx" @click="confirmEvent"> 选好了 </view>
@@ -36,6 +39,10 @@ export default {
 		count: {
 			type: Object,
 			default: {}
+		},
+		discountAmount: {
+			type: Number,
+			default: 0
 		}
 	},
 	methods: {
@@ -99,17 +106,35 @@ export default {
 				}
 			}
 			& .price {
+				flex: 1;
+				min-width: 0;
 				font-weight: 500;
 				color: #ffffff;
-				font-size: 36upx;
-				padding-left: 24upx;
+				font-size: 34upx;
+				padding-left: 16upx;
+				padding-right: 8upx;
+				.price-line {
+					display: block;
+					white-space: nowrap;
+					overflow: hidden;
+					text-overflow: ellipsis;
+					line-height: 1.2;
+				}
+				.price-gap {
+					margin-left: 10upx;
+				}
+				.discount-tip {
+					margin-left: 10upx;
+					font-size: 26upx;
+					color: #ffd666;
+				}
 			}
 		}
 		& .cart-rg_bx {
 			height: 100%;
 			width: 200upx;
 			text-align: center;
-			font-size: 28upx;
+			font-size: 34upx;
 			color: #ffffff;
 			background-color: #09C567;
 			line-height: 88upx;

+ 72 - 14
hdApp/src/mixins/cgProduct.js

@@ -72,15 +72,21 @@ export default {
 			let price = 0;
 			if (this.selectList) {
 				for (const item of this.selectList) {
-					const itemInfo = this.getSelectItemById(item.id, item.classId);
-					if ( itemInfo && !this.$util.isEmpty(itemInfo.bigPrice) && !this.$util.isEmpty(itemInfo.smallPrice) ) {
-						price += item.bigCount * Number(itemInfo.bigPrice);
-						price += item.smallCount * Number(itemInfo.smallPrice);
-					}
+					price += this.getSelectItemTotalPrice(item);
 				}
 			}
 			return Math.round(price * 100) / 100;
 		},
+		// 满减优惠总额
+		allReachDiscountAmount() {
+			let discount = 0;
+			if (this.selectList) {
+				for (const item of this.selectList) {
+					discount += this.getReachDiscountAmount(item);
+				}
+			}
+			return Math.round(discount * 100) / 100;
+		},
 		allPriceFun() {
 			let price = 0;
 			if (this.selectList) {
@@ -91,7 +97,7 @@ export default {
 					);
 
 				for (const item of newSelectList) {
-					price += this.getLimitBuyPriceInfo(item).total;
+					price += this.getSelectItemTotalPrice(item);
 				}
 			}
 			return Math.round(price * 100) / 100;
@@ -259,6 +265,52 @@ export default {
 			const limitItem = this.getLimitBuyItemById(item.id);
 			return !!(limitItem && this.isTrueValue(limitItem.isLimit) && this.isTrueValue(limitItem.specialPrice));
 		},
+		isReachDiscountReached(item) {
+			const reachNum = Number(item.reachNum) || 0;
+			if (reachNum <= 0) {
+				return false;
+			}
+			const itemInfo = this.getSelectItemById(item.id, item.classId);
+			return Number(itemInfo.bigCount) >= reachNum;
+		},
+		getReachDiscountAmount(item) {
+			if (!this.isReachDiscountReached(item)) {
+				return 0;
+			}
+			const itemInfo = this.getSelectItemById(item.id, item.classId);
+			const bigCount = Number(itemInfo.bigCount) || 0;
+			const originalBig = this.toSafeNumber(item.bigPrice || item.price);
+			const reachPrice = this.toSafeNumber(item.reachPrice);
+			return Math.round(Math.max(0, bigCount * (originalBig - reachPrice)) * 100) / 100;
+		},
+		getCartItemUnitPrice(item) {
+			const itemInfo = this.getSelectItemById(item.id, item.classId);
+			if (Number(itemInfo.bigCount) > 0 && this.isReachDiscountReached(item)) {
+				return parseFloat(this.toSafeNumber(item.reachPrice));
+			}
+			return parseFloat(this.toSafeNumber(item.bigPrice || item.price));
+		},
+		getSelectItemTotalPrice(item) {
+			return this.getLimitBuyPriceInfo(item).total;
+		},
+		_applyReachDiscountToPriceInfo(item, itemInfo, result) {
+			if (!this.isReachDiscountReached(item)) {
+				result.reachDiscountActive = false;
+				return;
+			}
+			const bigCount = Number(itemInfo.bigCount) || 0;
+			const smallCount = Number(itemInfo.smallCount) || 0;
+			if (!result.isLimitSpecial) {
+				const reachPrice = this.toSafeNumber(item.reachPrice);
+				const smallPrice = this.toSafeNumber(item.smallPrice);
+				result.total = bigCount * reachPrice + smallCount * smallPrice;
+			} else {
+				const reachNumDiscount = Number(item.reachNumDiscount) || 0;
+				result.total = Math.max(0.01, result.total - reachNumDiscount * bigCount);
+			}
+			result.total = Math.round(result.total * 100) / 100;
+			result.reachDiscountActive = true;
+		},
 		getLimitBuyPriceInfo(item) {
 			const itemInfo = this.getSelectItemById(item.id, item.classId);
 			
@@ -278,6 +330,7 @@ export default {
 			result.total = itemInfo.bigCount * specialPrice + itemInfo.smallCount * originalPrice;
 			const limitItem = this.getLimitBuyItemById(item.id);
 			if (!limitItem || !this.isLimitSpecialItem(item)) {
+				this._applyReachDiscountToPriceInfo(item, itemInfo, result);
 				return result;
 			}
 			const exceedNum = this.toSafeNumber(limitItem.exceedNum) + this.toSafeNumber(limitItem.currentBuyNum);
@@ -295,6 +348,7 @@ export default {
 				result.total = (result.currentBuyNum - result.exceedNum) * specialPrice + result.exceedNum * originalPrice;
 			}
 
+			this._applyReachDiscountToPriceInfo(item, itemInfo, result);
 			return result;
 		},
 		/**
@@ -304,8 +358,18 @@ export default {
 		getLimitBuyPriceDisplayParts(item) {
 			const priceInfo = this.getLimitBuyPriceInfo(item);
 			const fmt = (n) => parseFloat(Number(n) || 0);
+			const itemInfo = this.getSelectItemById(item.id, item.classId);
+			if (priceInfo.reachDiscountActive && !priceInfo.isLimitSpecial && Number(itemInfo.bigCount) > 0) {
+				const reachPrice = fmt(item.reachPrice);
+				const originalBig = fmt(item.bigPrice || item.price);
+				return {
+					showStrike: reachPrice < originalBig,
+					main: `¥${reachPrice}`,
+					strike: reachPrice < originalBig ? `¥${originalBig}` : ""
+				};
+			}
 			if (!priceInfo.isLimitSpecial) {
-				const big = Number(item.bigCount) > 0;
+				const big = Number(itemInfo.bigCount) > 0;
 				const p = big
 					? this.toSafeNumber(item.bigPrice)
 					: this.toSafeNumber(item.smallPrice);
@@ -548,13 +612,7 @@ export default {
 		},
 		//获取当前选中商品总价
 		getSelectItemPrice(item) {
-			let price = 0;
-			const { bigCount, smallCount, bigPrice, smallPrice } = item;
-			let sum =
-				Number(bigCount) * Number(bigPrice) +
-				Number(smallCount) * Number(smallPrice);
-			price = Math.round(sum * 100) / 100;
-			return price;
+			return this.getSelectItemTotalPrice(item);
 		},
 		//商品-请求商品数据
 		async initGoodsData(extendInfo) {

+ 122 - 32
hdApp/src/pagesPurchase/components/item.vue

@@ -17,10 +17,9 @@
 				<view class="kc num-open_bx flex-space">
 					<view>
 						<view class="flex-space" v-if="Number(info.discountPrice)>0" style="position:absolute;top:14upx;">
-							<view style="padding:2upx 10upx 5upx 10upx;text-align: center;color: red;border: 1px solid red;margin-right: 20upx;line-height: 1;font-size: 20upx">
+							<view style="padding:2upx 10upx 5upx 10upx;text-align: center;color: red;border: 1px solid red;line-height: 1;font-size: 20upx">
 								{{parseFloat(((Number(info.discountPrice)/Number(info.prePrice)).toFixed(2)*10).toFixed(1))+'折'}}
 							</view>
-							<text style="text-decoration:line-through;color:#A9A9A9">¥{{parseFloat(info.prePrice)}}</text>
 						</view>
 						<view class="flex-space" style="color:#333333;position:absolute;top:13upx;" v-else>
 							<block v-if="info.ratioType == 0">
@@ -31,10 +30,14 @@
 							</block>
 						</view>
 						<view class="price" v-if="info.myLevel && info.myLevel == 2">
-							<text style="color:#a7a2a2;text-decoration:line-through;font-size:30upx;font-weight:bold;" v-if="Number(shopId)!=38322">¥{{parseFloat(info.defaultGradePrice) }}</text>
-							<text style="font-weight:bold;margin-left:10upx;font-size:30upx;">会员¥{{ parseFloat(info.price) }}</text>
+							<text style="color:#a7a2a2;text-decoration:line-through;font-size:30upx;font-weight:bold;" v-if="Number(shopId)!=38322 && !displayOriginalPriceLabel">¥{{parseFloat(info.defaultGradePrice) }}</text>
+							<text v-if="displayOriginalPriceLabel" class="price-original">{{ displayOriginalPriceLabel }}</text>
+							<text style="font-weight:bold;font-size:30upx;" :class="{'price-reach': reachDiscountReached}">会员¥{{ displayUnitPrice }}</text>
+						</view>
+						<view class="price price-wrap" v-else>
+							<text v-if="displayOriginalPriceLabel" class="price-original">{{ displayOriginalPriceLabel }}</text>
+							<text style="font-weight:bold;font-size:30upx;" :class="{'price-reach': reachDiscountReached}">¥{{ displayUnitPrice }}</text>
 						</view>
-						<view class="price" style="font-weight:bold;font-size:30upx;" v-else>¥{{ info.price ? parseFloat(info.price) : 0 }}</view>
 					</view>
 					<view style="text-align: right" >
 						<view class="open-bx" >
@@ -43,7 +46,7 @@
 								<text v-if="bigCount > 0" style="font-weight:bold;color:#3385ff;">{{ `${bigCount}` }}</text>
 								<text v-if="smallCount > 0" >{{ `${smallCount}` }}</text>
 							</text>
-							<i class="iconfont iconzeng" @click.stop="addEvents(info.variety)"></i>
+							<i class="iconfont iconzeng add-btn" @click.stop="addEvents(info.variety)"></i>
 						</view>
 						<stock v-if="showStock && showStock == '1'">
 							<text v-if="Number(info.stock) > Number(info.stockWarning)" style="color:#333;margin-right:55upx;">还剩 {{ parseFloat(info.stock) }}</text>
@@ -58,21 +61,31 @@
 				</view>
 			</view>
 		</view>
-		<view class="remark-bar" v-if="info.itemRemark" @click.stop>
-			<text class="iconfont iconmingxi1 remark-icon"></text>
-			<text class="remark-text">{{ info.itemRemark }}</text>
+		<view class="extra-line extra-line--middle" v-if="info.itemRemark" @click.stop>
+			<view class="extra-line-row extra-line-row--with-icon">
+				<view class="remark-notice-icon">!</view>
+				<view class="extra-line-content">
+					<text class="remark-text">{{ info.itemRemark }}</text>
+				</view>
+			</view>
 		</view>
 		<view class="extra-line extra-line--middle" v-if="showMiddleExtra" @click.stop>
-			<view class="extra-line-row" v-if="Number(info.reachNum)>0">
-				<text style="font-weight:bold;">
-					满{{info.reachNum}}扎,享 ¥{{parseFloat(info.reachPrice)}}/扎<block v-if="info.presell == 0">(下单后生效)</block>
-				</text>
+			<view class="extra-line-row extra-line-row--with-icon" v-if="Number(info.reachNum)>0">
+				<text class="iconfont iconjianqu extra-line-icon"></text>
+				<view class="extra-line-content">
+					<text style="font-weight:bold;">
+						满{{info.reachNum}}扎 享 ¥{{parseFloat(info.reachPrice)}}
+					</text>
+				</view>
 			</view>
-			<view class="extra-line-row" v-if="info.presell && info.presell == 1">
-				<text style="font-weight:bold;margin-right:10upx;">到货日期</text>
-				<block v-if="!$util.isEmpty(info.presellDateShow)">
-					<text style="font-weight:bold;" v-for="(dateItem, dateIndex) in info.presellDateShow" :key="dateIndex">{{dateItem}}<text v-if="dateIndex!=info.presellDateShow.length-1">,</text></text>
-				</block>
+			<view class="extra-line-row extra-line-row--with-icon" v-if="info.presell && info.presell == 1">
+				<text class="iconfont iconfahuo extra-line-icon"></text>
+				<view class="extra-line-content">
+					<text style="font-weight:bold;margin-right:10upx;">到货日期</text>
+					<block v-if="!$util.isEmpty(info.presellDateShow)">
+						<text style="font-weight:bold;" v-for="(dateItem, dateIndex) in info.presellDateShow" :key="dateIndex">{{dateItem}}<text v-if="dateIndex!=info.presellDateShow.length-1">,</text></text>
+					</block>
+				</view>
 			</view>
 		</view>
 		<view class="extra-line" v-else-if="showMyStock" @click.stop>
@@ -129,6 +142,29 @@ export default {
 		},
 		showMyStock() {
 			return !this.showMiddleExtra && this.info.myDisplay == 1;
+		},
+		reachDiscountReached() {
+			const reachNum = Number(this.info.reachNum) || 0;
+			return reachNum > 0 && Number(this.bigCount) >= reachNum;
+		},
+		hasLimitDiscount() {
+			return Number(this.info.discountPrice) > 0;
+		},
+		displayOriginalPriceLabel() {
+			if (this.reachDiscountReached) {
+				const price = parseFloat(Number(this.info.price) || 0);
+				return this.info.myLevel == 2 ? `会员¥${price}` : `¥${price}`;
+			}
+			if (this.hasLimitDiscount) {
+				return `¥${parseFloat(Number(this.info.prePrice) || 0)}`;
+			}
+			return '';
+		},
+		displayUnitPrice() {
+			if (this.reachDiscountReached) {
+				return parseFloat(Number(this.info.reachPrice) || 0);
+			}
+			return parseFloat(Number(this.info.price) || 0);
 		}
 	},
 	data() {
@@ -193,32 +229,66 @@ export default {
 	position: relative;
 	margin-bottom: 20upx;
 }
-.remark-bar {
+.remark-notice-icon {
+	width: 30upx;
+	height: 30upx;
+	border-radius: 50%;
+	background: #ff8c3a;
+	color: #fff;
+	font-size: 22upx;
+	font-weight: bold;
+	line-height: 30upx;
+	text-align: center;
+	flex-shrink: 0;
+	margin-right: 8upx;
 	display: flex;
 	align-items: center;
-	margin-top: 4upx;
-	padding: 6upx 10upx;
-	background: #fff8f2;
-	border-left: 5upx solid #ff8c3a;
-	box-sizing: border-box;
-}
-.remark-icon {
-	font-size: 28upx;
-	color: #ff8c3a;
-	line-height: 1.2;
-	margin-right: 10upx;
-	flex-shrink: 0;
+	justify-content: center;
 }
 .remark-text {
 	font-size: 30upx;
 	font-weight: bold;
 	color: #ff2842;
-	line-height: 1.3;
+	line-height: 30upx;
 	overflow: hidden;
 	white-space: nowrap;
 	text-overflow: ellipsis;
+}
+.extra-line-row--with-icon {
+	display: flex;
+	align-items: center;
+}
+.extra-line-icon {
+	font-size: 26upx;
+	color: #3385ff;
+	line-height: 26upx;
+	height: 26upx;
+	margin-right: 8upx;
+	flex-shrink: 0;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+}
+.extra-line-content {
 	flex: 1;
 	min-width: 0;
+	display: flex;
+	align-items: center;
+	flex-wrap: wrap;
+}
+.price-wrap {
+	font-weight: bold;
+	font-size: 30upx;
+}
+.price-original {
+	text-decoration: line-through;
+	color: #A9A9A9;
+	font-size: 24upx;
+	margin-right: 8upx;
+	font-weight: bold;
+}
+.price-reach {
+	color: #ff2842;
 }
 .extra-line {
 	margin-top: 8upx;
@@ -285,6 +355,15 @@ export default {
 		& .num-open_bx {
 			display: flex;
 			align-items: center;
+			& > view:first-child {
+				flex: 1;
+				min-width: 0;
+				padding-right: 16upx;
+				box-sizing: border-box;
+			}
+			& > view:last-child {
+				flex-shrink: 0;
+			}
 			& .price {
 				font-size: 28upx;
 				color: #ff2842;
@@ -295,10 +374,21 @@ export default {
 			& .open-bx {
 				display: flex;
 				align-items: center;
+				justify-content: flex-end;
+				padding-right: 4upx;
+				box-sizing: border-box;
+				flex-shrink: 0;
 				& .iconfont {
 					color: #09C567;
 					font-size: 55upx;
 				}
+				& .iconfont.add-btn {
+					font-size: 62upx;
+					line-height: 1;
+					padding: 6upx;
+					margin: -6upx 0 -6upx 0;
+					box-sizing: content-box;
+				}
 				& > .num {
 					display: inline-block;
 					width: 100upx;

+ 28 - 11
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -93,7 +93,7 @@
 			</template>
 		</modal-module>
 
-		<FooterCart :price="allPrice" :count="allCount" @confirm="confirmSelectEvent" @showCartItem="showCartItem"></FooterCart>
+		<FooterCart :price="allPrice" :count="allCount" :discountAmount="allReachDiscountAmount" @confirm="confirmSelectEvent" @showCartItem="showCartItem"></FooterCart>
 		<wangCg :notOpenShop.sync="notOpenShop" :pass.sync="pass" @bthClick="goToCg()" @refresh="toRefresh" @contactShop="contactShop()"></wangCg>
 		<app-activily-coupon :show.sync="isNewCustom" :info="newCustomGift" :ghsId="ghsId" />
 
@@ -109,12 +109,15 @@
 							<view class="item-info">
 								<view class="info-line">
 									<text class="item-name">{{ item.name }}</text>
-									<text class="item-price">
-										<text class="unit">¥</text>
-										<text class="price">
-											{{ parseFloat(item.price)||0 }}
+									<view class="item-price-col">
+										<text class="item-price">
+											<text v-if="isReachDiscountReached(item)" class="price-original">¥{{ parseFloat(item.bigPrice || item.price) }}</text>
+											<text class="unit">¥</text>
+											<text class="price" :class="{'price-reach': isReachDiscountReached(item)}">
+												{{ getCartItemUnitPrice(item) }}
+											</text>
 										</text>
-									</text>
+									</view>
 								</view>
 								<view class="limit-buy-tip" v-if="getLimitBuyWarn(item)">
 									{{ getLimitBuyWarn(item) }}
@@ -891,7 +894,7 @@ export default {
 	}
 	.item_list_title {
 		margin-bottom: 20upx;
-		font-size: 26upx;
+		font-size: 34upx;
 		font-weight: 600;
 		color: #067a40;
 	}
@@ -994,7 +997,7 @@ export default {
 					align-items: flex-end;
 					.item-name {
 						color: #666;
-						font-size: 28upx;
+						font-size: 34upx;
 						overflow: hidden;
 						white-space: nowrap;
 						text-overflow: ellipsis;
@@ -1002,11 +1005,25 @@ export default {
 					}
 					.item-price {
 						color: #333;
-						font-size: 22upx;
+						font-size: 26upx;
+						white-space: nowrap;
 						.price {
 							font-size: 32upx;
 							font-weight: bold;
 						}
+						.price-reach {
+							color: #ff2842;
+						}
+						.price-original {
+							margin-right: 6upx;
+							font-size: 28upx;
+							color: #A9A9A9;
+							text-decoration: line-through;
+						}
+					}
+					.item-price-col {
+						flex-shrink: 0;
+						text-align: right;
 					}
 				}
 			.limit-buy-tip {
@@ -1014,7 +1031,7 @@ export default {
 				left: 0;
 				top: 86upx;
 				color: red;
-				font-size: 24upx;
+				font-size: 30upx;
 				text-align: left;
 			}
 
@@ -1036,7 +1053,7 @@ export default {
 			color: #868686;
 			border-radius: 22upx;
 			background-color: #f5f5f5;
-			font-size: 28upx;
+			font-size: 34upx;
 		}
 	}