lilei 9 月之前
父节点
当前提交
5357abae2b
共有 2 个文件被更改,包括 36 次插入21 次删除
  1. 35 20
      pages/index/index.vue
  2. 1 1
      pages/morePage/morePage.vue

+ 35 - 20
pages/index/index.vue

@@ -210,6 +210,7 @@
 				screenWidth: 325, // 屏幕宽度
 				productList:[], // 热门产品
 				hotProductPageNo: 1 ,// 热门产品页码
+				hotProductpageSize:10, // 热门产品每页数量
 				totalhotPage: 0, // 热门产品总页数
 				showFixed: false, // 是否显示浮动头部
 				isCheckLogin:false, // 是否正在检查登录
@@ -332,11 +333,11 @@
 				// 价格类型
 				this.getLookUpList('PRICE_SHOW_TYPE', 'vuex_priceTypeList');
 				// 初始化页面
-				this.pageInit(false)
+				this.pageInit(0)
 			})
 			// 刷新首页数据
 			uni.$on("refashHome",()=>{
-				this.pageInit(true)
+				this.pageInit(2)
 			})
 		},
 		// 页面卸载
@@ -349,12 +350,12 @@
 			this.avatarUrl = uni.getStorageSync('userPhoto');
 			// 重新刷新
 			if(!this.isCheckLogin){
-				this.pageInit(true)
+				this.pageInit(1)
 			}
 		},
 		// 下拉刷新
 		onPullDownRefresh(){
-			this.pageInit(true)
+			this.pageInit(2)
 			setTimeout(function () {
 				uni.stopPullDownRefresh();
 			}, 1000);
@@ -397,11 +398,9 @@
 						// 获取扫描记录
 						this.getVinLog()
 						// 商品分类
-						if(this.productTypeList.length == 0){
-							this.getGoodType()
-						}
+						this.getGoodType()
 						// 获取推荐产品
-						this.getHotProductList()
+						this.getHotProductList(flag)
 					}
 				}else{
 					// 未登录
@@ -409,11 +408,11 @@
 					// 隐藏促销模块
 					this.hidePromoTab()
 					// 商品分类
-					if(this.productTypeList.length == 0){
+					if(flag!=1){
 						this.getGoodType()
 					}
 					// 获取推荐产品
-					this.getHotProductList()
+					this.getHotProductList(flag)
 				}
 			},
 			// 查询是否支持数字货架, flag: true 再次刷新,false 首次加载,只加载一次
@@ -427,7 +426,7 @@
 							// 查询是否有商城
 							this.getHasShopping(flag)
 							// 只需加载一次
-							if(!flag){
+							if(flag==0){
 								// 更新用户信息
 								this.getCurrUserInfo()
 								// 显示促销模块
@@ -472,12 +471,12 @@
 					if(this.hasShopiing){
 						// 隐藏tab 视频,显示tab购物车
 						this.showCatTab()
-						if(this.productTypeList.length == 0){
+						if(flag!=1){
 							// 商品分类
 							this.getGoodType()
 						}
 						// 获取推荐产品
-						this.getHotProductList()
+						this.getHotProductList(flag)
 					}else{
 						// 没有商城
 						// 隐藏tab 购物车,显示tab视频
@@ -519,19 +518,35 @@
 				})
 			},
 			// 商品列表查询
-			getHotProductList(){
-				this.productList = []
+			getHotProductList(flag){
 				this.hotProductPageNo = 1
-				this.getProductList()
+				// 不是show 刷新列表
+				if(flag!=1){
+					this.productList = []
+					this.hotProductpageSize = 10
+				}else{
+					// 刷新列表
+					let count = 0
+					this.productList.forEach(item => {
+						count += item.length
+					})
+					this.hotProductpageSize = count
+				}
+				this.getProductList(flag)
 			},
-			getProductList(){
+			getProductList(flag){
 				this.status = "loading"
 				const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
 				// 获取推荐产品	
-				 getShopProductList({pageNo:this.hotProductPageNo,pageSize:10,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
+				 getShopProductList({pageNo:this.hotProductPageNo,pageSize:this.hotProductpageSize,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
 					 if(res.status == 200){
 						 const list = res.data ? res.data.list : []
-						 this.productList.push(list)
+						 if(flag!=1){
+							 this.productList.push(list)
+						 }else{
+							 // 刷新
+							 this.productList = [list]
+						 }
 						 this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
 						 // 判断是否最后一页
 						 const maxPages = Math.ceil(res.data.count / 10)
@@ -897,7 +912,7 @@
 		&::after{
 			/* 这个伪类的作用就是一个圆弧的背景色 */
 			width: 130%;
-			height: 40vh;
+			height: 30vh;
 			position: absolute;
 			/*设置水平居中*/
 			left: -15%;

+ 1 - 1
pages/morePage/morePage.vue

@@ -53,7 +53,7 @@
 				<view class="list-title flex align_center justify_between" @click="toPage('/pagesB/coupon')">
 					<view><u-icon size="34" color="#ff7d0b" name="gift-fill"></u-icon> <text style="color: #ff7d0b;margin-left: 10rpx;">我的优惠券</text></view>
 					<view>
-						<u-badge :absolute="false" :count="couponCount"></u-badge>
+						<u-badge :absolute="false" :count="hasShelf?couponCount:0"></u-badge>
 						<uni-icons type="arrowright" size="20" color="#999"></uni-icons>
 					</view>
 				</view>