sh-select-coupon.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="select-coupon-wrap ">
  3. <view class="coupon-item u-flex u-row-between">
  4. <view class="item-title">优惠券</view>
  5. <view class="u-flex" @tap="showModal = true">
  6. <text class="price" v-if="couponList.length">{{ title }}</text>
  7. <text class="sel-coupon" v-else>暂无优惠券</text>
  8. <text class="u-iconfont uicon-arrow-right" style="color: #bfbfbf"></text>
  9. </view>
  10. </view>
  11. <u-popup v-model="showModal" mode="bottom" :closeable="true" close-icon-pos="top-right" border-radius="30">
  12. <view class="modal-box page_box">
  13. <view class="modal-head u-flex u-row-center u-col-center"><text class="head-title">选择优惠券</text></view>
  14. <view class="modal-content content_box u-flex-col u-p-20">
  15. <u-radio-group v-model="radio" @change="radioGroupChange" width="100%" activeColor="#e9b564">
  16. <view class="radio-item">
  17. <u-radio :name="0"><text class="coupon-title u-p-l-10">不使用优惠券</text></u-radio>
  18. </view>
  19. <view class="radio-item" v-for="(radio, index) in couponList" :key="radio.user_coupons_id">
  20. <u-radio :name="index + 1">
  21. <text class="coupon-title u-p-l-10">{{ radio.name }}:{{ `满${radio.enough}减${radio.amount}` }}</text>
  22. </u-radio>
  23. </view>
  24. </u-radio-group>
  25. </view>
  26. <button class="u-reset-button serve-btn" @tap="showModal = false">确定</button>
  27. </view>
  28. </u-popup>
  29. </view>
  30. </template>
  31. <script>
  32. /**
  33. * 选择优惠券模态框
  34. * @property {Object} couponList - 可用优惠券列表数据
  35. *
  36. */
  37. export default {
  38. components: {},
  39. data() {
  40. return {
  41. showModal: false,
  42. radio: 0,
  43. title: '选择优惠券'
  44. };
  45. },
  46. props: {
  47. couponList: {
  48. type: Array,
  49. default: () => []
  50. }
  51. },
  52. computed: {},
  53. methods: {
  54. radioGroupChange(index) {
  55. this.title = index > 0 ? '-¥' + this.couponList[index - 1].amount : '选择优惠券';
  56. this.$emit('change', index - 1);
  57. }
  58. }
  59. };
  60. </script>
  61. <style lang="scss" scoped>
  62. // 优惠券项
  63. .coupon-item {
  64. border-top: 1rpx solid rgba(#dfdfdf, 0.5);
  65. height: 100rpx;
  66. background: #fff;
  67. padding: 0 25rpx;
  68. .item-title {
  69. font-size: 28rpx;
  70. margin-right: 20rpx;
  71. }
  72. .price {
  73. font-size: 26rpx;
  74. color: #ff0000;
  75. margin-right: 20rpx;
  76. }
  77. .sel-coupon {
  78. font-size: 26rpx;
  79. color: #c4c4c4;
  80. margin-right: 20rpx;
  81. }
  82. }
  83. // 模态框
  84. .modal-box {
  85. width: 750rpx;
  86. height: 700rpx;
  87. background: #fff;
  88. padding: 30rpx;
  89. // 按钮
  90. .serve-btn {
  91. width: 690rpx;
  92. line-height: 80rpx;
  93. background: linear-gradient(90deg, rgba(240, 199, 133, 1), rgba(246, 214, 157, 1));
  94. border-radius: 40rpx;
  95. color: rgba(#fff, 0.9);
  96. margin-top: 40rpx;
  97. }
  98. .radio-item {
  99. width: 690rpx;
  100. margin-bottom: 20rpx;
  101. }
  102. // 标题
  103. .modal-head {
  104. margin-bottom: 30rpx;
  105. .head-title {
  106. font-size: 32rpx;
  107. font-weight: bold;
  108. }
  109. }
  110. }
  111. </style>