activityCard.vue 3.7 KB

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