get-coupon.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="get-coupon" :style="[wrapStyle]">
  3. <view class="coupons flex bg-white" @tap="showCoupon=true" v-if="list.length">
  4. <view class="text muted">领券</view>
  5. <view class="flex-1 flex">
  6. <view class="con flex flex-1">
  7. <view v-for="(item, index) in list" :key="index" class="coupons-item m-r-20">
  8. <view v-if="index < 2" class="flex xs">
  9. <view class="line-1">
  10. {{ item.condition_type_desc }}
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. <u-icon name="arrow-right"></u-icon>
  16. </view>
  17. </view>
  18. <!-- 领券 -->
  19. <u-popup v-model="showCoupon" closeable mode="bottom" border-radius="14">
  20. <view>
  21. <view class="p-30">
  22. <view class="title md bold">领券</view>
  23. </view>
  24. <view class="content bg-body">
  25. <scroll-view scroll-y="true" style="height: 700rpx">
  26. <coupon-list :list="list" @refresh="getGoodsCouponFun" :btn-type="3"></coupon-list>
  27. </scroll-view>
  28. </view>
  29. </view>
  30. </u-popup>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. getCouponList
  36. } from '@/api/activity';
  37. export default {
  38. name: "get-coupon",
  39. props: {
  40. goodsId: {
  41. type: [Number, String]
  42. },
  43. shopId: {
  44. type: [Number, String]
  45. },
  46. type: {
  47. type: String
  48. },
  49. wrapStyle: Object
  50. },
  51. data() {
  52. return {
  53. showCoupon: false,
  54. list: []
  55. };
  56. },
  57. watch: {
  58. goodsId(val) {
  59. this.getGoodsCouponFun()
  60. },
  61. shopId() {
  62. this.getGoodsCouponFun()
  63. }
  64. },
  65. methods: {
  66. async getGoodsCouponFun() {
  67. console.log(this.goodsId)
  68. const {
  69. data,
  70. code
  71. } = await getCouponList({
  72. goods_id: this.goodsId,
  73. shop_id: this.shopId
  74. });
  75. console.log(data)
  76. if (code == 1) {
  77. this.list = data.lists;
  78. }
  79. },
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .get-coupon {
  85. .coupons {
  86. padding: 24rpx 24rpx;
  87. .text {
  88. width: 100rpx;
  89. flex: none;
  90. }
  91. .con {
  92. width: 400rpx;
  93. }
  94. .coupons-item {
  95. overflow: hidden;
  96. &>view {
  97. position: relative;
  98. height: 40rpx;
  99. line-height: 40rpx;
  100. padding: 0 18rpx;
  101. border-radius: 6rpx;
  102. box-sizing: border-box;
  103. background-color: $-color-primary;
  104. color: #fff;
  105. white-space: nowrap;
  106. overflow: hidden;
  107. &::after,
  108. &::before {
  109. content: '';
  110. display: block;
  111. width: 20rpx;
  112. height: 20rpx;
  113. position: absolute;
  114. left: -14rpx;
  115. background-color: #fff;
  116. border-radius: 50%;
  117. border: 1px solid currentColor;
  118. box-sizing: border-box;
  119. }
  120. &::after {
  121. right: -14rpx;
  122. left: auto;
  123. }
  124. }
  125. }
  126. }
  127. }
  128. </style>