guhongwei 2 anos atrás
pai
commit
f51f3d9c4c
2 arquivos alterados com 36 adições e 13 exclusões
  1. 0 1
      pages/home/index.vue
  2. 36 12
      pagesHome/market/search.vue

+ 0 - 1
pages/home/index.vue

@@ -105,7 +105,6 @@
 					limit: 20
 				});
 				if (res.errcode == '0') {
-					console.log(res);
 					that.$set(that, `marketList`, res.data)
 				}
 			},

+ 36 - 12
pagesHome/market/search.vue

@@ -14,11 +14,11 @@
 								</view>
 								<view class="icon">
 									<view class="icon_1">
-										<text :class="['iconfont',item.shangActive]" v-if="condActive==index&&shang==true"></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==true"></text>
+										<text :class="['iconfont', item.xiaActive]" v-if="condActive==index&&xia=='-1'"></text>
 										<text :class="['iconfont', item.xia]" v-else></text>
 									</view>
 								</view>
@@ -62,8 +62,8 @@
 				skip: 0,
 				limit: 5,
 				condActive: 0,
-				shang: false,
-				xia: false,
+				shang: '',
+				xia: '',
 				condList: [ // 筛选
 					{
 						name: '默认',
@@ -104,7 +104,8 @@
 					limit: that.limit
 				}
 				const res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
-					...info
+					...info,
+					...that.searchInfo
 				})
 				if (res.errcode == '0') {
 					let list = [...that.list, ...res.data];
@@ -140,19 +141,42 @@
 			// 输入框
 			toInput(e) {
 				const that = this;
-				that.$set(that.searchInfo, `name`, e.detail.value)
+				if (e.detail.value) that.$set(that.searchInfo, `name`, e.detail.value);
+				that.search();
 			},
 			// 筛选
 			toCond(index, e) {
 				const that = this;
+				let condActive = that.condActive;
 				that.$set(that, `condActive`, index);
-				if (that.xia == false) {
-					that.$set(that, `shang`, false);
-					that.$set(that, `xia`, true);
-				} else if (that.xia == true) {
-					that.$set(that, `shang`, true);
-					that.$set(that, `xia`, false);
+				if (condActive != index && that.xia == '') {
+					that.$set(that, `shang`, '0');
+					that.$set(that, `xia`, '-1');
+				} else if (condActive == index && that.xia == '-1') {
+					that.$set(that, `shang`, '1');
+					that.$set(that, `xia`, '0');
+				} else if (condActive == index && that.shang == '1') {
+					that.$set(that, `shang`, '0');
+					that.$set(that, `xia`, '-1');
+				} else if (condActive = index && that.shang == '1') {
+					that.$set(that, `shang`, '0');
+					that.$set(that, `xia`, '-1');
 				}
+				let key = '';
+				let value;
+				if (index != 0) {
+					value = that.shang == '0' ? that.xia : that.shang;
+				}
+				if (index == 1) {
+					key = 'sell_num';
+				} else if (index == 2) {
+					key = 'sell_money';
+				} else if (index == 3) {
+					key = 'view_num';
+				}
+				that.$set(that.searchInfo, `key`, key);
+				that.$set(that.searchInfo, `value`, value);
+				that.search();
 			}
 		}
 	}