liujie
2026-08-21 ad5db85e540947e82c7a4d5612879b3b3ecdf459
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<template>
  <view class="withdrawal-page" :class="{ leaving: isLeaving }">
    <guide-nav-bar title="导游提现" @back="goBack" />
 
    <view class="balance-card">
      <text class="balance-label">当前可提</text>
      <text class="balance-amount">¥{{ availableText }}</text>
      <view class="withdraw-button" @tap="startWithdrawal">提现</view>
    </view>
 
    <view class="heading">
      <text>提现记录</text>
      <text>共 {{ total }} 条</text>
    </view>
 
    <scroll-view class="record-list" scroll-y>
      <view v-if="loading" class="state-text">正在加载</view>
      <view v-else-if="!records.length" class="state-text">暂无提现记录</view>
      <view v-for="item in records" :key="item.id" class="record">
        <view class="record-top">
          <text>提现</text>
          <text class="record-money">¥{{ formatMoney(item.amount) }}</text>
        </view>
        <view class="record-bottom">
          <text>{{ displayTime(item) }} {{ item.cardMasked || '' }}</text>
          <text :class="'status ' + statusClass(item.status)">{{ statusText(item.status) }}</text>
        </view>
        <text v-if="item.reason" class="reason">{{ item.reason }}</text>
      </view>
    </scroll-view>
  </view>
</template>
 
<script>
import GuideNavBar from '../../components/guide-nav-bar/guide-nav-bar.vue'
import { getOnboardingStatus } from '../../services/settlement'
import { getWithdrawals, getWithdrawalSummary } from '../../services/withdrawal'
import { backOrHome, routeTo } from '../../utils/router'
 
export default {
  components: {
    GuideNavBar
  },
  data() {
    return {
      loading: false,
      availableAmount: 0,
      records: [],
      total: 0,
      isLeaving: false
    }
  },
  computed: {
    availableText() {
      return this.formatMoney(this.availableAmount)
    }
  },
  onShow() {
    this.loadData()
  },
  methods: {
    goBack() {
      if (this.isLeaving) {
        return
      }
      this.isLeaving = true
      setTimeout(() => {
        backOrHome('/pages/earnings/index')
      }, 280)
    },
    startWithdrawal() {
      getOnboardingStatus().then((item) => {
        const status = (item && item.status) || 'unsubmitted'
        if (status === 'approved') {
          routeTo('/pages/withdrawal-detail/index')
          return
        }
        if (status === 'pending' || status === 'rejected') {
          routeTo('/pages/onboarding-pending/index')
          return
        }
        routeTo('/pages/onboarding/index')
      }).catch((error) => {
        uni.showToast({ title: (error && error.message) || '进件状态查询失败', icon: 'none' })
      })
    },
    loadData() {
      this.loading = true
      Promise.all([
        getWithdrawalSummary(),
        getWithdrawals()
      ]).then(([summary, page]) => {
        this.availableAmount = Number(summary && summary.availableAmount || 0)
        this.records = (page && page.records) || []
        this.total = Number(page && page.total || 0)
      }).catch((error) => {
        uni.showToast({ title: error.message || '提现记录加载失败', icon: 'none' })
      }).finally(() => {
        this.loading = false
      })
    },
    formatMoney(amount = 0) {
      return Number(amount || 0).toFixed(2)
    },
    formatTime(value) {
      return value ? String(value).replace('T', ' ').slice(0, 19) : ''
    },
    displayTime(item) {
      if (item.status === 'APPROVED' && item.processedAt) {
        return '到账 ' + this.formatTime(item.processedAt)
      }
      return this.formatTime(item.appliedAt)
    },
    statusText(status) {
      if (status === 'APPROVED') return '已到账'
      if (status === 'REJECTED') return '已驳回'
      if (status === 'PROCESSING') return '到账处理中'
      return '待审核'
    },
    statusClass(status) {
      if (status === 'APPROVED') return 'paid'
      if (status === 'REJECTED') return 'rejected'
      if (status === 'PROCESSING') return 'pending'
      return 'pending'
    }
  }
}
</script>
 
<style scoped>
.withdrawal-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f6f8fb;
  padding-bottom: env(safe-area-inset-bottom);
  animation: pageSlideIn 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
 
.withdrawal-page.leaving {
  animation: pageSlideOut 280ms cubic-bezier(0.4, 0, 1, 1) both;
}
 
@keyframes pageSlideIn {
  from { opacity: 0.35; transform: translateX(72rpx); }
  to { opacity: 1; transform: translateX(0); }
}
 
@keyframes pageSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0.2; transform: translateX(260rpx); }
}
 
.balance-card {
  margin: 28rpx 28rpx 0;
  padding: 36rpx 32rpx 32rpx;
  border: 1rpx solid #edf0f4;
  border-radius: 12rpx;
  background: #ffffff;
  text-align: center;
}
 
.balance-label {
  color: #667085;
  font-size: 26rpx;
}
 
.balance-amount {
  display: block;
  margin: 16rpx 0 28rpx;
  color: #1f3b5b;
  font-size: 56rpx;
  font-weight: 800;
  line-height: 1;
}
 
.withdraw-button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88rpx;
  border-radius: 12rpx;
  background: #4d8fe8;
  color: #ffffff;
  font-size: 30rpx;
  font-weight: 700;
}
 
.heading {
  display: flex;
  justify-content: space-between;
  padding: 36rpx 36rpx 18rpx;
  color: #1f3b5b;
  font-size: 30rpx;
  font-weight: 700;
}
 
.heading text:last-child {
  color: #a0a9b7;
  font-size: 24rpx;
  font-weight: 400;
}
 
.record-list {
  flex: 1;
  min-height: 0;
  padding: 0 28rpx 24rpx;
  box-sizing: border-box;
}
 
.record {
  padding: 26rpx 28rpx;
  margin-bottom: 16rpx;
  border: 1rpx solid #edf0f4;
  border-radius: 12rpx;
  background: #ffffff;
}
 
.record-top,
.record-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
 
.record-top {
  color: #1f2937;
  font-size: 28rpx;
  font-weight: 700;
}
 
.record-money {
  font-weight: 800;
}
 
.record-bottom {
  margin-top: 16rpx;
  color: #667085;
  font-size: 23rpx;
}
 
.status {
  font-weight: 700;
}
 
.pending {
  color: #e58b28;
}
 
.paid {
  color: #249765;
}
 
.rejected,
.reason {
  color: #e95b5b;
}
 
.reason {
  display: block;
  margin-top: 8rpx;
  font-size: 22rpx;
}
 
.state-text {
  padding-top: 120rpx;
  color: #8993a1;
  text-align: center;
  font-size: 28rpx;
}
</style>