statistics.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  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" :ontouch="true" :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" :ontouch="true" />
  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. enableScroll: true,
  225. padding: [15,10,15,0],
  226. legend: {
  227. show: false // 设置图例不显示
  228. },
  229. yAxis: {
  230. gridType: "dash",
  231. dashLength: 2,
  232. data: [
  233. {
  234. min: 0,
  235. max: 10
  236. }
  237. ]
  238. },
  239. extra: {
  240. area: {
  241. type: "curve",
  242. opacity: 0.2,
  243. addLine: true,
  244. width: 2,
  245. gradient: true,
  246. activeType: "hollow"
  247. },
  248. // line: {
  249. // type: "curve",
  250. // width: 2,
  251. // activeType: "hollow",
  252. // linearType: "custom"
  253. // }
  254. },
  255. xAxis: {
  256. disableGrid: true,
  257. type:'grid',
  258. gridType:'dash',
  259. itemCount:4,//x轴单屏显示数据的数量,默认为5个
  260. scrollShow:true,//新增是否显示滚动条,默认false
  261. scrollAlign:'left',//滚动条初始位置
  262. scrollBackgroundColor:'#F7F7FF',//默认为 #EFEBEF
  263. scrollColor:'#A6A6A6',//默认为 #A6A6A6,
  264. fontSize:11,
  265. },
  266. },
  267. chartData1: {},
  268. directLsit: []
  269. }
  270. },
  271. computed: {
  272. ...mapState(['userInfo']),
  273. },
  274. onLoad() {
  275. this.level = this.userInfo.sysUser.level
  276. if (this.level == 2) {
  277. this.partnerTypeOption = this.partnerTypeOption.slice(0, -1);
  278. }
  279. if (this.level == 3) {
  280. this.partnerTypeOption = this.partnerTypeOption.slice(0, -2);
  281. }
  282. if (this.level == 4) {
  283. this.partnerTypeOption = this.partnerTypeOption.slice(0, 1);
  284. }
  285. this.$http.get('/sys/qy/wechat/find/picture').then(res => {
  286. this.supportStaffUrl = res.data.supportStaffUrl
  287. })
  288. },
  289. onShow() {
  290. this.type = uni.getStorageSync('type')
  291. // if(this.type ==2){
  292. // this.queryData({type:1})
  293. // }
  294. // else{
  295. // this.queryData({type:1})
  296. // }
  297. this.queryData()
  298. if (this.type == 1 && this.level!==5) {
  299. this.analysisQueryData()
  300. this.rankingQueryData()
  301. }
  302. },
  303. methods: {
  304. canvasInit(canvas, width, height) {
  305. // 初始化画布
  306. this.canvas2d = canvas;
  307. },
  308. directDetail(val){
  309. uni.navigateTo({
  310. url: "/pages/statistics/statisticsDetail?key=" + encodeURIComponent(JSON.stringify(val.partnerIds))
  311. })
  312. },
  313. getPartnerType2(type) {
  314. this.typeStatistics2 = type
  315. this.analysisQueryData()
  316. },
  317. getPartnerType3(type) {
  318. this.typeStatistics3 = type
  319. this.rankingQueryData()
  320. },
  321. getPartnerType(type) {
  322. this.typeStatistics = type
  323. this.queryData()
  324. },
  325. getStatistics(type) {
  326. // uni.navigateTo({
  327. // url: "/pages/tools/achievement/achievement"
  328. // })
  329. // this.studioType=type
  330. this.typeStatistics = type
  331. this.queryData()
  332. },
  333. //点击跳转企业微信客服
  334. weChatService() {
  335. uni.share({
  336. provider: "weixin",
  337. openCustomerServiceChat: true,
  338. customerUrl: this.supportStaffUrl, //企业微信地址
  339. corpid: 'wwfe67d19509d43ec5', //企业id
  340. success: (res) => { },
  341. fail: (err) => { }
  342. });
  343. },
  344. async analysisQueryData() {
  345. let params = {
  346. beginTime: this.beginTime,
  347. endTime: this.endTime,
  348. type: this.typeStatistics2,
  349. }
  350. let res = await this.$http.post('/APPPartner/getPartnerProportion', params);
  351. if (res.code == '200' ) {
  352. this.echartsList2=res.data
  353. this.chartsDataPie2 = {
  354. series: [{
  355. "data": [
  356. { name: `新增`,
  357. value: res.data.newProportion,
  358. labelText: `${res.data.newProportion?'新增:'+res.data.newProportion+'%':'新增:0%'}`
  359. },
  360. { name: "历史",
  361. value: res.data.oldProportion,
  362. labelText: `${res.data.oldProportion?'历史:'+res.data.oldProportion+'%':'历史:0%'}`
  363. }
  364. ]
  365. // "data": [
  366. // { name: `新增`, value: res.data.newProportion?res.data.newProportion:0},
  367. // { name: "历史", value: res.data.oldProportion?res.data.oldProportion:0}
  368. // ]
  369. }]
  370. }
  371. }
  372. },
  373. async rankingQueryData() {
  374. let params = {
  375. type: this.typeStatistics3,
  376. }
  377. let res = await this.$http.get('/APPPartner/getLevelPartner', params);
  378. if (res.code == '200') {
  379. this.directLsit = res.data
  380. }
  381. },
  382. getTime(beginTime,endTime){
  383. this.beginTime=beginTime
  384. this.endTime=endTime
  385. },
  386. async queryData() {
  387. let params = {
  388. beginTime: this.beginTime,
  389. endTime: this.endTime,
  390. type: this.typeStatistics,
  391. }
  392. let res = {}
  393. if (this.type == 1 &&this.level!==5) {
  394. res = await this.$http.post('/APPPartner/getPartnerCount', params);
  395. }else if (this.type == 1 &&this.level==5) {
  396. params = {
  397. beginTime: this.beginTime,
  398. endTime: this.endTime,
  399. number: this.typeStatistics,
  400. }
  401. res = await this.$http.post('/APPPartner/getFivePartnerCount', params);
  402. }
  403. else {
  404. res = await this.$http.post('/APPPartner/getCountUser', params);
  405. }
  406. if (res.code == '200') {
  407. this.echartsList = res.data
  408. if (res.data.countUserNumVoList && res.data.countUserNumVoList.length > 0) {
  409. let dateList = res.data.countUserNumVoList.map(function (item) {
  410. // return item.time.split(" ")[1] ? item.time.split(" ")[1] + ':00' : item.time.split(" ")[0]
  411. return item.time
  412. });
  413. let valueList = res.data.countUserNumVoList.map(function (item) {
  414. return item.countNum;
  415. });
  416. let rualit = {
  417. categories:dateList ,
  418. series: [
  419. {
  420. name: "人数",
  421. // type: "line",
  422. data: valueList
  423. },
  424. ]
  425. };
  426. this.chartData1 = JSON.parse(JSON.stringify(rualit));
  427. valueList.sort((a, b) => a - b)
  428. this.opts1.yAxis.data[0].max = valueList[valueList.length - 1];
  429. }
  430. else {
  431. this.echartsList.countUserNumVoList = []
  432. }
  433. }
  434. }
  435. }
  436. }
  437. </script>
  438. <style lang="scss" scoped>
  439. .headers {
  440. position: fixed;
  441. top: 0;
  442. left: 0;
  443. height: auto;
  444. width: 100%;
  445. z-index: 999999;
  446. padding: 16px;
  447. padding-top: 40px;
  448. text {
  449. font-size: 18px;
  450. font-weight: 700;
  451. color: #333333;
  452. }
  453. }
  454. .headers-right {
  455. position: absolute;
  456. right: 15px;
  457. display: flex;
  458. align-items: center;
  459. text {
  460. font-size: 13px;
  461. color: #666666;
  462. }
  463. image {
  464. // right: 0;
  465. width: 15px;
  466. height: 15px;
  467. margin-right: 5px;
  468. }
  469. }
  470. .body-box {
  471. background: #ffffff;
  472. margin: 15px
  473. }
  474. .statistics-title {
  475. font-size: 16px;
  476. color: #333333;
  477. }
  478. .statistics-title::before {
  479. content: " ";
  480. display: inline-block;
  481. width: 4px;
  482. height: 12px;
  483. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  484. border-radius: 5px 5px 5px 5px;
  485. margin-right: 4px;
  486. margin-top: 2px;
  487. }
  488. .search-data {
  489. color: #666666;
  490. border: 1px solid #EEEEEE;
  491. .active {
  492. color: #FFFFFF;
  493. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  494. }
  495. text {
  496. padding: 5px 6px;
  497. border-left: 1px solid #EEEEEE;
  498. }
  499. text:first-child {
  500. border-left: none
  501. }
  502. }
  503. .statistics-number {
  504. margin: 10px 10px 20px 10px;
  505. background: #FBFBFB;
  506. border-radius: 4px 4px 4px 4px;
  507. text-align: center;
  508. padding: 15px 0;
  509. overflow: hidden;
  510. view {
  511. width: 33.33%;
  512. float: left;
  513. }
  514. text {
  515. display: block;
  516. }
  517. text:first-child {
  518. font-size: 25px;
  519. color: #333333;
  520. }
  521. text:last-child {
  522. font-size: 13px;
  523. color: #999999;
  524. }
  525. }
  526. .statistics-type {
  527. text-align: center;
  528. margin-bottom: 20px;
  529. text {
  530. display: inline-block;
  531. width: 80px;
  532. height: 30px;
  533. line-height: 30px;
  534. text-align: center;
  535. font-size: 16px;
  536. color: #666666;
  537. background: #F4F4F4;
  538. }
  539. .selected {
  540. color: #FFFFFF;
  541. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  542. }
  543. // text:first-child{
  544. // color: #FFFFFF;
  545. // background: linear-gradient( 132deg, #2DD9FF 0%, #2D6DFF 100%);
  546. // }
  547. }
  548. .partner-type {
  549. margin: 10px;
  550. width: 97%;
  551. overflow: hidden;
  552. white-space: nowrap;
  553. text {
  554. display: inline-block;
  555. border-radius: 14px 14px 14px 14px;
  556. font-size: 14px;
  557. color: #666666;
  558. padding: 1px 10px;
  559. background: #F4F4F4;
  560. margin-right: 8px;
  561. }
  562. .selected {
  563. color: #FFFFFF;
  564. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  565. }
  566. }
  567. .teamStatistics {
  568. margin: 10px;
  569. background: #FFFFFF;
  570. // box-shadow: 0px 4px 10px 0px #DAE3F4;
  571. border-radius: 2px 2px 2px 2px;
  572. border: 1px solid #C8D8FF;
  573. }
  574. .statisticsContent {
  575. box-sizing: border-box;
  576. height: 70upx;
  577. text-align: center;
  578. line-height: 70upx;
  579. font-size: 26rpx;
  580. color: #666666;
  581. display: flex;
  582. flex-wrap: nowrap;
  583. justify-content: space-around;
  584. view {
  585. text-align: center;
  586. line-height: 70upx;
  587. width: 25%;
  588. font-size: 12px;
  589. }
  590. image {
  591. display: inline-block;
  592. width: 21px;
  593. height: 21px;
  594. vertical-align: middle;
  595. }
  596. }
  597. .statisticsTitle {
  598. display: flex;
  599. flex-wrap: nowrap;
  600. justify-content: space-around;
  601. height: 70upx;
  602. box-sizing: border-box;
  603. line-height: 70upx;
  604. font-size: 24rpx;
  605. color: #232832;
  606. background: linear-gradient(180deg, #DAE0EE 0%, #E9ECF4 100%);
  607. // border-radius: 6px 6px 0 0;
  608. view {
  609. text-align: center;
  610. line-height: 35px;
  611. color: #2D6DFF;
  612. width: 25%;
  613. font-size: 12px;
  614. }
  615. }
  616. .charts-box {
  617. width: 100%;
  618. height: 300px;
  619. }
  620. </style>