coolc-coupon.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="coupon-item">
  3. <view class="coupon-money">
  4. <view class="nick" v-if="!types">{{item.title}}</view>
  5. <view class="layof" :style="{color:theme}">¥{{item.couponPrice}}</view>
  6. <view v-if="item.cid" class="end_time">有效期至{{item.endTime}}</view>
  7. <view v-if="!item.cid && item.endTime" class="end_time">在{{item.endTime}}前有效。 {{item.isPermanent?'不限制领取':'可领1张'}},已领{{item.nowCount}}张</view>
  8. <view v-if="!item.cid && !item.endTime" class="end_time">在领取后{{item.couponTime}}天内有效。可领{{item.isPermanent?'不限制':'1'}}张,已领{{item.nowCount}}张</view>
  9. <view v-if="!types">
  10. <!-- <view class="tit">券号:{{item.ticket}}</view> -->
  11. <view class="demand">满{{item.useMinPrice}}可用。{{item.categoryTitle?'限' + item.categoryTitle + '可用': '全商品可用'}}</view>
  12. </view>
  13. </view>
  14. <!-- <view @click="share" v-if="item.couponId" class="get-btn" :style="{color:color, borderColor:color, background:solid}">分享</view> -->
  15. <view @click="useMethod" v-if="item.cid" class="get-btn" :style="{color:color, borderColor:color, background:solid}">使用</view>
  16. <view @click="obtain" v-if="!item.cid && !item.isPermanent" class="get-btn" :style="{color:color, borderColor:color, background:solid}">{{ item.nowCount < 1 ? '立即领取' : '已领取' }}</view>
  17. <view @click="obtain" v-if="!item.cid && item.isPermanent" class="get-btn" :style="{color:color, borderColor:color, background:solid}">立即领取</view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. components: {
  23. },
  24. data() {
  25. return {
  26. }
  27. },
  28. props: {
  29. item: {
  30. type: Object
  31. },
  32. index: {
  33. type: Number
  34. },
  35. types: {
  36. type: String,
  37. default: ''
  38. },
  39. theme: {
  40. type: String,
  41. default: '#ff9000'
  42. },
  43. solid: {
  44. type: String,
  45. default: '#ffffff'
  46. },
  47. color: {
  48. type: String,
  49. default: '#ff9000'
  50. },
  51. },
  52. methods: {
  53. obtain() {
  54. this.$emit('obtainCoupon', this.item, this.index)
  55. },
  56. share() {
  57. this.$emit('shareCoupon', this.item, this.index)
  58. },
  59. useMethod() {
  60. this.$emit('useCoupon', this.item, this.index)
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang='scss'>
  66. .coupon-item {
  67. width: 100%;
  68. height: auto;
  69. display: table;
  70. border-radius: 10upx;
  71. padding: 0 20upx;
  72. margin-top: 22upx;
  73. border: 1px solid #eeeeee;
  74. position: relative;
  75. .coupon-money {
  76. width: 465upx;
  77. height: auto;
  78. display: table;
  79. float: left;
  80. padding: 26upx 0;
  81. border-style: none dotted none none;
  82. border-color: #eeeeee;
  83. .nick {
  84. width: 100%;
  85. height: 50upx;
  86. line-height: 30upx;
  87. font-size: $font-sm;
  88. color: #999999;
  89. }
  90. .tit {
  91. width: 100%;
  92. height: 50upx;
  93. line-height: 50upx;
  94. font-size: $font-sm;
  95. color: #999999;
  96. }
  97. .demand {
  98. width: 100%;
  99. height: 30upx;
  100. line-height: 30upx;
  101. font-size: $font-sm;
  102. color: #999999;
  103. }
  104. .layof {
  105. width: 100%;
  106. height: 48upx;
  107. line-height: 30upx;
  108. font-size: 44upx;
  109. color: #ff9000;
  110. font-weight: bold;
  111. }
  112. .end_time {
  113. width: 100%;
  114. line-height: 30upx;
  115. font-size: $font-sm;
  116. color: #999999;
  117. }
  118. }
  119. .get-btn {
  120. width: 146upx;
  121. height: 52upx;
  122. line-height: 50upx;
  123. position: absolute;
  124. top: 50%;
  125. right: 26upx;
  126. margin-top: -26upx;
  127. text-align: center;
  128. border-radius: 60upx;
  129. color: #ff9000;
  130. border: 1px solid #ff9000;
  131. font-size: $font-sm;
  132. float: right;
  133. }
  134. }
  135. .coupon-item:after {
  136. width: 40upx;
  137. height: 20upx;
  138. position: absolute;
  139. left: 460upx;
  140. top: -1px;
  141. border-radius: 0 0 40upx 40upx;
  142. content: "";
  143. display: block;
  144. background: #FFF;
  145. border: 1px solid #eeeeee;
  146. border-top: 0px;
  147. }
  148. .coupon-item:before {
  149. width: 40upx;
  150. height: 20upx;
  151. position: absolute;
  152. left: 460upx;
  153. bottom: -1px;
  154. border-radius: 40upx 40upx 0 0;
  155. content: "";
  156. display: block;
  157. background: #FFF;
  158. border: 1px solid #eeeeee;
  159. border-bottom: 0px;
  160. }
  161. </style>