guhongwei 2 years ago
parent
commit
0bbf910907
5 changed files with 114 additions and 135 deletions
  1. 2 1
      pages.json
  2. 0 40
      pages/home/index.vue
  3. 2 1
      pages/index/index.vue
  4. 106 89
      pagesHome/market/search.vue
  5. 4 4
      pagesRest/recom/index.vue

+ 2 - 1
pages.json

@@ -184,7 +184,8 @@
 				{
 					"path": "market/search",
 					"style": {
-						"navigationBarTitleText": "商品搜索"
+						"navigationBarTitleText": "商品搜索",
+						"enablePullDownRefresh": false
 					}
 				},
 				{

+ 0 - 40
pages/home/index.vue

@@ -369,46 +369,6 @@
 				}
 
 			}
-
-			// .recomList {
-			// 	display: flex;
-			// 	flex-direction: row;
-			// 	justify-content: space-around;
-			// 	width: 41vw;
-			// 	margin: 0 0 2vw 0;
-			// 	padding: 2vw;
-			// 	border-radius: 10px;
-			// 	background-image: linear-gradient(to bottom, rgba(250, 216, 213, 1) 5%, rgba(255, 255, 255, 1) 22%);
-
-			// 	.list {
-			// 		width: 20vw;
-			// 		text-align: center;
-
-			// 		.title {
-			// 			text-align: center;
-			// 			font-weight: bold;
-			// 			font-size: var(--font15Size);
-			// 			;
-			// 			margin: 0 0 1vw 0;
-			// 		}
-
-			// 		.image {
-			// 			width: 18vw;
-			// 			height: 20vw;
-			// 			margin: 0 0 1vw 0;
-			// 		}
-
-			// 		.name {
-			// 			width: 17vw;
-			// 			font-size: var(--font12Size);
-			// 			;
-			// 			border: 1px solid var(--fFB1Color);
-			// 			border-radius: 25px;
-			// 			padding: 0 1vw;
-			// 			text-align: center;
-			// 		}
-			// 	}
-			// }
 		}
 
 		.five {

+ 2 - 1
pages/index/index.vue

@@ -29,7 +29,7 @@
 				let res = await that.$api(`/config`, 'GET', {});
 				if (res.errcode == '0') {
 					let config = res.data;
-					that.$set(that, `logoUrl`, config.config.share[0].url)
+					that.$set(that, `logoUrl`, config.config.logo[0].url)
 					uni.setStorage({
 						key: 'config',
 						data: config,
@@ -54,6 +54,7 @@
 							success: function() {
 								uni.redirectTo({
 									// url: `/pagesRest/recom/index?act_tags=xpsj`
+									// url: `/pagesHome/market/search`
 									url: `/pages/home/index`
 								})
 							}

+ 106 - 89
pagesHome/market/search.vue

@@ -5,54 +5,52 @@
 				<input type="text" v-model="searchInfo.name" @blur="toInput" placeholder="搜索商品">
 			</view>
 			<view class="two">
-				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
 					<view class="list-scroll-view">
 						<view class="two_1">
-							<view :class="['list',condActive==index?'activeList':'']" v-for="(item,index) in condList"
-								:key="index" @tap="toCond(index,item)">
+							<view :class="['list',condActive==index?'activeList':'']" v-for="(item,index) in condList" :key="index" @tap="toCond(index,item)">
 								<view class="name">
 									{{item.name}}
 								</view>
 								<view class="icon">
 									<view class="icon_1">
-										<text :class="['iconfont',item.shangActive]"
-											v-if="condActive==index&&shang=='1'"></text>
+										<text :class="['iconfont',item.shangActive]" v-if="condActive==index&&shang=='1'"></text>
 										<text :class="['iconfont',item.shang]" v-else></text>
 									</view>
 									<view class="icon_1">
-										<text :class="['iconfont', item.xiaActive]"
-											v-if="condActive==index&&xia=='-1'"></text>
+										<text :class="['iconfont', item.xiaActive]" v-if="condActive==index&&xia=='-1'"></text>
 										<text :class="['iconfont', item.xia]" v-else></text>
 									</view>
 								</view>
 							</view>
 							<view class="screenList" v-if="pid">
-								<picker @change="screenChange" name="screen" :value="screen" :range="screenList"
-									range-key="label">
+								<picker @change="screenChange" name="screen" :value="screen" :range="screenList" range-key="label">
 									<view class="uni-input">{{screen_name||'筛选'}}</view>
 								</picker>
 							</view>
 						</view>
 						<view class="two_2">
-							<view class="list" v-for="(item,index) in list" :key="index" @tap="toBuy(item)">
-								<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
-								</image>
-								<view class="sale" v-if="item.is_sale==true">
-									<text>已售尽</text>
-								</view>
-								<view class="name">
-									{{item.name}}
-								</view>
-								<view class="other">
-									<view class="money">
-										<text>¥</text>
-										<text>{{item.sell_money}}</text>
+							<view class="pubu">
+								<view class="list" v-for="(item,index) in list" :key="index" @tap="toBuy(item)">
+									<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
+									</image>
+									<view class="sale" v-if="item.is_sale==true">
+										<text>已售尽</text>
 									</view>
-									<view class="other_1">
-										{{item.view_num||0}}人浏览
+									<view class="name">
+										{{item.name}}
 									</view>
-									<view class="btn" v-if="item.is_sale==false">
-										<text class="iconfont icon-gouwuche"></text>
+									<view class="other">
+										<view class="money">
+											<text>¥</text>
+											<text>{{item.sell_money}}</text>
+										</view>
+										<view class="other_1">
+											{{item.view_num||0}}人浏览
+										</view>
+										<view class="btn" v-if="item.is_sale==false">
+											<text class="iconfont icon-gouwuche"></text>
+										</view>
 									</view>
 								</view>
 							</view>
@@ -60,6 +58,9 @@
 					</view>
 				</scroll-view>
 			</view>
+			<view class="is_bottom" v-if="is_bottom">
+				<text>数据到底了!!</text>
+			</view>
 		</view>
 	</mobile-frame>
 </template>
@@ -109,7 +110,10 @@
 				// 筛选
 				screenList: [],
 				screen: '',
-				screen_name: ''
+				screen_name: '',
+				// 数据是否触底
+				is_bottom: false,
+				scrollTop: 0,
 			};
 		},
 		onLoad: async function(e) {
@@ -181,11 +185,17 @@
 					that.$set(that, `skip`, skip)
 					that.search();
 					uni.hideLoading();
-				} else uni.showToast({
-					title: '没有更多数据了'
-				});
 
+				} else that.$set(that, `is_bottom`, true)
 			},
