index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <div class="app-container home">
  3. <div id="main">
  4. <div class="card_left">
  5. <el-card class="box-card card1 ">
  6. <div class="title">
  7. <span>用户概括</span>
  8. </div>
  9. <div class="contain">
  10. <i class="el-icon-s-custom"></i>
  11. <div class="num">999,999</div>
  12. <div class="num_txt">已注册人数</div>
  13. </div>
  14. <div id="user" style="width: 100%;height:374px;margin-left:-20%"></div>
  15. </el-card>
  16. <el-card class="box-card card2">
  17. <div class="title">
  18. <span>消费数据统计</span>
  19. </div>
  20. <div class="contain">
  21. <div class="day">
  22. <div class="rmb_icon">¥</div>
  23. <div class="right">
  24. <div class="num_txt">当天支付金额</div>
  25. <div class="num"><span>10,000</span> 元</div>
  26. </div>
  27. </div>
  28. <div class="now">
  29. <div class="rmb_icon">¥</div>
  30. <div class="right">
  31. <div class="num_txt">当前账户余额总额</div>
  32. <div class="num"><span>50,000,000</span> 元</div>
  33. </div>
  34. </div>
  35. </div>
  36. </el-card>
  37. </div>
  38. <div class="card_right">
  39. <el-card class="box-card card3">
  40. <div class="title">
  41. <span>充值行为分析</span>
  42. </div>
  43. <div class="contain">
  44. <div class="top">
  45. <div class="day_sum">
  46. <div class="num_txt">今日充值总金额</div>
  47. <div class="num"><span>10,000</span> 元</div>
  48. </div>
  49. <div class="day_count">
  50. <div class="num_txt">今日充值次数</div>
  51. <div class="num"><span>200</span> 次</div>
  52. </div>
  53. <div class="day_count">
  54. <div class="num_txt">今日平均充值金额</div>
  55. <div class="num"><span>200</span> 元</div>
  56. </div>
  57. </div>
  58. <div class="middle">
  59. <div id="pay_type" style="width: 500px;height:150px"></div>
  60. <div id="channel" style="width: 500px;height:150px"></div>
  61. </div>
  62. <div class="title" style="width:100%">
  63. <span>充值行为分析</span>
  64. </div>
  65. <div class="data">
  66. <el-dropdown @command="handleMonth" class="data_type">
  67. <span class="el-dropdown-link">
  68. {{month}}<i class="el-icon-arrow-down el-icon--right"></i>
  69. </span>
  70. <el-dropdown-menu slot="dropdown">
  71. <el-dropdown-item command="1">1月</el-dropdown-item>
  72. <el-dropdown-item command="2">2月</el-dropdown-item>
  73. </el-dropdown-menu>
  74. </el-dropdown>
  75. <el-dropdown @command="handleYear" class="data_type">
  76. <span class="el-dropdown-link">
  77. {{year}}<i class="el-icon-arrow-down el-icon--right"></i>
  78. </span>
  79. <el-dropdown-menu slot="dropdown">
  80. <el-dropdown-item command="2021">2021年</el-dropdown-item>
  81. <el-dropdown-item command="2022">2022年</el-dropdown-item>
  82. </el-dropdown-menu>
  83. </el-dropdown>
  84. </div>
  85. <div class="bottom" >
  86. <div id="statistics" style="width: 800px;height:200px"></div>
  87. </div>
  88. </div>
  89. </el-card>
  90. </div>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. export default {
  96. name: "index",
  97. data() {
  98. return {
  99. // 版本号
  100. month:"月",
  101. year:"年"
  102. };
  103. },
  104. mounted() {
  105. this.drawLine();
  106. },
  107. methods: {
  108. handleMonth(month) {
  109. this.month = month + "月"
  110. },
  111. handleYear(year) {
  112. console.log(1)
  113. this.year = year + "年"
  114. },
  115. drawLine(){
  116. // 基于准备好的dom,初始化echarts实例
  117. let user = this.$echarts.init(document.getElementById('user'))
  118. let pay_type = this.$echarts.init(document.getElementById('pay_type'))
  119. let channel = this.$echarts.init(document.getElementById('channel'))
  120. let statistics = this.$echarts.init(document.getElementById('statistics'))
  121. // 指定图表的配置项和数据
  122. var option1 = {
  123. tooltip: {
  124. trigger: 'item'
  125. },
  126. legend: {
  127. orient: 'vertical',
  128. top: '15%',
  129. left: 'left',
  130. left: '80%'
  131. },
  132. series: [
  133. {
  134. name: '',
  135. type: 'pie',
  136. radius: ['40%', '70%'],
  137. avoidLabelOverlap: false,
  138. itemStyle: {
  139. borderRadius: 10,
  140. borderColor: '#fff',
  141. borderWidth: 2
  142. },
  143. label: {
  144. show: false,
  145. position: 'center'
  146. },
  147. emphasis: {
  148. label: {
  149. show: true,
  150. fontSize: '16',
  151. fontWeight: 'bold'
  152. }
  153. },
  154. labelLine: {
  155. show: false
  156. },
  157. data: [
  158. { value: 1048, name: '东信员工' },
  159. { value: 735, name: '合作伙伴' },
  160. { value: 580, name: '租客' },
  161. { value: 1048, name: '东信员工1' },
  162. { value: 735, name: '合作伙伴1' },
  163. { value: 580, name: '租客1' },
  164. { value: 1048, name: '东信员工2' },
  165. { value: 735, name: '合作伙伴2' },
  166. { value: 580, name: '租客2' },
  167. ]
  168. }
  169. ]
  170. };
  171. var option2 = {
  172. title: {
  173. text: '支付方式'
  174. },
  175. tooltip: {
  176. trigger: 'item'
  177. },
  178. legend: {
  179. orient: 'vertical',
  180. top: '15%',
  181. left: 'left',
  182. left: '80%'
  183. },
  184. series: [
  185. {
  186. name: '',
  187. type: 'pie',
  188. radius: ['40%', '70%'],
  189. avoidLabelOverlap: false,
  190. itemStyle: {
  191. borderRadius: 10,
  192. borderColor: '#fff',
  193. borderWidth: 2
  194. },
  195. label: {
  196. show: false,
  197. position: 'center'
  198. },
  199. emphasis: {
  200. label: {
  201. show: true,
  202. fontSize: '12',
  203. fontWeight: 'bold'
  204. }
  205. },
  206. labelLine: {
  207. show: false
  208. },
  209. data: [
  210. { value: 1048, name: '支付宝' },
  211. { value: 735, name: '微信' },
  212. { value: 73, name: '现金' },
  213. ]
  214. }
  215. ]
  216. };
  217. var option3 = {
  218. title: {
  219. text: '充值渠道'
  220. },
  221. tooltip: {
  222. trigger: 'item'
  223. },
  224. legend: {
  225. orient: 'vertical',
  226. top: '15%',
  227. left: 'left',
  228. left: '80%'
  229. },
  230. series: [
  231. {
  232. name: '',
  233. type: 'pie',
  234. radius: ['40%', '70%'],
  235. avoidLabelOverlap: false,
  236. itemStyle: {
  237. borderRadius: 10,
  238. borderColor: '#fff',
  239. borderWidth: 2
  240. },
  241. label: {
  242. show: false,
  243. position: 'center'
  244. },
  245. emphasis: {
  246. label: {
  247. show: true,
  248. fontSize: '12',
  249. fontWeight: 'bold'
  250. }
  251. },
  252. labelLine: {
  253. show: false
  254. },
  255. data: [
  256. { value: 1048, name: '餐厅' },
  257. { value: 735, name: '活动中心' },
  258. { value: 73, name: '游泳馆' },
  259. ]
  260. }
  261. ]
  262. };
  263. var option4 = {
  264. title: {
  265. text: '充值总额'
  266. },
  267. tooltip: {
  268. trigger: 'axis'
  269. },
  270. legend: {
  271. // data: ['Email']
  272. },
  273. grid: {
  274. // left: '3%',
  275. // right: '4%',
  276. // bottom: '3%',
  277. containLabel: false
  278. },
  279. // toolbox: {
  280. // feature: {
  281. // saveAsImage: {}
  282. // }
  283. // },
  284. xAxis: {
  285. type: 'category',
  286. boundaryGap: false,
  287. data: ['1日','2日','3日','4日','5日','6日','7日','8日','9日','10日','11日','12日','13日','14日','15日','16日','17日','18日','19日','20日','21日','22日','23日','24日','25日','26日','27日','28日','29日','30日']
  288. },
  289. yAxis: {
  290. type: 'value'
  291. },
  292. series: [
  293. {
  294. // name: 'Email',
  295. type: 'line',
  296. stack: 'Total',
  297. data: [120, 134, 90, 230, 210,120, 132, 10100, 134, 90,120, 134, 90, 230, 210,120, 132, 10100, 134, 90,120, 134, 90, 230, 210,120, 132, 10100, 134, 90]
  298. },
  299. ]
  300. };
  301. user.setOption(option1);
  302. pay_type.setOption(option2);
  303. channel.setOption(option3);
  304. statistics.setOption(option4);
  305. },
  306. }
  307. }
  308. </script>
  309. <style scoped lang="scss">
  310. .text {
  311. font-size: 14px;
  312. }
  313. .item {
  314. margin-bottom: 18px;
  315. }
  316. .clearfix:before,
  317. .clearfix:after {
  318. display: table;
  319. content: "";
  320. }
  321. .clearfix:after {
  322. clear: both
  323. }
  324. .box-card {
  325. margin-top:10px;
  326. }
  327. #main{
  328. .box-card{
  329. .title{
  330. text-align: left;
  331. span{
  332. font-size: 16px;
  333. font-weight: 700;;
  334. padding-bottom:2px;
  335. border-bottom:1px solid #ccc !important;
  336. }
  337. }
  338. }
  339. .card_left{
  340. width:40%;
  341. float: left;
  342. .card1{
  343. .contain{
  344. margin:30px auto 0;
  345. text-align: center;
  346. &>div{
  347. display: inline-block;
  348. }
  349. .el-icon-s-custom{
  350. font-size:30px;
  351. }
  352. .num{
  353. font-size: 30px;
  354. font-weight: 700;
  355. margin:0 16px;
  356. }
  357. .num_txt{
  358. font-size: 12px;
  359. color:#ccc;
  360. }
  361. }
  362. }
  363. .card2{
  364. .contain{
  365. margin:30px auto 0;
  366. text-align: left;
  367. &>div>div{
  368. display: inline-block;
  369. }
  370. &>div:nth-child(2){
  371. margin:80px auto 40px;
  372. }
  373. .rmb_icon{
  374. font-size:40px;
  375. font-weight: 700;
  376. margin:0 10% 0 15%;
  377. vertical-align: middle;
  378. }
  379. .right{
  380. vertical-align: middle;
  381. width:40%;
  382. text-align: right;
  383. .num_txt{
  384. font-size: 12px;
  385. color:#ccc !important;
  386. text-align: right;
  387. margin-right:14px;
  388. }
  389. .num{
  390. font-size: 12px;
  391. margin-top:5px;
  392. color:#ccc;
  393. span{
  394. font-size: 30px;
  395. font-weight: 700;
  396. color:#000;
  397. }
  398. }
  399. }
  400. }
  401. }
  402. }
  403. .card_right{
  404. float:left;
  405. width:60%;
  406. .card3{
  407. width:100%;
  408. margin-left:10px;
  409. .title{
  410. width:85%;
  411. margin:0 auto;
  412. }
  413. .contain{
  414. width:85%;
  415. margin:30px auto 0;
  416. text-align: left;
  417. .top{
  418. display: flex;
  419. div{
  420. flex:3;
  421. text-align: center;
  422. .num_txt{
  423. font-size: 12px;
  424. color:#ccc !important;
  425. text-align: center;
  426. }
  427. .num{
  428. font-size: 12px;
  429. margin-top:5px;
  430. color:#ccc;
  431. span{
  432. font-size: 30px;
  433. font-weight: 700;
  434. color:#000;
  435. }
  436. }
  437. }
  438. }
  439. .middle{
  440. div{
  441. margin-top:40px;
  442. }
  443. }
  444. .bottom{
  445. margin-top:40px;
  446. }
  447. .data{
  448. width:100%;
  449. text-align: right;
  450. margin-left:-100px;
  451. .data_type{
  452. margin:20px 0 0 20px;
  453. padding:0 15px;
  454. border:1px solid #000;
  455. }
  456. }
  457. }
  458. }
  459. }
  460. }
  461. </style>