s-coupon-get.vue 2.6 KB

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