index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. <template>
  2. <view class="box">
  3. <image class="bg-img" src="/static/bg.png" mode=""></image>
  4. <image class="bt-box" src="/static/bt.png" mode=""></image>
  5. <view class="top-box">
  6. <view class="top-left">
  7. <view class="fc-f fs-40 mr-32">
  8. {{currentDate}}
  9. </view>
  10. <view class="fc-f fs-40 mr-32">
  11. {{currentTime}}
  12. </view>
  13. <view class="fc-f fs-40">
  14. {{weekday}}
  15. </view>
  16. </view>
  17. <view class="top-left">
  18. <view class="fc-f fs-40">
  19. 26°C
  20. </view>
  21. </view>
  22. </view>
  23. <view class="data-box">
  24. <!-- 左 -->
  25. <view class="left-box flex-1">
  26. <view class="top-left mb-56">
  27. <view class="amount-box flex-1">
  28. <image class="amount-img" src="/static/k1.png" mode=""></image>
  29. <image class="amount-img-two z-3" src="/static/zje.png" mode=""></image>
  30. <view class="z-3">
  31. <view class="fc-00D5FF fw-b fs-48">
  32. ¥{{totalData.total_money}}
  33. </view>
  34. <view class="fc-f fs-14">
  35. 收款总金额
  36. </view>
  37. </view>
  38. </view>
  39. <view class="amount-box flex-1 mrl-12">
  40. <image class="amount-img" src="/static/k1.png" mode=""></image>
  41. <image class="amount-img-two z-3" src="/static/zbs.png" mode=""></image>
  42. <view class="z-3">
  43. <view class="fc-00D5FF fw-b fs-48">
  44. {{totalData.count}}
  45. </view>
  46. <view class="fc-f fs-14">
  47. 收款总笔数
  48. </view>
  49. </view>
  50. </view>
  51. <view class="amount-box flex-1">
  52. <image class="amount-img" src="/static/k1.png" mode=""></image>
  53. <image class="amount-img-two z-3" src="/static/zrs.png" mode=""></image>
  54. <view class="z-3">
  55. <view class="fc-00D5FF fw-b fs-48">
  56. {{totalData.total_member}}
  57. </view>
  58. <view class="fc-f fs-14">
  59. 消费总人数
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="flex-1 list-box">
  65. <image class="list-img" src="/static/k3.png" mode=""></image>
  66. <view class="title-box mb-26">
  67. <image class="title-img" src="/static/xfmx.png" mode=""></image>
  68. </view>
  69. <!-- 滚动列表 -->
  70. <scroll-view class="scroll-view-css z-3" scroll-y="true" :scroll-top="scrollTop"
  71. scroll-with-animation="true">
  72. <view class="item-box" v-for="(item,i) in listData" :key="i">
  73. <view class="user-box w-30">
  74. <image class="user-img" :src="item.head_img" mode=""></image>
  75. <view class="">
  76. <view class="fs-32 fc-f w-90 text-overflow-ellipsis-one">
  77. {{item.nickname}}
  78. </view>
  79. <view class="fs-28 fc-B2D6FF">
  80. 消费者
  81. </view>
  82. </view>
  83. </view>
  84. <view class="w-30">
  85. <view class="fs-32 fc-f w-90 text-overflow-ellipsis-one">
  86. {{item.shop_name}}
  87. </view>
  88. <view class="fs-28 fc-B2D6FF">
  89. 消费门店
  90. </view>
  91. </view>
  92. <view class="w-20">
  93. <view class="fs-32 fc-f">
  94. ¥{{item.pay_money}}
  95. </view>
  96. <view class="fs-28 fc-B2D6FF">
  97. 消费金额
  98. </view>
  99. </view>
  100. <view class="w-20">
  101. <view class="fs-32 fc-f">
  102. {{item.created_at}}
  103. </view>
  104. <view class="fs-28 fc-B2D6FF text-align-right">
  105. 消费时间
  106. </view>
  107. </view>
  108. </view>
  109. </scroll-view>
  110. </view>
  111. </view>
  112. <!-- 右 -->
  113. <view class="right-box flex-1">
  114. <view class="flex-1 chart-box">
  115. <image class="chart-bg" src="/static/k2.png" mode=""></image>
  116. <view class="title-box">
  117. <image class="title-img" src="/static/xfdb.png" mode=""></image>
  118. <view class="fc-f fs-28 title-right">
  119. 单位(元)
  120. </view>
  121. </view>
  122. <view class="flex-1 z-3 column-box">
  123. <!-- 柱状图 -->
  124. <columnVue ref="columnRef" class="z-3"></columnVue>
  125. </view>
  126. </view>
  127. <view class="flex-1 chart-box mbt-12">
  128. <image class="chart-bg" src="/static/k2.png" mode=""></image>
  129. <view class="title-box">
  130. <image class="title-img" src="/static/zjtj.png" mode=""></image>
  131. <view class="bfje-num">
  132. <view class="bfje-title">
  133. <image class="bf-img" src="/static/bfje.png" mode=""></image>
  134. <view class="fc-B2D6FF fs-28">
  135. 总帮扶金额(元)
  136. </view>
  137. </view>
  138. <view class="fc-f fs-40">
  139. {{Number(summaryDaya.total_money).toFixed(2)}}
  140. </view>
  141. </view>
  142. </view>
  143. <view class="flex-1 tj-box">
  144. <view class="hx-box z-3">
  145. <!-- 环形图 -->
  146. <ringVue ref="ringRef"></ringVue>
  147. </view>
  148. <view class="bf-box mr-86 ml-28">
  149. <view class="bf-num">
  150. <image class="yhbf-img" src="/static/yhbf.png" mode=""></image>
  151. <view class="fc-f fs-40 z-3 text-align-center">
  152. ¥{{Number(summaryDaya.total_member).toFixed(2)}}
  153. </view>
  154. </view>
  155. <view class="bf-title">
  156. <image class="yh-bg" src="/static/yh-bg.png" mode=""></image>
  157. <image class="yh-img z-3" src="/static/yh.png" mode=""></image>
  158. <view class="fs-28 fc-f z-3">
  159. 用户帮扶资金 {{userGdp}}%
  160. </view>
  161. </view>
  162. </view>
  163. <view class="bf-box">
  164. <view class="bf-num">
  165. <image class="yhbf-img" src="/static/dpbf.png" mode=""></image>
  166. <view class="fc-f fs-40 z-3 text-align-center">
  167. ¥{{Number(summaryDaya.total_shop).toFixed(2)}}
  168. </view>
  169. </view>
  170. <view class="bf-title">
  171. <image class="yh-bg" src="/static/dp-bg.png" mode=""></image>
  172. <image class="yh-img z-3" src="/static/dp.png" mode=""></image>
  173. <view class="fs-28 fc-f z-3">
  174. 店铺帮扶资金 {{shopGdp}}%
  175. </view>
  176. </view>
  177. </view>
  178. </view>
  179. </view>
  180. <view class="flex-1 chart-box">
  181. <image class="chart-bg" src="/static/k2.png" mode=""></image>
  182. <view class="title-box">
  183. <image class="title-img" src="/static/rztj.png" mode=""></image>
  184. </view>
  185. <view class="flex-1 z-3">
  186. <!-- 曲线图 -->
  187. <lineVue ref="lineRef"></lineVue>
  188. </view>
  189. </view>
  190. </view>
  191. </view>
  192. </view>
  193. </template>
  194. <script>
  195. import columnVue from './components/column.vue';
  196. import lineVue from './components/line.vue';
  197. import ringVue from './components/ring.vue';
  198. import {
  199. chartShop,
  200. chartConsume,
  201. chartTotal,
  202. chartList,
  203. chartSummary
  204. } from '@/api/chart.js';
  205. export default {
  206. components: {
  207. columnVue,
  208. lineVue,
  209. ringVue
  210. },
  211. data() {
  212. return {
  213. scrollTop: 0,
  214. timer: '', //定时器
  215. listData: [],
  216. currentDate: '',
  217. currentTime: '',
  218. weekday: '',
  219. totalData: {},
  220. summaryDaya: {},
  221. shopGdp: '',
  222. userGdp: ''
  223. }
  224. },
  225. onReady() {
  226. if (window.plus) { // 仅在5+环境中有效
  227. plus.screen.lockOrientation(
  228. 'portrait-primary'); // 锁定为竖屏,如果你想锁定为横屏,可以使用 'landscape-primary' 或 'landscape-secondary'
  229. } else {
  230. // 对于非5+环境,例如H5,你可能需要使用CSS媒体查询或其他JavaScript库来处理横屏模式。
  231. }
  232. },
  233. mounted() {
  234. this.startAutoScroll();
  235. this.updateDateTime()
  236. setInterval(() => { // 每分钟更新一次日期和时间
  237. this.updateDateTime();
  238. }, 60000); // 60000毫秒 = 1分钟
  239. this.updateTime(); // 初始化时间显示
  240. setInterval(this.updateTime, 1000); // 每秒更新时间
  241. this.chartShop()
  242. this.chartConsume()
  243. this.chartTotal()
  244. this.chartList()
  245. this.chartSummary()
  246. },
  247. methods: {
  248. chartSummary() {
  249. chartSummary().then((res) => {
  250. if (res.code === 1) {
  251. this.summaryDaya = res.data
  252. this.shopGdp = ((Number(res.data.total_shop).toFixed(2) / Number(res.data.total_money)
  253. .toFixed(2)) * 100).toFixed(0)
  254. this.userGdp = ((Number(res.data.total_member).toFixed(2) / Number(res.data.total_money)
  255. .toFixed(2)) * 100).toFixed(0)
  256. this.$refs.ringRef.getServerData(res.data)
  257. }
  258. })
  259. },
  260. chartList() {
  261. chartList().then((res) => {
  262. if (res.code === 1) {
  263. this.listData = res.data.items
  264. }
  265. })
  266. },
  267. chartTotal() {
  268. chartTotal().then((res) => {
  269. this.totalData = res.data
  270. })
  271. },
  272. chartConsume() {
  273. chartConsume().then((res) => {
  274. this.$refs.columnRef.getServerData(res)
  275. })
  276. },
  277. chartShop() {
  278. chartShop().then((res) => {
  279. this.$refs.lineRef.getServerData(res.categories, res.series)
  280. })
  281. },
  282. updateTime() {
  283. this.currentTime = new Date().toLocaleTimeString(); // 更新时间,例如 "2:05:30 PM" 格式(根据地区不同)
  284. },
  285. updateDateTime() {
  286. const now = new Date();
  287. this.currentDate = now.toLocaleDateString(); // 获取日期(格式可能因地区而异)
  288. this.weekday = now.toLocaleDateString('default', {
  289. weekday: 'long'
  290. }); // 获取星期
  291. },
  292. startAutoScroll() {
  293. this.timer = setInterval(() => {
  294. this.scrollTop += 84;
  295. // console.log(this.scrollTop);
  296. // console.log(10 * 84);
  297. // 到底
  298. if (this.scrollTop >= (10 * 84)) {
  299. this.scrollTop = 0;
  300. }
  301. }, 2000);
  302. },
  303. }
  304. }
  305. </script>
  306. <style>
  307. .box {
  308. width: 100%;
  309. height: 100vh;
  310. position: relative;
  311. overflow: hidden;
  312. display: flex;
  313. flex-direction: column;
  314. }
  315. .bg-img {
  316. position: absolute;
  317. left: 0;
  318. top: 0;
  319. z-index: 1;
  320. width: 101vw;
  321. height: 102vh;
  322. }
  323. .bt-box {
  324. position: absolute;
  325. left: 0;
  326. top: 0;
  327. z-index: 1;
  328. width: 100%;
  329. height: 200rpx;
  330. }
  331. .top-box {
  332. height: 200rpx;
  333. display: flex;
  334. align-items: center;
  335. justify-content: space-between;
  336. padding: 0 86rpx;
  337. margin-bottom: 60rpx;
  338. position: relative;
  339. z-index: 2;
  340. }
  341. .top-left {
  342. display: flex;
  343. align-items: center;
  344. }
  345. .text-align-center {
  346. text-align: center;
  347. }
  348. .text-overflow-ellipsis-one {
  349. white-space: nowrap;
  350. text-overflow: ellipsis;
  351. overflow: hidden;
  352. word-break: break-all;
  353. }
  354. .fw-b {
  355. font-weight: bold;
  356. }
  357. .fc-00D5FF {
  358. color: #00D5FF;
  359. }
  360. .fc-B2D6FF {
  361. color: #B2D6FF;
  362. }
  363. .fc-f {
  364. color: #fff;
  365. }
  366. .fs-13 {
  367. font-size: 13rpx;
  368. }
  369. .fs-48 {
  370. font-size: 48rpx;
  371. }
  372. .fs-10 {
  373. font-size: 10rpx;
  374. }
  375. .fs-40 {
  376. font-size: 40rpx;
  377. }
  378. .fs-32 {
  379. font-size: 32rpx;
  380. }
  381. .fs-28 {
  382. font-size: 28rpx;
  383. }
  384. .fs-7 {
  385. font-size: 7rpx;
  386. }
  387. .fs-16 {
  388. font-size: 16rpx;
  389. }
  390. .fs-5 {
  391. font-size: 5rpx;
  392. }
  393. .fs-14 {
  394. font-size: 24rpx;
  395. }
  396. .mr-32 {
  397. margin-right: 32rpx;
  398. }
  399. .mr-6 {
  400. margin-right: 6rpx;
  401. }
  402. .mr-86 {
  403. margin-right: 86rpx;
  404. }
  405. .ml-142 {
  406. margin-left: 142rpx;
  407. }
  408. .mb-10 {
  409. margin-bottom: 10rpx;
  410. }
  411. .mb-5 {
  412. margin-bottom: 5rpx;
  413. }
  414. .mb-26 {
  415. margin-bottom: 26rpx;
  416. }
  417. .mb-56 {
  418. margin-bottom: 56rpx;
  419. }
  420. .mrl-12 {
  421. margin: 0 12rpx;
  422. }
  423. .mbt-12 {
  424. margin: 12rpx 0;
  425. }
  426. .text-align-right {
  427. text-align: right;
  428. }
  429. .flex-1 {
  430. flex: 1;
  431. }
  432. .z-3 {
  433. position: relative;
  434. z-index: 3;
  435. }
  436. .w-30 {
  437. width: 30%;
  438. }
  439. .w-20 {
  440. width: 20%;
  441. }
  442. .left-box {
  443. display: flex;
  444. flex-direction: column;
  445. }
  446. .data-box {
  447. padding: 0 112rpx 56rpx 112rpx;
  448. box-sizing: border-box;
  449. display: flex;
  450. flex: 1;
  451. }
  452. .amount-box {
  453. width: 620rpx;
  454. height: 204rpx;
  455. position: relative;
  456. padding: 20rpx 50rpx;
  457. box-sizing: border-box;
  458. display: flex;
  459. align-items: center;
  460. margin-right: 62rpx;
  461. }
  462. .amount-img {
  463. position: absolute;
  464. left: 0;
  465. top: 0;
  466. width: 100%;
  467. height: 100%;
  468. z-index: 2;
  469. }
  470. .amount-img-two {
  471. width: 168rpx;
  472. height: 168rpx;
  473. margin-right: 40rpx;
  474. }
  475. .list-box {
  476. position: relative;
  477. padding: 60rpx 40rpx;
  478. box-sizing: border-box;
  479. display: flex;
  480. flex-direction: column;
  481. margin-right: 62rpx;
  482. }
  483. .list-img {
  484. position: absolute;
  485. left: 0;
  486. top: 0;
  487. width: 100%;
  488. height: 100%;
  489. z-index: 2;
  490. }
  491. .right-box {
  492. display: flex;
  493. flex-direction: column;
  494. }
  495. .chart-box {
  496. position: relative;
  497. padding: 40rpx;
  498. box-sizing: border-box;
  499. display: flex;
  500. flex-direction: column;
  501. }
  502. .chart-bg {
  503. position: absolute;
  504. left: 0;
  505. top: 0;
  506. width: 100%;
  507. height: 100%;
  508. z-index: 2;
  509. }
  510. .title-box {
  511. position: relative;
  512. width: 1404rpx;
  513. height: 78rpx;
  514. }
  515. .title-img {
  516. position: absolute;
  517. top: 0;
  518. bottom: 0;
  519. width: 100%;
  520. height: 100%;
  521. z-index: 2;
  522. }
  523. .title-right {
  524. text-align: right;
  525. position: relative;
  526. top: 20rpx;
  527. z-index: 2;
  528. }
  529. .bfje-num {
  530. position: absolute;
  531. top: 0;
  532. right: 0;
  533. border-radius: 2rpx;
  534. border-image: linear-gradient(90deg, rgba(113, 203, 255, 0.5), rgba(0, 161, 255, 0.05)) 0 0;
  535. z-index: 2;
  536. }
  537. .bfje-title {
  538. display: flex;
  539. align-items: center;
  540. margin-bottom: 1rpx;
  541. }
  542. .bf-img {
  543. width: 32rpx;
  544. height: 32rpx;
  545. margin-right: 1rpx;
  546. }
  547. .tj-box {
  548. display: flex;
  549. align-items: center;
  550. justify-content: center;
  551. }
  552. .bf-box {
  553. width: 376rpx;
  554. height: auto;
  555. }
  556. .bf-num {
  557. width: 376rpx;
  558. height: 180rpx;
  559. position: relative;
  560. margin-bottom: 24rpx;
  561. }
  562. .bf-title {
  563. width: 100%;
  564. height: 56rpx;
  565. display: flex;
  566. align-items: center;
  567. justify-content: center;
  568. position: relative;
  569. }
  570. .yh-bg {
  571. position: absolute;
  572. top: 0;
  573. height: 0;
  574. width: 100%;
  575. height: 100%;
  576. z-index: 2;
  577. }
  578. .yh-img {
  579. width: 36rpx;
  580. height: 36rpx;
  581. margin-right: 1rpx;
  582. }
  583. .yhbf-img {
  584. position: absolute;
  585. left: 0;
  586. top: 0;
  587. width: 100%;
  588. height: 100%;
  589. z-index: 2;
  590. }
  591. .hx-box {
  592. width: 280rpx;
  593. height: 280rpx;
  594. }
  595. .scroll-view-css {
  596. width: 100%;
  597. height: 1060rpx;
  598. overflow: auto;
  599. }
  600. .scroll-view-css ::-webkit-scrollbar {
  601. display: none;
  602. }
  603. .item-box {
  604. width: 100%;
  605. height: 136rpx;
  606. background: rgba(0, 161, 255, 0.05);
  607. border-radius: 48rpx;
  608. margin-bottom: 32rpx;
  609. padding: 28rpx 48rpx;
  610. box-sizing: border-box;
  611. display: flex;
  612. align-items: center;
  613. justify-content: space-between;
  614. }
  615. .user-box {
  616. display: flex;
  617. align-items: center;
  618. }
  619. .user-img {
  620. width: 80rpx;
  621. height: 80rpx;
  622. border-radius: 50%;
  623. margin-right: 16rpx;
  624. }
  625. .column-box {
  626. padding: 40rpx 0 28rpx;
  627. box-sizing: border-box;
  628. }
  629. .w-max-441 {
  630. max-width: 100rpx;
  631. }
  632. .w-90 {
  633. max-width: 90%;
  634. }
  635. </style>