index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <div class="work-index">
  3. <div class="work-index-content">
  4. <div class="work-left">
  5. <div class="work-box">
  6. <div class="title">
  7. <div class="label">个人信息</div>
  8. </div>
  9. <div class="content user-content">
  10. <div class="user-avatar">
  11. <div class="user-avatar-img">
  12. <avatar :user="user" :size="20"></avatar>
  13. </div>
  14. <div class="user-avatar-name">{{user.userName}}</div>
  15. </div>
  16. <div class="user-list">
  17. <div class="user-item">
  18. <div class="user-key">公司名称</div>
  19. <div class="user-value">{{organization.name}}</div>
  20. </div>
  21. <div class="user-item">
  22. <div class="user-key">公司部门</div>
  23. <div class="user-value">智慧城市事业部</div>
  24. </div>
  25. <div class="user-item">
  26. <div class="user-key">联系方式</div>
  27. <div class="user-value">{{user.phone}}</div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="work-box">
  33. <div class="title">
  34. <div class="label">公告</div>
  35. <div class="more" @click="$router.push('/work/notice')">查看更多>></div>
  36. </div>
  37. <div class="content notice-content" v-if="noticeList.length >0">
  38. <div class="notice-item" v-for="(item,index) in noticeList" :key="item.id"
  39. @click="openNotice(item)">
  40. <div class="notice-dage"></div>
  41. <div class="notice-label hui-ellipsis">{{item.content}}</div>
  42. <div class="notice-date alibaba">{{$dayjs(item.publishTime).format('YYYY-MM-DD')}}</div>
  43. </div>
  44. </div>
  45. <div class="content notice-content" v-else>
  46. <el-empty description="暂无公告" :image-size="80"></el-empty>
  47. </div>
  48. </div>
  49. <div class="work-box message-work-box">
  50. <div class="title">
  51. <div class="label">消息通知</div>
  52. <div class="more" @click="$router.push('/work/message')">查看更多>></div>
  53. </div>
  54. <div class="content message-content" v-if="messageList.length >0">
  55. <div class="message-item hui-ellipsis" v-for="(item,index) in messageList" :key="item.id">
  56. {{item.message}}
  57. </div>
  58. </div>
  59. <div class="content message-content" v-else>
  60. <el-empty description="暂无消息通知" :image-size="80"></el-empty>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="work-right">
  65. <div class="work-box message-work-box">
  66. <div class="title">
  67. <div class="label">服务数据</div>
  68. <div class="title-option">
  69. <div v-for="(item,index) in versionList"
  70. :class="nowVersion.id === item.id ?'option-item active':'option-item'"
  71. @click="changeVersion(item)">
  72. {{item.name}}
  73. </div>
  74. </div>
  75. </div>
  76. <div class="content count-serve-content">
  77. <div class="count-serve-item color-primary">
  78. <div class="count-serve-title hanyiyaku">{{nowVersion.id === 1 ? '消费金额' : '成交金额'}}</div>
  79. <div class="count-serve-value alibaba">{{orderCountNumber[nowVersion.type].totalFee}}</div>
  80. </div>
  81. <div class="count-serve-item color-success">
  82. <div class="count-serve-title hanyiyaku">订单数</div>
  83. <div class="count-serve-value alibaba">{{orderCountNumber[nowVersion.type].orders}}</div>
  84. </div>
  85. <div class="count-serve-item color-warning">
  86. <div class="count-serve-title hanyiyaku">发票数</div>
  87. <div class="count-serve-value alibaba">{{orderCountNumber[nowVersion.type].invoice}}</div>
  88. </div>
  89. <div class="count-serve-item color-warning">
  90. <div class="count-serve-title hanyiyaku">合同数</div>
  91. <div class="count-serve-value alibaba">{{orderCountNumber[nowVersion.type].contract}}</div>
  92. </div>
  93. </div>
  94. <div class="title">
  95. <div class="label">订单统计</div>
  96. <div>
  97. <el-date-picker size="small" v-model="timeData" type="daterange" range-separator="至"
  98. start-placeholder="开始日期" end-placeholder="结束日期" @change="initOrderByTime"
  99. value-format="yyyy-MM-dd" :clearable="false" align="center">
  100. </el-date-picker>
  101. </div>
  102. </div>
  103. <div ref="chart1" class="content order-count"></div>
  104. <div class="title">
  105. <div class="label">{{nowVersion.id === 1 ? '购买排行' : '销量排行'}}</div>
  106. </div>
  107. <div class="content pay-count">
  108. <div class="pay-header tr">
  109. <div class="td td-150">排名</div>
  110. <div class="td td-flex">产品</div>
  111. <div class="td td-150">单价</div>
  112. <div class="td td-150">{{nowVersion.id === 1 ? '购买次数' : '销量'}}</div>
  113. </div>
  114. <div class="pay-table" v-if="orderCount[nowVersion.type].length>0">
  115. <div class="pay-tr tr" v-for="(item,index) in orderCount[nowVersion.type]" :key="item.id">
  116. <div class="td td-150">{{index+1}}</div>
  117. <div class="td td-flex">
  118. <div class="serve-item">
  119. <img :src="imageUrl(item.rotatingImages)" alt="payment.png">
  120. <span>{{item.name}}</span>
  121. </div>
  122. </div>
  123. <div class="td td-150">¥{{item.price}}</div>
  124. <div class="td td-150">{{item.orders}}</div>
  125. </div>
  126. </div>
  127. <div class="pay-table" v-else>
  128. <el-empty description="暂无记录" :image-size="80"></el-empty>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <el-dialog :close-on-click-modal="false" title="公告详情" :visible.sync="visible" width="900px"
  135. :append-to-body="true">
  136. <dialog-detail v-if="visible" :detailId="detailId"></dialog-detail>
  137. </el-dialog>
  138. </div>
  139. </template>
  140. <script>
  141. import {
  142. getAnnouncementListByQueryAndPage
  143. } from '@/api/organization'
  144. import {
  145. getMessagePageListByQuery
  146. } from '@/api/message'
  147. import {
  148. getOrdeCount,
  149. getOrdeCountByDate,
  150. getOrdeCountPay
  151. } from '@/api/serve'
  152. const dialogDetail = () => import('@/components/work/organization/announcement/dialogDetail');
  153. export default {
  154. components: {
  155. dialogDetail
  156. },
  157. data() {
  158. return {
  159. user: {},
  160. organization: {},
  161. versionList: [{
  162. id: 1,
  163. type: 'payOrganization',
  164. name: '企业版'
  165. }, {
  166. id: 2,
  167. type: 'organization',
  168. name: '商业版'
  169. }],
  170. nowVersion: {
  171. id: 1,
  172. type: 'payOrganization',
  173. name: '企业版'
  174. },
  175. noticeList: [],
  176. messageList: [],
  177. orderCount: {
  178. organization: [],
  179. payOrganization: []
  180. },
  181. orderCountNumber: {
  182. organization: {
  183. totalFee: 0,
  184. contract: 0,
  185. orders: 0,
  186. invoice: 0
  187. },
  188. payOrganization: {
  189. totalFee: 0,
  190. contract: 0,
  191. orders: 0,
  192. invoice: 0
  193. }
  194. },
  195. timeData: [],
  196. visible: false,
  197. detailId: ''
  198. }
  199. },
  200. mounted() {
  201. this.user = this.$store.getters.user;
  202. this.organization = this.$store.getters.organization;
  203. this.timeData = [this.$dayjs().subtract(1, 'month').format('YYYY-MM-DD'), this.$dayjs().format('YYYY-MM-DD')];
  204. this.init();
  205. },
  206. methods: {
  207. init() {
  208. this.initNotice();
  209. this.initMessage();
  210. this.initOrder();
  211. this.initOrderByTime();
  212. },
  213. initNotice() {
  214. getAnnouncementListByQueryAndPage(1, 6, {
  215. organizationId: this.$store.getters.organization.id,
  216. projectId: this.$store.getters.id,
  217. status: 1
  218. }).then(res => {
  219. if (res.state) {
  220. this.noticeList = res.data.dataList;
  221. }
  222. })
  223. },
  224. initMessage() {
  225. getMessagePageListByQuery(1, 10, {
  226. organizationId: this.$store.getters.organization.id,
  227. projectId: this.$store.getters.id,
  228. userId: this.$store.getters.user.userId
  229. }).then(res => {
  230. if (res.state) {
  231. this.messageList = res.data.dataList.map(node => {
  232. return Object.assign(node, JSON.parse(node.json));
  233. });
  234. }
  235. })
  236. },
  237. initOrder() {
  238. getOrdeCountPay(this.$store.getters.organization.id).then(res => {
  239. if (res.state) {
  240. this.orderCount = res.data;
  241. }
  242. });
  243. getOrdeCount(this.$store.getters.organization.id).then(res => {
  244. if (res.state) {
  245. this.orderCountNumber = res.data;
  246. }
  247. });
  248. },
  249. initOrderByTime() {
  250. getOrdeCountByDate(this.$store.getters.organization.id, this.timeData[0], this.timeData[1]).then(res => {
  251. if (res.state) {
  252. let data = res.data[this.nowVersion.type];
  253. this.chart(this.$refs.chart1, [data.map(node => node.orders)], ['#32a0ff'], data.map(
  254. node => node.day), [new echarts.graphic.LinearGradient(0,
  255. 0, 0, 1, [{
  256. offset: 0,
  257. color: 'rgba(50,160,255, 0.35)'
  258. }, {
  259. offset: 1,
  260. color: 'rgba(50,160,255, 0)'
  261. }])])
  262. }
  263. });
  264. },
  265. imageUrl(data) {
  266. if (!data) return 'https://assets.api.uizard.io/api/cdn/stream/c05650d2-192b-4a56-ae97-05638f53804c.png';
  267. let imgData = JSON.parse(data)[0];
  268. if (!imgData) {
  269. return 'https://assets.api.uizard.io/api/cdn/stream/c05650d2-192b-4a56-ae97-05638f53804c.png';
  270. }
  271. return imgData.url;
  272. },
  273. changeVersion(item) {
  274. this.nowVersion = item;
  275. this.initOrderByTime();
  276. },
  277. openNotice(item) {
  278. this.detailId = item.id;
  279. this.visible = true;
  280. },
  281. chart(elem, data, color, x, areaColor) {
  282. let chart = echarts.init(elem);
  283. let series = [];
  284. for (var i = 0; i < data.length; i++) {
  285. series = series.concat([{
  286. data: data[i],
  287. type: 'line',
  288. symbolSize: 6,
  289. color: color[i],
  290. lineStyle: {
  291. width: 1
  292. },
  293. areaStyle: {
  294. color: areaColor[i]
  295. },
  296. z: 99
  297. }, {
  298. data: data[i],
  299. type: 'line',
  300. showSymbol: false,
  301. label: {
  302. show: true,
  303. color: '#32a0ff'
  304. },
  305. lineStyle: {
  306. width: 1
  307. },
  308. color: color[i],
  309. z: 99
  310. }]);
  311. }
  312. let option = {
  313. tooltip: {
  314. show: true,
  315. trigger: 'axis',
  316. formatter: function() {
  317. return ''
  318. },
  319. backgroundColor: 'rgba(255,255,255,0)',
  320. borderWidth: 0,
  321. padding: 0,
  322. axisPointer: {
  323. lineStyle: {
  324. type: 'solid',
  325. color: '#32a0ff',
  326. }
  327. }
  328. },
  329. grid: {
  330. left: '15',
  331. top: '35',
  332. right: '15',
  333. bottom: '25',
  334. containLabel: true
  335. },
  336. xAxis: {
  337. type: 'category',
  338. data: x,
  339. axisLabel: {
  340. margin: 4,
  341. color: '#707b85',
  342. fontSize: 12,
  343. fontWeight: 'bold'
  344. },
  345. boundaryGap: true,
  346. axisLine: {
  347. lineStyle: {
  348. color: '#707b85'
  349. }
  350. },
  351. axisTick: {
  352. show: false
  353. }
  354. },
  355. yAxis: {
  356. type: 'value',
  357. name: '订单数',
  358. axisLabel: {
  359. margin: 10,
  360. color: '#707b85',
  361. fontSize: 12,
  362. fontWeight: 'bold'
  363. },
  364. splitLine: {
  365. show: true,
  366. lineStyle: {
  367. color: 'rgba(108,128,151,0.3)',
  368. type: 'dashed'
  369. }
  370. }
  371. },
  372. series: series
  373. };
  374. chart.setOption(option);
  375. },
  376. },
  377. }
  378. </script>
  379. <style lang="scss">
  380. .work-index {
  381. width: 100%;
  382. height: 100%;
  383. overflow-y: auto;
  384. .work-index-content {
  385. display: flex;
  386. min-height: 100%;
  387. }
  388. .work-left {
  389. width: 420px;
  390. margin-right: 15px;
  391. display: flex;
  392. flex-direction: column;
  393. }
  394. .work-right {
  395. flex: 1;
  396. width: 0;
  397. display: flex;
  398. flex-direction: column;
  399. }
  400. .work-box {
  401. background: #fff;
  402. border-radius: 4px;
  403. margin-bottom: 15px;
  404. &:last-child {
  405. margin-bottom: 0;
  406. }
  407. &.message-work-box {
  408. flex: 1;
  409. height: 0;
  410. margin-bottom: 0;
  411. display: flex;
  412. flex-direction: column;
  413. }
  414. .title {
  415. height: 44px;
  416. line-height: 44px;
  417. padding: 0 15px;
  418. display: flex;
  419. justify-content: space-between;
  420. align-items: center;
  421. .more {
  422. color: $--color-text-secondary;
  423. cursor: pointer;
  424. font-size: $--font-size-small;
  425. &:hover {
  426. color: $--color-primary;
  427. }
  428. }
  429. .label {
  430. font-size: $--font-size-large;
  431. font-weight: bold;
  432. }
  433. .title-option {
  434. display: flex;
  435. align-items: center;
  436. height: 24px;
  437. border-radius: 2px;
  438. border: 1px solid $--color-primary;
  439. }
  440. .option-item {
  441. width: 60px;
  442. height: 24px;
  443. font-size: 12px;
  444. text-align: center;
  445. line-height: 24px;
  446. border-radius: 2px;
  447. cursor: pointer;
  448. }
  449. .option-item.active {
  450. background: $--color-primary;
  451. color: #fff;
  452. }
  453. .option-item:hover {
  454. color: $--color-primary;
  455. }
  456. .option-item.active:hover {
  457. color: #fff;
  458. }
  459. }
  460. .content {
  461. padding: 0 15px;
  462. }
  463. .pay-count {
  464. .tr {
  465. display: flex;
  466. }
  467. .td-150 {
  468. width: 150px;
  469. justify-content: center;
  470. }
  471. .td-flex {
  472. flex: 1;
  473. width: 0;
  474. }
  475. .td {
  476. display: flex;
  477. align-items: center;
  478. }
  479. .pay-tr {
  480. .td {
  481. padding: 5px 0;
  482. }
  483. }
  484. .pay-header {
  485. background: $--background-color-base;
  486. .td {
  487. font-weight: bold;
  488. height: 44px;
  489. }
  490. }
  491. .serve-item {
  492. display: flex;
  493. align-items: center;
  494. img {
  495. width: 50px;
  496. height: 50px;
  497. border-radius: 4px;
  498. margin-right: 10px;
  499. }
  500. }
  501. }
  502. .message-content {
  503. flex: 1;
  504. height: 0;
  505. overflow-y: auto;
  506. margin-bottom: 15px;
  507. .message-item {
  508. line-height: 40px;
  509. padding: 0 10px;
  510. cursor: pointer;
  511. }
  512. .message-item:nth-child(2n-1) {
  513. background: $--background-color-base;
  514. }
  515. .message-item:hover {
  516. color: $--color-primary;
  517. }
  518. }
  519. .order-count {
  520. height: 293px;
  521. }
  522. .notice-content {
  523. height: 210px;
  524. overflow-y: auto;
  525. }
  526. .notice-item {
  527. display: flex;
  528. align-items: center;
  529. padding-bottom: 15px;
  530. cursor: pointer;
  531. &:hover {
  532. color: $--color-primary;
  533. .notice-date {
  534. color: $--color-primary;
  535. }
  536. }
  537. }
  538. .notice-dage {
  539. width: 6px;
  540. height: 6px;
  541. border-radius: 6px;
  542. background: $--color-danger;
  543. margin-right: 10px;
  544. &.ready {
  545. background: $--color-info;
  546. }
  547. }
  548. .notice-label {
  549. flex: 1;
  550. width: 0;
  551. }
  552. .notice-date {
  553. color: $--color-text-secondary;
  554. margin-left: 15px;
  555. }
  556. .count-serve-content {
  557. display: flex;
  558. }
  559. .count-serve-item {
  560. flex: 1;
  561. width: 0;
  562. height: 110px;
  563. padding: 15px;
  564. background: linear-gradient(to top, #fff, #f2f3f5);
  565. /* 如果需要兼容旧版浏览器,可以添加带厂商前缀的代码 */
  566. background: -webkit-linear-gradient(bottom, #f2f3f5, #fff);
  567. /* Safari 5.1-6.0 */
  568. background: -o-linear-gradient(bottom, #f2f3f5, #fff);
  569. /* Opera 11.1-12.0 */
  570. background: -moz-linear-gradient(bottom, #f2f3f5, #fff);
  571. /* Firefox 3.6-15 */
  572. border-radius: 8px;
  573. margin: 0 10px;
  574. }
  575. .count-serve-title {
  576. margin-bottom: 5px;
  577. }
  578. .count-serve-value {
  579. font-size: 30px;
  580. }
  581. .user-content {
  582. display: flex;
  583. padding-bottom: 15px;
  584. }
  585. .user-avatar {
  586. width: 110px;
  587. background: linear-gradient(to top, #f8f8f8, #f2f3f5);
  588. /* 如果需要兼容旧版浏览器,可以添加带厂商前缀的代码 */
  589. background: -webkit-linear-gradient(bottom, #f2f3f5, #f8f8f8);
  590. /* Safari 5.1-6.0 */
  591. background: -o-linear-gradient(bottom, #f2f3f5, #f8f8f8);
  592. /* Opera 11.1-12.0 */
  593. background: -moz-linear-gradient(bottom, #f2f3f5, #f8f8f8);
  594. /* Firefox 3.6-15 */
  595. border-radius: 4px;
  596. display: flex;
  597. flex-direction: column;
  598. align-items: center;
  599. justify-content: center;
  600. margin-right: 5px;
  601. .user-avatar-img {
  602. width: 64px;
  603. height: 64px;
  604. border: 2px solid $--border-color-base;
  605. border-radius: 50%;
  606. overflow: hidden;
  607. }
  608. .user-avatar-name {
  609. margin-top: 6px;
  610. font-weight: bold;
  611. }
  612. }
  613. .user-list {
  614. flex: 1;
  615. width: 0;
  616. .user-item {
  617. display: flex;
  618. margin-bottom: 2px;
  619. .user-key {
  620. width: 90px;
  621. }
  622. .user-value {
  623. flex: 1;
  624. width: 0;
  625. margin-left: 2px;
  626. overflow: hidden;
  627. white-space: nowrap;
  628. text-overflow: ellipsis;
  629. }
  630. }
  631. .user-item>div {
  632. background: linear-gradient(to top, #f8f8f8, #f2f3f5);
  633. /* 如果需要兼容旧版浏览器,可以添加带厂商前缀的代码 */
  634. background: -webkit-linear-gradient(bottom, #f2f3f5, #f8f8f8);
  635. /* Safari 5.1-6.0 */
  636. background: -o-linear-gradient(bottom, #f2f3f5, #f8f8f8);
  637. /* Opera 11.1-12.0 */
  638. background: -moz-linear-gradient(bottom, #f2f3f5, #f8f8f8);
  639. /* Firefox 3.6-15 */
  640. border-radius: 4px;
  641. line-height: 36px;
  642. padding: 0 16px;
  643. }
  644. .user-item:last-child {
  645. margin-bottom: 0;
  646. }
  647. }
  648. }
  649. }
  650. </style>