AI销管
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

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