statistics.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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,
  344. labelText: `${res.data.newProportion?'新增:'+res.data.newProportion+'%':'新增:0%'}` },
  345. { name: "历史", value: res.data.oldProportion,
  346. labelText: `${res.data.oldProportion?'历史:'+res.data.oldProportion+'%':'历史:0%'}`
  347. }
  348. ]
  349. // "data": [
  350. // { name: `新增`, value: res.data.newProportion?res.data.newProportion:0},
  351. // { name: "历史", value: res.data.oldProportion?res.data.oldProportion:0}
  352. // ]
  353. }]
  354. }
  355. }
  356. },
  357. async rankingQueryData() {
  358. let params = {
  359. type: this.typeStatistics3,
  360. }
  361. let res = await this.$http.get('/APPPartner/getLevelPartner', params);
  362. if (res.code == '200') {
  363. this.directLsit = res.data
  364. }
  365. },
  366. getTime(beginTime,endTime){
  367. this.beginTime=beginTime
  368. this.endTime=endTime
  369. },
  370. async queryData() {
  371. let params = {
  372. beginTime: this.beginTime,
  373. endTime: this.endTime,
  374. type: this.typeStatistics,
  375. }
  376. let res = {}
  377. if (this.type == 1 &&this.level!==5) {
  378. res = await this.$http.post('/APPPartner/getPartnerCount', params);
  379. }else if (this.type == 1 &&this.level==5) {
  380. params = {
  381. beginTime: this.beginTime,
  382. endTime: this.endTime,
  383. number: this.typeStatistics,
  384. }
  385. res = await this.$http.post('/APPPartner/getFivePartnerCount', params);
  386. }
  387. else {
  388. res = await this.$http.post('/APPPartner/getCountUser', params);
  389. }
  390. if (res.code == '200') {
  391. this.echartsList = res.data
  392. if (res.data.countUserNumVoList && res.data.countUserNumVoList.length > 0) {
  393. let dateList = res.data.countUserNumVoList.map(function (item) {
  394. // return item.time.split(" ")[1] ? item.time.split(" ")[1] + ':00' : item.time.split(" ")[0]
  395. return item.time
  396. });
  397. let valueList = res.data.countUserNumVoList.map(function (item) {
  398. return item.countNum;
  399. });
  400. let rualit = {
  401. categories: dateList,
  402. series: [
  403. {
  404. name: "人数",
  405. // type: "line",
  406. data: valueList
  407. },
  408. ]
  409. };
  410. this.chartData1 = JSON.parse(JSON.stringify(rualit));
  411. valueList.sort((a, b) => a - b)
  412. this.opts1.yAxis.data[0].max = valueList[valueList.length - 1];
  413. }
  414. else {
  415. this.echartsList.countUserNumVoList = []
  416. }
  417. }
  418. }
  419. }
  420. }
  421. </script>
  422. <style lang="scss" scoped>
  423. .headers {
  424. position: fixed;
  425. top: 0;
  426. left: 0;
  427. height: auto;
  428. width: 100%;
  429. z-index: 999999;
  430. padding: 16px;
  431. padding-top: 40px;
  432. text {
  433. font-size: 18px;
  434. font-weight: 700;
  435. color: #333333;
  436. }
  437. }
  438. .headers-right {
  439. position: absolute;
  440. right: 15px;
  441. display: flex;
  442. align-items: center;
  443. text {
  444. font-size: 13px;
  445. color: #666666;
  446. }
  447. image {
  448. // right: 0;
  449. width: 15px;
  450. height: 15px;
  451. margin-right: 5px;
  452. }
  453. }
  454. .body-box {
  455. background: #ffffff;
  456. margin: 15px
  457. }
  458. .statistics-title {
  459. font-size: 16px;
  460. color: #333333;
  461. }
  462. .statistics-title::before {
  463. content: " ";
  464. display: inline-block;
  465. width: 4px;
  466. height: 12px;
  467. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  468. border-radius: 5px 5px 5px 5px;
  469. margin-right: 4px;
  470. margin-top: 2px;
  471. }
  472. .search-data {
  473. color: #666666;
  474. border: 1px solid #EEEEEE;
  475. .active {
  476. color: #FFFFFF;
  477. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  478. }
  479. text {
  480. padding: 5px 6px;
  481. border-left: 1px solid #EEEEEE;
  482. }
  483. text:first-child {
  484. border-left: none
  485. }
  486. }
  487. .statistics-number {
  488. margin: 10px 10px 20px 10px;
  489. background: #FBFBFB;
  490. border-radius: 4px 4px 4px 4px;
  491. text-align: center;
  492. padding: 15px 0;
  493. overflow: hidden;
  494. view {
  495. width: 33.33%;
  496. float: left;
  497. }
  498. text {
  499. display: block;
  500. }
  501. text:first-child {
  502. font-size: 25px;
  503. color: #333333;
  504. }
  505. text:last-child {
  506. font-size: 13px;
  507. color: #999999;
  508. }
  509. }
  510. .statistics-type {
  511. text-align: center;
  512. text {
  513. display: inline-block;
  514. width: 80px;
  515. height: 30px;
  516. line-height: 30px;
  517. text-align: center;
  518. font-size: 16px;
  519. color: #666666;
  520. background: #F4F4F4;
  521. }
  522. .selected {
  523. color: #FFFFFF;
  524. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  525. }
  526. // text:first-child{
  527. // color: #FFFFFF;
  528. // background: linear-gradient( 132deg, #2DD9FF 0%, #2D6DFF 100%);
  529. // }
  530. }
  531. .partner-type {
  532. margin: 10px;
  533. width: 97%;
  534. overflow: hidden;
  535. white-space: nowrap;
  536. text {
  537. display: inline-block;
  538. border-radius: 14px 14px 14px 14px;
  539. font-size: 14px;
  540. color: #666666;
  541. padding: 1px 10px;
  542. background: #F4F4F4;
  543. margin-right: 8px;
  544. }
  545. .selected {
  546. color: #FFFFFF;
  547. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  548. }
  549. }
  550. .teamStatistics {
  551. margin: 10px;
  552. background: #FFFFFF;
  553. // box-shadow: 0px 4px 10px 0px #DAE3F4;
  554. border-radius: 2px 2px 2px 2px;
  555. border: 1px solid #C8D8FF;
  556. }
  557. .statisticsContent {
  558. box-sizing: border-box;
  559. height: 70upx;
  560. text-align: center;
  561. line-height: 70upx;
  562. font-size: 26rpx;
  563. color: #666666;
  564. display: flex;
  565. flex-wrap: nowrap;
  566. justify-content: space-around;
  567. view {
  568. text-align: center;
  569. line-height: 70upx;
  570. width: 25%;
  571. font-size: 12px;
  572. }
  573. image {
  574. display: inline-block;
  575. width: 21px;
  576. height: 21px;
  577. vertical-align: middle;
  578. }
  579. }
  580. .statisticsTitle {
  581. display: flex;
  582. flex-wrap: nowrap;
  583. justify-content: space-around;
  584. height: 70upx;
  585. box-sizing: border-box;
  586. line-height: 70upx;
  587. font-size: 24rpx;
  588. color: #232832;
  589. background: linear-gradient(180deg, #DAE0EE 0%, #E9ECF4 100%);
  590. // border-radius: 6px 6px 0 0;
  591. view {
  592. text-align: center;
  593. line-height: 35px;
  594. color: #2D6DFF;
  595. width: 25%;
  596. font-size: 12px;
  597. }
  598. }
  599. .charts-box {
  600. width: 100%;
  601. height: 300px;
  602. }
  603. </style>