Browse Source

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

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

38
pages/point/exchangeRecord/exchangeRecord.vue

@ -2,7 +2,7 @@
<view> <view>
<lf-nav title="兑换记录" :showIcon="true" bgColor="#fff"></lf-nav> <lf-nav title="兑换记录" :showIcon="true" bgColor="#fff"></lf-nav>
<view class="head"> <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> </view>
<scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" <scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher"
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh" > @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh" >
@ -53,12 +53,13 @@
scrollH: 0, scrollH: 0,
nav_height: 0, nav_height: 0,
isRefresher: true, isRefresher: true,
pageSize: 10
pageSize: 10,
is_search: false //
} }
}, },
computed: { computed: {
autoHeight(){ autoHeight(){
return `calc(${this.scrollH}px - ${this.nav_height}px - 180rpx)`;
return `calc(${this.scrollH}px - ${this.nav_height}px - 180rpx - 120rpx)`;
} }
}, },
onLoad(){ onLoad(){
@ -88,18 +89,41 @@
this.isRefresher = true; this.isRefresher = true;
this.refreshFn({type: 'scrollRefresh'}); this.refreshFn({type: 'scrollRefresh'});
}, },
customClick(event){
//
onSearch(event){
console.log(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 = {}){ getPointOrder(options = {}){
let par = {
page: this.page
}
if(this.is_search && this.value){
par.keyword = this.value;
}
this.$http.get({ this.$http.get({
api: 'api/order/point/list', api: 'api/order/point/list',
header: { header: {
Authorization: this.$cookieStorage.get('user_token') Authorization: this.$cookieStorage.get('user_token')
}, },
data: {
page: this.page
}
data: par
}).then(res => { }).then(res => {
console.log("----", res); console.log("----", res);
let isPage = this.page < res.data.meta.pagination.total_pages?true:false; let isPage = this.page < res.data.meta.pagination.total_pages?true:false;

Loading…
Cancel
Save