s-coupon-get.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!-- 商品详情 - 优惠劵领取 -->
  2. <template>
  3. <su-popup
  4. :show="show"
  5. type="bottom"
  6. round="20"
  7. @close="emits('close')"
  8. showClose
  9. backgroundColor="#f2f2f2"
  10. >
  11. <view class="model-box">
  12. <view class="title ss-m-t-16 ss-m-l-20 ss-flex">优惠券</view>
  13. <scroll-view
  14. class="model-content"
  15. scroll-y
  16. :scroll-with-animation="false"
  17. :enable-back-to-top="true"
  18. >
  19. <view class="subtitle ss-m-l-20">可使用优惠券</view>
  20. <view v-for="item in state.couponInfo" :key="item.id">
  21. <s-coupon-list :data="item">
  22. <template #default>
  23. <button
  24. class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
  25. :class="!item.canTake ? 'boder-btn' : ''"
  26. @click.stop="getBuy(item.id)"
  27. :disabled="!item.canTake"
  28. >
  29. {{ item.canTake ? '立即领取' : '已领取' }}
  30. </button>
  31. </template>
  32. </s-coupon-list>
  33. </view>
  34. </scroll-view>
  35. </view>
  36. </su-popup>
  37. </template>
  38. <script setup>
  39. import { computed, reactive } from 'vue';
  40. const props = defineProps({
  41. modelValue: {
  42. type: Object,
  43. default() {},
  44. },
  45. show: {
  46. type: Boolean,
  47. default: false,
  48. },
  49. });
  50. const emits = defineEmits(['get', 'close']);
  51. const state = reactive({
  52. couponInfo: computed(() => props.modelValue)
  53. });
  54. // 领取优惠劵
  55. const getBuy = (id) => {
  56. emits('get', id);
  57. };
  58. </script>
  59. <style lang="scss" scoped>
  60. .model-box {
  61. height: 60vh;
  62. .title {
  63. font-size: 36rpx;
  64. height: 80rpx;
  65. font-weight: bold;
  66. color: #333333;
  67. }
  68. .subtitle {
  69. font-size: 26rpx;
  70. font-weight: 500;
  71. color: #333333;
  72. }
  73. }
  74. .model-content {
  75. height: 54vh;
  76. }
  77. .modal-footer {
  78. width: 100%;
  79. height: 120rpx;
  80. background: #fff;
  81. }
  82. .confirm-btn {
  83. width: 710rpx;
  84. margin-left: 20rpx;
  85. height: 80rpx;
  86. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  87. border-radius: 40rpx;
  88. color: #fff;
  89. }
  90. // 优惠券按钮
  91. .card-btn {
  92. // width: 144rpx;
  93. padding: 0 16rpx;
  94. height: 50rpx;
  95. border-radius: 40rpx;
  96. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  97. color: #ffffff;
  98. font-size: 24rpx;
  99. font-weight: 400;
  100. }
  101. .boder-btn {
  102. background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light));
  103. color: #fff !important;
  104. }
  105. </style>