WXL
2025-12-27 05e6b08007a86b5b10c680babc9c3bcc3a1a201b
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<template>
  <view class="payment-method">
    <!-- 银行卡列表 -->
    <view class="section-card">
      <view class="section-header">
        <text class="title">我的银行卡</text>
        <text class="add-btn" @tap="addBankCard">添加银行卡</text>
      </view>
      <view class="card-list">
        <view 
          class="bank-card"
          v-for="(card, index) in bankCards"
          :key="index"
          :class="card.type"
        >
          <view class="card-info">
            <image :src="card.logo" mode="aspectFit" class="bank-logo" />
            <view class="info">
              <text class="bank-name">{{ card.bankName }}</text>
              <text class="card-type">{{ card.cardType }}</text>
            </view>
          </view>
          <text class="card-number">**** **** **** {{ card.lastFour }}</text>
          <view class="card-actions">
            <text class="default-tag" v-if="card.isDefault">默认</text>
            <view class="action-btns">
              <text 
                class="action-btn"
                v-if="!card.isDefault"
                @tap="setDefault(card)"
              >设为默认</text>
              <text 
                class="action-btn"
                @tap="unbindCard(card)"
              >解除绑定</text>
            </view>
          </view>
        </view>
      </view>
    </view>
    
    <!-- 其他支付方式 -->
    <view class="section-card">
      <view class="section-header">
        <text class="title">其他支付方式</text>
      </view>
      <view class="payment-list">
        <view 
          class="payment-item"
          v-for="(payment, index) in paymentMethods"
          :key="index"
          @tap="togglePayment(payment)"
        >
          <view class="payment-info">
            <image :src="payment.icon" mode="aspectFit" class="payment-icon" />
            <view class="info">
              <text class="name">{{ payment.name }}</text>
              <text class="desc">{{ payment.desc }}</text>
            </view>
          </view>
          <switch 
            :checked="payment.enabled"
            color="#0f95b0"
            @change="e => togglePayment(payment, e.detail.value)"
          />
        </view>
      </view>
    </view>
    
    <!-- 温馨提示 -->
    <view class="notice-card">
      <view class="section-title">温馨提示</view>
      <view class="notice-list">
        <view class="notice-item">
          <text class="dot"></text>
          <text class="content">为保障资金安全,请使用本人银行卡</text>
        </view>
        <view class="notice-item">
          <text class="dot"></text>
          <text class="content">银行卡信息已进行加密保护</text>
        </view>
        <view class="notice-item">
          <text class="dot"></text>
          <text class="content">如遇支付问题,请联系客服:+853 2837 1333</text>
        </view>
      </view>
    </view>
  </view>
</template>
 
<script setup>
import { ref } from 'vue'
 
// 银行卡列表
const bankCards = ref([
  {
    id: 1,
    bankName: '中国银行(青岛)',
    cardType: '储蓄卡',
    lastFour: '8888',
    type: 'bocm',
    logo: '/static/payment/bocm.png',
    isDefault: true
  },
  {
    id: 2,
    bankName: '工商银行(青岛)',
    cardType: '储蓄卡',
    lastFour: '6666',
    type: 'icbcm',
    logo: '/static/payment/icbcm.png',
    isDefault: false
  }
])
 
// 其他支付方式
const paymentMethods = ref([
  {
    id: 1,
    name: '支付宝国际版',
    desc: '支持青岛元/港币/人民币支付',
    icon: '/static/payment/alipay.png',
    enabled: true
  },
  {
    id: 2,
    name: 'MPay青岛钱包',
    desc: '青岛本地移动支付工具',
    icon: '/static/payment/mpay.png',
    enabled: true
  },
  {
    id: 3,
    name: 'BOC Pay',
    desc: '中银青岛手机支付',
    icon: '/static/payment/bocpay.png',
    enabled: false
  },
  {
    id: 4,
    name: 'WeChat Pay HK',
    desc: '支持港币/青岛元支付',
    icon: '/static/payment/wechat.png',
    enabled: true
  }
])
 
// 添加银行卡
const addBankCard = () => {
  uni.navigateTo({
    url: '/pages/my/add-bank-card'
  })
}
 
// 设为默认卡
const setDefault = (card) => {
  uni.showModal({
    title: '提示',
    content: '确定要将该卡设为默认支付卡吗?',
    success: (res) => {
      if (res.confirm) {
        // 这里调用设置默认API
        bankCards.value.forEach(item => {
          item.isDefault = item.id === card.id
        })
        uni.showToast({
          title: '设置成功',
          icon: 'success'
        })
      }
    }
  })
}
 
