Browse Source

bug 修复

lilei 4 years ago
parent
commit
56ca964b47
2 changed files with 24 additions and 16 deletions
  1. 2 2
      pages/cart/cart.vue
  2. 22 14
      pages/goods/index.vue

+ 2 - 2
pages/cart/cart.vue

@@ -53,7 +53,7 @@
 								<view class="goods-price">
 									<view>
 										<text>{{good.goods.sellGold}}</text>
-										<image mode="scaleToFill" style="width: 30rpx;height: 30rpx;"src="/static/ledou.png"></image>
+										<image mode="scaleToFill" style="width: 30rpx;height: 30rpx;" src="/static/ledou.png"></image>
 									</view>
 									<view v-if="good.goods.inventoryQty>0&&good.goods.state==1">
 										<uni-numbers-box @change="goodsNumsChange()" :index="cindex+'-'+index" :value="good.buyQty" :max="good.goods.inventoryQty" :min="1"></uni-numbers-box>
@@ -70,7 +70,7 @@
 					<!-- 小计 -->
 					<view class="goods-class-heji">
 						<view>合计:<text>{{item.total}}</text></view>
-						<image mode="scaleToFill" style="width: 30rpx;height: 30rpx;"src="/static/ledou.png"></image>
+						<image mode="scaleToFill" style="width: 30rpx;height: 30rpx;" src="/static/ledou.png"></image>
 					</view>
 				</view>
 			</view>

+ 22 - 14
pages/goods/index.vue

@@ -47,7 +47,8 @@
 		},
 		computed: {
 			goodsListLength() {
-				return this.goodsList.length
+				let len  = this.goodsList.length
+				return len
 			}
 		},
 		onShow() {
@@ -63,6 +64,7 @@
 		// 下拉刷新
 		onPullDownRefresh() {
 			console.log('refresh')
+			this.noDataText = '正在加载...'
 			this.pageInit()
 			setTimeout(function () {
 				uni.stopPullDownRefresh()
@@ -85,6 +87,25 @@
 					}
 				})
 			},
+			// 查询商品
+			getGoods(item,index){
+				getGoodsList({
+						pageNo:1,
+						pageSize:item.popularizeGoodsLimit,
+						goodsTypeNo:item.goodsTypeNo,
+					}).then(res => {
+					console.log(res,'goodsList')
+					if(res.status == 200&&res.data.list&&res.data.list.length){
+						this.goodsList[index] = {
+							type: item,
+							list: res.data.list
+						}
+						this.goodsList.splice()
+					}else{
+						this.noDataText = '暂无商品'
+					}
+				})
+			},
 			// 点击banner
 			clickBanner(index){
 				let row = this.imageTopList[index]
@@ -116,19 +137,6 @@
 					url:"/pages/goods/goods?goodsTypeNo="+ item.goodsTypeNo + "&goldLimit="+ item.goldLimit + "&name=" + item.name
 				})
 			},
-			// 查询商品
-			getGoods(item,index){
-				getGoodsList({pageNo:1,pageSize:item.popularizeGoodsLimit,goodsTypeNo:item.goodsTypeNo}).then(res => {
-					console.log(res,'goodsList')
-					if(res.status == 200&&res.data.list&&res.data.list.length){
-						this.goodsList[index] = {
-							type: item,
-							list: res.data.list
-						}
-						this.goodsList.splice()
-					}
-				})
-			}
 		}
 	}
 </script>