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.
 
 
 

1336 lines
37 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. {{index==1?item.num+'%':item.num}}
  52. </view>
  53. <view class="comparesize" v-if="compareFlag&&timepickpickisshow">
  54. <text style="margin-right: 10rpx;">对比:{{index==1?item.num1+'%':item.num1}} </text>
  55. <text :style="{color:item.num2*1>0?'red':'green'}">{{item.num2+'%'}} {{item.num2*1>0?'↑':'↓'}}</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+'%'}}{{item1*1>0?'↑':item1*1<0?'↓':''}}</view>
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. <view class="table" v-if="guwenFlag" style="width: 100%;">
  163. <scroll-view scroll-x="true" style="white-space: nowrap;">
  164. <view v-for="(item,index) in tableDate" :key="index" :style="{display:index==0?'inline-block':'block'}">
  165. <view class="tr" style="display: inline-block;">
  166. <view v-for="(item1,index1) in item" :key="index1" class="trd" style="display: inline-block;">
  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+'%'}}{{item1*1>0?'↑':item1*1<0?'↓':''}}</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 = data.contrastSumDuration|| 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.tableDate=[]
  524. this.pamect.showStatus = 0;
  525. this.pamect.timeType = "4";
  526. this.pamect.firstStartDate = '';
  527. this.pamect.firstEndDate = '';
  528. this.pamect.lastStartDate = '';
  529. this.pamect.lastEndDate = '';
  530. this.pamect.accountId = '';
  531. this.pamect.marketingId = '';
  532. this.pamect.deptId = ""
  533. this.activeTotal = 0;
  534. this.timepickpickisshow = false;
  535. this.init()
  536. if (index == 1) {
  537. this.guwenshow = true;
  538. }
  539. },
  540. //项目维度
  541. ProjectDimension() {
  542. const that = this;
  543. that.lineOptsect = {
  544. categories: [],
  545. series: []
  546. };
  547. this.linetype = "line";
  548. this.$u.post("/cusLvStatistics/teamOrOneValueShow", this.pamect).then(data => {
  549. if (this.pamect.showStatus == 0) {
  550. that.lineOptsect = {
  551. categories: [],
  552. series: [{
  553. name: '起始时间',
  554. data: [],
  555. color: '#7ED3F4'
  556. }]
  557. }
  558. data.lastValue.forEach((child, zxc) => {
  559. that.lineOptsect.categories.push(child.statDate.substring(5, 10))
  560. })
  561. that.lineOptsect.series[0].data = data.lastValue.map(item => item.fraction);
  562. } else {
  563. that.lineOptsect = {
  564. categories: [],
  565. series: [{
  566. name: '起始时间',
  567. data: [],
  568. color: '#7ED3F4'
  569. },
  570. {
  571. name: '对比时间',
  572. data: [],
  573. color: '#FF7070'
  574. },
  575. ]
  576. }
  577. data.firstValue.forEach((item, sdf) => {
  578. data.lastValue.forEach((child, zxc) => {
  579. if (sdf == zxc) {
  580. that.lineOptsect.categories.push(
  581. child.statDate.substring(5,10) + 'vs' + item.statDate.substring(5, 10)
  582. )
  583. }
  584. })
  585. })
  586. that.lineOptsect.series[1].data = data.firstValue.map(item => item.fraction);
  587. that.lineOptsect.series[0].data = data.lastValue.map(item => item.fraction)
  588. that.guwenFlag = false
  589. // // 处理表格数据
  590. let arr = [
  591. ['时间', '时段一', '时段二', '变化']
  592. // {
  593. // time:'时间',
  594. // time1:'时段一',
  595. // time2:'时段二',
  596. // compare:'变化'
  597. // },
  598. ]
  599. that.lineOptsect.categories.map((item, index) => {
  600. let newarr = [item, data.lastValue[index].fraction, data.firstValue[index].fraction,data.contrast[index].data
  601. ]
  602. // obj.time=item
  603. // obj.time1=data.firstValue[index].fraction
  604. // obj.time2=data.lastValue[index].fraction
  605. // obj.compare=data.contrast[index].data
  606. // arr.push(obj)
  607. arr.push(newarr)
  608. })
  609. // console.log(arr)
  610. that.tableDate = arr
  611. }
  612. });
  613. },
  614. //顾问维度
  615. ConsultantDimension() {
  616. const that = this;
  617. that.lineOptsect = {
  618. categories: [],
  619. series: []
  620. };
  621. this.linetype = "radar";
  622. this.$u.post("/cusLvStatistics/accFirstLevelContrast", this.pamect).then(data => {
  623. // return
  624. if (this.pamect.showStatus == 0) {
  625. that.lineOptsect = {
  626. categories: [],
  627. series: [{
  628. name: '时段一',
  629. data: [],
  630. color: '#7ED3F4'
  631. }]
  632. }
  633. data.firstList.forEach((item, sdf) => {
  634. that.lineOptsect.categories.push(item.name)
  635. that.lineOptsect.series[0].data.push(data.firstList[sdf].total)
  636. })
  637. // that.lineOptsect.series[0].data = data.lastValue.map(item => item.fraction);
  638. } else {
  639. // 当有对比的时候
  640. that.lineOptsect = {
  641. categories: [],
  642. series: [{
  643. name: '时段一',
  644. data: [],
  645. color: '#7ED3F4'
  646. },
  647. {
  648. name: '时段二',
  649. data: [],
  650. color: '#FF7070'
  651. },
  652. ]
  653. }
  654. data.headerList.forEach((item, sdf) => {
  655. that.lineOptsect.categories.push(item.name)
  656. that.lineOptsect.series[0].data.push(data.firstList[sdf].total)
  657. that.lineOptsect.series[1].data.push(data.secondList[sdf].total)
  658. })
  659. // return
  660. // // 处理表格数据
  661. that.guwenFlag = true
  662. let arr = []
  663. arr[0] = ['时间', ...that.lineOptsect.categories]
  664. arr[1] = ['变化']
  665. arr[2] = ['时段一']
  666. arr[3] = ['时段二']
  667. // console.log(arr)
  668. data.firstList.map((item, index) => {
  669. arr[2].push(item.total)
  670. arr[3].push(data.secondList[index].total)
  671. arr[1].push(data.thirdList[index].total)
  672. })
  673. that.tableDate = arr
  674. }
  675. });
  676. },
  677. // 顾问纬度选择顾问
  678. oninputtap() {
  679. this.Showhiddenunits = true;
  680. },
  681. // 顾问选择确认
  682. confirm(e) {
  683. this.lopanobj.id = e[0].value;
  684. this.lopanobj.name = e[0].label;
  685. this.pamect.accountId = this.lopanobj.id;
  686. this.ConsultantDimension()
  687. this.Showhiddenunits = false;
  688. },
  689. //获取顾问
  690. getguwenlist() {
  691. this.$u.post("/cusLvStatistics/selectAllAccountIdByHouseId", {
  692. houseId: this.pamect.houseId
  693. }).then(data => {
  694. this.selectlist = [];
  695. if (data.length == 0) {
  696. this.lineOptsect = {
  697. categories: [],
  698. series: []
  699. };
  700. this.guwenshow = false;
  701. return
  702. } else {
  703. this.guwenshow = true;
  704. data.forEach(item => {
  705. this.selectlist.push({
  706. value: item.accountId,
  707. label: item.name
  708. })
  709. })
  710. this.lopanobj.id = data[0].accountId;
  711. this.lopanobj.name = data[0].name;
  712. this.pamect.accountId = this.lopanobj.id;
  713. this.ConsultantDimension()
  714. }
  715. })
  716. },
  717. //销讲一级
  718. speakingLevel() {
  719. this.linetype = "radar";
  720. this.lineOptsect = {
  721. categories: [],
  722. series: []
  723. };
  724. this.$u.post("/cusLvStatistics/firstLevelContrast", this.pamect).then(data => {
  725. if (data.length == 0) {
  726. return
  727. } else {
  728. let list = data.map(item => {
  729. return item.name
  730. });
  731. let list1 = data.map(item => {
  732. if (item.avgExecutionRate == null) {
  733. item.avgExecutionRate = 0
  734. } else {
  735. item.avgExecutionRate = item.avgExecutionRate
  736. }
  737. return item.avgExecutionRate
  738. });
  739. this.lineOptsect = {
  740. "categories": list,
  741. "series": [{
  742. "name": "销讲一级",
  743. "data": list1
  744. }]
  745. }
  746. }
  747. })
  748. },
  749. //销讲二级
  750. aboutEecondary() {
  751. this.lineOptsect = {};
  752. this.linetype = "line";
  753. this.$u.post("/cusLvStatistics/level2Contrast", this.pamect).then(data => {
  754. if (this.pamect.showStatus == 0) {
  755. this.lineOptsect = {
  756. categories: [],
  757. series: [{
  758. name: '起始时间',
  759. data: [],
  760. color: '#7ED3F4'
  761. }]
  762. }
  763. data.lastList.forEach((item, sdf) => {
  764. this.lineOptsect.categories.push(item.statDate.substring(5, 10))
  765. })
  766. this.lineOptsect.series[0].data = data.lastList.map(item => item.avgExecutionRate);
  767. } else {
  768. this.lineOptsect = {
  769. categories: [],
  770. series: [{
  771. name: '起始时间',
  772. data: [],
  773. color: '#7ED3F4'
  774. },
  775. {
  776. name: '对比时间',
  777. data: [],
  778. color: '#FF7070'
  779. },
  780. ]
  781. }
  782. data.firstList.forEach((item, sdf) => {
  783. data.lastList.forEach((child, zxc) => {
  784. if (sdf == zxc) {
  785. this.lineOptsect.categories.push(
  786. child.statDate.substring(5,10) + 'vs' + item.statDate.substring(5, 10)
  787. )
  788. }
  789. })
  790. })
  791. this.lineOptsect.series[1].data = data.firstList.map(item => item.avgExecutionRate);
  792. this.lineOptsect.series[0].data = data.lastList.map(item => item.avgExecutionRate)
  793. let that = this
  794. this.guwenFlag = false
  795. // // 处理表格数据
  796. let arr = [
  797. ['时间', '时段一', '时段二', '变化']
  798. ]
  799. that.lineOptsect.categories.map((item, index) => {
  800. let newarr = [item, data.lastList[
  801. index].avgExecutionRate, data.firstList[index].avgExecutionRate, data.contrast[index].data]
  802. arr.push(newarr)
  803. })
  804. // console.log(arr)
  805. that.tableDate = arr
  806. }
  807. })
  808. },
  809. //销讲二级:获取一级
  810. getonsyiji() {
  811. this.$u.post("/cusLvStatistics/findAllFirstLevel", {
  812. houseId: this.pamect.houseId
  813. }).then(data => {
  814. this.selectlist2 = [];
  815. if (data.length == 0) {
  816. this.Selectlevel = false;
  817. this.lineOptsect = {
  818. categories: [],
  819. series: []
  820. };
  821. return
  822. } else {
  823. this.Selectlevel = true;
  824. data.forEach(item => {
  825. this.selectlist2.push({
  826. value: item.marketingId,
  827. label: item.name
  828. })
  829. })
  830. this.Selectlevelobj.id = data[0].marketingId;
  831. this.Selectlevelobj.name = data[0].name;
  832. this.getonserji(this.Selectlevelobj.id)
  833. }
  834. })
  835. },
  836. //销讲二级:通过一级获取二级
  837. getonserji(ccd) {
  838. this.$u.post("/cusLvStatistics/findLevel2ByFirstLevel", {
  839. houseId: this.pamect.houseId,
  840. marketingId: ccd
  841. }).then(data => {
  842. this.selectlist3 = [];
  843. data.forEach(item => {
  844. this.selectlist3.push({
  845. value: item.marketingId,
  846. label: item.name
  847. })
  848. })
  849. this.erSelectlevelobj.id = data[0].marketingId;
  850. this.erSelectlevelobj.name = data[0].name;
  851. this.pamect.marketingId = this.erSelectlevelobj.id;
  852. this.aboutEecondary()
  853. })
  854. },
  855. //销讲二级:一级选择
  856. oninputtap2() {
  857. this.Showhiddenunits2 = true;
  858. },
  859. //销讲二级:二级选择
  860. oninputtap3() {
  861. if (this.Selectlevelobj.id == "") {
  862. uni.showToast({
  863. title: '请先选择一级',
  864. duration: 2000
  865. });
  866. } else {
  867. this.Showhiddenunits3 = true;
  868. }
  869. },
  870. //销讲二级:一级选择确认
  871. confirm2(e) {
  872. this.Selectlevelobj.id = e[0].value;
  873. this.Selectlevelobj.name = e[0].label;
  874. this.getonserji(this.Selectlevelobj.id)
  875. },
  876. //销讲二级:二级选择确认
  877. confirm3(e) {
  878. this.erSelectlevelobj.id = e[0].value;
  879. this.erSelectlevelobj.name = e[0].label;
  880. this.pamect.marketingId = this.erSelectlevelobj.id;
  881. this.aboutEecondary()
  882. },
  883. //团队请选择
  884. oninputtap4() {
  885. this.Showhiddenunits4 = true;
  886. },
  887. //团队选择确认
  888. confirm4(e) {
  889. this.Selecttuanduiobj.id = e[0].value;
  890. this.Selecttuanduiobj.name = e[0].label;
  891. this.pamect.deptId = this.Selecttuanduiobj.id;
  892. this.pamect.showStatus = 0;
  893. this.pamect.timeType = "4";
  894. this.pamect.firstStartDate = '';
  895. this.pamect.firstEndDate = '';
  896. this.pamect.lastStartDate = '';
  897. this.pamect.lastEndDate = '';
  898. this.activeTotal = 0;
  899. this.timepickpickisshow = false;
  900. this.init()
  901. this.TeamCompared()
  902. },
  903. //获取团队列表
  904. getuanduilist() {
  905. this.$u.post("/cusLvStatistics/findAllDeptIdByHouseId ", {
  906. houseId: this.pamect.houseId
  907. }).then(data => {
  908. this.selectlist4 = [{
  909. value: "",
  910. label: "全部"
  911. }];
  912. if (data.length == 0) {
  913. this.Selecttuandui = false;
  914. this.lineOptsect = {
  915. categories: [],
  916. series: []
  917. };
  918. return
  919. } else {
  920. this.Selecttuandui = true;
  921. data.forEach(item => {
  922. this.selectlist4.push({
  923. value: item.deptId,
  924. label: item.deptName
  925. })
  926. })
  927. this.Selecttuanduiobj.id = "";
  928. this.Selecttuanduiobj.name = "全部";
  929. this.pamect.deptId = this.Selecttuanduiobj.id;
  930. this.TeamCompared()
  931. }
  932. })
  933. },
  934. //团队对比
  935. TeamCompared() {
  936. const that = this;
  937. that.lineOptsect = {};
  938. this.linetype = "line";
  939. this.$u.post("/cusLvStatistics/teamOrOneValueShowByDept", this.pamect).then(data => {
  940. if (this.Selecttuanduiobj.id == "") {
  941. var newlist = [];
  942. for (var i in data) {
  943. var ect = data[i].receptionStatList.map(item => {
  944. if (item.fraction == null) {
  945. item.fraction = 0
  946. } else {
  947. item.fraction = item.fraction
  948. }
  949. return item.fraction
  950. });
  951. newlist.push({
  952. name: data[i].deptName,
  953. data: ect
  954. })
  955. }
  956. var timelist = [];
  957. for (var i in data) {
  958. var ect = data[i].receptionStatList.map(item => {
  959. return item.statDate
  960. });
  961. timelist.push({
  962. name: data[i].deptName,
  963. data: ect
  964. })
  965. }
  966. var xAxisdata = [];
  967. timelist[0].data.forEach((item, sdf) => {
  968. xAxisdata.push(item.substring(5, 10))
  969. })
  970. that.lineOptsect = {
  971. categories: xAxisdata,
  972. series: newlist
  973. }
  974. } else {
  975. if (this.pamect.showStatus == 0) {
  976. that.lineOptsect = {
  977. categories: [],
  978. series: [{
  979. name: '起始时间',
  980. data: [],
  981. color: '#7ED3F4'
  982. }]
  983. }
  984. data.lastValue.receptionStatList.forEach((item, sdf) => {
  985. that.lineOptsect.categories.push(item.statDate.substring(5, 10))
  986. })
  987. that.lineOptsect.series[0].data = data.lastValue.receptionStatList.map(item => item
  988. .fraction);
  989. } else {
  990. that.lineOptsect = {
  991. categories: [],
  992. series: [{
  993. name: '起始时间',
  994. data: [],
  995. color: '#7ED3F4'
  996. },
  997. {
  998. name: '对比时间',
  999. data: [],
  1000. color: '#FF7070'
  1001. },
  1002. ]
  1003. }
  1004. data.firstValue.receptionStatList.forEach((item, sdf) => {
  1005. data.lastValue.receptionStatList.forEach((child, zxc) => {
  1006. if (sdf == zxc) {
  1007. that.lineOptsect.categories.push(
  1008. child.statDate.substring(5,10) + 'vs' + item.statDate.substring(5, 10)
  1009. )
  1010. }
  1011. })
  1012. })
  1013. that.lineOptsect.series[1].data = data.firstValue.receptionStatList.map(item => item
  1014. .fraction);
  1015. that.lineOptsect.series[0].data = data.lastValue.receptionStatList.map(item => item
  1016. .fraction)
  1017. that.guwenFlag = false
  1018. // 团队处理数据
  1019. // // 处理表格数据
  1020. let arr = [
  1021. ['时间', '时段一', '时段二', '变化']
  1022. // {
  1023. // time:'时间',
  1024. // time1:'时段一',
  1025. // time2:'时段二',
  1026. // compare:'变化'
  1027. // },
  1028. ]
  1029. that.lineOptsect.categories.map((item, index) => {
  1030. let newarr = [item, data
  1031. .lastValue.receptionStatList[index].fraction, data.firstValue.receptionStatList[index].fraction,data.contrast
  1032. .receptionStatList[index].data
  1033. ]
  1034. // obj.time=item
  1035. // obj.time1=data.firstValue[index].fraction
  1036. // obj.time2=data.lastValue[index].fraction
  1037. // obj.compare=data.contrast[index].data
  1038. // arr.push(obj)
  1039. arr.push(newarr)
  1040. })
  1041. // console.log(arr)
  1042. that.tableDate = arr
  1043. }
  1044. }
  1045. });
  1046. },
  1047. //算相隔天数
  1048. DateDiff(sDate1, sDate2) {
  1049. var aDate, oDate1, oDate2, iDays;
  1050. aDate = sDate1.split("-");
  1051. oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]); //转换为yyyy-MM-dd格式
  1052. aDate = sDate2.split("-");
  1053. oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);
  1054. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24); //把相差的毫秒数转换为天数
  1055. return iDays + 1; //返回相差天数
  1056. },
  1057. },
  1058. }
  1059. </script>
  1060. <style lang="scss" scoped>
  1061. .title2-che {
  1062. width: 178rpx;
  1063. height: 48rpx;
  1064. background: #FFFFFF;
  1065. border-radius: 6rpx;
  1066. border: 1px solid #E0E0E0;
  1067. line-height: 48rpx;
  1068. font-size: 28rpx;
  1069. font-weight: 400;
  1070. color: #666666;
  1071. text-indent: 12rpx;
  1072. margin-left: 35rpx;
  1073. position: relative;
  1074. .righttochoose {
  1075. width: 18rpx;
  1076. height: 24rpx;
  1077. position: absolute;
  1078. top: 12rpx;
  1079. right: 12rpx;
  1080. }
  1081. }
  1082. .table {
  1083. border: 0px solid darkgray;
  1084. .tr {
  1085. display: flex;
  1086. // width: 100%;
  1087. justify-content: center;
  1088. height: 64rpx;
  1089. align-items: center;
  1090. border-bottom: 1px solid #E0E0E0;
  1091. flex-wrap: nowrap;
  1092. .td {
  1093. text-align: center;
  1094. font-size: 24rpx;
  1095. font-weight: 400;
  1096. color: #333333;
  1097. height: 64rpx;
  1098. line-height: 64rpx;
  1099. // flex-shrink: 0;
  1100. }
  1101. .trd{
  1102. flex-shrink: 0;
  1103. min-width: 300rpx;
  1104. // border-bottom: 1px solid #ccc;
  1105. }
  1106. .th {
  1107. height: 64rpx;
  1108. text-align: center;
  1109. font-size: 28rpx;
  1110. font-weight: 400;
  1111. color: #666666;
  1112. line-height: 64rpx;
  1113. }
  1114. }
  1115. }
  1116. .activecllasscet2 {
  1117. color: #2671E2;
  1118. border-bottom: 2px solid #2671E2;
  1119. }
  1120. .timeduibi {
  1121. width: 100%;
  1122. background: #FFFFFF;
  1123. padding-bottom: 10rpx;
  1124. .timeshow {
  1125. color: #666666;
  1126. width: 100%;
  1127. height: 50rpx;
  1128. font-size: 28rpx;
  1129. line-height: 50rpx;
  1130. text-indent: 30rpx;
  1131. }
  1132. }
  1133. // 顶部时间切换
  1134. .timetabct {
  1135. width: 100%;
  1136. height: 98rpx;
  1137. display: flex;
  1138. align-items: center;
  1139. border-bottom: 1px solid #E0E0E0;
  1140. }
  1141. .timetabctview {
  1142. flex: 1;
  1143. height: 100%;
  1144. display: flex;
  1145. justify-content: center;
  1146. align-items: center;
  1147. }
  1148. .timetabct view {
  1149. width: 94rpx;
  1150. text-align: center;
  1151. height: 100%;
  1152. line-height: 98rpx;
  1153. font-size: 28rpx;
  1154. font-family: PingFangSC-Regular, PingFang SC;
  1155. font-weight: 400;
  1156. color: #666666;
  1157. }
  1158. .activecllasscet {
  1159. border-bottom: 2px solid #2671E2;
  1160. }
  1161. // 对比时间切换
  1162. .timepick {
  1163. width: 100%;
  1164. height: 90rpx;
  1165. display: flex;
  1166. align-items: center;
  1167. background: #FFFFFF;
  1168. }
  1169. .timepicktime {
  1170. width: 260rpx;
  1171. height: 50rpx;
  1172. border: 1rpx solid #E0E0E0;
  1173. margin-left: 30rpx;
  1174. display: flex;
  1175. background: #FFFFFF;
  1176. }
  1177. .timepicktime>view:nth-of-type(1) {
  1178. width: 210rpx;
  1179. height: 100%;
  1180. line-height: 50rpx;
  1181. font-size: 26rpx;
  1182. font-weight: 400;
  1183. text-align: center;
  1184. }
  1185. .timepicktime>view:nth-of-type(2) {
  1186. width: 49rpx;
  1187. height: 100%;
  1188. // border-left: 1px solid #E0E0E0;
  1189. }
  1190. .timepickpick {
  1191. width: 110rpx;
  1192. height: 50rpx;
  1193. margin-left: 30rpx;
  1194. display: flex;
  1195. align-items: center;
  1196. }
  1197. .Underimg {
  1198. width: 50rpx;
  1199. height: 50rpx;
  1200. margin-top: -2rpx;
  1201. }
  1202. .timeButton {
  1203. width: 100%;
  1204. height: 60rpx;
  1205. display: flex;
  1206. color: #b1b1b1;
  1207. font-size: 28rpx;
  1208. .item {
  1209. text-align: center;
  1210. line-height: 60rpx;
  1211. padding-left: 12rpx;
  1212. padding-right: 12rpx;
  1213. border-radius: 8rpx;
  1214. border: 1px solid #E0E0E0;
  1215. margin-right: 20rpx;
  1216. &.active {
  1217. color: #FFFFFF;
  1218. background-color: #2671E2;
  1219. }
  1220. }
  1221. }
  1222. .boardbox {
  1223. width: 100%;
  1224. height: 172rpx;
  1225. display: flex;
  1226. align-items: center;
  1227. background: #F4F8FD;
  1228. border-radius: 8rpx;
  1229. margin-top: 28rpx;
  1230. .boardbox-zuo {
  1231. width: 50%;
  1232. height: 120rpx;
  1233. border-right: 1px solid #E0E0E0;
  1234. }
  1235. .boardbox-you {
  1236. width: 50%;
  1237. height: 120rpx;
  1238. }
  1239. .boardbox-text1 {
  1240. width: 100%;
  1241. text-align: center;
  1242. font-size: 28rpx;
  1243. color: #333333;
  1244. }
  1245. .boardbox-text2 {
  1246. width: 100%;
  1247. text-align: center;
  1248. font-size: 26rpx;
  1249. color: #333333;
  1250. margin-top: 10rpx;
  1251. }
  1252. }
  1253. .comparesize {
  1254. flex: 1;
  1255. font-size: 24rpx;
  1256. color: #666666;
  1257. margin-top: 10rpx;
  1258. }
  1259. .grid:nth-child(1){
  1260. border-right:none ;
  1261. border-bottom:none ;
  1262. }
  1263. .grid:nth-child(3){
  1264. width: 50.5%;
  1265. }
  1266. </style>