Browse Source

bug修复

zhengjinyi 4 years ago
parent
commit
8f13bc83e2

+ 17 - 1
components/cm-module/productDetails/cm-price.vue

@@ -9,7 +9,9 @@
 				<text class="txt sm">{{ smallMoney }} </text>
 			</view>
 			<view class="floor-item-act" v-if="product.activeStatus == 1">
-				<view class="tag" @click.stop="clickPopupShow()">活动价</view>
+				<text class="tag tag-01" v-if="product.includedTax == '0'">自营</text>
+				<text class="tag tag-01" v-if="product.includedTax == '1'">促销</text>
+				<view class="tag tag-02" @click.stop="clickPopupShow()">活动价</view>
 			</view>
 		</view>
 		<!--促销活动弹窗提示-->
@@ -352,4 +354,18 @@ export default {
 		border-radius: 44rpx;
 	}
 }
+
+// .wrap-main{
+// 	.floor-item-act{
+// 		&::after{
+// 			content: "";
+// 			display: block;
+// 			clear: both;
+// 		}
+// 		.tag{
+// 			margin-right: 10rpx;
+// 			float: left;
+// 		}
+// 	}
+// }
 </style>

+ 81 - 49
pages/goods/product.vue

@@ -27,7 +27,7 @@
 		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading	="true" :loadingType="2"></tui-skeleton>
 		<template v-else >
 			<view class="container-product tui-skeleton">
-				<view class="container-product-main product-details0">
+				<view class="container-product-main product-details product-details0">
 					<view class="product-top">
 						<view class="banner-section">
 							<uni-swiper-dot :info="productImage" :current="current" field="content" :mode="mode" >
@@ -379,21 +379,30 @@
 					longPressActions:''
 				})
 			},
