fhstat.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <div id="fhstat">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <h3 class="h3">商家</h3>
  6. <el-col :span="4" class="sjList" v-for="(item, sjindex) in sjList.slice(0, 6)" :key="`${sjindex}`">
  7. <p>{{ item.name }}</p>
  8. <p>
  9. 销售注册数:<span>{{ xsgetnum(item) || 0 }}</span
  10. >&nbsp;人
  11. </p>
  12. <p>
  13. 客户报名数:<span>{{ khgetnum(item) || 0 }}</span
  14. >&nbsp;人
  15. </p>
  16. </el-col>
  17. <h3 class="h3 two">销售员</h3>
  18. <el-col :span="4" class="xsList" v-for="(tag, xsindex) in xsList.slice(0, 6)" :key="xsindex + 'only'">
  19. <p>{{ tag.name }}</p>
  20. <p>
  21. 客户报名数:<span>{{ xskhgetnum(tag) || 0 }}&nbsp;人</span>
  22. </p>
  23. </el-col>
  24. </el-col>
  25. </el-row>
  26. </div>
  27. </template>
  28. <script>
  29. import { mapState, createNamespacedHelpers } from 'vuex';
  30. export default {
  31. metaInfo: { title: 'fhstat' },
  32. name: 'fhstat',
  33. props: {
  34. // 商家
  35. sjstatList: { type: Array },
  36. // 销售
  37. xsstatList: { type: Array },
  38. // 客户
  39. khstatList: { type: Array },
  40. },
  41. components: {},
  42. data: function() {
  43. return {
  44. sjList: [],
  45. xsList: [],
  46. };
  47. },
  48. created() {},
  49. methods: {
  50. searchfilter() {
  51. let sjList = this.sjstatList.filter(i => i.ssid == this.user.tableid);
  52. if (sjList) this.$set(this, `sjList`, sjList);
  53. let xsList = this.xsstatList.filter(i => i.ssid == this.user.tableid);
  54. if (xsList) this.$set(this, `xsList`, xsList);
  55. },
  56. // 获取商家销售数
  57. xsgetnum(data) {
  58. let res = this.xsstatList.filter(i => i.ssid == data.tableid);
  59. if (res) {
  60. return res.length;
  61. }
  62. },
  63. // 商家客户总数
  64. khgetnum(data) {
  65. let res = this.khstatList.filter(i => i.sjid == data.tableid);
  66. if (res) {
  67. return res.length;
  68. }
  69. },
  70. // 销售员客户总数
  71. xskhgetnum(data) {
  72. let res = this.khstatList.filter(i => i.xsid == data.tableid);
  73. if (res) {
  74. return res.length;
  75. }
  76. },
  77. },
  78. watch: {
  79. sjstatList: {
  80. handler(val) {
  81. this.searchfilter();
  82. },
  83. },
  84. xsstatList: {
  85. handler(val) {
  86. this.searchfilter();
  87. },
  88. },
  89. khstatList: {
  90. handler(val) {
  91. this.searchfilter();
  92. },
  93. },
  94. immediate: true,
  95. deep: true,
  96. },
  97. computed: {
  98. ...mapState(['user']),
  99. },
  100. };
  101. </script>
  102. <style lang="less" scoped>
  103. .main {
  104. .h3 {
  105. float: left;
  106. width: 100%;
  107. margin: 15px 0;
  108. }
  109. .two {
  110. margin: 70px 0 15px 0;
  111. }
  112. .sjList {
  113. text-align: center;
  114. border-radius: 360px;
  115. margin: 5px 10px;
  116. width: 15%;
  117. height: 240px;
  118. box-shadow: 0 0 6px #ccc;
  119. p:nth-child(1) {
  120. font-size: 20px;
  121. font-family: 微软雅黑;
  122. font-weight: bold;
  123. padding: 50px 0 20px 0;
  124. }
  125. p:nth-child(2) {
  126. font-size: 16px;
  127. font-family: 微软雅黑;
  128. font-weight: bold;
  129. padding: 10px 0;
  130. span {
  131. color: red;
  132. }
  133. }
  134. p:nth-child(3) {
  135. font-size: 16px;
  136. font-family: 微软雅黑;
  137. font-weight: bold;
  138. padding: 10px 0;
  139. span {
  140. color: red;
  141. }
  142. }
  143. }
  144. .xsList {
  145. text-align: center;
  146. border-radius: 360px;
  147. margin: 5px 0 90px 10px;
  148. width: 15%;
  149. height: 240px;
  150. box-shadow: 0 0 6px #ccc;
  151. p:nth-child(1) {
  152. font-size: 20px;
  153. font-family: 微软雅黑;
  154. font-weight: bold;
  155. padding: 70px 0 20px 0;
  156. }
  157. p:nth-child(2) {
  158. font-size: 16px;
  159. font-family: 微软雅黑;
  160. font-weight: bold;
  161. padding: 15px 0;
  162. span {
  163. color: red;
  164. }
  165. }
  166. }
  167. }
  168. </style>