statistics.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. <template>
  2. <view>
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <!-- 头部信息Start -->
  6. <view class="headers " :style="headerStyle">
  7. <view class="dis a-c j-c">
  8. <text>统计</text>
  9. <!-- <view class="headers-right">
  10. <image @click="weChatService" src="/static/image/my/kefu.png" mode="">
  11. </image>
  12. <text>客服</text>
  13. </view> -->
  14. </view>
  15. </view>
  16. <view class="body-box" style="margin-top: 100px" v-if="type == 1 && level!==5">
  17. <view class=" dis j-s a-c" style="padding: 10px 10px 0 0;">
  18. <view class="statistics-title">新增人员汇总统计</view>
  19. <year @queryData="queryData" @time="getTime"></year>
  20. </view>
  21. <view class="statistics-number ">
  22. <view v-if="level <= 4">
  23. <text>{{ echartsList.onePartnerNum || 0 }}</text>
  24. <text>管理人</text>
  25. </view>
  26. <view v-if="level <= 3">
  27. <text>{{ echartsList.twoPartnerNum || 0 }}</text>
  28. <text>合伙人</text>
  29. </view>
  30. <view v-if="level <= 2">
  31. <text>{{ echartsList.threePartnerNum || 0 }}</text>
  32. <text>工作室</text>
  33. </view>
  34. <view v-if="level == 1">
  35. <text>{{ echartsList.fourPartnerNum || 0 }}</text>
  36. <text>团队</text>
  37. </view>
  38. <view>
  39. <text>{{ echartsList.workSum || 0 }}</text>
  40. <text>业务员</text>
  41. </view>
  42. </view>
  43. <view class="partner-type dis">
  44. <view style="width: 650px;overflow-x: auto;">
  45. <text :class="typeStatistics == val.value ? 'selected' : ''" v-for="val in partnerTypeOption"
  46. :key="val.value" @click="getPartnerType(val.value)">{{ val.lable }}</text>
  47. </view>
  48. </view>
  49. <o-empty v-if="echartsList.countUserNumVoList && echartsList.countUserNumVoList.length == 0"
  50. height="20vh" />
  51. <qiun-data-charts v-else type="area" :ontouch="true" :opts="opts1" :chartData="chartData1" />
  52. </view>
  53. <view class="body-box" v-if="type == 1 && level!==5">
  54. <view class=" dis j-s a-c" style="padding: 10px 10px 0 0;">
  55. <view class="statistics-title">新增人员占比分析</view>
  56. <year @queryData="analysisQueryData" @time="getTime"></year>
  57. </view>
  58. <leverStaff @getPartnerType="getPartnerType2"></leverStaff>
  59. <o-empty v-if="!echartsList2.newProportion && !echartsList2.oldProportion" height="20vh" />
  60. <view v-else class="charts-box" style="height: 200px;">
  61. <qiun-data-charts type="ring" :eopts="ringOpts" :chartData="chartsDataPie2" />
  62. </view>
  63. </view>
  64. <view class="body-box" style="padding-bottom: 10px;" v-if="type == 1 && level!==5">
  65. <view class=" dis j-s a-c" style="padding: 10px 10px 0 0;">
  66. <view class="statistics-title">排名</view>
  67. </view>
  68. <leverStaff @getPartnerType="getPartnerType3"></leverStaff>
  69. <view class="teamStatistics ">
  70. <view class="statisticsTitle">
  71. <view>排名</view>
  72. <view>姓名</view>
  73. <view>人数</view>
  74. <view>详情</view>
  75. </view>
  76. <block v-for="(item, index) in directLsit" :key="index">
  77. <view>
  78. <view class="statisticsContent ">
  79. <view>
  80. <image v-if="index == 0" src="/static/icon/paiming1.png" mode=""></image>
  81. <image v-else-if="index == 1" src="/static/icon/paiming2.png" mode=""></image>
  82. <image v-else-if="index == 2" src="/static/icon/paiming3.png" mode=""></image>
  83. <text v-else>{{ index + 1 }}</text>
  84. </view>
  85. <view>{{ item.userName }}</view>
  86. <view>{{ item.deptManNum }}</view>
  87. <view style="color:#739EFF " @click="directDetail(item)">查看</view>
  88. </view>
  89. </view>
  90. </block>
  91. <!-- <o-empty v-if="directLsit.length==0" /> -->
  92. </view>
  93. </view>
  94. <view class="body-box" style="margin-top: 100px;" v-if="type == 1&& level==5">
  95. <view class=" dis j-s a-c" style="padding: 10px 10px 0 0;">
  96. <view class="statistics-title">新增人员汇总统计</view>
  97. <year @queryData="queryData" @time="getTime"></year>
  98. </view>
  99. <view class="statistics-number ">
  100. <view>
  101. <text>{{ echartsList.workSum || 0 }}</text>
  102. <text>工作室</text>
  103. </view>
  104. <view>
  105. <text>{{ echartsList.deptSum || 0 }}</text>
  106. <text>团队</text>
  107. </view>
  108. <view>
  109. <text>{{ echartsList.deptManSum || 0 }}</text>
  110. <text>代理人</text>
  111. </view>
  112. </view>
  113. <view class="statistics-type">
  114. <text :class="typeStatistics == 1 ? 'selected' : ''" @click="getStatistics(1)">工作室</text>
  115. <text :class="typeStatistics == 2 ? 'selected' : ''" @click="getStatistics(2)">团队</text>
  116. <text :class="typeStatistics == 3 ? 'selected' : ''" @click="getStatistics(3)">代理人</text>
  117. </view>
  118. <o-empty v-if="echartsList.countUserNumVoList && echartsList.countUserNumVoList.length == 0"
  119. height="20vh" />
  120. <qiun-data-charts v-else type="area" :opts="opts1" :chartData="chartData1" />
  121. </view>
  122. <view class="body-box" style="margin-top: 100px;" v-if="type == 2">
  123. <view class=" dis j-s a-c" style="padding: 10px 10px 0 0;">
  124. <view class="statistics-title">新增人员汇总统计</view>
  125. <year @queryData="queryData" @time="getTime"></year>
  126. </view>
  127. <view class="statistics-number ">
  128. <view>
  129. <text>{{ echartsList.countSum || 0 }}</text>
  130. <text>新增人员</text>
  131. </view>
  132. <view>
  133. <text>{{ echartsList.deptSum || 0 }}</text>
  134. <text>团队</text>
  135. </view>
  136. <view>
  137. <text>{{ echartsList.deptManSum || 0 }}</text>
  138. <text>代理人</text>
  139. </view>
  140. </view>
  141. <view class="statistics-type">
  142. <text :class="typeStatistics == 1 ? 'selected' : ''" @click="getStatistics(1)">团队</text>
  143. <text :class="typeStatistics == 2 ? 'selected' : ''" @click="getStatistics(2)">代理人</text>
  144. </view>
  145. <o-empty v-if="echartsList.countUserNumVoList && echartsList.countUserNumVoList.length == 0"
  146. height="20vh" />
  147. <qiun-data-charts v-else type="area" :opts="opts1" :chartData="chartData1" :ontouch="true" />
  148. </view>
  149. </view>
  150. </template>
  151. <script>
  152. import {
  153. mapState,
  154. } from "vuex"
  155. import leverStaff from "../components/leverStaff.vue"
  156. import year from "../components/year.vue"
  157. export default {
  158. components: {
  159. leverStaff,
  160. year
  161. },
  162. data() {
  163. return {
  164. beginTime: '',
  165. endTime: '',
  166. ringOpts: {
  167. color: ['#02CDFF ', '#2D97FF'],
  168. legend: {
  169. show: false // 设置图例不显示
  170. },
  171. dataLabel: true,
  172. },
  173. chartsDataPie2: {},
  174. echartsList2: {},
  175. level: '',
  176. type: null,
  177. typeStatistics: 1,
  178. typeStatistics2: 1,
  179. typeStatistics3: 1,
  180. option: {},
  181. supportStaffUrl: '',
  182. headerStyle: {
  183. backgroundColor: 'transparent',
  184. backgroundImage: 'url("/static/beijing (2).png")',
  185. backgroundSize: 'cover',
  186. backgroundPosition: '',
  187. boxShadow: ''
  188. // 其他样式属性...
  189. },
  190. year: [{
  191. lable: '日',
  192. startShow: false
  193. }, {
  194. lable: '周',
  195. startShow: false
  196. }, {
  197. lable: '月',
  198. startShow: false
  199. }],
  200. echartsList: {},
  201. analysisEchartsList: {},
  202. partnerTypeOption: [{
  203. lable: '一级合伙人',
  204. value: '1'
  205. }, {
  206. lable: '二级合伙人',
  207. value: '2'
  208. }, {
  209. lable: '三级合伙人',
  210. value: '3'
  211. }, {
  212. lable: '四级合伙人',
  213. value: '4'
  214. }, ],
  215. // optsMax:10,
  216. opts1: {
  217. enableScroll: true,
  218. padding: [15, 10, 15, 0],
  219. legend: {
  220. show: false // 设置图例不显示
  221. },
  222. xAxis: {
  223. disableGrid: true,
  224. type: 'grid',
  225. gridType: 'dash',
  226. itemCount: 4, //x轴单屏显示数据的数量,默认为5个
  227. scrollShow: true, //新增是否显示滚动条,默认false
  228. scrollAlign: 'left', //滚动条初始位置
  229. scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
  230. scrollColor: '#A6A6A6', //默认为 #A6A6A6,
  231. fontSize: 11,
  232. },
  233. yAxis: {
  234. gridType: "dash",
  235. dashLength: 2,
  236. },
  237. extra: {
  238. area: {
  239. type: "curve",
  240. opacity: 0.2,
  241. addLine: true,
  242. width: 2,
  243. gradient: true,
  244. activeType: "hollow"
  245. },
  246. },
  247. },
  248. chartData1: {},
  249. directLsit: []
  250. }
  251. },
  252. computed: {
  253. ...mapState(['userInfo']),
  254. },
  255. onLoad() {
  256. this.level = this.userInfo.sysUser.level
  257. if (this.level == 2) {
  258. this.partnerTypeOption = this.partnerTypeOption.slice(0, -1);
  259. }
  260. if (this.level == 3) {
  261. this.partnerTypeOption = this.partnerTypeOption.slice(0, -2);
  262. }
  263. if (this.level == 4) {
  264. this.partnerTypeOption = this.partnerTypeOption.slice(0, 1);
  265. }
  266. this.$http.get('/sys/qy/wechat/find/picture').then(res => {
  267. this.supportStaffUrl = res.data.supportStaffUrl
  268. })
  269. },
  270. onShow() {
  271. this.type = uni.getStorageSync('type')
  272. // if(this.type ==2){
  273. // this.queryData({type:1})
  274. // }
  275. // else{
  276. // this.queryData({type:1})
  277. // }
  278. this.queryData()
  279. if (this.type == 1 && this.level !== 5) {
  280. this.analysisQueryData()
  281. this.rankingQueryData()
  282. }
  283. },
  284. methods: {
  285. canvasInit(canvas, width, height) {
  286. // 初始化画布
  287. this.canvas2d = canvas;
  288. },
  289. directDetail(val) {
  290. uni.navigateTo({
  291. url: "/pages/statistics/statisticsDetail?key=" + encodeURIComponent(JSON.stringify(val
  292. .partnerIds))
  293. })
  294. },
  295. getPartnerType2(type) {
  296. this.typeStatistics2 = type
  297. this.analysisQueryData()
  298. },
  299. getPartnerType3(type) {
  300. this.typeStatistics3 = type
  301. this.rankingQueryData()
  302. },
  303. getPartnerType(type) {
  304. this.typeStatistics = type
  305. this.queryData()
  306. },
  307. getStatistics(type) {
  308. // uni.navigateTo({
  309. // url: "/pages/tools/achievement/achievement"
  310. // })
  311. // this.studioType=type
  312. this.typeStatistics = type
  313. this.queryData()
  314. },
  315. //点击跳转企业微信客服
  316. weChatService() {
  317. uni.share({
  318. provider: "weixin",
  319. openCustomerServiceChat: true,
  320. customerUrl: this.supportStaffUrl, //企业微信地址
  321. corpid: 'wwfe67d19509d43ec5', //企业id
  322. success: (res) => {},
  323. fail: (err) => {}
  324. });
  325. },
  326. async analysisQueryData() {
  327. let params = {
  328. beginTime: this.beginTime,
  329. endTime: this.endTime,
  330. type: this.typeStatistics2,
  331. }
  332. let res = await this.$http.post('/APPPartner/getPartnerProportion', params);
  333. if (res.code == '200') {
  334. this.echartsList2 = res.data
  335. this.chartsDataPie2 = {
  336. series: [{
  337. "data": [{
  338. name: `新增`,
  339. value: res.data.newProportion,
  340. labelText: `${res.data.newProportion?'新增:'+res.data.newProportion+'%':'新增:0%'}`
  341. },
  342. {
  343. name: "历史",
  344. value: res.data.oldProportion,
  345. labelText: `${res.data.oldProportion?'历史:'+res.data.oldProportion+'%':'历史:0%'}`
  346. }
  347. ]
  348. // "data": [
  349. // { name: `新增`, value: res.data.newProportion?res.data.newProportion:0},
  350. // { name: "历史", value: res.data.oldProportion?res.data.oldProportion:0}
  351. // ]
  352. }]
  353. }
  354. }
  355. },
  356. async rankingQueryData() {
  357. let params = {
  358. type: this.typeStatistics3,
  359. }
  360. let res = await this.$http.get('/APPPartner/getLevelPartner', params);
  361. if (res.code == '200') {
  362. this.directLsit = res.data
  363. }
  364. },
  365. getTime(beginTime, endTime) {
  366. this.beginTime = beginTime
  367. this.endTime = endTime
  368. },
  369. async queryData() {
  370. let params = {
  371. beginTime: this.beginTime,
  372. endTime: this.endTime,
  373. type: this.typeStatistics,
  374. }
  375. let res = {}
  376. if (this.type == 1 && this.level !== 5) {
  377. res = await this.$http.post('/APPPartner/getPartnerCount', params);
  378. } else if (this.type == 1 && this.level == 5) {
  379. params = {
  380. beginTime: this.beginTime,
  381. endTime: this.endTime,
  382. number: this.typeStatistics,
  383. }
  384. res = await this.$http.post('/APPPartner/getFivePartnerCount', params);
  385. } else {
  386. res = await this.$http.post('/APPPartner/getCountUser', params);
  387. }
  388. if (res.code == '200') {
  389. this.echartsList = res.data
  390. if (res.data.countUserNumVoList && res.data.countUserNumVoList.length > 0) {
  391. let dateList = res.data.countUserNumVoList.map(function(item) {
  392. // return item.time.split(" ")[1] ? item.time.split(" ")[1] + ':00' : item.time.split(" ")[0]
  393. return item.time
  394. });
  395. let valueList = res.data.countUserNumVoList.map(function(item) {
  396. return item.countNum;
  397. });
  398. let rualit = {
  399. categories: dateList,
  400. series: [{
  401. name: "人数",
  402. // type: "line",
  403. data: valueList
  404. }]
  405. };
  406. this.chartData1 = JSON.parse(JSON.stringify(rualit));
  407. } else {
  408. this.echartsList.countUserNumVoList = []
  409. }
  410. }
  411. }
  412. }
  413. }
  414. </script>
  415. <style lang="scss" scoped>
  416. .headers {
  417. position: fixed;
  418. top: 0;
  419. left: 0;
  420. height: auto;
  421. width: 100%;
  422. z-index: 999999;
  423. padding: 16px;
  424. padding-top: 40px;
  425. text {
  426. font-size: 18px;
  427. font-weight: 700;
  428. color: #333333;
  429. }
  430. }
  431. .headers-right {
  432. position: absolute;
  433. right: 15px;
  434. display: flex;
  435. align-items: center;
  436. text {
  437. font-size: 13px;
  438. color: #666666;
  439. }
  440. image {
  441. // right: 0;
  442. width: 15px;
  443. height: 15px;
  444. margin-right: 5px;
  445. }
  446. }
  447. .body-box {
  448. background: #ffffff;
  449. margin: 15px
  450. }
  451. .statistics-title {
  452. font-size: 16px;
  453. color: #333333;
  454. }
  455. .statistics-title::before {
  456. content: " ";
  457. display: inline-block;
  458. width: 4px;
  459. height: 12px;
  460. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  461. border-radius: 5px 5px 5px 5px;
  462. margin-right: 4px;
  463. margin-top: 2px;
  464. }
  465. .search-data {
  466. color: #666666;
  467. border: 1px solid #EEEEEE;
  468. .active {
  469. color: #FFFFFF;
  470. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  471. }
  472. text {
  473. padding: 5px 6px;
  474. border-left: 1px solid #EEEEEE;
  475. }
  476. text:first-child {
  477. border-left: none
  478. }
  479. }
  480. .statistics-number {
  481. margin: 10px 10px 20px 10px;
  482. background: #FBFBFB;
  483. border-radius: 4px 4px 4px 4px;
  484. text-align: center;
  485. padding: 15px 0;
  486. overflow: hidden;
  487. view {
  488. width: 33.33%;
  489. float: left;
  490. }
  491. text {
  492. display: block;
  493. }
  494. text:first-child {
  495. font-size: 25px;
  496. color: #333333;
  497. }
  498. text:last-child {
  499. font-size: 13px;
  500. color: #999999;
  501. }
  502. }
  503. .statistics-type {
  504. text-align: center;
  505. margin-bottom: 20px;
  506. text {
  507. display: inline-block;
  508. width: 80px;
  509. height: 30px;
  510. line-height: 30px;
  511. text-align: center;
  512. font-size: 16px;
  513. color: #666666;
  514. background: #F4F4F4;
  515. }
  516. .selected {
  517. color: #FFFFFF;
  518. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  519. }
  520. // text:first-child{
  521. // color: #FFFFFF;
  522. // background: linear-gradient( 132deg, #2DD9FF 0%, #2D6DFF 100%);
  523. // }
  524. }
  525. .partner-type {
  526. margin: 10px;
  527. width: 97%;
  528. overflow: hidden;
  529. white-space: nowrap;
  530. text {
  531. display: inline-block;
  532. border-radius: 14px 14px 14px 14px;
  533. font-size: 14px;
  534. color: #666666;
  535. padding: 1px 10px;
  536. background: #F4F4F4;
  537. margin-right: 8px;
  538. }
  539. .selected {
  540. color: #FFFFFF;
  541. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  542. }
  543. }
  544. .teamStatistics {
  545. margin: 10px;
  546. background: #FFFFFF;
  547. // box-shadow: 0px 4px 10px 0px #DAE3F4;
  548. border-radius: 2px 2px 2px 2px;
  549. border: 1px solid #C8D8FF;
  550. }
  551. .statisticsContent {
  552. box-sizing: border-box;
  553. height: 70upx;
  554. text-align: center;
  555. line-height: 70upx;
  556. font-size: 26rpx;
  557. color: #666666;
  558. display: flex;
  559. flex-wrap: nowrap;
  560. justify-content: space-around;
  561. view {
  562. text-align: center;
  563. line-height: 70upx;
  564. width: 25%;
  565. font-size: 12px;
  566. }
  567. image {
  568. display: inline-block;
  569. width: 21px;
  570. height: 21px;
  571. vertical-align: middle;
  572. }
  573. }
  574. .statisticsTitle {
  575. display: flex;
  576. flex-wrap: nowrap;
  577. justify-content: space-around;
  578. height: 70upx;
  579. box-sizing: border-box;
  580. line-height: 70upx;
  581. font-size: 24rpx;
  582. color: #232832;
  583. background: linear-gradient(180deg, #DAE0EE 0%, #E9ECF4 100%);
  584. // border-radius: 6px 6px 0 0;
  585. view {
  586. text-align: center;
  587. line-height: 35px;
  588. color: #2D6DFF;
  589. width: 25%;
  590. font-size: 12px;
  591. }
  592. }
  593. .charts-box {
  594. width: 100%;
  595. height: 300px;
  596. }
  597. </style>