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.
 
 
 

1307 lines
35 KiB

  1. <template>
  2. <view>
  3. <view class="timetabct">
  4. <view class="timetabctview">
  5. <view :class="{ activecllasscet: activeTotal == 0 }" @click="tabtimetap(0)">7天</view>
  6. </view>
  7. <view class="timetabctview">
  8. <view :class="{ activecllasscet: activeTotal == 1 }" @click="tabtimetap(1)">15天</view>
  9. </view>
  10. <view class="timetabctview">
  11. <view :class="{ activecllasscet: activeTotal == 2 }" @click="tabtimetap(2)">30天</view>
  12. </view>
  13. </view>
  14. <view class="timepick">
  15. <view class="timepicktime">
  16. <view @click="tabtimetap(3)">{{sheartime1}}</view>
  17. <view>
  18. <image class="Underimg" src="../../../static/images/Underimg.png" mode=""></image>
  19. </view>
  20. </view>
  21. <view class="timepickpick">
  22. <view @click="checkboxChange()" style="width: 40rpx;height:40rpx;border: 1rpx solid #E0E0E0;">
  23. <image v-if="timepickpickisshow" style="width: 40rpx;height: 40rpx;"
  24. src="../../../static/images/xuanzhong.png" mode=""></image>
  25. </view>
  26. <view style="font-size:26rpx;text-indent: 12rpx;">对比</view>
  27. </view>
  28. <view class="timepicktime" v-if="timepickpickisshow">
  29. <view @click="tabtimetap(4)">{{sheartime2}}</view>
  30. <view>
  31. <image class="Underimg" src="../../../static/images/Underimg.png" mode=""></image>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="timeduibi">
  36. <view class="timeshow">数据起始时间:<text style="color: #333333;">{{kanbanlist.kaishitime}}</text></view>
  37. <view class="timeshow" v-if="kanbanlist.duibitime.length!=0">
  38. 数据对比时间:
  39. <text style="color: #333333;">{{kanbanlist.duibitime}}</text>
  40. </view>
  41. </view>
  42. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  43. <view class="boxzonglan" style="min-height: 100rpx;">
  44. <view class="zonglantit">简报</view>
  45. <view class="zonglanbox">
  46. <view class="grid" v-for="(item,index) in numlist" :key="index" style="width: 100%;">
  47. <view class="audonum" v-if="item.name=='接待时长'">{{item.name}}/分</view>
  48. <view class="audonum" v-else>{{item.name}}</view>
  49. <view class="num" style="display: flex;">
  50. <view class="" style="width: 35%;">
  51. {{item.num}}
  52. </view>
  53. <view class="comparesize" v-if="compareFlag&&timepickpickisshow">
  54. <text style="margin-right: 10rpx;">对比:{{item.num1}} </text>
  55. <text :style="{color:item.num2*1>0?'red':'green'}">{{item.num2}}</text>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  62. <view class="boxtittab" style="border: none;height: 82rpx;">
  63. <view class="tabbox">
  64. <view :class="{ activecllasscet2: newactiveTotal == 0 }" @click="tabxuanxiangtap(0)">项目</view>
  65. </view>
  66. <view class="tabbox">
  67. <view :class="{ activecllasscet2: newactiveTotal == 1 }" @click="tabxuanxiangtap(1)">顾问</view>
  68. </view>
  69. <view class="tabbox">
  70. <view :class="{ activecllasscet2: newactiveTotal == 2 }" @click="tabxuanxiangtap(2)">团队</view>
  71. </view>
  72. <view class="tabbox">
  73. <view :class="{ activecllasscet2: newactiveTotal == 3 }" @click="tabxuanxiangtap(3)">销讲一级</view>
  74. </view>
  75. <view class="tabbox">
  76. <view :class="{ activecllasscet2: newactiveTotal == 4 }" @click="tabxuanxiangtap(4)">销讲二级</view>
  77. </view>
  78. </view>
  79. <view class="chart">
  80. <view style="display: flex;justify-content:center;padding-left: 30rpx;padding-right: 30rpx;margin-top: 16rpx;"
  81. v-if="guwenshow&&lopanobj.name" @click="oninputtap()">
  82. <view class="title2-che" style="width: 220rpx;">{{lopanobj.name}}
  83. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  84. </view>
  85. </view>
  86. <view style="padding: 30rpx;padding-bottom: 20rpx;align-items: center;" v-if="Selectlevel">
  87. <view style="display: flex;align-items: center;border-bottom: 1px solid #C9C9C9;height: 80rpx;">
  88. <view>选择一级:</view>
  89. <view style="width:75%;">
  90. <input @click="oninputtap2()" v-model="Selectlevelobj.name" type="text" disabled="true"
  91. :border="border" placeholder="请选择" />
  92. </view>
  93. <view>
  94. <image src="https://qufang.oss-cn-beijing.aliyuncs.com/upload/icon/xcx/jjycrm/qf/more.png"
  95. style="width:12rpx;height:23rpx;margin-left: 16rpx;">
  96. </view>
  97. </view>
  98. <view style="display: flex;align-items: center;border-bottom: 1px solid #C9C9C9;height: 80rpx;">
  99. <view>选择二级:</view>
  100. <view style="width:75%;">
  101. <input @click="oninputtap3()" v-model="erSelectlevelobj.name" type="text" disabled="true"
  102. :border="border" placeholder="请选择" />
  103. </view>
  104. <view>
  105. <image src="https://qufang.oss-cn-beijing.aliyuncs.com/upload/icon/xcx/jjycrm/qf/more.png"
  106. style="width:12rpx;height:23rpx;margin-left: 16rpx;">
  107. </view>
  108. </view>
  109. </view>
  110. <view style="display: flex;align-items: center;height: 80rpx;justify-content: center;" v-if="Selecttuandui&&Selecttuanduiobj.name"
  111. @click="oninputtap4()">
  112. <view class="title2-che" style="width: 220rpx;">{{Selecttuanduiobj.name}}
  113. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  114. </view>
  115. </view>
  116. <view class="single">
  117. <view class="danwei" style="margin-top: 10rpx;">销讲词执行率</view>
  118. <view class="uchaserbox" v-if="lineOptsect.series.length!=0">
  119. <qiun-data-charts :style="!showCanvas?'display:none':''" :type="linetype" :chartData="lineOptsect"
  120. background="none" :ontouch="true" canvasId="wangxiaohuaerlingeryilingwuyibao"
  121. :canvas2d="true" />
  122. </view>
  123. <view v-else style="width: 100%;">
  124. <view style="width: 100%;text-align: center;">
  125. <image style="width: 200rpx;height: 200rpx;"
  126. src="https://static.quhouse.com/zhikong_xcx_img/nodatalist.png" mode=""></image>
  127. </view>
  128. <view style="text-align: center;width: 100%;margin-top: 20rpx;color: #999999;">暂无数据</view>
  129. </view>
  130. </view>
  131. </view>
  132. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  133. <view class="single" v-if="timepickpickisshow">
  134. <view class="title">
  135. <view class="title1">对比报表</view>
  136. </view>
  137. <view class="table" v-if="!guwenFlag">
  138. <view v-for="(item,index) in tableDate" :key="index">
  139. <view class="tr">
  140. <view v-for="(item1,index1) in item" :key="index" style="width: 100%;">
  141. <view v-if="index1<item.length-1||index==0" class="td"
  142. style="border-right:1px solid #E0E0E0;">{{item1}}</view>
  143. <view v-if="index>0 && index1==item.length-1" class="td"
  144. style="border-right:1px solid #E0E0E0;" :style="{color:item1*1>0?'red':'green'}">
  145. {{item1==0?'--':item1+'%'}}</view>
  146. </view>
  147. </view>
  148. </view>
  149. </view>
  150. <view class="table" v-if="guwenFlag">
  151. <scroll-view style="" scroll-x="true">
  152. <view v-for="(item,index) in tableDate" :key="index">
  153. <view class="tr">
  154. <view v-for="(item1,index1) in item" :key="index1" style="width: 100%;">
  155. <view v-if="index==1&&index1>0" class="td" :style="{color:item1*1>0?'red':'green'}"
  156. style="border-right:1px solid #E0E0E0;">{{item1==0?'--':item1+'%'}}</view>
  157. <view v-else-if="index>1&&index1>0" class="td" style="border-right:1px solid #E0E0E0;">
  158. {{item1+'%'}}</view>
  159. <view v-else class="td" style="border-right:1px solid #E0E0E0;">{{item1}}</view>
  160. </view>
  161. </view>
  162. </view>
  163. </scroll-view>
  164. </view>
  165. </view>
  166. <view style="width: 100%;height: 60rpx;"></view>
  167. <view v-if="Showhiddenunits">
  168. <u-select v-model="Showhiddenunits" mode="single-column" :list="selectlist" @confirm="confirm">
  169. </u-select>
  170. </view>
  171. <view v-if="Showhiddenunits2">
  172. <u-select v-model="Showhiddenunits2" mode="single-column" :list="selectlist2" @confirm="confirm2">
  173. </u-select>
  174. </view>
  175. <view v-if="Showhiddenunits3">
  176. <u-select v-model="Showhiddenunits3" mode="single-column" :list="selectlist3" @confirm="confirm3">
  177. </u-select>
  178. </view>
  179. <view v-if="Showhiddenunits4">
  180. <u-select v-model="Showhiddenunits4" mode="single-column" :list="selectlist4" @confirm="confirm4">
  181. </u-select>
  182. </view>
  183. <u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar>
  184. <newcalendar v-model="totalTimeShow2" :planNum='intervaltime' mode="date" @change="totalTimeChange2">
  185. </newcalendar>
  186. </view>
  187. </template>
  188. <script>
  189. import newcalendar from '@/components/newcalendar/newcalendar.vue';
  190. export default {
  191. data() {
  192. return {
  193. compareFlag: false,
  194. numlist: [{
  195. name: '接待量',
  196. num: '10',
  197. num1: '0',
  198. num2: '0'
  199. },
  200. {
  201. name: '平均执行率',
  202. num: '10',
  203. num1: '0',
  204. num2: '0'
  205. },
  206. {
  207. name: '接待时长',
  208. num: '10',
  209. num1: '0',
  210. num2: '0'
  211. },
  212. ],
  213. activeTotal: 0, //时间下标
  214. newactiveTotal: 0, //tab下标
  215. totalTimeShow: false,
  216. totalTimeShow2: false,
  217. totalTimeShow3: false,
  218. cWidth: uni.upx2px(690),
  219. cHeight: uni.upx2px(453),
  220. AcHeight: uni.upx2px(500),
  221. kanbanlist: { //录音和测评的数据
  222. kaishitime: '',
  223. duibitime: '',
  224. audonum: '',
  225. audotime: "",
  226. avgDuration: '',
  227. fraction: ''
  228. },
  229. pamect: { //接口参数
  230. houseId: '',
  231. timeType: "4",
  232. firstStartDate: '', //第一次开始时间
  233. firstEndDate: '', //第一次结束时间
  234. lastStartDate: '',
  235. lastEndDate: '',
  236. accountId: '', //顾问ids
  237. marketingId: '', //二级销讲id
  238. deptId: "", //部门id
  239. showStatus: 0
  240. },
  241. linetype: "line",
  242. lineOptsect: {}, //图表数据
  243. Showhiddenunits: false,
  244. selectlist: [],
  245. guwenshow: false,
  246. lopanobj: {
  247. id: '',
  248. name: ''
  249. },
  250. //二级相关
  251. Selectlevel: false,
  252. Selectlevelobj: {
  253. id: '',
  254. name: ''
  255. },
  256. erSelectlevelobj: {
  257. id: '',
  258. name: ''
  259. },
  260. Showhiddenunits2: false,
  261. Showhiddenunits3: false,
  262. selectlist2: [],
  263. selectlist3: [],
  264. //团队相关
  265. Selecttuandui: false,
  266. selectlist4: [],
  267. Selecttuanduiobj: {
  268. id: '',
  269. name: ''
  270. },
  271. Showhiddenunits4: false,
  272. showCanvas: true,
  273. timepickpickisshow: false,
  274. sheartime1: "",
  275. sheartime2: "",
  276. intervaltime: 0,
  277. tableDate: [],
  278. guwenFlag: false
  279. };
  280. },
  281. components: {
  282. newcalendar
  283. },
  284. onLoad: function(options) {
  285. this.pamect.houseId = uni.getStorageSync('buildingID').id;
  286. this.init()
  287. },
  288. watch: {
  289. Showhiddenunits(newValue, oldValue) {
  290. this.showCanvas = !newValue
  291. },
  292. Showhiddenunits2(newValue, oldValue) {
  293. this.showCanvas = !newValue
  294. },
  295. Showhiddenunits3(newValue, oldValue) {
  296. this.showCanvas = !newValue
  297. },
  298. Showhiddenunits4(newValue, oldValue) {
  299. this.showCanvas = !newValue
  300. },
  301. totalTimeShow(newValue, oldValue) {
  302. this.showCanvas = !newValue
  303. },
  304. totalTimeShow2(newValue, oldValue) {
  305. this.showCanvas = !newValue
  306. },
  307. totalTimeShow3(newValue, oldValue) {
  308. this.showCanvas = !newValue
  309. },
  310. },
  311. methods: {
  312. //是否对比
  313. checkboxChange() {
  314. if (this.newactiveTotal == 3) {
  315. uni.showToast({
  316. title: '销讲一级无对比',
  317. duration: 2000
  318. });
  319. return
  320. }
  321. if (this.newactiveTotal == 2) {
  322. if (this.Selecttuanduiobj.id == '') {
  323. uni.showToast({
  324. title: '全部团队无对比',
  325. duration: 2000
  326. });
  327. return
  328. }
  329. }
  330. if (this.timepickpickisshow == true) {
  331. this.timepickpickisshow = false;
  332. this.pamect.showStatus = 0;
  333. this.init()
  334. } else {
  335. this.timepickpickisshow = true;
  336. this.pamect.showStatus = 1;
  337. }
  338. this.activeTotal = 8;
  339. },
  340. init() {
  341. this.$u.post("/cusLvStatistics/lyAndcp", this.pamect).then(data => {
  342. this.pamect.lastStartDate = data.lastStartDate;
  343. this.pamect.lastEndDate = data.lastEndDate;
  344. this.numlist[0].num = data.startSumCustomer
  345. this.numlist[1].num = data.startFraction;
  346. this.numlist[2].num = Math.floor(data.startSumDuration/60) || 0;
  347. if (data.endSumDuration != null) {
  348. this.compareFlag = true
  349. // return
  350. this.numlist[0].num1 = data.endSumCustomer
  351. this.numlist[1].num1 = data.endFraction;
  352. this.numlist[2].num1 = Math.floor(data.endSumDuration/60) || 0;
  353. this.numlist[0].num2 = data.contrastSumCustomer
  354. this.numlist[1].num2 = data.contrastFraction + '%';
  355. this.numlist[2].num2 = Math.floor(data.contrastSumDuration/60) || 0;
  356. } else {
  357. this.compareFlag = false
  358. }
  359. this.sheartime1 = data.lastStartDate.substring(5, 10) + "--" + data.lastEndDate.substring(5,
  360. 10);
  361. this.sheartime2 = '请选择';
  362. this.kanbanlist.duibitime = '';
  363. var kaishi = this.DateDiff(data.lastStartDate, data.lastEndDate);
  364. this.kanbanlist.kaishitime = data.lastStartDate + "至" + data.lastEndDate + "(" + kaishi + "天)";
  365. if (this.pamect.showStatus == 1) {
  366. this.sheartime2 = data.firstStartDate.substring(5, 10) + "--" + data.firstEndDate
  367. .substring(5, 10);
  368. var jeishu = this.DateDiff(data.firstStartDate, data.firstEndDate);
  369. this.kanbanlist.duibitime = data.firstStartDate + "至" + data.firstEndDate + "(" + jeishu +
  370. "天)";
  371. }
  372. this.kanbanlist.audonum = data.sumCustomer;
  373. this.kanbanlist.audotime = data.avgDuration;
  374. this.kanbanlist.avgDuration = data.fraction;
  375. this.kanbanlist.fraction = data.fraction;
  376. if (this.newactiveTotal == 0) {
  377. this.ProjectDimension()
  378. } else if (this.newactiveTotal == 1) {
  379. if (this.pamect.accountId == "") {
  380. this.getguwenlist()
  381. } else {
  382. this.ConsultantDimension()
  383. }
  384. } else if (this.newactiveTotal == 2) {
  385. if (this.pamect.deptId == "") {
  386. this.getuanduilist()
  387. } else {
  388. this.TeamCompared()
  389. }
  390. } else if (this.newactiveTotal == 3) {
  391. this.speakingLevel()
  392. } else {
  393. if (this.pamect.marketingId == '') {
  394. this.getonsyiji()
  395. } else {
  396. this.aboutEecondary()
  397. }
  398. }
  399. });
  400. },
  401. //起始时间
  402. totalTimeChange(e) {
  403. this.pamect.lastStartDate = e.startDate;
  404. this.pamect.lastEndDate = e.endDate;
  405. var kaishi = this.DateDiff(this.pamect.lastStartDate, this.pamect.lastEndDate)
  406. this.kanbanlist.kaishitime = this.pamect.lastStartDate + "至" + this.pamect.lastEndDate + "(" + kaishi +
  407. "天)";
  408. if (this.pamect.showStatus == 0) {
  409. this.init()
  410. this.totalTimeShow = false;
  411. } else {
  412. if (this.pamect.firstStartDate.length == 0) {
  413. uni.showToast({
  414. title: '请选择对比时间',
  415. duration: 2000
  416. });
  417. } else {
  418. var jshu = this.DateDiff(this.pamect.firstStartDate, this.pamect.firstEndDate)
  419. if (kaishi == jshu) {
  420. this.init()
  421. } else {
  422. uni.showToast({
  423. title: '请选择相同天数',
  424. duration: 2000
  425. });
  426. }
  427. }
  428. this.totalTimeShow = false;
  429. }
  430. },
  431. //对比时间
  432. totalTimeChange2(e) {
  433. var d = new Date(e.result);
  434. d.setDate(d.getDate() + this.intervaltime);
  435. var year = d.getFullYear();
  436. var month = d.getMonth() + 1;
  437. if (month < 10) month = '0' + month;
  438. var day = d.getDate();
  439. if (day < 10) day = '0' + day;
  440. this.pamect.firstStartDate = e.result;
  441. this.pamect.firstEndDate = year + '-' + month + '-' + day;
  442. console.log(this.pamect.firstStartDate)
  443. var kaishi = this.DateDiff(this.pamect.lastStartDate, this.pamect.lastEndDate)
  444. var jeishu = this.DateDiff(this.pamect.firstStartDate, this.pamect.firstEndDate)
  445. this.kanbanlist.duibitime = this.pamect.firstStartDate + "至" + this.pamect.firstEndDate + "(" + jeishu +
  446. "天)";
  447. console.log(this.pamect.lastStartDate, this.pamect.lastEndDate, kaishi, jeishu)
  448. if (kaishi == jeishu) {
  449. this.init()
  450. } else {
  451. uni.showToast({
  452. title: '请选择相同天数',
  453. duration: 2000
  454. });
  455. }
  456. this.totalTimeShow2 = false;
  457. },
  458. //自定义时间
  459. totalTimeChange3(e) {
  460. this.pamect.firstStartDate = "";
  461. this.pamect.firstEndDate = "";
  462. this.pamect.lastStartDate = e.startDate;
  463. this.pamect.lastEndDate = e.endDate;
  464. this.init()
  465. this.totalTimeShow3 = false;
  466. },
  467. //时间切换
  468. tabtimetap(index) {
  469. if (index == 0) {
  470. this.pamect.timeType = "4";
  471. this.pamect.firstStartDate = '';
  472. this.pamect.firstEndDate = '';
  473. this.pamect.lastStartDate = '';
  474. this.pamect.lastEndDate = '';
  475. this.init()
  476. } else if (index == 1) {
  477. this.pamect.timeType = "5";
  478. this.pamect.firstStartDate = '';
  479. this.pamect.firstEndDate = '';
  480. this.pamect.lastStartDate = '';
  481. this.pamect.lastEndDate = '';
  482. this.init()
  483. } else if (index == 2) {
  484. this.pamect.timeType = "6";
  485. this.pamect.firstStartDate = '';
  486. this.pamect.firstEndDate = '';
  487. this.pamect.lastStartDate = '';
  488. this.pamect.lastEndDate = '';
  489. this.init()
  490. } else if (index == 3) {
  491. this.pamect.timeType = "";
  492. this.totalTimeShow = true;
  493. } else if (index == 4) {
  494. this.pamect.timeType = "";
  495. var kaishi = this.DateDiff(this.pamect.lastStartDate, this.pamect.lastEndDate)
  496. console.log(kaishi)
  497. this.intervaltime = kaishi - 1;
  498. this.totalTimeShow2 = true;
  499. } else {
  500. this.pamect.timeType = "";
  501. this.totalTimeShow3 = true;
  502. }
  503. this.activeTotal = index;
  504. },
  505. //tab切换
  506. tabxuanxiangtap(index) {
  507. this.newactiveTotal = index;
  508. this.guwenshow = false;
  509. this.Selectlevel = false;
  510. this.Selecttuandui = false;
  511. this.pamect.showStatus = 0;
  512. this.pamect.timeType = "4";
  513. this.pamect.firstStartDate = '';
  514. this.pamect.firstEndDate = '';
  515. this.pamect.lastStartDate = '';
  516. this.pamect.lastEndDate = '';
  517. this.pamect.accountId = '';
  518. this.pamect.marketingId = '';
  519. this.pamect.deptId = ""
  520. this.activeTotal = 0;
  521. this.timepickpickisshow = false;
  522. this.init()
  523. if (index == 1) {
  524. this.guwenshow = true;
  525. }
  526. },
  527. //项目维度
  528. ProjectDimension() {
  529. const that = this;
  530. that.lineOptsect = {
  531. categories: [],
  532. series: []
  533. };
  534. this.linetype = "line";
  535. this.$u.post("/cusLvStatistics/teamOrOneValueShow", this.pamect).then(data => {
  536. if (this.pamect.showStatus == 0) {
  537. that.lineOptsect = {
  538. categories: [],
  539. series: [{
  540. name: '起始时间',
  541. data: [],
  542. color: '#7ED3F4'
  543. }]
  544. }
  545. data.lastValue.forEach((child, zxc) => {
  546. that.lineOptsect.categories.push(child.statDate.substring(5, 10))
  547. })
  548. that.lineOptsect.series[0].data = data.lastValue.map(item => item.fraction);
  549. } else {
  550. that.lineOptsect = {
  551. categories: [],
  552. series: [{
  553. name: '起始时间',
  554. data: [],
  555. color: '#7ED3F4'
  556. },
  557. {
  558. name: '对比时间',
  559. data: [],
  560. color: '#FF7070'
  561. },
  562. ]
  563. }
  564. data.firstValue.forEach((item, sdf) => {
  565. data.lastValue.forEach((child, zxc) => {
  566. if (sdf == zxc) {
  567. that.lineOptsect.categories.push(item.statDate.substring(5,
  568. 10) + 'vs' + child.statDate.substring(5, 10))
  569. }
  570. })
  571. })
  572. that.lineOptsect.series[1].data = data.firstValue.map(item => item.fraction);
  573. that.lineOptsect.series[0].data = data.lastValue.map(item => item.fraction)
  574. that.guwenFlag = false
  575. // // 处理表格数据
  576. let arr = [
  577. ['时间', '时段一', '时段二', '变化']
  578. // {
  579. // time:'时间',
  580. // time1:'时段一',
  581. // time2:'时段二',
  582. // compare:'变化'
  583. // },
  584. ]
  585. that.lineOptsect.categories.map((item, index) => {
  586. let newarr = [item, data.firstValue[index].fraction, data.lastValue[index]
  587. .fraction, data.contrast[index].data
  588. ]
  589. // obj.time=item
  590. // obj.time1=data.firstValue[index].fraction
  591. // obj.time2=data.lastValue[index].fraction
  592. // obj.compare=data.contrast[index].data
  593. // arr.push(obj)
  594. arr.push(newarr)
  595. })
  596. // console.log(arr)
  597. that.tableDate = arr
  598. }
  599. });
  600. },
  601. //顾问维度
  602. ConsultantDimension() {
  603. const that = this;
  604. that.lineOptsect = {
  605. categories: [],
  606. series: []
  607. };
  608. this.linetype = "radar";
  609. this.$u.post("/cusLvStatistics/accFirstLevelContrast", this.pamect).then(data => {
  610. // return
  611. if (this.pamect.showStatus == 0) {
  612. that.lineOptsect = {
  613. categories: [],
  614. series: [{
  615. name: '时段一',
  616. data: [],
  617. color: '#7ED3F4'
  618. }]
  619. }
  620. data.firstList.forEach((item, sdf) => {
  621. that.lineOptsect.categories.push(item.name)
  622. that.lineOptsect.series[0].data.push(data.headerList[sdf].total)
  623. })
  624. // that.lineOptsect.series[0].data = data.lastValue.map(item => item.fraction);
  625. } else {
  626. // 当有对比的时候
  627. that.lineOptsect = {
  628. categories: [],
  629. series: [{
  630. name: '时段一',
  631. data: [],
  632. color: '#7ED3F4'
  633. },
  634. {
  635. name: '时段二',
  636. data: [],
  637. color: '#FF7070'
  638. },
  639. ]
  640. }
  641. data.headerList.forEach((item, sdf) => {
  642. that.lineOptsect.categories.push(item.name)
  643. that.lineOptsect.series[0].data.push(data.firstList[sdf].total)
  644. that.lineOptsect.series[1].data.push(data.secondList[sdf].total)
  645. })
  646. // return
  647. // // 处理表格数据
  648. that.guwenFlag = true
  649. let arr = []
  650. arr[0] = ['时间', ...that.lineOptsect.categories]
  651. arr[1] = ['变化']
  652. arr[2] = ['时段一']
  653. arr[3] = ['时段二']
  654. // console.log(arr)
  655. data.firstList.map((item, index) => {
  656. arr[1].push(item.total)
  657. arr[2].push(data.secondList[index].total)
  658. arr[3].push(data.thirdList[index].total)
  659. })
  660. that.tableDate = arr
  661. }
  662. });
  663. },
  664. // 顾问纬度选择顾问
  665. oninputtap() {
  666. this.Showhiddenunits = true;
  667. },
  668. // 顾问选择确认
  669. confirm(e) {
  670. this.lopanobj.id = e[0].value;
  671. this.lopanobj.name = e[0].label;
  672. this.pamect.accountId = this.lopanobj.id;
  673. this.ConsultantDimension()
  674. this.Showhiddenunits = false;
  675. },
  676. //获取顾问
  677. getguwenlist() {
  678. this.$u.post("/cusLvStatistics/selectAllAccountIdByHouseId", {
  679. houseId: this.pamect.houseId
  680. }).then(data => {
  681. this.selectlist = [];
  682. if (data.length == 0) {
  683. this.lineOptsect = {
  684. categories: [],
  685. series: []
  686. };
  687. this.guwenshow = false;
  688. return
  689. } else {
  690. this.guwenshow = true;
  691. data.forEach(item => {
  692. this.selectlist.push({
  693. value: item.accountId,
  694. label: item.name
  695. })
  696. })
  697. this.lopanobj.id = data[0].accountId;
  698. this.lopanobj.name = data[0].name;
  699. this.pamect.accountId = this.lopanobj.id;
  700. this.ConsultantDimension()
  701. }
  702. })
  703. },
  704. //销讲一级
  705. speakingLevel() {
  706. this.linetype = "radar";
  707. this.lineOptsect = {
  708. categories: [],
  709. series: []
  710. };
  711. this.$u.post("/cusLvStatistics/firstLevelContrast", this.pamect).then(data => {
  712. if (data.length == 0) {
  713. return
  714. } else {
  715. let list = data.map(item => {
  716. return item.name
  717. });
  718. let list1 = data.map(item => {
  719. if (item.avgExecutionRate == null) {
  720. item.avgExecutionRate = 0
  721. } else {
  722. item.avgExecutionRate = item.avgExecutionRate
  723. }
  724. return item.avgExecutionRate
  725. });
  726. this.lineOptsect = {
  727. "categories": list,
  728. "series": [{
  729. "name": "",
  730. "data": list1
  731. }]
  732. }
  733. }
  734. })
  735. },
  736. //销讲二级
  737. aboutEecondary() {
  738. this.lineOptsect = {};
  739. this.linetype = "line";
  740. this.$u.post("/cusLvStatistics/level2Contrast", this.pamect).then(data => {
  741. if (this.pamect.showStatus == 0) {
  742. this.lineOptsect = {
  743. categories: [],
  744. series: [{
  745. name: '起始时间',
  746. data: [],
  747. color: '#7ED3F4'
  748. }]
  749. }
  750. data.lastList.forEach((item, sdf) => {
  751. this.lineOptsect.categories.push(item.statDate.substring(5, 10))
  752. })
  753. this.lineOptsect.series[0].data = data.lastList.map(item => item.avgExecutionRate);
  754. } else {
  755. this.lineOptsect = {
  756. categories: [],
  757. series: [{
  758. name: '起始时间',
  759. data: [],
  760. color: '#7ED3F4'
  761. },
  762. {
  763. name: '对比时间',
  764. data: [],
  765. color: '#FF7070'
  766. },
  767. ]
  768. }
  769. data.firstList.forEach((item, sdf) => {
  770. data.lastList.forEach((child, zxc) => {
  771. if (sdf == zxc) {
  772. this.lineOptsect.categories.push(item.statDate.substring(5,
  773. 10) + 'vs' + child.statDate.substring(5, 10))
  774. }
  775. })
  776. })
  777. this.lineOptsect.series[1].data = data.firstList.map(item => item.avgExecutionRate);
  778. this.lineOptsect.series[0].data = data.lastList.map(item => item.avgExecutionRate)
  779. let that = this
  780. this.guwenFlag = false
  781. // // 处理表格数据
  782. let arr = [
  783. ['时间', '时段一', '时段二', '变化']
  784. ]
  785. that.lineOptsect.categories.map((item, index) => {
  786. let newarr = [item, data.firstList[index].avgExecutionRate, data.lastList[
  787. index].avgExecutionRate, data.contrast[index].data]
  788. arr.push(newarr)
  789. })
  790. // console.log(arr)
  791. that.tableDate = arr
  792. }
  793. })
  794. },
  795. //销讲二级:获取一级
  796. getonsyiji() {
  797. this.$u.post("/cusLvStatistics/findAllFirstLevel", {
  798. houseId: this.pamect.houseId
  799. }).then(data => {
  800. this.selectlist2 = [];
  801. if (data.length == 0) {
  802. this.Selectlevel = false;
  803. this.lineOptsect = {
  804. categories: [],
  805. series: []
  806. };
  807. return
  808. } else {
  809. this.Selectlevel = true;
  810. data.forEach(item => {
  811. this.selectlist2.push({
  812. value: item.marketingId,
  813. label: item.name
  814. })
  815. })
  816. this.Selectlevelobj.id = data[0].marketingId;
  817. this.Selectlevelobj.name = data[0].name;
  818. this.getonserji(this.Selectlevelobj.id)
  819. }
  820. })
  821. },
  822. //销讲二级:通过一级获取二级
  823. getonserji(ccd) {
  824. this.$u.post("/cusLvStatistics/findLevel2ByFirstLevel", {
  825. houseId: this.pamect.houseId,
  826. marketingId: ccd
  827. }).then(data => {
  828. this.selectlist3 = [];
  829. data.forEach(item => {
  830. this.selectlist3.push({
  831. value: item.marketingId,
  832. label: item.name
  833. })
  834. })
  835. this.erSelectlevelobj.id = data[0].marketingId;
  836. this.erSelectlevelobj.name = data[0].name;
  837. this.pamect.marketingId = this.erSelectlevelobj.id;
  838. this.aboutEecondary()
  839. })
  840. },
  841. //销讲二级:一级选择
  842. oninputtap2() {
  843. this.Showhiddenunits2 = true;
  844. },
  845. //销讲二级:二级选择
  846. oninputtap3() {
  847. if (this.Selectlevelobj.id == "") {
  848. uni.showToast({
  849. title: '请先选择一级',
  850. duration: 2000
  851. });
  852. } else {
  853. this.Showhiddenunits3 = true;
  854. }
  855. },
  856. //销讲二级:一级选择确认
  857. confirm2(e) {
  858. this.Selectlevelobj.id = e[0].value;
  859. this.Selectlevelobj.name = e[0].label;
  860. this.getonserji(this.Selectlevelobj.id)
  861. },
  862. //销讲二级:二级选择确认
  863. confirm3(e) {
  864. this.erSelectlevelobj.id = e[0].value;
  865. this.erSelectlevelobj.name = e[0].label;
  866. this.pamect.marketingId = this.erSelectlevelobj.id;
  867. this.aboutEecondary()
  868. },
  869. //团队请选择
  870. oninputtap4() {
  871. this.Showhiddenunits4 = true;
  872. },
  873. //团队选择确认
  874. confirm4(e) {
  875. this.Selecttuanduiobj.id = e[0].value;
  876. this.Selecttuanduiobj.name = e[0].label;
  877. this.pamect.deptId = this.Selecttuanduiobj.id;
  878. this.pamect.showStatus = 0;
  879. this.pamect.timeType = "4";
  880. this.pamect.firstStartDate = '';
  881. this.pamect.firstEndDate = '';
  882. this.pamect.lastStartDate = '';
  883. this.pamect.lastEndDate = '';
  884. this.activeTotal = 0;
  885. this.timepickpickisshow = false;
  886. this.init()
  887. this.TeamCompared()
  888. },
  889. //获取团队列表
  890. getuanduilist() {
  891. this.$u.post("/cusLvStatistics/findAllDeptIdByHouseId ", {
  892. houseId: this.pamect.houseId
  893. }).then(data => {
  894. this.selectlist4 = [{
  895. value: "",
  896. label: "全部"
  897. }];
  898. if (data.length == 0) {
  899. this.Selecttuandui = false;
  900. this.lineOptsect = {
  901. categories: [],
  902. series: []
  903. };
  904. return
  905. } else {
  906. this.Selecttuandui = true;
  907. data.forEach(item => {
  908. this.selectlist4.push({
  909. value: item.deptId,
  910. label: item.deptName
  911. })
  912. })
  913. this.Selecttuanduiobj.id = "";
  914. this.Selecttuanduiobj.name = "全部";
  915. this.pamect.deptId = this.Selecttuanduiobj.id;
  916. this.TeamCompared()
  917. }
  918. })
  919. },
  920. //团队对比
  921. TeamCompared() {
  922. const that = this;
  923. that.lineOptsect = {};
  924. this.linetype = "line";
  925. this.$u.post("/cusLvStatistics/teamOrOneValueShowByDept", this.pamect).then(data => {
  926. if (this.Selecttuanduiobj.id == "") {
  927. var newlist = [];
  928. for (var i in data) {
  929. var ect = data[i].receptionStatList.map(item => {
  930. if (item.fraction == null) {
  931. item.fraction = 0
  932. } else {
  933. item.fraction = item.fraction
  934. }
  935. return item.fraction
  936. });
  937. newlist.push({
  938. name: data[i].deptName,
  939. data: ect
  940. })
  941. }
  942. var timelist = [];
  943. for (var i in data) {
  944. var ect = data[i].receptionStatList.map(item => {
  945. return item.statDate
  946. });
  947. timelist.push({
  948. name: data[i].deptName,
  949. data: ect
  950. })
  951. }
  952. var xAxisdata = [];
  953. timelist[0].data.forEach((item, sdf) => {
  954. xAxisdata.push(item.substring(5, 10))
  955. })
  956. that.lineOptsect = {
  957. categories: xAxisdata,
  958. series: newlist
  959. }
  960. } else {
  961. if (this.pamect.showStatus == 0) {
  962. that.lineOptsect = {
  963. categories: [],
  964. series: [{
  965. name: '起始时间',
  966. data: [],
  967. color: '#7ED3F4'
  968. }]
  969. }
  970. data.lastValue.receptionStatList.forEach((item, sdf) => {
  971. that.lineOptsect.categories.push(item.statDate.substring(5, 10))
  972. })
  973. that.lineOptsect.series[0].data = data.lastValue.receptionStatList.map(item => item
  974. .fraction);
  975. } else {
  976. that.lineOptsect = {
  977. categories: [],
  978. series: [{
  979. name: '起始时间',
  980. data: [],
  981. color: '#7ED3F4'
  982. },
  983. {
  984. name: '对比时间',
  985. data: [],
  986. color: '#FF7070'
  987. },
  988. ]
  989. }
  990. data.firstValue.receptionStatList.forEach((item, sdf) => {
  991. data.lastValue.receptionStatList.forEach((child, zxc) => {
  992. if (sdf == zxc) {
  993. that.lineOptsect.categories.push(item.statDate.substring(5,
  994. 10) + 'vs' + child.statDate.substring(5, 10))
  995. }
  996. })
  997. })
  998. that.lineOptsect.series[1].data = data.firstValue.receptionStatList.map(item => item
  999. .fraction);
  1000. that.lineOptsect.series[0].data = data.lastValue.receptionStatList.map(item => item
  1001. .fraction)
  1002. that.guwenFlag = false
  1003. // 团队处理数据
  1004. // // 处理表格数据
  1005. let arr = [
  1006. ['时间', data.firstValue.deptName, data.lastValue.deptName, '变化']
  1007. // {
  1008. // time:'时间',
  1009. // time1:'时段一',
  1010. // time2:'时段二',
  1011. // compare:'变化'
  1012. // },
  1013. ]
  1014. that.lineOptsect.categories.map((item, index) => {
  1015. let newarr = [item, data.firstValue.receptionStatList[index].fraction, data
  1016. .lastValue.receptionStatList[index].fraction, data.contrast
  1017. .receptionStatList[index].data
  1018. ]
  1019. // obj.time=item
  1020. // obj.time1=data.firstValue[index].fraction
  1021. // obj.time2=data.lastValue[index].fraction
  1022. // obj.compare=data.contrast[index].data
  1023. // arr.push(obj)
  1024. arr.push(newarr)
  1025. })
  1026. // console.log(arr)
  1027. that.tableDate = arr
  1028. }
  1029. }
  1030. });
  1031. },
  1032. //算相隔天数
  1033. DateDiff(sDate1, sDate2) {
  1034. var aDate, oDate1, oDate2, iDays;
  1035. aDate = sDate1.split("-");
  1036. oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]); //转换为yyyy-MM-dd格式
  1037. aDate = sDate2.split("-");
  1038. oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);
  1039. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24); //把相差的毫秒数转换为天数
  1040. return iDays + 1; //返回相差天数
  1041. },
  1042. },
  1043. }
  1044. </script>
  1045. <style lang="scss" scoped>
  1046. .title2-che {
  1047. width: 178rpx;
  1048. height: 48rpx;
  1049. background: #FFFFFF;
  1050. border-radius: 6rpx;
  1051. border: 1px solid #E0E0E0;
  1052. line-height: 48rpx;
  1053. font-size: 28rpx;
  1054. font-weight: 400;
  1055. color: #666666;
  1056. text-indent: 12rpx;
  1057. margin-left: 35rpx;
  1058. position: relative;
  1059. .righttochoose {
  1060. width: 18rpx;
  1061. height: 24rpx;
  1062. position: absolute;
  1063. top: 12rpx;
  1064. right: 12rpx;
  1065. }
  1066. }
  1067. .table {
  1068. border: 0px solid darkgray;
  1069. .tr {
  1070. display: flex;
  1071. width: 100%;
  1072. justify-content: center;
  1073. height: 64rpx;
  1074. align-items: center;
  1075. border-bottom: 1px solid #E0E0E0;
  1076. .td {
  1077. text-align: center;
  1078. font-size: 24rpx;
  1079. font-weight: 400;
  1080. color: #333333;
  1081. height: 64rpx;
  1082. line-height: 64rpx;
  1083. }
  1084. .th {
  1085. height: 64rpx;
  1086. text-align: center;
  1087. font-size: 28rpx;
  1088. font-weight: 400;
  1089. color: #666666;
  1090. line-height: 64rpx;
  1091. }
  1092. }
  1093. }
  1094. .activecllasscet2 {
  1095. color: #2671E2;
  1096. border-bottom: 2px solid #2671E2;
  1097. }
  1098. .timeduibi {
  1099. width: 100%;
  1100. background: #FFFFFF;
  1101. padding-bottom: 10rpx;
  1102. .timeshow {
  1103. color: #666666;
  1104. width: 100%;
  1105. height: 50rpx;
  1106. font-size: 28rpx;
  1107. line-height: 50rpx;
  1108. text-indent: 30rpx;
  1109. }
  1110. }
  1111. // 顶部时间切换
  1112. .timetabct {
  1113. width: 100%;
  1114. height: 98rpx;
  1115. display: flex;
  1116. align-items: center;
  1117. border-bottom: 1px solid #E0E0E0;
  1118. }
  1119. .timetabctview {
  1120. flex: 1;
  1121. height: 100%;
  1122. display: flex;
  1123. justify-content: center;
  1124. align-items: center;
  1125. }
  1126. .timetabct view {
  1127. width: 94rpx;
  1128. text-align: center;
  1129. height: 100%;
  1130. line-height: 98rpx;
  1131. font-size: 28rpx;
  1132. font-family: PingFangSC-Regular, PingFang SC;
  1133. font-weight: 400;
  1134. color: #666666;
  1135. }
  1136. .activecllasscet {
  1137. border-bottom: 2px solid #2671E2;
  1138. }
  1139. // 对比时间切换
  1140. .timepick {
  1141. width: 100%;
  1142. height: 90rpx;
  1143. display: flex;
  1144. align-items: center;
  1145. background: #FFFFFF;
  1146. }
  1147. .timepicktime {
  1148. width: 260rpx;
  1149. height: 50rpx;
  1150. border: 1rpx solid #E0E0E0;
  1151. margin-left: 30rpx;
  1152. display: flex;
  1153. background: #FFFFFF;
  1154. }
  1155. .timepicktime>view:nth-of-type(1) {
  1156. width: 210rpx;
  1157. height: 100%;
  1158. line-height: 50rpx;
  1159. font-size: 26rpx;
  1160. font-weight: 400;
  1161. text-align: center;
  1162. }
  1163. .timepicktime>view:nth-of-type(2) {
  1164. width: 50rpx;
  1165. height: 100%;
  1166. border-left: 1px solid #E0E0E0;
  1167. }
  1168. .timepickpick {
  1169. width: 110rpx;
  1170. height: 50rpx;
  1171. margin-left: 30rpx;
  1172. display: flex;
  1173. align-items: center;
  1174. }
  1175. .Underimg {
  1176. width: 50rpx;
  1177. height: 50rpx;
  1178. margin-top: -2rpx;
  1179. }
  1180. .timeButton {
  1181. width: 100%;
  1182. height: 60rpx;
  1183. display: flex;
  1184. color: #b1b1b1;
  1185. font-size: 28rpx;
  1186. .item {
  1187. text-align: center;
  1188. line-height: 60rpx;
  1189. padding-left: 12rpx;
  1190. padding-right: 12rpx;
  1191. border-radius: 8rpx;
  1192. border: 1px solid #E0E0E0;
  1193. margin-right: 20rpx;
  1194. &.active {
  1195. color: #FFFFFF;
  1196. background-color: #2671E2;
  1197. }
  1198. }
  1199. }
  1200. .boardbox {
  1201. width: 100%;
  1202. height: 172rpx;
  1203. display: flex;
  1204. align-items: center;
  1205. background: #F4F8FD;
  1206. border-radius: 8rpx;
  1207. margin-top: 28rpx;
  1208. .boardbox-zuo {
  1209. width: 50%;
  1210. height: 120rpx;
  1211. border-right: 1px solid #E0E0E0;
  1212. }
  1213. .boardbox-you {
  1214. width: 50%;
  1215. height: 120rpx;
  1216. }
  1217. .boardbox-text1 {
  1218. width: 100%;
  1219. text-align: center;
  1220. font-size: 28rpx;
  1221. color: #333333;
  1222. }
  1223. .boardbox-text2 {
  1224. width: 100%;
  1225. text-align: center;
  1226. font-size: 26rpx;
  1227. color: #333333;
  1228. margin-top: 10rpx;
  1229. }
  1230. }
  1231. .comparesize {
  1232. flex: 1;
  1233. font-size: 24rpx;
  1234. color: #666666;
  1235. margin-top: 10rpx;
  1236. }
  1237. </style>