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.
 
 
 

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