鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.1 KiB

  1. <template>
  2. <view class="card info">
  3. <view class="card-header">{{ product.name }}</view>
  4. <view class="card-content">
  5. <view class="row desc">{{ product.desc }}</view>
  6. <view class="flex row tags" v-if="product.tags && product.tags.length">
  7. <view class="tag" v-for="(tag, tIdx) in product.tags" :key="tIdx">
  8. {{ tag }}
  9. </view>
  10. </view>
  11. <view class="flex row time">
  12. <view class="time-item">
  13. <view class="time-item-value">{{ $dayjs(productPackage.startDate).format('MM月DD日') }}</view>
  14. <view class="time-item-label">出发日期</view>
  15. </view>
  16. <view class="flex time-total">
  17. <view class="time-total-line"></view>
  18. <view class="time-total-value">{{ `${days}` }}</view>
  19. <view class="time-total-line"></view>
  20. </view>
  21. <view class="time-item">
  22. <view class="time-item-value">{{ $dayjs(productPackage.endDate).format('MM月DD日') }}</view>
  23. <view class="time-item-label">结束日期</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. props: {
  32. data: {
  33. type: Object,
  34. default() {
  35. return {}
  36. }
  37. },
  38. },
  39. computed: {
  40. product() {
  41. return this.data?.product || {}
  42. },
  43. productPackage() {
  44. const { time, product } = this.data
  45. const { timeOptions } = product || {}
  46. return timeOptions?.find?.(item => item.id === time) || {}
  47. },
  48. days() {
  49. console.log('productPackage', this.productPackage)
  50. const { startDate, endDate } = this.productPackage
  51. return this.$dayjs(endDate).diff(this.$dayjs(startDate), 'day')
  52. },
  53. },
  54. }
  55. </script>
  56. <style scoped lang="scss">
  57. .card {
  58. width: 100%;
  59. padding: 32rpx;
  60. font-family: PingFang SC;
  61. font-weight: 400;
  62. line-height: 1.4;
  63. box-sizing: border-box;
  64. background: #FFFFFF;
  65. border-radius: 24rpx;
  66. &-header {
  67. font-family: PingFang SC;
  68. font-weight: 500;
  69. font-size: 32rpx;
  70. line-height: 1.4;
  71. color: #181818;
  72. }
  73. &-content {
  74. }
  75. }
  76. .row {
  77. margin-top: 16rpx;
  78. }
  79. .desc {
  80. font-size: 26rpx;
  81. color: #8B8B8B;
  82. }
  83. .tags {
  84. justify-content: flex-start;
  85. flex-wrap: wrap;
  86. gap: 16rpx;
  87. .tag {
  88. padding: 2rpx 14rpx;
  89. font-family: PingFang SC;
  90. font-weight: 400;
  91. font-size: 24rpx;
  92. line-height: 1.4;
  93. color: #00A9FF;
  94. background: #E9F8FF;
  95. border: 2rpx solid #00A9FF;
  96. border-radius: 8rpx;
  97. }
  98. }
  99. .time {
  100. justify-content: space-between;
  101. &-item {
  102. &-value {
  103. font-size: 32rpx;
  104. font-weight: 500;
  105. color: #000000;
  106. }
  107. &-label {
  108. margin-top: 4rpx;
  109. font-size: 26rpx;
  110. color: #8B8B8B;
  111. }
  112. }
  113. &-total {
  114. &-line {
  115. width: 64rpx;
  116. height: 2rpx;
  117. background: #8B8B8B;
  118. }
  119. &-value {
  120. padding: 6rpx 22rpx;
  121. font-size: 26rpx;
  122. color: #8B8B8B;
  123. border: 2rpx solid #8B8B8B;
  124. border-radius: 26rpx;
  125. }
  126. }
  127. }
  128. </style>