鸿宇研学生前端代码
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.

148 lines
3.2 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. style: {
  39. type: String,
  40. default: ''
  41. }
  42. },
  43. computed: {
  44. product() {
  45. return this.data?.product || {}
  46. },
  47. productPackage() {
  48. const { time, product } = this.data
  49. const { timeOptions } = product || {}
  50. return timeOptions?.find?.(item => item.id === time) || {}
  51. },
  52. days() {
  53. console.log('productPackage', this.productPackage)
  54. const { startDate, endDate } = this.productPackage
  55. return this.$dayjs(endDate).diff(this.$dayjs(startDate), 'day')
  56. },
  57. },
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .card {
  62. width: 100%;
  63. padding: 32rpx;
  64. font-family: PingFang SC;
  65. font-weight: 400;
  66. line-height: 1.4;
  67. box-sizing: border-box;
  68. background: #FFFFFF;
  69. border-radius: 24rpx;
  70. &-header {
  71. font-family: PingFang SC;
  72. font-weight: 500;
  73. font-size: 32rpx;
  74. line-height: 1.4;
  75. color: #181818;
  76. }
  77. &-content {
  78. }
  79. }
  80. .row {
  81. margin-top: 16rpx;
  82. }
  83. .desc {
  84. font-size: 26rpx;
  85. color: #8B8B8B;
  86. }
  87. .tags {
  88. justify-content: flex-start;
  89. flex-wrap: wrap;
  90. gap: 16rpx;
  91. .tag {
  92. padding: 2rpx 14rpx;
  93. font-family: PingFang SC;
  94. font-weight: 400;
  95. font-size: 24rpx;
  96. line-height: 1.4;
  97. color: #00A9FF;
  98. background: #E9F8FF;
  99. border: 2rpx solid #00A9FF;
  100. border-radius: 8rpx;
  101. }
  102. }
  103. .time {
  104. justify-content: space-between;
  105. &-item {
  106. &-value {
  107. font-size: 32rpx;
  108. font-weight: 500;
  109. color: #000000;
  110. }
  111. &-label {
  112. margin-top: 4rpx;
  113. font-size: 26rpx;
  114. color: #8B8B8B;
  115. }
  116. }
  117. &-total {
  118. &-line {
  119. width: 64rpx;
  120. height: 2rpx;
  121. background: #8B8B8B;
  122. }
  123. &-value {
  124. padding: 6rpx 22rpx;
  125. font-size: 26rpx;
  126. color: #8B8B8B;
  127. border: 2rpx solid #8B8B8B;
  128. border-radius: 26rpx;
  129. }
  130. }
  131. }
  132. </style>