Browse Source

搜索更新

zhuxiuping 2 years ago
parent
commit
5bbffc2943

+ 2 - 1
packageShang/pages/goods/goods-list.vue

@@ -136,6 +136,7 @@
 			this.loadData();
 		},
 		onLoad(options) {
+			console.log(options,decodeURIComponent(options.keyword),'pop')
 			this.getNowDate()
 			var userId=options.userId || ''
 			var searchCnt=options.searchCnt || 1
@@ -267,7 +268,7 @@
 					//根据类别
 					var data='?categoryId='+_self.leiId+'&state=1&categoryLevel='+_self.leiLevel
 						+'&curPage='+_self.reqdata.page+'&pageSize='+_self.reqdata.rows
-						+'&orderField='+_self.reqdata.sidx+'&order='+_self.reqdata.sord
+						+'&orderField='+_self.reqdata.sidx+'&order='+_self.reqdata.sord+'&goodsName='+_self.keyword
 					goodslistlimit(data).then((res) => {
 						if (res.success) {
 							if (res.data) {

+ 20 - 18
packageShang/pages/home/search/search.vue

@@ -124,7 +124,6 @@
 
 			shuru(event){
 				this.keyword=event.detail.value
-				console.log(this.keyword,'res')
 			},
 			// 搜索
 			search(type, item) {
@@ -134,29 +133,32 @@
 						uni.setStorageSync('historyKeyword', this.historyDatas.toString());
 						this.$api.togoodslist({
 							keyword: item,
-							userId:userId,
-							searchCnt:searchCnt,
-							createBy:createBy,
-							createTime:createTime,
+							// userId:userId,
+							// searchCnt:searchCnt,
+							// createBy:createBy,
+							// createTime:createTime,
 						});
 						break;
 					case 'hot':
+					this.removeRepeat(item.keyword);
+					uni.setStorageSync('historyKeyword', this.historyDatas.toString());
 						this.keyword=item.keyword
-						for( var i=0;i<this.historyDatas.length;i++){
-							if(item.keyword=this.historyDatas[i].keyword){
-								var id=this.historyDatas[i].id
-								var userId=this.historyDatas[i].userId
-								var searchCnt=parseInt(this.historyDatas[i].searchCnt)+1
-								var createBy=this.historyDatas[i].createBy
-								var createTime=this.historyDatas[i].createTime
-							}
-						}
+						// for( var i=0;i<this.historyDatas.length;i++){
+						// 	if(item.keyword=this.historyDatas[i].keyword){
+						// 		var id=this.historyDatas[i].id
+						// 		var userId=this.historyDatas[i].userId
+						// 		var searchCnt=parseInt(this.historyDatas[i].searchCnt)+1
+						// 		var createBy=this.historyDatas[i].createBy
+						// 		var createTime=this.historyDatas[i].createTime
+						// 	}
+						// }
+						console.log()
 						this.$api.togoodslist({
 							keyword: item.keyword,
-							userId:userId,
-							searchCnt:searchCnt,
-							createBy:createBy,
-							createTime:createTime,
+							// userId:userId,
+							// searchCnt:searchCnt,
+							// createBy:createBy,
+							// createTime:createTime,
 						});
 						break;
 					default:

+ 1 - 1
packageShang/utils/api_goods.js

@@ -45,7 +45,7 @@ export const cartadd = (data) => {
 // 商品评价
 export const pingjia = (data) => {
     return request({
-        url: '/goodsComment/open/list',
+        url: '/goodsComment/open/list'+data,
         method: 'get',
 		header:{
 			"Mall-Token": uni.getStorageSync('tokenId')