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.
 
 
 

632 lines
16 KiB

  1. <template>
  2. <view>
  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 class="timepick">
  18. <view class="timepicktime" @click="chiocStaff(0)">
  19. <view>{{staff1.label}}</view>
  20. <view>
  21. <image class="Underimg" src="../../../static/images/Underimg.png" mode=""></image>
  22. </view>
  23. </view>
  24. <view class="timepickpick">
  25. <view @click="checkboxChange()" style="width: 40rpx;height:40rpx;border: 1rpx solid #E0E0E0;">
  26. <image v-if="timepickpickisshow" style="width: 40rpx;height: 40rpx;" src="../../../static/images/xuanzhong.png" mode=""></image>
  27. </view>
  28. <view style="font-size:26rpx;text-indent: 12rpx;">对比</view>
  29. </view>
  30. <view class="timepicktime" v-if="timepickpickisshow" @click="chiocStaff(1)">
  31. <view>{{staff2.label}}</view>
  32. <view>
  33. <image class="Underimg" src="../../../static/images/Underimg.png" mode=""></image>
  34. </view>
  35. </view>
  36. </view>
  37. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  38. <view class="single">
  39. <view class="title">
  40. <view class="title1" style="flex: 1;">接待量</view>
  41. </view>
  42. <view class="hejibox">
  43. <view class="heji">{{staff1.label}}:{{newTeam1||0}}</view>
  44. <view class="heji" v-if="timepickpickisshow">{{staff2.label}}:{{newAvg1||0}}</view>
  45. </view>
  46. <view class="danwei">来访(人)</view>
  47. <view class="uchaserbox">
  48. <qiun-data-charts
  49. type="line"
  50. :chartData="lineOptsect"
  51. background="none"
  52. :ontouch="true"
  53. canvasId="wangxiaohuaerlingeryilingwuyibbb"
  54. :canvas2d="true"
  55. />
  56. </view>
  57. </view>
  58. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  59. <view class="single">
  60. <view class="title">
  61. <view class="title1" style="flex: 1;">录音时长</view>
  62. <view class="title3" style="flex: 1;">
  63. <!-- <view class="title3-box" style="width: 40%;" @click="tabtimetap1(0)">
  64. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 0 }">有效录音</view>
  65. </view>
  66. <view class="title3-box" style="width: 40%;"@click="tabtimetap1(1)">
  67. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 1 }">录音时长</view>
  68. </view> -->
  69. </view>
  70. </view>
  71. <view class="hejibox">
  72. <view class="heji">{{staff1.label}}:{{newTeam2||0}}</view>
  73. <view class="heji" v-if="timepickpickisshow">{{staff2.label}}:{{newAvg2||0}}</view>
  74. </view>
  75. <view class="danwei">录音时长</view>
  76. <view class="uchaserbox">
  77. <qiun-data-charts
  78. type="line"
  79. :chartData="lineOptsect1"
  80. background="none"
  81. :ontouch="true"
  82. canvasId="wangxiaouaerlingeryilingwuyibhh"
  83. :canvas2d="true"
  84. />
  85. </view>
  86. </view>
  87. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  88. <view class="single">
  89. <view class="title">
  90. <view class="title1" style="flex: 1;">销讲执行率</view>
  91. <view class="title3" style="flex: 1;">
  92. <!-- <view class="title3-box" style="width: 40%;" @click="tabtimetap1(0)">
  93. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 0 }">有效录音</view>
  94. </view>
  95. <view class="title3-box" style="width: 40%;"@click="tabtimetap1(1)">
  96. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 1 }">录音时长</view>
  97. </view> -->
  98. </view>
  99. </view>
  100. <view class="hejibox">
  101. <view class="heji">{{staff1.label}}:{{newTeam3||0}}</view>
  102. <view class="heji" v-if="timepickpickisshow">{{staff2.label}}:{{newAvg3||0}}</view>
  103. </view>
  104. <!-- <view class="danwei">录音时长</view> -->
  105. <view class="uchaserbox">
  106. <qiun-data-charts
  107. type="line"
  108. :chartData="lineOptsect2"
  109. background="none"
  110. :ontouch="true"
  111. canvasId="wangxiaohuaerlingryilingwuyibhh"
  112. :canvas2d="true"
  113. />
  114. </view>
  115. </view>
  116. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  117. <view class="single">
  118. <view class="title" style="padding-right: 30rpx;">
  119. <view class="title1" style="flex: 1;">销讲能力</view>
  120. </view>
  121. <view class="uchaserbox" style="height: 70vh;">
  122. <qiun-data-charts
  123. type="radar"
  124. :chartData="chartData"
  125. :canvas2d="true"
  126. canvasId="wangxiaohuaerlingeryilinwuycsdx"
  127. background="none"
  128. :opts="opts"
  129. />
  130. </view>
  131. </view>
  132. <!-- <u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar> -->
  133. <u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar>
  134. <!-- 选择客户的选择框 -->
  135. <u-select v-model="staffShow" :list="staffList" @confirm="staffSelectCallback" :default-value='selindex'></u-select>
  136. <u-select v-model="staffShow1" :list="staffList1" @confirm="staffSelectCallback" :default-value='selindex'></u-select>
  137. </view>
  138. </template>
  139. <script>
  140. export default {
  141. data() {
  142. return {
  143. timepickpickisshow:true,
  144. totalTimeShow: false,
  145. activeTotal:4,
  146. activeTotal2:1,
  147. // 项目id
  148. houseId:'',
  149. staffList:[],
  150. staffList1:[],
  151. staffShow:false,
  152. staffShow1:false,
  153. newTeam1:'',
  154. newAvg1:'',
  155. newTeam2:'',
  156. newAvg2:'',
  157. newTeam3:'',
  158. newAvg3:'',
  159. staff1:{
  160. value:'',
  161. label:''
  162. },
  163. staff2:{
  164. value:'',
  165. label:'平均'
  166. },
  167. opts: {
  168. fontSize: 10,
  169. extra: {
  170. radar: {
  171. max: ''
  172. }
  173. }
  174. },
  175. lastStartDate:'',
  176. lastEndDate :'',
  177. selindex:[0],
  178. choseStaffFlag:false,
  179. lineOptsect:{
  180. "categories": ["2016","2017","2018","2019","2020","2021"],
  181. "series": [
  182. {
  183. "name": "成交量1",
  184. "data": [35,8,25,37,4,20]
  185. },
  186. {
  187. "name": "成交量2",
  188. "data": [40,18,45,44,10,60]
  189. }
  190. ]
  191. },
  192. lineOptsect1:{
  193. "categories": ["2016","2017","2018","2019","2020","2021"],
  194. "series": [
  195. {
  196. "name": "成交量1",
  197. "data": [35,8,25,37,4,20]
  198. },
  199. {
  200. "name": "成交量2",
  201. "data": [40,18,45,44,10,60]
  202. }
  203. ]
  204. },
  205. lineOptsect2:{
  206. "categories": ["2016","2017","2018","2019","2020","2021"],
  207. "series": [
  208. {
  209. "name": "成交量1",
  210. "data": [35,8,25,37,4,20]
  211. },
  212. {
  213. "name": "成交量2",
  214. "data": [40,18,45,44,10,60]
  215. }
  216. ]
  217. },
  218. chartData:{
  219. "categories": ["维度1","维度2","维度3","维度4","维度5","维度6"],
  220. "series": [
  221. {
  222. "name": "成交量",
  223. "data": [90,110,165,195,187,172]
  224. }
  225. ]
  226. }
  227. };
  228. },
  229. onLoad: function(options) {
  230. // 获取项目id
  231. this.houseId = uni.getStorageSync('buildingID').id;
  232. // this.buildingname = uni.getStorageSync('buildingID').name;
  233. // 请求接口获取所有置业顾问员工的列表
  234. this.getStaffList()
  235. },
  236. onPullDownRefresh() {
  237. this.getStaffList()
  238. setTimeout(function () {
  239. uni.stopPullDownRefresh();
  240. }, 1000);
  241. },
  242. methods: {
  243. //是否对比
  244. checkboxChange(){
  245. this.timepickpickisshow=!this.timepickpickisshow;
  246. this.staff2.value=''
  247. this.staff2.label='平均'
  248. // this.getreception()
  249. // this.getRecordList()
  250. // this.getAwardList()
  251. // this.getAward()
  252. this.getdata()
  253. },
  254. // 点击员工对比
  255. chiocStaff(idx){
  256. if(idx==0){
  257. // 当选择了第一个的时候
  258. this.choseStaffFlag=false
  259. this.staffShow=true
  260. }else{
  261. this.choseStaffFlag=true
  262. this.staffShow1=true
  263. }
  264. },
  265. // 获取员工列表
  266. getStaffList(){
  267. this.$u.post('/cusLvStatistics/selectAllAccountIdByHouseId',{houseId:this.houseId})
  268. .then(res=>{
  269. // console.log(res,'123')
  270. this.staffList=[]
  271. this.staffList1=[]
  272. res.map(item=>{
  273. let obj={}
  274. obj.value=item.accountId
  275. obj.label=item.name
  276. this.staffList.push(obj)
  277. })
  278. this.staffList1=[...this.staffList]
  279. this.staffList1.unshift({
  280. value:'',
  281. label:'平均'
  282. })
  283. this.staff1=this.staffList[0]
  284. // this.getreception()
  285. // this.getRecordList()
  286. // this.getAwardList()
  287. // this.getAward()
  288. this.getdata()
  289. })
  290. },
  291. getdata(){
  292. this.getreception()
  293. this.getRecordList()
  294. this.getAward()
  295. this.getAwardList()
  296. },
  297. // 获取接待量数据
  298. getreception(){
  299. this.$u.post('/cusLvStatistics/employeeAnalysisReception',{
  300. userA:this.staff1.value,
  301. userB:this.staff2.value,
  302. houseId:this.houseId,
  303. timeType:this.lastEndDate?null:this.activeTotal+'',
  304. lastEndDate:this.lastEndDate,
  305. lastStartDate:this.lastStartDate
  306. })
  307. .then(res=>{
  308. this.newTeam1=res.avg[0]
  309. this.newAvg1=res.avg[1]
  310. // console.log(res)
  311. let first=res.first
  312. let second=res.second
  313. this.lineOptsect.categories=[]
  314. if(!this.timepickpickisshow){
  315. this.lineOptsect.series=[
  316. {
  317. name:first[0].accountName,
  318. data:[]
  319. }
  320. ]
  321. first.map(item=>{
  322. this.lineOptsect.categories.push(item.statDate.slice(5,10))
  323. this.lineOptsect.series[0].data.push(item.receptionCount||0)
  324. })
  325. }else{
  326. this.lineOptsect.series=[
  327. {
  328. name:first[0].accountName,
  329. data:[]
  330. },
  331. {
  332. "name": second[0].accountName,
  333. "data": []
  334. }
  335. ]
  336. first.map(item=>{
  337. this.lineOptsect.categories.push(item.statDate.slice(5,10))
  338. this.lineOptsect.series[0].data.push(item.receptionCount)
  339. })
  340. second.map(item=>{
  341. this.lineOptsect.series[1].data.push(item.receptionCount)
  342. })
  343. }
  344. // console.log(this.lineOptsect,'1')
  345. })
  346. },
  347. // 销奖趋势
  348. getAward(){
  349. this.$u.post('/cusLvStatistics/employeeAnalysisExacutiveRate',{
  350. userA:this.staff1.value,
  351. userB:this.staff2.value,
  352. houseId:this.houseId,
  353. timeType:this.lastEndDate?null:this.activeTotal+'',
  354. lastEndDate:this.lastEndDate,
  355. lastStartDate:this.lastStartDate
  356. })
  357. .then(res=>{
  358. this.newTeam3=res.avg[0]
  359. this.newAvg3=res.avg[1]
  360. // console.log(res)
  361. let first=res.first
  362. let second=res.second
  363. this.lineOptsect2.categories=[]
  364. if(!this.timepickpickisshow){
  365. this.lineOptsect2.series=[
  366. {
  367. name:first[0].accountName,
  368. data:[]
  369. }
  370. ]
  371. first.map(item=>{
  372. // console.log(item)
  373. this.lineOptsect2.categories.push(item.statDate.slice(5,10))
  374. this.lineOptsect2.series[0].data.push(item.sumFraction)
  375. })
  376. }else{
  377. this.lineOptsect2.series=[
  378. {
  379. name:first[0].accountName,
  380. data:[]
  381. },
  382. {
  383. "name": second[0].accountName,
  384. "data": []
  385. }
  386. ]
  387. first.map(item=>{
  388. this.lineOptsect2.categories.push(item.statDate.slice(5,10))
  389. this.lineOptsect2.series[0].data.push(item.sumFraction)
  390. })
  391. second.map(item=>{
  392. this.lineOptsect2.series[1].data.push(item.sumFraction)
  393. })
  394. }
  395. // console.log(this.lineOptsect2,'3')
  396. })
  397. },
  398. // 获取有效录音
  399. async getRecordList(){
  400. // 当选择有效录音时
  401. let res=null
  402. if(this.activeTotal2==0){
  403. res= await this.$u.post('/cusLvStatistics/employeeAnalysisEffectiveRecording',{
  404. userA:this.staff1.value,
  405. userB:this.staff2.value,
  406. houseId:this.houseId,
  407. timeType:this.lastEndDate?null:this.activeTotal+'',
  408. lastEndDate:this.lastEndDate,
  409. lastStartDate:this.lastStartDate
  410. })
  411. }else{
  412. res= await this.$u.post('/cusLvStatistics/employeeAnalysisRecordingTime',{
  413. userA:this.staff1.value,
  414. userB:this.staff2.value,
  415. houseId:this.houseId,
  416. timeType:this.lastEndDate?null:this.activeTotal+'',
  417. lastEndDate:this.lastEndDate,
  418. lastStartDate:this.lastStartDate
  419. })
  420. }
  421. // console.log(res)
  422. this.newTeam2=res.avg[0]
  423. this.newAvg2=res.avg[1]
  424. let first=res.first
  425. let second=res.second
  426. this.lineOptsect1.categories=[]
  427. if(!this.timepickpickisshow){
  428. this.lineOptsect1.series=[
  429. {
  430. name:first[0].accountName,
  431. data:[]
  432. }
  433. ]
  434. first.map(item=>{
  435. this.lineOptsect1.categories.push(item.statDate.slice(5,10))
  436. this.lineOptsect1.series[0].data.push(item.sumDuration)
  437. })
  438. }else{
  439. this.lineOptsect1.series=[
  440. {
  441. name:first[0].accountName,
  442. data:[]
  443. },
  444. {
  445. "name": second[0].accountName,
  446. "data": []
  447. }
  448. ]
  449. first.map(item=>{
  450. this.lineOptsect1.categories.push(item.statDate.slice(5,10))
  451. this.lineOptsect1.series[0].data.push(item.sumDuration)
  452. })
  453. second.map(item=>{
  454. this.lineOptsect1.series[1].data.push(item.sumDuration)
  455. })
  456. }
  457. // console.log(this.lineOptsect1,'2')
  458. },
  459. // 获取销奖能力
  460. getAwardList(){
  461. this.$u.post('/cusLvStatistics/employeeAnalysisLevel1Fraction',{
  462. userA:this.staff1.value,
  463. userB:this.staff2.value,
  464. houseId:this.houseId,
  465. timeType:this.lastEndDate?null:this.activeTotal+'',
  466. lastEndDate:this.lastEndDate,
  467. lastStartDate:this.lastStartDate
  468. })
  469. .then(res=>{
  470. // console.log(res)
  471. let first=res.first
  472. let second=res.second
  473. let max = first[0].avgExecutionRate
  474. this.chartData.categories=[]
  475. if(!this.timepickpickisshow){
  476. this.chartData.series=[
  477. {
  478. name:first[0].accountName,
  479. data:[]
  480. }
  481. ]
  482. first.map(item=>{
  483. if (max < item.avgExecutionRate) max = item.avgExecutionRate;
  484. this.chartData.categories.push(item.name)
  485. this.chartData.series[0].data.push(item.avgExecutionRate)
  486. })
  487. }else{
  488. this.chartData.series=[
  489. {
  490. name:first[0].accountName,
  491. data:[]
  492. },
  493. {
  494. "name": second[0].accountName,
  495. "data": []
  496. }
  497. ]
  498. first.map(item=>{
  499. this.chartData.categories.push(item.name)
  500. this.chartData.series[0].data.push(item.avgExecutionRate)
  501. })
  502. second.map(item=>{
  503. this.chartData.series[1].data.push(item.avgExecutionRate)
  504. })
  505. let all = [...first, ...second]
  506. all.map(item => {
  507. if (max < item.avgExecutionRate) max = item.avgExecutionRate;
  508. })
  509. }
  510. this.opts.extra.radar.max = max + 25
  511. })
  512. },
  513. tabtimetap(index){
  514. if (index == 3) {
  515. this.totalTimeShow = true;
  516. } else {
  517. this.activeTotal = index;
  518. this.lastEndDate=''
  519. this.lastStartDate=''
  520. // 获取数据
  521. // this.getreception()
  522. // this.getRecordList()
  523. // this.getAwardList()
  524. this.getdata()
  525. }
  526. },
  527. tabtimetap1(index){
  528. this.activeTotal2 = index;
  529. // 调用方法
  530. this.getRecordList()
  531. },
  532. //自定义时间
  533. totalTimeChange(e) {
  534. console.log(e.startDate, e.endDate)
  535. this.activeTotal=3;
  536. this.lastEndDate=e.endDate
  537. this.lastStartDate=e.startDate
  538. // 获取数据
  539. // this.getreception()
  540. // this.getRecordList()
  541. // this.getAwardList()
  542. this.getdata()
  543. },
  544. staffSelectCallback(e){
  545. if(this.choseStaffFlag){
  546. // 第二个客户
  547. // console.log(e,'第二个')
  548. this.staff2=e[0]
  549. }else{
  550. // 第一个客户
  551. // console.log(e,'第一个')
  552. this.staff1=e[0]
  553. }
  554. if(this.staff1.label==this.staff2.label){
  555. uni.showToast({
  556. title:'请勿选择重复',
  557. icon:'none'
  558. })
  559. this.staff2.label='请选择'
  560. // this.staff2.label='平均'
  561. // this.staff2.value=''
  562. return
  563. }else{
  564. // 获取数据
  565. // this.getreception()
  566. // this.getRecordList()
  567. // this.getAwardList()
  568. this.getdata()
  569. }
  570. },
  571. },
  572. }
  573. </script>
  574. <style lang="scss" scoped>
  575. // 对比时间切换
  576. .timepick{
  577. width: 100%;
  578. height: 90rpx;
  579. display: flex;
  580. align-items: center;
  581. background: #FAFAFA;
  582. }
  583. .timepicktime{
  584. width: 260rpx;
  585. height: 50rpx;
  586. border: 1rpx solid #E0E0E0;
  587. margin-left: 30rpx;
  588. display: flex;
  589. background: #FFFFFF;
  590. }
  591. .timepicktime>view:nth-of-type(1){
  592. width: 210rpx;
  593. height: 100%;
  594. line-height: 50rpx;
  595. font-size: 26rpx;
  596. font-weight: 400;
  597. text-align: center;
  598. }
  599. .timepicktime>view:nth-of-type(2){
  600. width: 49rpx;
  601. height: 100%;
  602. // border-left: 1px solid #E0E0E0;
  603. }
  604. .timepickpick{
  605. width: 110rpx;
  606. height: 50rpx;
  607. margin-left: 30rpx;
  608. display: flex;
  609. align-items: center;
  610. }
  611. .Underimg{
  612. width: 50rpx;
  613. height:50rpx;
  614. margin-top: -2rpx;
  615. }
  616. </style>