index.vue 20 KB

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