微信

myCard.vue 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div class="card-content flex-l" :class="{invalid: data.invalid || isgrey}">
  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>{{ismanager?data.SentCount:data.CustomerList.length}}</span>
  28. </div>
  29. <div>
  30. <span>用户使用</span>
  31. <span>{{ismanager?data.usedCount:data.CustomerList.filter(x => x.status===1).length}}</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. isgrey: {
  58. type: Boolean,
  59. default: false
  60. },
  61. ismanager: {
  62. type: Boolean,
  63. default: false
  64. }
  65. },
  66. methods: {
  67. share () {
  68. if (!this.data.invalid) {
  69. if (this.isgrey) {
  70. this.$toast('您的卡券分享功能已被关闭,请联系主管')
  71. } else {
  72. this.$emit('share', this.data)
  73. }
  74. }
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .card-content {
  81. box-shadow: 0px 2px 0.1rem 0px rgba(193, 204, 217, 0.5);
  82. border-radius: 0.08rem;
  83. overflow: hidden;
  84. margin-bottom: 0.2rem;
  85. &.invalid {
  86. filter: grayscale(100%);
  87. opacity: 0.5;
  88. }
  89. .card-top {
  90. height: 1rem;
  91. padding: 0.1rem;
  92. box-sizing: border-box;
  93. .descs {
  94. overflow: hidden;
  95. text-overflow: ellipsis;
  96. display: -webkit-box;
  97. -webkit-line-clamp: 2;
  98. -webkit-box-orient: vertical;
  99. height: 0.32rem;
  100. line-height: 0.16rem;
  101. }
  102. div:nth-of-type(1) {
  103. width: 1.15rem;
  104. position: relative;
  105. .logo {
  106. width: 85%;
  107. position: absolute;
  108. }
  109. .line3 {
  110. height: 80%;
  111. position: absolute;
  112. right: 0.15rem;
  113. top: 10%;
  114. }
  115. > span {
  116. color: #fc6243;
  117. position: absolute;
  118. top: 50%;
  119. left: 40%;
  120. transform: translate(-50%, -50%);
  121. font-size: 0.14rem;
  122. display: flex;
  123. align-items: baseline;
  124. span {
  125. color: #fc6243;
  126. font-size: 0.22rem;
  127. }
  128. }
  129. }
  130. div:nth-of-type(2) {
  131. flex: 1;
  132. h2 {
  133. font-size: 0.16rem;
  134. }
  135. span {
  136. color: #323645;
  137. font-size: 12px;
  138. padding-top: 0.05rem;
  139. }
  140. }
  141. }
  142. .card-main {
  143. position: relative;
  144. img {
  145. width: 100%;
  146. position: absolute;
  147. top: 0;
  148. left: 0;
  149. }
  150. div {
  151. flex: 1;
  152. display: flex;
  153. flex-flow: column nowrap;
  154. justify-content: center;
  155. align-items: center;
  156. padding-top: 0.15rem;
  157. span:nth-of-type(1) {
  158. font-size: 0.12rem;
  159. color: #323645;
  160. }
  161. span:nth-of-type(2) {
  162. font-size: 0.12rem;
  163. color: #fc6243;
  164. }
  165. }
  166. }
  167. .card-bottom {
  168. padding: 0.1rem;
  169. margin-top: 0.1rem;
  170. background-color: #fc6243;
  171. text-align: center;
  172. color: #fff;
  173. border-radius: 0 0 0.08rem 0.08rem;
  174. }
  175. }
  176. </style>