AI销管
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.
 
 
 
 

580 lines
16 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 class="single">
  18. <view class="title">
  19. <view class="title1">接待量(TOP10)</view>
  20. </view>
  21. <view class="hejisan">
  22. <view class="sanbox1" >
  23. <view class="text1-2">{{newTeam1||0}}</view>
  24. <view class="text1-1">项目</view>
  25. </view>
  26. <view class="sanbox1">
  27. <view class="text1-2">{{newAvg1||0}}</view>
  28. <view class="text1-1">均值</view>
  29. </view>
  30. </view>
  31. <view class="jindu">
  32. <scroll-view scroll-y="true" >
  33. <view class="jindu-box" v-for="(item,index) in newlisttabinfo1" :key="index">
  34. <view class="jindu-boxche">
  35. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  36. <view class="progress-cus">
  37. <view class="color" :style="'width:'+ getPercent(item.zxl,1) + '%'" ></view>
  38. </view>
  39. <!-- <view style="width: 440rpx;margin-left: 10rpx;">
  40. <u-line-progress height="24" :show-percent="false" active-color="#FBA448" :percent="item.zxl1"></u-line-progress>
  41. </view> -->
  42. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}</view>
  43. </view>
  44. </view>
  45. </scroll-view>
  46. </view>
  47. </view>
  48. <view class="single">
  49. <view class="title">
  50. <view class="title1">接待时长(TOP10)</view>
  51. </view>
  52. <view class="hejisan">
  53. <view class="sanbox1" >
  54. <view class="text1-2">{{newTeam2||0}}</view>
  55. <view class="text1-1">项目</view>
  56. </view>
  57. <view class="sanbox1">
  58. <view class="text1-2">{{newAvg2||0}}</view>
  59. <view class="text1-1">均值</view>
  60. </view>
  61. </view>
  62. <view class="jindu">
  63. <scroll-view scroll-y="true" >
  64. <view class="jindu-box" v-for="(item,index) in newlisttabinfo2" :key="index">
  65. <view class="jindu-boxche">
  66. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  67. <view class="progress-cus">
  68. <view class="color" :style="'width:'+ getPercent(item.zxl,2) + '%'" ></view>
  69. </view>
  70. <!-- <view style="width: 440rpx;margin-left: 10rpx;">
  71. <u-line-progress height="24" :show-percent="false" active-color="#4FC78F" :percent="item.zxl1"></u-line-progress>
  72. </view> -->
  73. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}</view>
  74. </view>
  75. </view>
  76. </scroll-view>
  77. </view>
  78. </view>
  79. <view class="single">
  80. <view class="title">
  81. <view class="title1" style="flex: 1;">销讲执行排名(TOP10)</view>
  82. <!-- <view class="title3" style="flex: 1;">
  83. <view class="title3-box">
  84. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 0 }">执行率</view>
  85. </view>
  86. <view class="title3-box">
  87. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 1 }">得分</view>
  88. </view>
  89. </view> -->
  90. </view>
  91. <view class="hejisan">
  92. <view class="sanbox1" >
  93. <view class="text1-2">{{newTeam3||0}}</view>
  94. <view class="text1-1">项目</view>
  95. </view>
  96. <view class="sanbox1">
  97. <view class="text1-2">{{newAvg3||0}}%</view>
  98. <view class="text1-1">均值</view>
  99. </view>
  100. </view>
  101. <view class="jindu">
  102. <scroll-view scroll-y="true" >
  103. <view class="jindu-box" v-for="(item,index) in newlisttabinfo3" :key="index">
  104. <view class="jindu-boxche">
  105. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  106. <view class="progress-cus">
  107. <view class="color" :style="'width:'+ getPercent1(item.zxl)+ '%'" ></view>
  108. </view>
  109. <!-- <view style="width: 440rpx;margin-left: 10rpx;">
  110. <u-line-progress height="24" :show-percent="false" active-color="#9B6BDF" :percent="item.zxl1"></u-line-progress>
  111. </view> -->
  112. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}%</view>
  113. </view>
  114. </view>
  115. </scroll-view>
  116. </view>
  117. </view>
  118. <view class="single">
  119. <view class="title">
  120. <view class="title1" style="flex: 1;">顾问执行排名(TOP10)</view>
  121. <!-- <view class="title3" style="flex: 1;">
  122. <view class="title3-box">
  123. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 0 }">执行率</view>
  124. </view>
  125. <view class="title3-box">
  126. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 1 }">得分</view>
  127. </view>
  128. </view> -->
  129. </view>
  130. <!-- <view class="hejibox">
  131. <view class="heji">项目:{{newTeam4||0}}</view>
  132. <view class="heji">均值:{{newAvg4||0}}</view>
  133. </view> -->
  134. <view class="jindu">
  135. <scroll-view scroll-y="true" >
  136. <view class="jindu-box" v-for="(item,index) in newlisttabinfo4" :key="index">
  137. <view class="jindu-boxche">
  138. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  139. <view class="progress-cus">
  140. <view class="color" :style="'width:'+getPercent1(item.zxl) + '%'" ></view>
  141. </view>
  142. <!-- <view style="width: 440rpx;margin-left: 10rpx;">
  143. <u-line-progress height="24" :show-percent="false" active-color="#9B6BDF" :percent="item.zxl1"></u-line-progress>
  144. </view> -->
  145. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}%</view>
  146. </view>
  147. </view>
  148. </scroll-view>
  149. </view>
  150. </view>
  151. <view class="single">
  152. <view class="title" style="padding-right: 30rpx;">
  153. <view class="title1" style="flex: 1;">销讲能力</view>
  154. <!-- <view class="title2" style="flex: 1;justify-content: flex-end;" @click="Groupcontrast">
  155. <view class="title2-che">项目
  156. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  157. </view>
  158. </view> -->
  159. <view class="title2" style="flex: 1;justify-content: flex-end;" @click="staffShow=true">
  160. <view class="title2-che" style="width: auto;">{{staff.label}}
  161. <image class="righttochoose" src="../../../static/images/down.png" mode=""></image>
  162. </view>
  163. </view>
  164. </view>
  165. <!-- <view class="hejibox">
  166. <view class="heji">项目:50</view>
  167. <view class="heji">均值:25</view>
  168. </view> -->
  169. <view class="uchaserbox" v-if="emptyCharData">
  170. <qiun-data-charts
  171. type="radar"
  172. :chartData="chartData"
  173. :canvas2d="true"
  174. canvasId="wangxiaohuaerlingeryilingwuyib88"
  175. background="none"
  176. :loadingType="0"
  177. :opts="opts"
  178. />
  179. </view>
  180. <view class="uchaserbox" v-else>
  181. <u-empty mode="data"></u-empty>
  182. </view>
  183. </view>
  184. <!--
  185. <view class="single">
  186. <view class="title">
  187. <view class="title1">禁忌执行率(TOP10)</view>
  188. </view>
  189. <view class="hejibox">
  190. <view class="heji">合计:50</view>
  191. <view class="heji">均值:25</view>
  192. </view>
  193. <view class="jindu">
  194. <view class="jindu-box" v-for="(item,index) in newlisttabinfo" :key="index">
  195. <view class="jindu-boxche">
  196. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  197. <view style="width: 440rpx;margin-left: 10rpx;">
  198. <u-line-progress height="24" :show-percent="false" active-color="#E6625B" :percent="item.zxl"></u-line-progress>
  199. </view>
  200. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}%</view>
  201. </view>
  202. </view>
  203. </view>
  204. </view> -->
  205. <!-- <view class="single">
  206. <view class="title" style="padding-right: 30rpx;">
  207. <view class="title1" style="flex: 1;">违禁能力(TOP10)</view>
  208. <view class="title2" style="flex: 1;justify-content: flex-end;">
  209. <view class="title2-che">项目
  210. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  211. </view>
  212. </view>
  213. </view>
  214. <view class="hejibox">
  215. <view class="heji">合计:50</view>
  216. <view class="heji">均值:25</view>
  217. </view>
  218. <view class="uchaserbox">
  219. <qiun-data-charts
  220. type="radar"
  221. :chartData="chartData"
  222. :canvas2d="true"
  223. canvasId="wangxiaohuaerlingeryilingwuyib89"
  224. background="none"
  225. />
  226. </view>
  227. </view> -->
  228. <u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar>
  229. <!-- 选择项目 -->
  230. <u-select v-model="staffShow" :list="staffList" @confirm="staffSelectCallback" :default-value='selindex'></u-select>
  231. </view>
  232. </template>
  233. <script>
  234. var app = getApp();
  235. var util = require("../../../utils/util.js");
  236. var config = require("../../../config");
  237. export default {
  238. data() {
  239. return {
  240. activeTotal: 4,
  241. activeTotal2: 0,
  242. bocindex:0,
  243. totalTimeShow: false,
  244. // 项目id
  245. houseId:'',
  246. staffShow:false,
  247. staffList:[],
  248. lastStartDate:'',
  249. lastEndDate :'',
  250. newTeam1:'',
  251. newAvg1:'',
  252. newTeam2:'',
  253. newAvg2:'',
  254. newTeam3:'',
  255. newAvg3:'',
  256. newTeam4:'',
  257. newAvg4:'',
  258. staff:{
  259. value:'',
  260. label:''
  261. },
  262. newlisttabinfo1:[
  263. {name:'接待量',zxl:'10'},
  264. {name:'平均执行率',zxl:'50'},
  265. {name:'接待客户',zxl:'80'},
  266. ],
  267. newlisttabinfo2:[
  268. {name:'接待量',zxl:'10'},
  269. {name:'平均执行率',zxl:'50'},
  270. {name:'接待客户',zxl:'80'},
  271. ],
  272. newlisttabinfo3:[
  273. {name:'接待量',zxl:'10'},
  274. {name:'平均执行率',zxl:'50'},
  275. {name:'接待客户',zxl:'80'},
  276. ],
  277. newlisttabinfo4:[
  278. {name:'接待量',zxl:'10'},
  279. {name:'平均执行率',zxl:'50'},
  280. {name:'接待客户',zxl:'80'},
  281. ],
  282. chartData:{
  283. "categories": [],
  284. "series": [
  285. ]
  286. },
  287. emptyCharData:true,
  288. opts: {
  289. fontSize: 10,
  290. extra: {
  291. radar: {
  292. max: 100
  293. }
  294. }
  295. }
  296. };
  297. },
  298. onLoad() {
  299. let that=this
  300. uni.$on('updateGroup',function(data){
  301. console.log(data)
  302. that.houseId=data.arr.join(',')
  303. // 获取销奖能力
  304. that.getPowerList()
  305. })
  306. this.getSectionList()
  307. },
  308. onPullDownRefresh(){
  309. this.getSectionList()
  310. setTimeout(function () {
  311. uni.stopPullDownRefresh();
  312. }, 1000);
  313. },
  314. methods: {
  315. getPercent(num,type) {
  316. if(this.newlisttabinfo1&&this.newlisttabinfo1.length&&type==1){
  317. console.log(this.newlisttabinfo1)
  318. let index0 = this.newlisttabinfo1[0]
  319. let percent = num/(index0.zxl) * 100
  320. return percent.toFixed(2)
  321. }else if(this.newlisttabinfo2&&this.newlisttabinfo2.length&&type==2){
  322. let index0 = this.newlisttabinfo2[0]
  323. let percent = num/(index0.zxl) * 100
  324. return percent.toFixed(2)
  325. }else if(this.newlisttabinfo3&&this.newlisttabinfo3.length&&type==3){
  326. let index0 = this.newlisttabinfo3[0]
  327. let percent = num/(index0.zxl) * 100
  328. return percent.toFixed(2)
  329. }else{
  330. return 0
  331. }
  332. },
  333. getPercent1(num){
  334. console.log(num)
  335. return num||0
  336. },
  337. // 获取部门列表
  338. getSectionList(){
  339. this.$u.post('/user/getHouseByToken',)
  340. .then(res=>{
  341. // console.log(res)
  342. this.staffList=[]
  343. res.map((item,index)=>{
  344. let obj={}
  345. obj.value=item.id
  346. obj.label=item.propertyName
  347. this.staffList.push(obj)
  348. })
  349. this.houseId=this.staffList[0].value
  350. this.staff=this.staffList[0]
  351. this.getdata()
  352. // console.log(this.staffList,this.staffList,this.houseId)
  353. })
  354. },
  355. //指标执行率分析tab
  356. tapspagek2(index) {
  357. this.bocindex = index;
  358. },
  359. staffSelectCallback(e){
  360. this.staff=e[0]
  361. this.houseId=e[0].value
  362. this.getPowerList()
  363. },
  364. getdata(){
  365. // 请求接口获取接待量
  366. this.receptionCountList('1','/cusLvStatistics/groupComparisonReception')
  367. // 接待时长
  368. this.receptionCountList('2','/cusLvStatistics/groupComparisonReceptionTime')
  369. // 小将排名
  370. this.receptionCountList('3','/cusLvStatistics/groupComparisonTalkRank')
  371. // 顾问牌名
  372. this.receptionCountList('4','/cusLvStatistics/groupComparisonTalkRankByConsultant')
  373. // 销奖能力
  374. this.getPowerList()
  375. },
  376. //时间切换
  377. tabtimetap(index) {
  378. this.activeTotal = index;
  379. if (index == 3) {
  380. this.totalTimeShow = true;
  381. } else {
  382. this.lastEndDate=''
  383. this.lastStartDate=''
  384. this.getdata()
  385. // // 获取数据
  386. // // 团队对比接待量
  387. // this.receptionCountList(0,1,'/cusLvStatistics/teamAnalysisReception')
  388. // // 团队对比接待时长
  389. // this.receptionCountList(0,2,'/cusLvStatistics/teamAnalysisReceptionTime')
  390. // /* 销奖执行率 */
  391. // this.receptionCountList(0,3,'/cusLvStatistics/teamAnalysisExecutionRate')
  392. // // 获取销奖能力
  393. // this.getPowerList()
  394. }
  395. },
  396. // 接待时长
  397. receptionCountList(index,url){
  398. this.$u.post(url,{
  399. timeType:this.lastEndDate?null:this.activeTotal+'',
  400. lastEndDate:this.lastEndDate,
  401. lastStartDate:this.lastStartDate
  402. })
  403. .then(res=>{
  404. // console.log(res)
  405. let result=res.result
  406. this['newTeam'+index]=res.avg[0]
  407. this['newAvg'+index]=res.avg[1]
  408. // return
  409. // 处理数据
  410. // 先处理牌名数据,需要进行判断全部还是单个
  411. // 当为全部时
  412. this['newlisttabinfo'+index]=[]
  413. // 当选择全部时
  414. let arr=[]
  415. // 当两个都选择的时候
  416. result.map(item=>{
  417. let obj={}
  418. obj.name=item.houseName
  419. obj.zxl=item.data
  420. arr.push(obj)
  421. })
  422. arr=this.dealData(arr)
  423. this['newlisttabinfo'+index]=arr
  424. })
  425. },
  426. // 获取销奖能力
  427. getPowerList(){
  428. this.chartData={
  429. categories:[],
  430. series:[]
  431. }
  432. this.$u.post('/cusLvStatistics/groupComparisonMarketingAbility',{
  433. houseIds:this.houseId,
  434. timeType:this.lastEndDate?null:this.activeTotal+'',
  435. lastEndDate:this.lastEndDate,
  436. lastStartDate:this.lastStartDate
  437. })
  438. .then(res=>{
  439. let allobj={
  440. categories:[],
  441. series:[]
  442. }
  443. if(res.result.length!=0){
  444. res.result.map((item,index)=>{
  445. let obj={
  446. name:item.length>0?item[0].houseName:'',
  447. data:[]
  448. }
  449. item.map(item1=>{
  450. if(index==0){
  451. allobj.categories.push(item1.name)
  452. }
  453. obj.data.push(item1.avgExecutionRate)
  454. })
  455. allobj.series.push(obj)
  456. })
  457. this.chartData=allobj
  458. this.$forceUpdate()
  459. this.emptyCharData = true;
  460. }else{
  461. this.emptyCharData = false;
  462. }
  463. })
  464. },
  465. //自定义时间
  466. totalTimeChange(e) {
  467. console.log(e.startDate, e.endDate)
  468. this.activeTotal=3;
  469. this.lastEndDate=e.endDate
  470. this.lastStartDate=e.startDate
  471. this.getdata()
  472. },
  473. //集团对比
  474. Groupcontrast(){
  475. uni.navigateTo({
  476. url: `/pages/center/Piabodata/selectGroup?ids=${this.houseId}`
  477. });
  478. },
  479. // 定义一个公共方法对数据进行处理
  480. dealData(arr){
  481. // 获取最大值
  482. let num=Math.max.apply(Math, arr.map(function (o) { return o.zxl })) //结果:3
  483. // console.log(num)
  484. if(num>100){
  485. // 获取最大值的下标
  486. // let idx=arr.findIndex(item=>item.zxl==num)
  487. // console.log(idx,123)
  488. arr.map(item=>{
  489. item.zxl1=Math.floor(item.zxl/num*100)
  490. })
  491. // console.log(arr)
  492. return arr
  493. }else{
  494. arr.map(item=>{
  495. item.zxl1=item.zxl
  496. })
  497. return arr
  498. }
  499. },
  500. }
  501. };
  502. </script>
  503. <style lang="scss" scoped>
  504. .box {
  505. width: 100%;
  506. height: 100%;
  507. background: #FAFAFA;
  508. }
  509. .single {
  510. margin-top: 20rpx;
  511. padding-bottom: 20rpx;
  512. }
  513. .boxtittab {
  514. position: sticky;
  515. top: var(--window-top);
  516. z-index: 999;
  517. }
  518. .hejisan{
  519. width: 92%;
  520. margin: 0 auto;
  521. display: flex;
  522. padding:0 0 20rpx;
  523. .sanbox1{
  524. flex: 1;
  525. display: flex;
  526. flex-direction: column;
  527. justify-content: center;
  528. align-items: center;
  529. position: relative;
  530. &::after{
  531. position: absolute;
  532. content: '';
  533. width: 1rpx;
  534. height: 86rpx;
  535. background: #E0E0E0;
  536. right: 0;
  537. top: 0;
  538. }
  539. &:last-child::after {
  540. position: absolute;
  541. content: '';
  542. width: 1rpx;
  543. height: 86rpx;
  544. right: 0;
  545. top: 0;
  546. background: #fff;
  547. }
  548. }
  549. .text1-1{
  550. font-size: 24rpx;
  551. font-family: PingFangSC-Regular, PingFang SC;
  552. font-weight: 400;
  553. color: #333333;
  554. line-height: 32rpx;
  555. }
  556. .text1-2{
  557. color: #333333;
  558. font-size: 40rpx;
  559. line-height: 46rpx;
  560. font-family: PingFangSC-Regular, PingFang SC;
  561. margin-bottom: 10rpx;
  562. }
  563. }
  564. </style>