| | |
| | | <view class="history" v-if="historyList && historyList.length > 0"> |
| | | <view class="history-title">历史搜索</view> |
| | | <view class="history-list"> |
| | | <view class="history-list-item" v-for="(item, index) in historyList" :key="index">{{item.content}}</view> |
| | | <view class="history-list-item" v-for="(item, index) in historyList" :key="index" @click="seleContent(item.content)">{{item.content}}</view> |
| | | </view> |
| | | </view> |
| | | <template v-if="isSearch"> |
| | |
| | | page: 1, |
| | | next: true, |
| | | isSearch: false, |
| | | historyList: [] |
| | | historyList: [], |
| | | categoryId: null, |
| | | applicableBrandId: null |
| | | }; |
| | | }, |
| | | onLoad() { |
| | | onLoad(option) { |
| | | if (option.categoryId) { |
| | | this.categoryId = option.categoryId |
| | | this.isSearch = true |
| | | this.getGoodsList() |
| | | } |
| | | if (option.applicableBrandId) { |
| | | this.applicableBrandId = option.applicableBrandId |
| | | this.isSearch = true |
| | | this.getGoodsList() |
| | | } |
| | | this.gethistary() |
| | | }, |
| | | onReachBottom() { |
| | | this.getGoodsList() |
| | | }, |
| | | methods: { |
| | | seleContent(val) { |
| | | this.goodsName = val |
| | | this.search() |
| | | }, |
| | | gethistary() { |
| | | if (!this.userInfo) return |
| | | this.$u.api.searchHistoryList({ |
| | | memberId: this.userInfo.id |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | console.log(res) |
| | | this.historyList = res.data |
| | | } |
| | | }) |
| | |
| | | model: { |
| | | type: 0, |
| | | sortInfo: 3, |
| | | goodsName: this.goodsName |
| | | goodsName: this.goodsName, |
| | | memberId: this.userInfo.id, |
| | | categoryId: this.categoryId, |
| | | applicableBrandId: this.applicableBrandId |
| | | } |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.gethistary() |
| | | res.data.records.forEach(item => { |
| | | item.minPrice = item.minPrice.toFixed(2).split('.') |
| | | }) |
| | |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | page { |
| | | background-color: #F9F9FB; |
| | | } |
| | | </style> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | width: 100%; |
| | |
| | | margin-right: 24rpx; |
| | | margin-bottom: 24rpx; |
| | | &:last-child { |
| | | margin: 0 !important; |
| | | margin-right: 0 !important; |
| | | } |
| | | } |
| | | } |