MrShi
2023-10-13 9fca254349144bb63fa62261a85dacc87c43e4d2
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
    <view class="list">
        <view class="list_item" v-for="(item, index) in list" :key="index" @click="jump(item.type, item.orderId)">
            <view class="list_item_a">
                <text>{{item.title}}</text>
                <text v-if="item.type === 0">¥{{(item.money / 100).toFixed(2)}}</text>
                <text style="color: #FC2525;" v-if="item.type === 1 || item.type === 2 || item.type === 3">-¥{{(item.money / 100).toFixed(2)}}</text>
            </view>
            <view class="list_item_b">
                <text>{{item.doneDate}}</text>
                <text v-if="item.type === 0">微信支付</text>
                <text v-if="item.type === 1">查看明细</text>
                <text v-if="item.type === 2">微信退款</text>
                <text v-if="item.type === 3">微信退款</text>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                page: 1,
                list: [],
                next: false
            };
        },
        onLoad() {
            this.getList()
        },
        onReachBottom() {
            console.log('触底加载')
            this.getList()
        },
        methods: {
            jump(type, id) {
                if (type === 1) {
                    uni.navigateTo({
                        url: `/pages/settlementDetails/settlementDetails?id=${id}`
                    });
                }
            },
            getList() {
                if (!this.next) {
                    this.$u.api.transactionsPage({
                        capacity: 10,
                        model: {},
                        page: this.page,
                        sorts: [
                            {
                                direction: 'DESC',
                                property: 'createDate'
                            }
                        ]
                    }).then(res => {
                        if (res.code === 200) {
                            this.page += 1
                            this.list.push(...res.data.records)
                            if (res.data.total === this.list.length) {
                                this.next = true
                            }
                        }
                    })
                }
            }
        }
    }
</script>
<style>
    page {
        background-color: #f7f7f7;
    }
</style>
<style lang="scss" scoped>
    .list {
        width: 100%;
        padding: 20rpx;
        box-sizing: border-box;
        .list_item {
            width: 100%;
            background: #FFFFFF;
            border-radius: 20rpx;
            margin-bottom: 20rpx;
            padding: 30rpx;
            box-sizing: border-box;
            &:last-child {
                margin: 0;
            }
            .list_item_a {
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                text {
                    &:first-child {
                        font-size: 32rpx;
                        font-family: PingFangSC-Regular, PingFang SC;
                        font-weight: 400;
                        color: #222222;
                    }
                    &:last-child {
                        font-size: 30rpx;
                        font-family: PingFangSC-Medium, PingFang SC;
                        font-weight: 500;
                        color: #222222;
                    }
                }
            }
            .list_item_b {
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-top: 20rpx;
                text {
                    font-size: 26rpx;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #999999;
                }
            }
        }
    }
</style>