Files
frontend-app/pages/mine_package/mine_purse_log/mine_purse_log.vue
T

565 lines
12 KiB
Vue
Raw Normal View History

2025-08-06 20:25:41 +08:00
<template>
2025-08-16 20:05:46 +08:00
<view class="mine_purse_log_warp">
2025-08-06 20:25:41 +08:00
<Header :leftTitle="$t('mine.purse.mine_purse_log.title')" left-path-type="navigateTo"
2025-08-07 22:26:22 +08:00
left-path="/pages/mine_package/mine_purse/mine_purse" />
2025-08-08 00:08:12 +08:00
2025-08-06 20:25:41 +08:00
<view class="info_warp">
2025-08-16 15:14:14 +08:00
<view v-if="form.category !== 'redpacket'">
2025-08-12 11:28:59 +08:00
<view class="info_title_warp">
<view :class="selInfo === item.key ? 'info_title_item_warp info_title_item_sel_warp' : 'info_title_item_warp'"
v-for="item in infoList" :key="item.key" @click="selectInfo(item)">
<text>{{ item.name }}</text>
<view class="info_title_item_sel_but_warp" v-if="selInfo === item.key"></view>
</view>
2025-08-06 20:25:41 +08:00
</view>
2025-08-12 11:28:59 +08:00
<view class="line"></view>
2025-08-06 20:25:41 +08:00
</view>
2025-08-08 00:08:12 +08:00
2025-08-12 11:28:59 +08:00
2025-08-16 16:11:38 +08:00
<view
v-if="form.category === 'vcoin' || form.category === 'balance' || form.category === 'expend' || form.category === 'raffle'">
2025-08-12 11:28:59 +08:00
<view class="info_center_warp">
<view class="info_center_warp-item" v-for="item in source">
2025-08-14 20:44:00 +08:00
<view class="info_center_warp-item-top">{{ headerData[item.key] }}</view>
2025-08-12 11:28:59 +08:00
<view class="info_center_warp-item-bottom">{{ item.name }}</view>
</view>
2025-08-08 00:08:12 +08:00
</view>
2025-08-12 11:28:59 +08:00
<view class="line"></view>
2025-08-08 00:08:12 +08:00
</view>
2025-08-12 11:28:59 +08:00
<view class="info_list_warp-mine">
2025-08-16 22:03:57 +08:00
<scroll-view scroll-y="true" @scrolltolower="loadMore(selInfo)" style="height: 100%;">
2025-08-12 11:28:59 +08:00
<view v-for="item in orderList" :key="item.id" class="purse_info_item-mine"
2025-08-06 20:25:41 +08:00
v-if="orderList && orderList.length !== 0">
<view class="purse_info_left">
<!-- <up-image :src="item.type === 1? '/static/mine/purse_sf.png' : '/static/mine/purse_xf.png'" width="40" height="40" bgColor="#f1f6ff00"></up-image> -->
2025-10-16 17:33:22 +08:00
<up-image :src="item.amount > 0 ? '/static/mine/zhen.png' : '/static/mine/fu.png'" width="32" height="32" bgColor="#f1f6ff00"></up-image>
2025-08-06 20:25:41 +08:00
<view class="purse_data_warp">
<view class="purse_info_name">{{ getValue(BALANCE_TYPE, item.type) }}</view>
<view class="purse_info_value">{{ formatDate(item.ctdate) }}</view>
</view>
</view>
<view class="ipurse_nfo_right">
2025-08-16 20:05:46 +08:00
<view class="purse_info_title" style="text-align: end;">{{ handleAmount(item.amount) }}</view>
2025-08-06 20:25:41 +08:00
<view class="purse_info_value">{{ item.remark }}</view>
</view>
</view>
<view v-else class="not_order_warp">
2025-08-06 20:47:28 +08:00
<up-image src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/not_order.png" width="80" height="80"
bgColor="#f1f6ff00"></up-image>
2025-08-06 20:25:41 +08:00
<view class="not_order_msg_warp">暂无记录~</view>
</view>
<view v-if="loading" style="text-align: center;">加载中...</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import Header from '@/components/header.vue';
2025-08-16 16:11:38 +08:00
import { getAcctFlow, getAcctMiningStat, getAcctContribution, getAcctFlowList, getBonusStat, getAcctBalance } from '@/api/finance.js';
2025-08-06 20:25:41 +08:00
import { getValue, BALANCE_TYPE } from '@/utils/enumUtils.js';
import { formatDate, handleAmount } from '@/utils/index.js';
2025-08-16 20:05:46 +08:00
import Decimal from 'decimal.js';
2025-08-06 20:25:41 +08:00
export default {
computed: {
BALANCE_TYPE() {
return BALANCE_TYPE;
}
},
2025-08-16 15:14:14 +08:00
2025-08-08 00:08:12 +08:00
components: { Header },
2025-08-14 20:44:00 +08:00
2025-08-06 20:25:41 +08:00
data() {
return {
infoList: [
2025-08-14 20:44:00 +08:00
2025-08-06 20:25:41 +08:00
],
2025-08-12 11:28:59 +08:00
source: [],
2025-08-14 20:44:00 +08:00
headerData: {},
2025-08-06 20:25:41 +08:00
selInfo: "cur",
form: {
id: 0,
page: 1,
pageSize: 15,
category: null,
},
orderList: [],
lockId: 0,
curId: 0,
2025-08-14 20:44:00 +08:00
preId: 0,
2025-08-06 20:25:41 +08:00
}
},
onLoad(option) {
const category = option.category;
if (category && category !== 0) {
this.form.category = category;
}
const lockId = option.lockId;
const curId = option.curId;
2025-08-14 20:44:00 +08:00
const preId = option.preId;
2025-08-12 11:28:59 +08:00
2025-08-15 20:52:54 +08:00
// 分红金额 balance
2025-08-15 21:00:37 +08:00
console.log("分红金额category", category);
2025-08-15 20:52:54 +08:00
if (category === 'balance') {
2025-08-15 21:00:37 +08:00
this.onGetBonusStat();
2025-08-16 15:14:14 +08:00
this.infoList = [
{
name: "活期账户",
key: "cur"
},
{
name: "预存款账户",
key: "pre"
},
]
2025-08-12 11:28:59 +08:00
this.source = [
{
name: "今日分红数量",
2025-08-15 12:12:28 +08:00
key: "todayBonus"
2025-08-12 11:28:59 +08:00
},
{
name: "总分红数量",
2025-08-15 12:12:28 +08:00
key: "totalBonus"
2025-08-12 11:28:59 +08:00
},
{
name: "平台总分红",
2025-08-15 12:12:28 +08:00
key: "totalMallBonus"
2025-08-12 11:28:59 +08:00
},
{
2025-10-16 17:33:22 +08:00
name: "共享资金池剩余",
2025-08-15 12:12:28 +08:00
key: "poolBonus"
2025-08-12 11:28:59 +08:00
},
];
}
// TBC
if (category === 'vcoin') {
2025-08-14 20:44:00 +08:00
this.onGetAcctMiningStat();
2025-08-16 16:11:38 +08:00
this.infoList = [
{
name: "活期账户",
key: "cur"
},
{
2025-10-11 17:35:13 +08:00
name: "锁定账户",
2025-08-16 16:11:38 +08:00
key: "lockAmount"
},
2025-08-14 20:44:00 +08:00
2025-08-16 16:11:38 +08:00
{
name: "预存款账户",
key: "pre"
},
]
2025-08-12 11:28:59 +08:00
this.source = [
{
name: "商城总挖矿数量",
2025-08-14 20:44:00 +08:00
key: "mallTotalMiningSum"
2025-08-12 11:28:59 +08:00
},
{
name: "已兑换数量",
2025-08-14 20:44:00 +08:00
key: "exchangeNumber"
2025-08-12 11:28:59 +08:00
},
];
}
2025-08-14 20:44:00 +08:00
2025-08-12 11:28:59 +08:00
// 贡献值 expend
if (category === 'expend') {
2025-08-14 20:44:00 +08:00
this.onGetAcctContribution();
2025-08-16 15:14:14 +08:00
this.infoList = [
{
name: "活期账户",
key: "cur"
},
{
name: "预存款账户",
key: "pre"
},
]
2025-08-12 11:28:59 +08:00
this.source = [
{
name: "今日贡献值",
2025-08-14 20:44:00 +08:00
key: "todayValue"
2025-08-12 11:28:59 +08:00
},
{
name: "总贡献值",
2025-08-14 20:44:00 +08:00
key: "totalValue"
2025-08-12 11:28:59 +08:00
},
{
2025-08-16 22:03:57 +08:00
name: "商城日贡献",
2025-08-14 20:44:00 +08:00
key: "todayMallValue"
2025-08-12 11:28:59 +08:00
},
{
name: "我的占比",
2025-08-14 20:44:00 +08:00
key: "ratio"
2025-08-12 11:28:59 +08:00
},
];
}
2025-08-15 20:52:54 +08:00
// 抽奖次数 raffle
2025-08-16 16:11:38 +08:00
if (category === 'raffle') {
this.onGetAcctBalance();
this.infoList = [
{
name: "活期账户",
key: "cur"
},
{
2025-10-11 17:35:13 +08:00
name: "锁定账户",
2025-08-16 16:11:38 +08:00
key: "lockAmount"
},
{
name: "预存款账户",
key: "pre"
},
];
this.source = [
{
name: "可用次数",
key: "curAmount"
},
{
name: "锁定次数",
key: "lockAmount"
2025-08-16 18:14:11 +08:00
},
{
name: "预发放次数",
key: "preAmount"
2025-08-16 16:11:38 +08:00
}
];
}
2025-08-12 11:28:59 +08:00
2025-08-16 15:14:14 +08:00
// 积分 redpacket
if (category === 'redpacket') {
this.infoList = [
{
name: "活期账户",
key: "cur"
},
]
}
2025-08-06 20:25:41 +08:00
if (lockId && lockId !== 'null') {
this.lockId = lockId;
// this.selectInfo(this.infoList[1]);
}
2025-08-14 20:44:00 +08:00
2025-08-06 20:25:41 +08:00
if (curId && curId !== 'null') {
this.curId = curId;
this.selectInfo(this.infoList[0]);
}
2025-08-14 20:44:00 +08:00
if (preId && preId !== 'null') {
this.preId = preId;
}
2025-08-16 15:14:14 +08:00
// this.onGetAcctFlowList();
2025-08-06 20:25:41 +08:00
},
methods: {
getValue,
formatDate,
handleAmount,
2025-08-14 20:44:00 +08:00
2025-08-15 21:00:37 +08:00
// 分红统计
async onGetBonusStat() {
const resp = await getBonusStat();
console.log("分红统计", resp);
this.headerData = resp.data || {};
},
2025-08-14 20:44:00 +08:00
// 流水挖矿统计
async onGetAcctMiningStat() {
const resp = await getAcctMiningStat();
console.log("流水挖矿统计", resp);
if (resp && resp.bizcode === 100) {
this.headerData = resp.data || {};
} else {
return [];
}
},
// 流水贡献值
async onGetAcctContribution() {
const resp = await getAcctContribution();
console.log("流水贡献值", resp);
if (resp && resp.bizcode === 100) {
if (resp.data.ratio) {
2025-08-16 18:14:11 +08:00
const ratio = new Decimal(resp.data.ratio);
resp.data.ratio = ratio.times(100).toNumber() + '%';
2025-08-14 20:44:00 +08:00
}
this.headerData = resp.data || {};
} else {
return [];
}
},
2025-08-16 16:11:38 +08:00
// 抽奖次数
async onGetAcctBalance() {
const resp = await getAcctBalance();
if (resp && resp.bizcode === 100) {
const data = resp.data.find(item => item.categoty === 'raffle');
console.log("查询账户流水", data);
this.headerData = data || {};
} else {
return [];
}
},
2025-08-14 20:44:00 +08:00
// 查询账户流水
// async onGetAcctFlowList() {
// const resp = await getAcctFlowList(this.form);
// console.log("查询账户流水", resp);
// if (resp && resp.bizcode === 100) {
// this.orderList = resp.data || [];
// } else {
// return [];
// }
// },
2025-08-06 20:25:41 +08:00
selectInfo(item) {
this.orderList = [];
this.form.page = 1;
this.selInfo = item.key;
let id = 0;
if (item.key === "cur") {
id = this.curId;
}
2025-10-11 17:35:13 +08:00
if (item.key === "lockAmount") {
2025-08-06 20:25:41 +08:00
id = this.lockId;
}
2025-08-14 20:44:00 +08:00
if (item.key === "pre") {
id = this.preId;
}
2025-08-06 20:25:41 +08:00
this.form.id = id;
this.loadData();
},
// 加载数据的方法
async loadData() {
if (this.loading) return; // 如果正在加载,则不重复加载
this.loading = true; // 设置加载状态为true
try {
// 模拟异步获取数据,实际应用中应该替换为你的数据获取逻辑,例如API调用
const newData = await this.fetchData(this.form.page, this.form.pageSize);
this.orderList = [...this.orderList, ...newData]; // 将新数据添加到列表中
this.form.page++; // 页码加1
} catch (error) {
console.error('加载数据失败:', error);
} finally {
this.loading = false; // 设置加载状态为false
}
},
2025-08-14 20:44:00 +08:00
// 列表数据
2025-08-06 20:25:41 +08:00
async fetchData(page, pageSize) {
if (!this.form.id || this.form.id === 0) {
return [];
}
const params = {
id: this.form.id,
category: this.form.category,
page,
pageSize,
}
console.log("params", params);
2025-08-14 20:44:00 +08:00
const resp = await getAcctFlowList(params);
console.log("列表数据---1", resp);
2025-08-06 20:25:41 +08:00
if (resp && resp.bizcode === 100) {
const data = resp.data && resp.data.entitys || [];
return data
} else {
return [];
}
},
// 当滚动到底部时触发的方法
loadMore(selInfo) {
let id = 0;
if (selInfo === "cur") {
id = this.curId;
}
2025-10-11 17:35:13 +08:00
if (selInfo === "lockAmount") {
2025-08-06 20:25:41 +08:00
id = this.lockId;
}
this.form.id = id;
this.loadData(); // 加载更多数据
}
}
}
</script>
2025-08-16 20:05:46 +08:00
<style lang="scss">
.mine_purse_log_warp {
2025-08-16 22:03:57 +08:00
height: calc(100vh - var(--status-bar-height));
2025-08-06 20:25:41 +08:00
overflow-y: hidden;
2025-08-16 22:03:57 +08:00
.info_warp {
height: calc(100% - 165rpx);
}
2025-08-06 20:25:41 +08:00
.info_title_warp {
display: flex;
2025-08-08 00:08:12 +08:00
justify-content: space-around;
2025-08-14 20:44:00 +08:00
padding: 0 50rpx;
2025-08-08 00:08:12 +08:00
.info_title_item_warp {
font-size: 32rpx;
color: #666666;
}
.info_title_item_sel_warp {
display: flex;
flex-direction: column;
align-items: center;
color: #7934F6;
font-weight: 500;
.info_title_item_sel_but_warp {
background: $app-bt-bj;
border-radius: 4rpx;
width: 80rpx;
height: 6rpx;
margin-top: 20rpx;
}
}
2025-08-06 20:25:41 +08:00
}
2025-08-08 00:08:12 +08:00
.line {
width: 100vw;
height: 12rpx;
background: #F5F5F5;
2025-08-06 20:25:41 +08:00
}
2025-08-08 00:08:12 +08:00
.info_center_warp {
display: flex;
justify-content: space-between;
2025-08-16 22:03:57 +08:00
padding: 32rpx 24rpx;
2025-08-08 00:08:12 +08:00
.info_center_warp-item {
2025-08-16 22:03:57 +08:00
flex: 1;
min-width: 25%;
2025-08-08 00:08:12 +08:00
.info_center_warp-item-top {
font-weight: bold;
font-size: 36rpx;
color: #333333;
text-align: center;
2025-08-16 22:03:57 +08:00
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
2025-08-08 00:08:12 +08:00
}
.info_center_warp-item-bottom {
font-size: 26rpx;
color: #999999;
2025-08-16 20:59:19 +08:00
margin-top: 15rpx;
2025-08-16 22:03:57 +08:00
text-align: center;
2025-08-08 00:08:12 +08:00
}
}
2025-08-06 20:25:41 +08:00
}
2025-08-12 11:28:59 +08:00
.info_list_warp-mine {
padding: 44rpx 32rpx;
2025-08-16 22:03:57 +08:00
height: calc(100% - 180rpx - 24rpx - 83rpx - 10rpx);
// max-height: 100%;
2025-08-12 11:28:59 +08:00
.purse_info_item-mine {
display: flex;
justify-content: space-between;
2025-08-16 20:59:19 +08:00
align-items: center;
2025-08-12 11:28:59 +08:00
border: 0;
height: 128rpx;
margin-bottom: 0;
padding: 0;
2025-08-08 00:08:12 +08:00
2025-08-12 11:28:59 +08:00
.purse_info_left .ipurse_nfo_right {
display: flex;
2025-08-16 20:59:19 +08:00
justify-content: space-between;
2025-08-12 11:28:59 +08:00
flex-direction: column;
2025-08-16 20:59:19 +08:00
height: 82rpx;
.purse_data_warp {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 20rpx;
.purse_info_name {
font-size: 28rpx;
color: #333333;
font-weight: normal;
}
.purse_info_value {
font-size: 24rpx;
color: #999999;
}
.purse_info_title {
font-weight: bold;
font-size: 32px;
color: #333333;
text-align: end;
}
}
}
.purse_info_left {
.purse_info_name {
font-weight: 400;
}
.purse_info_value {
margin-top: 8rpx;
}
}
.ipurse_nfo_right {
.purse_info_value {
width: 300rpx;
white-space: nowrap;
/* 禁止换行 */
overflow: hidden;
/* 隐藏溢出内容 */
text-overflow: ellipsis;
/* 显示省略号 */
}
2025-08-12 11:28:59 +08:00
}
}
2025-08-06 20:25:41 +08:00
}
}
</style>