index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  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">
  74. <image class="user-img" :src="item.head_img" mode=""></image>
  75. <view class="">
  76. <view class="fs-32 fc-f text-overflow-ellipsis-one w-max-441">
  77. {{item.nickname}}
  78. </view>
  79. <view class="fs-28 fc-B2D6FF">
  80. 消费者
  81. </view>
  82. </view>
  83. </view>
  84. <view class="">
  85. <view class="fs-32 fc-f">
  86. {{item.shop_name}}
  87. </view>
  88. <view class="fs-28 fc-B2D6FF">
  89. 消费门店
  90. </view>
  91. </view>
  92. <view class="">
  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="">
  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. 27998.00
  140. </view>
  141. </view>
  142. </view>
  143. <view class="flex-1 tj-box">
  144. <view class="hx-box z-3">
  145. <!-- 环形图 -->
  146. <ringVue></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. ¥8999.00
  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. 用户帮扶资金 40%
  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. ¥18999.00
  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. 店铺帮扶资金 60%
  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. } from '@/api/chart.js';
  204. export default {
  205. components: {
  206. columnVue,
  207. lineVue,
  208. ringVue
  209. },
  210. data() {
  211. return {
  212. scrollTop: 0,
  213. timer: '', //定时器
  214. listData: [],
  215. currentDate: '',
  216. currentTime: '',
  217. weekday: '',
  218. totalData: {}
  219. }
  220. },
  221. mounted() {
  222. this.startAutoScroll();
  223. this.updateDateTime()
  224. setInterval(() => { // 每分钟更新一次日期和时间
  225. this.updateDateTime();
  226. }, 60000); // 60000毫秒 = 1分钟
  227. this.updateTime(); // 初始化时间显示
  228. setInterval(this.updateTime, 1000); // 每秒更新时间
  229. this.chartShop()
  230. this.chartConsume()
  231. this.chartTotal()
  232. this.chartList()
  233. },
  234. methods: {
  235. chartList() {
  236. chartList().then((res) => {
  237. if (res.code === 1) {
  238. this.listData = res.data.items
  239. }
  240. })
  241. },
  242. chartTotal() {
  243. chartTotal().then((res) => {
  244. this.totalData = res.data
  245. })
  246. },
  247. chartConsume() {
  248. chartConsume().then((res) => {
  249. this.$refs.columnRef.getServerData(res)
  250. })
  251. },
  252. chartShop() {
  253. chartShop().then((res) => {
  254. this.$refs.lineRef.getServerData(res.categories, res.series)
  255. })
  256. },
  257. updateTime() {
  258. this.currentTime = new Date().toLocaleTimeString(); // 更新时间,例如 "2:05:30 PM" 格式(根据地区不同)
  259. },
  260. updateDateTime() {
  261. const now = new Date();
  262. this.currentDate = now.toLocaleDateString(); // 获取日期(格式可能因地区而异)
  263. this.weekday = now.toLocaleDateString('default', {
  264. weekday: 'long'
  265. }); // 获取星期
  266. },
  267. startAutoScroll() {
  268. this.timer = setInterval(() => {
  269. this.scrollTop += 84;
  270. // console.log(this.scrollTop);
  271. // console.log(10 * 84);
  272. // 到底
  273. if (this.scrollTop >= (10 * 84)) {
  274. this.scrollTop = 0;
  275. }
  276. }, 2000);
  277. },
  278. }
  279. }
  280. </script>
  281. <style>
  282. .box {
  283. width: 100%;
  284. height: 100vh;
  285. position: relative;
  286. overflow: hidden;
  287. display: flex;
  288. flex-direction: column;
  289. }
  290. .bg-img {
  291. position: absolute;
  292. left: 0;
  293. top: 0;
  294. z-index: 1;
  295. width: 101vw;
  296. height: 102vh;
  297. }
  298. .bt-box {
  299. position: absolute;
  300. left: 0;
  301. top: 0;
  302. z-index: 1;
  303. width: 100%;
  304. height: 200rpx;
  305. }
  306. .top-box {
  307. height: 200rpx;
  308. display: flex;
  309. align-items: center;
  310. justify-content: space-between;
  311. padding: 0 86rpx;
  312. margin-bottom: 60rpx;
  313. position: relative;
  314. z-index: 2;
  315. }
  316. .top-left {
  317. display: flex;
  318. align-items: center;
  319. }
  320. .text-align-center {
  321. text-align: center;
  322. }
  323. .text-overflow-ellipsis-one {
  324. white-space: nowrap;
  325. text-overflow: ellipsis;
  326. overflow: hidden;
  327. word-break: break-all;
  328. }
  329. .fw-b {
  330. font-weight: bold;
  331. }
  332. .fc-00D5FF {
  333. color: #00D5FF;
  334. }
  335. .fc-B2D6FF {
  336. color: #B2D6FF;
  337. }
  338. .fc-f {
  339. color: #fff;
  340. }
  341. .fs-13 {
  342. font-size: 13rpx;
  343. }
  344. .fs-48 {
  345. font-size: 48rpx;
  346. }
  347. .fs-10 {
  348. font-size: 10rpx;
  349. }
  350. .fs-40 {
  351. font-size: 40rpx;
  352. }
  353. .fs-32 {
  354. font-size: 32rpx;
  355. }
  356. .fs-28 {
  357. font-size: 28rpx;
  358. }
  359. .fs-7 {
  360. font-size: 7rpx;
  361. }
  362. .fs-16 {
  363. font-size: 16rpx;
  364. }
  365. .fs-5 {
  366. font-size: 5rpx;
  367. }
  368. .fs-14 {
  369. font-size: 24rpx;
  370. }
  371. .mr-32 {
  372. margin-right: 32rpx;
  373. }
  374. .mr-6 {
  375. margin-right: 6rpx;
  376. }
  377. .mr-86 {
  378. margin-right: 86rpx;
  379. }
  380. .ml-142 {
  381. margin-left: 142rpx;
  382. }
  383. .mb-10 {
  384. margin-bottom: 10rpx;
  385. }
  386. .mb-5 {
  387. margin-bottom: 5rpx;
  388. }
  389. .mb-26 {
  390. margin-bottom: 26rpx;
  391. }
  392. .mb-56 {
  393. margin-bottom: 56rpx;
  394. }
  395. .mrl-12 {
  396. margin: 0 12rpx;
  397. }
  398. .mbt-12 {
  399. margin: 12rpx 0;
  400. }
  401. .text-align-right {
  402. text-align: right;
  403. }
  404. .flex-1 {
  405. flex: 1;
  406. }
  407. .z-3 {
  408. position: relative;
  409. z-index: 3;
  410. }
  411. .left-box {
  412. display: flex;
  413. flex-direction: column;
  414. }
  415. .data-box {
  416. padding: 0 112rpx 56rpx 112rpx;
  417. box-sizing: border-box;
  418. display: flex;
  419. flex: 1;
  420. }
  421. .amount-box {
  422. width: 620rpx;
  423. height: 204rpx;
  424. position: relative;
  425. padding: 20rpx 50rpx;
  426. box-sizing: border-box;
  427. display: flex;
  428. align-items: center;
  429. margin-right: 62rpx;
  430. }
  431. .amount-img {
  432. position: absolute;
  433. left: 0;
  434. top: 0;
  435. width: 100%;
  436. height: 100%;
  437. z-index: 2;
  438. }
  439. .amount-img-two {
  440. width: 168rpx;
  441. height: 168rpx;
  442. margin-right: 40rpx;
  443. }
  444. .list-box {
  445. position: relative;
  446. padding: 60rpx 40rpx;
  447. box-sizing: border-box;
  448. display: flex;
  449. flex-direction: column;
  450. margin-right: 62rpx;
  451. }
  452. .list-img {
  453. position: absolute;
  454. left: 0;
  455. top: 0;
  456. width: 100%;
  457. height: 100%;
  458. z-index: 2;
  459. }
  460. .right-box {
  461. display: flex;
  462. flex-direction: column;
  463. }
  464. .chart-box {
  465. position: relative;
  466. padding: 40rpx;
  467. box-sizing: border-box;
  468. display: flex;
  469. flex-direction: column;
  470. }
  471. .chart-bg {
  472. position: absolute;
  473. left: 0;
  474. top: 0;
  475. width: 100%;
  476. height: 100%;
  477. z-index: 2;
  478. }
  479. .title-box {
  480. position: relative;
  481. width: 1404rpx;
  482. height: 78rpx;
  483. }
  484. .title-img {
  485. position: absolute;
  486. top: 0;
  487. bottom: 0;
  488. width: 100%;
  489. height: 100%;
  490. z-index: 2;
  491. }
  492. .title-right {
  493. text-align: right;
  494. position: relative;
  495. top: 20rpx;
  496. z-index: 2;
  497. }
  498. .bfje-num {
  499. position: absolute;
  500. top: 0;
  501. right: 0;
  502. border-radius: 2rpx;
  503. border-image: linear-gradient(90deg, rgba(113, 203, 255, 0.5), rgba(0, 161, 255, 0.05)) 0 0;
  504. z-index: 2;
  505. }
  506. .bfje-title {
  507. display: flex;
  508. align-items: center;
  509. margin-bottom: 1rpx;
  510. }
  511. .bf-img {
  512. width: 32rpx;
  513. height: 32rpx;
  514. margin-right: 1rpx;
  515. }
  516. .tj-box {
  517. display: flex;
  518. align-items: center;
  519. justify-content: center;
  520. }
  521. .bf-box {
  522. width: 376rpx;
  523. height: auto;
  524. }
  525. .bf-num {
  526. width: 376rpx;
  527. height: 180rpx;
  528. position: relative;
  529. margin-bottom: 24rpx;
  530. }
  531. .bf-title {
  532. width: 100%;
  533. height: 56rpx;
  534. display: flex;
  535. align-items: center;
  536. justify-content: center;
  537. position: relative;
  538. }
  539. .yh-bg {
  540. position: absolute;
  541. top: 0;
  542. height: 0;
  543. width: 100%;
  544. height: 100%;
  545. z-index: 2;
  546. }
  547. .yh-img {
  548. width: 36rpx;
  549. height: 36rpx;
  550. margin-right: 1rpx;
  551. }
  552. .yhbf-img {
  553. position: absolute;
  554. left: 0;
  555. top: 0;
  556. width: 100%;
  557. height: 100%;
  558. z-index: 2;
  559. }
  560. .hx-box {
  561. width: 280rpx;
  562. height: 280rpx;
  563. }
  564. .scroll-view-css {
  565. width: 100%;
  566. height: 1060rpx;
  567. overflow: auto;
  568. }
  569. .scroll-view-css ::-webkit-scrollbar {
  570. display: none;
  571. }
  572. .item-box {
  573. width: 100%;
  574. height: 136rpx;
  575. background: rgba(0, 161, 255, 0.05);
  576. border-radius: 48rpx;
  577. margin-bottom: 32rpx;
  578. padding: 28rpx 48rpx;
  579. box-sizing: border-box;
  580. display: flex;
  581. align-items: center;
  582. justify-content: space-between;
  583. }
  584. .user-box {
  585. display: flex;
  586. align-items: center;
  587. }
  588. .user-img {
  589. width: 80rpx;
  590. height: 80rpx;
  591. border-radius: 50%;
  592. margin-right: 16rpx;
  593. }
  594. .column-box {
  595. padding: 40rpx 0 28rpx;
  596. box-sizing: border-box;
  597. }
  598. .w-max-441{
  599. max-width: 100rpx;
  600. }
  601. </style>