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.
 
 
 

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