index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. <template>
  2. <div class="hintTabPage">
  3. <div class="itemTab">
  4. <van-collapse v-model="activeNames">
  5. <!-- 拜访(实时) -->
  6. <van-collapse-item :name="visitCollapse.name">
  7. <template #title>
  8. <div class="itemHeader">
  9. <span class="itemTitle">{{ visitCollapse.title }}</span>
  10. <span @click.stop>
  11. <el-popover placement="right" trigger="click" popper-class="hintPopover">
  12. <div
  13. class="popoverConten"
  14. v-for="(item, index) in visitCollapse.tipsPopoverlabel"
  15. :key="index">
  16. {{ item }}
  17. </div>
  18. <div slot="reference" class="hintIconBox">
  19. <img class="hintIcon" :src="hintIcon" />
  20. </div>
  21. </el-popover>
  22. </span>
  23. <span class="updateTime">更新时间:{{ visitCollapse.latestUpdateTime }}</span>
  24. </div>
  25. </template>
  26. <visitPage
  27. fromType="noVisit"
  28. :empLevel="empLevel"
  29. :contentData="visitCollapse.contentData"
  30. :maskShow="visitCollapse.collapseLosding"
  31. :resData="visitCollapse.resData"></visitPage>
  32. </van-collapse-item>
  33. <!-- 建店 -->
  34. <van-collapse-item :name="createStore.name">
  35. <template #title>
  36. <div class="itemHeader" @click.stop>
  37. <span class="itemTitle">{{ createStore.title }}</span>
  38. <el-popover placement="right" trigger="click" popper-class="hintPopover">
  39. <div
  40. class="popoverConten"
  41. v-for="(item, index) in createStore.tipsPopoverlabel"
  42. :key="index">
  43. {{ item }}
  44. </div>
  45. <div slot="reference" class="hintIconBox">
  46. <img class="hintIcon" :src="hintIcon" />
  47. </div>
  48. </el-popover>
  49. </div>
  50. </template>
  51. <visitPage
  52. fromType="createStore"
  53. :empLevel="empLevel"
  54. :contentData="createStore.contentData"
  55. :maskShow="createStore.collapseLosding"
  56. :resData="createStore.resData"></visitPage>
  57. </van-collapse-item>
  58. <!-- 日报、周报、半月报 -->
  59. <van-collapse-item name="3" v-if="empLevel != '4'">
  60. <template #title>
  61. <div class="itemHeader" @click.stop>
  62. <span class="itemTitle">{{ report.title }}</span>
  63. <el-popover placement="right" trigger="click" popper-class="hintPopover">
  64. <div class="popoverConten">
  65. {{ report.reportData.tip }}
  66. </div>
  67. <div slot="reference" class="hintIconBox">
  68. <img class="hintIcon" :src="hintIcon" />
  69. </div>
  70. </el-popover>
  71. </div>
  72. </template>
  73. <div class="reportContent">
  74. <div class="reportItem">
  75. <div class="label">填写率:</div>
  76. <div class="value">本月{{ report.reportData.fillingRate }}</div>
  77. <div class="itemDetail" v-if="empLevel != '3'" @click="reportClick('fillingRate')">
  78. 下属详情
  79. </div>
  80. </div>
  81. <div class="reportItem" v-show="empLevel != '3'">
  82. <div class="label">审批率:</div>
  83. <div class="value">本月{{ report.reportData.approvalRate }}</div>
  84. </div>
  85. <div class="" v-show="empLevel == '1'">本周点评业务员</div>
  86. <div class="reportItem" v-show="empLevel == '1'">
  87. <div class="label">日报数(目标数):</div>
  88. <div class="value">{{ report.reportData.commentNum }}个(5个)</div>
  89. <div class="itemDetail" @click="reportClick('commentNum')">进入点评</div>
  90. </div>
  91. <div class="mask" v-if="report.reportLosding">
  92. <van-loading type="spinner" color="#1989fa" />
  93. </div>
  94. </div>
  95. </van-collapse-item>
  96. <!-- 色卡 销售员和销售部主管显示-->
  97. <van-collapse-item name="4" v-if="empLevel == '2' || empLevel == '3'">
  98. <template #title>
  99. <div class="itemHeader" @click.stop>
  100. <span class="itemTitle">{{ pantone.title }}</span>
  101. <el-popover placement="right" trigger="click" popper-class="hintPopover">
  102. <div class="popoverConten">
  103. {{ pantone.tip }}
  104. </div>
  105. <div slot="reference" class="hintIconBox">
  106. <img class="hintIcon" :src="hintIcon" />
  107. </div>
  108. </el-popover>
  109. </div>
  110. </template>
  111. <div class="pantoneContent">
  112. <template v-if="empLevel == '3'">
  113. <div v-for="(val, key, index) in pantone.pantoneData" :key="index">
  114. <div class="title">{{ key }}</div>
  115. <div class="pantoneItem">
  116. <div class="firstItem item">
  117. <div class="left">
  118. <div class="lebel">已领用:</div>
  119. <div class="value">{{ val.ywyylyNum }}本</div>
  120. </div>
  121. <div class="right">
  122. <div class="lebel">已发放门店:</div>
  123. <div class="value">{{ val.ywyyffNum }}本</div>
  124. </div>
  125. </div>
  126. <div class="secondItem item">
  127. <div class="left">
  128. <div class="lebel">门店未签收:</div>
  129. <div class="value">{{ val.mdwqsNum }}本</div>
  130. </div>
  131. <div class="right">
  132. <div class="lebel">门店未签收:</div>
  133. <div class="value valueIsClick" @click="pantoneClick(val, key)">
  134. {{ val.wqsmdNum }}家
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </template>
  141. <template v-if="empLevel == '2'">
  142. <div v-for="(val, key, index) in pantone.pantoneData" :key="index">
  143. <div class="title">{{ key }}</div>
  144. <div class="pantoneItem">
  145. <div class="firstItem item">
  146. <div class="left">
  147. <div class="lebel">直发销售部数:</div>
  148. <div class="value">{{ val.zfxsbNum }}本</div>
  149. </div>
  150. <div class="right">
  151. <div class="lebel">业务员已领用:</div>
  152. <div class="value">{{ val.ywyylyNum }}本</div>
  153. </div>
  154. </div>
  155. <div class="secondItem item">
  156. <div class="left">
  157. <div class="lebel">业务员已发放:</div>
  158. <div class="value">{{ val.ywyyffNum }}本</div>
  159. </div>
  160. <div class="right">
  161. <div class="lebel">门店未签收:</div>
  162. <div class="value valueIsClick" @click="pantoneClick(val, key)">
  163. {{ val.wqsmdNum }}家
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. </template>
  170. <div class="mask" v-if="pantone.pantoneLosding">
  171. <van-loading type="spinner" color="#1989fa" />
  172. </div>
  173. </div>
  174. </van-collapse-item>
  175. </van-collapse>
  176. </div>
  177. </div>
  178. </template>
  179. <script>
  180. import {
  181. selectVisitsRealTime,
  182. selectBuildingStore,
  183. getReportTarget,
  184. getReportMaterial,
  185. } from '@/api/index';
  186. import hintIcon from '@/assets/hintIcon.png';
  187. import visitPage from './visitPage.vue';
  188. import { mapState } from 'vuex';
  189. export default {
  190. name: 'hintTabPage',
  191. components: { visitPage },
  192. computed: {
  193. ...mapState({
  194. userInfo: (state) => state.user.userInfo,
  195. }),
  196. },
  197. props: {
  198. tabVal: {
  199. type: [String, Number],
  200. default: '-1',
  201. },
  202. },
  203. data() {
  204. return {
  205. empLevel: '', //员工级别,1大区主管2销售部主管3业务员4其他 ***其他级别4,不显示日报、周报、半月报和色卡
  206. hintIcon: hintIcon,
  207. activeNames: ['1', '2', '3', '4', '5'],
  208. visitCollapse: {
  209. name: '1',
  210. title: '拜访(实时)',
  211. collapseLosding: true,
  212. latestUpdateTime: '',
  213. tipsPopoverlabel: [],
  214. tipsPopoverValue: null,
  215. contentData: [
  216. {
  217. title: '可控店',
  218. titleProp: 'keKong',
  219. bagColor: '#eb6877',
  220. visitDetail: [
  221. {
  222. leftTable: '本月拜访率:',
  223. leftProp: 'visitRateThisMonth',
  224. leftUnit: '%',
  225. leftIsClick: false,
  226. rightTable: '未拜访:',
  227. rightProp: 'notVisited',
  228. rightUnit: '家',
  229. rightIsClick: true,
  230. },
  231. ],
  232. },
  233. {
  234. title: '金牌店',
  235. titleProp: 'jinPai',
  236. bagColor: '#f1b789',
  237. visitDetail: [
  238. {
  239. leftTable: '本月拜访率:',
  240. leftProp: 'visitRateThisMonth',
  241. leftUnit: '%',
  242. leftIsClick: false,
  243. rightTable: '未拜访:',
  244. rightProp: 'notVisited',
  245. rightUnit: '家',
  246. rightIsClick: true,
  247. },
  248. ],
  249. },
  250. {
  251. title: '同A店',
  252. titleProp: 'tongA',
  253. bagColor: '#88abda',
  254. visitDetail: [
  255. {
  256. leftTable: '近2个月拜访率:',
  257. leftProp: 'visitRateInThePastTwoMonths',
  258. leftUnit: '%',
  259. leftIsClick: false,
  260. rightTable: '未拜访:',
  261. rightProp: 'notVisited',
  262. rightUnit: '家',
  263. rightIsClick: true,
  264. },
  265. ],
  266. },
  267. {
  268. title: '同B店',
  269. titleProp: 'tongB',
  270. bagColor: '#8f82bc',
  271. visitDetail: [
  272. {
  273. leftTable: '近3个月拜访率:',
  274. leftProp: 'visitRateInThePastThreeMonths',
  275. leftUnit: '%',
  276. leftIsClick: false,
  277. rightTable: '未拜访:',
  278. rightProp: 'notVisited',
  279. rightUnit: '家',
  280. rightIsClick: true,
  281. },
  282. ],
  283. },
  284. ],
  285. resData: null,
  286. },
  287. createStore: {
  288. name: '2',
  289. title: '建店',
  290. collapseLosding: true,
  291. tipsPopoverlabel: [
  292. {
  293. label: '未完工',
  294. prop: '',
  295. },
  296. {
  297. label: '为结案',
  298. prop: '',
  299. },
  300. ],
  301. tipsPopoverValue: null,
  302. contentData: [
  303. {
  304. title: '可控店',
  305. titleProp: 'keKong',
  306. bagColor: '#eb6877',
  307. visitDetail: [
  308. {
  309. leftTable: '本月累计:',
  310. leftProp: 'month',
  311. leftUnit: '家',
  312. leftIsClick: false,
  313. },
  314. {
  315. leftTable: '今年累计:',
  316. leftProp: 'year',
  317. leftUnit: '家',
  318. leftIsClick: false,
  319. rightTable: '45天未结案:',
  320. rightProp: 'keKongAbnormalNum',
  321. rightUnit: '家',
  322. rightIsClick: true,
  323. },
  324. ],
  325. },
  326. {
  327. title: '金牌店',
  328. titleProp: 'jinPai',
  329. bagColor: '#f1b789',
  330. visitDetail: [
  331. {
  332. leftTable: '本月累计:',
  333. leftProp: 'month',
  334. leftUnit: '家',
  335. leftIsClick: false,
  336. rightTable: '7天未完工:',
  337. rightProp: 'jinPaiAbnormalNum',
  338. rightUnit: '家',
  339. rightIsClick: true,
  340. },
  341. {
  342. leftTable: '今年累计:',
  343. leftProp: 'year',
  344. leftUnit: '家',
  345. leftIsClick: false,
  346. rightTable: '30天未结案:',
  347. rightProp: 'jinPaiUnfinishedNum',
  348. rightUnit: '家',
  349. rightIsClick: true,
  350. },
  351. ],
  352. },
  353. {
  354. title: '同A店',
  355. titleProp: 'tongA',
  356. bagColor: '#88abda',
  357. visitDetail: [
  358. {
  359. leftTable: '本月累计:',
  360. leftProp: 'month',
  361. leftUnit: '家',
  362. leftIsClick: false,
  363. },
  364. {
  365. leftTable: '今年累计:',
  366. leftProp: 'year',
  367. leftUnit: '家',
  368. leftIsClick: false,
  369. rightTable: '30天未结案:',
  370. rightProp: 'tongAAbnormalNum',
  371. rightUnit: '家',
  372. rightIsClick: true,
  373. },
  374. ],
  375. },
  376. {
  377. title: '同B店',
  378. titleProp: 'tongB',
  379. bagColor: '#8f82bc',
  380. visitDetail: [
  381. {
  382. leftTable: '本月累计:',
  383. leftProp: 'month',
  384. leftUnit: '家',
  385. leftIsClick: false,
  386. },
  387. {
  388. leftTable: '今年累计:',
  389. leftProp: 'year',
  390. leftUnit: '家',
  391. leftIsClick: false,
  392. rightTable: '30天未结案:',
  393. rightProp: 'tongBAbnormalNum',
  394. rightUnit: '家',
  395. rightIsClick: true,
  396. },
  397. ],
  398. },
  399. ],
  400. resData: null,
  401. },
  402. report: {
  403. title: '',
  404. reportLosding: true,
  405. reportData: {},
  406. },
  407. pantone: {
  408. title: '色卡',
  409. tip: '',
  410. pantoneLosding: true,
  411. pantoneData: {},
  412. },
  413. };
  414. },
  415. watch: {
  416. tabVal: {
  417. handler(val) {
  418. if (val == -1) {
  419. this.initData();
  420. }
  421. },
  422. immediate: true,
  423. },
  424. },
  425. activated() {},
  426. methods: {
  427. initData() {
  428. if (!this.userInfo) return;
  429. this.empLevel = this.userInfo.empLevel;
  430. // 获取拜访数据
  431. this.getVisitCollapseData();
  432. // 获取建店数据
  433. this.getSelectBuildingStore();
  434. // 获取汇报数据 日报、周报、半月报
  435. this.getReportData();
  436. // 获取色卡数据
  437. this.getPantoneData();
  438. },
  439. getVisitCollapseData() {
  440. this.visitCollapse.collapseLosding = true;
  441. selectVisitsRealTime().then((res) => {
  442. this.visitCollapse.resData = res.data;
  443. this.visitCollapse.tipsPopoverlabel = res.data.reminderContent;
  444. this.visitCollapse.latestUpdateTime = res.data.latestUpdateTime;
  445. this.visitCollapse.collapseLosding = false;
  446. });
  447. },
  448. getSelectBuildingStore() {
  449. this.createStore.collapseLosding = true;
  450. selectBuildingStore().then((res) => {
  451. this.createStore.resData = res.data;
  452. this.createStore.tipsPopoverlabel = res.data.reminderContent;
  453. this.createStore.collapseLosding = false;
  454. });
  455. },
  456. getReportData() {
  457. if (this.empLevel == '1') {
  458. this.report.title = '半月报';
  459. } else if (this.empLevel == '2') {
  460. this.report.title = '周报';
  461. } else if (this.empLevel == '3') {
  462. this.report.title = '日报';
  463. }
  464. this.report.reportLosding = true;
  465. getReportTarget().then((res) => {
  466. this.report.reportLosding = false;
  467. this.report.reportData = res.data || {};
  468. });
  469. },
  470. getPantoneData() {
  471. if (this.empLevel == 2 || this.empLevel == 3) {
  472. this.pantone.pantoneLosding = true;
  473. getReportMaterial().then((res) => {
  474. this.pantone.pantoneLosding = false;
  475. this.pantone.tip = res.data.tip;
  476. this.pantone.pantoneData = res.data;
  477. delete this.pantone.pantoneData.tip;
  478. });
  479. }
  480. },
  481. // 汇报下属详情-点击
  482. reportClick(type) {
  483. if (type == 'fillingRate') {
  484. // 下属汇报率审批率统计
  485. this.$router.push({ path: 'reportingRate' });
  486. } else if (type == 'commentNum') {
  487. // 下属业务员历史日报
  488. this.$router.push({ path: 'subordinateHistoricalDaily' });
  489. }
  490. },
  491. // 色卡查看详情
  492. pantoneClick(val, key) {
  493. // 业务员进入未拜访列表
  494. if (this.empLevel == '3') {
  495. this.$router.push({ path: '/pantoneNoGet', query: { storeId: val.storeId } });
  496. } else if (this.empLevel == '2') {
  497. // 销售部主管
  498. this.$router.push({
  499. path: '/hintDetail',
  500. query: { fromType: 'pantone', materialCode: val.materialCode, pantoneName: key }, // materialCode物料来源
  501. });
  502. }
  503. },
  504. },
  505. };
  506. </script>
  507. <style lang="scss" scoped>
  508. .hintTabPage {
  509. padding: 6px;
  510. /* padding: 10px; */
  511. .itemTab {
  512. /* background: #fff; */
  513. padding: 8px;
  514. /* padding: 10px; */
  515. margin-bottom: 10px;
  516. border-radius: 5px;
  517. .itemHeader {
  518. /* width: 150px; */
  519. color: #0057ba;
  520. font-weight: 500;
  521. font-size: 16px;
  522. padding: 10px 0;
  523. display: inline-flex;
  524. align-items: center;
  525. .itemTitle {
  526. margin-right: 10px;
  527. }
  528. .hintIconBox {
  529. display: flex;
  530. .hintIcon {
  531. width: 16px;
  532. height: 16px;
  533. }
  534. }
  535. .van-popover__wrapper {
  536. display: flex;
  537. }
  538. .updateTime {
  539. margin-left: 10px;
  540. font-size: 12px;
  541. }
  542. }
  543. .van-collapse-item {
  544. margin-bottom: 15px;
  545. }
  546. /* 汇报 日报、周报、半月报 */
  547. .reportContent {
  548. color: #666666;
  549. padding: 8px 0;
  550. .reportItem {
  551. display: flex;
  552. position: relative;
  553. padding: 3px 0;
  554. .value {
  555. font-weight: 600;
  556. }
  557. .itemDetail {
  558. text-decoration: underline;
  559. color: #0057ba;
  560. position: absolute;
  561. right: 10px;
  562. }
  563. }
  564. }
  565. /* 色卡 */
  566. .pantoneContent {
  567. padding-bottom: 10px;
  568. .title {
  569. padding: 2px 5px;
  570. border-radius: 2px;
  571. background-color: #13b5b1;
  572. margin: 4px 0;
  573. display: inline-block;
  574. color: #fff;
  575. }
  576. .pantoneItem {
  577. .item {
  578. display: flex;
  579. justify-content: space-between;
  580. .left {
  581. display: flex;
  582. }
  583. .right {
  584. display: flex;
  585. width: 48%;
  586. justify-content: left;
  587. .valueIsClick {
  588. text-decoration: underline;
  589. color: #0057ba;
  590. }
  591. }
  592. }
  593. .firstItem {
  594. }
  595. .secondItem {
  596. }
  597. }
  598. }
  599. }
  600. .mask {
  601. position: absolute;
  602. width: 100%;
  603. height: 100%;
  604. top: 0;
  605. background: rgba(255, 255, 255, 0.8);
  606. display: flex;
  607. justify-content: center;
  608. align-items: center;
  609. }
  610. }
  611. </style>
  612. <style lang="scss">
  613. .hintTabPage {
  614. .itemTab {
  615. .van-cell {
  616. padding: 0 8px;
  617. align-items: center;
  618. }
  619. .van-collapse-item__content {
  620. padding: 0 8px;
  621. }
  622. }
  623. }
  624. .hintPopover {
  625. background: #deedff;
  626. .popper__arrow {
  627. &::after {
  628. border-right-color: #deedff !important;
  629. }
  630. }
  631. }
  632. </style>