微信

index.vue 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="mainPage flex-v" v-if="data">
  3. <div class="top flex-h">
  4. <span>¥<em>{{parseInt(data.Price)}}</em>元</span>
  5. <div class="flex-item">
  6. <div>
  7. <span>{{data.CardName}}</span>
  8. <span>卡券描述卡券描述卡券描述卡券描述卡券描述</span>
  9. <span>{{toolClass.dateFormat(data.StartDate)}} - {{toolClass.dateFormat(data.EndDate)}}</span>
  10. </div>
  11. </div>
  12. </div>
  13. <ul class="numList flex-h">
  14. <li class="flex-item">
  15. <div>
  16. <span>总数量</span>
  17. <span>{{data.TotalCount}}</span>
  18. </div>
  19. </li>
  20. <li class="flex-item">
  21. <div>
  22. <span>剩余</span>
  23. <span>{{data.TotalCount - data.SentCount}}</span>
  24. </div>
  25. </li>
  26. <li class="flex-item">
  27. <div>
  28. <span>用户领取</span>
  29. <span>{{data.SentCount}}</span>
  30. </div>
  31. </li>
  32. <li class="flex-item">
  33. <div>
  34. <span>实际使用</span>
  35. <span>{{data.UsedCount}}</span>
  36. </div>
  37. </li>
  38. </ul>
  39. <div class="flex-item">
  40. <div>
  41. <div>
  42. <ul>
  43. <li class="flex-h">
  44. <span>销售名称</span>
  45. <div class="flex-item">
  46. <div>
  47. <span>实际使用</span>
  48. </div>
  49. </div>
  50. <span>用户领取</span>
  51. </li>
  52. <li class="flex-h" v-for="(item,index) in data.CustomerCard" :key="index">
  53. <span>{{salesData(item).name}}</span>
  54. <div class="flex-item">
  55. <div>
  56. <span>{{salesData(item).receive}}</span>
  57. </div>
  58. </div>
  59. <span>{{salesData(item).used}}</span>
  60. </li>
  61. </ul>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import { createNamespacedHelpers } from 'vuex'
  69. const { mapState: mapForbidState, mapActions: mapForbidActions } = createNamespacedHelpers('forbid')
  70. export default {
  71. name: '',
  72. data () {
  73. return {
  74. data: {}
  75. }
  76. },
  77. created () {
  78. if (this.$route.query.type === 'card') {
  79. this.getCardNum({ id: this.$route.query.id }).then(() => {
  80. this.getSales({ type: 'sales' }).then(() => {
  81. this.data = this.cardAndCoupon
  82. this.data.CustomerCard = this.data.CustomerCard || []
  83. })
  84. })
  85. } else {
  86. this.getCouponNum({ id: this.$route.query.id }).then(() => {
  87. this.getSales({ type: 'sales' }).then(() => {
  88. this.data = this.cardAndCoupon
  89. this.data.CustomerCard = this.data.CustomerCoupon || []
  90. })
  91. })
  92. }
  93. },
  94. computed: {
  95. ...mapForbidState({
  96. salesList: x => x.salesList,
  97. cardAndCoupon: x => x.cardAndCoupon
  98. })
  99. },
  100. methods: {
  101. ...mapForbidActions(['getCardNum', 'getCouponNum', 'getSales']),
  102. salesData (item) {
  103. let receive = 0
  104. let used = 0
  105. let name
  106. if (this.$route.query.type === 'card') {
  107. for (let i = 0; i < this.salesList.length; i++) {
  108. this.salesList[i].CustomerCard = this.salesList[i].CustomerCard || []
  109. for (let j = 0; j < this.salesList[i].CustomerCard.length; j++) {
  110. if (this.salesList[i].CustomerCard[j].SalesId === item.SalesId) {
  111. name = this.salesList[i].RealName
  112. receive++
  113. if (!item.VerifyStatus) {
  114. used++
  115. }
  116. }
  117. }
  118. }
  119. } else {
  120. for (let i = 0; i < this.salesList.length; i++) {
  121. this.salesList[i].CustomerCoupon = this.salesList[i].CustomerCoupon || []
  122. for (let j = 0; j < this.salesList[i].CustomerCoupon.length; j++) {
  123. if (this.salesList[i].CustomerCoupon[j].SalesId === item.SalesId) {
  124. name = this.salesList[i].RealName
  125. receive++
  126. if (!item.VerifyStatus) {
  127. used++
  128. }
  129. }
  130. }
  131. }
  132. }
  133. return {
  134. 'name': name,
  135. 'receive': receive,
  136. 'used': used
  137. }
  138. },
  139. }
  140. }
  141. </script>
  142. <!-- Add "scoped" attribute to limit CSS to this component only -->
  143. <style lang="scss" scoped>
  144. @import 'page.scss';
  145. </style>