Przeglądaj źródła

Merge branch 'develop' of http://git.chelingzhu.com/chelingzhu-web/zxyj-mini-html into develop

1004749546@qq.com 4 lat temu
rodzic
commit
a3a8987ef2

+ 8 - 1
components/uni-coods/uni-coods.vue

@@ -3,7 +3,14 @@
 		<view class="goods-item" v-for="item in list" :key="item.id">
 			<view class="goods-imgs"  @click="toDetail(item)">
 				<view v-if="item.inventoryQty == 0" class="goods-staus">已售罄</view>
-				<u-lazy-load img-mode="scaleToFill" :height="imgHeight" :image="item.homeImage" :loading-img="loadingImg" :error-img="errorImg"></u-lazy-load>
+				<view v-if="item.delFlage == 0 || item.state == 0" class="goods-staus">已失效</view>
+				<u-lazy-load 
+				img-mode="scaleToFill" 
+				:height="imgHeight" 
+				:image="item.homeImage+'?x-oss-process=image/resize,m_pad,h_252,w_325,color_ffffff'" 
+				:loading-img="loadingImg" 
+				:error-img="errorImg">
+				</u-lazy-load>
 			</view>
 			<view class="name ellipsis-two"  @click="toDetail(item)">{{item.name}}</view>
 			<view class="price">

+ 3 - 3
pages.json

@@ -19,8 +19,8 @@
 		{
 			"path": "pages/goods/index", // 商城
 			"style": {
-				"navigationBarTitleText": "乐色管家",
-				"enablePullDownRefresh": false
+				"navigationBarTitleText": "乐色商城",
+				"enablePullDownRefresh": true
 			}
 		},
 		{
@@ -150,7 +150,7 @@
             "style" :                                                                                    
             {
                 "navigationBarTitleText": "商品",
-                "enablePullDownRefresh": false
+                "enablePullDownRefresh": true
             }
             
         },

+ 14 - 1
pages/goods/goods.vue

@@ -19,6 +19,7 @@
 			return {
 				clsId: '',
 				goldLimit:0,
+				goodsName: '',
 				pageNo: 1,
 				pageSize: 10,
 				goodsList:[],
@@ -27,11 +28,23 @@
 			};
 		},
 		onLoad(opts) {
-			console.log(opts)
+			this.goodsName = opts.name
 			this.clsId = opts.goodsTypeNo
 			this.goldLimit = opts.goldLimit
+			uni.setNavigationBarTitle({
+				title: this.goodsName
+			})
 			this.getGoods()
 		},
+		// 下拉刷新
+		onPullDownRefresh() {
+			console.log('refresh')
+			this.pageNo = 1
+			this.getGoods()
+			setTimeout(function () {
+				uni.stopPullDownRefresh()
+			}, 200)
+		},
 		methods: {
 			// 查询商品
 			getGoods(item,index){

+ 1 - 1
pages/goods/goodsDetail.vue

@@ -4,7 +4,7 @@
 			<!-- 商品信息 -->
 			<view class="goods-head">
 				<view class="goods-imgs">
-					<view class="goods-staus" v-if="goodContent.inventoryQty == 0"></view>
+					<view class="goods-staus" v-if="goodContent.inventoryQty == 0 || goodContent.delFlage == 0 || goodContent.state == 0"></view>
 					<u-swiper height="340" :border-radius="15" mode="number" indicator-pos="bottomRight" :list="imageList"></u-swiper>
 				</view>
 				<view class="goods-name">

+ 30 - 19
pages/goods/index.vue

@@ -6,7 +6,7 @@
 		</view>
 		<!-- 商品 -->
 		<view class="goods">
-			<view v-for="(item,index) in goodsList" :key="item.type.id" v-if="goodsList.length&&item.list.length">
+			<view v-for="(item,index) in goodsList" :key="index" v-if="goodsList.length&&item.list.length">
 				<u-section :title="item.type.name" font-size="35" line-color="#01c9b2" sub-title="更多" @click="toGoods(item.type)"></u-section>
 				<view class="goods-list">
 					<uni-coods :list="item.list"></uni-coods>
@@ -38,23 +38,34 @@
 				goodsType:[], // 商品分类
 			}
 		},
-		onShow() {
-			this.getbannerList()
-			this.goodsList = []
-			getGoodsClass({}).then(res => {
-				console.log(res)
-				if(res.status == 200){
-					this.goodsType = res.data
-					this.goodsType.map((item,index) => {
-						this.getGoods(item,index)
-					})
-				}else{
-					this.goodsList = []
-					this.noDataText = '暂无商品'
-				}
-			})
+		onLoad() {
+			this.pageInit()
+		},
+		// 下拉刷新
+		onPullDownRefresh() {
+			console.log('refresh')
+			this.pageInit()
+			setTimeout(function () {
+				uni.stopPullDownRefresh()
+			}, 200)
 		},
 		methods: { 
+			pageInit(){
+				this.getbannerList()
+				this.goodsList = []
+				getGoodsClass({}).then(res => {
+					console.log(res)
+					if(res.status == 200){
+						this.goodsType = res.data
+						this.goodsType.map((item,index) => {
+							this.getGoods(item,index)
+						})
+					}else{
+						this.goodsList = []
+						this.noDataText = '暂无商品'
+					}
+				})
+			},
 			// 点击banner
 			clickBanner(index){
 				let row = this.imageTopList[index]
@@ -83,7 +94,7 @@
 			// 更多商品
 			toGoods(item){
 				uni.navigateTo({
-					url:"/pages/goods/goods?goodsTypeNo="+ item.goodsTypeNo + "&goldLimit="+ item.goldLimit
+					url:"/pages/goods/goods?goodsTypeNo="+ item.goodsTypeNo + "&goldLimit="+ item.goldLimit + "&name=" + item.name
 				})
 			},
 			// 查询商品
@@ -91,10 +102,10 @@
 				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.push({
+						this.goodsList[index] = {
 							type: item,
 							list: res.data.list
-						})
+						}
 						this.goodsList.splice()
 					}
 				})

+ 5 - 0
pages/index/index.vue

@@ -197,6 +197,10 @@
 			},
 			// 添加购物车
 			addGoodToCart(item){
+				uni.showLoading({
+					mask: true,
+					title: "加入购物车中..."
+				})
 				addGoodsToCart(item).then(res => {
 					if(res.status == 200){
 						uni.showToast({
@@ -206,6 +210,7 @@
 						// 刷新购物车
 						this.getCartList()
 					}
+					uni.hideLoading()
 				})
 			},
 			// 删除购物车