detail.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  3. <!-- 加载中 -->
  4. <view class="loading" v-if="loading">
  5. <text>加载中...</text>
  6. </view>
  7. <!-- 计划详情 -->
  8. <template v-else-if="plan">
  9. <view class="header">
  10. <text class="title">{{ plan.title }}</text>
  11. <view class="status-badge" :class="'status-' + (plan.status || 0)">
  12. <text>{{ statusText(plan.status) }}</text>
  13. </view>
  14. </view>
  15. <view class="info-card" v-if="plan.description">
  16. <text class="info-label">计划说明</text>
  17. <text class="info-value">{{ plan.description }}</text>
  18. </view>
  19. <view class="info-card">
  20. <text class="info-label">成员</text>
  21. <text class="info-value">{{ plan.childName || '--' }}</text>
  22. </view>
  23. <view class="info-card" v-if="plan.guideName">
  24. <text class="info-label">规划师</text>
  25. <text class="info-value">{{ plan.guideName }}</text>
  26. </view>
  27. <view class="info-card">
  28. <text class="info-label">创建时间</text>
  29. <text class="info-value">{{ plan.createTime || '--' }}</text>
  30. </view>
  31. <!-- 计划条目 -->
  32. <view class="items-section" v-if="plan.items && plan.items.length > 0">
  33. <text class="section-title">计划内容</text>
  34. <view class="item-card" v-for="item in plan.items" :key="item.id">
  35. <view class="item-top">
  36. <text class="item-title">{{ item.title }}</text>
  37. <text class="item-status" v-if="item.completed">✅ 已完成</text>
  38. </view>
  39. <text class="item-desc" v-if="item.description">{{ item.description }}</text>
  40. </view>
  41. </view>
  42. </template>
  43. <!-- 空状态 -->
  44. <view class="empty" v-else>
  45. <text class="empty-icon">📋</text>
  46. <text class="empty-text">计划不存在</text>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import { getGuidePlanDetail } from '../../../utils/api.js'
  52. import fontScaleMixin from '@/mixins/font-scale.js'
  53. export default {
  54. mixins: [fontScaleMixin],
  55. data() {
  56. return {
  57. loading: false,
  58. plan: null
  59. }
  60. },
  61. onLoad: function(options) {
  62. if (options.planId) {
  63. this.planId = options.planId
  64. this.loadDetail()
  65. }
  66. },
  67. methods: {
  68. loadDetail: function() {
  69. if (!this.planId) return
  70. this.loading = true
  71. var self = this
  72. getGuidePlanDetail({ planId: this.planId }).then(function(res) {
  73. self.loading = false
  74. if (res.code === 200 && res.data) {
  75. self.plan = res.data
  76. }
  77. }).catch(function() {
  78. self.loading = false
  79. })
  80. },
  81. statusText: function(status) {
  82. var map = { 0: '待审核', 1: '进行中', 2: '已完成', 3: '已取消' }
  83. return map[status] || '未知'
  84. }
  85. }
  86. }
  87. </script>
  88. <style scoped lang="scss">
  89. .container { min-height: 100vh; background: $facade-fill-page; padding-bottom: $uni-space-lg; }
  90. .loading, .empty { display: flex; flex-direction: column; align-items: center; padding: 100rpx 0; }
  91. .empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); }
  92. .empty-text { font-size: calc(30rpx * var(--font-scale, 1)); color: $facade-text-body; margin-top: 20rpx; }
  93. .header { background: $app-surface; padding: 40rpx $uni-space-page; display: flex; justify-content: space-between; align-items: center; }
  94. .title { font-size: calc(36rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; flex: 1; }
  95. .status-badge { font-size: calc(24rpx * var(--font-scale, 1)); padding: 6rpx 20rpx; border-radius: 24rpx; }
  96. .status-0 { background: $fortune-1-tint; color: $brand-primary; }
  97. .status-1 { background: $mat-green-tint; color: $mat-green; }
  98. .status-2 { background: $mat-blue-tint; color: $mat-blue-base; }
  99. .status-3 { background: $facade-fill-2; color: $facade-text-muted; }
  100. .info-card { background: $app-surface; margin: 20rpx $uni-space-lg; padding: 24rpx $uni-space-page; border-radius: 16rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  101. .info-label { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-muted; display: block; margin-bottom: 8rpx; }
  102. .info-value { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-strong; display: block; }
  103. .items-section { margin: 20rpx $uni-space-lg; }
  104. .section-title { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; display: block; margin-bottom: 16rpx; }
  105. .item-card { background: $app-surface; border-radius: 16rpx; padding: 24rpx; margin-bottom: 16rpx; box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04); }
  106. .item-top { display: flex; justify-content: space-between; align-items: center; }
  107. .item-title { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; }
  108. .item-status { font-size: calc(24rpx * var(--font-scale, 1)); color: $mat-green; }
  109. .item-desc { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-body; margin-top: 10rpx; display: block; line-height: 1.5; }
  110. </style>