weixin.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div id="weixin">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="crumbs">
  6. <el-breadcrumb separator="/">
  7. <el-breadcrumb-item> <i class="el-icon-lx-cascades"></i> 微信宣传转发统计 </el-breadcrumb-item>
  8. </el-breadcrumb>
  9. </el-col>
  10. <el-col :span="24" class="container down">
  11. <el-col :span="24" class="downTop">
  12. <el-col :span="4">
  13. <el-select v-model="searchForm.xsid" clearable placeholder="请选择销售员">
  14. <el-option v-for="item in xsList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
  15. </el-select>
  16. </el-col>
  17. <el-col :span="6">
  18. <el-date-picker
  19. v-model="searchForm.date"
  20. value-format="yyyy-MM-dd"
  21. format="yyyy-MM-dd"
  22. type="daterange"
  23. range-separator="-"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期"
  26. clearable
  27. >
  28. </el-date-picker>
  29. </el-col>
  30. <el-col :span="14">
  31. <el-button type="primary" icon="el-icon-search" @click="search">搜索</el-button>
  32. </el-col>
  33. </el-col>
  34. <el-col :span="24" class="downList">
  35. <el-col :span="24" class="downListOne"> 微信转发总{{ wxtotal }}次 </el-col>
  36. <el-col :span="24" class="downListTwo">
  37. <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search">
  38. <template #custom="{item, row}">
  39. <template v-if="item.prop == 'num'">
  40. <span>{{ getkhTotal(row) }}</span>
  41. </template>
  42. </template>
  43. </data-table>
  44. </el-col>
  45. </el-col>
  46. </el-col>
  47. </el-col>
  48. </el-row>
  49. </div>
  50. </template>
  51. <script>
  52. import _ from 'lodash';
  53. import dataTable from '@/components/frame/filter-page-table.vue';
  54. import { mapState, createNamespacedHelpers } from 'vuex';
  55. const { mapActions: xs } = createNamespacedHelpers('xs');
  56. const { mapActions: zf } = createNamespacedHelpers('zf');
  57. export default {
  58. metaInfo: { title: '微信宣传转发统计' },
  59. name: 'weixin',
  60. props: {},
  61. components: {
  62. dataTable, //列表组件
  63. },
  64. data: function() {
  65. return {
  66. // 查询
  67. searchForm: {},
  68. xsList: [],
  69. // 客户列表
  70. opera: [],
  71. fields: [
  72. { label: '销售员姓名', prop: 'xsname' },
  73. { label: '微信转发数', prop: 'times' },
  74. ],
  75. list: [],
  76. total: 0,
  77. // 微信转发总数
  78. wxtotal: 0,
  79. };
  80. },
  81. created() {
  82. this.searchXs();
  83. },
  84. methods: {
  85. ...xs({ xsQuery: 'query' }),
  86. ...zf({ zfQuery: 'query' }),
  87. async searchXs() {
  88. let res = await this.xsQuery({ ssid: this.user.tableid });
  89. if (this.$checkRes(res)) {
  90. let data = res.data;
  91. data.push({ name: '全部' });
  92. this.$set(this, `xsList`, data);
  93. }
  94. },
  95. async search({ skip = 0, limit = 10, ...info } = {}) {
  96. info = {
  97. xsid: this.searchForm.xsid,
  98. start: _.get(this.searchForm, 'date[0]'),
  99. end: _.get(this.searchForm, 'date[1]'),
  100. };
  101. let res = await this.zfQuery({ skip, limit, ...info });
  102. if (this.$checkRes(res)) {
  103. this.$set(this, `list`, res.data);
  104. let wxtotal = res.data.reduce((p, n) => p + (n['times'] * 1 || 0), 0);
  105. if (wxtotal) this.$set(this, `wxtotal`, wxtotal);
  106. }
  107. },
  108. },
  109. computed: {
  110. ...mapState(['user']),
  111. },
  112. };
  113. </script>
  114. <style lang="less" scoped>
  115. .down {
  116. .downList {
  117. .downListOne {
  118. padding: 15px 0;
  119. }
  120. }
  121. }
  122. </style>