浏览代码

乐豆明细修改

1004749546@qq.com 4 年之前
父节点
当前提交
fa0701ec07
共有 2 个文件被更改,包括 39 次插入25 次删除
  1. 3 1
      api/user.js
  2. 36 24
      pages/userCenter/ldDetailed.vue

+ 3 - 1
api/user.js

@@ -25,7 +25,9 @@ export const loginPhone = params => {
 };
 // 乐豆使用明细
 export const ldUsedQuery = params => { 
-  let url = `customerGoldLog/queryByMonth`
+  let url = `customerGoldLog/queryByMonth/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
   return axios.request({
     url: url,
     data: params,

+ 36 - 24
pages/userCenter/ldDetailed.vue

@@ -2,31 +2,31 @@
 	<view class="ldDetailed-container">
 		<!-- 筛选菜单 -->
 		<u-dropdown ref="uDropdown" class="filter-dropdown">
-			<u-dropdown-item v-model="queryParam.changeType" :title="titType" :options="optionsType" @change="searchHandle()"></u-dropdown-item>
-			<u-dropdown-item v-model="timeScope" :title="titScope" :options="optionsScope" @change="searchHandle()"></u-dropdown-item>
+			<u-dropdown-item v-model="queryParam.changeType" :title="titType" :options="optionsType" @change="searchHandle(1)"></u-dropdown-item>
+			<u-dropdown-item v-model="timeScope" :title="titScope" :options="optionsScope" @change="searchHandle(1)"></u-dropdown-item>
 		</u-dropdown>
 		<scroll-view class="scroll-con" scroll-y @scrolltolower="onreachBottom">
 			<!-- 列表数据 -->
 			<view class="cell-item-con">
 				<view class="cell-item" v-for="(item, index) in listdata" :key="index">
-					<text class="cell-item-month" v-if="timeScope == 'threeMonth'">{{item.month}}</text>
-					<view class="cell-item-main" v-for="(subItem, ind) in item.monthDataList" :key="ind">
+					<!-- <text class="cell-item-month" v-if="timeScope == 'threeMonth'">{{item.month}}</text> -->
+					<view class="cell-item-main" >
 						<view :class="['cell-item-pic']">
-							<u-image mode="scaleToFill" v-if="subItem.changeType == 'ADD'" shape="circle" width="70rpx" height="70rpx" src="/static/tudi.png"></u-image>
+							<u-image mode="scaleToFill" v-if="item.changeType == 'ADD'" shape="circle" width="70rpx" height="70rpx" src="/static/tudi.png"></u-image>
 							<u-image mode="scaleToFill" v-else shape="circle" width="70rpx" height="70rpx" src="/static/bued.png"></u-image>
 						</view>
 						<view class="cell-item-c">
-							<text class="cell-item-des">{{subItem.operateTypeDictValue||'--'}}</text>
-							<text class="cell-item-date">{{subItem.createDate}}</text>
+							<text class="cell-item-des">{{item.operateTypeDictValue||'--'}}</text>
+							<text class="cell-item-date">{{item.createDate}}</text>
 						</view>
-						<view :class="['cell-item-score', subItem.changeType == 'ADD' ? 'black' : 'red']">
-							<text>{{subItem.changeType == 'ADD' ? '+'+subItem.changeNum : '-'+subItem.changeNum}}</text>
+						<view :class="['cell-item-score', item.changeType == 'ADD' ? 'black' : 'red']">
+							<text>{{item.changeType == 'ADD' ? '+'+item.changeNum : '-'+item.changeNum}}</text>
 							<u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
 						</view>
 					</view>
-					<view class="nodata" v-if="item.monthDataList.length==0 && status!='loading'">
+					<!-- <view class="nodata" v-if="item.monthDataList.length==0 && status!='loading'">
 						<u-empty :text="noDataText" mode="list"></u-empty>
-					</view>
+					</view> -->
 				</view>
 			</view>
 			<view class="nodata" v-if="listdata.length==0 && status!='loading'">
@@ -48,7 +48,7 @@
 			return {
 				listdata: [],
 				pageNo: 1,  //  当前页码
-				pageSize: 10,  //  每页条数
+				pageSize: 20,  //  每页条数
 				total: 0,  //  数据总条数
 				noDataText: '暂无数据',  //  列表请求状态提示语
 				status: 'loadmore',  //  加载中状态
@@ -64,7 +64,7 @@
 			}
 		},
 		onShow() {
-			this.searchHandle()
+			this.searchHandle(1)
 		},
 		onLoad() {
 			this.timeScope = 'threeMonth'
@@ -114,31 +114,43 @@
 		},
 		methods:{
 			// 搜索查询
-			searchHandle () {
-				this.listdata = []
+			searchHandle (pageNo) {
+				this.pageNo = pageNo ? pageNo : this.pageNo
+				if(this.pageNo == 1){
+					this.listdata = []
+				}
 				this.status = "loading"
 				let params = Object.assign(this.queryParam,this.queryDate)
+				params.pageNo = this.pageNo
+				params.pageSize = this.pageSize
 				console.log(params,'pppppppp')
 				ldUsedQuery(params).then(res => {
 					console.log(res,'pppppppp')
 					if (res.status == 200) {
-						let list = res.data
-						// 查询3个月时 数据处理
-						if (this.timeScope == 'threeMonth') {
-							list.map(item=>{
-								let m = moment(item.month).month()+1
-								item.month = (m == moment().month()+1) ? '本月' : m+'月'
-							})
+						if(this.pageNo>1){
+							this.listdata = this.listdata.concat(res.data.list || [])
+						}else{
+							this.listdata = res.data.list || []
 						}
-						this.listdata = list
+						this.total = res.data.count || 0
 					} else {
 						this.noDataText = res.message
 						this.listdata = []
 						this.total = 0
 					}
-					this.status = "nomore"
+					this.status = "loadmore"
 				})
 			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listdata.length < this.total){
+					this.pageNo += 1
+					this.searchHandle()
+				}else{
+					uni.showToast({ title: '已经到底了', icon: 'none' })
+					this.status = "nomore"
+				}
+			}
 		}
 	}
 </script>