result.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view class="result-page">
  3. <view class="result-card">
  4. <view class="result-icon" :class="status === 'success' ? 'icon-success' : 'icon-fail'">
  5. <text>{{ status === 'success' ? '✓' : '✕' }}</text>
  6. </view>
  7. <text class="result-title">{{ status === 'success' ? '支付成功' : '支付未完成' }}</text>
  8. <text class="result-amount" v-if="amountText">支付金额:¥{{ amountText }}</text>
  9. <text class="result-order" v-if="orderNo">订单号:{{ orderNo }}</text>
  10. <button class="primary-btn" v-if="status === 'success'" @click="goList">查看我的报名</button>
  11. <button class="primary-btn" v-else @click="goPay">重新支付</button>
  12. <button class="ghost-btn" @click="goHome">返回首页</button>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import { fenToYuan } from '@/utils/format.js'
  18. import { guardPage } from '@/utils/guard.js'
  19. export default {
  20. data() {
  21. return {
  22. status: 'success',
  23. amount: 0,
  24. amountText: '',
  25. orderNo: ''
  26. }
  27. },
  28. onLoad(options) {
  29. if (!guardPage()) return
  30. this.status = options && options.status ? options.status : 'success'
  31. this.amount = options && options.amount ? Number(options.amount) : 0
  32. this.amountText = fenToYuan(this.amount)
  33. this.orderNo = options && options.orderNo ? options.orderNo : ''
  34. },
  35. methods: {
  36. goList() {
  37. uni.redirectTo({ url: '/pages/enroll/list' })
  38. },
  39. goPay() {
  40. uni.navigateBack({ delta: 1 })
  41. },
  42. goHome() {
  43. uni.switchTab({ url: '/pages/index/index' })
  44. }
  45. }
  46. }
  47. </script>
  48. <style scoped>
  49. .result-page { min-height: 100vh; background: #F5F5F5; padding: 32rpx; }
  50. .result-card { background: #FFF; border-radius: 16rpx; padding: 64rpx 32rpx; display: flex; flex-direction: column; align-items: center; }
  51. .result-icon { width: 120rpx; height: 120rpx; border-radius: 50%; color: #FFF; font-size: 72rpx; display: flex; align-items: center; justify-content: center; margin-bottom: 32rpx; }
  52. .icon-success { background: #22C55E; }
  53. .icon-fail { background: #EF4444; }
  54. .result-title { font-size: 36rpx; font-weight: 700; color: #2A2326; margin-bottom: 16rpx; }
  55. .result-amount { font-size: 28rpx; color: #475569; margin-bottom: 8rpx; }
  56. .result-order { font-size: 24rpx; color: #94877F; margin-bottom: 56rpx; }
  57. .primary-btn { width: 480rpx; height: 84rpx; line-height: 84rpx; background: #FC7A57; color: #FFF; font-size: 28rpx; font-weight: 600; border-radius: 42rpx; border: none; margin-bottom: 24rpx; }
  58. .primary-btn:active { opacity: 0.85; }
  59. .ghost-btn { width: 480rpx; height: 84rpx; line-height: 84rpx; background: #FFF; color: #5A4F4B; font-size: 28rpx; border-radius: 42rpx; border: 2rpx solid #E2E8F0; }
  60. .ghost-btn:active { opacity: 0.7; }
  61. </style>