wkyy 3 年之前
父節點
當前提交
ce8d8ed519
共有 3 個文件被更改,包括 76 次插入17 次删除
  1. 25 5
      pages/record/index.vue
  2. 27 8
      pages/user/coupon/myCoupon.vue
  3. 24 4
      pages/user/finance/rechargeList.vue

+ 25 - 5
pages/record/index.vue

@@ -53,7 +53,9 @@
 				month: '',
 				startDate: '',
 				endDate: '',
-				chargeList: []
+				chargeList: [],
+				pageIndex: 1,
+				recordsTotal: 0,
 			}
 		},
 		onReady() {
@@ -72,7 +74,16 @@
 					
 			this.getChargeList();
 		},
+		onReachBottom() {
+			if (this.chargeList.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
 		methods: {
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getChargeList()
+			},
 			textColor(item) {
 				switch (item.status) {
 					case '1':
@@ -96,24 +107,33 @@
 				this.startDate = params.year + '-' + params.month + '-' + '01';
 				var day = new Date(params.year, params.month, 0).getDate();
 				this.endDate = params.year + '-' + params.month + '-' + day;
-				this.getChargeList();
+				this.getChargeList(true);
 				this.show = false;
 			},
 			cancelTime() {
 				this.show = false;
 			},
-			getChargeList() {
+			getChargeList(bl) {
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
-				})		
+				})
+				if (bl) {
+					this.chargeList = [];
+					this.pageIndex = 1;
+				}
 				API.chargingRecordData({
+					pageIndex: this.pageIndex,
 					startDate: this.startDate,
 					endDate: this.endDate
 				}).then((res) => {
 					uni.hideLoading();
 					
-					this.chargeList = res.data.data;
+					this.chargeList = [
+						...this.chargeList,
+						...res.data.data
+					];
+					this.recordsTotal = res.data.recordsTotal;
 				}).catch(error => {
 					uni.showToast({
 						title: error,

+ 27 - 8
pages/user/coupon/myCoupon.vue

@@ -28,8 +28,8 @@
 				<view class="limit">
 					<view class="limit-text">
 							<view class="limit-text1">
-								<u-read-more ref="uReadMore" :shadow-style="shadowStyle" :show-height="50" text-indent="0" :close-text="closeContent" 
-									:open-text="openContent" color="#999999" :toggle="true">
+								<u-read-more ref="uReadMore" :shadow-style="shadowStyle" :show-height="50" text-indent="0" color="#999999" :close-text="closeContent" 
+									:open-text="openContent" :toggle="true">
 									<rich-text :nodes="item.useScope"></rich-text>
 								</u-read-more>
 							</view>
@@ -57,7 +57,8 @@
 				current: 0,
 				couponType: '0',
 				myCouponList: [],
-				readContent: `限用户充电电费+服务费满100元使用。限微信钱包、支付宝生活号APP端使用,<br />不支持找零,限登录和充电帐号为155****1111使用。`,
+				pageIndex: 1,
+				recordsTotal: 0,
 				shadowStyle: {
 					width: "110%",
 					backgroundImage: "none",
@@ -66,12 +67,17 @@
 					justifyContent: "right",
 				},
 				closeContent: '',
-				openContent: ','
+				openContent: '',
 			}
 		},
 		onShow() {
 			this.getCouponList();
 		},
+		onReachBottom() {
+			if (this.myCouponList.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
 		methods:{
 			toConversion() {
 				uni.navigateTo({
@@ -83,17 +89,26 @@
 					url: '/pages/index/index'
 				})
 			},
-			getCouponList() {
+			getCouponList(bl) {
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
-				})		
+				})
+				if (bl) {
+					this.myCouponList = [];
+					this.pageIndex = 1;
+				}
 				userApi.couponList({
+					pageIndex: this.pageIndex,
 					status: this.couponType
 				}).then((res) => {
 					uni.hideLoading();
 					
-					this.myCouponList = res.data.data;
+					this.myCouponList = [
+						...this.myCouponList,
+						...res.data.data
+					];
+					this.recordsTotal = res.data.recordsTotal;
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -104,7 +119,11 @@
 			change(index) {
 				this.current = index;
 				this.couponType = this.tabList[index].type;
-				this.getCouponList();
+				this.getCouponList(true);
+			},
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getCouponList()
 			},
 		}
 	}

+ 24 - 4
pages/user/finance/rechargeList.vue

@@ -39,6 +39,8 @@
 				month: '',
 				dateMonth: '',
 				accountList: [],
+				pageIndex: 1,
+				recordsTotal: 0,
 			}
 		},
 		onReady() {			
@@ -58,18 +60,36 @@
 					
 			this.getAccountRecordData();
 		},
+		onReachBottom() {
+			if (this.chargeList.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
 		methods: {
-			getAccountRecordData() {
+			myLoadmore(bl) {
+				this.pageIndex += 1;
+				this.getAccountRecordData()
+			},
+			getAccountRecordData(bl) {
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
-				})		
+				})
+				if (bl) {
+					this.accountList = [];
+					this.pageIndex = 1;
+				}
 				API.accountRecordData({
+					pageIndex: this.pageIndex,
 					queryDate: this.dateMonth,
 				}).then((res) => {
 					uni.hideLoading();
 					
-					this.accountList = res.data.data;
+					this.accountList = [
+						...this.accountList,
+						...res.data.data
+					];
+					this.recordsTotal = res.data.recordsTotal;
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -84,7 +104,7 @@
 				} else {
 					this.month = params.month;
 				}
-				this.getAccountRecordData();
+				this.getAccountRecordData(true);
 				this.show = false;
 			},
 			cancelTime() {