couponItem.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="coupon-item" @click="onClick" :style="{
  3. background: `url(${youhuiquan_bgimg}) no-repeat center top`,
  4. backgroundSize: '100% 100%',
  5. }">
  6. <view class="left" >
  7. <view :class="['img-wrap', { disabled: config.disabled }]">
  8. <text class="unit">¥</text>
  9. <text class="number">{{ getNumber(data.coupon_price) }}</text>
  10. </view>
  11. <view class="info-wrap">
  12. <view class="title">{{ data.coupon_name || data.coupon_title }}</view>
  13. <view class="docs mtb12">满{{ data.use_min_price }}元使用</view>
  14. <view class="docs">{{ getFormatTime(data.start_time) }}~{{
  15. getFormatTime(data.end_time)
  16. }}</view>
  17. </view>
  18. </view>
  19. <view :class="[
  20. 'right-btn',
  21. { disabled: config.disabled, btnPlain: config.btnPlain },
  22. ]">
  23. {{ config.btnText }}
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import dayjs from "dayjs";
  29. export default {
  30. props: {
  31. config: {
  32. type: Object,
  33. default: () => ({
  34. disabled: Boolean,
  35. btnPlain: Boolean,
  36. btnText: String,
  37. }),
  38. },
  39. data: {
  40. type: Object,
  41. default: () => ({}),
  42. },
  43. },
  44. data() {
  45. return {
  46. youhuiquan_bgimg: '',
  47. }
  48. },
  49. mounted() {
  50. const configs = uni.getStorageSync("configs");
  51. console.log(configs)
  52. if (configs) {
  53. this.youhuiquan_bgimg = configs.cs_youhuiquan_bgimg
  54. }
  55. },
  56. methods: {
  57. getNumber(data) {
  58. return Number(data);
  59. },
  60. getFormatTime(time) {
  61. return dayjs(time).format("YYYY-MM-DD");
  62. },
  63. onClick() {
  64. console.log("onClickonClickonClickonClickonClickonClick")
  65. console.log("this.config.disabled",this.config.disabled)
  66. if (this.config.disabled) {
  67. return;
  68. }
  69. this.$emit("on-click", this.data);
  70. },
  71. },
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. .coupon-item {
  76. display: flex;
  77. justify-content: space-between;
  78. align-items: center;
  79. height: 184rpx;
  80. background-color: #fff;
  81. border: none;
  82. padding-right: 30rpx;
  83. //box-shadow: -2rpx 5rpx 15rpx 2rpx rgba(190, 190, 190, 0.25);
  84. margin-bottom: 20rpx;
  85. .left {
  86. display: flex;
  87. align-items: center;
  88. border: none;
  89. .img-wrap {
  90. display: flex;
  91. justify-content: center;
  92. align-items: center;
  93. width: 185rpx;
  94. height: 184rpx;
  95. color: #AC7B43 ;
  96. border: none;
  97. font-weight: 700;
  98. .unit {
  99. font-size: 36rpx;
  100. margin-top: 22rpx;
  101. }
  102. .number {
  103. font-size: 72rpx;
  104. }
  105. }
  106. .info-wrap {
  107. margin-left: 38rpx;
  108. .title {
  109. line-height: 39rpx;
  110. font-size: 28rpx;
  111. font-weight: bold;
  112. color: #0c0f17;
  113. }
  114. .docs {
  115. font-size: 24rpx;
  116. font-weight: 500;
  117. color: #87898a;
  118. line-height: 34rpx;
  119. &.mtb12 {
  120. margin: 12rpx 0;
  121. }
  122. }
  123. }
  124. }
  125. .right-btn {
  126. display: flex;
  127. justify-content: center;
  128. align-items: center;
  129. width: 144rpx;
  130. height: 56rpx;
  131. font-size: 24rpx;
  132. line-height: 1;
  133. font-weight: 500;
  134. color: #ffffff;
  135. background: linear-gradient( 315deg, #CA9359 0%, #E2B98E 100%);
  136. border-radius: 292rpx 292rpx 292rpx 292rpx ;
  137. &.btnPlain {
  138. //background: #ffffff;
  139. background: linear-gradient( 315deg, #CA9359 0%, #E2B98E 100%);
  140. color: #ffffff;
  141. }
  142. &.disabled {
  143. background: #f2f2f2;
  144. color: #767676;
  145. }
  146. }
  147. }
  148. </style>