WXL
3 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
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
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
<template>
  <view class="refund-container">
    <!-- 订单信息 -->
    <view class="order-card">
      <view class="hospital-info">
        <image :src="order.hospitalLogo" mode="aspectFit" class="logo" />
        <view class="info">
          <text class="name">{{ order.hospitalName }}</text>
          <text class="department">{{ order.departmentName }}</text>
        </view>
      </view>
      
      <view class="amount-info">
        <text class="label">支付金额</text>
        <text class="amount">¥{{ order.amount }}</text>
      </view>
    </view>
    
    <!-- 退款表单 -->
    <view class="refund-form card">
      <view class="section-title">退款信息</view>
      
      <!-- 退款金额 -->
      <view class="form-item">
        <text class="label required">退款金额</text>
        <view class="amount-input">
          <text class="currency">¥</text>
          <input 
            type="digit" 
            v-model="refundAmount"
            :maxlength="10"
            placeholder="请输入退款金额"
          />
        </view>
        <text class="max-amount">最多可退 ¥{{ order.amount }}</text>
      </view>
      
      <!-- 退款原因 -->
      <view class="form-item">
        <text class="label required">退款原因</text>
        <picker 
          mode="selector" 
          :range="refundReasons" 
          range-key="label"
          @change="onReasonChange"
        >
          <view class="picker">
            <text>{{ selectedReason?.label || '请选择退款原因' }}</text>
            <text class="iconfont icon-arrow-right"></text>
          </view>
        </picker>
      </view>
      
      <!-- 退款说明 -->
      <view class="form-item">
        <text class="label">退款说明</text>
        <textarea 
          v-model="refundDesc"
          placeholder="请输入退款说明(选填)"
          :maxlength="200"
          class="desc-textarea"
        />
        <text class="word-count">{{ refundDesc.length }}/200</text>
      </view>
      
      <!-- 上传凭证 -->
      <view class="form-item">
        <text class="label">上传凭证</text>
        <view class="upload-list">
          <view 
            class="image-item"
            v-for="(image, index) in uploadImages"
            :key="index"
          >
            <image :src="image" mode="aspectFill" @tap="previewImage(index)" />
            <text class="delete" @tap.stop="deleteImage(index)">×</text>
          </view>
          <view 
            class="upload-btn"
            v-if="uploadImages.length < 3"
            @tap="chooseImage"
          >
            <text class="iconfont icon-add"></text>
            <text>上传图片</text>
          </view>
        </view>
        <text class="upload-tip">最多上传3张图片,每张不超过5MB</text>
      </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">退款申请提交后,工作人员将在1-3个工作日内进行审核</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 class="bottom-bar">
      <button 
        class="submit-btn primary-btn"
        :disabled="!canSubmit"
        @tap="submitRefund"
      >提交申请</button>
    </view>
  </view>
</template>
 
<script setup>
import { ref, computed } from 'vue'
 
// 订单信息
const order = ref({
  id: 1,
  hospitalName: '青岛镜湖医院',
  hospitalLogo: '/static/hospital/kiang-wu.jpg',
  departmentName: '心内科',
  amount: 360.00
})
 
// 退款金额
const refundAmount = ref('')
 
// 退款原因列表
const refundReasons = [
  { value: 1, label: '预约时间冲突' },
  { value: 2, label: '重复预约' },
  { value: 3, label: '身体原因无法就医' },
  { value: 4, label: '其他原因' }
]
const selectedReason = ref(null)
 
// 退款说明
const refundDesc = ref('')
 
// 上传图片
const uploadImages = ref([])
 
// 是否可以提交
const canSubmit = computed(() => {
  const amount = Number(refundAmount.value)
  return amount > 0 && 
    amount <= order.value.amount && 
    selectedReason.value
})
 
// 选择退款原因
const onReasonChange = (e) => {
  selectedReason.value = refundReasons[e.detail.value]
}
 
// 选择图片
const chooseImage = () => {
  uni.chooseImage({
    count: 3 - uploadImages.value.length,
    sizeType: ['compressed'],
    sourceType: ['album', 'camera'],
    success: (res) => {
      uploadImages.value.push(...res.tempFilePaths)
    }
  })
}
 
// 预览图片
const previewImage = (index) => {
  uni.previewImage({
    urls: uploadImages.value,
    current: index
  })
}
 
// 删除图片
const deleteImage = (index) => {
  uploadImages.value.splice(index, 1)
}
 
