home.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="24">
  5. <div class="separate_page">
  6. <h3>用户统计</h3>
  7. <div class="dflex">
  8. <div class="tag">
  9. <i class="iconfont iconyonghu"></i>
  10. <div>
  11. <div class="tag_title">总用户数</div>
  12. <v-countup class="tag_data" :start-value="start" :end-value="member_sta.member_cnt"
  13. :options="options"></v-countup>
  14. </div>
  15. </div>
  16. <div class="tag">
  17. <i class="iconfont iconshijian"></i>
  18. <div>
  19. <div class="tag_title">近7天活跃量</div>
  20. <v-countup class="tag_data" :start-value="start" :end-value="member_sta.member_cnt_7"
  21. :options="options"></v-countup>
  22. </div>
  23. </div>
  24. <div class="tag">
  25. <i class="iconfont iconquanbudingdan"></i>
  26. <div>
  27. <div class="tag_title">昨日新增量</div>
  28. <v-countup class="tag_data" :start-value="start"
  29. :end-value="member_sta.member_cnt_yesterday" :options="options"></v-countup>
  30. </div>
  31. </div>
  32. <div class="tag">
  33. <i class="iconfont iconxiadan"></i>
  34. <div>
  35. <div class="tag_title">订单数</div>
  36. <v-countup class="tag_data" :start-value="start" :end-value="member_sta.order_cnt"
  37. :options="options"></v-countup>
  38. </div>
  39. </div>
  40. <div class="tag">
  41. <i class="iconfont iconxiaofei"></i>
  42. <div>
  43. <div class="tag_title">今日付款数</div>
  44. <v-countup class="tag_data" :start-value="start" :end-value="member_sta.pay_cnt"
  45. :options="options"></v-countup>
  46. </div>
  47. </div>
  48. <div class="tag">
  49. <i class="iconfont iconxiaofei"></i>
  50. <div>
  51. <div class="tag_title">今日总消费</div>
  52. <v-countup class="tag_data" :start-value="start" :end-value="member_sta.pay_money"
  53. :options="options"></v-countup>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </el-col>
  59. </el-row>
  60. <el-row :gutter="16">
  61. <el-col :span="5">
  62. <div class="separate_page stats_area">
  63. <h3>订单统计</h3>
  64. <div class="order">
  65. <div class="dflex">
  66. <div class="circle_txt">总</div>
  67. <div>
  68. <div class="order_title">总单数</div>
  69. <v-countup class="order_data" :start-value="start" :end-value="order_sta.order_cnt"
  70. :options="options"></v-countup>
  71. </div>
  72. </div>
  73. <div class="dflex">
  74. <div class="circle_txt">单</div>
  75. <div>
  76. <div class="order_title">客单价</div>
  77. <v-countup class="order_data" :start-value="start"
  78. :end-value="order_sta.pay_money / order_sta.pay_cnt" :decimals="2"
  79. :options="options_price"></v-countup>
  80. </div>
  81. </div>
  82. <div class="dflex">
  83. <div class="circle_txt">支</div>
  84. <div>
  85. <div class="order_title">支付数</div>
  86. <v-countup class="order_data" :start-value="start" :end-value="order_sta.pay_cnt"
  87. :options="options"></v-countup>
  88. </div>
  89. </div>
  90. <div class="dflex">
  91. <div class="circle_txt">金</div>
  92. <div>
  93. <div class="order_title">付款金额</div>
  94. <v-countup class="order_data" :start-value="start" :end-value="order_sta.pay_money"
  95. :decimals="2" :options="options_price"></v-countup>
  96. </div>
  97. </div>
  98. <div class="dflex">
  99. <div class="circle_txt">退</div>
  100. <div>
  101. <div class="order_title">退款数</div>
  102. <v-countup class="order_data" :start-value="start" :end-value="order_sta.refund_cnt"
  103. :options="options"></v-countup>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </el-col>
  109. <el-col :span="19">
  110. <div class="separate_page stats_area">
  111. <div class="dflex_sb">
  112. <h3>日/月订单数</h3>
  113. <div>
  114. <el-button size="mini" :class="{ active: days == '日' }" @click="day" round>日</el-button>
  115. <el-button size="mini" :class="{ active: days == '月' }" @click="month" round>月</el-button>
  116. </div>
  117. </div>
  118. <div id="create-line-line" class="echart_line_line"></div>
  119. </div>
  120. </el-col>
  121. </el-row>
  122. <el-row :gutter="16">
  123. <el-col :span="7">
  124. <div class="separate_page ranking_area">
  125. <div class="dflex_sb">
  126. <h3>访客排行</h3>
  127. <el-select size="small" style="width: 100px;" class="state_search" v-model="visit_state_search"
  128. @change="get_visit_stats">
  129. <el-option v-for="(item, idx) in options_state" :key="idx" :label="item.label"
  130. :value="item.value"></el-option>
  131. </el-select>
  132. </div>
  133. <el-table height="25rem" :data="tableData_visit" highlight-current-row class="home_table card">
  134. <el-table-column property="name" label="名称" align="center" class="aaa"></el-table-column>
  135. <el-table-column property="state" label="状态" align="center"></el-table-column>
  136. <el-table-column property="visit" label="访客数" align="center"></el-table-column>
  137. <el-table-column property="browse" label="浏览数" align="center"></el-table-column>
  138. </el-table>
  139. </div>
  140. </el-col>
  141. <el-col :span="7">
  142. <div class="separate_page ranking_area">
  143. <div class="dflex_sb">
  144. <h3>浏览排行</h3>
  145. <el-select size="small" style="width: 100px;" class="state_search" v-model="browse_state_search"
  146. @change="get_browse_stats">
  147. <el-option v-for="(item, idx) in options_state" :key="idx" :label="item.label"
  148. :value="item.value"></el-option>
  149. </el-select>
  150. </div>
  151. <el-table height="25rem" :data="tableData_browse" highlight-current-row class="home_table card">
  152. <el-table-column property="name" label="名称" align="center"></el-table-column>
  153. <el-table-column property="state" label="状态" align="center"></el-table-column>
  154. <el-table-column property="browse" label="浏览数" align="center"></el-table-column>
  155. <el-table-column property="visit" label="访客数" align="center"></el-table-column>
  156. </el-table>
  157. </div>
  158. </el-col>
  159. <el-col :span="10">
  160. <div class="separate_page ranking_area">
  161. <h3>商品类型分布</h3>
  162. <div id="create-pie" class="echart_pie"></div>
  163. </div>
  164. </el-col>
  165. </el-row>
  166. <el-row>
  167. <el-col :span="24">
  168. <div class="separate_page">
  169. <h3>会员省份分布</h3>
  170. <div id="create-map" class="echart_map"></div>
  171. </div>
  172. </el-col>
  173. </el-row>
  174. </div>
  175. </template>
  176. <script>
  177. import vCountup from 'vue-countupjs';
  178. import echarts from 'echarts';
  179. import china from 'echarts/map/json/china.json';
  180. echarts.registerMap('china', china);
  181. export default {
  182. components: {
  183. vCountup
  184. },
  185. data() {
  186. return {
  187. start: 0,
  188. options: {
  189. useEasing: true, // 缓动动画 easing
  190. useGrouping: true, // 1,000,000 vs 1000000
  191. separator: ',', // 数字分隔符
  192. decimal: '.', // 小数分隔符
  193. prefix: '', // 前缀
  194. suffix: '' // 后缀
  195. },
  196. options_price: {
  197. useEasing: true, // 缓动动画 easing
  198. useGrouping: true, // 1,000,000 vs 1000000
  199. separator: ',', // 数字分隔符
  200. decimal: '.', // 小数分隔符
  201. prefix: '¥', // 前缀
  202. suffix: '' // 后缀
  203. },
  204. member_sta: {},
  205. order_sta: {},
  206. options_line_line: [],
  207. echart_line_line: null,
  208. days: '日',
  209. tableData_visit: [],
  210. tableData_browse: [],
  211. options_state: [{
  212. value: '全部',
  213. label: '全部'
  214. },
  215. {
  216. value: '待审核',
  217. label: '待审核'
  218. },
  219. {
  220. value: '销售中',
  221. label: '销售中'
  222. },
  223. {
  224. value: '已下架',
  225. label: '已下架'
  226. }
  227. ],
  228. visit_state_search: '全部',
  229. browse_state_search: '全部'
  230. };
  231. },
  232. methods: {
  233. create_line_line(callback) {
  234. let _this = this;
  235. this.echart_line_line = this.$echarts.init(document.getElementById('create-line-line'));
  236. //对话框图片
  237. var uploadedDataURL = '/asset/get/s/data-1547533200844-7eBMgp66l.png';
  238. this.options_line_line = {
  239. backgroundColor: '#FFF',
  240. grid: {
  241. top: '9%',
  242. bottom: '19%',
  243. left: '6%',
  244. right: '4%'
  245. },
  246. tooltip: {
  247. trigger: 'axis',
  248. label: {
  249. show: true
  250. },
  251. formatter: function(params) {
  252. let str = '';
  253. str += params[0].data.name + '\n';
  254. params.forEach(item => {
  255. if (item.seriesName === '订单数') {
  256. str += item.seriesName + ' : ' + item.data.value + '' + '\n';
  257. } else if (item.seriesName === '支付数') {
  258. str += item.seriesName + ' : ' + item.data.value + '' + '\n';
  259. str += '支付金额' + ' : ¥' + item.data.money + '' + '\n';
  260. }
  261. });
  262. return str;
  263. }
  264. },
  265. legend: {
  266. data: ['订单数', '支付数'],
  267. top: '0%',
  268. textStyle: {
  269. color: '#000'
  270. }
  271. },
  272. xAxis: {
  273. boundaryGap: true, //默认,坐标轴留白策略
  274. axisLine: {
  275. show: false
  276. },
  277. splitLine: {
  278. show: false
  279. },
  280. axisTick: {
  281. show: false,
  282. alignWithLabel: true
  283. },
  284. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
  285. },
  286. yAxis: {
  287. axisLine: {
  288. show: false
  289. },
  290. splitLine: {
  291. show: true,
  292. lineStyle: {
  293. type: 'dashed',
  294. color: '#d9d9d9'
  295. }
  296. },
  297. axisTick: {
  298. show: false
  299. },
  300. splitArea: {
  301. show: true,
  302. areaStyle: {
  303. color: '#fff'
  304. }
  305. }
  306. },
  307. series: [{
  308. smooth: true, //是否平滑曲线显示
  309. name: '订单数',
  310. type: 'line',
  311. symbol: 'circle',
  312. symbolSize: 7,
  313. lineStyle: {
  314. color: '#fd6b6c',
  315. shadowBlur: 12,
  316. shadowColor: '#fd6b6c',
  317. shadowOffsetX: 1,
  318. shadowOffsetY: 1
  319. },
  320. itemStyle: {
  321. color: '#fd6b6c',
  322. borderWidth: 1,
  323. borderColor: '#fd6b6c'
  324. },
  325. data: [600, 1000, 800, 1300, 1250, 1400, 1500, 1400, 1250, 1400, 1500, 2000]
  326. },
  327. {
  328. smooth: true, //是否平滑曲线显示
  329. name: '支付数',
  330. type: 'line',
  331. symbol: 'circle',
  332. symbolSize: 7,
  333. lineStyle: {
  334. color: '#07c160',
  335. shadowBlur: 12,
  336. shadowColor: '#07c160',
  337. shadowOffsetX: 1,
  338. shadowOffsetY: 1
  339. },
  340. itemStyle: {
  341. color: '#07c160',
  342. borderWidth: 1,
  343. borderColor: '#07c160'
  344. },
  345. data: [600, 1000, 800, 1300, 1250, 1400, 1500, 1400, 1250, 1400, 1500, 2000]
  346. }
  347. ]
  348. };
  349. window.addEventListener('resize', () => {
  350. _this.echart_line_line.resize();
  351. });
  352. if (typeof callback === 'function') {
  353. callback();
  354. }
  355. },
  356. create_pie() {
  357. const myChart = this.$echarts.init(document.getElementById('create-pie'));
  358. const state = {
  359. code: 200,
  360. msg: '',
  361. datas: [{
  362. state: '已下架',
  363. cnt: 8
  364. }, {
  365. state: '销售中',
  366. cnt: 19
  367. }]
  368. };
  369. const category = {
  370. code: 200,
  371. msg: '',
  372. datas: [{
  373. name: '冰箱',
  374. state: '销售中',
  375. cnt: 1
  376. },
  377. {
  378. name: '微波炉',
  379. state: '已下架',
  380. cnt: 1
  381. },
  382. {
  383. name: '电视',
  384. state: '销售中',
  385. cnt: 1
  386. },
  387. {
  388. name: '相机',
  389. state: '已下架',
  390. cnt: 2
  391. },
  392. {
  393. name: '华为',
  394. state: '销售中',
  395. cnt: 3
  396. },
  397. {
  398. name: '小米',
  399. state: '销售中',
  400. cnt: 2
  401. },
  402. {
  403. name: '苹果',
  404. state: '销售中',
  405. cnt: 1
  406. },
  407. {
  408. name: '上衣',
  409. state: '销售中',
  410. cnt: 1
  411. },
  412. {
  413. name: '裤子',
  414. state: '已下架',
  415. cnt: 1
  416. },
  417. {
  418. name: '回力',
  419. state: '已下架',
  420. cnt: 1
  421. },
  422. {
  423. name: '回力',
  424. state: '销售中',
  425. cnt: 2
  426. },
  427. {
  428. name: '耐克',
  429. state: '销售中',
  430. cnt: 2
  431. },
  432. {
  433. name: '361°',
  434. state: '销售中',
  435. cnt: 2
  436. },
  437. {
  438. name: '行李箱',
  439. state: '已下架',
  440. cnt: 1
  441. },
  442. {
  443. name: '手提包',
  444. state: '已下架',
  445. cnt: 1
  446. },
  447. {
  448. name: '手提包',
  449. state: '销售中',
  450. cnt: 2
  451. },
  452. {
  453. name: null,
  454. state: '已下架',
  455. cnt: 1
  456. },
  457. {
  458. name: '耳钉',
  459. state: '销售中',
  460. cnt: 2
  461. }
  462. ]
  463. };
  464. let echartData = {
  465. inner: [],
  466. outer: []
  467. };
  468. echartData.inner = [];
  469. echartData.outer = [];
  470. state.datas.forEach(_ => {
  471. echartData.inner.push({
  472. value: _.cnt,
  473. name: _.state
  474. });
  475. });
  476. category.datas.forEach(_ => {
  477. echartData.outer.push({
  478. value: _.cnt,
  479. name: _.name
  480. });
  481. });
  482. const option = {
  483. backgroundColor: '#fff',
  484. color: [
  485. '#2ec7c9',
  486. '#b6a2de',
  487. '#5ab1ef',
  488. '#ffb980',
  489. '#d87a80',
  490. '#8d98b3',
  491. '#FFEA01',
  492. '#B8D07C',
  493. '#fca4bb',
  494. '#dc69aa',
  495. '#07a2a4',
  496. '#9a7fd1',
  497. '#588dd5',
  498. '#f5994e',
  499. '#c05050',
  500. '#59678c',
  501. '#c9ab00',
  502. '#7eb00a',
  503. '#6f5553',
  504. '#c14089'
  505. ],
  506. tooltip: {
  507. trigger: 'item',
  508. formatter: '{a} \n{b}: {c} ({d}%)'
  509. },
  510. series: [{
  511. name: '商品状态',
  512. type: 'pie',
  513. radius: [0, '35%'],
  514. itemStyle: {
  515. normal: {
  516. borderColor: '#fff',
  517. borderWidth: 2
  518. }
  519. },
  520. label: {
  521. normal: {
  522. position: 'inner'
  523. }
  524. },
  525. labelLine: {
  526. normal: {
  527. show: false
  528. }
  529. },
  530. data: echartData.inner
  531. },
  532. {
  533. name: '商品分类',
  534. type: 'pie',
  535. radius: ['45%', '55%'],
  536. data: echartData.outer,
  537. labelLine: {
  538. normal: {
  539. length: 20,
  540. length2: 140,
  541. lineStyle: {
  542. color: '#e6e6e6'
  543. }
  544. }
  545. },
  546. label: {
  547. normal: {
  548. formatter: params => {
  549. return '{icon|●}{name|' + params.name + '}{percent|' + params.percent
  550. .toFixed(1) + '%}{value|' + params.value + '}';
  551. },
  552. padding: [0, -130, 25, -130],
  553. rich: {
  554. color: '#333',
  555. icon: {
  556. fontSize: 16
  557. },
  558. name: {
  559. fontSize: 14,
  560. padding: [0, 5, 0, 5],
  561. color: '#666666'
  562. },
  563. percent: {
  564. color: '#333',
  565. padding: [0, 5, 0, 0]
  566. },
  567. value: {
  568. fontSize: 16,
  569. fontWeight: 'bold',
  570. color: '#333333'
  571. }
  572. }
  573. }
  574. }
  575. }
  576. ]
  577. };
  578. myChart.setOption(option);
  579. window.addEventListener('resize', function() {
  580. myChart.resize();
  581. });
  582. },
  583. day() {
  584. this.days = '日';
  585. const res = {
  586. code: 200,
  587. msg: '',
  588. datas: [{
  589. time: '2021-07-13',
  590. order_cnt: 1,
  591. pay_cnt: 0,
  592. pay_money: 0.0
  593. },
  594. {
  595. time: '2021-07-14',
  596. order_cnt: 3,
  597. pay_cnt: 0,
  598. pay_money: 0.0
  599. },
  600. {
  601. time: '2021-07-15',
  602. order_cnt: 2,
  603. pay_cnt: 0,
  604. pay_money: 0.0
  605. },
  606. {
  607. time: '2021-07-16',
  608. order_cnt: 2,
  609. pay_cnt: 0,
  610. pay_money: 0.0
  611. },
  612. {
  613. time: '2021-07-17',
  614. order_cnt: 1,
  615. pay_cnt: 0,
  616. pay_money: 0.0
  617. },
  618. {
  619. time: '2021-07-18',
  620. order_cnt: 1,
  621. pay_cnt: 0,
  622. pay_money: 0.0
  623. },
  624. {
  625. time: '2021-07-19',
  626. order_cnt: 5,
  627. pay_cnt: 0,
  628. pay_money: 0.0
  629. },
  630. {
  631. time: '2021-07-20',
  632. order_cnt: 2,
  633. pay_cnt: 0,
  634. pay_money: 0.0
  635. },
  636. {
  637. time: '2021-07-21',
  638. order_cnt: 6,
  639. pay_cnt: 1,
  640. pay_money: 0.01
  641. },
  642. {
  643. time: '2021-07-22',
  644. order_cnt: 3,
  645. pay_cnt: 0,
  646. pay_money: 0.0
  647. },
  648. {
  649. time: '2021-07-23',
  650. order_cnt: 3,
  651. pay_cnt: 0,
  652. pay_money: 0.0
  653. },
  654. {
  655. time: '2021-07-24',
  656. order_cnt: 3,
  657. pay_cnt: 0,
  658. pay_money: 0.0
  659. },
  660. {
  661. time: '2021-07-25',
  662. order_cnt: 3,
  663. pay_cnt: 0,
  664. pay_money: 0.0
  665. },
  666. {
  667. time: '2021-07-26',
  668. order_cnt: 3,
  669. pay_cnt: 0,
  670. pay_money: 0.0
  671. },
  672. {
  673. time: '2021-07-27',
  674. order_cnt: 3,
  675. pay_cnt: 0,
  676. pay_money: 0.0
  677. },
  678. {
  679. time: '2021-07-28',
  680. order_cnt: 3,
  681. pay_cnt: 0,
  682. pay_money: 0.0
  683. },
  684. {
  685. time: '2021-07-29',
  686. order_cnt: 3,
  687. pay_cnt: 0,
  688. pay_money: 0.0
  689. },
  690. {
  691. time: '2021-07-30',
  692. order_cnt: 3,
  693. pay_cnt: 0,
  694. pay_money: 0.0
  695. },
  696. {
  697. time: '2021-08-01',
  698. order_cnt: 3,
  699. pay_cnt: 0,
  700. pay_money: 0.0
  701. },
  702. {
  703. time: '2021-08-02',
  704. order_cnt: 3,
  705. pay_cnt: 0,
  706. pay_money: 0.0
  707. },
  708. {
  709. time: '2021-08-03',
  710. order_cnt: 3,
  711. pay_cnt: 0,
  712. pay_money: 0.0
  713. },
  714. {
  715. time: '2021-08-04',
  716. order_cnt: 3,
  717. pay_cnt: 0,
  718. pay_money: 0.0
  719. }
  720. ]
  721. };
  722. if (res.code == 200) {
  723. this.options_line_line.xAxis.data = [];
  724. this.options_line_line.series[0].data = [];
  725. this.options_line_line.series[1].data = [];
  726. let today = new Date();
  727. for (let i = 30; i > 0; i--) {
  728. today = new Date();
  729. today.setTime(today.getTime() - 1000 * 60 * 60 * 24 * i);
  730. this.options_line_line.series[0].data.push({
  731. value: 0,
  732. name: today.format('yyyy年MM月dd日')
  733. });
  734. this.options_line_line.series[1].data.push({
  735. value: 0,
  736. money: 0
  737. });
  738. this.options_line_line.xAxis.data.push({
  739. value: today.format('dd'),
  740. time: today.format('yyyy-MM-dd')
  741. });
  742. }
  743. this.options_line_line.xAxis.data.forEach((x, i) => {
  744. let data = res.datas.find(d => d.time.split(' ')[0] == x.time);
  745. if (data) {
  746. this.options_line_line.series[0].data[i].value = data.order_cnt;
  747. this.options_line_line.series[1].data[i].value = data.pay_cnt;
  748. this.options_line_line.series[1].data[i].money = data.pay_money;
  749. }
  750. });
  751. this.echart_line_line.setOption(this.options_line_line);
  752. }
  753. },
  754. month() {
  755. this.days = '月';
  756. const res = {
  757. code: 200,
  758. msg: '',
  759. datas: [{
  760. time: '2021-07',
  761. order_cnt: 1,
  762. pay_cnt: 0,
  763. pay_money: 0.0
  764. },
  765. {
  766. time: '2021-06',
  767. order_cnt: 3,
  768. pay_cnt: 0,
  769. pay_money: 0.0
  770. },
  771. {
  772. time: '2021-05',
  773. order_cnt: 2,
  774. pay_cnt: 0,
  775. pay_money: 0.0
  776. },
  777. {
  778. time: '2021-04',
  779. order_cnt: 2,
  780. pay_cnt: 0,
  781. pay_money: 0.0
  782. },
  783. {
  784. time: '2021-03',
  785. order_cnt: 1,
  786. pay_cnt: 0,
  787. pay_money: 0.0
  788. },
  789. {
  790. time: '2021-02',
  791. order_cnt: 1,
  792. pay_cnt: 0,
  793. pay_money: 0.0
  794. },
  795. {
  796. time: '2021-01',
  797. order_cnt: 5,
  798. pay_cnt: 0,
  799. pay_money: 0.0
  800. },
  801. {
  802. time: '2020-12',
  803. order_cnt: 2,
  804. pay_cnt: 0,
  805. pay_money: 0.0
  806. },
  807. {
  808. time: '2020-10',
  809. order_cnt: 6,
  810. pay_cnt: 1,
  811. pay_money: 0.01
  812. },
  813. {
  814. time: '2020-09',
  815. order_cnt: 3,
  816. pay_cnt: 0,
  817. pay_money: 0.0
  818. }
  819. ]
  820. };
  821. if (res.code == 200) {
  822. this.options_line_line.xAxis.data = [];
  823. this.options_line_line.series[0].data = [];
  824. this.options_line_line.series[1].data = [];
  825. let today = new Date();
  826. for (let i = 12; i > 0; i--) {
  827. today = new Date();
  828. today.setMonth(today.getMonth() - i);
  829. this.options_line_line.series[0].data.push({
  830. value: 0,
  831. name: today.format('yyyy年MM月')
  832. });
  833. this.options_line_line.series[1].data.push({
  834. value: 0,
  835. money: 0
  836. });
  837. this.options_line_line.xAxis.data.push({
  838. value: today.format('MM'),
  839. time: today.format('yyyy-MM')
  840. });
  841. }
  842. this.options_line_line.xAxis.data.forEach((x, i) => {
  843. let data = res.datas.find(d => d.time.split(' ')[0] == x.time);
  844. if (data) {
  845. this.options_line_line.series[0].data[i].value = data.order_cnt;
  846. this.options_line_line.series[1].data[i].value = data.pay_cnt;
  847. this.options_line_line.series[1].data[i].money = data.pay_money;
  848. }
  849. });
  850. this.echart_line_line.setOption(this.options_line_line);
  851. }
  852. },
  853. get_visit_stats() {
  854. const res = {
  855. code: 200,
  856. msg: '',
  857. datas: [{
  858. goods_id: 1057,
  859. name: 'Huawei/华为Mate30 全网通5G智能手机',
  860. state: '销售中',
  861. visit: 32,
  862. browse: 101.0
  863. },
  864. {
  865. goods_id: 1061,
  866. name: '无耳洞耳夹OL多圈925银针耳钉简约时尚耳饰品',
  867. state: '销售中',
  868. visit: 31,
  869. browse: 247.0
  870. },
  871. {
  872. goods_id: 1042,
  873. name: '上衣衬衫女',
  874. state: '销售中',
  875. visit: 24,
  876. browse: 97.0
  877. },
  878. {
  879. goods_id: 1037,
  880. name: '小米电视',
  881. state: '销售中',
  882. visit: 24,
  883. browse: 92.0
  884. },
  885. {
  886. goods_id: 1046,
  887. name: '361°篮球鞋',
  888. state: '销售中',
  889. visit: 24,
  890. browse: 126.0
  891. },
  892. {
  893. goods_id: 1035,
  894. name: '三星冰箱',
  895. state: '销售中',
  896. visit: 24,
  897. browse: 114.0
  898. },
  899. {
  900. goods_id: 1055,
  901. name: '361男鞋运动鞋',
  902. state: '销售中',
  903. visit: 21,
  904. browse: 41.0
  905. },
  906. {
  907. goods_id: 1050,
  908. name: '华为荣耀20',
  909. state: '销售中',
  910. visit: 19,
  911. browse: 131.0
  912. },
  913. {
  914. goods_id: 1054,
  915. name: '耐克男子运动鞋',
  916. state: '销售中',
  917. visit: 18,
  918. browse: 49.0
  919. },
  920. {
  921. goods_id: 1045,
  922. name: 'Nike男鞋',
  923. state: '销售中',
  924. visit: 17,
  925. browse: 36.0
  926. },
  927. {
  928. goods_id: 1041,
  929. name: 'iPhone 11 Pro Max',
  930. state: '销售中',
  931. visit: 14,
  932. browse: 68.0
  933. },
  934. {
  935. goods_id: 1059,
  936. name: '小包包女新款潮2020法国小众质感高级感洋气小ck小香风链条斜挎包 ',
  937. state: '销售中',
  938. visit: 14,
  939. browse: 24.0
  940. },
  941. {
  942. goods_id: 1058,
  943. name: '鲶鱼包小CK女包2020新款春夏手提包真皮翅膀包结婚新娘包',
  944. state: '已下架',
  945. visit: 14,
  946. browse: 67.0
  947. },
  948. {
  949. goods_id: 1060,
  950. name: '阿吉豆耳钉女日韩可爱甜美气质猫咪耳环人造猫眼石文艺钩坠耳饰品 ',
  951. state: '销售中',
  952. visit: 14,
  953. browse: 54.0
  954. },
  955. {
  956. goods_id: 1039,
  957. name: '华为折叠手机',
  958. state: '销售中',
  959. visit: 14,
  960. browse: 116.0
  961. },
  962. {
  963. goods_id: 1043,
  964. name: '休闲裤',
  965. state: '已下架',
  966. visit: 12,
  967. browse: 20.0
  968. },
  969. {
  970. goods_id: 1053,
  971. name: '回力帆布小白鞋',
  972. state: '销售中',
  973. visit: 11,
  974. browse: 19.0
  975. },
  976. {
  977. goods_id: 1040,
  978. name: '小米10',
  979. state: '销售中',
  980. visit: 11,
  981. browse: 28.0
  982. },
  983. {
  984. goods_id: 1051,
  985. name: '黑鲨游戏手机',
  986. state: '销售中',
  987. visit: 11,
  988. browse: 69.0
  989. },
  990. {
  991. goods_id: 1056,
  992. name: '富士X-T200相机',
  993. state: '已下架',
  994. visit: 9,
  995. browse: 26.0
  996. }
  997. ]
  998. };
  999. if (res.code == 200) {
  1000. this.tableData_visit = res.datas;
  1001. }
  1002. },
  1003. get_browse_stats() {
  1004. const res = {
  1005. code: 200,
  1006. msg: '',
  1007. datas: [{
  1008. goods_id: 1061,
  1009. name: '无耳洞耳夹OL多圈925银针耳钉简约时尚耳饰品',
  1010. state: '销售中',
  1011. visit: 31,
  1012. browse: 247.0
  1013. },
  1014. {
  1015. goods_id: 1050,
  1016. name: '华为荣耀20',
  1017. state: '销售中',
  1018. visit: 19,
  1019. browse: 131.0
  1020. },
  1021. {
  1022. goods_id: 1046,
  1023. name: '361°篮球鞋',
  1024. state: '销售中',
  1025. visit: 24,
  1026. browse: 126.0
  1027. },
  1028. {
  1029. goods_id: 1039,
  1030. name: '华为折叠手机',
  1031. state: '销售中',
  1032. visit: 14,
  1033. browse: 116.0
  1034. },
  1035. {
  1036. goods_id: 1035,
  1037. name: '三星冰箱',
  1038. state: '销售中',
  1039. visit: 24,
  1040. browse: 114.0
  1041. },
  1042. {
  1043. goods_id: 1057,
  1044. name: 'Huawei/华为Mate30 全网通5G智能手机',
  1045. state: '销售中',
  1046. visit: 32,
  1047. browse: 101.0
  1048. },
  1049. {
  1050. goods_id: 1042,
  1051. name: '上衣衬衫女',
  1052. state: '销售中',
  1053. visit: 24,
  1054. browse: 97.0
  1055. },
  1056. {
  1057. goods_id: 1037,
  1058. name: '小米电视',
  1059. state: '销售中',
  1060. visit: 24,
  1061. browse: 92.0
  1062. },
  1063. {
  1064. goods_id: 1051,
  1065. name: '黑鲨游戏手机',
  1066. state: '销售中',
  1067. visit: 11,
  1068. browse: 69.0
  1069. },
  1070. {
  1071. goods_id: 1041,
  1072. name: 'iPhone 11 Pro Max',
  1073. state: '销售中',
  1074. visit: 14,
  1075. browse: 68.0
  1076. },
  1077. {
  1078. goods_id: 1058,
  1079. name: '鲶鱼包小CK女包2020新款春夏手提包真皮翅膀包结婚新娘包',
  1080. state: '已下架',
  1081. visit: 14,
  1082. browse: 67.0
  1083. },
  1084. {
  1085. goods_id: 1060,
  1086. name: '阿吉豆耳钉女日韩可爱甜美气质猫咪耳环人造猫眼石文艺钩坠耳饰品 ',
  1087. state: '销售中',
  1088. visit: 14,
  1089. browse: 54.0
  1090. },
  1091. {
  1092. goods_id: 1054,
  1093. name: '耐克男子运动鞋',
  1094. state: '销售中',
  1095. visit: 18,
  1096. browse: 49.0
  1097. },
  1098. {
  1099. goods_id: 1055,
  1100. name: '361男鞋运动鞋',
  1101. state: '销售中',
  1102. visit: 21,
  1103. browse: 41.0
  1104. },
  1105. {
  1106. goods_id: 1045,
  1107. name: 'Nike男鞋',
  1108. state: '销售中',
  1109. visit: 17,
  1110. browse: 36.0
  1111. },
  1112. {
  1113. goods_id: 1040,
  1114. name: '小米10',
  1115. state: '销售中',
  1116. visit: 11,
  1117. browse: 28.0
  1118. },
  1119. {
  1120. goods_id: 1056,
  1121. name: '富士X-T200相机',
  1122. state: '已下架',
  1123. visit: 9,
  1124. browse: 26.0
  1125. },
  1126. {
  1127. goods_id: 1059,
  1128. name: '小包包女新款潮2020法国小众质感高级感洋气小ck小香风链条斜挎包 ',
  1129. state: '销售中',
  1130. visit: 14,
  1131. browse: 24.0
  1132. },
  1133. {
  1134. goods_id: 1044,
  1135. name: '回力手绘鞋鲸鱼',
  1136. state: '销售中',
  1137. visit: 8,
  1138. browse: 22.0
  1139. },
  1140. {
  1141. goods_id: 1043,
  1142. name: '休闲裤',
  1143. state: '已下架',
  1144. visit: 12,
  1145. browse: 20.0
  1146. }
  1147. ]
  1148. };
  1149. if (res.code == 200) {
  1150. this.tableData_browse = res.datas;
  1151. }
  1152. },
  1153. create_map() {
  1154. const myChart = this.$echarts.init(document.getElementById('create-map'));
  1155. const res = {
  1156. code: 200,
  1157. msg: '',
  1158. datas: [{
  1159. pro: '广东',
  1160. cnt: 14.0
  1161. },
  1162. {
  1163. pro: '北京',
  1164. cnt: 5.0
  1165. },
  1166. {
  1167. pro: '河南',
  1168. cnt: 3.0
  1169. },
  1170. {
  1171. pro: '山东',
  1172. cnt: 3.0
  1173. },
  1174. {
  1175. pro: '湖北',
  1176. cnt: 2.0
  1177. },
  1178. {
  1179. pro: '吉林',
  1180. cnt: 1.0
  1181. },
  1182. {
  1183. pro: '上海',
  1184. cnt: 1.0
  1185. },
  1186. {
  1187. pro: '沙田区',
  1188. cnt: 1.0
  1189. },
  1190. {
  1191. pro: '海南',
  1192. cnt: 1.0
  1193. }
  1194. ]
  1195. };
  1196. let dataList = [{
  1197. name: '南海诸岛',
  1198. value: 0
  1199. },
  1200. {
  1201. name: '北京',
  1202. value: 54
  1203. },
  1204. {
  1205. name: '天津',
  1206. value: 13
  1207. },
  1208. {
  1209. name: '上海',
  1210. value: 40
  1211. },
  1212. {
  1213. name: '重庆',
  1214. value: 75
  1215. },
  1216. {
  1217. name: '河北',
  1218. value: 13
  1219. },
  1220. {
  1221. name: '河南',
  1222. value: 83
  1223. },
  1224. {
  1225. name: '云南',
  1226. value: 11
  1227. },
  1228. {
  1229. name: '辽宁',
  1230. value: 19
  1231. },
  1232. {
  1233. name: '黑龙江',
  1234. value: 15
  1235. },
  1236. {
  1237. name: '湖南',
  1238. value: 69
  1239. },
  1240. {
  1241. name: '安徽',
  1242. value: 60
  1243. },
  1244. {
  1245. name: '山东',
  1246. value: 39
  1247. },
  1248. {
  1249. name: '新疆',
  1250. value: 4
  1251. },
  1252. {
  1253. name: '江苏',
  1254. value: 31
  1255. },
  1256. {
  1257. name: '浙江',
  1258. value: 104
  1259. },
  1260. {
  1261. name: '江西',
  1262. value: 36
  1263. },
  1264. {
  1265. name: '湖北',
  1266. value: 1052
  1267. },
  1268. {
  1269. name: '广西',
  1270. value: 33
  1271. },
  1272. {
  1273. name: '甘肃',
  1274. value: 7
  1275. },
  1276. {
  1277. name: '山西',
  1278. value: 9
  1279. },
  1280. {
  1281. name: '内蒙古',
  1282. value: 7
  1283. },
  1284. {
  1285. name: '陕西',
  1286. value: 22
  1287. },
  1288. {
  1289. name: '吉林',
  1290. value: 4
  1291. },
  1292. {
  1293. name: '福建',
  1294. value: 18
  1295. },
  1296. {
  1297. name: '贵州',
  1298. value: 5
  1299. },
  1300. {
  1301. name: '广东',
  1302. value: 98
  1303. },
  1304. {
  1305. name: '青海',
  1306. value: 1
  1307. },
  1308. {
  1309. name: '西藏',
  1310. value: 0
  1311. },
  1312. {
  1313. name: '四川',
  1314. value: 44
  1315. },
  1316. {
  1317. name: '宁夏',
  1318. value: 4
  1319. },
  1320. {
  1321. name: '海南',
  1322. value: 22
  1323. },
  1324. {
  1325. name: '台湾',
  1326. value: 3
  1327. },
  1328. {
  1329. name: '香港',
  1330. value: 5
  1331. },
  1332. {
  1333. name: '澳门',
  1334. value: 5
  1335. }
  1336. ];
  1337. dataList.forEach(_ => {
  1338. let _pro = res.datas.find(x => x.pro == _.name);
  1339. if (_pro) {
  1340. _.value = _pro.cnt;
  1341. } else {
  1342. _.value = 0;
  1343. }
  1344. });
  1345. const option = {
  1346. tooltip: {
  1347. show: true,
  1348. formatter: function(e) {
  1349. return 0 == e.value ? e.name + ':暂无会员' : e.seriesName + '\n' + e.name + ':' + e.value;
  1350. }
  1351. },
  1352. visualMap: {
  1353. min: 0,
  1354. max: 1000,
  1355. left: 10,
  1356. bottom: 40,
  1357. showLabel: !0,
  1358. text: ['高', '低'],
  1359. pieces: [{
  1360. gt: 100,
  1361. label: '> 100 人',
  1362. color: '#7f1100'
  1363. },
  1364. {
  1365. gte: 10,
  1366. lte: 100,
  1367. label: '10 - 100 人',
  1368. color: '#ff5428'
  1369. },
  1370. {
  1371. gte: 1,
  1372. lt: 10,
  1373. label: '1 - 9 人',
  1374. color: '#ff8c71'
  1375. },
  1376. {
  1377. gt: 0,
  1378. lt: 1,
  1379. label: '疑似',
  1380. color: '#ffd768'
  1381. },
  1382. {
  1383. value: 0,
  1384. color: '#ffffff'
  1385. }
  1386. ],
  1387. show: false
  1388. },
  1389. geo: {
  1390. map: 'china',
  1391. roam: !1,
  1392. scaleLimit: {
  1393. min: 1,
  1394. max: 2
  1395. },
  1396. zoom: 1.2,
  1397. top: 60,
  1398. label: {
  1399. normal: {
  1400. show: !0,
  1401. fontSize: '14',
  1402. color: 'rgba(0,0,0,0.7)'
  1403. }
  1404. },
  1405. itemStyle: {
  1406. normal: {
  1407. //shadowBlur: 50,
  1408. //shadowColor: 'rgba(0, 0, 0, 0.2)',
  1409. borderColor: 'rgba(0, 0, 0, 0.2)'
  1410. },
  1411. emphasis: {
  1412. areaColor: '#f2d5ad',
  1413. shadowOffsetX: 0,
  1414. shadowOffsetY: 0,
  1415. borderWidth: 0
  1416. }
  1417. }
  1418. },
  1419. series: [{
  1420. name: '会员人数',
  1421. type: 'map',
  1422. geoIndex: 0,
  1423. data: dataList
  1424. }]
  1425. };
  1426. myChart.setOption(option);
  1427. window.addEventListener('resize', function() {
  1428. myChart.resize();
  1429. });
  1430. }
  1431. },
  1432. created() {
  1433. this.member_sta = {
  1434. member_cnt: 246,
  1435. member_cnt_7: 4,
  1436. member_cnt_today: 0,
  1437. member_cnt_yesterday: 10,
  1438. order_cnt: 42,
  1439. pay_cnt: 20
  1440. };
  1441. this.order_sta = {
  1442. order_cnt: 162,
  1443. pay_cnt: 52,
  1444. pay_money: 0.6,
  1445. refund_cnt: 4
  1446. };
  1447. this.get_visit_stats();
  1448. this.get_browse_stats();
  1449. },
  1450. mounted() {
  1451. this.create_line_line(() => {
  1452. this.day();
  1453. });
  1454. this.create_pie();
  1455. this.create_map();
  1456. }
  1457. };
  1458. </script>
  1459. <style>
  1460. .separate_page {
  1461. background-color: #fff;
  1462. margin-bottom: 16px;
  1463. padding: 30px;
  1464. border-radius: 10px;
  1465. }
  1466. .tag {
  1467. margin-top: 2.1875rem;
  1468. width: 15rem;
  1469. height: 6.25rem;
  1470. background-color: #7d6aff;
  1471. border-radius: 0.625rem;
  1472. margin-right: 2.5rem;
  1473. display: flex;
  1474. align-items: center;
  1475. justify-content: center;
  1476. padding-top: 0.625rem;
  1477. }
  1478. .tag:nth-child(2) {
  1479. background-color: #ffa66a;
  1480. }
  1481. .tag:nth-child(3) {
  1482. background-color: #ff6b6b;
  1483. }
  1484. .tag:nth-child(4) {
  1485. background-color: #69b5ff;
  1486. }
  1487. .tag:nth-child(5) {
  1488. background-color: #b96bff;
  1489. }
  1490. .tag:nth-child(6) {
  1491. background-color: #e9c52b;
  1492. }
  1493. .tag i {
  1494. font-size: 2.1875rem;
  1495. margin-right: 1.5625rem;
  1496. color: #fff;
  1497. }
  1498. .tag_title {
  1499. font-size: 0.875rem;
  1500. color: #fff;
  1501. }
  1502. .tag_data {
  1503. font-size: 1.5625rem;
  1504. font-weight: 400;
  1505. color: #fff;
  1506. }
  1507. .order {
  1508. padding-top: 2rem;
  1509. }
  1510. .stats_area {
  1511. height: 38rem;
  1512. overflow: hidden;
  1513. }
  1514. .card {
  1515. margin-top: 1rem;
  1516. }
  1517. .circle_txt {
  1518. font-size: 1.25rem;
  1519. text-align: center;
  1520. line-height: 3.75rem;
  1521. margin-bottom: 2.5rem;
  1522. color: #fff;
  1523. margin-right: 1.25rem;
  1524. margin-left: 2.1875rem;
  1525. width: 3.75rem;
  1526. height: 3.75rem;
  1527. border-radius: 50%;
  1528. background-color: #ff6b6b;
  1529. }
  1530. .dflex:nth-child(2) .circle_txt {
  1531. background-color: #7e6aff;
  1532. }
  1533. .dflex:nth-child(3) .circle_txt {
  1534. background-color: #69b5ff;
  1535. }
  1536. .dflex:nth-child(4) .circle_txt {
  1537. background-color: #ffa66a;
  1538. }
  1539. .dflex:nth-child(5) .circle_txt {
  1540. margin-bottom: 0rem;
  1541. background-color: #b96bff;
  1542. }
  1543. .order_title {
  1544. font-size: 0.75rem;
  1545. margin-top: 0.5625rem;
  1546. }
  1547. .order_data {
  1548. font-size: 1.25rem;
  1549. }
  1550. .echart_line_line {
  1551. width: 100%;
  1552. height: 34rem;
  1553. padding-top: 2rem;
  1554. }
  1555. .ranking_area {
  1556. height: 32rem;
  1557. overflow: hidden;
  1558. }
  1559. .echart_pie {
  1560. width: 100%;
  1561. height: 30rem;
  1562. padding-top: 2rem;
  1563. }
  1564. .echart_map {
  1565. width: 100%;
  1566. height: 40rem;
  1567. padding-top: 2rem;
  1568. }
  1569. </style>