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.
 
 
 
 

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