statistics.vue 15 KB

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