index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view class="page" :style="{'padding-top':mt+'px'}">
  3. <c-nav-bar title="统计" :showIcon="false"></c-nav-bar>
  4. <view class="hander">
  5. <!-- 2024年1月 -->
  6. <view
  7. class="tn-flex tn-flex-col-center tn-margin-right tn-padding-xs tn-text-sm tn-bg-gray--light tn-radius tn-color-gray--dark"
  8. style="border-radius: 12rpx; width: 160rpx;">
  9. <picker @change="bindDateChange" mode="date" :value="date" :start="startDate" :end="endDate"
  10. fields="month">
  11. <text class="tn-padding-left-xs tn-padding-right-xs">{{date}}
  12. </text>
  13. </picker>
  14. </view>
  15. <view style="width: 60rpx; line-height: 48rpx; height: 48rpx; margin: 15rpx 0 ; ">
  16. <u-icon name="arrow-down" color="#000000" size="20"></u-icon>
  17. </view>
  18. </view>
  19. <view class="hander-price">
  20. <view class="one">
  21. <view class="left">
  22. 总营业额
  23. </view>
  24. <view class="right">
  25. 共{{list.totalNums}}笔
  26. </view>
  27. </view>
  28. <view class="two">
  29. <text>¥</text>
  30. <text>{{list.totalAmount}}</text>
  31. </view>
  32. </view>
  33. <view class="echarts-one">
  34. <view class="title">
  35. 营业概况
  36. </view>
  37. <view class="hander-content">
  38. <view class="list">
  39. <view class="title">
  40. 房费
  41. </view>
  42. <view class="price">
  43. {{list.roomAmount}}
  44. </view>
  45. </view>
  46. <view class="list">
  47. <view class="title">
  48. 商品
  49. </view>
  50. <view class="price">
  51. {{list.breakfastAmount}}
  52. </view>
  53. </view>
  54. <view class="list">
  55. <view class="title">
  56. 其他
  57. </view>
  58. <view class="price">
  59. {{list.othersAmount}}
  60. </view>
  61. </view>
  62. </view>
  63. <view class="Pie_charts" style="min-height: 580rpx;">
  64. <!-- <PieCharts></PieCharts> -->
  65. <qiun-data-charts type="ring" :opts="optsPied" :chartData="chartDataPied" />
  66. </view>
  67. </view>
  68. <view class="echarts-two">
  69. <view class="title">
  70. 交易趋势
  71. </view>
  72. <view class="title1">
  73. 单位:元
  74. </view>
  75. <view class="line_charts_one">
  76. <qiun-data-charts type="area" :opts="revenueOptsone" :chartData="revenueChartDataOne" />
  77. </view>
  78. </view>
  79. <view class="echarts-three">
  80. <view>
  81. <view class="title">
  82. 入住率
  83. </view>
  84. <view class="title1">
  85. 入住率(%)
  86. </view>
  87. </view>
  88. <view class="line_charts_two">
  89. <qiun-data-charts type="area" :opts="revenueOptstwo" :chartData="revenueChartDataTwo" />
  90. </view>
  91. </view>
  92. <Tabbar :tabbarIndex="2"></Tabbar>
  93. </view>
  94. </template>
  95. <script>
  96. // import uCharts from '@/utils/u-charts.js';
  97. import PieCharts from "@/components/Charts/PieCharts.vue"
  98. import LineOne from "@/components/Charts/LineOne.vue"
  99. import LineTwo from "@/components/Charts/LineTwo.vue"
  100. export default {
  101. components: {
  102. PieCharts,
  103. LineOne,
  104. LineTwo
  105. },
  106. data() {
  107. return {
  108. h: uni.getSystemInfoSync().windowHeight,
  109. mt: uni.getSystemInfoSync().statusBarHeight + 54,
  110. date: '2024-01',
  111. fromData: {
  112. dateDay: '2024-01',
  113. homestayId: ''
  114. },
  115. chartDataPied: {},
  116. optsPied: {
  117. rotate: false,
  118. rotateLock: false,
  119. color: ['#1372FF', '#F89F2A', '#02C493'],
  120. padding: [30, 30, 30, 35],
  121. dataLabel: true,
  122. enableScroll: false,
  123. legend: {
  124. show: true,
  125. position: "bottom",
  126. lineHeight: 25
  127. },
  128. title: {
  129. name: "",
  130. fontSize: 15,
  131. color: "#666666"
  132. },
  133. subtitle: {
  134. name: "",
  135. fontSize: 25,
  136. color: "#7cb5ec"
  137. },
  138. extra: {
  139. ring: {
  140. ringWidth: 25,
  141. activeOpacity: 0.5,
  142. activeRadius: 10,
  143. offsetAngle: 0,
  144. labelWidth: 10,
  145. border: false,
  146. borderWidth: 3,
  147. borderColor: "#FFFFFF"
  148. }
  149. },
  150. },
  151. PieChartsList: {},
  152. // 公司营收
  153. revenueChartDataOne: {},
  154. revenueOptsone: {
  155. color: ["#4B98FE"],
  156. padding: [15, 15],
  157. dataLabel: false,
  158. xAxis: {
  159. disableGrid: true,
  160. },
  161. yAxis: {
  162. // gridColor: "rgba(230,230,230,0.6)",
  163. gridColor: "rgba(200,200,200,0.6)",
  164. disabled: false,
  165. disableGrid: false,
  166. gridType: 'dash',
  167. dashLength: '4',
  168. data: [{
  169. axisLineColor: "#FFFFFF",
  170. min: 0,
  171. }],
  172. },
  173. legend: {
  174. show: false,
  175. position: "top",
  176. float: "right",
  177. },
  178. extra: {
  179. area: {
  180. type: "curve",
  181. opacity: 0.8,
  182. addLine: true,
  183. width: 1,
  184. gradient: true,
  185. },
  186. },
  187. },
  188. dataListOne: [],
  189. // 公司营收
  190. revenueChartDataTwo: {},
  191. revenueOptstwo: {
  192. color: ["#4B98FE"],
  193. padding: [15, 15],
  194. dataLabel: false,
  195. xAxis: {
  196. disableGrid: true,
  197. },
  198. yAxis: {
  199. // gridColor: "rgba(230,230,230,0.6)",
  200. gridColor: "rgba(200,200,200,0.6)",
  201. disabled: false,
  202. disableGrid: false,
  203. gridType: 'dash',
  204. dashLength: '4',
  205. data: [{
  206. axisLineColor: "#FFFFFF",
  207. min: 0,
  208. max: 1
  209. }],
  210. },
  211. legend: {
  212. show: false,
  213. position: "top",
  214. float: "right",
  215. },
  216. extra: {
  217. area: {
  218. type: "curve",
  219. opacity: 0.8,
  220. addLine: true,
  221. width: 1,
  222. gradient: true,
  223. },
  224. },
  225. },
  226. dataListTwo: [],
  227. list: {}
  228. }
  229. },
  230. onReady() {
  231. // this.fromData.dateDay = e.detail.value
  232. this.fromData.homestayId = wx.getStorageSync('homestayId')
  233. if (this.fromData.homestayId !== '') {
  234. this.getList()
  235. }
  236. },
  237. methods: {
  238. bindDateChange(e) {
  239. this.date = e.detail.value
  240. this.fromData.dateDay = e.detail.value
  241. this.getList()
  242. },
  243. // 时间
  244. startDate() {
  245. return this.getDate('start')
  246. },
  247. endDate() {
  248. return this.getDate('end')
  249. },
  250. getList() {
  251. this.$api.get('/merchant/hotel/mine/getHotelCountInfo', this.fromData).then(res => {
  252. console.log(res);
  253. this.list = res.data.data
  254. // 环图 营业概况
  255. this.getServerData();
  256. // 交易趋势
  257. this.drawRevenueChartsOne()
  258. // 入住率
  259. this.drawRevenueChartstwo()
  260. })
  261. },
  262. // 环图 营业概况
  263. getServerData() {
  264. this.PieChartsList = this.list
  265. console.log('环图2222', this.PieChartsList);
  266. this.PieChartsList = {
  267. series: [{
  268. data: [{
  269. "name": "房费",
  270. "value": this.PieChartsList.roomAmount,
  271. "labelText": "房费" + this.PieChartsList.roomRatio + '%'
  272. },
  273. {
  274. "name": "商品",
  275. "value": this.PieChartsList.othersAmount,
  276. "labelText": "商品" + this.PieChartsList.othersRatio + '%'
  277. },
  278. {
  279. "name": "其他",
  280. "value": this.PieChartsList.breakfastAmount,
  281. "labelText": "其他" + this.PieChartsList.breakfastRatio + '%',
  282. },
  283. ],
  284. }],
  285. }
  286. this.chartDataPied = JSON.parse(JSON.stringify(this.PieChartsList));
  287. },
  288. // 交易趋势
  289. drawRevenueChartsOne() {
  290. // this.list = this.objList
  291. // console.log('交易趋势33333333', this.list);
  292. this.list.checkedInChant.forEach(item => {
  293. this.dataListOne.push(item.checkedInRatio)
  294. })
  295. let list1 = {
  296. categories: [
  297. "01-01", "", "", "", "", "", "",
  298. "01-08", "", "", "", "", "", "",
  299. "01-15", "", "", "", "", "", "",
  300. "01-22", "", "", "", "", "", "",
  301. "01-29", "", ""
  302. ],
  303. series: [{
  304. name: "收入",
  305. data: this.dataListOne,
  306. legendShape: "circle",
  307. color: "#4088FE",
  308. pointShape: "none",
  309. }, ],
  310. }
  311. this.revenueChartDataOne = JSON.parse(JSON.stringify(list1));
  312. },
  313. // 入住率
  314. drawRevenueChartstwo() {
  315. this.list.checkedInChant.forEach(item => {
  316. this.dataListTwo.push(item.checkedInRatio)
  317. })
  318. let list2 = {
  319. categories: ["01-01", "", "", "", "", "", "", "01-08", "", "", "", "", "", "", "01-15",
  320. "", "", "", "", "", "", "01-22", "", "", "", "", "", "", "01-29", "", "",
  321. ],
  322. series: [{
  323. name: "入住率",
  324. data: this.dataListTwo,
  325. legendShape: "circle",
  326. color: "#600EFF",
  327. pointShape: "none",
  328. }, ],
  329. }
  330. this.revenueChartDataTwo = JSON.parse(JSON.stringify(list2));
  331. },
  332. }
  333. }
  334. </script>
  335. <style scoped lang="less">
  336. .charts-box {
  337. width: 100%;
  338. height: 630rpx;
  339. }
  340. .page {
  341. background: #F3F4F4;
  342. padding-bottom: 40rpx;
  343. box-sizing: border-box;
  344. // overflow-y: auto;
  345. padding: 20rpx 30rpx;
  346. // height: 100%;
  347. }
  348. .hander {
  349. height: 48rpx;
  350. width: 216rpx;
  351. border-radius: 8rpx;
  352. background-color: #fff;
  353. text-align: center;
  354. line-height: 48rpx;
  355. display: flex !important;
  356. justify-content: space-between !important;
  357. }
  358. .hander-price {
  359. margin-top: 20rpx;
  360. width: 100%;
  361. height: 192rpx;
  362. padding: 30rpx;
  363. box-sizing: border-box;
  364. border-radius: 10rpx;
  365. background-color: #fff;
  366. .one {
  367. display: flex;
  368. justify-content: space-between;
  369. .left {
  370. font-size: 32rpx;
  371. color: #333333;
  372. font-weight: Heavy;
  373. font-family: PingFang SC-Heavy;
  374. }
  375. .right {
  376. font-size: 24rpx;
  377. color: #333333;
  378. font-weight: Regular;
  379. font-family: PingFang SC-Regular;
  380. }
  381. }
  382. .two {
  383. margin-top: 20rpx;
  384. font-size: 48rpx;
  385. color: #1372FF;
  386. font-weight: Heavy;
  387. font-family: PingFang SC-Heavy;
  388. }
  389. }
  390. .echarts-one {
  391. box-sizing: border-box;
  392. width: 100%;
  393. height: 829rpx;
  394. background-color: #fff;
  395. margin: 20rpx 0;
  396. border-radius: 10rpx;
  397. padding: 30rpx;
  398. .title {
  399. font-size: 32rpx;
  400. color: #333333;
  401. font-weight: Heavy;
  402. font-family: PingFang SC-Heavy;
  403. }
  404. .hander-content {
  405. margin-top: 40rpx;
  406. display: flex;
  407. justify-content: space-between;
  408. height: 110rpx;
  409. .title {
  410. font-size: 28rpx;
  411. color: #777777;
  412. font-weight: Regular;
  413. font-family: PingFang SC-Regular;
  414. }
  415. .price {
  416. margin-top: 10rpx;
  417. font-size: 28rpx;
  418. color: #333;
  419. font-weight: Bold;
  420. font-family: PingFang SC-Bold;
  421. }
  422. }
  423. .Pie_charts {
  424. width: 600rpx !important;
  425. height: 560rpx !important;
  426. // background-color: aqua;
  427. }
  428. }
  429. .echarts-two {
  430. box-sizing: border-box;
  431. width: 100%;
  432. height: 543rpx;
  433. background-color: #fff;
  434. margin: 20rpx 0;
  435. border-radius: 10rpx;
  436. padding: 30rpx;
  437. .title {
  438. font-size: 32rpx;
  439. color: #333333;
  440. font-weight: Heavy;
  441. font-family: PingFang SC-Heavy;
  442. }
  443. .title1 {
  444. margin-left: 20rpx;
  445. margin-top: 20rpx;
  446. font-size: 20rpx;
  447. color: #333333;
  448. font-weight: Regular;
  449. font-family: PingFang SC-Regular;
  450. }
  451. .line_charts_one {
  452. width: 630rpx;
  453. height: 388rpx;
  454. // background-color: aqua;
  455. }
  456. }
  457. .echarts-three {
  458. box-sizing: border-box;
  459. width: 100%;
  460. height: 540rpx;
  461. background-color: #fff;
  462. margin: 20rpx 0;
  463. border-radius: 10rpx;
  464. padding: 30rpx;
  465. .title {
  466. font-size: 32rpx;
  467. color: #333333;
  468. font-weight: Heavy;
  469. font-family: PingFang SC-Heavy;
  470. }
  471. .title1 {
  472. margin-left: 20rpx;
  473. margin-top: 20rpx;
  474. font-size: 20rpx;
  475. color: #333333;
  476. font-weight: Regular;
  477. font-family: PingFang SC-Regular;
  478. }
  479. .line_charts_two {
  480. width: 630rpx;
  481. height: 388rpx;
  482. // background-color: aqua;
  483. }
  484. }
  485. </style>