| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <template>
- <view class="container">
- <image class="banner" src="@/static/images/mine/back.png" mode="aspectFill" />
- <view class="title" :style="{ top: `${paddingTop * 2}rpx` }">
- <view class="title_back" @click="handleBack">
- <wd-icon name="thin-arrow-left" color="#001713" size="18"></wd-icon>
- </view>
- 使用明细
- </view>
- <!-- 选择时间区域 -->
- <view class="time">
- <wd-datetime-picker type="year-month" v-model="timeValue1" format="yyyy-MM" @confirm="handleConfirm" />
- </view>
- <!-- 内容区域 -->
- <scroll-view scroll-y class="body" @scrolltolower="scrolltolower">
- <!-- 每一个明细区域 -->
- <view class="body_item" v-for="(item,index) in listData" :key="index">
- <view v-if="item.vertifyState==1">
- <view class="item_msg">
- <view class="">订单号:{{item.orderNum}}</view>
- <view class="msg_detail">充值+{{item.account4}}</view>
- </view>
- <view class="">描述:支付{{item.account4}}
- <!-- ,赠送补贴包{{item.account2}} -->
- </view>
- <view class="item_text">主余额:{{item.account1}}
- <!-- 补贴余额:{{item.account2}} 余额:{{item.account5}} -->
- </view>
- <view class="item_text">{{item.createTime}}</view>
- </view>
-
- <view v-if="item.vertifyState==0">
- <view class="item_msg">
- <view class="">订单号:{{item.orderNum}}</view>
- <view class="msg_detail">提现-{{item.account4}}</view>
- </view>
- <!-- <view class="">描述:支付{{item.account4}},赠送补贴包{{item.account2}}</view> -->
- <view class="item_text">主余额:{{item.account1}}
- <!-- 补贴余额:{{item.account2}} 余额:{{item.account5}} -->
- </view>
- <view class="item_text">{{item.createTime}}</view>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script setup>
- import { onMounted, ref ,computed} from 'vue'
- import { onLoad, onReachBottom } from '@dcloudio/uni-app'
- import { myRequest } from '@/utils/api.ts'
- const userInfo = uni.getStorageSync('carUserInfo')
- // 胶囊按钮距离页面顶部的距离
- const paddingTop = ref(0)
- // 当前选择的时间
- const timeValue1 = ref(new Date())
- const timeValue = ref(new Date())
- // 当前选择的时间转换成2025-10格式
- const timeTime = ref('')
- // 每页多少条数据
- const pageSize = ref(6)
- // 当前是第几页
- const currentPage = ref(1)
- // 总共多少条数据
- const total = ref(0)
- // 预约记录数据
- const listData = ref([])
- onMounted(() => {
- paddingTop.value = uni.getMenuButtonBoundingClientRect().top
- })
- // 计算属性:将时间戳转换为 Sat Feb 01 2025 08:00:00 GMT+0800 (中国标准时间) 格式
- function formattedDate(value){
- const date = new Date(value);
- return date.toString();
- }
-
- // 转换为 "yyyy-MM" 格式
- function formattedDate2(value){
- // 1. 将字符串转换为 Date 对象
- const date = new Date(value);
-
- // 2. 提取年和月(月份需 +1,且补0至2位)
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, '0');
-
- // 3. 拼接为 "yyyy-MM" 格式
- return `${year}-${month}`;
- }
- // 计算下一个月
- function nextMonth(value1){
- // 1. 拆分年和月
- const [year, month] = value1.value.split('-').map(Number);
-
- // 2. 月份 +1,若超过12则年份 +1,月份重置为1
- let newYear = year;
- let newMonth = month + 1;
- if (newMonth > 12) {
- newYear += 1;
- newMonth = 1;
- }
-
- // 3. 格式化为 "yyyy-MM"
- return `${newYear}-${String(newMonth).padStart(2, '0')}`;
- }
-
- // 确认选择时的回调(此时 value 已为 "yyyy-MM" 格式)
- const handleConfirm = (value) => {
- timeValue.value = formattedDate(value.value)//value; // 直接赋值,保持格式一致
- // console.log(11133,timeValue.value,formattedDate(value.value),formattedDate2(timeValue.value))
- getMyData()
- };
- // 获取充值明细数据
- async function getMyData() {
- const start=formattedDate2(timeValue.value)
- timeTime.value=formattedDate2(timeValue.value)
- const end=nextMonth(timeTime)
- const res = await myRequest({
- url: '/cardlist.action',
- data: {
- mobile: userInfo.mobile,
- createStart: start,
- createEnd: end,
- rows: pageSize.value,
- page: currentPage.value
- }
- })
- console.log(res)
- listData.value = [...listData.value, ...res.rows]
- total.value = res.total
- }
- onLoad(() => {
- getMyData()
- console.log(111,timeValue.value)
- })
- // 页面滚动到底部触发的回调
- const scrolltolower = () => {
- if (listData.value.length < total.value) {
- currentPage.value++
- getMyData()
- } else {
- uni.showToast({
- title: '没有更多数据了',
- icon: 'none'
- })
- }
- }
- // 顶部返回图标回调
- const handleBack = () => {
- uni.navigateBack()
- }
- </script>
- <style lang="scss" scoped>
- .container {
- position: relative;
- height: 100vh;
- color: #001713;
- background-color: #fff;
- overflow: hidden;
- .banner {
- width: 100%;
- height: 482rpx;
- }
- .title {
- position: absolute;
- display: flex;
- align-items: center;
- width: 100vh;
- font-size: 40rpx;
- .title_back {
- margin-left: 26rpx;
- margin-right: 252rpx;
- }
- }
- .time {
- position: absolute;
- top: 130rpx;
- left: 32rpx;
- width: 250rpx;
- :deep(.wd-cell) {
- background-color: transparent;
- }
- }
- .body {
- position: absolute;
- top: 230rpx;
- box-sizing: border-box;
- padding: 10rpx 30rpx;
- height: calc(100vh - 230rpx);
- color: #001713;
- font-size: 28rpx;
- background-color: #fff;
- .body_item {
- padding: 20rpx 0;
- margin-bottom: 10rpx;
- border-bottom: 2rpx solid #d5d5d5;
- .item_msg {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 8rpx;
- .msg_detail {
- font-size: 36rpx;
- font-weight: bold;
- }
- }
- .item_text {
- margin-top: 12rpx;
- color: #aba6a6;
- font-size: 24rpx;
- }
- }
- }
- }
- </style>
|