index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="discount">
  3. <view class="pre_one">优惠劵({{couponList.length}}张)</view>
  4. <view class="pre_two" v-for="(item,index) in couponList" :key="index">
  5. <view class="left" v-if="item.discount_type=='min'">
  6. <view class="money">¥{{item.discount_config.min||'0'}}</view>
  7. <view v-if="item.discount_config.limit=='nolimit'" class="man">不限</view>
  8. <view v-else class="man">满{{item.discount_config.limit||'0'}}可用</view>
  9. </view>
  10. <view class="left" v-else-if="item.discount_type=='discount'">
  11. <view class="money">{{item.discount_config.min||'0'}}折</view>
  12. <view v-if="item.discount_config.limit=='nolimit'" class="man">不限</view>
  13. <view v-else class="man">满{{item.discount_config.limit||'0'}}可用,最多减{{item.discount_config.max||'0'}}元
  14. </view>
  15. </view>
  16. <view class="right">
  17. <view class="other">
  18. <view class="type"><text>{{item.discount_type_label||'暂无'}}</text>
  19. {{item.name||'暂无'}}
  20. </view>
  21. <view v-if="item.expire_type=='days'" class="date">{{item.expire_time||'暂无'}}天内有效</view>
  22. <view v-if="item.expire_type=='fixed'" class="date">{{item.expire_time||'暂无'}}</view>
  23. <view v-if="item.get_limit=='max'" class="date">
  24. {{item.use_limit_label||'暂无'}}-{{item.expire_type_label}}-{{item.get_limit_label||'暂无'}}领取{{item.get_limit_config.max}}张
  25. </view>
  26. <view v-if="item.get_limit=='nolimit'" class="date">
  27. {{item.use_limit_label||'暂无'}}-{{item.expire_type_label}}-{{item.get_limit_label||'暂无'}}
  28. </view>
  29. </view>
  30. <view class="btn">
  31. <button v-if="Style&&Style.btn||false" type="default" size="mini"
  32. @click="toDiscount(item)">确认</button>
  33. <button v-if="Style&&Style.status||false" type="default"
  34. size="mini">{{item.status=='0'?'未使用':item.status=='1'?'已使用':'已过期'}}</button>
  35. <button v-if="Style&&Style.receive||false" type="default" size="mini"
  36. @click="toReceive(item)">领取</button>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. props: {
  45. couponList: {
  46. type: Array,
  47. },
  48. Style: {
  49. type: Object,
  50. },
  51. },
  52. data() {
  53. return {
  54. };
  55. },
  56. methods: {
  57. // 选择优惠劵
  58. toDiscount(e) {
  59. const that = this;
  60. that.$emit('toDiscount', e)
  61. },
  62. // 领取优惠劵
  63. toReceive(e) {
  64. const that = this;
  65. that.$emit('toReceive', e)
  66. },
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. .discount {
  72. .pre_one {
  73. text-align: center;
  74. padding: 2vw 0;
  75. }
  76. .pre_two {
  77. display: flex;
  78. justify-content: space-between;
  79. align-items: center;
  80. width: 96vw;
  81. margin: 0 2vw 2vw 2vw;
  82. border-radius: 3vw;
  83. .left {
  84. text-align: center;
  85. border-radius: 3vw;
  86. padding: 6vw 3vw;
  87. background-color: #FFFACD;
  88. color: #8B4513;
  89. border-right: 0.5vw dashed var(--fcColor);
  90. .money {
  91. font-size: var(--font18Szie);
  92. font-weight: bold;
  93. }
  94. .man {
  95. font-size: var(--font14Size);
  96. }
  97. }
  98. .right {
  99. display: flex;
  100. justify-content: space-between;
  101. align-items: center;
  102. border-radius: 3vw;
  103. padding: 1.5vw 3vw;
  104. background-color: var(--mainColor);
  105. .other {
  106. display: flex;
  107. flex-direction: column;
  108. width: 46vw;
  109. .type {
  110. overflow: hidden;
  111. text-overflow: ellipsis;
  112. display: -webkit-box;
  113. line-height: 6vw;
  114. -webkit-line-clamp: 1;
  115. -webkit-box-orient: vertical;
  116. font-size: var(--font14Size);
  117. margin: 0 1vw 1vw 0;
  118. text {
  119. margin: 0 1vw 0 0;
  120. border: 0.5vw solid red;
  121. color: red;
  122. padding: 0 1vw;
  123. border-radius: 1vw;
  124. font-size: var(--font12Size);
  125. }
  126. }
  127. .date {
  128. overflow: hidden;
  129. text-overflow: ellipsis;
  130. display: -webkit-box;
  131. -webkit-line-clamp: 2;
  132. -webkit-box-orient: vertical;
  133. font-size: var(--font12Size);
  134. color: var(--f99Color);
  135. }
  136. }
  137. .btn {
  138. width: 20vw;
  139. button {
  140. background-color: #FFD700;
  141. font-weight: bold;
  142. }
  143. }
  144. }
  145. }
  146. }
  147. </style>