coupon.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view>
  3. <view>
  4. <scroll-view scroll-x class="bg-white nav text-center" style="height: 100vh;">
  5. <view :class="index==TabCur?'cu-item text-blue cur':'cu-item'" v-for="(item,index) in list" :key="index" @click="tabSelect"
  6. :data-id="index" style="">
  7. {{item.name}}
  8. <text v-if="index == 0">({{notUsed}})</text>
  9. <text v-if="index == 1">({{used}})</text>
  10. <text v-if="index == 2">({{invalid}})</text>
  11. </view>
  12. <view class="coupon-List" v-if="TabCur == 0">
  13. <view style="text-align: right;">
  14. <text>使用规则 ></text>
  15. </view>
  16. <view class="margin-top-sm">
  17. <view class="cu-list menu-avatar padding-tb-sm bg-white">
  18. <view class="cu-item" v-for="(item,index) in 5" :key="index">
  19. <view class="cu-avatar round lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/img/champion/Taric.png);">
  20. </view>
  21. <view class="content">
  22. <view class="text-grey">
  23. <text class="text-cut">九折卷</text>
  24. </view>
  25. <view class="text-gray text-sm flex">
  26. <text class="text-cut">满20元可用,优惠上限50元</text>
  27. </view>
  28. <view class="text-gray text-sm flex">
  29. <text class="text-cut">有效期:2020.01.01 11:00:00-2020.01.10 11:00:00</text>
  30. </view>
  31. </view>
  32. <view class="action">
  33. <!-- <view class="text-grey text-xs">22:20</view>
  34. <view class="cuIcon-notice_forbid_fill text-gray"></view> -->
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view v-else-if="TabCur == 1">
  41. </view>
  42. <view v-else="TabCur == 2">
  43. </view>
  44. </scroll-view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. mounted() {
  51. this.getCouponList()
  52. },
  53. data() {
  54. return {
  55. notUsed: 1, //未使用
  56. used: 2, //已使用
  57. invalid: 3, //过期
  58. TabCur: 0,
  59. list: [{
  60. name: '未使用',
  61. }, {
  62. name: '已使用',
  63. }, {
  64. name: '已过期',
  65. }],
  66. // 因为内部的滑动机制限制,请将tabs组件和swiper组件的current用不同变量赋值
  67. current: 0, // tabs组件的current值,表示当前活动的tab选项
  68. swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
  69. pageindex: 1,
  70. couponList:[]
  71. };
  72. },
  73. methods: {
  74. tabSelect(e) {
  75. this.TabCur = e.currentTarget.dataset.id
  76. console.log(this.TabCur)
  77. },
  78. getCouponList: async function() {
  79. let res = await this.$request.post("/api/v1/coupon/couponList", {
  80. page: this.pageindex
  81. })
  82. console.log(res)
  83. if(res.status == 0){
  84. this.couponList = res.data.data
  85. }
  86. }
  87. },
  88. onShow() {
  89. }
  90. };
  91. </script>
  92. <style>
  93. .coupon-List {
  94. height: 100%;
  95. width: 100%;
  96. background-color: #f9f9f9;
  97. padding: 20rpx 20rpx 0 20rpx;
  98. }
  99. /*卡片*/
  100. .u-card-wrap {
  101. background-color: $u-bg-color;
  102. padding: 1px;
  103. }
  104. .u-body-item {
  105. font-size: 32rpx;
  106. color: #333;
  107. padding: 20rpx 10rpx;
  108. }
  109. .u-body-item image {
  110. width: 120rpx;
  111. flex: 0 0 120rpx;
  112. height: 120rpx;
  113. border-radius: 8rpx;
  114. margin-left: 12rpx;
  115. }
  116. </style>