AI销管
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.
 
 
 
 

1363 regels
33 KiB

  1. <template>
  2. <view class="pages">
  3. <!-- 日报内容部分 -->
  4. <view class="container">
  5. <!-- 头部日报卡 -->
  6. <view class="c-head-card">
  7. <view class="c-title-text">
  8. {{ projectName || '' }}销讲助手周报
  9. </view>
  10. <text class="date">{{ weekObj.createTimeName }}</text>
  11. <view class="creative-time">
  12. 生成时间:{{ weekObj.createTime || '--' }}
  13. </view>
  14. </view>
  15. </view>
  16. <view class="nodata-box" v-if="nodata">
  17. <image class="img" src="/static/images/nodata.png" mode="" />
  18. <view class="text">此项目本周还没有接待量哦~</view>
  19. </view>
  20. <template v-else>
  21. <!-- 简报 -->
  22. <view class="briefing">
  23. <view class="briefing-title">
  24. 简报
  25. </view>
  26. <!-- 简报表格部分 -->
  27. <view class="briefing-box">
  28. <block v-for="(data, index) in numlist" :key="index">
  29. <view class="briefing-box-item" @click="toAuthPage(data)">
  30. <view class="tops" :class="[data.class || '']">
  31. {{ data.name }}
  32. </view>
  33. <view class="middle" :class="[data.class || '']">
  34. {{ data.num || 0 }}
  35. </view>
  36. <view class="bottom">
  37. 对比上周: {{ data.preNum || 0 }}
  38. <text class="b-text"
  39. :class="{up: data.percent > 0, down: data.percent < 0}">{{ data.percent || '0' }}</text>
  40. <template v-if="data.percent != 0">
  41. <text style="margin-left: 8rpx;font-size: 34rpx;font-weight: bold;"
  42. :class="{up: data.percent > 0, down: data.percent < 0}">{{ data.percent > 0 ? '↑' : '↓' }}</text>
  43. </template>
  44. </view>
  45. </view>
  46. </block>
  47. </view>
  48. </view>
  49. <!-- 销讲场景执行排名 -->
  50. <view class="execution-ranking" v-if="!weekObj.orgCode">
  51. <view class="execution-ranking-title">
  52. 销讲场景执行排名
  53. </view>
  54. <template v-if="isShowXJTop1List">
  55. <view class="execution-ranking-desc" v-if="false">
  56. <text>销讲场景平均执行对比上周</text>
  57. <text>{{ rankTop('fractionPKName') }}</text>
  58. <text>{{ rankTop('fractionPK') }}</text>
  59. <text>%</text>
  60. <template v-if="rankTop('fractionBastValue') > 0">
  61. <text>,其中【{{ rankTop('fractionBastName') }}】最强为</text>
  62. <text class="up">{{ rankTop('fractionBastValue') }}</text>
  63. <text>%</text>
  64. </template>
  65. <template v-if="rankTop('fractionLastValue') < 0">
  66. <text>,【{{ rankTop('fractionLastName') }}】执行最弱为</text>
  67. <text class="down">{{ rankTop('fractionLastValue') }}</text>
  68. <text>%;</text>
  69. </template>
  70. </view>
  71. <!-- 排名百分比列表 -->
  72. <view class="ranking-box" @click="toTrendAnalysis('销讲数据')">
  73. <block v-for="(percent, index) in weekObj.XJTop1List" :key="index">
  74. <view class="ranking-item">
  75. <view class="left">{{ percent.title }}</view>
  76. <view class="middle">
  77. <u-line-progress :active-color="$options.filters.setColor(index)"
  78. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.value">
  79. </u-line-progress>
  80. </view>
  81. <view class="right"> {{ percent.value || '0' }} %</view>
  82. </view>
  83. </block>
  84. </view>
  85. </template>
  86. <template v-else>
  87. <view class="empity">
  88. 暂无数据
  89. </view>
  90. </template>
  91. </view>
  92. <!-- 接待统计 -->
  93. <view class="statistics">
  94. <view class="statistics-title">
  95. 接待统计
  96. </view>
  97. <template v-if="isShowStatistics">
  98. <view class="statistics-desc" v-if="false">
  99. <text>
  100. 顾问平均执行率对比上周
  101. </text>
  102. <text>
  103. {{ rankTop('ranktype') || '' }}
  104. </text>
  105. <text :class="[rankTop('class')]">{{ rankTop('people') || '' }}</text>
  106. <text class="">
  107. 人,其中{{ rankTop('topName') || '' }}上升
  108. </text>
  109. <text class="up">{{ rankTop('topPk') || '0' }}</text>
  110. <text class="">
  111. %为最高,{{ rankTop('lastName') || '' }}下降
  112. </text>
  113. <text class="down">{{ rankTop('lastPk') || '0' }}</text>
  114. <text class="">
  115. %降幅最大。
  116. </text>
  117. </view>
  118. <view class="table">
  119. <view class="thead">
  120. <block v-for="(head, headIndex) in tableHead" :key="headIndex">
  121. <view class="thead-item"
  122. :style="[(weekObj.orgCode && head.title2) ? head.style1 : head.style]">
  123. <template v-if="weekObj.orgCode && head.title2">
  124. {{ head.title2 }}
  125. </template>
  126. <template v-else>
  127. {{ head.title }}
  128. </template>
  129. </view>
  130. </block>
  131. </view>
  132. <view class="tbody" @click="toEmployeesstatistics('顾问排名')">
  133. <block v-for="(data, index) in weekObj.customerInfo1" :key="index">
  134. <view class="tbody-item">
  135. <template v-if="!weekObj.orgCode">
  136. <view class="tbody-items name">{{ data.name }}</view>
  137. </template>
  138. <template v-else>
  139. <view class="tbody-items time">{{ data.houseName }}</view>
  140. </template>
  141. <view class="tbody-items nums">{{ data.activeCustomer }}</view>
  142. <template v-if="!weekObj.orgCode">
  143. <view class="tbody-items time">{{ tofixed2(data.avgDuration)}}m</view>
  144. </template>
  145. <template v-else>
  146. <view class="tbody-items time">{{ tofixed2(data.avgDuration/60) }}m</view>
  147. </template>
  148. <view class="tbody-items percent">{{ data.fraction }}%</view>
  149. <template v-if="!weekObj.orgCode">
  150. <view class="tbody-items week" :class="{up: data.pk > 0, down: data.pk < 0}">
  151. <template v-if="data.pk">
  152. {{ data.pk > 0 ? `+${data.pk}` : data.pk }}%
  153. </template>
  154. </view>
  155. </template>
  156. <template v-else>
  157. <view class="tbody-items week"
  158. :class="{up: data.fractionContrast > 0, down: data.fractionContrast < 0}">
  159. <template v-if="data.fractionContrast">
  160. {{ data.fractionContrast > 0 ? `+${data.fractionContrast}` : data.fractionContrast }}%
  161. </template>
  162. <template v-else>--</template>
  163. </view>
  164. </template>
  165. </view>
  166. </block>
  167. </view>
  168. </view>
  169. </template>
  170. <template v-else>
  171. <view class="empity">
  172. 暂无数据
  173. </view>
  174. </template>
  175. </view>
  176. <!-- 顾问销讲执行率排名 -->
  177. <view class="guwen-ranking">
  178. <view class="guwen-ranking-title">
  179. <template v-if="!weekObj.orgCode">
  180. 顾问销讲执行率排名(TOP10)
  181. </template>
  182. <template v-else>
  183. 项目销讲执行排名(TOP10)
  184. </template>
  185. </view>
  186. <template v-if="isShowZXLTopList">
  187. <!-- 排名百分比列表 -->
  188. <view class="ranking-box">
  189. <block v-for="(percent, index) in weekObj.ZXLTopList" :key="index">
  190. <view class="ranking-item" @click="toStaffAnalysis('销讲数据', percent)">
  191. <view class="left">{{ percent.title }}</view>
  192. <view class="middle">
  193. <u-line-progress :active-color="$options.filters.setColor(index)"
  194. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.value">
  195. </u-line-progress>
  196. </view>
  197. <view class="right"> {{ percent.value || '0' }} %</view>
  198. </view>
  199. </block>
  200. </view>
  201. </template>
  202. <template v-else>
  203. <view class="empity">
  204. 暂无数据
  205. </view>
  206. </template>
  207. </view>
  208. <!-- 顾问接待量排名 -->
  209. <view class="guwen-ranking">
  210. <view class="guwen-ranking-title">
  211. <template v-if="!weekObj.orgCode">
  212. 顾问接待量排名(TOP10)
  213. </template>
  214. <template v-else>
  215. 项目有效接待排名(TOP10)
  216. </template>
  217. </view>
  218. <template v-if="isShowJDLTopList">
  219. <!-- 排名百分比列表 -->
  220. <view class="ranking-box">
  221. <block v-for="(percent, index) in weekObj.JDLTopList" :key="index">
  222. <view class="ranking-item" @click="toStaffAnalysis('销讲数据', percent)">
  223. <view class="left">{{ percent.title }}</view>
  224. <view class="middle">
  225. <u-line-progress :active-color="$options.filters.setColor(index)"
  226. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.value">
  227. </u-line-progress>
  228. </view>
  229. <view class="right"> {{ percent.value || '0' }} </view>
  230. </view>
  231. </block>
  232. </view>
  233. </template>
  234. <template v-else>
  235. <view class="empity">
  236. 暂无数据
  237. </view>
  238. </template>
  239. </view>
  240. <!-- 顾问接待量排名 -->
  241. <view class="guwen-ranking" v-if="weekObj.level1List">
  242. <view class="guwen-ranking-title">
  243. 画像一级触达排名(TOP10)
  244. </view>
  245. <template v-if="weekObj.level1List">
  246. <!-- 排名百分比列表 -->
  247. <view class="ranking-box">
  248. <block v-for="(percent, index) in weekObj.level1List" :key="index">
  249. <view class="ranking-item">
  250. <view class="left">{{ percent.name }}</view>
  251. <view class="middle">
  252. <u-line-progress :active-color="$options.filters.setColor(index)"
  253. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.percent">
  254. </u-line-progress>
  255. </view>
  256. <view class="right"> {{ percent.total || '0' }} </view>
  257. </view>
  258. </block>
  259. </view>
  260. </template>
  261. <template v-else>
  262. <view class="empity">
  263. 暂无数据
  264. </view>
  265. </template>
  266. </view>
  267. <view class="guwen-ranking" v-if="weekObj.level2List">
  268. <view class="guwen-ranking-title">
  269. 画像关键词触达排名(TOP10)
  270. </view>
  271. <template v-if="weekObj.level2List">
  272. <!-- 排名百分比列表 -->
  273. <view class="ranking-box">
  274. <block v-for="(percent, index) in weekObj.level2List" :key="index">
  275. <view class="ranking-item">
  276. <view class="left">{{ percent.name }}</view>
  277. <view class="middle">
  278. <u-line-progress :active-color="$options.filters.setColor(index)"
  279. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.percent">
  280. </u-line-progress>
  281. </view>
  282. <view class="right"> {{ percent.total || '0' }} </view>
  283. </view>
  284. </block>
  285. </view>
  286. </template>
  287. <template v-else>
  288. <view class="empity">
  289. 暂无数据
  290. </view>
  291. </template>
  292. </view>
  293. <!-- 使用建议 -->
  294. <view class="proposal" v-if="weekObj.suggest">
  295. <view class="proposal-title">
  296. 使用建议
  297. </view>
  298. <!-- 建议的文字 -->
  299. <view class="proposal-box">
  300. <u-parse class="ql-editor" :content="weekObj.suggest" />
  301. </view>
  302. </view>
  303. <!-- 底部按钮 -->
  304. <view class="nav-footer">
  305. <view class="footer-item" @click="toHome">
  306. 回到管理端
  307. </view>
  308. <view class="footer-item full" style="margin-left: 24rpx;" @tap="forShare">
  309. <button open-type="share" class="fulls">
  310. 一键转发
  311. </button>
  312. </view>
  313. </view>
  314. </template>
  315. </view>
  316. </template>
  317. <script>
  318. import uParse from '@/components/gaoyia-parse/parse.vue'
  319. export default {
  320. components: {
  321. uParse
  322. },
  323. data() {
  324. return {
  325. nodata: false,
  326. tableHead: [{
  327. title: '顾问',
  328. title2: '项目名称',
  329. style: {
  330. flex: 1
  331. },
  332. style1: {
  333. flex: 2
  334. },
  335. },
  336. {
  337. title: '接待量',
  338. style: {
  339. flex: 1
  340. }
  341. },
  342. {
  343. title: '平均接待时长',
  344. style: {
  345. flex: 2
  346. }
  347. },
  348. {
  349. title: '平均执行率',
  350. style: {
  351. flex: 2
  352. }
  353. },
  354. {
  355. title: '对比上周',
  356. style: {
  357. flex: 1.5
  358. }
  359. },
  360. ],
  361. id: '', // id
  362. needList: ['JDLTop', 'ZXLTop', 'XJTop1'], // 需要转换数组的内容
  363. // 简报
  364. numlist: [{
  365. name: '接待量 (次)',
  366. num: '',
  367. setName: 'receptionCount1',
  368. percent: '',
  369. percentName: 'receptionCountPK',
  370. preNum: '', // 上周数量
  371. preNumName: 'receptionCount2', //
  372. path: '/pages/center/records/index',
  373. pathParms: '?activeTotal=4&refresh=refresh', // 参数
  374. auth: 'jdjl', //
  375. }, {
  376. name: '有效接待 (次)',
  377. num: '',
  378. setName: 'activeCustomer1',
  379. percent: '',
  380. percentName: 'activeCustomerPK',
  381. preNum: '', // 上周数量
  382. preNumName: 'activeCustomer2', //
  383. path: '/pages/center/records/index',
  384. pathParms: '?activeTotal=4&refresh=refresh&validInvalid=0', // 参数
  385. auth: 'jdjl', //
  386. },
  387. {
  388. name: '平均执行率(%)',
  389. num: '',
  390. setName: 'fraction1',
  391. percent: '',
  392. percentName: 'fractionPK',
  393. preNum: '', // 上周数量
  394. preNumName: 'fraction2', //
  395. path: '/pages/center/records/index',
  396. pathParms: '?activeTotal=4&refresh=refresh&validInvalid=0', // 参数
  397. auth: 'jdjl', //
  398. },
  399. {
  400. name: '平均接待时长(分)',
  401. num: '',
  402. setName: 'avgDuration1',
  403. percent: '',
  404. percentName: 'avgDurationPK',
  405. preNum: '', // 上周数量
  406. preNumName: 'avgDuration2', //
  407. path: '/pages/center/records/index',
  408. pathParms: '?activeTotal=4&refresh=refresh&validInvalid=0', // 参数
  409. auth: 'jdjl', //
  410. },
  411. {
  412. name: '违禁接待 (次)',
  413. num: '',
  414. setName: 'prohibitedNum1',
  415. percent: '',
  416. percentName: 'prohibitedNumPK',
  417. preNum: '', // 上周数量
  418. preNumName: 'prohibitedNum2', //
  419. class: 'down',
  420. path: '/pages/center/prohibited/index',
  421. pathParms: '?activeTotal=4&violatedStatus=1&refresh=refresh', // 参数
  422. auth: 'wjjl',
  423. },
  424. {
  425. name: '客户画像触达 (次)',
  426. num: '',
  427. setName: 'reachSum1',
  428. percent: '',
  429. percentName: 'reachSumPK',
  430. preNum: '', // 上周数量
  431. preNumName: 'reachSum2', //
  432. path: '/pages/center/Piabodata/Userinsightinto',
  433. pathParms: '?activeTotal=3', // 参数
  434. auth: 'xjfx',
  435. },
  436. {
  437. name: '已标记',
  438. num: '',
  439. setName: 'labelledReceptionNum1',
  440. percent: '',
  441. percentName: 'labelledReceptionNumPK',
  442. preNum: '', // 上周数量
  443. preNumName: 'labelledReceptionNum2', //
  444. path: '/pages/center/records/index',
  445. pathParms: '?activeTotal=4&refresh=refresh&markAdvisor=1', // 参数
  446. auth: 'jdjl', //
  447. },
  448. {
  449. name: '未标记',
  450. num: '',
  451. setName: 'unlabelledReceptionNum1',
  452. percent: '',
  453. percentName: 'unlabelledReceptionNumPK',
  454. preNum: '', // 上周数量
  455. preNumName: 'unlabelledReceptionNum2', //
  456. class: 'down',
  457. path: '/pages/center/records/index',
  458. pathParms: '?activeTotal=4&refresh=refresh&markAdvisor=0&validInvalid=0', // 参数
  459. auth: 'jdjl', //
  460. },
  461. ],
  462. // 周报详情
  463. weekObj: {},
  464. projectName: '', // 项目名称
  465. }
  466. },
  467. computed: {
  468. // 获取本地存储的权限列表
  469. menuList() {
  470. return uni.getStorageSync('weapp_session_Menu_data')
  471. },
  472. // 排名最高与最低
  473. rankTop() {
  474. return name => {
  475. let obj = {}
  476. try {
  477. if (this.weekObj.customerInfo1.length && this.weekObj.customerInfo2.length) {
  478. obj.ranktype = (this.weekObj.customerInfo1.length - this.weekObj.customerInfo2.length) >
  479. 0 ? '上升' : '下降'
  480. obj.people = Math.abs(this.weekObj.customerInfo1.length - this.weekObj.customerInfo2
  481. .length)
  482. }
  483. if (this.weekObj.customerInfo1 && this.weekObj.customerInfo1.length > 0) {
  484. obj.topName = this.weekObj.customerInfo1[0].name
  485. obj.topPk = Math.abs(this.weekObj.customerInfo1[0].pk)
  486. obj.lastName = this.weekObj.customerInfo1[this.weekObj.customerInfo1.length - 1].name,
  487. obj.lastPk = Math.abs(this.weekObj.customerInfo1[this.weekObj.customerInfo1.length - 1]
  488. .pk)
  489. }
  490. if (this.weekObj.customerInfo1.length && this.weekObj.customerInfo2.length) {
  491. obj.class = (this.weekObj.customerInfo1.length - this.weekObj.customerInfo2.length) > 0 ?
  492. 'up' : 'down'
  493. }
  494. if (this.weekObj.fractionPK) {
  495. obj.fractionPKName = this.weekObj.fractionPK > 0 ? '上涨' : '下跌'
  496. obj.fractionPK = Math.abs(this.weekObj.fractionPK)
  497. }
  498. if (this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0) {
  499. obj.fractionBastName = this.weekObj.XJTop1List[0].title
  500. obj.fractionBastValue = this.weekObj.XJTop1List[0].value
  501. }
  502. if (this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0) {
  503. obj.fractionLastName = this.weekObj.XJTop1List[this.weekObj.XJTop1List.length - 1].title
  504. obj.fractionLastValue = this.weekObj.XJTop1List[this.weekObj.XJTop1List.length - 1].value
  505. }
  506. return obj[name] || ''
  507. } catch (e) {
  508. console.log(e)
  509. return ''
  510. }
  511. }
  512. },
  513. // 接待统计
  514. isShowStatistics() {
  515. // return this.rankTop('ranktype') && this.rankTop('class') && this.rankTop('people') && this.rankTop('topName') && this.rankTop('topPk') && this.rankTop('lastName') && this.rankTop('lastPk') && this.weekObj.customerInfo1 && this.weekObj.customerInfo1.length > 0
  516. return this.weekObj.customerInfo1 && this.weekObj.customerInfo1.length > 0
  517. },
  518. isShowXJTop1List() {
  519. // return this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0 && this.rankTop('fractionPKName') && this.rankTop('fractionPK') && this.rankTop('fractionBastName') && this.rankTop('fractionBastValue') && this.rankTop('fractionLastName') && this.rankTop('fractionLastName') && this.rankTop('fractionLastValue')
  520. return this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0
  521. },
  522. isShowZXLTopList() {
  523. return this.weekObj.ZXLTopList && this.weekObj.ZXLTopList.length > 0
  524. },
  525. isShowJDLTopList() {
  526. return this.weekObj.JDLTopList && this.weekObj.JDLTopList.length > 0
  527. },
  528. },
  529. onLoad(option) {
  530. if (option.id) this.id = option.id
  531. this.getMessage()
  532. },
  533. onShareAppMessage() {
  534. return {
  535. title: `${this.projectName}销讲助手周报`,
  536. path: `/pages/reportExcel/weekReport?id=${this.id}`
  537. }
  538. },
  539. methods: {
  540. tofixed2(time) {
  541. if (time) {
  542. return time.toFixed(2)
  543. } else {
  544. return 0
  545. }
  546. },
  547. forShare() {
  548. this.$u.get("/zkMessage/shareMessage", {
  549. id: this.id,
  550. houseId: uni.getStorageSync('buildingID').id
  551. })
  552. },
  553. // 趋势分析
  554. toTrendAnalysis(name) {
  555. return
  556. let date = this.weekObj.weekDate.split('~')
  557. let [t1, t2] = [date[0], date[1]]
  558. let time1 = new Date(t1.replace(/-/g, '/'))
  559. let time2 = new Date(t2.replace(/-/g, '/'))
  560. time1.setDate(time1.getDate() - 7)
  561. time2.setDate(time2.getDate() - 7)
  562. let res1 = `${time1.getFullYear()}-${time1.getMonth() + 1}-${time1.getDate()}`
  563. let res2 = `${time2.getFullYear()}-${time2.getMonth() + 1}-${time2.getDate()}`
  564. if (this.isPassWatch(name)) {
  565. uni.navigateTo({
  566. url: `/pages/center/Piabodata/TrendAnalysis?type=1&staTime=${date[0]}&endtime=${date[1]}&staTime1=${res1}&endtime1=${res2}`
  567. })
  568. } else {
  569. uni.showToast({
  570. title: '暂无权限',
  571. icon: "none"
  572. })
  573. }
  574. },
  575. // 顾问排名
  576. toEmployeesstatistics(name) {
  577. let date = this.weekObj.weekDate.split('~')
  578. let [t1, t2] = [date[0], date[1]]
  579. if (this.isPassWatch(name)) {
  580. uni.navigateTo({
  581. url: `/pages/center/Piabodata/Employeesstatistics?type=1&staTime=${date[0]}&endtime=${date[1]}`
  582. })
  583. } else {
  584. uni.showToast({
  585. title: '暂无权限',
  586. icon: "none"
  587. })
  588. }
  589. },
  590. // 员工分析
  591. toStaffAnalysis(name, data) {
  592. let obj = this.weekObj.customerInfo1.find(item => {
  593. return item.name == data.title
  594. })
  595. console.log(obj)
  596. let time = this.weekObj.weekDate.split('~')
  597. if (this.isPassWatch(name)) {
  598. uni.navigateTo({
  599. url: `/pages/center/Piabodata/StaffAnalysis?type=1&id=${obj.id}&startDate=${time[0]}&endDate=${time[1]}`
  600. });
  601. } else {
  602. uni.showToast({
  603. title: '暂无权限',
  604. icon: "none"
  605. })
  606. }
  607. },
  608. // 跳转对应页面
  609. toAuthPage(data) {
  610. if (!uni.getStorageSync('weapp_session_login_data').token) {
  611. this.toHome()
  612. return
  613. }
  614. if (this.isPassWatch(data.auth)) {
  615. let time = this.weekObj.weekDate.split('~')
  616. data.pathParms = `${data.pathParms}&staTime=${time[0]}&endtime=${time[1]}`
  617. uni.navigateTo({
  618. url: `${data.path}${data.pathParms}`
  619. })
  620. } else {
  621. uni.showToast({
  622. title: '暂无权限',
  623. icon: "none"
  624. })
  625. }
  626. },
  627. // 是否有权限观看
  628. isPassWatch(name) {
  629. return this.menuList[name]
  630. },
  631. // 跳转首页
  632. toHome() {
  633. uni.navigateTo({
  634. url: '/pages/index/guide'
  635. })
  636. },
  637. // 获取周报详情
  638. getMessage() {
  639. this.$u.get('/zkMessage/findByProjectId', {
  640. id: this.id,
  641. houseId: uni.getStorageSync('buildingID').id
  642. }).then(res => {
  643. let data = {}
  644. if (res.zkMessage.content) {
  645. data = JSON.parse(res.zkMessage.content)
  646. this.bubbleSort(data.customerInfo1 || [], 'pk')
  647. this.bubbleSort(data.customerInfo2 || [], 'pk')
  648. data.customerInfo1 && data.customerInfo1.reverse()
  649. data.customerInfo2 && data.customerInfo2.reverse()
  650. this.weekObj = {
  651. ...res.zkMessage,
  652. ...data
  653. }
  654. } else {
  655. this.nodata = true
  656. this.weekObj = {
  657. ...res.zkMessage,
  658. }
  659. }
  660. if (this.weekObj.level1List && this.weekObj.level2List) {
  661. if (this.weekObj.level1List[0] && this.weekObj.level1List[0].total) {
  662. let max1 = this.weekObj.level1List[0].total || 1
  663. this.weekObj.level1List.forEach(item => {
  664. item.percent = Math.floor((item.total / max1) * 100)
  665. })
  666. } else {
  667. this.weekObj.level1List.forEach(item => {
  668. item.percent = 0
  669. })
  670. }
  671. if (this.weekObj.level2List[0] && this.weekObj.level2List[0].total) {
  672. let max2 = this.weekObj.level2List[0].total || 1
  673. this.weekObj.level2List.forEach(item => {
  674. item.percent = Math.floor((item.total / max2) * 100)
  675. })
  676. } else {
  677. this.weekObj.level2List.forEach(item => {
  678. item.percent = 0
  679. })
  680. }
  681. }
  682. this.weekObj.createTimeName = this.getTimeLines(this.weekObj.weekDate, 1)
  683. console.log(this.weekObj, 'this.weekObj')
  684. this.projectName = res.projectName
  685. this.numlist.forEach(item => {
  686. if (data[item.setName]) {
  687. item.num = data[item.setName]
  688. }
  689. if (data[item.percentName]) {
  690. item.percent = data[item.percentName]
  691. }
  692. if (data[item.preNumName]) {
  693. item.preNum = data[item.preNumName]
  694. }
  695. })
  696. this.init()
  697. }).catch(e => {
  698. console.log(e)
  699. })
  700. },
  701. // 把对象转成数组并在后续的步骤方便处理
  702. init() {
  703. console.log(this.weekObj, 'this.weekObj')
  704. this.needList.forEach(item => {
  705. console.log(item)
  706. if (this.weekObj[item] && Object.keys(this.weekObj[item]).length > 0) {
  707. this.weekObj[item + 'List'] = [] // 销讲执行
  708. for (let i in this.weekObj[item]) {
  709. this.weekObj[item + 'List'].push({
  710. title: i,
  711. value: this.weekObj[item][i]
  712. })
  713. }
  714. } else {
  715. this.weekObj[item + 'List'] = []
  716. }
  717. })
  718. this.sortInitArr()
  719. },
  720. // 排序对象转换后的数组
  721. sortInitArr() {
  722. this.needList.forEach(item => {
  723. if (this.weekObj[item + 'List']) {
  724. this.bubbleSort(this.weekObj[item + 'List'])
  725. this.weekObj[item + 'List'] = this.dealData(this.weekObj[item + 'List'])
  726. }
  727. })
  728. this.reverseList()
  729. },
  730. // 反转数组
  731. reverseList() {
  732. this.needList.forEach(item => {
  733. if (this.weekObj[item + 'List']) {
  734. this.weekObj[item + 'List'].reverse()
  735. }
  736. })
  737. console.log(this.weekObj, '12312312312')
  738. },
  739. // 冒泡排序
  740. bubbleSort(arr, keys = 'value') {
  741. for (let i = 0; i < arr.length - 1; i += 1) {
  742. //通过 arr.length 次把第一位放到最后,完成排序
  743. //-i是因为最后的位置是会动态改变的,当完成一次后,最后一位会变成倒数第二位
  744. for (let j = 0; j < arr.length - 1 - i; j += 1) {
  745. if (arr[j][keys] > arr[j + 1][keys]) {
  746. const temp = arr[j];
  747. arr[j] = arr[j + 1];
  748. arr[j + 1] = temp;
  749. }
  750. }
  751. }
  752. },
  753. // 定义一个公共方法对数据进行处理
  754. dealData(arr) {
  755. // 获取最大值
  756. let num = Math.max.apply(Math, arr.map((o) => {
  757. return o.value
  758. }))
  759. arr.map(item => {
  760. item.values = Math.floor(item.value / num * 100)
  761. })
  762. return arr
  763. },
  764. // 转换时间
  765. getTimeLine(date, type = 1) {
  766. let resu = '--'
  767. if (!date) return resu
  768. let time = new Date(date.replace(/-/g, '/'))
  769. time.setDate(time.getDate() - 7)
  770. let arr = date.split(' ')
  771. let str = arr[0]
  772. let result = str.split('-')
  773. let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
  774. let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
  775. if (type == 1) {
  776. resu = `${m}.${d}-${result[1]}.${result[2]}`
  777. } else {
  778. resu = `${m}月${d}日~${result[1]}月${result[2]}日`
  779. }
  780. return resu
  781. },
  782. // 转换时间
  783. getTimeLines(date) {
  784. if (!date) return ''
  785. let arr = date.split('~')
  786. let str0 = arr[0].split('-')
  787. let str1 = arr[1].split('-')
  788. return `${str0[1]}月${str0[2]}日~${str1[1]}月${str1[2]}日`
  789. },
  790. },
  791. filters: {
  792. // 时间格式转换
  793. fomatDate(date) {
  794. if (!date) return '--'
  795. let arr = date.split(' ')
  796. let str = arr[0]
  797. let result = str.split('-')
  798. return `${result[1]}-${result[2]}`
  799. },
  800. // 转换时间
  801. getTimeLine(date, type = 1) {
  802. if (!date) return '--'
  803. console.log(date.replace(/-/g, '/'))
  804. let time = new Date(date.replace(/-/g, '/'))
  805. time.setDate(time.getDate() - 7)
  806. let arr = date.split(' ')
  807. let str = arr[0]
  808. let result = str.split('-')
  809. let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
  810. let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
  811. if (type == 1) {
  812. return `${m}.${d}-${result[1]}.${result[2]}`
  813. } else {
  814. return `${m}月${d}日~${result[1]}月${result[2]}日`
  815. }
  816. },
  817. // 设置颜色
  818. setColor(index) {
  819. let color = ''
  820. switch (index) {
  821. case 0:
  822. color = '#E7483C';
  823. break;
  824. case 1:
  825. color = '#FF8C13';
  826. break;
  827. case 2:
  828. color = '#FFCC00';
  829. break;
  830. default:
  831. color = '#4FC78F';
  832. break;
  833. }
  834. return color
  835. },
  836. }
  837. }
  838. </script>
  839. <style lang="scss" scoped>
  840. @import '@/static/css/quill/quill.core.css';
  841. @import '@/static/css/quill/quill.snow.css';
  842. @import '@/static/css/quill/quill.bubble.css';
  843. .pages {
  844. width: 100vw;
  845. min-height: 100vh;
  846. display: flex;
  847. flex-direction: column;
  848. background: #F8F8F8;
  849. .nav-header {
  850. flex-shrink: 0;
  851. }
  852. .container {
  853. padding: 30rpx 30rpx 40rpx;
  854. display: flex;
  855. flex-direction: column;
  856. background: #fff;
  857. .c-head-card {
  858. padding: 30rpx;
  859. width: 100%;
  860. min-height: 252rpx;
  861. border: 2rpx solid #000000;
  862. border-radius: 12rpx;
  863. box-shadow: 10rpx 10rpx #2671E2;
  864. display: flex;
  865. flex-direction: column;
  866. .c-title-text {
  867. // position: relative;
  868. flex-grow: 1;
  869. font-size: 48rpx;
  870. font-weight: bold;
  871. color: #303030;
  872. }
  873. .date {
  874. // position: absolute;
  875. // right: 0;
  876. // bottom: 6rpx;
  877. font-size: 30rpx;
  878. color: #303030;
  879. }
  880. .creative-time {
  881. margin: 20rpx 0 0 0;
  882. flex-shrink: 0;
  883. }
  884. }
  885. }
  886. .nodata-box {
  887. width: 750rpx;
  888. flex: 1;
  889. margin: 0 auto;
  890. display: flex;
  891. justify-content: center;
  892. align-items: center;
  893. flex-direction: column;
  894. background-color: #fff;
  895. .img {
  896. width: 400rpx;
  897. height: 400rpx;
  898. }
  899. .text {
  900. text-align: center;
  901. font-size: 28rpx;
  902. font-family: PingFangSC-Regular, PingFang SC;
  903. font-weight: 400;
  904. color: #666666;
  905. line-height: 40rpx;
  906. }
  907. }
  908. .briefing {
  909. background: #fff;
  910. .briefing-title {
  911. padding: 0 30rpx;
  912. height: 90rpx;
  913. display: flex;
  914. align-items: center;
  915. border: 1rpx solid #E0E0E0;
  916. font-size: 32rpx;
  917. font-weight: bold;
  918. }
  919. .briefing-box {
  920. width: 100%;
  921. display: flex;
  922. flex-wrap: wrap;
  923. .briefing-box-item {
  924. padding: 20rpx 30rpx;
  925. width: 50%;
  926. height: 186rpx;
  927. border: 1px solid #E0E0E0;
  928. border-left: none;
  929. border-top: none;
  930. &:nth-of-type(2n) {
  931. border-right: none;
  932. }
  933. .top {
  934. font-size: 28rpx;
  935. }
  936. .middle {
  937. margin: 14rpx 0 12rpx;
  938. font-size: 32rpx;
  939. font-weight: 600;
  940. color: #333333;
  941. }
  942. .bottom {
  943. font-size: 26rpx;
  944. color: #666666;
  945. .b-text {
  946. margin-left: 20rpx;
  947. &.down {
  948. color: #E7483C;
  949. font-size: 34rpx;
  950. }
  951. &.up {
  952. font-size: 34rpx;
  953. color: #43CD80;
  954. }
  955. }
  956. }
  957. }
  958. }
  959. }
  960. .execution-ranking {
  961. margin: 20rpx 0 0 0;
  962. padding: 30rpx;
  963. background: #fff;
  964. .execution-ranking-title {
  965. font-size: 32rpx;
  966. font-weight: bold;
  967. }
  968. .execution-ranking-desc {
  969. margin-top: 20rpx;
  970. font-size: 30rpx;
  971. }
  972. .ranking-box {
  973. margin: 30rpx 0 0 0;
  974. .ranking-item {
  975. margin-bottom: 18rpx;
  976. display: flex;
  977. &:nth-last-of-type(1) {
  978. margin-bottom: 0;
  979. }
  980. .left {
  981. flex-shrink: 0;
  982. width: 270rpx;
  983. font-size: 30rpx;
  984. overflow: hidden;
  985. text-overflow: ellipsis;
  986. white-space: nowrap;
  987. }
  988. .middle {
  989. flex-grow: 1;
  990. }
  991. .right {
  992. flex-shrink: 0;
  993. width: 118rpx;
  994. font-size: 30rpx;
  995. text-align: center;
  996. }
  997. }
  998. }
  999. }
  1000. .statistics {
  1001. margin: 20rpx 0 0 0;
  1002. background: #fff;
  1003. .statistics-title {
  1004. padding: 30rpx 30rpx 0;
  1005. width: 100%;
  1006. font-size: 32rpx;
  1007. font-weight: bold;
  1008. }
  1009. .statistics-desc {
  1010. padding: 0 30rpx;
  1011. margin-top: 20rpx;
  1012. }
  1013. .table {
  1014. margin: 30rpx 0 0 0;
  1015. .thead {
  1016. padding: 0 30rpx;
  1017. width: 100%;
  1018. height: 72rpx;
  1019. display: flex;
  1020. align-items: center;
  1021. border: 1rpx solid #E0E0E0;
  1022. border-left: none;
  1023. border-right: none;
  1024. font-size: 26rpx;
  1025. .thead-item {
  1026. text-align: center;
  1027. }
  1028. }
  1029. .tbody {
  1030. .tbody-item {
  1031. padding: 0 30rpx;
  1032. display: flex;
  1033. align-items: center;
  1034. height: 72rpx;
  1035. background: #FAFCFF;
  1036. &:nth-of-type(2n) {
  1037. background: #FFFFFF;
  1038. }
  1039. .tbody-items {
  1040. flex: 1;
  1041. display: flex;
  1042. justify-content: center;
  1043. }
  1044. .name {
  1045. justify-content: flex-start;
  1046. overflow: hidden;
  1047. text-overflow: ellipsis;
  1048. white-space: nowrap;
  1049. }
  1050. .time {
  1051. flex: 2;
  1052. }
  1053. .percent {
  1054. flex: 2;
  1055. }
  1056. .week {
  1057. flex: 1.5;
  1058. }
  1059. }
  1060. }
  1061. .tbottom {
  1062. width: 100%;
  1063. height: 72rpx;
  1064. display: flex;
  1065. justify-content: center;
  1066. align-items: center;
  1067. font-size: 30rpx;
  1068. color: #2671E2;
  1069. background: #FAFCFF;
  1070. }
  1071. }
  1072. }
  1073. .guwen-ranking {
  1074. margin: 20rpx 0 0 0;
  1075. width: 100%;
  1076. padding: 30rpx;
  1077. background: #fff;
  1078. .guwen-ranking-title {
  1079. font-size: 32rpx;
  1080. font-weight: 500;
  1081. }
  1082. .guwen-ranking-desc {
  1083. margin-top: 20rpx;
  1084. font-size: 30rpx;
  1085. }
  1086. .ranking-box {
  1087. margin: 30rpx 0 0 0;
  1088. .ranking-item {
  1089. margin-bottom: 18rpx;
  1090. display: flex;
  1091. &:nth-last-of-type(1) {
  1092. margin-bottom: 0;
  1093. }
  1094. .left {
  1095. flex-shrink: 0;
  1096. width: 270rpx;
  1097. font-size: 30rpx;
  1098. overflow: hidden;
  1099. text-overflow: ellipsis;
  1100. white-space: nowrap;
  1101. }
  1102. .middle {
  1103. flex-grow: 1;
  1104. }
  1105. .right {
  1106. flex-shrink: 0;
  1107. width: 118rpx;
  1108. font-size: 30rpx;
  1109. text-align: center;
  1110. }
  1111. }
  1112. }
  1113. }
  1114. .proposal {
  1115. margin: 20rpx 0 0 0;
  1116. padding: 30rpx;
  1117. background: #fff;
  1118. .proposal-title {
  1119. font-size: 32rpx;
  1120. font-weight: 500;
  1121. }
  1122. .proposal-box {
  1123. margin: 30rpx 0 0 0;
  1124. .proposal-item {
  1125. margin: 20rpx 0 0 0;
  1126. display: flex;
  1127. .lside {
  1128. flex-shrink: 0;
  1129. margin: 0 12rpx 0 0;
  1130. width: 44rpx;
  1131. height: 44rpx;
  1132. border-radius: 50%;
  1133. background: #2671E2;
  1134. text-align: center;
  1135. line-height: 44rpx;
  1136. color: #fff;
  1137. }
  1138. .rside {
  1139. .rside-title {
  1140. font-size: 32rpx;
  1141. }
  1142. .rside-box {
  1143. margin: 16rpx 0 0 0;
  1144. }
  1145. }
  1146. }
  1147. }
  1148. }
  1149. .nav-footer {
  1150. position: sticky;
  1151. bottom: 0;
  1152. padding: 32rpx;
  1153. width: 100%;
  1154. display: flex;
  1155. justify-content: center;
  1156. background: #fff;
  1157. .footer-item {
  1158. flex: 1;
  1159. height: 88rpx;
  1160. display: flex;
  1161. justify-content: center;
  1162. align-items: center;
  1163. color: #2671E2;
  1164. border: 2rpx solid #2671E2;
  1165. border-radius: 8rpx;
  1166. overflow: hidden;
  1167. font-size: 32rpx;
  1168. &.full {
  1169. background: #2671E2;
  1170. color: #fff;
  1171. .fulls {
  1172. box-sizing: border-box;
  1173. width: 100%;
  1174. height: 100%;
  1175. background: transparent;
  1176. color: #fff;
  1177. font-size: 32rpx;
  1178. font-weight: normal;
  1179. line-height: 88rpx;
  1180. }
  1181. }
  1182. }
  1183. }
  1184. .up {
  1185. color: #43CD80 !important;
  1186. }
  1187. .down {
  1188. color: #E6273A !important;
  1189. }
  1190. .empity {
  1191. width: 100%;
  1192. height: 300rpx;
  1193. display: flex;
  1194. justify-content: center;
  1195. align-items: center;
  1196. font-size: 28rpx;
  1197. color: #666666;
  1198. }
  1199. }
  1200. </style>