|
@@ -8,7 +8,7 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="commodity-list-wrapper" :style="{'overflow':'auto','height':(listData.length>4? windowHeight + 'px' : 'auto')}">
|
|
<view class="commodity-list-wrapper" :style="{'overflow':'auto','height':(listData.length>4? windowHeight + 'px' : 'auto')}">
|
|
- <scroll-view :style="{'height':(listData.length>4? scrollHeight+'px' : 'auto')}" @scrolltolower="scrolltolower" scroll-y v-if="!showEmpty">
|
|
|
|
|
|
+ <scroll-view :style="{'height':scrollHeight+'px'}" @scrolltolower="scrolltolower" scroll-y v-if="listData.length > 0">
|
|
<view class="Listitem" v-for="(item, index) in listData" :key="index" :class="item.sold==1?'activeImg':''"
|
|
<view class="Listitem" v-for="(item, index) in listData" :key="index" :class="item.sold==1?'activeImg':''"
|
|
:productid="item.productID" @click.stop="navToDetailPage(item.productID)">
|
|
:productid="item.productID" @click.stop="navToDetailPage(item.productID)">
|
|
<view class="itemImg onhref" >
|
|
<view class="itemImg onhref" >
|
|
@@ -95,10 +95,11 @@
|
|
secondHandType:1,
|
|
secondHandType:1,
|
|
instrumentType:0,
|
|
instrumentType:0,
|
|
name:'',
|
|
name:'',
|
|
- total:0
|
|
|
|
|
|
+ total:0,
|
|
|
|
+ hasNextPage:false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- onLoad(option) {
|
|
|
|
|
|
+ created() {
|
|
this.getListFromServer()
|
|
this.getListFromServer()
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -112,11 +113,6 @@
|
|
this.getListFromServer()
|
|
this.getListFromServer()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- scrolltolower() {
|
|
|
|
- if(this.total>this.listData.length && this.pullFlag) {
|
|
|
|
- this.getListFromServer(true);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
getListFromServer(loadMore) {
|
|
getListFromServer(loadMore) {
|
|
this.showLoading = true;
|
|
this.showLoading = true;
|
|
this.loadingNow = true;
|
|
this.loadingNow = true;
|
|
@@ -138,6 +134,7 @@
|
|
const resList = resData.results;
|
|
const resList = resData.results;
|
|
if(resList && resList.length > 0){
|
|
if(resList && resList.length > 0){
|
|
this.total = resData.totalRecord;
|
|
this.total = resData.totalRecord;
|
|
|
|
+ this.hasNextPage = resData.hasNextPage;
|
|
this.showEmpty = false;
|
|
this.showEmpty = false;
|
|
if(loadMore) {
|
|
if(loadMore) {
|
|
this.listData = [...this.listData,...resList];
|
|
this.listData = [...this.listData,...resList];
|
|
@@ -148,7 +145,7 @@
|
|
this.pullFlag = false;
|
|
this.pullFlag = false;
|
|
setTimeout(()=>{ this.pullFlag = true; },500)
|
|
setTimeout(()=>{ this.pullFlag = true; },500)
|
|
// 底部提示文案
|
|
// 底部提示文案
|
|
- if(this.totalPage>this.listData.length) {
|
|
|
|
|
|
+ if(hasNextPage) {
|
|
this.loadingText = '上拉加载更多';
|
|
this.loadingText = '上拉加载更多';
|
|
} else {
|
|
} else {
|
|
this.showLoading = true;
|
|
this.showLoading = true;
|
|
@@ -163,6 +160,11 @@
|
|
this.$util.msg(error.msg,2000);
|
|
this.$util.msg(error.msg,2000);
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ scrolltolower() {
|
|
|
|
+ if(this.hasNextPage && this.pullFlag) {
|
|
|
|
+ this.getListFromServer(true);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
onShowClose () {//输入框失去焦点时触发
|
|
onShowClose () {//输入框失去焦点时触发
|
|
if(this.name != ''){
|
|
if(this.name != ''){
|
|
this.isShowClose = true;
|
|
this.isShowClose = true;
|
|
@@ -173,6 +175,14 @@
|
|
onFocus () { //输入框获取焦点时触发
|
|
onFocus () { //输入框获取焦点时触发
|
|
this.inputEmpty(this.searchInputVal)
|
|
this.inputEmpty(this.searchInputVal)
|
|
},
|
|
},
|
|
|
|
+ inputEmpty(val){
|
|
|
|
+ this.isShowWrapper = false
|
|
|
|
+ if(val != ''){
|
|
|
|
+ this.isShowClose = true
|
|
|
|
+ }else{
|
|
|
|
+ this.isShowClose = false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
delInputText () { //清除输入框内容
|
|
delInputText () { //清除输入框内容
|
|
this.name = ''
|
|
this.name = ''
|
|
this.isShowClose = false
|
|
this.isShowClose = false
|