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.
 
 
 

732 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()" v-if="permissions.commonly3">
  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()" v-if="permissions.commonly5">
  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()" v-if="permissions.commonly6">
  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="permissions.commonly4">
  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="permissions.commonly2">
  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. permissions:{
  305. commonly2:false,
  306. commonly3:false,
  307. commonly4:false,
  308. commonly5:false,
  309. commonly6:false,
  310. },
  311. };
  312. },
  313. onShow() {
  314. let newmenulist= uni.getStorageSync('weapp_session_Menu_data');
  315. this.permissions.commonly2=newmenulist.lpdb;
  316. this.permissions.commonly3=newmenulist.xjqs;
  317. this.permissions.commonly4=newmenulist.tddb;
  318. this.permissions.commonly5=newmenulist.gwnl;
  319. this.permissions.commonly6=newmenulist.yhhx;
  320. // 获取楼盘id
  321. this.houseId = uni.getStorageSync('buildingID').id;
  322. // 获取数据看板
  323. // 获取员工
  324. this.getStaffList()
  325. // 获取团队
  326. this.getSectionList()
  327. // 获取团队是否显示权限
  328. // 获取简报
  329. this.getReport()
  330. // 获取接待趋势
  331. this.getRtrent()
  332. // 获取维度
  333. this.getindexZxl()
  334. },
  335. methods: {
  336. // 获取员工列表
  337. getStaffList() {
  338. this.$u.post('/cusLvStatistics/selectAllAccountIdByHouseId', {
  339. houseId: this.houseId
  340. })
  341. .then(res => {
  342. // console.log(res,'123')
  343. this.staffList = []
  344. res.map(item => {
  345. let obj = {}
  346. obj.value = item.accountId
  347. obj.label = item.name
  348. this.staffList.push(obj)
  349. })
  350. this.staff = this.staffList[0]
  351. this.getAward()
  352. })
  353. },
  354. // 获取接待趋势
  355. getRtrent() {
  356. this.$u.post('/cusLvStatistics/receptionTrend', {
  357. houseId: this.houseId,
  358. timeType: this.lastEndDate ? null : this.activeTotal,
  359. lastEndDate: this.lastEndDate,
  360. lastStartDate: this.lastStartDate
  361. })
  362. .then(res => {
  363. // console.log(res)
  364. this.allechar = res
  365. this.tapspagek2(this.bocindex)
  366. })
  367. },
  368. // 销奖维度
  369. getindexZxl() {
  370. this.$u.post('/cusLvStatistics/indexZxl', {
  371. houseId: this.houseId,
  372. timeType: this.lastEndDate ? null : this.activeTotal,
  373. lastEndDate: this.lastEndDate,
  374. lastStartDate: this.lastStartDate
  375. })
  376. .then(res => {
  377. // console.log(res)
  378. // 处理销奖维度执行率
  379. // this.newlisttabinfo
  380. let arr = []
  381. this.newlistoj = []
  382. res.list.map((item, index) => {
  383. arr.push({
  384. name: item.name,
  385. zxl: item.zxl
  386. })
  387. this.newlistoj.push({
  388. name: item.name,
  389. id: index
  390. })
  391. })
  392. this.newlisttabinfo = arr
  393. this.allList = res.list
  394. this.tapspagek3(this.bocindex1)
  395. })
  396. },
  397. // 获取简报
  398. getReport() {
  399. this.$u.post('/cusLvStatistics/xiaojiangAnalysis', {
  400. houseId: this.houseId,
  401. timeType: this.lastEndDate ? null : this.activeTotal,
  402. lastEndDate: this.lastEndDate,
  403. lastStartDate: this.lastStartDate
  404. })
  405. .then(res => {
  406. // 接待量
  407. this.numlist[0].num = res.receptionCount || 0
  408. // 接待客户
  409. this.numlist[1].num = res.sumCustomer || 0
  410. // 执行率
  411. this.numlist[2].num = (res.fraction || 0) + '%'
  412. // 录音时长
  413. this.numlist[3].num = Math.floor(res.sumDuration / 60) || 0
  414. // util.formatSecond()||0
  415. })
  416. },
  417. // 获取团队列表
  418. getSectionList() {
  419. this.$u.post('/cusLvStatistics/findAllDeptIdByHouseId', {
  420. houseId: this.houseId
  421. })
  422. .then(res => {
  423. this.teamList = []
  424. res.map(item => {
  425. let obj = {}
  426. obj.value = item.deptId
  427. obj.label = item.deptName
  428. this.teamList.push(obj)
  429. })
  430. this.team = this.teamList[0]
  431. this.receptionCountList()
  432. })
  433. },
  434. // 员工销奖趋势
  435. getAward() {
  436. if (this.staffList.length == 0) {
  437. this.staffFlag = false
  438. this.$forceUpdate()
  439. return
  440. }
  441. this.$u.post('/cusLvStatistics/employeeAnalysisExacutiveRate', {
  442. userA: this.staff.value,
  443. userB: '',
  444. houseId: this.houseId,
  445. timeType: this.lastEndDate ? null : this.activeTotal + '',
  446. lastEndDate: this.lastEndDate,
  447. lastStartDate: this.lastStartDate
  448. })
  449. .then(res => {
  450. this.allnum1 = res.avg[0]
  451. this.allavg1 = res.avg[1]
  452. // console.log(res)
  453. let first = res.first
  454. let second = res.second
  455. this.lineOptsect2.categories = []
  456. this.lineOptsect2.series = [{
  457. name: first[0].accountName,
  458. data: []
  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. this.getAward()
  524. },
  525. staffSelectCallback(e, idx) {
  526. if (idx == 0) {
  527. this.staff = e[0]
  528. this.getAward()
  529. } else {
  530. this.team = e[0]
  531. this.receptionCountList()
  532. }
  533. // console.log(e,idx)
  534. },
  535. //自定义时间
  536. totalTimeChange(e) {
  537. console.log(e.startDate, e.endDate)
  538. this.activeTotal = 3;
  539. this.lastEndDate = e.endDate
  540. this.lastStartDate = e.startDate
  541. this.getdata()
  542. },
  543. //指标执行率分析tab
  544. tapspagek2(index) {
  545. // console.log(index)
  546. // 对数据进行分析和处理
  547. // 先处理日期
  548. let allobj = {
  549. "categories": [],
  550. "series": [{
  551. name: '接待量',
  552. data: []
  553. }]
  554. }
  555. if (index == 0) {
  556. // 接待量
  557. this.danwei = '单位(次)'
  558. allobj.series[0].name = '接待量'
  559. this.allechar.map(item => {
  560. allobj.categories.push(item.statDate.slice(5, 10))
  561. allobj.series[0].data.push(item.receptionCount)
  562. })
  563. } else if (index == 1) {
  564. // 平均执行率
  565. this.danwei = '单位(%)'
  566. allobj.series[0].name = '平均执行率'
  567. this.allechar.map(item => {
  568. allobj.categories.push(item.statDate.slice(5, 10))
  569. allobj.series[0].data.push(item.fraction)
  570. })
  571. } else if (index == 2) {
  572. // 接待客户
  573. this.danwei = '单位(个)'
  574. allobj.series[0].name = '接待客户'
  575. this.allechar.map(item => {
  576. allobj.categories.push(item.statDate.slice(5, 10))
  577. allobj.series[0].data.push(item.sumCustomer)
  578. })
  579. } else {
  580. // 录音时长
  581. this.danwei = '单位(min)'
  582. allobj.series[0].name = '录音时长'
  583. this.allechar.map(item => {
  584. allobj.categories.push(item.statDate.slice(5, 10))
  585. allobj.series[0].data.push(item.sumDuration)
  586. })
  587. }
  588. this.bocindex = index;
  589. this.lineOptsect = allobj
  590. },
  591. tapspagek3(index) {
  592. let arr = []
  593. // return
  594. // console.log(index,this.allList[index])
  595. this.allList[index].children.map(item => {
  596. arr.push({
  597. name: item.name,
  598. zxl: item.zxl
  599. })
  600. })
  601. this.newlisttabinfo1 = arr
  602. this.bocindex1 = index;
  603. },
  604. //集团对比
  605. Groupcontrast() {
  606. uni.navigateTo({
  607. url: '/pages/center/Piabodata/Groupcontrast'
  608. });
  609. },
  610. //团队对比
  611. Theteamcompared() {
  612. if (this.teamList.length == 0) {
  613. uni.showToast({
  614. title: '没有团队呢',
  615. icon: 'none'
  616. })
  617. return
  618. }
  619. uni.navigateTo({
  620. url: '/pages/center/Piabodata/Theteamcompared'
  621. });
  622. },
  623. //用户洞察
  624. toUserinsightinto() {
  625. uni.navigateTo({
  626. url: '/pages/center/Piabodata/Userinsightinto'
  627. });
  628. },
  629. //趋势分析
  630. toTrendAnalysis() {
  631. uni.navigateTo({
  632. url: '/pages/center/Piabodata/TrendAnalysis'
  633. });
  634. },
  635. //员工分析
  636. toStaffAnalysis() {
  637. if (this.staffList.length == 0) {
  638. uni.showToast({
  639. title: '没有团队呢',
  640. icon: 'none'
  641. })
  642. return
  643. }
  644. uni.navigateTo({
  645. url: '/pages/center/Piabodata/StaffAnalysis'
  646. });
  647. }
  648. }
  649. };
  650. </script>
  651. <style lang="scss" scoped>
  652. .box {
  653. width: 100%;
  654. height: 100%;
  655. background: #FAFAFA;
  656. padding-bottom: 60rpx;
  657. }
  658. .Piabodata-box {
  659. width: 100%;
  660. background: #FFFFFF;
  661. display: flex;
  662. flex-wrap: wrap;
  663. padding-bottom: 30rpx;
  664. .Piabodata {
  665. width: 33.3%;
  666. .Piabodata-img {
  667. width: 100%;
  668. text-align: center;
  669. .Piabodata-img1 {
  670. width: 134rpx;
  671. height: 134rpx;
  672. }
  673. }
  674. .Piabodata-text {
  675. width: 100%;
  676. text-align: center;
  677. font-size: 24rpx;
  678. font-weight: 400;
  679. color: #333333;
  680. margin-top: -10rpx;
  681. }
  682. }
  683. }
  684. .grid:nth-child(1) {
  685. border-right: none;
  686. border-bottom: none;
  687. }
  688. .grid:nth-child(2) {
  689. border-bottom: none;
  690. }
  691. .grid:nth-child(3) {
  692. border-right: none;
  693. }
  694. </style>