s-coupon-get.vue 2.4 KB

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