| | |
| | | <u-search placeholder="请输入商品名称搜索" height="36" searchIconColor="#999999" borderColor="#EEEEEE" |
| | | bgColor="#F9F9FB" :showAction="false" v-model="goodsName" @search="search" /> |
| | | </view> |
| | | <view class="history"> |
| | | <view class="history" v-if="historyList && historyList.length > 0"> |
| | | <view class="history-title">历史搜索</view> |
| | | <view class="history-list"> |
| | | <view class="history-list-item">支重轮</view> |
| | | <view class="history-list-item" v-for="(item, index) in historyList" :key="index">{{item.content}}</view> |
| | | </view> |
| | | </view> |
| | | <template v-if="isSearch"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapState } from 'vuex' |
| | | export default { |
| | | computed: { |
| | | ...mapState(['userInfo']) |
| | | }, |
| | | data() { |
| | | return { |
| | | goodsName: '', |
| | | goodsList: [], |
| | | page: 1, |
| | | next: true, |
| | | isSearch: false |
| | | isSearch: false, |
| | | historyList: [] |
| | | }; |
| | | }, |
| | | onLoad() { |
| | | this.gethistary() |
| | | }, |
| | | onReachBottom() { |
| | | this.getGoodsList() |
| | | }, |
| | | methods: { |
| | | 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 |
| | | } |
| | | }) |
| | | }, |
| | | search() { |
| | | if (!this.isSearch) { |
| | | this.isSearch = true |