zhaoyun há 14 horas atrás
pai
commit
b0f7e91bc6
2 ficheiros alterados com 23 adições e 14 exclusões
  1. 2 8
      mer_uniapp/pages/index/index.vue
  2. 21 6
      mer_uniapp/pages/takeout/index.vue

+ 2 - 8
mer_uniapp/pages/index/index.vue

@@ -81,23 +81,18 @@
 
 
 			<!-- 活动精选 -->
-			<view class="content-goods">
+			<view class="content-goods" v-if="proList.length">
 				<view>
 					<image src="/static/img/img-hdjx.png" style="width: 298rpx;height: 44rpx;"></image>
-
 					<text class="goods-more" @tap="goGenDuo">更多 》</text>
 				</view>
-
-
 				<view style="display: flex;">
-
 					<view class="goods-list" v-for="item in proList" :key="item.id">
 						<view style="display: flex;" @click="goGoodList(item)">
 							<view style="margin-right: 20rpx;">
 								<image :src="item.image" style="width: 134rpx;height: 134rpx;border-radius: 12rpx;">
 								</image>
 							</view>
-
 							<view>
 								<view class="goods-title">{{item.name}}</view>
 								<view class="goods-desc">{{item.intro}}</view>
@@ -109,7 +104,6 @@
 							</view>
 						</view>
 					</view>
-
 				</view>
 			</view>
 
@@ -274,7 +268,7 @@
 					this.cateList = res.data.navigatList;
 					this.cateId = res.data.cateId
 					this.cateList.push({
-						id: 999,
+						id: 999999,
 						name: '今日吃啥',
 						imageUrl: '/static/img/ic-random.png',
 						color: '#FF9805',

+ 21 - 6
mer_uniapp/pages/takeout/index.vue

@@ -25,7 +25,7 @@
 						<view class="flex-between-center" style="padding-right: 53rpx;">
 							<text class="mer-tj">今日推荐</text>
 							<text class="goods-score">{{recommendObj.score}}</text>
-							<text class="goods-info">销量{{recommendObj.salesVolume}}</text>
+							<text class="goods-info">销量{{recommendObj.salesVolume}}</text>
 							<text v-if="!recommendObj.isfreeDeliverfee" class="goods-info" style="color: #E5AD21;margin-left: 18rpx;">免配送费</text>
 							<view v-if="!recommendObj.isfreeDeliverfee && recommendObj.freeDeliverFee > 0" style="color: #999999;font-size: 21rpx;margin-left: 10rpx;text-decoration: line-through;">¥
 								{{recommendObj.freeDeliverFee}}</view>
@@ -184,13 +184,25 @@
 					that.winHeight = res.windowHeight
 				},
 			});
+			const allData = {
+				name : '全部',
+				id : 0,
+				icon :  '/static/img/quanbu.png',
+			}; 
 			getProduct(that.takeoutId).then(res => {
 				const data = res.data;
 				// data[0].id = 0;
-				data[0].name = '全部';
-				data[0].icon = '/static/img/quanbu.png';
-				that.optionIndex = data[0].id;
-				that.optionData = data || []
+				// data[0].name = '全部';
+				// data[0].icon = '/static/img/quanbu.png';
+				// that.optionIndex = data[0].id;
+				// that.optionData = data || []  
+				if (data.length !== 0) {
+					that.optionIndex =0; 
+					that.optionData.push(allData)
+					data.forEach(function(item) {
+					  that.optionData.push(item);
+					}); 
+				} 
 				that.page = 1;
 				that.getMatchedData()
 				console.log(that.optionData, '12312321321312321321312312')
@@ -218,7 +230,7 @@
 					latitude: uni.getStorageSync('user_latitude'),
 					longitude: uni.getStorageSync('user_longitude'),
 					productType: this.takeoutId,
-					// typeIds: this.optionIndex==0?"":this.optionIndex,
+					typeIds: this.optionIndex==0?"":this.optionIndex,
 					page: this.page,
 					limit: 10
 				}).then(res => {
@@ -263,7 +275,10 @@
 			// },
 			onOptionClick(item) {
 				if (this.optionIndex === item.id) return
+				this.page = 1;
+				this.merchantList = [];
 				this.optionIndex = item.id;
+				//this.optionIndex = item.id;
 				this.getMatchedData()
 			},
 			merchantTab(item) {