couponTpl.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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">{{item.couponTitle}}</view>
  9. </view>
  10. <view class="coupon-price">
  11. ¥<text>{{item.couponAmount}}</text>
  12. </view>
  13. </view>
  14. <view class="coupon-desc">
  15. <view><u-icon class="icon" size="30" name="clock"></u-icon>{{item.validEndTimeStr}}</view>
  16. <view><u-icon class="icon" size="30" name="info-circle"></u-icon>{{item.couponRuleDesc}}</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. }
  35. },
  36. methods: {
  37. // 选中优惠卷
  38. checked(item) {
  39. if(this.showCheck){
  40. this.$emit('checkOk',item)
  41. }
  42. },
  43. },
  44. }
  45. </script>
  46. <style lang="scss">
  47. .coupon-list{
  48. padding: 25rpx;
  49. }
  50. .coupon-box.diabled{
  51. background: #999;
  52. }
  53. .coupon-box{
  54. margin-bottom: 30rpx;
  55. border-radius: 15rpx;
  56. box-shadow: 2rpx 2rpx 10rpx #ddd;
  57. background: #ff0000;
  58. color: #FFFFFF;
  59. .coupon-head{
  60. display: flex;
  61. align-items: center;
  62. padding: 20rpx 30rpx;
  63. position: relative;
  64. border-bottom: 15rpx dotted #FFFFFF;
  65. margin-bottom: -8rpx;
  66. .coupon-sel{
  67. position: absolute;
  68. width: 56rpx;
  69. height: 46rpx;
  70. right: 0;
  71. top: 0;
  72. }
  73. .coupon-checked{
  74. background: url(/static/img/select.png) no-repeat center;
  75. background-size: 100% 100%;
  76. }
  77. .coupon-title{
  78. flex-grow: 1;
  79. font-size: 32rpx;
  80. }
  81. .coupon-price{
  82. padding: 0 15rpx;
  83. color: #FFFFFF;
  84. text{
  85. font-size: 60rpx;
  86. }
  87. }
  88. }
  89. .coupon-desc{
  90. padding: 10rpx 30rpx;
  91. color: #666;
  92. background: #FFFFFF;
  93. border-bottom-left-radius:10rpx;
  94. border-bottom-right-radius: 10rpx;
  95. >view{
  96. padding: 5rpx 0;
  97. }
  98. .icon{
  99. margin-right: 10rpx;
  100. }
  101. }
  102. }
  103. </style>