couponTpl.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="coupon-list">
  3. <view class="coupon-box" v-for="item in list" :key="item.id" @click="checked(item)">
  4. <view class="coupon-head">
  5. <view class="coupon-sel coupon-checked" v-if="item.checked"></view>
  6. <view class="coupon-sel" v-else></view>
  7. <view class="coupon-title">
  8. <view class="coupon-title-1">满100减50</view>
  9. </view>
  10. <view class="coupon-price">
  11. ¥<text>100</text>
  12. </view>
  13. </view>
  14. <view class="coupon-desc">
  15. <view><u-icon class="icon" size="30" name="clock"></u-icon> 有效期至:2020-05-12</view>
  16. <view><u-icon class="icon" size="30" name="info-circle"></u-icon> 优惠卷使用说明优惠卷使用说明优惠卷使用说明优惠卷使用说明</view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default{
  23. name: 'couponTpl',
  24. props: {
  25. showCheck: {
  26. type: Boolean,
  27. default: false
  28. },
  29. list:{
  30. type: Array,
  31. default: function(){
  32. return [
  33. {
  34. id: 23432445,
  35. name: "满100减50",
  36. price: 100,
  37. yxTime: "2020-05-16",
  38. remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
  39. checked: false
  40. },
  41. {
  42. id: 3544355,
  43. name: "满100减50",
  44. price: 100,
  45. yxTime: "2020-05-16",
  46. remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
  47. checked: false
  48. },
  49. {
  50. id: 234234234,
  51. name: "满100减50",
  52. price: 100,
  53. yxTime: "2020-05-16",
  54. remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
  55. checked: false
  56. },
  57. {
  58. id: 66264646,
  59. name: "满100减50",
  60. price: 100,
  61. yxTime: "2020-05-16",
  62. remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
  63. checked: false
  64. },
  65. {
  66. id: 9794694698,
  67. name: "满100减50",
  68. price: 100,
  69. yxTime: "2020-05-16",
  70. remarks: '优惠卷使用说明优惠卷使用说明优惠卷使用说明',
  71. checked: false
  72. }
  73. ]
  74. }
  75. }
  76. },
  77. methods: {
  78. // 选中优惠卷
  79. checked(item) {
  80. if(this.showCheck){
  81. let has = this.list.find(item=>item.checked)
  82. if(has){
  83. has.checked = false
  84. }
  85. item.checked = true
  86. this.$emit('checkOk',item)
  87. }
  88. },
  89. },
  90. }
  91. </script>
  92. <style lang="scss">
  93. .coupon-list{
  94. padding: 25rpx;
  95. }
  96. .coupon-box.diabled{
  97. background: #999;
  98. }
  99. .coupon-box{
  100. margin-bottom: 30rpx;
  101. border-radius: 15rpx;
  102. box-shadow: 2rpx 2rpx 10rpx #ddd;
  103. background: #ff0000;
  104. color: #FFFFFF;
  105. .coupon-head{
  106. display: flex;
  107. align-items: center;
  108. padding: 20rpx 30rpx;
  109. position: relative;
  110. border-bottom: 15rpx dotted #FFFFFF;
  111. margin-bottom: -8rpx;
  112. .coupon-sel{
  113. position: absolute;
  114. width: 56rpx;
  115. height: 46rpx;
  116. right: 0;
  117. top: 0;
  118. }
  119. .coupon-checked{
  120. background: url(/static/img/select.png) no-repeat center;
  121. background-size: 100% 100%;
  122. }
  123. .coupon-title{
  124. flex-grow: 1;
  125. font-size: 32rpx;
  126. }
  127. .coupon-price{
  128. padding: 0 15rpx;
  129. color: #FFFFFF;
  130. text{
  131. font-size: 60rpx;
  132. }
  133. }
  134. }
  135. .coupon-desc{
  136. padding: 10rpx 30rpx;
  137. color: #666;
  138. background: #FFFFFF;
  139. border-bottom-left-radius:10rpx;
  140. border-bottom-right-radius: 10rpx;
  141. >view{
  142. padding: 5rpx 0;
  143. }
  144. .icon{
  145. margin-right: 10rpx;
  146. }
  147. }
  148. }
  149. </style>