微信

myCard.vue 4.0KB

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