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.
 
 
 

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