rk
2025-10-13 bd6229ebd9cb543a22944ecb1142fad92b675dce
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<template>
    <view class="mx">
        <view class="index-search" :style="{ top: (statusbarHeight + navHeight) + 'px' }">
            <view :class="item.id === type ? 'index-search-item active' : 'index-search-item'" v-for="(item, index) in list" :key="index" @click="changeType(item.id,item.optType)">
                <text>{{item.name}}</text>
                <view class="index-search-item-x" v-if="item.id === type"></view>
            </view>
        </view>
        <view class="mx-list">
            <view v-if="dataList && dataList.length" class="mx-list-item" v-for="(item, index) in dataList" :key="index">
                <view class="mx-list-item-a">
                    <text>{{item.remark || ''}}</text>
                    <text>{{((item.optType||1) * (item.amount||0)/100).toFixed(2) }}元</text>
                </view>
                <view class="mx-list-item-b">
                    <text>交易号:{{item.transactionNo || '-'}}</text>
                    <text v-if="item.status ==0">已到账</text>
                    <text v-if="item.status ==1">交易失败</text>
                    <text v-if="item.status ==2" class="redtxt">处理中</text>
                </view>
                <view class="mx-list-item-c">
                    {{item.createTime}}
                </view>
            </view>
            <view class="mx-list-item-d">
                <text v-if="!hasMore">{{loadTxt}}</text> 
            </view>
        </view>
    </view>
</template>
 
<script>
    export default { 
        data() {
            return {
                type: 1,
                list: [
                    { name: '全部', id: 1, optType:null },
                    { name: '收入', id: 2, optType:1 },
                    { name: '支出', id: 3 , optType:-1}
                ],
                searchForm:{
                    optType:null
                },
                capacity:10,
                page:1,
                hasMore: true,
                dataList:[],
                changing1:false,
                loadTxt:'已加载全部'
            };
        },
        onReachBottom() {
            if(this.hasMore){
                this.getPageData(this.page+1)
            }
            console.log("我被触发了")
        },
        onShow(){
            this.changeType(1,'')  
        },
        methods: {
            changeType(id,optType) {
                if(this.changing1){
                    return
                }
                this.type = id
                this.searchForm.optType = optType
                this.getPageData(1)
            },
            getPageData(page){
                this.page = page
                if(this.page ==1){
                    this.hasMore=true
                    this.dataList=[]
                }
                if(this.changing1){
                    return
                }
                this.changing1 = true
                var that = this
                var param ={
                    capacity:this.capacity,
                    page : this.page,
                    model:{
                        optType:this.searchForm.optType
                    }
                }
                that.$u.api.revenuePage(param)
                .then(res =>{
                    if(res.code ===200) {
                        if(res.data && res.data.records && res.data.records.length && res.data.page == that.page) { 
                            that.dataList = [...that.dataList,...(res.data.records)]
                        } 
                        if(that.dataList.length == (res.data.total||0)){
                            that.hasMore = false
                        }
                        if(res.data.total ==0){
                            that.loadTxt='未查询到记录'
                        }else{
                            that.loadTxt='已加载全部'
                        }
                    } 
                 }).finally(() => {
                    that.changing1 = false
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .mx {
        width: 100%;
        .mx-list {
            width: 100%;
            padding: 0 30rpx;
            box-sizing: border-box;
            .mx-list-item-d{
                padding: 20px;
                width: 100%;
                text-align: center;
                font-size: 24rpx;
                color: #999999;
            }
            .mx-list-item {
                width: 100%;
                height: 208rpx;
                display: flex;
                flex-direction: column;
                justify-content: space-evenly;
                border-bottom: 1rpx solid #E5E5E5;
                
                .mx-list-item-a {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    text {
                        &:nth-child(1) {
                            font-weight: 400;
                            font-size: 30rpx;
                            color: #222222;
                        }
                        &:nth-child(2) {
                            font-weight: 600;
                            font-size: 30rpx;
                            color: #222222;
                        }
                    }
                }
                .mx-list-item-b {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    text {
                        font-weight: 400;
                        font-size: 26rpx;
                        color: #999999;
                    }
                }
                .mx-list-item-c {
                    font-weight: 400;
                    font-size: 26rpx;
                    color: #999999;
                }
            }
        }
        .index-search {
            width: 100%;
            height: 100rpx;
            padding: 0 30rpx;
            position: sticky;
            left: 0;
            top: 0;
            z-index: 9;
            box-sizing: border-box;
            background-color: #FFFFFF;
            display: flex;
            align-items: center;
            border-bottom: 1rpx solid #E5E5E5;
            .active {
                text {
                    font-weight: 500 !important;
                    font-size: 32rpx !important;
                    color: #222222 !important;
                }
            }
            .index-search-item {
                flex: 1;
                height: 100%;
                display: flex;
                align-items: center;
                justify-content: center;
                position: relative;
                text {
                    font-weight: 400;
                    font-size: 30rpx;
                    color: #666666;
                }
                .index-search-item-x {
                    position: absolute;
                    bottom: 0;
                    left: 50%;
                    transform: translate(-50%, 0);
                    width: 40rpx;
                    height: 6rpx;
                    background: #00BC12;
                    border-radius: 3rpx;
                }
            }
        }
    }
    .redtxt{
        color: #FF0000 !important;
    }
</style>