AI销管
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

StaffAnalysis.vue 16 KiB

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