Browse Source

完成积分商城订单列表搜索功能

master
邓平艺 4 years ago
parent
commit
014cef1b5c
  1. 40
      pages/point/exchangeRecord/exchangeRecord.vue

40
pages/point/exchangeRecord/exchangeRecord.vue

@ -2,10 +2,10 @@
<view>
<lf-nav title="兑换记录" :showIcon="true" bgColor="#fff"></lf-nav>
<view class="head">
<u-search placeholder="搜你想要的" v-model="value" @custom="customClick"></u-search>
<u-search placeholder="搜你想要的" v-model="value" @custom="onSearch" @search="onSearch" @clear="clearSearch"></u-search>
</view>
<scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher"
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh" >
<view class="content">
<view class="card" v-for="(item, index) in list" :key="index" @click="$url('/pages/order/newdetail/newdetail?type=point&order_id='+item.order_no)">
<view>
@ -53,12 +53,13 @@
scrollH: 0,
nav_height: 0,
isRefresher: true,
pageSize: 10
pageSize: 10,
is_search: false //
}
},
computed: {
autoHeight(){
return `calc(${this.scrollH}px - ${this.nav_height}px - 180rpx)`;
return `calc(${this.scrollH}px - ${this.nav_height}px - 180rpx - 120rpx)`;
}
},
onLoad(){
@ -88,18 +89,41 @@
this.isRefresher = true;
this.refreshFn({type: 'scrollRefresh'});
},
customClick(event){
//
onSearch(event){
console.log(event)
if(event){
this.is_search = true;
}else{
this.is_search = false;
}
this.page = 1;
this.isPage = true;
this.loadingClass = true;
this.list = []
this.loadingText = '正在加载中';
this.getPointOrder();
},
//
clearSearch(){
if(this.is_search){
this.onSearch(false);
}
},
getPointOrder(options = {}){
let par = {
page: this.page
}
if(this.is_search && this.value){
par.keyword = this.value;
}
this.$http.get({
api: 'api/order/point/list',
header: {
Authorization: this.$cookieStorage.get('user_token')
},
data: {
page: this.page
}
data: par
}).then(res => {
console.log("----", res);
let isPage = this.page < res.data.meta.pagination.total_pages?true:false;

Loading…
Cancel
Save