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.
 
 
 

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