Selaa lähdekoodia

1. 修复分页问题

MONSTER-ygh 1 vuosi sitten
vanhempi
commit
c7e5672bce

+ 1 - 1
components/customScrollList/customScrollList.vue

@@ -58,7 +58,7 @@ export default {
         return {
             defaultOption: {
                 page: 1, // 分页
-                size: 15, // 分页大小
+                size: 10, // 分页大小
                 auto: true, // 自动加载
                 height: null, // 组件高度
                 disabled: false, // 禁用

+ 2 - 2
pages.json

@@ -27,14 +27,14 @@
 		{
 			"path": "pages/cash/index",
 			"style": {
-				"navigationBarTitleText": "提现",
+				"navigationBarTitleText": "余额提现",
 				"navigationStyle": "custom"
 			}
 		},
 		{
 			"path": "pages/distributor/index",
 			"style": {
-				"navigationBarTitleText": "选择下级分销商",
+				"navigationBarTitleText": "提现",
 				"navigationStyle": "custom"
 			}
 		},

+ 23 - 8
pages/consume/index.vue

@@ -108,6 +108,7 @@
 				console.log('item', item);
 				if(this.serialType == item.key) return
 				this.serialType = item.key
+				this.marketPersonsSerialList = []
 				this.$refs.customScrollList.refresh()
 			},
 			/**
@@ -115,24 +116,32 @@
 			 */
 			async load(paging) {
 				try{
+					if(paging.page == 1) {
+						this.marketPersonsSerialList = []
+					}
 					this.$refs.customScrollList.showPullUp = true
 					let res = await this.$u.api.marketPersonsSerial({
 						noSign: 1,
 						userid: this.distribution_user_info.userId,
-						pageNum: 1,
-						pageSize: 10,
+						pageNum: paging.page,
+						pageSize: paging.size,
 						serialType: this.serialType
 					})
-					
 					if(res && res.code ===200) {
 						if(res.data.rows){
-							this.marketPersonsSerialList = this.marketPersonsSerialList.concat(res.data.rows)
+							let list = JSON.parse(JSON.stringify(this.marketPersonsSerialList))
+							res.data.rows.forEach(item=>{
+								list.push({
+									...item
+								})
+							})
+							this.marketPersonsSerialList = list
 						}else {
-							this.marketPersonsSerialList = []
+							
 						}
 						this.$refs.customScrollList.loadSuccess({
 							list: this.marketPersonsSerialList,
-							total: this.marketPersonsSerialList.length
+							total: res.data.total
 						})
 					} else {
 						this.$refs.customScrollList.loadSuccess({
@@ -169,14 +178,20 @@
 					})
 					if(res && res.code ===200) {
 						if(res.data.rows){
-							this.marketPersonsSerialList = [].concat(res.data.rows)
+							let list = []
+							res.data.rows.forEach(item=>{
+								list.push({
+									...item
+								})
+							})
+							this.marketPersonsSerialList = list
 						}else {
 							this.marketPersonsSerialList = []
 						}
 						// this.marketPersonsSerialList = null
 						this.$refs.customScrollList.refreshSuccess({
 							list: this.marketPersonsSerialList,
-							total: this.marketPersonsSerialList.length
+							total: res.data.total
 						})
 					} else {
 						this.$refs.customScrollList.refreshSuccess({

+ 25 - 15
pages/distributor/index.vue

@@ -25,6 +25,9 @@
 				@load="load"
 				@paging="paging"
 				@refresh="refresh"
+				:option="{
+					offsetBottom: 100,
+				}"
 				 >
 					<view v-if="dataList.length>0" style="width: 100%;padding: 10rpx 30rpx 0;box-sizing: border-box;" class="item-list">
 						<u-checkbox-group placement="column" @change="checkboxChange">
@@ -177,7 +180,7 @@
 		},
 		onShow() {
 			this.statusBarHeight = getApp().globalData.statusBarHeight
-			this.$refs.customScrollList.refresh()
+			//this.$refs.customScrollList.refresh()
 		},
 		watch:{
 			dataList(){
@@ -210,21 +213,26 @@
 			 * 获取数据
 			 */
 			async load(paging) {
+				console.log("paging====",paging)
 				try{
+					if(paging.page == 1){
+						this.dataList = []
+					}
 					this.$refs.customScrollList.showPullUp = true
 					let res = await this.$u.api.distributorList({
 						noSign: 1,
 						userid: this.distribution_user_info.userId,
-						pageNum: 1,
-						pageSize: 10,
+						pageNum: paging.page,
+						pageSize: paging.size,
 						status: this.serialType
 					})
 					
 					if(res && res.code ===200) {
 						if(res.data.rows){
-							this.dataList = res.data.rows.map(item => {
+							let list = JSON.parse(JSON.stringify(this.dataList))
+							res.data.rows.forEach(item => {
 								item.checked = false;
-								return {
+								list.push({
 									...item,
 									class: {
 									  0: 'status-0',
@@ -237,15 +245,16 @@
 									  7: 'status-7',
 									  8: 'status-8'
 									}[item.status] || ''
-								} 
+								})
 							})
-							this.totalPriceAll = res.data.realPrice
+							this.dataList = list
+							//this.totalPriceAll = res.data.realPrice
 						}else {
-							this.dataList = []
+							
 						}
 						this.$refs.customScrollList.loadSuccess({
 							list: this.dataList,
-							total: this.dataList.length
+							total: res.data.total
 						})
 					} else {
 						this.$refs.customScrollList.loadSuccess({
@@ -282,9 +291,10 @@
 					})
 					if(res && res.code ===200) {
 						if(res.data.rows){
-							this.dataList = [].concat(res.data.rows.map(item => {
+							let list = []
+							res.data.rows.forEach(item => {
 								item.checked = false;
-								return {
+								list.push({
 									...item,
 									class: {
 									  0: 'status-0',
@@ -297,15 +307,15 @@
 									  7: 'status-7',
 									  8: 'status-8'
 									}[item.status] || ''
-								} 
-							}))
+								})
+							})
+							this.dataList = list
 						}else {
-							this.dataList = []
 						}
 						// this.marketPersonsSerialList = null
 						this.$refs.customScrollList.refreshSuccess({
 							list: this.dataList,
-							total: this.dataList.length
+							total: res.data.total
 						})
 					} else {
 						this.$refs.customScrollList.refreshSuccess({