index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="main">
  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">
  6. <view class="money">¥{{item.money||'0'}}</view>
  7. <view class="man">满{{item.discount_money||'0'}}可以</view>
  8. </view>
  9. <view class="right">
  10. <view class="other">
  11. <view class="type"><text>{{item.type||'暂无'}}</text> {{item.coupon.name||'暂无'}}</view>
  12. <view class="date">有效期{{item.start_time||'暂无'}}-{{item.end_time||'暂无'}}</view>
  13. </view>
  14. <view class="btn">
  15. <button v-if="Style&&Style.btn||false" type="default" size="mini"
  16. @click="toDiscount(item)">确认</button>
  17. <button v-else type="default" size="mini">{{item.status=='0'?'未使用':item.status=='1'?'已使用':'已过期'}}</button>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. props: {
  26. couponList: {
  27. type: Array,
  28. },
  29. Style: {
  30. type: Object,
  31. },
  32. },
  33. data() {
  34. return {
  35. };
  36. },
  37. methods: {
  38. // 选择优惠劵
  39. toDiscount(e) {
  40. const that = this;
  41. that.$emit('toDiscount', e)
  42. },
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. .main {
  48. .pre_one {
  49. text-align: center;
  50. padding: 2vw 0;
  51. }
  52. .pre_two {
  53. display: flex;
  54. justify-content: space-between;
  55. align-items: center;
  56. width: 96vw;
  57. margin: 0 2vw 2vw 2vw;
  58. border-radius: 3vw;
  59. .left {
  60. text-align: center;
  61. border-radius: 3vw;
  62. padding: 5vw 3vw;
  63. background-color: #FFFACD;
  64. color: #8B4513;
  65. .money {
  66. font-size: var(--font18Szie);
  67. font-weight: bold;
  68. }
  69. .man {
  70. font-size: var(--font14Size);
  71. }
  72. }
  73. .right {
  74. display: flex;
  75. justify-content: space-between;
  76. align-items: center;
  77. flex-grow: 1;
  78. border-radius: 3vw;
  79. padding: 5vw 3vw;
  80. background-color: var(--mainColor);
  81. .other {
  82. display: flex;
  83. flex-direction: column;
  84. width: 50vw;
  85. .type {
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. display: -webkit-box;
  89. line-height: 6vw;
  90. -webkit-line-clamp: 1;
  91. -webkit-box-orient: vertical;
  92. font-size: var(--font14Size);
  93. margin: 0 1vw 1vw 0;
  94. text {
  95. margin: 0 1vw 0 0;
  96. border: 0.5vw solid red;
  97. color: red;
  98. padding: 0 1vw;
  99. border-radius: 1vw;
  100. font-size: var(--font12Size);
  101. }
  102. }
  103. .date {
  104. font-size: var(--font12Size);
  105. color: var(--f99Color);
  106. }
  107. }
  108. .btn {
  109. width: 20vw;
  110. button {
  111. background-color: #FFD700;
  112. font-weight: bold;
  113. }
  114. }
  115. }
  116. }
  117. }
  118. </style>