// 解除绑定
const unbindCard = (card) => {
  if (card.isDefault) {
    uni.showToast({
      title: '默认卡不能解绑',
      icon: 'none'
    })
    return
  }
  
  uni.showModal({
    title: '提示',
    content: '确定要解除该银行卡绑定吗?',
    success: (res) => {
      if (res.confirm) {
        // 这里调用解绑API
        const index = bankCards.value.findIndex(item => item.id === card.id)
        if (index > -1) {
          bankCards.value.splice(index, 1)
          uni.showToast({
            title: '解绑成功',
            icon: 'success'
          })
        }
      }
    }
  })
}
 
// 切换支付方式
const togglePayment = (payment, value) => {
  if (typeof value === 'undefined') {
    value = !payment.enabled
  }
  
  // 这里调用开启/关闭API
  payment.enabled = value
  uni.showToast({
    title: value ? '已开启' : '已关闭',
    icon: 'success'
  })
}
</script>
 
<style lang="scss">
.payment-method {
  min-height: 100vh;
  background: $bg-color;
  padding: 20rpx;
  
  .section-card {
    background: #fff;
    border-radius: $radius-lg;
    padding: 30rpx;
    margin-bottom: 20rpx;
    
    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20rpx;
      
      .title {
        font-size: 32rpx;
        color: $text-primary;
        font-weight: bold;
      }
      
      .add-btn {
        font-size: 28rpx;
        color: $primary-color;
        
        &:active {
          opacity: 0.8;
        }
      }
    }
    
    .card-list {
      .bank-card {
        background: $primary-gradient;
        border-radius: $radius-lg;
        padding: 30rpx;
        margin-bottom: 20rpx;
        color: #fff;
        
        &:last-child {
          margin-bottom: 0;
        }
        
        &.bocm {
          background: linear-gradient(135deg, #D4237A, #FF6B6B);
        }
        
        &.icbcm {
          background: linear-gradient(135deg, #FF8C00, #FFB74D);
        }
        
        .card-info {
          display: flex;
          align-items: center;
          margin-bottom: 30rpx;
          
          .bank-logo {
            width: 60rpx;
            height: 60rpx;
            margin-right: 16rpx;
          }
          
          .info {
            .bank-name {
              font-size: 32rpx;
              font-weight: bold;
              margin-bottom: 4rpx;
              display: block;
            }
            
            .card-type {
              font-size: 24rpx;
              opacity: 0.9;
            }
          }
        }
        
        .card-number {
          font-size: 36rpx;
          font-family: monospace;
          letter-spacing: 4rpx;
          margin-bottom: 30rpx;
          display: block;
        }
        
        .card-actions {
          display: flex;
          justify-content: space-between;
          align-items: center;
          
          .default-tag {
            font-size: 24rpx;
            padding: 4rpx 12rpx;
            background: rgba(255,255,255,0.2);
            border-radius: $radius-sm;
          }
          
          .action-btns {
            display: flex;
            gap: 20rpx;
            
            .action-btn {
              font-size: 24rpx;
              padding: 4rpx 12rpx;
              background: rgba(255,255,255,0.2);
              border-radius: $radius-sm;
              
              &:active {
                opacity: 0.8;
              }
            }
          }
        }
      }
    }
    
    .payment-list {
      .payment-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20rpx 0;
        border-bottom: 1rpx solid #eee;
        
        &:last-child {
          border-bottom: none;
        }
        
        .payment-info {
          display: flex;
          align-items: center;
          
          .payment-icon {
            width: 80rpx;
            height: 80rpx;
            margin-right: 20rpx;
          }
          
          .info {
            .name {
              font-size: 30rpx;
              color: $text-primary;
              margin-bottom: 4rpx;
              display: block;
            }
            
            .desc {
              font-size: 24rpx;
              color: $text-secondary;
            }
          }
        }
      }
    }
  }
  
  .notice-card {
    background: #fff;
    border-radius: $radius-lg;
    padding: 30rpx;
    
    .section-title {
      font-size: 30rpx;
      color: $text-primary;
      font-weight: bold;
      margin-bottom: 20rpx;
    }
    
    .notice-list {
      .notice-item {
        display: flex;
        align-items: flex-start;
        margin-bottom: 16rpx;
        
        &:last-child {
          margin-bottom: 0;
        }
        
        .dot {
          width: 12rpx;
          height: 12rpx;
          background: $primary-color;
          border-radius: 50%;
          margin-top: 8rpx;
          margin-right: 12rpx;
          flex-shrink: 0;
        }
        
        .content {
          flex: 1;
          font-size: 26rpx;
          color: $text-regular;
          line-height: 1.6;
        }
      }
    }
  }
}
</style>