// 提交退款
const submitRefund = () => {
  if (!canSubmit.value) return
  
  uni.showModal({
    title: '确认提交',
    content: '确定要提交退款申请吗?',
    success: (res) => {
      if (res.confirm) {
        uni.showLoading({
          title: '提交中...'
        })
        
        // 这里调用退款API
        setTimeout(() => {
          uni.hideLoading()
          uni.showToast({
            title: '提交成功',
            icon: 'success'
          })
          setTimeout(() => {
            uni.navigateBack()
          }, 1500)
        }, 1000)
      }
    }
  })
}
</script>
 
<style lang="scss">
.refund-container {
  min-height: 100vh;
  background: $bg-color;
  padding-bottom: 120rpx;
  
  .order-card {
    background: #fff;
    padding: 30rpx;
    margin-bottom: 20rpx;
    
    .hospital-info {
      display: flex;
      align-items: center;
      margin-bottom: 20rpx;
      
      .logo {
        width: 80rpx;
        height: 80rpx;
        border-radius: $radius-sm;
        margin-right: 20rpx;
      }
      
      .info {
        flex: 1;
        
        .name {
          font-size: 32rpx;
          color: $text-primary;
          font-weight: bold;
          margin-bottom: 8rpx;
          display: block;
        }
        
        .department {
          font-size: 26rpx;
          color: $text-regular;
        }
      }
    }
    
    .amount-info {
      .label {
        font-size: 26rpx;
        color: $text-regular;
        margin-right: 12rpx;
      }
      
      .amount {
        font-size: 36rpx;
        color: $danger;
        font-weight: bold;
      }
    }
  }
  
  .refund-form {
    background: #fff;
    padding: 30rpx;
    margin-bottom: 20rpx;
    
    .form-item {
      margin-bottom: 30rpx;
      
      .label {
        font-size: 28rpx;
        color: $text-primary;
        margin-bottom: 16rpx;
        display: block;
        
        &.required::before {
          content: '*';
          color: $danger;
          margin-right: 4rpx;
        }
      }
      
      .amount-input {
        display: flex;
        align-items: center;
        height: 88rpx;
        background: $bg-color;
        border-radius: $radius-lg;
        padding: 0 30rpx;
        margin-bottom: 12rpx;
        
        .currency {
          font-size: 36rpx;
          color: $text-primary;
          margin-right: 12rpx;
        }
        
        input {
          flex: 1;
          height: 100%;
          font-size: 32rpx;
          color: $text-primary;
        }
      }
      
      .max-amount {
        font-size: 24rpx;
        color: $text-secondary;
      }
      
      .picker {
        height: 88rpx;
        background: $bg-color;
        border-radius: $radius-lg;
        padding: 0 30rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;
        
        text {
          font-size: 28rpx;
          color: $text-primary;
          
          &.icon-arrow-right {
            font-size: 24rpx;
            color: $text-secondary;
          }
        }
      }
      
      .desc-textarea {
        width: 100%;
        height: 200rpx;
        background: $bg-color;
        border-radius: $radius-lg;
        padding: 20rpx;
        font-size: 28rpx;
        margin-bottom: 12rpx;
      }
      
      .word-count {
        font-size: 24rpx;
        color: $text-secondary;
        text-align: right;
        display: block;
      }
      
      .upload-list {
        display: flex;
        flex-wrap: wrap;
        gap: 20rpx;
        margin-bottom: 12rpx;
        
        .image-item {
          position: relative;
          width: 160rpx;
          height: 160rpx;
          
          image {
            width: 100%;
            height: 100%;
            border-radius: $radius-sm;
          }
          
          .delete {
            position: absolute;
            top: -20rpx;
            right: -20rpx;
            width: 40rpx;
            height: 40rpx;
            line-height: 36rpx;
            text-align: center;
            background: rgba(0,0,0,0.5);
            border-radius: 50%;
            color: #fff;
            font-size: 32rpx;
          }
        }
        
        .upload-btn {
          width: 160rpx;
          height: 160rpx;
          background: $bg-color;
          border-radius: $radius-sm;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          
          .iconfont {
            font-size: 48rpx;
            color: $text-secondary;
            margin-bottom: 8rpx;
          }
          
          text {
            font-size: 24rpx;
            color: $text-secondary;
          }
        }
      }
      
      .upload-tip {
        font-size: 24rpx;
        color: $text-secondary;
      }
    }
  }
  
  .notice-card {
    background: #fff;
    padding: 30rpx;
    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: 12rpx;
          margin-right: 12rpx;
          flex-shrink: 0;
        }
        
        .content {
          flex: 1;
          font-size: 26rpx;
          color: $text-regular;
          line-height: 1.6;
        }
      }
    }
  }
  
  .bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20rpx 30rpx;
    background: #fff;
    box-shadow: $shadow-lg;
    
    .submit-btn {
      width: 100%;
      
      &[disabled] {
        opacity: 0.6;
      }
    }
  }
}
</style>