Prechádzať zdrojové kódy

新增积分流水页面

Wang-Xiao-Ran 1 rok pred
rodič
commit
64ffe00961
5 zmenil súbory, kde vykonal 93 pridanie a 34 odobranie
  1. 11 0
      api/me/meOperate.js
  2. 9 0
      pages.json
  3. 5 25
      pages/me/me.vue
  4. 6 0
      pages/me/meOperate.css
  5. 62 9
      pages/me/meOperate.vue

+ 11 - 0
api/me/meOperate.js

@@ -0,0 +1,11 @@
+import request from '@/utils/request'
+
+
+export function listScoreInfo(query) {
+  return request({
+    url: '/score/getScoreList',
+    method: 'get',
+    data: query
+  })
+}
+

+ 9 - 0
pages.json

@@ -132,6 +132,15 @@
 				"navigationBarTitleText": "主题配置类型"
 				
 			}
+		},
+		{
+			"path": "pages/me/meOperate",
+			"style": {
+				"usingComponents": {},
+				"navigationBarBackgroundColor": "#07c160",
+				"navigationBarTextStyle": "white",
+				"navigationBarTitleText": "积分流水"
+			}
 		}
 	],
 	"tabBar": {

+ 5 - 25
pages/me/me.vue

@@ -7,7 +7,7 @@
 			<text>{{initInfo.scoreNum}}</text>
 		</view>
 		<view class="uni-panel" v-for="(item, index) in list" :key="item.id">
-			<view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="goDetailPage(index, item.id)">
+			<view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="goDetailPage(item.id)">
 				<text class="uni-panel-text">{{item.name}}</text>
 				<text class="uni-panel-icon uni-icon" :class="item.open ? 'uni-panel-icon-on' : ''">{{item.pages ? '&#xe581;' : '&#xe470;'}}</text>
 			</view>
@@ -33,13 +33,11 @@ export default {
 					id: 'me/meOperate',//id是文件路径
 					name: '我的积分流水',
 					open: false,
-					pages: ['meOperate']
 				},
 				{
 					id: 'wenba/wenba',
 					name: '我的问答',
 					open: false,
-					pages: ['meOperate']
 				}
 			]
 		};
@@ -80,29 +78,11 @@ export default {
 	 */
 	onShareAppMessage() {},
 	methods: {
-		goDetailPage(panel, e) {
-			if (typeof e === 'string') {
+		goDetailPage(e) {
 				const url = '/pages/' + e
-				if (this.hasLeftWin) {
-					uni.reLaunch({
-						url: url
-					})
-				} else {
-					uni.navigateTo({
-						url: url
-					})
-				}
-			} else {
-				if (this.hasLeftWin) {
-					uni.reLaunch({
-						url: e.url
-					})
-				} else {
-					uni.navigateTo({
-						url: e.url
-					})
-				}
-			}
+				uni.navigateTo({
+					url: url
+				})
 		},
 		//获取用户信息:用户名称:头像
 		getUserInfoByUserId(userId){

+ 6 - 0
pages/me/meOperate.css

@@ -0,0 +1,6 @@
+.uni-group {
+	display: flex;
+	align-items: center;
+}
+
+

+ 62 - 9
pages/me/meOperate.vue

@@ -1,22 +1,75 @@
 <template>
 	<view>
-		
+		<view class="uni-container">
+			<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据">
+				<uni-tr>
+					<uni-th align="center">姓名</uni-th>
+					<uni-th align="center">积分变动</uni-th>
+					<uni-th align="center">剩余积分</uni-th>
+					<uni-th align="center">积分变动来源</uni-th>
+					<uni-th align="center">时间</uni-th>
+				</uni-tr>
+				<uni-tr v-for="(item, index) in tableData" :key="index">
+					<uni-td>{{item.name == null || item.name == '' ? item.wechatName : item.name}}</uni-td>
+					<uni-td>{{ item.scoreOperate }}</uni-td>
+					<uni-td align="center">{{ item.scoreNum }}</uni-td>
+					<uni-td align="center">{{ item.relevance }}</uni-td>
+					<uni-td align="center">{{ item.createTime }}</uni-td>
+				</uni-tr>
+			</uni-table>
+			<view class="uni-pagination-box">
+				<uni-pagination show-icon :page-size="queryParams.pageSize" :current="queryParams.pageNum" :total="total" @change="change" />
+			</view>
+		</view>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			}
+import {listScoreInfo} from '@/api/me/meOperate.js';
+export default {
+	data() {
+		return {
+			searchVal: '',
+			tableData: [],
+			// 数据总量
+			total: 0,
+			userId : null,
+			queryParams:{
+				// 当前页
+				pageNum: 1,
+				// 每页数据量
+				pageSize: 10,
+				//请求参数
+				userId: getApp().globalData.userId
+			},
+			loading: false,
+		};
+	},
+	onLoad() {
+		this.selectedIndexs = [];
+		this.getData(1);
+	},
+	methods: {
+		// 分页触发
+		change(e) {
+			this.$refs.table.clearSelection();
+			this.selectedIndexs.length = 0;
+			this.getData(e.current);
 		},
-		methods: {
-			
+		// 获取数据
+		getData(pageNum) {
+			this.loading = true;
+			this.queryParams.pageNum = pageNum;
+			listScoreInfo(this.queryParams).then(res =>{
+				this.tableData = res.rows
+				this.total = res.total
+				this.loading = false;
+			});
 		}
 	}
+};
 </script>
 
 <style>
-
+@import './meOperate.css';
 </style>