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.
 
 
 
 

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