sales-data.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('components/count-to', __DIR__);
  4. ComponentHelper::loadComponentView('components/list', __DIR__);
  5. ComponentHelper::loadComponentView('components/my-table', __DIR__);
  6. ComponentHelper::loadComponentView('components/screen-contain', __DIR__);
  7. ?>
  8. <div id="sales-data" v-cloak>
  9. <screen-contain text-left="直播间带货销售数据" text-right="直播间带货销售数据">
  10. <div class="sales-data-cont">
  11. <div class="echarts-item flex-y-end one">
  12. <div>
  13. <div class="title">今日互动数据</div>
  14. <div class="func-list">
  15. <div v-for="(item,index) in list" :key="index" style="margin-bottom: 12px;">
  16. <div class="circ" :style="{background: item.color}"></div>
  17. <div class="number">{{item.number}}</div>
  18. <div class="text">{{item.text}}</div>
  19. </div>
  20. </div>
  21. </div>
  22. <div id="echarts1" style="width: 220px;height: 220px;"></div>
  23. </div>
  24. <div class="live live-bg">
  25. <div class="live-title" style="width:100%;height: 80px;">
  26. <div>直播累计销售额</div>
  27. <img style="position: relative; top: -18px" src="/resources/img/dirve/live-title-bg.png">
  28. </div>
  29. <div flex='cross:center' style="justify-content: center;">
  30. <div flex style="align-items: flex-end;" class="live-bg-money">
  31. <div style="font-size:30px">¥</div>
  32. <count-to class="count-to"></count-to>
  33. </div>
  34. </div>
  35. <div class="live-text">
  36. <div>总销售量 <span>602</span> 件</div>
  37. <div>累计观看 <span>1165</span> 人</div>
  38. </div>
  39. </div>
  40. <div class="echarts-item flex-y-end" style="padding-bottom:0;flex-wrap: wrap;">
  41. <div class="echarts3-title">
  42. <div style="font-size:30px;">观看人数趋势</div>
  43. <div>单位:人</div>
  44. </div>
  45. <div id="echarts3" style="width: 467px;height: 316px;"></div>
  46. </div>
  47. <div class="echarts-item anchor">
  48. <div class="anchor-title">主播排行榜TOP10</div>
  49. <div style="height:200px;">
  50. <my-table :data="tableData" :options="options">
  51. <!-- 没有做单独的标签 -->
  52. <template v-slot:sort="{ item,index }">
  53. <div>{{index+1}}</div>
  54. </template>
  55. </my-table>
  56. </div>
  57. </div>
  58. <div class="echarts-item commodity">
  59. <div class="commodity-header">
  60. <div class="commodity-title">商品排行</div>
  61. <div>
  62. <el-radio-group v-model="radio">
  63. <el-radio-button label="访问数据"></el-radio-button>
  64. <el-radio-button label="销售数据"></el-radio-button>
  65. </el-radio-group>
  66. </div>
  67. </div>
  68. <div style="text-align: end;margin: 10px 0">
  69. 商品总数:<span style="font-size: 23px;">6530件</span>
  70. </div>
  71. <div style="height:200px;">
  72. <my-table :data="tableData" :options="options1">
  73. <!-- 没有做单独的标签 -->
  74. <template v-slot:sort="{ item,index }">
  75. <div>得实DL - 528 条码...</div>
  76. </template>
  77. </my-table>
  78. </div>
  79. </div>
  80. <div class="echarts-item flex-y-end" style="padding-bottom:0;flex-wrap: wrap;">
  81. <div class="echarts6-title">
  82. <div style="font-size:30px;">直播交易趋势</div>
  83. <div>单位:元</div>
  84. </div>
  85. <div id="echarts6" style="width: 467px;height: 316px;"></div>
  86. </div>
  87. </div>
  88. <template v-slot:right>
  89. <div flex style="padding: 0 30px;">
  90. <div flex>
  91. <div style="font-size: 38px;">9:34</div>
  92. <div style="font-size: 16px;flex-direction: column;margin:0 30px 0 45px " flex="main:center">
  93. <div style="width: 100%;">星期五 上午</div>
  94. <div>2021年7月23日</div>
  95. </div>
  96. </div>
  97. <div class="full-screen">全屏</div>
  98. </div>
  99. </template>
  100. </screen-contain>
  101. </div>
  102. <!-- <script src="https://cdn.jsdelivr.net/npm/echarts@5.2.2/dist/echarts.min.js"></script> -->
  103. <script src="/resources/unpkg/echarts@5.2.2/dist/echarts.min.js"></script>
  104. <script>
  105. const app = new Vue({
  106. el: '#sales-data',
  107. data() {
  108. return {
  109. radio: '上海',
  110. options: [{
  111. props: "sort",
  112. label: '排行',
  113. width: '40',
  114. slot: true,
  115. }, {
  116. props: "name",
  117. label: '姓名',
  118. }, {
  119. props: "salesVolume",
  120. label: '销量',
  121. }, {
  122. props: "saleMoeny",
  123. label: '销售额',
  124. }, ],
  125. options1: [{
  126. props: "sort",
  127. label: '商品名称',
  128. width: '200',
  129. slot: true,
  130. textAlign: 'left'
  131. }, {
  132. props: "saleMoeny",
  133. label: '直播价',
  134. }, {
  135. props: "salesVolume",
  136. label: '点击人数',
  137. }, {
  138. props: "saleMoeny",
  139. label: '点击次数',
  140. }, ],
  141. tableData: [{
  142. sort: "0",
  143. name: '王小虎',
  144. salesVolume: '50',
  145. saleMoeny: '100'
  146. }, {
  147. sort: "0",
  148. salesVolume: '50',
  149. name: '王小虎',
  150. saleMoeny: '100'
  151. }, {
  152. sort: "0",
  153. salesVolume: '50',
  154. name: '王小虎',
  155. saleMoeny: '100'
  156. }, {
  157. sort: "0",
  158. salesVolume: '50',
  159. name: '王小虎',
  160. saleMoeny: '100'
  161. }, {
  162. sort: "0",
  163. salesVolume: '50',
  164. name: '王小虎',
  165. saleMoeny: '100'
  166. }, {
  167. sort: "0",
  168. salesVolume: '50',
  169. name: '王小虎',
  170. saleMoeny: '100'
  171. }, {
  172. sort: "0",
  173. salesVolume: '50',
  174. name: '王小虎',
  175. saleMoeny: '100'
  176. }, {
  177. sort: "0",
  178. salesVolume: '50',
  179. name: '王小虎',
  180. saleMoeny: '100'
  181. }, {
  182. sort: "0",
  183. salesVolume: '50',
  184. name: '王小虎',
  185. saleMoeny: '100'
  186. }, ],
  187. list: [{
  188. text: '观看人数',
  189. number: 65,
  190. color: '#0034E4'
  191. }, {
  192. text: '观看次数',
  193. number: 156,
  194. color: '#0187E1'
  195. }, {
  196. text: '分享人数',
  197. number: 10,
  198. color: '#18D275'
  199. }, {
  200. text: '分享次数',
  201. number: 86,
  202. color: '#A2E157'
  203. }, {
  204. text: '点赞人数',
  205. number: 615,
  206. color: '#EDA553'
  207. }, {
  208. text: '点赞次数',
  209. number: 65,
  210. color: '#ED7453'
  211. }]
  212. }
  213. },
  214. methods: {
  215. handleList(list) {
  216. return list.map(item => {
  217. return {
  218. value: item.number,
  219. name: item.text
  220. }
  221. })
  222. },
  223. echarts1Init() {
  224. const data = this.handleList(this.list)
  225. const colorList = this.list.map(item => {
  226. return item.color
  227. })
  228. var chartDom = document.getElementById('echarts1');
  229. var myChart = echarts.init(chartDom);
  230. var option = {
  231. color: colorList,
  232. title: {
  233. text: '6分10秒\n平均观看时长',
  234. x: 'center',
  235. y: 'center',
  236. textStyle: {
  237. fontSize: 16,
  238. color: '#fff'
  239. }
  240. },
  241. tooltip: {
  242. trigger: 'item'
  243. },
  244. series: [{
  245. name: 'Access From',
  246. type: 'pie',
  247. radius: ['50%', '70%'],
  248. avoidLabelOverlap: false,
  249. label: {
  250. show: false,
  251. position: 'center'
  252. },
  253. labelLine: {
  254. show: false
  255. },
  256. data
  257. }]
  258. };
  259. myChart.setOption(option);
  260. },
  261. echarts3Init() {
  262. var chartDom = document.getElementById('echarts3');
  263. var myChart = echarts.init(chartDom);
  264. // 指定图表的配置项和数据
  265. var option = {
  266. textStyle: {
  267. color: "#DCDFEB"
  268. },
  269. color: ['#80FFA5'],
  270. tooltip: {
  271. trigger: 'axis',
  272. axisPointer: {
  273. type: 'cross',
  274. label: {
  275. backgroundColor: '#6a7985'
  276. }
  277. }
  278. },
  279. xAxis: [{
  280. type: 'category',
  281. boundaryGap: false,
  282. data: ['10:00', '11:00', '12:00', '13:00', '14:00', '15:00']
  283. }],
  284. yAxis: [{
  285. type: 'value',
  286. max: 10000,
  287. splitLine: {
  288. lineStyle: {
  289. color: "rgba(250,250,250,0.4)"
  290. }
  291. }
  292. }],
  293. series: [{
  294. name: '观看人数',
  295. type: 'line',
  296. stack: 'Total',
  297. smooth: true,
  298. lineStyle: {
  299. width: '2',
  300. color: "#0034E4"
  301. },
  302. showSymbol: false,
  303. areaStyle: {
  304. opacity: 0.8,
  305. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  306. offset: 0,
  307. color: 'rgba(0, 52, 228, 0.42)'
  308. },
  309. {
  310. offset: 0.5,
  311. color: 'rgba(0, 52, 228, 0.28)'
  312. },
  313. {
  314. offset: 0.82,
  315. color: 'rgba(0, 52, 228, 0.08)'
  316. },
  317. {
  318. offset: 1,
  319. color: 'rgba(0, 52, 228, 0)'
  320. }
  321. ])
  322. },
  323. emphasis: {
  324. focus: 'series'
  325. },
  326. data: [0, 6000, 4000, 6000, 2000, 8000]
  327. }]
  328. };
  329. myChart.setOption(option);
  330. },
  331. echarts6Init() {
  332. var chartDom = document.getElementById('echarts6');
  333. var myChart = echarts.init(chartDom);
  334. // 指定图表的配置项和数据
  335. var option = {
  336. textStyle: {
  337. color: "#DCDFEB"
  338. },
  339. color: ['#80FFA5'],
  340. tooltip: {
  341. trigger: 'axis',
  342. axisPointer: {
  343. type: 'cross',
  344. label: {
  345. backgroundColor: '#6a7985'
  346. }
  347. }
  348. },
  349. xAxis: [{
  350. type: 'category',
  351. boundaryGap: false,
  352. data: ['10-09', '10-10', '10-11', '10-12', '10-13', '10-14']
  353. }],
  354. yAxis: [{
  355. type: 'value',
  356. max: 10000,
  357. splitLine: {
  358. lineStyle: {
  359. color: "rgba(250,250,250,0.4)"
  360. }
  361. }
  362. }],
  363. series: [{
  364. name: '交易金额',
  365. type: 'line',
  366. stack: 'Total',
  367. smooth: true,
  368. lineStyle: {
  369. width: '2',
  370. color: "#0034E4"
  371. },
  372. showSymbol: false,
  373. areaStyle: {
  374. opacity: 0.8,
  375. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  376. offset: 0,
  377. color: 'rgba(0, 52, 228, 0.42)'
  378. },
  379. {
  380. offset: 0.5,
  381. color: 'rgba(0, 52, 228, 0.28)'
  382. },
  383. {
  384. offset: 0.82,
  385. color: 'rgba(0, 52, 228, 0.08)'
  386. },
  387. {
  388. offset: 1,
  389. color: 'rgba(0, 52, 228, 0)'
  390. }
  391. ])
  392. },
  393. emphasis: {
  394. focus: 'series'
  395. },
  396. data: [0, 6000, 4000, 6000, 2000, 8000]
  397. }]
  398. };
  399. myChart.setOption(option);
  400. },
  401. },
  402. mounted() {
  403. this.echarts6Init()
  404. this.echarts3Init()
  405. this.echarts1Init()
  406. }
  407. })
  408. </script>
  409. <style>
  410. .commodity-header {
  411. display: flex;
  412. align-items: center;
  413. justify-content: space-between;
  414. }
  415. .anchor-title,
  416. .commodity-title {
  417. height: 37px;
  418. font-size: 30px;
  419. font-family: DIN;
  420. font-weight: bold;
  421. line-height: 37px;
  422. color: #F8F8F8;
  423. }
  424. .anchor-title {
  425. margin-bottom: 30px;
  426. }
  427. .live {
  428. flex-direction: column;
  429. justify-content: space-between;
  430. }
  431. .live .count-to {
  432. font-size: 60px;
  433. text-align: center;
  434. }
  435. .live-text {
  436. width: 100%;
  437. height: 80px;
  438. display: flex;
  439. padding: 0 30px;
  440. align-items: flex-end;
  441. justify-content: space-between;
  442. }
  443. .live-bg {
  444. display: flex;
  445. width: 527px;
  446. height: 376px;
  447. padding: 20px 0;
  448. margin-bottom: 40px;
  449. background: url('/resources/img/dirve/live-bg.png') no-repeat;
  450. background-size: 100% 100%;
  451. }
  452. .live-bg-money {
  453. width: 100%;
  454. padding: 40px 0;
  455. justify-content: center;
  456. background: url('/resources/img/dirve/live-bg-money.png') no-repeat;
  457. background-size: 100% 100%;
  458. }
  459. .live-text>div {
  460. height: 37px;
  461. font-family: Source Han Sans CN;
  462. font-weight: bold;
  463. line-height: 32px;
  464. font-size: 19px;
  465. color: #ddd;
  466. }
  467. .live-text>div span {
  468. font-size: 30px;
  469. color: #F8F8F8;
  470. }
  471. .live-title {
  472. height: 45px;
  473. font-size: 45px;
  474. font-family: Source Han Sans CN;
  475. font-weight: bold;
  476. text-align: center;
  477. color: #F8F8F8;
  478. }
  479. .sales-data-cont {
  480. display: flex;
  481. padding: 40px 40px 0 40px;
  482. flex-wrap: wrap;
  483. justify-content: space-around;
  484. }
  485. .flex-y-end {
  486. align-items: flex-end;
  487. }
  488. .echarts3-title,
  489. .echarts6-title {
  490. display: flex;
  491. justify-content: space-between;
  492. align-items: flex-end;
  493. width: 100%;
  494. }
  495. .anchor,
  496. .commodity {
  497. flex-direction: column;
  498. }
  499. .echarts-item {
  500. display: flex;
  501. width: 527px;
  502. height: 376px;
  503. padding: 30px;
  504. margin-bottom: 40px;
  505. background: linear-gradient(137deg, #0034E4 0%, #14141A 20%, rgba(7, 7, 9, 0.89) 80%, #0034E4 100%);
  506. border: 2px solid #0034E4;
  507. }
  508. .one .title {
  509. margin-bottom: 42px;
  510. font-size: 30px;
  511. font-family: Source Han Sans CN;
  512. font-weight: 500;
  513. line-height: 51px;
  514. color: #F8F8F8;
  515. }
  516. .one .func-list {
  517. display: flex;
  518. flex-wrap: wrap;
  519. }
  520. .one .func-list>div {
  521. width: 50%;
  522. }
  523. .one .func-list .circ {
  524. width: 11px;
  525. height: 11px;
  526. background: #0034E4;
  527. border-radius: 50%;
  528. }
  529. .one .func-list .number {
  530. height: 37px;
  531. font-size: 30px;
  532. font-weight: bold;
  533. line-height: 37px;
  534. color: #F8F8F8;
  535. }
  536. .one .func-list .text {
  537. font-size: 15px;
  538. font-family: Source Han Sans CN;
  539. font-weight: 400;
  540. line-height: 25px;
  541. color: #F8F8F8;
  542. opacity: 0.72;
  543. }
  544. .echarts-one {
  545. width: 200px;
  546. height: 200px;
  547. background-color: #ddd;
  548. }
  549. .el-radio-button:first-child .el-radio-button__inner {
  550. border-left: 1px solid #0034E4;
  551. }
  552. .el-radio-button__orig-radio:checked+.el-radio-button__inner {
  553. color: #FFF;
  554. background-color: #0034E4;
  555. border-color: #0034E4;
  556. }
  557. .el-radio-button:first-child .el-radio-button__inner {
  558. border-radius: 50px 0 0 50px;
  559. }
  560. .el-radio-button:last-child .el-radio-button__inner {
  561. border-radius: 0 50px 50px 0;
  562. }
  563. .el-radio-button__inner {
  564. padding: 8px 12px;
  565. color: #fff;
  566. background: transparent;
  567. border: 1px solid #0034E4;
  568. }
  569. .full-screen {
  570. width: 90px;
  571. height: 45px;
  572. border: 2px solid #0034E4;
  573. font-size: 23px;
  574. border-radius: 11px;
  575. line-height: 39px;
  576. color: #3865FC;
  577. text-align: center;
  578. }
  579. </style>