diff --git a/src/views/secondHandCar/indexList.vue b/src/views/secondHandCar/indexList.vue index 7869d4c1..613329a6 100644 --- a/src/views/secondHandCar/indexList.vue +++ b/src/views/secondHandCar/indexList.vue @@ -11,10 +11,10 @@
- - - - + + + +
@@ -62,34 +62,41 @@
-
+
-
-
-
- -
{{item.vehicleType?.substring(0,2)}}
-
-
-
{{item.vehicleType}}
-
{{ item.boardType?.label }} | {{ item.licenseType?.label }} | - {{ item.brandModel?.match(/^[\u4e00-\u9fa5]+/)?.[0]?.replace(/牌$/, '') }} | {{ item.mileage }}km | {{item.emissionStandard?.label}}
-
{{ item.boardType?.label }} | - {{item.vehicleType }} | {{item.emissionStandard?.label}}
-
注册日期: {{item.registerDate?.substring(0,10)}}
-
{{formatNumber(item.maxPrice) }}
-
- {{formatNumber(item.minPrice) }} - ~ - {{formatNumber(item.maxPrice) }} + +
+
+
+ +
{{item.vehicleType?.substring(0,2)}}
+
+
+
{{item.vehicleType}}
+
{{ item.boardType?.label }} | {{ item.licenseType?.label }} | + {{ item.brandModel?.match(/^[\u4e00-\u9fa5]+/)?.[0]?.replace(/牌$/, '') }} | {{ item.mileage }}km | {{item.emissionStandard?.label}}
+
{{ item.boardType?.label }} | + {{item.vehicleType }} | {{item.emissionStandard?.label}}
+
注册日期: {{item.registerDate?.substring(0,10)}}
+
{{formatNumber(item.maxPrice) }}
+
+ {{formatNumber(item.minPrice) }} + ~ + {{formatNumber(item.maxPrice) }} +
+
-
-
+
-
+
@@ -113,8 +120,6 @@ import {myMixins} from "@/utils/myMixins" import {appPageList,userFeedback } from "@/api/secondHandCar" export default { name: "indexList", - computed: { - }, mixins:[myMixins], watch:{ activeTab(){ @@ -147,8 +152,12 @@ export default { pageList:[], topSearch:'', activeTab:0, - showEmpty:false, - isLoading:false, + isLoading:"", + loading: false, + finished: false, + pageNum:1, + pageSize:10, + total:'', licenseType:'', vehicleType:'', priceSort:'', @@ -185,7 +194,23 @@ export default { } }); }, + methods:{ + async tabClick(type){ + this.activeTab=type + this.pageNum = 1 + this.pageList = []; + this.total=0 + await this.getList() + }, + async onLoad(){ + this.pageNum++; + await this.getList() + this.loading = false; + if (this.pageList.length >= this.total) { + this.finished = true; + } + }, changePrice(){ if(!this.priceSort){ this.priceSort=1 @@ -256,14 +281,17 @@ export default { this.$toast('反馈建议提交成功') }, onRefresh() { - this.getList() + this.pageNum=1 setTimeout(() => { this.$toast('刷新成功'); this.isLoading = false; }, 1000); }, + async getList(){ let res= await appPageList({ + pageNum:this.pageNum, + pageSize:this.pageSize, type:this.activeTab==0 ? 1 : 2, topSearch:this.topSearch, licenseType:this.licenseType, @@ -271,13 +299,14 @@ export default { priceSort:this.priceSort, boardType:this.boardType, emissionStandard:this.emissionStandard, - // brandModel:this.brandModel, }) - this.pageList=res.data - if(this.pageList?.length === 0){ - this.showEmpty = true - }else { - this.showEmpty = false + this.total=res.total + if(this.pageNum == 1){// 第一页直接赋值 + this.pageList=res.data + }else{// 第二页数据拼接 + let preList = this.pageList; + let arr = res.data; + this.pageList = preList.concat(arr) } }, goApp(){ @@ -290,7 +319,12 @@ export default { window.android.sendMessage("goBack"); } }, - } + }, + computed:{ + show() { + return (this.pageList.length < 0 || this.pageList.length == 0); // 判断数组长度是否大于 0 + }, + }, }