Browse Source

商品搜索页面优化

zhengjinyi 5 years ago
parent
commit
fec052f0b1

+ 0 - 1
components/module/headerNavbar/header-poduct.vue

@@ -52,7 +52,6 @@
 			}
 		},
 		created() {
-			// console.log(this.systeminfo);
 			// console.log(this.headerBtnPosi);
 			// console.log(this.headerColor)
 			this.fontSizeSetting = this.systeminfo.fontSizeSetting

+ 9 - 5
pages/goods/product.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="product">
-		<header-back  :systeminfo='systeminfo' :navbar-data='nvabarData' :headerBtnPosi ="headerBtnPosi" :headerColor="headerColor" :page='1'></header-back>
+		<header-back  :systeminfo='systeminfo' :navbar-data='nvabarData' :headerBtnPosi ="headerBtnPosi" :headerColor="headerColor" :page='backPage'></header-back>
 		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading	="true" :loadingType="9"></tui-skeleton>
 		<view class="container-product tui-skeleton">
 			<view class="product-top">
@@ -236,15 +236,19 @@
 				isIphoneX:this.$store.state.isIphoneX,
 				windowHeight: '',
 				headerColor:false,
+				backPage:1,
 				nvabarData: {							 //顶部自定义导航
 					showCapsule: 1, // 是否显示左上角图标   1表示显示    0表示不显示
-					title: '', 		// 导航栏 中间的标题
-				},
+					title: ''		// 导航栏 中间的标题
+				}
 			}
 		},
 		onLoad(option) {
 			let self = this;
 			this.productID = option.id;//获取商品ID
+			if(option.page == 2){
+				this.backPage = option.page
+			}
 			this.tabCurrentIndex = 1;// 页面显示是默认选中第一个	
 		},
 		methods:{
@@ -269,7 +273,7 @@
 								})
 								//拆分金额并转千分位格式显示
 								this.retailPrice = this.productData.retailPrice.toFixed(2);
-								this.buyRetailPrice = this.productData.retailPrice.toFixed(2);
+								this.buyRetailPrice = this.productData.retailPrice;
 								if(this.productData.validFlag =='2'){
 									this.disabled = true
 								}else{
@@ -495,7 +499,7 @@
 					this.initData();
 				}
 			});	
-		},
+		}
 	}
 </script>
 

+ 1 - 1
pages/login/login.vue

@@ -162,7 +162,7 @@
 						let url;
 						if(self.loginType) {
 							if(self.loginType=='detilType'){
-								self.$api.redirectTo(`/pages/goods/product?id=${self.id}`);
+								self.$api.redirectTo(`/pages/goods/product?id=${self.id}&page=2`);
 							}else if(self.loginType=='search'){
 								self.$api.redirectTo('/pages/search/search');
 							}else if(self.loginType == 1){

+ 5 - 3
pages/search/search-order.vue

@@ -22,8 +22,8 @@
 				</view>
 			</view>
 		</view>
-		<view class=" order-container" v-if="isShowWrapper" :style="{'overflow':(showSkeleton? 'hidden' : 'auto'),'height': (showSkeleton? windowHeight + 'px' : 'auto')}">
-			<scroll-view  class="tui-skeleton"  @scrolltolower="scrolltolower" scroll-y >
+		<view class=" order-container" v-if="isShowWrapper" :style="{'overflow':(showSkeleton? 'hidden' : 'auto'),'height': (showSkeleton? (scrollHeight-57) + 'px' : 'auto')}">
+			<scroll-view  class="tui-skeleton" :style="{'height':scrollHeight+'px'}"  @scrolltolower="scrolltolower" scroll-y >
 				<view  :class="{'tui-order-list':scrollTop >= 0}" class="tui-skeleton clearfix">
 					<!-- 空白页 -->
 					<empty v-if="isShowEmpty" :navbarHeight="navbarHeight"></empty>
@@ -269,6 +269,7 @@
 							response => {
 								if(response.code === '1'){
 									this.isShowWrapper = true
+									this.showSkeleton = true
 									const _responseData = response.data.results;
 									if(_responseData && _responseData.length > 0){
 										let filrerData = _responseData.filter(item=>{
@@ -333,6 +334,7 @@
 				if(this.hasNextPage){
 					this.loadding = true
 					this.pullUpOn = true
+					this.showSkeleton = false
 					this.getOnReachBottomData();
 				}	
 			},
@@ -487,7 +489,7 @@
 		top: 0;
 		left: 0;
 		background: #FFFFFF;
-		z-index: 999;
+		z-index: 1001;
 		.search-input{
 			width: 448rpx;
 			height: 80rpx;

+ 13 - 10
pages/search/search.vue

@@ -23,7 +23,7 @@
 		</view>
 		<!-- <go-search :theme="themeClass" @subMitSearch="subMitSearch"></go-search> -->
 		<view v-else class="container commodity-list-wrapper"  :style="{'overflow':(showSkeleton ? 'hidden' : 'auto'),'height':(showSkeleton? (scrollHeight-57) + 'px' : 'auto')}">
-			<scroll-view :style="{'height':scrollHeight+'px'}" @scrolltolower="toLower" scroll-y v-if="!showEmpty">
+			<scroll-view :style="{'height':scrollHeight+'px'}" @scrolltolower="scrolltolower" scroll-y v-if="!showEmpty">
 				<view v-for="(item,index) in commodityList" :key="index" :id="item.id" class="all-type-list-content commodity-list" @click.stop="navToDetailPage(item.id)">
 					<image mode='widthFix' :src="item.mainImage"  class="list-img" alt="list-img"></image>
 					<view class="list-details-info">
@@ -100,13 +100,7 @@
 			}
 		},
 		created() {
-			this.$api.getStorage().then((resolve) =>{
-				this.userID = resolve.userID
-			})
-			this.setScrollHeight();
-			this.$api.loginStatus().then((resolveData) => {
-				this.loginStatus = resolveData;
-			});
+			
 		},
 		onLoad() {
 		  this.initGetSerachRecord()
@@ -135,7 +129,7 @@
 					this.getListFromServer(false)
 				}
 			},
-			toLower() {
+			scrolltolower() {
 				// 第一次加载排除常用商品
 				if(this.hasNextPage && this.pullFlag) {
 					this.getListFromServer(true);
@@ -255,6 +249,15 @@
 					url:`/pages/login/login?type=${searchLoginType}`
 				})
 			}
+		},
+		onShow() {
+			this.$api.getStorage().then((resolve) =>{
+				this.userID = resolve.userID
+			})
+			this.setScrollHeight();
+			this.$api.loginStatus().then((resolveData) => {
+				this.loginStatus = resolveData;
+			});		
 		}
 	}
 </script>
@@ -273,7 +276,7 @@
 		top: 0;
 		left: 0;
 		background: #FFFFFF;
-		z-index: 999;
+		z-index: 1001;
 		.search-input{
 			width: 448rpx;
 			height: 80rpx;