-			tabClick(index) {//商品详情&&供应商信息tab切换
+			tabClick(index) {
+				//商品详情&&供应商信息tab切换
 				this.tabSelectFlag = true
-				this.tabCurrentIndex = index;
-				let classIndex = '.product-details'+index;
-				uni.createSelectorQuery().select('.container-product-main').boundingClientRect((data)=>{//最外层盒子节点
-				  uni.createSelectorQuery().select(classIndex).boundingClientRect((res)=>{//最外层盒子节点
-				    uni.pageScrollTo({
-				      duration:300,//过渡时间必须为0,uniapp bug,否则运行到手机会报错
-				      scrollTop:res.top - data.top - 150,//滚动到实际距离是元素距离顶部的距离减去最外层盒子的滚动距离
-				    })
-						setTimeout(()=>{
-							this.tabSelectFlag = false;
-						},500)
-				  }).exec()
-				}).exec()
+				this.tabCurrentIndex = index
+				let classIndex = '.product-details' + index
+				uni.createSelectorQuery()
+					.select('.container-product')
+					.boundingClientRect(data => {
+						//最外层盒子节点
+						uni.createSelectorQuery()
+							.select(classIndex)
+							.boundingClientRect(res => {
+								//最外层盒子节点
+								uni.pageScrollTo({
+									duration: 300, //过渡时间必须为0,uniapp bug,否则运行到手机会报错
+									scrollTop: res.top - data.top - 40 //滚动到实际距离是元素距离顶部的距离减去最外层盒子的滚动距离
+								})
+								setTimeout(() => {
+									this.tabSelectFlag = false
+								}, 500)
+							})
+							.exec()
+					})
+					.exec()
 			},
 			handleContact(e){//跳转小程序客服
 
@@ -549,15 +558,18 @@
 			getSectionProps() {//获取每个tab对应区域的scrollTop值
 				let className = '.product-details',
 					sectionPropsArr = [];
-				uni.createSelectorQuery().select('.container-product-main').boundingClientRect((data)=>{//最外层盒子节点
+				uni.createSelectorQuery().select('.container-product').boundingClientRect((data)=>{//最外层盒子节点
 				  uni.createSelectorQuery().selectAll(className).boundingClientRect((res)=>{//最外层盒子节点
 						res.forEach((item, index) => {
+							console.log(item);
 							sectionPropsArr.push({
 								className: `${className}${index}`,
-								scrollTop: item.top - data.top - 150
+								scrollTop: item.top - data.top,
+								height:item.height
 							})
 						})
 						this.sectionPropsArr = sectionPropsArr;
+						console.log(this.sectionPropsArr);
 						this.sectionTopRangeArr = this.getSectionRange(sectionPropsArr);
 				  }).exec()
 				}).exec()
@@ -565,35 +577,46 @@
 			getSectionRange(arr) {// 获取每个tab对应区域的区间
 				let sectionScrollTopList = [];
 				for(let i = 0; i < arr.length; i++) {
-					let thisScrollTop = arr[i].scrollTop;
-					if(i < arr.length - 1) {
-						let nextScrollTop = arr[i+1].scrollTop;
-						if(i == 0) {
-							sectionScrollTopList.push(`0-${thisScrollTop}`);
-						} else if(i == arr.length - 1){
-							sectionScrollTopList.push(`${thisScrollTop}-${nextScrollTop - this.winHeight}`);
-						} else {
-							sectionScrollTopList.push(`${thisScrollTop}-${nextScrollTop}`);
-						}
-					} else {
-						sectionScrollTopList.push(`${thisScrollTop}-${thisScrollTop+500}`);
-					}
+					sectionScrollTopList.push(`${arr[i].scrollTop}-${arr[i].scrollTop + arr[i].height}`)
 				}
+				// for(let i = 0; i < arr.length; i++) {
+				// 	let thisScrollTop = arr[i].scrollTop;
+				// 	let thisHeight = arr[i].height;
+				// 	if(i < arr.length - 1) {
+				// 		let nextScrollTop = arr[i+1].scrollTop;
+				// 		if(i == 0) {
+				// 			sectionScrollTopList.push(`0-${thisScrollTop + thisHeight}`);
+				// 		} else if(i == arr.length - 1){
+				// 			sectionScrollTopList.push(`${thisScrollTop + thisHeight}-${nextScrollTop - this.winHeight}`);
+				// 		} else {
+				// 			sectionScrollTopList.push(`${thisScrollTop + thisHeight}-${nextScrollTop}`);
+				// 		}
+				// 	} else {
+				// 		sectionScrollTopList.push(`${thisScrollTop}-${thisScrollTop+500}`);
+				// 	}
+				// }
 				return sectionScrollTopList;
 			},
-			activeTab: debounce((top, _this)=> {//当滑动时也能同步激活tab
-				const { sectionTopRangeArr } = _this;
-				if(sectionTopRangeArr.length > 0) {
-					sectionTopRangeArr.forEach((item, index) => {
-						let splitItem = item.split('-'),
-							openInterval = Number(splitItem[0]),
-							closedInterval = Number(splitItem[1]);
-						if(top >= openInterval && top < closedInterval) {
-							_this.tabCurrentIndex = index;
-						}
-					})
-				}
-			},100, true),
+			activeTab: debounce(
+				(top, _this) => {
+					//当滑动时也能同步激活tab
+					const { sectionTopRangeArr } = _this
+					console.log(sectionTopRangeArr);
+					if (sectionTopRangeArr.length > 0) {
+						sectionTopRangeArr.forEach((item, index) => {
+							let splitItem = item.split('-'),
+								openInterval = Number(splitItem[0]),
+								closedInterval = Number(splitItem[1])
+							if (top >= openInterval && top < closedInterval) {
+								console.log(top);
+								_this.tabCurrentIndex = index
+							}
+						})
+					}
+				},
+				100,
+				true
+			),
 			getWinHeight() {
 				this.winHeight = wx.getSystemInfoSync().windowHeight;
 			},
@@ -868,22 +891,31 @@
 				}
 			}
 			.floor-item-act{
-				width: 80rpx;
-				height: 30rpx;
+				// width: 80rpx;
+				height: 34rpx;
 				margin-top: 15rpx;
 				margin-left: 20rpx;
 				float: left;
 				.tag{
 					display: inline-block;
-					width: 80rpx;
-					height: 30rpx;
-					background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
-					background-size: contain;
+					height: 32rpx;
 					font-size: 22rpx;
 					line-height: 30rpx;
 					text-align: center;
 					color: #f83c6c;
 					float: left;
+					margin-right: 10rpx;
+					&.tag-02{
+						width: 80rpx;
+						background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
+						background-size: contain;
+					}
+					&.tag-01{
+						width: 56rpx;
+						color: #fff;
+						background-color: #f83c6c;
+						border-radius: 4rpx;
+					}
 				}
 			}
 			.floor-item-btn{

+ 16 - 5
pages/tabBar/cart/index.vue

@@ -29,7 +29,9 @@
 											<view class="producttitle" @click.stop="navToListPage(pros)"	>{{pros.productName}}</view>
 											<view class="productspec">规格:{{pros.unit ? pros.unit : ''}}</view>
 											<view class="floor-item-act" v-if="pros.activeStatus == 1">
-												<view class="tag"@click.stop="clickPopupShow(pros,2)">活动价</view>
+												<text class="tag tag-01" v-if="pros.includedTax == '0'">自营</text>
+												<text class="tag tag-01" v-if="pros.includedTax == '1'">促销</text>
+												<text class="tag tag-02" @click.stop="clickPopupShow(pros,2)">活动价</text>
 											</view>
 											<view class="productprice">
 												<!--使用过滤器对总价改变-->
@@ -1046,15 +1048,24 @@
 				float: left;
 				.tag{
 					display: inline-block;
-					width: 80rpx;
-					height: 30rpx;
-					background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
-					background-size: contain;
+					height: 32rpx;
 					font-size: 22rpx;
 					line-height: 30rpx;
 					text-align: center;
 					color: #f83c6c;
 					float: left;
+					margin-right: 10rpx;
+					&.tag-02{
+						width: 80rpx;
+						background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
+						background-size: contain;
+					}
+					&.tag-01{
+						width: 56rpx;
+						color: #fff;
+						background-color: #f83c6c;
+						border-radius: 4rpx;
+					}
 				}
 			}
 		}

+ 17 - 7
pages/tabBar/index/index.vue

@@ -32,9 +32,9 @@
 				<view class="product-list-msg">
 					<view class="product-msg-name">{{ pro.name }}</view>
 					<view class="product-list-tag" v-if="pro.activeStatus == 1">
-						<text class="tag">活动价</text>
-						<text class="tag" v-if="pro.includedTax == '0'">自营</text>
-						<text class="tag" v-if="pro.includedTax == '1'">促销</text>
+						<text class="tag tag-01" v-if="pro.includedTax == '0'">自营</text>
+						<text class="tag tag-01" v-if="pro.includedTax == '1'">促销</text>
+						<text class="tag tag-02">活动价</text>
 					</view>
 					<view class="product-list-pri">
 						<view class="price">¥{{ pro.price | PriceFormat}}</view>
@@ -417,22 +417,32 @@
 					float: left;
 				}
 				.product-list-tag{
+					position: relative;
+					z-index: 9;
 					width: 100%;
 					height: 30rpx;
 					margin-top: 8rpx;
 					float: left;
 					.tag{
 						display: inline-block;
-						width: 80rpx;
-						height: 30rpx;
-						background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
-						background-size: contain;
+						height: 32rpx;
 						font-size: 22rpx;
 						line-height: 30rpx;
 						text-align: center;
 						color: #f83c6c;
 						float: left;
 						margin-right: 10rpx;
+						&.tag-02{
+							width: 80rpx;
+							background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
+							background-size: contain;
+						}
+						&.tag-01{
+							width: 56rpx;
+							color: #fff;
+							background-color: #f83c6c;
+							border-radius: 4rpx;
+						}
 					}
 				}
 				.product-list-pri{

+ 8 - 1
pages/user/activity/activity.vue

@@ -12,7 +12,11 @@
 				</view>
 				<view class="product-list-msg">
 					<view class="product-msg-name">{{ pro.name }}</view>
-					<view class="product-list-tag" v-if="pro.activeStatus == 1"><text class="tag">活动价</text></view>
+					<view class="product-list-tag">
+						<text class="tag">活动价</text>
+						<text class="tag" v-if="pro.includedTax == '0'">自营</text>
+						<text class="tag" v-if="pro.includedTax == '1'">促销</text>
+					</view>
 					<view class="product-list-pri">
 						<view class="price">¥{{ pro.price | PriceFormat}}</view>
 						<view class="carts" @click.stop="handAddCarts(pro)">
@@ -221,6 +225,8 @@
 					float: left;
 				}
 				.product-list-tag{
+					position: relative;
+					z-index: 9;
 					width: 100%;
 					height: 30rpx;
 					margin-top: 8rpx;
@@ -236,6 +242,7 @@
 						text-align: center;
 						color: #f83c6c;
 						float: left;
+						margin-right: 10rpx;
 					}
 				}
 				.product-list-pri{

+ 18 - 5
pages/user/order/order-list-retail.vue

@@ -53,7 +53,11 @@
 											<view class="pros-product clearfix">
 												<view class="producttitle tui-skeleton-fillet">{{pros.name}}</view>
 												<view class="productspec tui-skeleton-fillet" v-if="pros.productCategory!=2">规格:{{pros.productUnit}}</view>
-												<view class="floor-item-act"><view class="tag" @click.stop="clickPopupShow(pros,2)">活动价</view></view>
+												<view class="floor-item-act">
+													<text class="tag tag-01" v-if="pros.includedTax == '0'">自营</text>
+													<text class="tag tag-01" v-if="pros.includedTax == '1'">促销</text>
+													<text class="tag tag-02" @click.stop="clickPopupShow(pros,2)">活动价</text>
+												</view>
 												<view class="productprice">
 													<view class="price tui-skeleton-fillet"><text>¥{{pros.price | NumFormat}}</text></view>
 													<view class="count tui-skeleton-fillet"><text class="small">x</text>{{pros.num}}</view>
@@ -910,15 +914,24 @@
 			float: left;
 			.tag{
 				display: inline-block;
-				width: 80rpx;
-				height: 30rpx;
-				background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
-				background-size: contain;
+				height: 32rpx;
 				font-size: 22rpx;
 				line-height: 30rpx;
 				text-align: center;
 				color: #f83c6c;
 				float: left;
+				margin-right: 10rpx;
+				&.tag-02{
+					width: 80rpx;
+					background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
+					background-size: contain;
+				}
+				&.tag-01{
+					width: 56rpx;
+					color: #fff;
+					background-color: #f83c6c;
+					border-radius: 4rpx;
+				}
 			}
 		}
 	}

+ 2 - 0
pages/user/order/success.vue

@@ -54,12 +54,14 @@
 			}
 		},
 		onLoad(option) {
+			console.log(option);
 			let data = JSON.parse(option.data);
 			this.orderInfo = data.data
 			console.log(this.orderInfo)
 		},
 		filters:{
 			NumFormat(value) {//处理金额
+				console.log(value);
 				return Number(value).toFixed(2);
 			},
 		},