+			toScroll(e) {
+				const that = this;
+				let up = that.scrollTop;
+				that.$set(that, `scrollTop`, e.detail.scrollTop);
+				let num = Math.sign(up - e.detail.scrollTop);
+				if (num == 1) that.$set(that, `is_bottom`, false);
+			},
+
 			// 输入框
 			toInput(e) {
 				const that = this;
@@ -312,85 +322,83 @@
 
 			.two_2 {
 				display: flex;
-				flex-direction: row;
-				flex-wrap: wrap;
-				padding: 2vw 2vw 0 2vw;
+				flex-direction: column;
+				padding: 2vw;
 				background-color: var(--f1Color);
 
-				.list {
-					position: relative;
-					width: 43vw;
-					margin: 0 2vw 2vw 0;
-					padding: 2vw;
-					border-radius: 9px;
-					background-color: var(--fffColor);
+				.pubu {
+					column-count: 2;
+					column-gap: 2vw;
 
-					.image {
+					.list {
+						position: relative;
+						background-color: var(--fffColor);
+						padding: 2vw;
+						margin: 0 0 2vw 0;
+						break-inside: avoid;
+						border-radius: 9px;
 
-						width: 100%;
-						height: 40vw;
-					}
+						.image {
 
-					.sale {
-						position: absolute;
-						top: 18vw;
-						text-align: center;
-						width: 43vw;
-
-						text {
-							background-color: #0000005f;
-							border-radius: 90px;
-							display: inline-block;
-							width: 15vw;
-							height: 15vw;
-							color: var(--fffColor);
+							width: 100%;
+							height: 40vw;
+						}
+
+						.sale {
+							position: absolute;
+							top: 18vw;
 							text-align: center;
-							line-height: 15vw;
+							width: 43vw;
+
+							text {
+								background-color: #0000005f;
+								border-radius: 90px;
+								display: inline-block;
+								width: 15vw;
+								height: 15vw;
+								color: var(--fffColor);
+								text-align: center;
+								line-height: 15vw;
+							}
 						}
-					}
 
-					.name {
-						font-size: var(--font16Size);
-						margin: 0 0 1vw 0;
-					}
+						.name {
+							font-size: var(--font16Size);
+							margin: 0 0 1vw 0;
+						}
 
-					.other {
-						display: flex;
-						flex-direction: row;
-						justify-content: space-between;
+						.other {
+							display: flex;
+							flex-direction: row;
+							justify-content: space-between;
 
-						.money {
-							font-size: var(--font14Size);
+							.money {
+								font-size: var(--font14Size);
 
-							text:nth-child(1) {
-								font-size: var(--font12Size);
+								text:nth-child(1) {
+									font-size: var(--font12Size);
+								}
 							}
-						}
 
-						.other_1 {
-							font-size: var(--font12Size);
-							color: var(--f85Color);
+							.other_1 {
+								font-size: var(--font12Size);
+								color: var(--f85Color);
 
-							text {
-								font-weight: bold;
-								padding: 0 2vw;
-								color: var(--ff0Color);
+								text {
+									font-weight: bold;
+									padding: 0 2vw;
+									color: var(--ff0Color);
+								}
 							}
-						}
 
-						.btn {
-							button {
-								font-size: var(--font20Size);
+							.btn {
+								button {
+									font-size: var(--font20Size);
+								}
 							}
 						}
 					}
 				}
-
-				.list:nth-child(2n) {
-					margin: 0 0 2vw 0;
-				}
-
-
 			}
 		}
 	}
@@ -407,4 +415,13 @@
 			flex-direction: column;
 		}
 	}
+
+	.is_bottom {
+		text-align: center;
+
+		text {
+			padding: 1vw 0;
+			display: inline-block;
+		}
+	}
 </style>

+ 4 - 4
pagesRest/recom/index.vue

@@ -90,16 +90,16 @@
 				let topUrl = [];
 				let res;
 				if (type == '1') {
-					res = await that.$api(`/goodsTags`, 'GET', {
+					res = await that.$api(`/goodsTags/getData`, 'GET', {
 						code: tags
 					})
 				} else if (type == '2') {
-					res = await that.$api(`/actTags`, 'GET', {
+					res = await that.$api(`/actTags/getData`, 'GET', {
 						value: act_tags
 					})
 				}
-				if (res.errcode == '0' && res.total > 0) {
-					let data = res.data[0];
+				if (res.errcode == '0') {
+					let data = res.data;
 					uni.setNavigationBarTitle({
 						title: data.label
 					});