statistics.vue 16 KB

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