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.
 
 
 
 

1374 lines
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.values">
  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. path1: '/pages/center/prohibited/firsts',
  459. pathParms: '?activeTotal=4&refresh=refresh&markAdvisor=0&validInvalid=0', // 参数
  460. auth: 'jdjl', //
  461. },
  462. ],
  463. // 周报详情
  464. weekObj: {},
  465. projectName: '', // 项目名称
  466. }
  467. },
  468. computed: {
  469. // 获取本地存储的权限列表
  470. menuList() {
  471. return uni.getStorageSync('weapp_session_Menu_data')
  472. },
  473. // 排名最高与最低
  474. rankTop() {
  475. return name => {
  476. let obj = {}
  477. try {
  478. if (this.weekObj.customerInfo1.length && this.weekObj.customerInfo2.length) {
  479. obj.ranktype = (this.weekObj.customerInfo1.length - this.weekObj.customerInfo2.length) >
  480. 0 ? '上升' : '下降'
  481. obj.people = Math.abs(this.weekObj.customerInfo1.length - this.weekObj.customerInfo2
  482. .length)
  483. }
  484. if (this.weekObj.customerInfo1 && this.weekObj.customerInfo1.length > 0) {
  485. obj.topName = this.weekObj.customerInfo1[0].name
  486. obj.topPk = Math.abs(this.weekObj.customerInfo1[0].pk)
  487. obj.lastName = this.weekObj.customerInfo1[this.weekObj.customerInfo1.length - 1].name,
  488. obj.lastPk = Math.abs(this.weekObj.customerInfo1[this.weekObj.customerInfo1.length - 1]
  489. .pk)
  490. }
  491. if (this.weekObj.customerInfo1.length && this.weekObj.customerInfo2.length) {
  492. obj.class = (this.weekObj.customerInfo1.length - this.weekObj.customerInfo2.length) > 0 ?
  493. 'up' : 'down'
  494. }
  495. if (this.weekObj.fractionPK) {
  496. obj.fractionPKName = this.weekObj.fractionPK > 0 ? '上涨' : '下跌'
  497. obj.fractionPK = Math.abs(this.weekObj.fractionPK)
  498. }
  499. if (this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0) {
  500. obj.fractionBastName = this.weekObj.XJTop1List[0].title
  501. obj.fractionBastValue = this.weekObj.XJTop1List[0].value
  502. }
  503. if (this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0) {
  504. obj.fractionLastName = this.weekObj.XJTop1List[this.weekObj.XJTop1List.length - 1].title
  505. obj.fractionLastValue = this.weekObj.XJTop1List[this.weekObj.XJTop1List.length - 1].value
  506. }
  507. return obj[name] || ''
  508. } catch (e) {
  509. console.log(e)
  510. return ''
  511. }
  512. }
  513. },
  514. // 接待统计
  515. isShowStatistics() {
  516. // 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
  517. return this.weekObj.customerInfo1 && this.weekObj.customerInfo1.length > 0
  518. },
  519. isShowXJTop1List() {
  520. // 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')
  521. return this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0
  522. },
  523. isShowZXLTopList() {
  524. return this.weekObj.ZXLTopList && this.weekObj.ZXLTopList.length > 0
  525. },
  526. isShowJDLTopList() {
  527. return this.weekObj.JDLTopList && this.weekObj.JDLTopList.length > 0
  528. },
  529. },
  530. onLoad(option) {
  531. if (option.id) this.id = option.id
  532. this.getMessage()
  533. },
  534. onShareAppMessage() {
  535. return {
  536. title: `${this.projectName}销讲助手周报`,
  537. path: `/pages/reportExcel/weekReport?id=${this.id}`
  538. }
  539. },
  540. methods: {
  541. tofixed2(time) {
  542. if (time) {
  543. return time.toFixed(2)
  544. } else {
  545. return 0
  546. }
  547. },
  548. forShare() {
  549. this.$u.get("/zkMessage/shareMessage", {
  550. id: this.id,
  551. houseId: uni.getStorageSync('buildingID').id,
  552. username: uni.getStorageSync('weapp_session_userInfo_data').username
  553. })
  554. },
  555. // 趋势分析
  556. toTrendAnalysis(name) {
  557. return
  558. let date = this.weekObj.weekDate.split('~')
  559. let [t1, t2] = [date[0], date[1]]
  560. let time1 = new Date(t1.replace(/-/g, '/'))
  561. let time2 = new Date(t2.replace(/-/g, '/'))
  562. time1.setDate(time1.getDate() - 7)
  563. time2.setDate(time2.getDate() - 7)
  564. let res1 = `${time1.getFullYear()}-${time1.getMonth() + 1}-${time1.getDate()}`
  565. let res2 = `${time2.getFullYear()}-${time2.getMonth() + 1}-${time2.getDate()}`
  566. if (this.isPassWatch(name)) {
  567. uni.navigateTo({
  568. url: `/pages/center/Piabodata/TrendAnalysis?type=1&staTime=${date[0]}&endtime=${date[1]}&staTime1=${res1}&endtime1=${res2}`
  569. })
  570. } else {
  571. uni.showToast({
  572. title: '暂无权限',
  573. icon: "none"
  574. })
  575. }
  576. },
  577. // 顾问排名
  578. toEmployeesstatistics(name) {
  579. let date = this.weekObj.weekDate.split('~')
  580. let [t1, t2] = [date[0], date[1]]
  581. if (this.isPassWatch(name)) {
  582. uni.navigateTo({
  583. url: `/pages/center/Piabodata/Employeesstatistics?type=1&staTime=${date[0]}&endtime=${date[1]}`
  584. })
  585. } else {
  586. uni.showToast({
  587. title: '暂无权限',
  588. icon: "none"
  589. })
  590. }
  591. },
  592. // 员工分析
  593. toStaffAnalysis(name, data) {
  594. let obj = this.weekObj.customerInfo1.find(item => {
  595. return item.name == data.title
  596. })
  597. console.log(obj)
  598. let time = this.weekObj.weekDate.split('~')
  599. if (this.isPassWatch(name)) {
  600. uni.navigateTo({
  601. url: `/pages/center/Piabodata/StaffAnalysis?type=1&id=${obj.id}&startDate=${time[0]}&endDate=${time[1]}`
  602. });
  603. } else {
  604. uni.showToast({
  605. title: '暂无权限',
  606. icon: "none"
  607. })
  608. }
  609. },
  610. // 跳转对应页面
  611. toAuthPage(data) {
  612. console.log(data, this.weekObj)
  613. if (!uni.getStorageSync('weapp_session_login_data').token) {
  614. this.toHome()
  615. return
  616. }
  617. if (this.isPassWatch(data.auth)) {
  618. let time = this.weekObj.weekDate.split('~')
  619. data.pathParms = `${data.pathParms}&staTime=${time[0]}&endtime=${time[1]}`
  620. // 判断为项目周报
  621. if (this.weekObj.orgCode && data.name == '未标记') {
  622. uni.navigateTo({
  623. url: `${data.path1}${data.pathParms}&orgCode=${this.weekObj.orgCode}&messageType=${this.weekObj.messageType}`
  624. })
  625. return
  626. }
  627. uni.navigateTo({
  628. url: `${data.path}${data.pathParms}`
  629. })
  630. } else {
  631. uni.showToast({
  632. title: '暂无权限',
  633. icon: "none"
  634. })
  635. }
  636. },
  637. // 是否有权限观看
  638. isPassWatch(name) {
  639. return this.menuList[name]
  640. },
  641. // 跳转首页
  642. toHome() {
  643. uni.navigateTo({
  644. url: '/pages/index/guide'
  645. })
  646. },
  647. // 获取周报详情
  648. getMessage() {
  649. this.$u.get('/zkMessage/findByProjectId', {
  650. id: this.id,
  651. houseId: uni.getStorageSync('buildingID').id,
  652. username: uni.getStorageSync('weapp_session_userInfo_data').username
  653. }).then(res => {
  654. let data = {}
  655. if (res.zkMessage.content) {
  656. data = JSON.parse(res.zkMessage.content)
  657. this.bubbleSort(data.customerInfo1 || [], 'pk')
  658. this.bubbleSort(data.customerInfo2 || [], 'pk')
  659. data.customerInfo1 && data.customerInfo1.reverse()
  660. data.customerInfo2 && data.customerInfo2.reverse()
  661. this.weekObj = {
  662. ...res.zkMessage,
  663. ...data
  664. }
  665. } else {
  666. this.nodata = true
  667. this.weekObj = {
  668. ...res.zkMessage,
  669. }
  670. }
  671. if (this.weekObj.level1List && this.weekObj.level2List) {
  672. if (this.weekObj.level1List[0] && this.weekObj.level1List[0].total) {
  673. let max1 = this.weekObj.level1List[0].total || 1
  674. this.weekObj.level1List.forEach(item => {
  675. item.percent = Math.floor((item.total / max1) * 100)
  676. })
  677. } else {
  678. this.weekObj.level1List.forEach(item => {
  679. item.percent = 0
  680. })
  681. }
  682. if (this.weekObj.level2List[0] && this.weekObj.level2List[0].total) {
  683. let max2 = this.weekObj.level2List[0].total || 1
  684. this.weekObj.level2List.forEach(item => {
  685. item.percent = Math.floor((item.total / max2) * 100)
  686. })
  687. } else {
  688. this.weekObj.level2List.forEach(item => {
  689. item.percent = 0
  690. })
  691. }
  692. }
  693. this.weekObj.createTimeName = this.getTimeLines(this.weekObj.weekDate, 1)
  694. console.log(this.weekObj, 'this.weekObj')
  695. this.projectName = res.projectName
  696. this.numlist.forEach(item => {
  697. if (data[item.setName]) {
  698. item.num = data[item.setName]
  699. }
  700. if (data[item.percentName]) {
  701. item.percent = data[item.percentName]
  702. }
  703. if (data[item.preNumName]) {
  704. item.preNum = data[item.preNumName]
  705. }
  706. })
  707. this.init()
  708. }).catch(e => {
  709. console.log(e)
  710. })
  711. },
  712. // 把对象转成数组并在后续的步骤方便处理
  713. init() {
  714. console.log(this.weekObj, 'this.weekObj')
  715. this.needList.forEach(item => {
  716. console.log(item)
  717. if (this.weekObj[item] && Object.keys(this.weekObj[item]).length > 0) {
  718. this.weekObj[item + 'List'] = [] // 销讲执行
  719. for (let i in this.weekObj[item]) {
  720. this.weekObj[item + 'List'].push({
  721. title: i,
  722. value: this.weekObj[item][i]
  723. })
  724. }
  725. } else {
  726. this.weekObj[item + 'List'] = []
  727. }
  728. })
  729. this.sortInitArr()
  730. },
  731. // 排序对象转换后的数组
  732. sortInitArr() {
  733. this.needList.forEach(item => {
  734. if (this.weekObj[item + 'List']) {
  735. this.bubbleSort(this.weekObj[item + 'List'])
  736. this.weekObj[item + 'List'] = this.dealData(this.weekObj[item + 'List'])
  737. }
  738. })
  739. this.reverseList()
  740. },
  741. // 反转数组
  742. reverseList() {
  743. this.needList.forEach(item => {
  744. if (this.weekObj[item + 'List']) {
  745. this.weekObj[item + 'List'].reverse()
  746. }
  747. })
  748. console.log(this.weekObj, '12312312312')
  749. },
  750. // 冒泡排序
  751. bubbleSort(arr, keys = 'value') {
  752. for (let i = 0; i < arr.length - 1; i += 1) {
  753. //通过 arr.length 次把第一位放到最后,完成排序
  754. //-i是因为最后的位置是会动态改变的,当完成一次后,最后一位会变成倒数第二位
  755. for (let j = 0; j < arr.length - 1 - i; j += 1) {
  756. if (arr[j][keys] > arr[j + 1][keys]) {
  757. const temp = arr[j];
  758. arr[j] = arr[j + 1];
  759. arr[j + 1] = temp;
  760. }
  761. }
  762. }
  763. },
  764. // 定义一个公共方法对数据进行处理
  765. dealData(arr) {
  766. // 获取最大值
  767. let num = Math.max.apply(Math, arr.map((o) => {
  768. return o.value
  769. }))
  770. arr.map(item => {
  771. item.values = Math.floor(item.value / num * 100)
  772. })
  773. return arr
  774. },
  775. // 转换时间
  776. getTimeLine(date, type = 1) {
  777. let resu = '--'
  778. if (!date) return resu
  779. let time = new Date(date.replace(/-/g, '/'))
  780. time.setDate(time.getDate() - 7)
  781. let arr = date.split(' ')
  782. let str = arr[0]
  783. let result = str.split('-')
  784. let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
  785. let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
  786. if (type == 1) {
  787. resu = `${m}.${d}-${result[1]}.${result[2]}`
  788. } else {
  789. resu = `${m}月${d}日~${result[1]}月${result[2]}日`
  790. }
  791. return resu
  792. },
  793. // 转换时间
  794. getTimeLines(date) {
  795. if (!date) return ''
  796. let arr = date.split('~')
  797. let str0 = arr[0].split('-')
  798. let str1 = arr[1].split('-')
  799. return `${str0[1]}月${str0[2]}日~${str1[1]}月${str1[2]}日`
  800. },
  801. },
  802. filters: {
  803. // 时间格式转换
  804. fomatDate(date) {
  805. if (!date) return '--'
  806. let arr = date.split(' ')
  807. let str = arr[0]
  808. let result = str.split('-')
  809. return `${result[1]}-${result[2]}`
  810. },
  811. // 转换时间
  812. getTimeLine(date, type = 1) {
  813. if (!date) return '--'
  814. console.log(date.replace(/-/g, '/'))
  815. let time = new Date(date.replace(/-/g, '/'))
  816. time.setDate(time.getDate() - 7)
  817. let arr = date.split(' ')
  818. let str = arr[0]
  819. let result = str.split('-')
  820. let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
  821. let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
  822. if (type == 1) {
  823. return `${m}.${d}-${result[1]}.${result[2]}`
  824. } else {
  825. return `${m}月${d}日~${result[1]}月${result[2]}日`
  826. }
  827. },
  828. // 设置颜色
  829. setColor(index) {
  830. let color = ''
  831. switch (index) {
  832. case 0:
  833. color = '#E7483C';
  834. break;
  835. case 1:
  836. color = '#FF8C13';
  837. break;
  838. case 2:
  839. color = '#FFCC00';
  840. break;
  841. default:
  842. color = '#4FC78F';
  843. break;
  844. }
  845. return color
  846. },
  847. }
  848. }
  849. </script>
  850. <style lang="scss" scoped>
  851. @import '@/static/css/quill/quill.core.css';
  852. @import '@/static/css/quill/quill.snow.css';
  853. @import '@/static/css/quill/quill.bubble.css';
  854. .pages {
  855. width: 100vw;
  856. min-height: 100vh;
  857. display: flex;
  858. flex-direction: column;
  859. background: #F8F8F8;
  860. .nav-header {
  861. flex-shrink: 0;
  862. }
  863. .container {
  864. padding: 30rpx 30rpx 40rpx;
  865. display: flex;
  866. flex-direction: column;
  867. background: #fff;
  868. .c-head-card {
  869. padding: 30rpx;
  870. width: 100%;
  871. min-height: 252rpx;
  872. border: 2rpx solid #000000;
  873. border-radius: 12rpx;
  874. box-shadow: 10rpx 10rpx #2671E2;
  875. display: flex;
  876. flex-direction: column;
  877. .c-title-text {
  878. // position: relative;
  879. flex-grow: 1;
  880. font-size: 48rpx;
  881. font-weight: bold;
  882. color: #303030;
  883. }
  884. .date {
  885. // position: absolute;
  886. // right: 0;
  887. // bottom: 6rpx;
  888. font-size: 30rpx;
  889. color: #303030;
  890. }
  891. .creative-time {
  892. margin: 20rpx 0 0 0;
  893. flex-shrink: 0;
  894. }
  895. }
  896. }
  897. .nodata-box {
  898. width: 750rpx;
  899. flex: 1;
  900. margin: 0 auto;
  901. display: flex;
  902. justify-content: center;
  903. align-items: center;
  904. flex-direction: column;
  905. background-color: #fff;
  906. .img {
  907. width: 400rpx;
  908. height: 400rpx;
  909. }
  910. .text {
  911. text-align: center;
  912. font-size: 28rpx;
  913. font-family: PingFangSC-Regular, PingFang SC;
  914. font-weight: 400;
  915. color: #666666;
  916. line-height: 40rpx;
  917. }
  918. }
  919. .briefing {
  920. background: #fff;
  921. .briefing-title {
  922. padding: 0 30rpx;
  923. height: 90rpx;
  924. display: flex;
  925. align-items: center;
  926. border: 1rpx solid #E0E0E0;
  927. font-size: 32rpx;
  928. font-weight: bold;
  929. }
  930. .briefing-box {
  931. width: 100%;
  932. display: flex;
  933. flex-wrap: wrap;
  934. .briefing-box-item {
  935. padding: 20rpx 30rpx;
  936. width: 50%;
  937. height: 186rpx;
  938. border: 1px solid #E0E0E0;
  939. border-left: none;
  940. border-top: none;
  941. &:nth-of-type(2n) {
  942. border-right: none;
  943. }
  944. .top {
  945. font-size: 28rpx;
  946. }
  947. .middle {
  948. margin: 14rpx 0 12rpx;
  949. font-size: 32rpx;
  950. font-weight: 600;
  951. color: #333333;
  952. }
  953. .bottom {
  954. font-size: 26rpx;
  955. color: #666666;
  956. .b-text {
  957. margin-left: 20rpx;
  958. &.down {
  959. color: #E7483C;
  960. font-size: 34rpx;
  961. }
  962. &.up {
  963. font-size: 34rpx;
  964. color: #43CD80;
  965. }
  966. }
  967. }
  968. }
  969. }
  970. }
  971. .execution-ranking {
  972. margin: 20rpx 0 0 0;
  973. padding: 30rpx;
  974. background: #fff;
  975. .execution-ranking-title {
  976. font-size: 32rpx;
  977. font-weight: bold;
  978. }
  979. .execution-ranking-desc {
  980. margin-top: 20rpx;
  981. font-size: 30rpx;
  982. }
  983. .ranking-box {
  984. margin: 30rpx 0 0 0;
  985. .ranking-item {
  986. margin-bottom: 18rpx;
  987. display: flex;
  988. &:nth-last-of-type(1) {
  989. margin-bottom: 0;
  990. }
  991. .left {
  992. flex-shrink: 0;
  993. width: 270rpx;
  994. font-size: 30rpx;
  995. overflow: hidden;
  996. text-overflow: ellipsis;
  997. white-space: nowrap;
  998. }
  999. .middle {
  1000. flex-grow: 1;
  1001. }
  1002. .right {
  1003. flex-shrink: 0;
  1004. width: 118rpx;
  1005. font-size: 30rpx;
  1006. text-align: center;
  1007. }
  1008. }
  1009. }
  1010. }
  1011. .statistics {
  1012. margin: 20rpx 0 0 0;
  1013. background: #fff;
  1014. .statistics-title {
  1015. padding: 30rpx 30rpx 0;
  1016. width: 100%;
  1017. font-size: 32rpx;
  1018. font-weight: bold;
  1019. }
  1020. .statistics-desc {
  1021. padding: 0 30rpx;
  1022. margin-top: 20rpx;
  1023. }
  1024. .table {
  1025. margin: 30rpx 0 0 0;
  1026. .thead {
  1027. padding: 0 30rpx;
  1028. width: 100%;
  1029. height: 72rpx;
  1030. display: flex;
  1031. align-items: center;
  1032. border: 1rpx solid #E0E0E0;
  1033. border-left: none;
  1034. border-right: none;
  1035. font-size: 26rpx;
  1036. .thead-item {
  1037. text-align: center;
  1038. }
  1039. }
  1040. .tbody {
  1041. .tbody-item {
  1042. padding: 0 30rpx;
  1043. display: flex;
  1044. align-items: center;
  1045. height: 72rpx;
  1046. background: #FAFCFF;
  1047. &:nth-of-type(2n) {
  1048. background: #FFFFFF;
  1049. }
  1050. .tbody-items {
  1051. flex: 1;
  1052. display: flex;
  1053. justify-content: center;
  1054. }
  1055. .name {
  1056. justify-content: flex-start;
  1057. overflow: hidden;
  1058. text-overflow: ellipsis;
  1059. white-space: nowrap;
  1060. }
  1061. .time {
  1062. flex: 2;
  1063. }
  1064. .percent {
  1065. flex: 2;
  1066. }
  1067. .week {
  1068. flex: 1.5;
  1069. }
  1070. }
  1071. }
  1072. .tbottom {
  1073. width: 100%;
  1074. height: 72rpx;
  1075. display: flex;
  1076. justify-content: center;
  1077. align-items: center;
  1078. font-size: 30rpx;
  1079. color: #2671E2;
  1080. background: #FAFCFF;
  1081. }
  1082. }
  1083. }
  1084. .guwen-ranking {
  1085. margin: 20rpx 0 0 0;
  1086. width: 100%;
  1087. padding: 30rpx;
  1088. background: #fff;
  1089. .guwen-ranking-title {
  1090. font-size: 32rpx;
  1091. font-weight: 500;
  1092. }
  1093. .guwen-ranking-desc {
  1094. margin-top: 20rpx;
  1095. font-size: 30rpx;
  1096. }
  1097. .ranking-box {
  1098. margin: 30rpx 0 0 0;
  1099. .ranking-item {
  1100. margin-bottom: 18rpx;
  1101. display: flex;
  1102. &:nth-last-of-type(1) {
  1103. margin-bottom: 0;
  1104. }
  1105. .left {
  1106. flex-shrink: 0;
  1107. width: 270rpx;
  1108. font-size: 30rpx;
  1109. overflow: hidden;
  1110. text-overflow: ellipsis;
  1111. white-space: nowrap;
  1112. }
  1113. .middle {
  1114. flex-grow: 1;
  1115. }
  1116. .right {
  1117. flex-shrink: 0;
  1118. width: 118rpx;
  1119. font-size: 30rpx;
  1120. text-align: center;
  1121. }
  1122. }
  1123. }
  1124. }
  1125. .proposal {
  1126. margin: 20rpx 0 0 0;
  1127. padding: 30rpx;
  1128. background: #fff;
  1129. .proposal-title {
  1130. font-size: 32rpx;
  1131. font-weight: 500;
  1132. }
  1133. .proposal-box {
  1134. margin: 30rpx 0 0 0;
  1135. .proposal-item {
  1136. margin: 20rpx 0 0 0;
  1137. display: flex;
  1138. .lside {
  1139. flex-shrink: 0;
  1140. margin: 0 12rpx 0 0;
  1141. width: 44rpx;
  1142. height: 44rpx;
  1143. border-radius: 50%;
  1144. background: #2671E2;
  1145. text-align: center;
  1146. line-height: 44rpx;
  1147. color: #fff;
  1148. }
  1149. .rside {
  1150. .rside-title {
  1151. font-size: 32rpx;
  1152. }
  1153. .rside-box {
  1154. margin: 16rpx 0 0 0;
  1155. }
  1156. }
  1157. }
  1158. }
  1159. }
  1160. .nav-footer {
  1161. position: sticky;
  1162. bottom: 0;
  1163. padding: 32rpx;
  1164. width: 100%;
  1165. display: flex;
  1166. justify-content: center;
  1167. background: #fff;
  1168. .footer-item {
  1169. flex: 1;
  1170. height: 88rpx;
  1171. display: flex;
  1172. justify-content: center;
  1173. align-items: center;
  1174. color: #2671E2;
  1175. border: 2rpx solid #2671E2;
  1176. border-radius: 8rpx;
  1177. overflow: hidden;
  1178. font-size: 32rpx;
  1179. &.full {
  1180. background: #2671E2;
  1181. color: #fff;
  1182. .fulls {
  1183. box-sizing: border-box;
  1184. width: 100%;
  1185. height: 100%;
  1186. background: transparent;
  1187. color: #fff;
  1188. font-size: 32rpx;
  1189. font-weight: normal;
  1190. line-height: 88rpx;
  1191. }
  1192. }
  1193. }
  1194. }
  1195. .up {
  1196. color: #43CD80 !important;
  1197. }
  1198. .down {
  1199. color: #E6273A !important;
  1200. }
  1201. .empity {
  1202. width: 100%;
  1203. height: 300rpx;
  1204. display: flex;
  1205. justify-content: center;
  1206. align-items: center;
  1207. font-size: 28rpx;
  1208. color: #666666;
  1209. }
  1210. }
  1211. </style>