index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. <template>
  2. <view v-if="isLogin">
  3. <!-- 背景图 -->
  4. <view class="index-bg">
  5. <image src="../../static/pages/images/self/indexBg.png"></image>
  6. </view>
  7. <!-- 数据 -->
  8. <view class="data-box">
  9. <view>
  10. <view class="ljsy">{{statisticData.totalProfit?statisticData.totalProfit:0}}</view>
  11. <view class="ljsy-label">累计收益(元)</view>
  12. </view>
  13. <view class="jy ddflex">
  14. <view>
  15. <view class="jy-data">{{statisticData.todayOrderCount?statisticData.todayOrderCount:0}}</view>
  16. <view class="jy-label">今日订单数</view>
  17. </view>
  18. <view class="jy-line"></view>
  19. <view>
  20. <view class="jy-data"><text style="font-size: 22rpx;font-weight: 400;">¥</text>{{statisticData.todayTurnover?statisticData.todayTurnover:0}}</view>
  21. <view class="jy-label">今日营业额</view>
  22. </view>
  23. <view class="jy-line"></view>
  24. <view>
  25. <view class="jy-data"><text style="font-size: 22rpx;font-weight: 400;">¥</text>{{statisticData.todayProfit?statisticData.todayProfit:0}}</view>
  26. <view class="jy-label">今日收益额</view>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 总数 -->
  31. <view class="total-box ddflex">
  32. <view class="fflex" v-if="!userInfo.storeId">
  33. <view class="total-label">商家总数</view>
  34. <view class="total-data">{{statisticData.merchantCount?statisticData.merchantCount:0}}</view>
  35. </view>
  36. <view v-if="!userInfo.storeId" class="total-data-line"></view>
  37. <view class="fflex" v-if="!userInfo.storeId">
  38. <view class="total-label">门店总数</view>
  39. <view class="total-data">{{statisticData.storeCount?statisticData.storeCount:0}}</view>
  40. </view>
  41. <view v-if="!userInfo.storeId" class="total-data-line"></view>
  42. <view class="fflex">
  43. <view class="total-label">设备总数</view>
  44. <view class="total-data">{{statisticData.batteryCount?statisticData.batteryCount:0}}</view>
  45. </view>
  46. <view class="total-data-line"></view>
  47. <view class="fflex">
  48. <view class="total-label">订单总数</view>
  49. <view class="total-data">{{statisticData.totalOrderCount?statisticData.totalOrderCount:0}}</view>
  50. </view>
  51. </view>
  52. <!-- nav -->
  53. <view v-if="!userInfo.storeId" class="nav-box ddflex">
  54. <view class="nav-item" @click="jumpUrl('/pages/myStore/myStore')">
  55. <image class="nav-item-icon" src="../../static/pages/images/wdsj.png"></image>
  56. <view class="nav-item-title">我的商家</view>
  57. </view>
  58. <view class="nav-item" @click="jumpUrl('/pages/myMerchant/myMerchant')">
  59. <image class="nav-item-icon" src="../../static/pages/images/wdmd.png"></image>
  60. <view class="nav-item-title">我的门店</view>
  61. </view>
  62. <view class="nav-item" v-if="!userInfo.storeId&&!userInfo.merchantId" @click="jumpUrl('/mine/myUser/myUser')">
  63. <image class="nav-item-icon" src="../../static/pages/images/wdyh.png"></image>
  64. <view class="nav-item-title">我的用户</view>
  65. </view>
  66. <view class="nav-item" @click="jumpUrl('/pages/operationData/operationData')">
  67. <image class="nav-item-icon" src="../../static/pages/images/yysj.png"></image>
  68. <view class="nav-item-title">运营数据</view>
  69. </view>
  70. </view>
  71. <view v-if="userInfo.storeId" class="nav-box ddflex" style="padding: 10rpx 30rpx;justify-content: space-between;" @click="jumpUrl('/pages/operationData/operationData')">
  72. <view class="nav-item ddflex">
  73. <image class="nav-item-icon" src="../../static/pages/images/yysj.png"></image>
  74. <view class="nav-item-title">运营数据</view>
  75. </view>
  76. <image style="width: 36rpx;height:36rpx;" src="../../static/pages/images/ssicon.png"></image>
  77. </view>
  78. <!-- 图表统计 -->
  79. <view class="echart-box">
  80. <view class="echart-box-header ddflex">
  81. <view class="echart-box-title">交易趋势</view>
  82. <view class="echart-box-timeType ddflex">
  83. <view :class="'echart-box-timeType-item '+(timeType==1?'echart-box-timeType-item-acitve':'')"
  84. @click="timeTypeChange(1)">今日</view>
  85. <view :class="'echart-box-timeType-item '+(timeType==2?'echart-box-timeType-item-acitve':'')"
  86. @click="timeTypeChange(2)">近7日</view>
  87. <view :class="'echart-box-timeType-item '+(timeType==3?'echart-box-timeType-item-acitve':'')"
  88. @click="timeTypeChange(3)">近30日</view>
  89. </view>
  90. </view>
  91. <view style="height:500rpx">
  92. <l-echart ref="chart" @finished="init"></l-echart>
  93. </view>
  94. </view>
  95. <!-- 图表统计 -->
  96. <view class="echart-box" v-if="!userInfo.storeId">
  97. <view class="echart-box-header ddflex">
  98. <view class="echart-box-title">营业额排名</view>
  99. <!-- <view class="echart-box-timeType ddflex">
  100. <view :class="'echart-box-timeType-item '+(storeType==1?'echart-box-timeType-item-acitve':'')"
  101. @click="storeTypeChange(1)">商户</view>
  102. <view :class="'echart-box-timeType-item '+(storeType==2?'echart-box-timeType-item-acitve':'')"
  103. @click="storeTypeChange(2)">门店</view>
  104. </view> -->
  105. </view>
  106. <view>
  107. <l-echart ref="chart2" @finished="init"></l-echart>
  108. </view>
  109. </view>
  110. <!-- 图表统计 -->
  111. <view class="echart-box">
  112. <view class="echart-box-header ddflex">
  113. <view class="echart-box-title">设备状态</view>
  114. </view>
  115. <view class="ddflex">
  116. <view class="fflex" style="height: 250rpx;">
  117. <l-echart ref="chart4" @finished="init"></l-echart>
  118. </view>
  119. <view class="fflex" style="height: 250rpx;">
  120. <l-echart ref="chart5" @finished="init"></l-echart>
  121. </view>
  122. <view class="fflex" style="height: 250rpx;">
  123. <l-echart ref="chart6" @finished="init"></l-echart>
  124. </view>
  125. </view>
  126. <view class="echart-line"></view>
  127. <view class="ddflex">
  128. <view style="width: 100%;height: 300rpx;">
  129. <l-echart ref="chart3" @finished="init"></l-echart>
  130. </view>
  131. </view>
  132. </view>
  133. <view class="guide" @tap="hideGuide" v-if="first">
  134. <image src="/static/pages/images/guide.png" mode="widthFix"></image>
  135. </view>
  136. <foot channel="home" :isUpdate="isUpdate"></foot>
  137. </view>
  138. <view v-else>
  139. <view class="wei-login" v-if="!isLogin">
  140. <image :src="picUrlss + 'wei_login.png'"></image>
  141. <view>暂未登录</view>
  142. <navigator url="/pages/authorize/authorize" hover-class="none" class="cart-login">立即登录</navigator>
  143. </view>
  144. <foot channel="home" :isUpdate="isUpdate"></foot>
  145. </view>
  146. </template>
  147. <script>
  148. //index.js
  149. //获取应用实例
  150. const app = getApp();
  151. const req = require('../../utils/request.js');
  152. const api = require('../../utils/api.js');
  153. const utils = require('../../utils/util.js');
  154. const mes = require('../../utils/requestmessage.js');
  155. const route = require('../../utils/route');
  156. const QQMapWX = require("../../utils/qqmap.js");
  157. import foot from '../../components/nav-bar/index';
  158. import footerCopyright from '../../components/footer-copyright/footer-copyright';
  159. import LEchart from '../../components/l-echart/l-echart.vue';
  160. import * as echarts from '../../utils/echarts.min.js'
  161. export default {
  162. data() {
  163. return {
  164. picUrlss: req.public.picUrls,
  165. systems: {},
  166. bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
  167. pxToRpxScale: 0,
  168. rpxTopxScale: 0,
  169. isLogin:false,
  170. timeType: 1, //统计时间 1.按日 2.按月 3.按季度
  171. storeType:1,//营业额查询1.商家 2.门店
  172. statisticData:{},//统计数据
  173. echartData:{},//曲线图
  174. storeRanking:{},//营业额排行
  175. userInfo:{},
  176. // 交易趋势图表数据
  177. option: {
  178. tooltip: {
  179. trigger: 'axis',
  180. axisPointer: {
  181. type: 'shadow'
  182. },
  183. confine: true
  184. },
  185. legend: {
  186. data: ['订单数', '订单金额','收益金额'],
  187. x: 'center', //可设定图例在左、右、居中
  188. y: 'top', //可设定图例在上、下、居中
  189. padding: [15, 0, 0, 0]
  190. },
  191. grid: {
  192. left: 0,
  193. right: 8,
  194. bottom: 5,
  195. top: 45,
  196. containLabel: true
  197. },
  198. xAxis: [{
  199. type: 'category',
  200. data: [],
  201. axisLine: {
  202. lineStyle: {
  203. color: '#999999'
  204. }
  205. },
  206. axisLabel: {
  207. color: '#666666',
  208. // interval: 0,
  209. }
  210. }],
  211. yAxis: [{
  212. type: 'value',
  213. axisTick: {
  214. show: false
  215. },
  216. axisLine: {
  217. lineStyle: {
  218. color: '#999999'
  219. }
  220. },
  221. axisLabel: {
  222. color: '#666666'
  223. }
  224. }],
  225. series: [{
  226. name: '订单数',
  227. type: 'line',
  228. data: [],
  229. showSymbol: false,
  230. smooth: true,
  231. itemStyle: {
  232. // 颜色
  233. color: '#5F50E6',
  234. // 给bar设置倒角
  235. barBorderRadius: [15, 15, 0, 0]
  236. }
  237. },
  238. {
  239. name: '订单金额',
  240. type: 'line',
  241. data: [],
  242. showSymbol: false,
  243. smooth: true,
  244. itemStyle: {
  245. // 颜色
  246. color: '#FF7D00',
  247. // 给bar设置倒角
  248. barBorderRadius: [15, 15, 0, 0]
  249. }
  250. },
  251. {
  252. name: '收益金额',
  253. type: 'line',
  254. data: [],
  255. showSymbol: false,
  256. smooth: true,
  257. itemStyle: {
  258. // 颜色
  259. color: '#FFDC0F',
  260. // 给bar设置倒角
  261. barBorderRadius: [15, 15, 0, 0]
  262. }
  263. },
  264. ]
  265. },
  266. // 商家营业额排名
  267. option2: {
  268. tooltip: {
  269. show:false,
  270. trigger: 'axis',
  271. axisPointer: {
  272. type: 'shadow'
  273. },
  274. confine: true
  275. },
  276. grid: {
  277. left: 0,
  278. right: 5,
  279. bottom: 10,
  280. top: 40,
  281. containLabel: true
  282. },
  283. xAxis: [{
  284. type: 'value',
  285. // data: [],
  286. show: false,
  287. axisLine: {
  288. lineStyle: {
  289. color: '#999999'
  290. }
  291. },
  292. axisLabel: {
  293. color: '#666666',
  294. // interval: 0,
  295. },
  296. splitLine:{
  297. show:false // 不显示网格线
  298. },
  299. }],
  300. yAxis: [{
  301. type: 'category',
  302. axisTick: {
  303. show: false
  304. },
  305. data: [],
  306. axisLine: {
  307. lineStyle: {
  308. color: '#999999'
  309. },
  310. show: false,
  311. },
  312. axisLabel: {
  313. color: '#666666',
  314. // inside:true,
  315. width:10,
  316. padding: [-20, 0, 0, -4],
  317. verticalAlign:'top',
  318. align:'left',
  319. inside:true
  320. },
  321. }],
  322. series: [{
  323. name: '营业额',
  324. type: 'bar',
  325. label: {
  326. normal: {
  327. show: true,
  328. position: 'right',
  329. color: '#4c4a4a',
  330. formatter:'¥{c}',
  331. padding: [-20, 5, 0, -100],
  332. verticalAlign:'top',
  333. align:'right'
  334. },
  335. },
  336. data: [],
  337. barWidth: 5,
  338. itemStyle: {
  339. // 颜色
  340. color: '#FF770F',
  341. // 给bar设置倒角
  342. barBorderRadius: [15, 15, 15, 15]
  343. }
  344. }]
  345. },
  346. // 设备状态
  347. option3: {
  348. title: {
  349. text: '设备出租比例',
  350. textStyle: {
  351. fontSize: 14
  352. },
  353. left: '70%',
  354. top: '30%'
  355. },
  356. tooltip: {
  357. trigger: 'axis',
  358. axisPointer: {
  359. type: 'shadow'
  360. },
  361. confine: true
  362. },
  363. legend: {
  364. data: ['已租', '未租'],
  365. x: 'right', //可设定图例在左、右、居中
  366. y: '50%', //可设定图例在上、下、居中
  367. itemHeight:5,
  368. itemWidth:20
  369. },
  370. grid: {
  371. left: 0,
  372. containLabel: true
  373. },
  374. series: [{
  375. name: '设备出租比例',
  376. type: 'pie',
  377. center: ['30%', '50%'],
  378. radius: ['60%', '80%'],
  379. label: {
  380. show: false
  381. },
  382. data: [{
  383. value: 1055,
  384. name: '未租',
  385. itemStyle: {
  386. color: "#FF770F"
  387. }
  388. },
  389. {
  390. value: 735,
  391. name: '已租',
  392. itemStyle: {
  393. color: "#EAECF5"
  394. }
  395. }
  396. ]
  397. }]
  398. },
  399. // 已租设备
  400. option4: {
  401. tooltip: {
  402. show:false
  403. },
  404. title: {
  405. text: '已租设备',
  406. textStyle: {
  407. fontSize: 14,
  408. fontWeight: 500
  409. },
  410. left: 'center',
  411. bottom: '0'
  412. },
  413. series: [{
  414. type: 'pie',
  415. radius: ['60%', '70%'],
  416. silent:true,
  417. label: {
  418. normal: {
  419. show: true,
  420. position: 'center',
  421. color: '#4c4a4a',
  422. formatter:'{c}',
  423. },
  424. emphasis: { //中间文字显示 
  425. show: true,
  426. textStyle:{
  427. }
  428. }
  429. },
  430. data: [{
  431. value: 1055,
  432. name: '已租',
  433. itemStyle: {
  434. color: "#0FCB27"
  435. }
  436. },
  437. {
  438. value: 735,
  439. name: '未租',
  440. itemStyle: {
  441. color: "#EAECF5"
  442. }
  443. }
  444. ]
  445. }]
  446. },
  447. // 未租设备
  448. option5: {
  449. title: {
  450. text: '未租设备',
  451. textStyle: {
  452. fontSize: 14,
  453. fontWeight: 500
  454. },
  455. left: 'center',
  456. bottom: '0'
  457. },
  458. series: [{
  459. type: 'pie',
  460. center: ['50%', '50%'],
  461. radius: ['60%', '70%'],
  462. silent:true,
  463. label: {
  464. normal: {
  465. show: true,
  466. position: 'center',
  467. color: '#4c4a4a',
  468. formatter:'{c}',
  469. },
  470. emphasis: { //中间文字显示 
  471. show: true,
  472. textStyle:{
  473. }
  474. }
  475. },
  476. data: [{
  477. value: 1055,
  478. name: '未租设备',
  479. itemStyle: {
  480. color: "#666464"
  481. }
  482. },
  483. {
  484. value: 735,
  485. name: '已租设备',
  486. itemStyle: {
  487. color: "#EAECF5"
  488. }
  489. }
  490. ]
  491. }]
  492. },
  493. // 到期设备
  494. option6: {
  495. title: {
  496. text: '到期设备',
  497. textStyle: {
  498. fontSize: 14,
  499. fontWeight: 500
  500. },
  501. left: 'center',
  502. bottom: '0'
  503. },
  504. series: [{
  505. type: 'pie',
  506. center: ['50%', '50%'],
  507. radius: ['60%', '70%'],
  508. silent:true,
  509. label: {
  510. normal: {
  511. show: true,
  512. position: 'center',
  513. color: '#4c4a4a',
  514. formatter:'{c}',
  515. },
  516. emphasis: { //中间文字显示 
  517. show: true,
  518. textStyle:{
  519. }
  520. }
  521. },
  522. data: [{
  523. value: 1055,
  524. name: '到期',
  525. itemStyle: {
  526. color: "#FF770F"
  527. }
  528. },
  529. {
  530. value: 735,
  531. name: '未到期',
  532. itemStyle: {
  533. color: "#EAECF5"
  534. }
  535. }
  536. ]
  537. }]
  538. },
  539. };
  540. },
  541. components: {
  542. foot,
  543. footerCopyright,
  544. LEchart
  545. },
  546. props: {},
  547. onLoad: async function(options) {
  548. },
  549. async onShow() {
  550. if(req.isLogins(false)){
  551. console.log('req.isLogins', true)
  552. this.isLogin = true
  553. await this.getUserInfo()
  554. await this.getEchartData()
  555. await this.getStatisticData()
  556. if(!this.userInfo.storeId)
  557. await this.getStoreData()
  558. this.init()
  559. }else{
  560. console.log('req.isLogins', false)
  561. this.isLogin = false
  562. }
  563. },
  564. onUnload() {},
  565. onHide() {},
  566. onReachBottom() {},
  567. onShareAppMessage() {
  568. },
  569. methods: {
  570. jumpUrl(url){
  571. if(req.isLogins(true)){
  572. uni.navigateTo({
  573. url:url
  574. })
  575. }
  576. },
  577. // 统计时间切换
  578. async timeTypeChange(val) {
  579. if (this.timeType == val) return false
  580. this.timeType = val
  581. await this.getEchartData()
  582. this.init()
  583. },
  584. // 营业额切换
  585. async storeTypeChange(val) {
  586. if (this.storeType == val) return false
  587. this.storeType = val
  588. await this.getStoreData()
  589. this.init()
  590. },
  591. init() {
  592. this.$refs.chart.init(echarts, async chart => {
  593. // let echartData = await this.getEchartData()
  594. this.option.yAxis[0].axisLabel.fontSize = 13 * this.rpxTopxScale
  595. this.option.xAxis[0].axisLabel.fontSize = 13 * this.rpxTopxScale
  596. this.option.legend.itemHeight = 10 * this.rpxTopxScale
  597. this.option.legend.itemWidth = 40 * this.rpxTopxScale
  598. if(this.echartData.orderList.length>0){
  599. this.option.xAxis[0].data = this.echartData.orderList.map(item=>{return item.showTime})
  600. this.option.series[0].data = this.echartData.orderList.map(item=>{return item.orderCount})
  601. }else{
  602. this.option.xAxis[0].data = []
  603. this.option.series[0].data = []
  604. }
  605. if(this.echartData.profitList.length>0){
  606. this.option.series[1].data = this.echartData.profitList.map(item=>{return item.profit})
  607. }else{
  608. this.option.series[1].data = []
  609. }
  610. if(this.echartData.turnoverList.length>0){
  611. this.option.series[2].data = this.echartData.turnoverList.map(item=>{return item.turnover})
  612. }else{
  613. this.option.series[2].data = []
  614. }
  615. chart.setOption(this.option);
  616. });
  617. if (this.$refs.chart2) {
  618. this.$refs.chart2.init(echarts, async chart => {
  619. // let echartData = await this.getEchartData()
  620. if(this.storeRanking.length>0){
  621. this.storeRanking = this.storeRanking.reverse()
  622. this.option2.yAxis[0].data = this.storeRanking.map(item=>{return item.turnover?item.name:''})
  623. this.option2.series[0].data = this.storeRanking.map(item=>{return item.turnover})
  624. }else{
  625. this.option2.yAxis[0].data = []
  626. this.option2.series[0].data = []
  627. }
  628. chart.setOption(this.option2);
  629. });
  630. }
  631. if (this.$refs.chart3) {
  632. this.$refs.chart3.init(echarts, async chart => {
  633. this.option3.title.textStyle.fontSize = 28 * this.rpxTopxScale
  634. this.option3.legend.itemHeight = 10 * this.rpxTopxScale
  635. this.option3.legend.itemWidth = 40 * this.rpxTopxScale
  636. this.option3.series[0].data[0].value = this.statisticData.noLeaseCount
  637. this.option3.series[0].data[1].value = this.statisticData.leaseCount
  638. chart.setOption(this.option3);
  639. });
  640. }
  641. if (this.$refs.chart4) {
  642. this.$refs.chart4.init(echarts, async chart => {
  643. this.option4.title.textStyle.fontSize = 24 * this.rpxTopxScale
  644. this.option4.series[0].data[0].value = this.statisticData.leaseCount
  645. this.option4.series[0].data[1].value = this.statisticData.noLeaseCount
  646. this.option4.series[0].label.normal.formatter = ()=>{return this.statisticData.leaseCount}
  647. chart.setOption(this.option4);
  648. });
  649. }
  650. if (this.$refs.chart5) {
  651. this.$refs.chart5.init(echarts, async chart => {
  652. this.option5.title.textStyle.fontSize = 24 * this.rpxTopxScale
  653. this.option5.series[0].data[0].value = this.statisticData.noLeaseCount
  654. this.option5.series[0].data[1].value = this.statisticData.leaseCount
  655. this.option4.series[0].label.normal.formatter = ()=>{return this.statisticData.noLeaseCount}
  656. chart.setOption(this.option5);
  657. });
  658. }
  659. if (this.$refs.chart6) {
  660. this.$refs.chart6.init(echarts, async chart => {
  661. this.option6.title.textStyle.fontSize = 24 * this.rpxTopxScale
  662. this.option6.series[0].data[0].value = this.statisticData.expireCount
  663. this.option6.series[0].data[1].value =Number(this.statisticData.batteryCount) - Number(this.statisticData.leaseCount)
  664. this.option6.series[0].label.normal.formatter = ()=>{return this.statisticData.expireCount}
  665. chart.setOption(this.option6);
  666. });
  667. }
  668. },
  669. // 获取图表数据
  670. getEchartData() {
  671. return new Promise((r, j) => {
  672. req.getRequest('/admin/v2/statistic/chart', {type: this.timeType}, res => {
  673. this.echartData = res
  674. console.log('statistic chart', res)
  675. r(res)
  676. })
  677. })
  678. },
  679. // 获取营业额数据
  680. getStoreData() {
  681. return new Promise((r, j) => {
  682. req.getRequest('/admin/v2/statistic/ranking', {type: this.storeType}, res => {
  683. this.storeRanking = res
  684. console.log('statistic ranking', res)
  685. r(res)
  686. })
  687. })
  688. },
  689. // 获取图表数据
  690. getStatisticData() {
  691. return new Promise((r, j) => {
  692. req.getRequest('/admin/v2/statistic/top', {}, res => {
  693. console.log('statistic top', res)
  694. this.statisticData = res
  695. r(res)
  696. })
  697. })
  698. },
  699. // 获取当前用户
  700. getUserInfo(){
  701. return new Promise((r, j) => {
  702. req.getRequest('/admin/v2/userInfo',{},res=>{
  703. this.userInfo = res
  704. r(res)
  705. })
  706. })
  707. }
  708. },
  709. mounted() {
  710. const systemInfo = uni.getSystemInfoSync();
  711. // px转换到rpx的比例
  712. let pxToRpxScale = 750 / systemInfo.windowWidth;
  713. this.pxToRpxScale = pxToRpxScale
  714. this.rpxTopxScale = systemInfo.windowWidth / 750
  715. let systems = {
  716. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  717. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  718. };
  719. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  720. this.systems = systems;
  721. }
  722. };
  723. </script>
  724. <style>
  725. @import './index.css';
  726. </style>