index.vue 15 KB

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