From c92b723d893bddd1cf9093e660806b226dc00921 Mon Sep 17 00:00:00 2001 From: seatonwan9 Date: 星期五, 15 八月 2025 19:01:56 +0800 Subject: [PATCH] 提交源码 --- src/views/pointsManage/personal/index.vue | 72 ++++++++++++++++++++++-------------- 1 files changed, 44 insertions(+), 28 deletions(-) diff --git a/src/views/pointsManage/personal/index.vue b/src/views/pointsManage/personal/index.vue index 9c16a88..4ee14ac 100644 --- a/src/views/pointsManage/personal/index.vue +++ b/src/views/pointsManage/personal/index.vue @@ -58,24 +58,25 @@ <span class="filter-label">鏁版嵁绫荤洰:</span> <el-select v-model="queryParams.dataCategory" placeholder="鍏ㄩ儴" clearable> <el-option label="鍏ㄩ儴" value="" /> - <el-option label="璧勬簮璐$尞" value="resource_contribution" /> - <el-option label="璧勬簮浜ゆ槗" value="resource_transaction" /> - <el-option label="璧勬簮浼犳挱" value="resource_dissemination" /> - <el-option label="鐢ㄦ埛鍙備笌" value="user_participation" /> - <el-option label="绉垎杞崲" value="points_conversion" /> - <el-option label="鍏朵粬" value="other" /> + <el-option + v-for="category in categoryList" + :key="category" + :label="getCategoryLabel(category)" + :value="category" + /> </el-select> </div> <div class="filter-item"> <span class="filter-label">鏃堕棿:</span> <el-date-picker v-model="dateRange" - type="daterange" + type="datetimerange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" - format="YYYY-MM-DD" - value-format="YYYY-MM-DD" + format="YYYY-MM-DD HH:mm:ss" + date-format="YYYY-MM-DD" + time-format="HH:mm:ss" @change="handleDateChange" /> </div> @@ -83,9 +84,8 @@ <span class="filter-label">鏁版嵁绫诲瀷:</span> <el-select v-model="queryParams.dataType" placeholder="鍏ㄩ儴" clearable> <el-option label="鍏ㄩ儴" value="" /> - <el-option label="鑾峰彇" value="earned" /> - <el-option label="娑堣��" value="consumed" /> - <el-option label="杞崲" value="converted" /> + <el-option label="鑾峰彇" value="0" /> + <el-option label="娑堣��" value="1" /> </el-select> </div> </div> @@ -110,9 +110,9 @@ <span>{{ getCategoryLabel(row.dataCategory) }}</span> </template> </el-table-column> - <el-table-column prop="name" label="鍚嶇О" min-width="300" show-overflow-tooltip /> - <el-table-column prop="flowTime" label="鏃堕棿" width="180" align="center" /> - <el-table-column prop="points" label="绉垎" width="100" align="center"> + <el-table-column prop="name" label="鍚嶇О" show-overflow-tooltip /> + <el-table-column prop="flowTime" label="鏃堕棿" align="center" /> + <el-table-column prop="points" label="绉垎" align="center"> <template #default="{ row }"> <span :class="row.points > 0 ? 'points-earned' : 'points-consumed'"> {{ row.points > 0 ? '+' : '' }}{{ row.points }} @@ -144,7 +144,7 @@ <script setup lang="ts"> import { ref, reactive, onMounted, computed } from 'vue' -import { ElMessage } from 'element-plus' +import { dayjs, ElMessage } from 'element-plus' import { ArrowLeft, Refresh, @@ -160,18 +160,17 @@ // 绉垎缁熻 const stats = ref<PointsStats>({ - balance: 20000, - totalEarned: 10000, - totalConsumed: 200, + balance: 0, + totalEarned: 0, + totalConsumed: 0, totalConverted: 0, }) // 鏌ヨ鍙傛暟 const queryParams = reactive<PointsQueryParams>({ + userId: '1', dataCategory: '', dataType: '', - startTime: '', - endTime: '', pageNum: 1, pageSize: 10, }) @@ -184,6 +183,9 @@ // 鎬绘暟 const total = ref(0) + +// 鏁版嵁绫荤洰鍒楄〃 +const categoryList = ref<string[]>([]) // 鏍煎紡鍖栨暟瀛� const formatNumber = (num: number) => { @@ -206,12 +208,25 @@ // 鑾峰彇绉垎缁熻 const getPointsStats = async () => { try { - const res = await pointsApi.getPersonalPointsStats() + const userId = 1; + const res = await pointsApi.getPersonalPointsStats(userId) if (res.code === 200 && res.data) { stats.value = res.data } } catch (error) { console.error('鑾峰彇绉垎缁熻澶辫触:', error) + } +} + +// 鑾峰彇鏁版嵁绫荤洰鍒楄〃 +const getCategoryList = async () => { + try { + const res = await pointsApi.getPointsFlowCategories() + if (res.code === 200 && res.data) { + categoryList.value = res.data + } + } catch (error) { + console.error('鑾峰彇鏁版嵁绫荤洰澶辫触:', error) } } @@ -238,8 +253,8 @@ const resetQuery = () => { queryParams.dataCategory = '' queryParams.dataType = '' - queryParams.startTime = '' - queryParams.endTime = '' + queryParams.flowStartTime = '' + queryParams.flowEndTime = '' dateRange.value = null queryParams.pageNum = 1 queryData() @@ -248,11 +263,11 @@ // 澶勭悊鏃ユ湡鍙樺寲 const handleDateChange = (dates: [string, string] | null) => { if (dates) { - queryParams.startTime = dates[0] - queryParams.endTime = dates[1] + queryParams.flowStartTime = dayjs(dates[0]).format('YYYY-MM-DD HH:mm:ss'); + queryParams.flowEndTime = dayjs(dates[1]).format('YYYY-MM-DD HH:mm:ss'); } else { - queryParams.startTime = '' - queryParams.endTime = '' + queryParams.flowStartTime = '' + queryParams.flowEndTime = '' } } @@ -288,6 +303,7 @@ onMounted(() => { getPointsStats() getPointsFlow() + getCategoryList() }) </script> -- Gitblit v1.8.0