feat 对接搜索推荐
This commit is contained in:
parent
c353a9d2ce
commit
da8468fe23
@ -1,6 +1,9 @@
|
||||
import {
|
||||
getHistorySearchList
|
||||
} from '~/services/home/getHistorySearchList';
|
||||
import {
|
||||
getSearchRecList
|
||||
} from '~/services/home/getSearchRecList';
|
||||
import {
|
||||
getHotSearchList
|
||||
} from '~/services/home/getHotSearchList';
|
||||
@ -49,7 +52,7 @@ Page({
|
||||
|
||||
async queryPopular() {
|
||||
try {
|
||||
getHotSearchList().then((res) => {
|
||||
getSearchRecList().then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.setData({
|
||||
popularWords: res.data,
|
||||
@ -142,6 +145,20 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 点击搜索推荐
|
||||
handleRecTap(e) {
|
||||
const {
|
||||
dataset
|
||||
} = e.currentTarget;
|
||||
const _searchValue = dataset?.value;
|
||||
if (_searchValue) {
|
||||
wx.navigateTo({
|
||||
url: `/pages/goods/result/index?searchValue=${_searchValue}`,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// TODO:提交搜索
|
||||
handleSubmit(e) {
|
||||
const {
|
||||
|
@ -17,6 +17,19 @@
|
||||
暂无数据
|
||||
</view>
|
||||
</view>
|
||||
<view class="popular-wrap">
|
||||
<view class="search-header">
|
||||
<text class="search-title">搜索推荐</text>
|
||||
</view>
|
||||
<view class="search-content" wx:if="{{popularWords.length > 0}}">
|
||||
<view class="search-item" hover-class="hover-history-item" wx:for="{{popularWords}}" data-value="{{item.title}}" bind:tap="handleRecTap" data-index="{{index}}" wx:key="*this">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else class="search-item">
|
||||
暂无数据
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="popular-wrap">
|
||||
<view class="search-header">
|
||||
<text class="search-title">热门搜索</text>
|
||||
|
@ -461,10 +461,8 @@ Page({
|
||||
return;
|
||||
}
|
||||
// this.payLock = true;
|
||||
console.log(submitCouponList);
|
||||
// const resSubmitCouponList = this.handleCouponList(submitCouponList);
|
||||
const openId = wx.getStorageSync('openId')
|
||||
console.log(openId, '我的openId');
|
||||
const params = {
|
||||
userAddressReq: settleDetailData.userAddress || userAddressReq,
|
||||
goodsRequestList: goodsRequestList,
|
||||
|
19
services/home/getSearchRecList.js
Normal file
19
services/home/getSearchRecList.js
Normal file
@ -0,0 +1,19 @@
|
||||
import {
|
||||
request
|
||||
} from '../_utils/request';
|
||||
|
||||
/** 获取搜索推荐列表 */
|
||||
export function getSearchRecList() {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: `SearchRecommendApi/getSearchRecommendList`,
|
||||
method: 'GET',
|
||||
success: function (res) {
|
||||
resolve(res);
|
||||
},
|
||||
fail: function (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user