微信

myCard.vue 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="card-content flex-l" :class="{invalid: data.invalid}">
  3. <div class="card-top flex-h">
  4. <div>
  5. <img :src="logo" class="logo">
  6. <span>¥ <span> {{data.price}} </span> 元</span>
  7. <img :src="line3" class="line3">
  8. </div>
  9. <div>
  10. <h2>{{data.title}}</h2>
  11. <span class="descs">{{data.desc}}</span>
  12. <span>{{data.startDate}}-{{data.endDate}}</span>
  13. </div>
  14. </div>
  15. <div class="card-main flex-h">
  16. <img :src="line">
  17. <div class="flex-h">
  18. <span>总数量</span>
  19. <span>{{data.totalCount}}</span>
  20. </div>
  21. <div>
  22. <span>总剩余</span>
  23. <span>{{data.totalCount - data.SentCount}}</span>
  24. </div>
  25. <div>
  26. <span>用户领取</span>
  27. <span>{{data.SentCount}}</span>
  28. </div>
  29. <div>
  30. <span>用户使用</span>
  31. <span>{{data.usedCount}}</span>
  32. </div>
  33. </div>
  34. <div class="card-bottom" @click.stop="share">
  35. 分享卡券
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. import logo from '../../common/icon/logo-t.png'
  41. import line from '../../common/icon/cicyle.png'
  42. import line3 from '../../common/icon/Line3.png'
  43. export default {
  44. name: 'myCard',
  45. data () {
  46. return {
  47. logo,
  48. line,
  49. line3
  50. }
  51. },
  52. props: {
  53. data: {
  54. type: Object,
  55. default: () => { }
  56. }
  57. },
  58. methods: {
  59. share () {
  60. if (!this.data.invalid) {
  61. this.$emit('share', this.data)
  62. }
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .card-content {
  69. box-shadow: 0px 2px 0.1rem 0px rgba(193, 204, 217, 0.5);
  70. border-radius: 0.08rem;
  71. overflow: hidden;
  72. margin-bottom: 0.2rem;
  73. &.invalid {
  74. filter: grayscale(100%);
  75. opacity: 0.5;
  76. }
  77. .card-top {
  78. height: 1rem;
  79. padding: 0.1rem;
  80. box-sizing: border-box;
  81. .descs {
  82. overflow: hidden;
  83. text-overflow: ellipsis;
  84. display: -webkit-box;
  85. -webkit-line-clamp: 2;
  86. -webkit-box-orient: vertical;
  87. height: .32rem;
  88. line-height: .16rem;
  89. }
  90. div:nth-of-type(1) {
  91. width: 1.15rem;
  92. position: relative;
  93. .logo {
  94. width: 85%;
  95. position: absolute;
  96. }
  97. .line3 {
  98. height: 80%;
  99. position: absolute;
  100. right: 0.15rem;
  101. top: 10%;
  102. }
  103. > span {
  104. color: #fc6243;
  105. position: absolute;
  106. top: 50%;
  107. left: 40%;
  108. transform: translate(-50%, -50%);
  109. font-size: 0.14rem;
  110. display: flex;
  111. align-items: baseline;
  112. span {
  113. color: #fc6243;
  114. font-size: 0.22rem;
  115. }
  116. }
  117. }
  118. div:nth-of-type(2) {
  119. flex: 1;
  120. h2 {
  121. font-size: 0.16rem;
  122. }
  123. span {
  124. color: #323645;
  125. font-size: 12px;
  126. padding-top: 0.05rem;
  127. }
  128. }
  129. }
  130. .card-main {
  131. position: relative;
  132. img {
  133. width: 100%;
  134. position: absolute;
  135. top: 0;
  136. left: 0;
  137. }
  138. div {
  139. flex: 1;
  140. display: flex;
  141. flex-flow: column nowrap;
  142. justify-content: center;
  143. align-items: center;
  144. padding-top: 0.15rem;
  145. span:nth-of-type(1) {
  146. font-size: 0.12rem;
  147. color: #323645;
  148. }
  149. span:nth-of-type(2) {
  150. font-size: 0.12rem;
  151. color: #fc6243;
  152. }
  153. }
  154. }
  155. .card-bottom {
  156. padding: 0.1rem;
  157. margin-top: 0.1rem;
  158. background-color: #fc6243;
  159. text-align: center;
  160. color: #fff;
  161. border-radius: 0 0 0.08rem 0.08rem;
  162. }
  163. }
  164. </style>