feat: 优化代码

This commit is contained in:
2025-08-06 20:25:41 +08:00
parent 5f7d0ceb79
commit 73823c50fd
1179 changed files with 42944 additions and 189654 deletions
@@ -0,0 +1,138 @@
<template>
<view class="purse_bonus_withdraw_log">
<Header :leftTitle="'提现记录(' + getValue(ACCOUNT_CATEGORY, form.category) + ')'" left-path-type="navigateTo"
:leftPath="'/pages/mine/mine_purse_bonus_withdraw/mine_purse_bonus_withdraw?category=' + form.category" />
<scroll-view scroll-y="true" @scrolltolower="loadMore" :style="{ 'height': 'calc(100vh - 200rpx)' }">
<view class="purse_bonus_withdraw_log_content" v-if="logList && logList.length !== 0">
<view class="log_item" v-for="(item, index) in logList" :key="index">
<view>
<view class="title_">{{ item.bankName }}(**** {{ getBankNumber(item.bankNo) }})</view>
<view class="msg_">{{ formatDate(item.ctdate) }}</view>
</view>
<view style="text-align: right;">
<view class="title_">{{ handleAmount(item.amount) }}</view>
<view class="msg_">{{ getValue(FINANCE_WITHDRAWAL_STATUS, item.status) }}</view>
</view>
</view>
</view>
<view v-else class="not_order_warp">
<up-image src="/static/common/not_order.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">还没有提现记录哦~</view>
</view>
<view v-if="loading" style="text-align: center;">加载中...</view>
</scroll-view>
</view>
</template>
<script>
import Header from '@/components/header.vue';
import { handleAmount, formatDate, getBankNumber } from '@/utils/index.js';
import { ACCOUNT_CATEGORY, ACCOUNT_TYPE, FINANCE_WITHDRAWAL_STATUS, getValue } from '@/utils/enumUtils.js';
import { getWithdrawalList } from '@/api/finance.js';
export default {
computed: {
ACCOUNT_CATEGORY() {
return ACCOUNT_CATEGORY;
},
ACCOUNT_TYPE() {
return ACCOUNT_TYPE;
},
FINANCE_WITHDRAWAL_STATUS() {
return FINANCE_WITHDRAWAL_STATUS;
}
},
components: { Header },
data() {
return {
logList: [],
form: {
category: null,
page: 1,
pageSize: 20,
},
loading: false, // 加载状态标志
}
},
onLoad(option) {
const category = option.category;
if (category && category !== "null") {
this.form.category = category;
}
},
mounted() {
this.loadData(); // 页面加载时加载数据
},
methods: {
handleAmount,
formatDate,
getValue,
getBankNumber,
// 加载数据的方法
async loadData() {
if (this.loading) return; // 如果正在加载,则不重复加载
this.loading = true; // 设置加载状态为true
try {
// 模拟异步获取数据,实际应用中应该替换为你的数据获取逻辑,例如API调用
const newData = await this.fetchData(this.form.page, this.form.pageSize);
if (newData.entitys) {
this.logList = [...this.logList, ...newData.entitys]; // 将新数据添加到列表中
this.form.page++; // 页码加1
}
} catch (error) {
console.error('加载数据失败:', error);
} finally {
this.loading = false; // 设置加载状态为false
}
},
// 模拟获取数据的方法,实际应用中应该替换为你的数据获取逻辑,例如从服务器获取数据
async fetchData(page, pageSize) {
const params = {
page,
pageSize,
category: this.form.category,
}
const data = await getWithdrawalList(params);
if (data && data.bizcode === 100) {
return data.data
} else {
return [];
}
},
// 当滚动到底部时触发的方法
loadMore() {
this.loadData(); // 加载更多数据
}
},
}
</script>
<style lang="scss" scoped>
.purse_bonus_withdraw_log {
background-color: $app-bj;
padding: 30rpx;
// height: calc(100vh - 60rpx);
// overflow: auto;
.log_item {
padding: 30rpx;
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
background: #FFFFFF;
border-radius: 20rpx;
}
.title_ {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
.msg_ {
font-size: 24rpx;
color: #808080;
margin-top: 10rpx;
}
}
</style>