web
2025-07-03 8e5fb21a2bf621291c1ceee396c01e3d42553511
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<template>
    <view class="record">
        <Navbar title="充值记录"></Navbar>
        <view class="header">
            <uni-data-select
                v-model="dateType"
                :localdata="dataTypeOption"
                @change="changeTime"
                :clear="false"
            />
        </view>
        <view class="chongzhi">
            <view class="item" v-for="(item, index) in list" :key="index">
                <vie class="info">
                    <view>充值金额:<text class="val">{{item.rechargeAmount}}</text>元</view>
                    <view>充值水量:<text class="val">{{item.rechargeWater}}</text>m³</view>
                </vie>
                <view class="status">
                    <view v-if="item.rechargeStatus === 1" style="color: #19d60b;">已充值</view>
                    <view v-else style="color: #818181;">未充值</view>
                </view>
                <view class="tm">{{item.createTimeView}}</view>
            </view>
        </view>
    </view>
</template>
 
<script setup>
    import {ref, onMounted} from 'vue'
    import Navbar from '../../components/navbar/navbar.vue'
    import {getrechargeRecord} from '@/api/index.js'
    import { onReachBottom } from '@dcloudio/uni-app';
    
    const list = ref([])
    const page = ref(1)
    const dateType = ref(0)
    
    const dataTypeOption = [
        { text: '全部', value: 0 },
        { text: '本日', value: 1 },
        { text: '本周', value: 2 },
        { text: '本月', value: 3 },
        { text: '本年', value: 4 }
    ]
    
    const getData = () => {
        const data = {
            dateType: dateType.value,
            limit: 10,
            page: page.value
        }
        getrechargeRecord(data).then(res => {
            if(res.code === 200) {
                list.value = res.data.list
            }
        })
    }
    
    // 选择时间
    const changeTime = () => {
        page.value = 1
        getData()
    }
    
    // 触底加载数据
    onReachBottom(() => {
        page.value ++
        getData()
    })
    
    onMounted(() => {
        getData()
    })
</script>
 
<style lang="scss" scoped>
    .chongzhi{
        padding: 0 20rpx;
        .item{
            padding: 20rpx;
            border-bottom: 1px solid #ddd;
            display: flex;
            align-items: center;
            justify-content: space-between;
            .info{
                width: 45%;
                flex-shrink: 0;
                text-align: left;
                font-size: 24rpx;
                .val{
                    font-size: 28rpx;
                }
            }
            .status{
                flex-grow: 1;
                text-align: center;
            }
            .tm{
                flex-grow: 1;
                text-align: right;
                font-size: 24rpx;
            }
        }
    }
</style>