Files
2026-05-26 15:52:30 +08:00

284 lines
7.3 KiB
Vue

<template>
<s-layout :title="dataObj.title" navbar="inner">
<view class="pages h100">
<image
class="w100 bg"
:src="$url + 'home/points.png'"
mode="widthFix"
:style="{ top: paddingTop + 'px' }"
/>
<view class="pages_con">
<!-- :style="{ marginTop: marginTop + 'px' }" -->
<view class="page_top c0">
<view class="size28 name">{{ dataObj.name }}</view>
<view class="flex-row al-flex-end">
<view class="num">{{ detailObj[dataObj.num] }}{{ dataObj.unit }}</view>
<view class="btn size24 btn_bg" @click="goUrl(dataObj.url)" v-if="dataObj.btn">
{{ dataObj.btn }}
</view>
<view class="btn size24 btn_bg" @click="goUrl(dataObj.url1)" v-if="dataObj.btn1">
{{ dataObj.btn1 }}
</view>
</view>
</view>
<view class="page_bottom bg24">
<view class="bottom_title center c0"> 收支明细 </view>
<view>
<card_mescroll ref="cardPages" @upCallback="getList" :height="height + 'px'">
<view
v-for="(v, i) in detailList"
:key="i"
class="flex-center ju-between p-b-34 p-t-32 border-bottom"
>
<view>
<view class="size28 line40 m-b-10 c0">{{ v.remark }}</view>
<view class="size24 c_999 line34">{{ formatDate(v.createTime) }}</view>
</view>
<view>{{ dataObj.numValue }}</view>
<view class="size32 c_EE0A24">
{{
dataObj.sourceName && v[dataObj?.sourceName] === 1
? (dataObj.sourceName ? '+' : '') + v[dataObj.numName]
: (dataObj.sourceName ? '-' : '') + v[dataObj.numName]
}}
</view>
</view>
</card_mescroll>
</view>
</view>
</view>
</view>
</s-layout>
</template>
<script setup lang="ts">
import sheep from '@/sheep';
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
import * as api from '@/sheep/api/increment';
import * as pointsApi from '@/sheep/api/home/points';
import { onLoad, onShow } from '@dcloudio/uni-app';
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
import { formatDate } from '@/sheep/helper/utils';
let { proxy } = getCurrentInstance();
let dataObj = reactive({
title: '我的积分',
name: '我的积分',
num: 0,
btn: '',
btn1: '',
list: [],
unit: '',
url: '',
url1: '',
numName: 'changeAmount',
sourceName: 'bizType',
listApi: pointsApi.integraldetai,
});
let typeArr = ref([
{
name: '收入',
transactionType: 1,
},
{
name: '支出',
transactionType: 2,
},
]);
let navIndex = ref(0);
let typeIndex = ref(0);
let marginTop = ref();
let height = ref(0);
let sysInfo = uni.getSystemInfoSync();
const windowHeight = sysInfo.windowHeight;
marginTop.value = sysInfo.statusBarHeight + uni.upx2px(88) + uni.upx2px(54);
let urlAPI = ref(api.getWallet);
height.value =
windowHeight -
sysInfo.statusBarHeight -
marginTop.value -
uni.upx2px(204) -
uni.upx2px(110) -
uni.upx2px(48) -
uni.upx2px(40);
const getData = () => {
urlAPI.value().then((res) => {
if (res.code === 0) {
dataObj.num = proxy.$fen2yuan(res.data.balance);
}
});
};
let cardPages = ref(null);
let detailList = ref([]);
let detailObj = ref({});
const getList = (mescroll) => {
let urlApi = dataObj.listApi;
let obj = {
pageNo: mescroll.num,
pageSize: mescroll.size,
};
urlApi(obj).then((res) => {
if (res.code === 0) {
detailObj.value = res.data;
let list = res.data.detailList.list || [];
if (mescroll.num == 1) detailList.value = [];
detailList.value = detailList.value.concat(list);
cardPages.value.getState(true, list.length);
} else {
cardPages.value.getState(false);
}
});
};
let type = ref(1);
const dataChange = async () => {
if (type.value) {
type.value = Number(type.value);
switch (Number(type.value)) {
case 1:
dataObj.title = '积分账户';
dataObj.name = '积分账户';
dataObj.btn = '去兑换';
dataObj.url = '/pages/home/pay/seed?type=1';
dataObj.num = 'currentBalance';
dataObj.listApi = api.exAndBesPointList;
dataObj.numName = 'amount';
dataObj.sourceName = '';
break;
case 2:
dataObj.title = '增量账户';
dataObj.name = '增量账户';
dataObj.num = 'currentBalance';
dataObj.unit = '元';
dataObj.btn = '去配票';
dataObj.btn1 = '去充值';
dataObj.url = '/pages/home/pay/seed?type=2';
dataObj.url1 = '/pages/home/pay/seed?type=3';
dataObj.listApi = api.getAccountDetail;
dataObj.numName = 'amount';
dataObj.sourceName = '';
break;
default:
break;
}
// getList();
}
if (cardPages.value) {
cardPages.value.mescrollTrigger();
}
};
onLoad(async (e) => {
type.value = e.type;
});
onShow(() => {
dataChange();
});
watch(
() => [navIndex.value, typeIndex.value],
() => {
cardPages.value.mescrollTrigger();
},
);
onShow(() => {
if (cardPages.value) {
cardPages.value.mescrollTrigger();
}
});
const goUrl = (url) => {
uni.navigateTo({
url: url,
});
};
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
let paddingTop = ref();
paddingTop.value = -(statusBarHeight + 44);
</script>
<style lang="scss" scoped>
.pages {
position: relative;
.bg {
position: absolute;
top: 0;
left: 0;
z-index: 0;
}
}
.pages_con {
position: relative;
padding: 0 40rpx;
box-sizing: border-box;
z-index: 1;
.page_top {
height: 204rpx;
color: #1a1a1a;
.name {
}
.num {
font-size: 68rpx;
}
.btn {
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
height: 52rpx;
line-height: 52rpx;
width: 112rpx;
text-align: center;
border-radius: 26rpx;
color: #ffffff;
margin-bottom: 10rpx;
margin-left: 20rpx;
}
}
.page_bottom {
background-color: #fff;
border-radius: 24rpx;
padding: 0 16rpx;
.bottom_title {
line-height: 110rpx;
}
}
}
.navItem {
margin-bottom: 20rpx;
margin-right: 32rpx;
color: #ffffff;
}
.activeNav {
position: relative;
color: var(--color32);
&::before {
content: '';
width: 40rpx;
height: 6rpx;
background: linear-gradient(131deg, var(--color30) 0%, var(--color32) 100%), #fa7e31;
border-radius: 4rpx;
position: absolute;
bottom: -14rpx;
left: 50%;
transform: translateX(-50%);
}
}
.typeItem {
width: 76rpx;
height: 40rpx;
background-color: #f2f2f2;
border-radius: 8rpx;
margin-left: 12rpx;
color: #333333;
}
.activeType {
color: var(--color30);
}
</style>