activityCard.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="activity-card-main u-flex u-col-top"
  3. @click.stop="clickCard">
  4. <image class="card-image"
  5. lazy-load
  6. :src="value.imgs | imgFilter(2)"
  7. mode="aspectFill"></image>
  8. <view class="u-flex-1 u-m-l-16 u-p-t-4">
  9. <view class="card-title u-font-28 bold u-line-1">{{value.title}}</view>
  10. <view class="card-desc u-flex u-content-color u-m-t-4 u-m-b-12">
  11. <view>平台:{{value.plat_type | platFilter}}</view>
  12. <view class="u-font-22 line-32 u-flex-1">({{value.start_time | timeFilter(this)}}---{{value.end_time | timeFilter(this)}})</view>
  13. <view v-if="value.distance">{{(value.distance / 1000).toFixed(1)}}km</view>
  14. <view v-else>距离&gt;99km</view>
  15. </view>
  16. <view class="card-footer u-flex u-col-bottom">
  17. <view class="u-flex-1 u-col-bottom">
  18. <view class="u-content-color u-p-b-12">{{value.activity_type === 2 ? '门槛:' + (value.floor_price / 100).toFixed(2) + '元' : ''}}</view>
  19. <view class="u-flex u-flex-1 u-col-bottom">
  20. <view class="u-content-color line-34">返利</view>
  21. <block v-if="value.activity_type * 1 === 1">
  22. <view class="u-m-l-8 u-primary-color u-font-32 line-44 bold">实付全返</view>
  23. </block>
  24. <block v-if="value.activity_type * 1 === 2">
  25. <view class="u-m-l-8 u-flex u-col-bottom">
  26. <text class="u-primary-color u-font-24 line-34 bold">¥</text>
  27. <text class="u-primary-color u-font-36 line-44 bold">{{(value.rebate_amount / 100).toFixed(2)}}</text>
  28. </view>
  29. </block>
  30. </view>
  31. </view>
  32. <view>
  33. <block v-if="status * 1 === 1">
  34. <view class="u-primary-color u-text-center u-font-20 line-28">剩余{{value.join_count - value.join_number}}</view>
  35. <button class="join-btn u-m-t-2 u-font-22 line-32"
  36. @click.stop="signUp">参与报名</button>
  37. </block>
  38. <block v-if="status * 1 === 2">
  39. <image class="already-img"
  40. src="../static/common/icon_bq_ybm.png"
  41. @click.stop="clickYBM"></image>
  42. </block>
  43. <block v-if="status * 1 === 3">
  44. <image class="already-img"
  45. src="../static/common/icon_bq_yqg.png"
  46. @click.stop="clickYQG"></image>
  47. </block>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. props: {
  56. value: {
  57. type: Object,
  58. default: () => { }
  59. }
  60. },
  61. computed: {
  62. status () {
  63. if (this.value.join_status === 1 || this.value.join_status === 2 || this.value.join_status === 3 || this.value.join_status === 4) {
  64. return 2
  65. } else if (this.value.join_count === this.value.join_number) {
  66. return 3
  67. } else {
  68. return 1
  69. }
  70. }
  71. },
  72. methods: {
  73. clickCard () {
  74. this.$emit('click-card', this.value)
  75. },
  76. signUp () {
  77. this.$emit('sign-up', this.value)
  78. },
  79. clickYBM () {
  80. this.$emit('click-ybm', this.value)
  81. },
  82. clickYQG () {
  83. this.$emit('click-yqg', this.value)
  84. }
  85. },
  86. filters: {
  87. platFilter (e) {
  88. const platText = {
  89. 8: '饿了么',
  90. 9: '美团'
  91. }
  92. return platText[e]
  93. },
  94. timeFilter (time, el) {
  95. return el.$dayjs(`${el.$dayjs().format('YYYY-MM-DD')} ${time}`).format('HH:mm')
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .activity-card-main {
  102. .card-image {
  103. width: 180px;
  104. height: 180px;
  105. border-radius: 12px;
  106. }
  107. .card-title {
  108. max-width: 498px;
  109. @include lineHeight(20px);
  110. }
  111. .card-desc {
  112. @include lineHeight(17px);
  113. }
  114. .join-btn {
  115. box-sizing: border-box;
  116. padding: 10px 16px;
  117. width: 120px;
  118. height: 50px;
  119. border-radius: 26px;
  120. color: #fff;
  121. background-color: $u-type-primary;
  122. }
  123. .already-img {
  124. width: 76px;
  125. height: 76px;
  126. vertical-align: bottom;
  127. }
  128. }
  129. </style>