myCoupon.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view ref="container">
  3. <div class="coupon-list" v-if="couponsList.length > 0">
  4. <div class="item acea-row row-center-wrapper" v-for="(item, index) in couponsList" :key="index">
  5. <div class="money" >
  6. <image v-if="item.status==0" class="img" src="../../static/images/coupon1.png" mode="widthFix"></image>
  7. <image v-if="item.status!=0" class="img" src="../../static/images/coupon2.png" mode="widthFix"></image>
  8. <div style="z-index: 999;">
  9. ¥<span class="num">{{ item.couponPrice }}</span>
  10. </div>
  11. <div class="pic-num" >满{{ item.useMinPrice }}元可用</div>
  12. </div>
  13. <div class="text">
  14. <div class="condition line1">
  15. {{ item.couponTitle }}
  16. </div>
  17. <div class="data acea-row row-between-wrapper">
  18. <div >{{ item.limitTime }}到期</div>
  19. <div class="bnt gray" v-if="item.status==1" >已使用</div>
  20. <div class="bnt gray" v-if="item.status==-1" >已过期</div>
  21. <div class="bnt bg-color-red" v-if="item.status==0" >可使用</div>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. <view v-if="couponsList.length == 0" class="no-data-box" @click="getMyCouponList()">
  27. <image src="/static/images/no_data.png" mode="aspectFit"></image>
  28. <view class="empty-title">暂无数据</view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { getMyCouponList } from '@/api/coupon'
  34. export default {
  35. name: 'UserCoupon',
  36. props: {},
  37. data: function() {
  38. return {
  39. couponsList: [],
  40. loading: false,
  41. }
  42. },
  43. watch: {
  44. },
  45. mounted: function() {
  46. this.getUseCoupons()
  47. },
  48. onShow() {
  49. },
  50. methods: {
  51. getUseCoupons: function() {
  52. let that = this;
  53. var data={};
  54. getMyCouponList(data).then(res => {
  55. that.couponsList = res.data
  56. })
  57. },
  58. },
  59. }
  60. </script>
  61. <style lang="less" scoped>
  62. .container {
  63. height: 100%;
  64. }
  65. /*优惠券列表公共*/
  66. .coupon-list {
  67. padding: 0 0.3 * 100rpx;
  68. margin-top: 0.25 * 100rpx;
  69. box-sizing: border-box;
  70. }
  71. .coupon-list .item {
  72. width: 100%;
  73. height: 1.7 * 100rpx;
  74. margin-bottom: 0.16 * 100rpx;
  75. }
  76. .coupon-list .item .money {
  77. background-size: 100% 100%;
  78. width: 2.4 * 100rpx;
  79. height: 100%;
  80. color: #fff;
  81. font-size: 0.36 * 100rpx;
  82. font-weight: bold;
  83. text-align: center;
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. justify-content: center;
  88. position: relative;
  89. }
  90. .coupon-list .item .money .img{
  91. position: absolute;
  92. width: 2.4 * 100rpx;
  93. height: 100%;
  94. color: #fff;
  95. }
  96. .coupon-list .item .money .num {
  97. font-size: 0.6 * 100rpx;
  98. }
  99. .coupon-list .item .money .pic-num {
  100. font-size: 20rpx;
  101. z-index: 99;
  102. }
  103. .coupon-list .item .text {
  104. width: 4.5 * 100rpx;
  105. padding: 0 0.17 * 100rpx 0 0.24 * 100rpx;
  106. background-color: #fff;
  107. box-sizing: border-box;
  108. }
  109. .coupon-list .item .text .condition {
  110. font-size: 0.3 * 100rpx;
  111. color: #282828;
  112. height: 0.93 * 100rpx;
  113. line-height: 0.93 * 100rpx;
  114. border-bottom: 1px solid #f0f0f0;
  115. }
  116. .coupon-list .item .text .data {
  117. font-size: 0.2 * 100rpx;
  118. color: #999;
  119. height: 0.76 * 100rpx;
  120. }
  121. .coupon-list .item .text .data .bnt {
  122. width: 1.36 * 100rpx;
  123. height: 0.44 * 100rpx;
  124. border-radius: 0.22 * 100rpx;
  125. font-size: 0.22 * 100rpx;
  126. color: #fff;
  127. text-align: center;
  128. line-height: 0.44 * 100rpx;
  129. background-color: red;
  130. }
  131. .coupon-list .item .text .data .bnt.gray {
  132. background-color: #ccc;
  133. }
  134. </style>