You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

710 lines
19 KiB

  1. <template>
  2. <view class="box">
  3. <view class="boxtittab">
  4. <view class="tabbox">
  5. <view :class="{ activecllasscet: activeTotal == 4 }" @click="tabtimetap(4)">近七天</view>
  6. </view>
  7. <view class="tabbox">
  8. <view :class="{ activecllasscet: activeTotal == 5 }" @click="tabtimetap(5)">近15天</view>
  9. </view>
  10. <view class="tabbox">
  11. <view :class="{ activecllasscet: activeTotal == 6 }" @click="tabtimetap(6)">近30天</view>
  12. </view>
  13. <view class="tabbox">
  14. <view :class="{ activecllasscet: activeTotal == 3 }" @click="tabtimetap(3)">自定义</view>
  15. </view>
  16. </view>
  17. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  18. <view class="Piabodata-box">
  19. <view class="Piabodata" @click="toTrendAnalysis()">
  20. <view class="Piabodata-img">
  21. <image class="Piabodata-img1" src="../../../static/images/qushi.png" mode=""></image>
  22. </view>
  23. <view class="Piabodata-text">趋势分析</view>
  24. </view>
  25. <view class="Piabodata" @click="toStaffAnalysis()">
  26. <view class="Piabodata-img">
  27. <image class="Piabodata-img1" src="../../../static/images/yuangong.png" mode=""></image>
  28. </view>
  29. <view class="Piabodata-text">员工分析</view>
  30. </view>
  31. <view class="Piabodata" @click="toUserinsightinto()">
  32. <view class="Piabodata-img">
  33. <image class="Piabodata-img1" src="../../../static/images/yinghu.png" mode=""></image>
  34. </view>
  35. <view class="Piabodata-text">用户洞察</view>
  36. </view>
  37. <view class="Piabodata" @click="Theteamcompared()" v-if="Theteamcomparedisshow">
  38. <view class="Piabodata-img">
  39. <image class="Piabodata-img1" src="../../../static/images/tuandui.png" mode=""></image>
  40. </view>
  41. <view class="Piabodata-text">团队对比</view>
  42. </view>
  43. <view class="Piabodata" @click="Groupcontrast()" v-if="Groupcontrastisshow">
  44. <view class="Piabodata-img">
  45. <image class="Piabodata-img1" src="../../../static/images/jituan.png" mode=""></image>
  46. </view>
  47. <view class="Piabodata-text">集团对比</view>
  48. </view>
  49. </view>
  50. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  51. <view class="boxzonglan" style="min-height: 400rpx;">
  52. <view class="zonglantit">简报</view>
  53. <view class="zonglanbox">
  54. <view class="grid" v-for="(item,index) in numlist" :key="index">
  55. <view class="audonum">{{item.name}}</text></view>
  56. <view class="num">{{item.num}}</view>
  57. </view>
  58. </view>
  59. </view>
  60. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  61. <view class="single">
  62. <view class="title">
  63. <view class="title1">接待趋势</view>
  64. </view>
  65. <view class="swiper-box">
  66. <u-tabs-swiper ref="tabs" font-size="30" :bold="true" swiper-width="600" :current="bocindex" @change="tapspagek2()"
  67. inactive-color="#b1b1b1" active-color="#008ef2" :list="newlistoj1" :is-scroll="true">
  68. </u-tabs-swiper>
  69. </view>
  70. <!-- <view class="hejibox">
  71. <view class="heji">合计:50</view>
  72. <view class="heji">均值:25</view>
  73. </view> -->
  74. <!-- <view class="danwei">来访(人)</view> -->
  75. <view class="uchaserbox">
  76. <qiun-data-charts
  77. type="line"
  78. :chartData="lineOptsect"
  79. background="none"
  80. :ontouch="true"
  81. canvasId="wangxiaohuaerlingilingwuyiba1"
  82. :canvas2d="true"
  83. />
  84. </view>
  85. </view>
  86. <view class="" v-if="teamFlag">
  87. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  88. <view class="single">
  89. <view class="title" @click="staffShow1=true">
  90. <view class="title1">团队接待趋势</view>
  91. <view class="title2">
  92. <view class="title2-che" style="width: 220rpx;">{{team.label}}
  93. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  94. </view>
  95. <!-- <view class="title2-che">执行率
  96. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  97. </view> -->
  98. </view>
  99. </view>
  100. <!-- <view class="hejibox">
  101. <view class="heji">合计:{{allnum||0}}</view>
  102. <view class="heji">均值:{{allavg||0}}</view>
  103. </view> -->
  104. <view class="danwei">来访(人)</view>
  105. <view class="uchaserbox">
  106. <qiun-data-charts
  107. type="line"
  108. :chartData="lineOptsect1"
  109. background="none"
  110. :ontouch="true"
  111. canvasId="wangxiaohuaerlineryiliwuyibao"
  112. :canvas2d="true"
  113. />
  114. </view>
  115. </view>
  116. </view>
  117. <view class="" v-if="staffFlag">
  118. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  119. <view class="single">
  120. <view class="title">
  121. <view class="title1">员工接待趋势</view>
  122. <view class="title2" @click="staffShow=true">
  123. <view class="title2-che" style="width: 220rpx;">{{staff.label}}
  124. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  125. </view>
  126. <!-- <view class="title2-che">执行率
  127. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  128. </view> -->
  129. </view>
  130. </view>
  131. <!-- <view class="hejibox">
  132. <view class="heji">合计:{{allnum1||0}}</view>
  133. <view class="heji">均值:{{allavg1||0}}</view>
  134. </view> -->
  135. <view class="danwei">来访(人)</view>
  136. <view class="uchaserbox">
  137. <qiun-data-charts
  138. type="line"
  139. :chartData="lineOptsect2"
  140. background="none"
  141. :ontouch="true"
  142. canvasId="wangxiaohuaerlingeryilingwuyibao"
  143. :canvas2d="true"
  144. />
  145. </view>
  146. </view>
  147. </view>
  148. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  149. <view class="single">
  150. <view class="title">
  151. <view class="title1">销讲维度执行率</view>
  152. <!-- <view class="title3">
  153. <view class="title3-box">
  154. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 0 }">执行率</view>
  155. </view>
  156. <view class="title3-box">
  157. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 1 }">得分</view>
  158. </view>
  159. </view> -->
  160. </view>
  161. <!-- <view class="hejibox">
  162. <view class="heji">合计:50</view>
  163. <view class="heji">均值:25</view>
  164. </view> -->
  165. <view class="jindu">
  166. <scroll-view style="height: 300rpx;" scroll-y="true" >
  167. <view class="jindu-box" v-for="(item,index) in newlisttabinfo" :key="index">
  168. <view class="jindu-boxche">
  169. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  170. <view style="width: 440rpx;margin-left: 10rpx;">
  171. <u-line-progress height="24" :show-percent="false" active-color="#4FC78F" :percent="item.zxl"></u-line-progress>
  172. </view>
  173. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}%</view>
  174. </view>
  175. </view>
  176. </scroll-view>
  177. </view>
  178. </view>
  179. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  180. <view class="single">
  181. <view class="title">
  182. <view class="title1">销讲指标执行率</view>
  183. </view>
  184. <view class="swiper-box">
  185. <u-tabs-swiper ref="tabs" font-size="30" :bold="true" swiper-width="600" :current="bocindex1" @change="tapspagek3"
  186. inactive-color="#b1b1b1" active-color="#008ef2" :list="newlistoj" :is-scroll="true">
  187. </u-tabs-swiper>
  188. </view>
  189. <view class="jindu">
  190. <scroll-view style="height: 300rpx;" scroll-y="true" >
  191. <view class="jindu-box" v-for="(item,index) in newlisttabinfo1" :key="index">
  192. <view class="jindu-boxche">
  193. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  194. <view style="width: 440rpx;margin-left: 10rpx;">
  195. <u-line-progress height="24" :show-percent="false" active-color="#4FC78F" :percent="item.zxl"></u-line-progress>
  196. </view>
  197. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}%</view>
  198. </view>
  199. </view>
  200. </scroll-view>
  201. </view>
  202. </view>
  203. <u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar>
  204. <u-select v-model="staffShow" :list="staffList" @confirm="staffSelectCallback($event,0)" :default-value='selindex'></u-select>
  205. <u-select v-model="staffShow1" :list="teamList" @confirm="staffSelectCallback($event,1)" :default-value='selindex'></u-select>
  206. </view>
  207. </template>
  208. <script>
  209. var app = getApp();
  210. var util = require("../../../utils/util.js");
  211. var config = require("../../../config");
  212. export default {
  213. data() {
  214. return {
  215. activeTotal: 4,
  216. activeTotal2: 0,
  217. houseId:'',
  218. timeobj:{
  219. statDateStart:'',
  220. statDateEnd:''
  221. },
  222. // 员工列表
  223. staffList:[],
  224. // 团队列表
  225. teamList:[],
  226. staffShow:false,
  227. staff:{
  228. value:'',
  229. label:''
  230. },
  231. team:{
  232. value:'',
  233. label:''
  234. },
  235. teamFlag:true,
  236. bocindex1:0,
  237. staffFlag:true,
  238. staffShow1:false,
  239. lastStartDate:'',
  240. lastEndDate :'',
  241. allnum:'',
  242. allavg:'',
  243. allnum1:'',
  244. allavg1:'',
  245. totalTimeShow: false,
  246. activeTab: 0,
  247. numlist:[
  248. {name:'接待量',num:'10'},
  249. {name:'接待客户',num:'10'},
  250. {name:'平均执行率',num:'10'},
  251. {name:'录音时长',num:'10'},
  252. ],
  253. lineOptsect:{
  254. "categories": ["2016","2017","2018","2019","2020","2021"],
  255. "series": [
  256. {
  257. "name": "成交量",
  258. "data": [35,8,25,37,4,20]
  259. }
  260. ]
  261. },
  262. lineOptsect1:{
  263. "categories": [],
  264. "series": []
  265. },
  266. lineOptsect2:{
  267. "categories": ["2016","2017","2018","2019","2020","2021"],
  268. "series": [
  269. {
  270. "name": "成交量",
  271. "data": [35,8,25,37,4,20]
  272. }
  273. ]
  274. },
  275. newlistoj:[],
  276. newlistoj1:[
  277. {name:"接待量",id:1},
  278. {name:"平均执行率",id:2},
  279. {name:"接待客户",id:3},
  280. {name:"录音时长",id:5},
  281. ],
  282. bocindex:0,
  283. newlisttabinfo:[
  284. {name:'接待量',zxl:'10'},
  285. {name:'平均执行率',zxl:'50'},
  286. {name:'接待客户',zxl:'80'},
  287. ],
  288. newlisttabinfo1:[
  289. {name:'接待量',zxl:'10'},
  290. {name:'平均执行率',zxl:'50'},
  291. {name:'接待客户',zxl:'80'},
  292. ],
  293. Theteamcomparedisshow:false,
  294. Groupcontrastisshow:false,
  295. allechar:[],
  296. allList:[]
  297. };
  298. },
  299. onShow() {
  300. // 获取楼盘id
  301. this.houseId = uni.getStorageSync('buildingID').id;
  302. // 获取数据看板
  303. // 获取员工
  304. this.getStaffList()
  305. // 获取团队
  306. this.getSectionList()
  307. // 获取团队是否显示权限
  308. this.queryHaveDept()
  309. // 获取简报
  310. this.getReport()
  311. // 获取接待趋势
  312. this.getRtrent()
  313. // 获取维度
  314. this.getindexZxl()
  315. },
  316. methods: {
  317. queryHaveDept() {
  318. return new Promise((resolve, reject) => {
  319. this.$u.get("/user/queryHaveDept?houseId="+this.houseId).then(res => {
  320. this.permissions(res)
  321. })
  322. })
  323. },
  324. permissions(res){
  325. if(res==1){
  326. this.Theteamcomparedisshow=false;
  327. this.Groupcontrastisshow=false;
  328. return
  329. }
  330. let totle=uni.getStorageSync('weapp_session_userInfo_data').total;
  331. if(totle==1){
  332. this.Theteamcomparedisshow=true;
  333. this.Groupcontrastisshow=false;
  334. }else{
  335. this.Theteamcomparedisshow=true;
  336. this.Groupcontrastisshow=true;
  337. }
  338. },
  339. // 获取员工列表
  340. getStaffList(){
  341. this.$u.post('/cusLvStatistics/selectAllAccountIdByHouseId',{houseId:this.houseId})
  342. .then(res=>{
  343. // console.log(res,'123')
  344. this.staffList=[]
  345. res.map(item=>{
  346. let obj={}
  347. obj.value=item.accountId
  348. obj.label=item.name
  349. this.staffList.push(obj)
  350. })
  351. this.staff=this.staffList[0]
  352. this.getAward()
  353. })
  354. },
  355. // 获取接待趋势
  356. getRtrent(){
  357. this.$u.post('/cusLvStatistics/receptionTrend',{
  358. houseId:this.houseId,
  359. timeType:this.lastEndDate?null:this.activeTotal,
  360. lastEndDate:this.lastEndDate,
  361. lastStartDate:this.lastStartDate
  362. })
  363. .then(res=>{
  364. // console.log(res)
  365. this.allechar=res
  366. this.tapspagek2(this.bocindex)
  367. })
  368. },
  369. // 销奖维度
  370. getindexZxl(){
  371. this.$u.post('/cusLvStatistics/indexZxl',{
  372. houseId:this.houseId,
  373. timeType:this.lastEndDate?null:this.activeTotal,
  374. lastEndDate:this.lastEndDate,
  375. lastStartDate:this.lastStartDate
  376. })
  377. .then(res=>{
  378. // console.log(res)
  379. // 处理销奖维度执行率
  380. // this.newlisttabinfo
  381. let arr=[]
  382. this.newlistoj=[]
  383. res.list.map((item,index)=>{
  384. arr.push({
  385. name:item.name,
  386. zxl:item.zxl
  387. })
  388. this.newlistoj.push({
  389. name:item.name,
  390. id:index
  391. })
  392. })
  393. this.newlisttabinfo=arr
  394. this.allList=res.list
  395. this.tapspagek3(this.bocindex1)
  396. })
  397. },
  398. // 获取简报
  399. getReport(){
  400. this.$u.post('/cusLvStatistics/xiaojiangAnalysis',{
  401. houseId:this.houseId,
  402. timeType:this.lastEndDate?null:this.activeTotal,
  403. lastEndDate:this.lastEndDate,
  404. lastStartDate:this.lastStartDate
  405. })
  406. .then(res=>{
  407. // 接待量
  408. this.numlist[0].num=res.receptionCount||0
  409. // 接待客户
  410. this.numlist[1].num=res.sumCustomer||0
  411. // 执行率
  412. this.numlist[2].num=(res.fraction||0)+'%'
  413. // 录音时长
  414. this.numlist[3].num=util.formatSecond(res.sumDuration)||0
  415. })
  416. },
  417. // 获取团队列表
  418. getSectionList(){
  419. this.$u.post('/cusLvStatistics/findAllDeptIdByHouseId',{houseId:this.houseId})
  420. .then(res=>{
  421. this.teamList=[]
  422. res.map(item=>{
  423. let obj={}
  424. obj.value=item.deptId
  425. obj.label=item.deptName
  426. this.teamList.push(obj)
  427. })
  428. this.team=this.teamList[0]
  429. this.receptionCountList()
  430. })
  431. },
  432. // 员工销奖趋势
  433. getAward(){
  434. if(this.staffList.length==0){
  435. this.staffFlag=false
  436. this.$forceUpdate()
  437. return
  438. }
  439. this.$u.post('/cusLvStatistics/employeeAnalysisExacutiveRate',{
  440. userA:this.staff.value,
  441. userB:'',
  442. houseId:this.houseId,
  443. timeType:this.lastEndDate?null:this.activeTotal+'',
  444. lastEndDate:this.lastEndDate,
  445. lastStartDate:this.lastStartDate
  446. })
  447. .then(res=>{
  448. this.allnum1=res.avg[0]
  449. this.allavg1=res.avg[1]
  450. // console.log(res)
  451. let first=res.first
  452. let second=res.second
  453. this.lineOptsect2.categories=[]
  454. this.lineOptsect2.series=[
  455. {
  456. name:first[0].accountName,
  457. data:[]
  458. }
  459. ]
  460. first.map(item=>{
  461. this.lineOptsect2.categories.push(item.statDate.slice(5,10))
  462. this.lineOptsect2.series[0].data.push(item.sumFraction)
  463. })
  464. })
  465. },
  466. // 团队接待趋势
  467. receptionCountList(){
  468. if(this.teamList.length==0){
  469. this.teamFlag=false
  470. this.$forceUpdate()
  471. return
  472. }
  473. this.$u.post('/cusLvStatistics/teamAnalysisExecutionRate',{
  474. deptIds:this.team.value,
  475. showRank:1,
  476. houseId:this.houseId,
  477. timeType:this.lastEndDate?null:this.activeTotal+'',
  478. lastEndDate:this.lastEndDate,
  479. lastStartDate:this.lastStartDate
  480. })
  481. .then(res=>{
  482. // console.log(res)
  483. let result=res.result
  484. this.allnum=res.avg[0]
  485. this.allavg=res.avg[1]
  486. // 当选择趋势时
  487. this.lineOptsect1={}
  488. let allobj={
  489. categories:[],
  490. series:[]
  491. }
  492. // 先处理时间
  493. // 当选择全部时
  494. // 当选择只有一个时
  495. let obj={}
  496. obj.data=[]
  497. obj.name=result[0][0].deptName
  498. result[0].map(item=>{
  499. allobj.categories.push(item.statDate.slice(5,10))
  500. obj.data.push(item.data)
  501. })
  502. allobj.series.push(obj)
  503. this.lineOptsect1=allobj
  504. })
  505. },
  506. //时间切换
  507. tabtimetap(index) {
  508. if (index == 3) {
  509. this.totalTimeShow = true;
  510. } else {
  511. this.activeTotal = index;
  512. this.lastEndDate=''
  513. this.lastStartDate=''
  514. this.getdata()
  515. }
  516. },
  517. // 获取数据
  518. getdata(){
  519. this.receptionCountList()
  520. this.getReport()
  521. this.getRtrent()
  522. this.getindexZxl()
  523. },
  524. staffSelectCallback(e,idx){
  525. if(idx==0){
  526. this.staff=e[0]
  527. this.getAward()
  528. }else{
  529. this.team=e[0]
  530. this.receptionCountList()
  531. }
  532. // console.log(e,idx)
  533. },
  534. //自定义时间
  535. totalTimeChange(e) {
  536. console.log(e.startDate, e.endDate)
  537. this.activeTotal=3;
  538. this.lastEndDate=e.endDate
  539. this.lastStartDate=e.startDate
  540. this.getdata()
  541. },
  542. //指标执行率分析tab
  543. tapspagek2(index) {
  544. // console.log(index)
  545. // 对数据进行分析和处理
  546. // 先处理日期
  547. let allobj={
  548. "categories": [],
  549. "series": [
  550. {
  551. name:'接待量',
  552. data:[]
  553. }
  554. ]
  555. }
  556. if(index==0){
  557. // 接待量
  558. this.allechar.map(item=>{
  559. allobj.categories.push(item.statDate.slice(5,10))
  560. allobj.series[0].data.push(item.receptionCount)
  561. })
  562. }else if(index==1){
  563. // 平均执行率
  564. this.allechar.map(item=>{
  565. allobj.categories.push(item.statDate.slice(5,10))
  566. allobj.series[0].data.push(item.fraction)
  567. })
  568. }else if(index==2){
  569. // 接待客户
  570. this.allechar.map(item=>{
  571. allobj.categories.push(item.statDate.slice(5,10))
  572. allobj.series[0].data.push(item.sumCustomer)
  573. })
  574. }else{
  575. // 录音时长
  576. this.allechar.map(item=>{
  577. allobj.categories.push(item.statDate.slice(5,10))
  578. allobj.series[0].data.push(item.sumDuration)
  579. })
  580. }
  581. this.bocindex = index;
  582. // console.log(allobj)
  583. // return
  584. this.lineOptsect=allobj
  585. },
  586. tapspagek3(index){
  587. let arr=[]
  588. // return
  589. // console.log(index,this.allList[index])
  590. this.allList[index].children.map(item=>{
  591. arr.push({
  592. name:item.name,
  593. zxl:item.zxl
  594. })
  595. })
  596. this.newlisttabinfo1=arr
  597. this.bocindex1 = index;
  598. },
  599. //集团对比
  600. Groupcontrast(){
  601. uni.navigateTo({
  602. url: '/pages/center/Piabodata/Groupcontrast'
  603. });
  604. },
  605. //团队对比
  606. Theteamcompared(){
  607. if(this.teamList.length==0){
  608. uni.showToast({
  609. title:'没有团队呢',
  610. icon:'none'
  611. })
  612. return
  613. }
  614. uni.navigateTo({
  615. url: '/pages/center/Piabodata/Theteamcompared'
  616. });
  617. },
  618. //用户洞察
  619. toUserinsightinto(){
  620. uni.navigateTo({
  621. url: '/pages/center/Piabodata/Userinsightinto'
  622. });
  623. },
  624. //趋势分析
  625. toTrendAnalysis(){
  626. uni.navigateTo({
  627. url: '/pages/center/Piabodata/TrendAnalysis'
  628. });
  629. },
  630. //员工分析
  631. toStaffAnalysis(){
  632. if(this.staffList.length==0){
  633. uni.showToast({
  634. title:'没有团队呢',
  635. icon:'none'
  636. })
  637. return
  638. }
  639. uni.navigateTo({
  640. url: '/pages/center/Piabodata/StaffAnalysis'
  641. });
  642. }
  643. }
  644. };
  645. </script>
  646. <style lang="scss" scoped>
  647. .box {
  648. width: 100%;
  649. height: 100%;
  650. background: #FAFAFA;
  651. padding-bottom: 60rpx;
  652. }
  653. .Piabodata-box{
  654. width: 100%;
  655. background: #FFFFFF;
  656. display: flex;
  657. flex-wrap: wrap;
  658. padding-bottom: 30rpx;
  659. .Piabodata{
  660. width: 33.3%;
  661. .Piabodata-img{
  662. width: 100%;
  663. text-align: center;
  664. .Piabodata-img1{
  665. width: 134rpx;
  666. height: 134rpx;
  667. }
  668. }
  669. .Piabodata-text{
  670. width: 100%;
  671. text-align: center;
  672. font-size: 24rpx;
  673. font-weight: 400;
  674. color: #333333;
  675. margin-top: -10rpx;
  676. }
  677. }
  678. }
  679. .grid:nth-child(1){
  680. border-right:none ;
  681. border-bottom:none ;
  682. }
  683. .grid:nth-child(2){
  684. border-bottom:none ;
  685. }
  686. .grid:nth-child(3){
  687. border-right:none ;
  688. }
  689. </style>