index.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <div id='app' v-cloak>
  2. <!-- 卡片1 -->
  3. <el-card shadow="never" style="border:0;min-width: 1200px;background: #f3f3f3;padding-bottom: 20px;" body-style="padding: 0 0;">
  4. <div class="header-item flex-row" :data="yesterday_state_list">
  5. <div class="items" >
  6. <div>{{yesterday_state_list.goods_amount || 0}}</div>
  7. <div>交易金额</div>
  8. </div>
  9. <div class="items" >
  10. <div>{{yesterday_state_list.order_count || 0}}</div>
  11. <div>订单量</div>
  12. </div>
  13. <div class="items" >
  14. <div>{{yesterday_state_list.goods_views_count || 0}}</div>
  15. <div>商品访问量</div>
  16. </div>
  17. <div class="items" >
  18. <div>{{yesterday_state_list.push_count || 0}}</div>
  19. <div>发布量</div>
  20. </div>
  21. <div class="items" >
  22. <div>{{yesterday_state_list.views_count || 0}}</div>
  23. <div>浏览量</div>
  24. </div>
  25. <div class="items" >
  26. <div>{{yesterday_state_list.stars_count || 0}}</div>
  27. <div>点赞量</div>
  28. </div>
  29. <div class="items" >
  30. <div>{{yesterday_state_list.shares_count || 0}}</div>
  31. <div>分享量</div>
  32. </div>
  33. <div class="items" >
  34. <div>{{yesterday_state_list.discuss_count || 0}}</div>
  35. <div>评论量</div>
  36. </div>
  37. <!-- <div style="display: none;">1</div> -->
  38. </div>
  39. <!-- 数据概况 -->
  40. <div class="profile">
  41. <div class="profile-header flex-x-between">
  42. <span class="titles">趋势分析</span>
  43. <div class="block">
  44. <el-date-picker
  45. v-model="time1"
  46. type="daterange"
  47. align="right"
  48. unlink-panels
  49. range-separator="至"
  50. start-placeholder="开始日期"
  51. end-placeholder="结束日期"
  52. :picker-options="pickerOptions"
  53. @change="pickerChange"
  54. :default-time="['00:00:00', '23:59:59']"
  55. >
  56. </el-date-picker>
  57. </div>
  58. </div>
  59. <!-- echarts -->
  60. <div class="dataBox" id="echartsBox1" style="width: calc(100% - 250px);height: 500px;"></div>
  61. </div>
  62. <!-- 人气排行 -->
  63. <el-row :gutter="20" v-loading="loading">
  64. <el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
  65. <el-card class="card box-card" v-if="allData" v-loading="loading5">
  66. <div class="cardHead" style="padding-bottom: 10px;">
  67. <div style="font-size: 17px;font-weight: bold;flex-shrink: 0;">人气排行TOP5</div>
  68. </div>
  69. <el-table class="myTable" :data="content_top_list" style="width: 100%">
  70. <el-table-column prop="rangk" label="排名" width="100">
  71. <template slot-scope="scope">
  72. <img style="margin-top: 3px" v-if="scope.$index == 0"
  73. src="resources/img/mall/statistic/first.png" alt="">
  74. <img style="margin-top: 3px" v-else-if="scope.$index == 1"
  75. src="resources/img/mall/statistic/sec.png" alt="">
  76. <img style="margin-top: 3px" v-else-if="scope.$index == 2"
  77. src="resources/img/mall/statistic/third.png" alt="">
  78. <span v-else-if="scope.$index < 9">0{{scope.$index+1}}</span>
  79. <span v-else>{{scope.$index+1}}</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column prop="title" label="标题" width="400" >
  83. <template slot-scope="scope">
  84. <div class="flex-row">
  85. <el-image fit="cover" v-if = "scope.row.type == 1" :src="scope.row.source.source[0]" style="width: 90px;height:70px;border-radius: 5px;flex-shrink: 0;margin-right: 5px;"></el-image>
  86. <el-image fit="cover" v-else :src="scope.row.source.cover" style="width: 90px;height:70px;border-radius: 5px;flex-shrink: 0;margin-right: 5px;"></el-image>
  87. <span style="margin-left: 10px">{{ scope.row.title }}</span>
  88. </div>
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="view_number" label="点赞量" align="center" >
  92. <template slot-scope="scope">
  93. <span style="margin-left: 10px">{{ scope.row.stars_count || 0 }}</span>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. </el-card>
  98. </el-col>
  99. <el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
  100. <el-card class="card box-card" v-if="allData" v-loading="loading5">
  101. <div class="cardHead" style="padding-bottom: 10px;">
  102. <div style="font-size: 17px;font-weight: bold;flex-shrink: 0;">带货排行TOP5</div>
  103. </div>
  104. <el-table class="myTable" :data="good_top_list" style="width: 100%">
  105. <el-table-column prop="rangk" label="排名" width="100">
  106. <template slot-scope="scope">
  107. <img style="margin-top: 3px" v-if="scope.$index == 0"
  108. src="resources/img/mall/statistic/first.png" alt="">
  109. <img style="margin-top: 3px" v-else-if="scope.$index == 1"
  110. src="resources/img/mall/statistic/sec.png" alt="">
  111. <img style="margin-top: 3px" v-else-if="scope.$index == 2"
  112. src="resources/img/mall/statistic/third.png" alt="">
  113. <span v-else-if="scope.$index < 9">0{{scope.$index+1}}</span>
  114. <span v-else>{{scope.$index+1}}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column prop="good_name" label="商品名称" width="290" >
  118. <template slot-scope="scope">
  119. <div class="flex-row">
  120. <el-image fit="cover" :src="scope.row.goods.cover_pic" style="width: 90px;height:70px;border-radius: 5px;flex-shrink: 0;margin-right: 5px;"></el-image>
  121. <span style="margin-left: 10px">{{ scope.row.goods.goods_name }}</span>
  122. </div>
  123. </template>
  124. </el-table-column>
  125. <el-table-column prop="view_number" label="商品访问人数" width="110">
  126. <template slot-scope="scope">
  127. <span style="margin-left: 10px">{{ scope.row.goods_views_count || 0 }}</span>
  128. </template>
  129. </el-table-column>
  130. <el-table-column prop="bought_number" label="成交人数" width="100">
  131. <template slot-scope="scope">
  132. <span style="margin-left: 10px">{{ scope.row.bought_count || 0 }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column prop="amount" label="成交金额" width="100">
  136. <template slot-scope="scope">
  137. <span style="margin-left: 10px">{{ scope.row.total_amount || 0 }}</span>
  138. </template>
  139. </el-table-column>
  140. <!-- <el-table-column prop="address" label="人气" align="center" >
  141. <template slot-scope="scope">
  142. <span style="margin-left: 10px">{{ scope.row.view_number || 0 }}</span>
  143. </template>
  144. </el-table-column> -->
  145. </el-table>
  146. </el-card>
  147. </el-col>
  148. </el-row>
  149. </el-card>
  150. </div>
  151. <script>
  152. let myChart;
  153. new Vue({
  154. el: '#app',
  155. data() {
  156. return {
  157. yesterday_state_list: {
  158. push_count:0,
  159. views_count:0,
  160. star_count:0,
  161. share_count:0,
  162. discuss_count:0,
  163. },
  164. pickerOptions: {
  165. shortcuts: [
  166. {
  167. text: '7天',
  168. onClick(picker) {
  169. const end = new Date();
  170. const start = new Date();
  171. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  172. picker.$emit('pick', [start, end]);
  173. }
  174. },
  175. {
  176. text: '30天',
  177. onClick(picker) {
  178. const end = new Date();
  179. const start = new Date();
  180. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  181. picker.$emit('pick', [start, end]);
  182. }
  183. }
  184. ]
  185. },
  186. time1: '',
  187. currentTimestamp1: '', // 当前时间
  188. beforeTimestamp1: '', // 之前时间(这里是7天前)
  189. allData: [],
  190. loading: false,
  191. loading5:false,
  192. personAndTeamList:{},
  193. content_top_list: [],
  194. good_top_list:[],
  195. }
  196. },
  197. created() {
  198. },
  199. mounted() {
  200. myChart = echarts.init(document.querySelector("#echartsBox1"));
  201. let currentTimestamp = new Date().getTime();
  202. this.currentTimestamp1 = currentTimestamp;
  203. this.beforeTimestamp1 = new Date(new Date().toLocaleDateString()).getTime() - 7 * 24 * 3600 * 1000 /// 1000
  204. this.time1 = [this.beforeTimestamp1,this.currentTimestamp1]
  205. this.getStateList();
  206. },
  207. methods: {
  208. // 获取昨日统计数据
  209. getStateList(startTime = null, endTime = null) {
  210. let self = this;
  211. self.listLoading = true;
  212. request({
  213. params: {
  214. r: 'operating-note/statistics/index',
  215. },
  216. data:{start_time: startTime, end_time: endTime},
  217. method: 'post',
  218. }).then(e => {
  219. // console.log(e);
  220. self.listLoading = false;
  221. if (e.data.code === 0) {
  222. this.content_top_list = e.data.data.start_list;
  223. this.good_top_list = e.data.data.goods_list;
  224. if(e.data.data.yesterday_data) this.yesterday_state_list = e.data.data.yesterday_data;
  225. if(e.data.data.statistical_list.dates) this.chartFun(e.data.data.statistical_list); else self.$message.success("暂无数据");
  226. } else {
  227. self.$message.error(e.data.msg);
  228. }
  229. }).catch(e => {
  230. console.log(e);
  231. });
  232. },
  233. pickerChange(e) {
  234. let startTime = e[0].getTime()
  235. let endTime = e[1].getTime()
  236. this.time1 = [startTime, endTime]
  237. this.getStateList(parseInt(startTime / 1000), parseInt(endTime / 1000));
  238. },
  239. chartFun(obj){
  240. // console.log(obj);
  241. option = {
  242. title: {
  243. text: ''
  244. },
  245. tooltip: {
  246. trigger: 'axis'
  247. },
  248. legend: {
  249. bottom: "0%",
  250. left:"4%",
  251. itemGap : 60,
  252. // data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
  253. data: obj.items
  254. },
  255. grid: {
  256. left: '3%',
  257. right: '4%',
  258. bottom: '8%',
  259. containLabel: true
  260. },
  261. xAxis: {
  262. type: 'category',
  263. boundaryGap: false,
  264. //设置x轴线的属性
  265. axisLine:{
  266. lineStyle:{
  267. color:'#BFBFBF',
  268. width:1,//这里是为了突出显示加上的
  269. }
  270. },
  271. data: obj.dates
  272. },
  273. yAxis: {
  274. type: 'value',
  275. splitLine: { // 设置y轴网格的属性
  276. show: true,
  277. interval: 3,
  278. lineStyle: {
  279. color: '#F3F3F3'
  280. }
  281. },
  282. axisLine:{ // 去掉y轴
  283. show:false
  284. },
  285. axisTick:{ // 去掉刻度线
  286. show:false
  287. },
  288. },
  289. series: obj.series
  290. };
  291. // 使用刚指定的配置项和数据显示图表。
  292. myChart.setOption(option)
  293. setTimeout(function (){
  294. window.onresize = function () {
  295. myChart.resize();
  296. }
  297. },200)
  298. // window.addEventListener("resize", function() {
  299. // var size = (window.innerWidth || document.documentElement.clientWidth) / 1920 * 100;
  300. // document.documentElement.style.fontSize = size + "px";
  301. // document.body.style.fontSize = "14px";
  302. // myChart.resize();
  303. // });
  304. },
  305. }
  306. })
  307. </script>
  308. <style>
  309. /* 卡片1 */
  310. .el-card__header{
  311. background: #fff;
  312. border-bottom: 0;
  313. }
  314. .titles {
  315. font-size: 17px;
  316. font-weight: 700;
  317. }
  318. /* */
  319. .header-item {
  320. background-color: #fff;
  321. margin-top: 10px;
  322. padding: 30px 0;
  323. border-radius: 5px;
  324. box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
  325. }
  326. .items {
  327. width: 25%;
  328. }
  329. .items>div {
  330. text-align: center;
  331. }
  332. .items>div:nth-child(1) {
  333. font-size: 28px;
  334. font-weight: 700;
  335. padding-bottom: 8px;
  336. font-family: '宋体';
  337. }
  338. .items>div:nth-child(2) {
  339. font-size: 12px;
  340. }
  341. /* 数据概况 */
  342. .el-date-editor .el-range-separator {
  343. width: 6%;
  344. }
  345. .profile {
  346. background: #fff;
  347. margin: 10px 0;
  348. border-radius: 5px;
  349. box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
  350. }
  351. .profile-header {
  352. align-items: center;
  353. padding: 20px;
  354. }
  355. .cardHead{
  356. display: flex;
  357. align-items: center;
  358. justify-content: space-between;
  359. flex-wrap: wrap;
  360. }
  361. .cardContent{
  362. margin-top: 20px;
  363. display: flex;
  364. flex-wrap: wrap;
  365. }
  366. .cardContent .item{
  367. display: flex;
  368. align-items: center;
  369. margin: 30px;
  370. }
  371. .cardHeadLeft{
  372. margin-bottom: 10px;
  373. }
  374. .myTable {
  375. min-height: 500px;
  376. }
  377. /* 公共样式 */
  378. .flex-row {
  379. display: -webkit-box;
  380. display: -webkit-flex;
  381. /* #ifndef APP-NVUE */
  382. display: flex;
  383. /* #endif */
  384. -webkit-box-orient: horizontal;
  385. -webkit-flex-direction: row;
  386. flex-direction: row;
  387. }
  388. .flex-col {
  389. display: -webkit-box;
  390. display: -webkit-flex;
  391. /* #ifndef APP-NVUE */
  392. display: flex;
  393. /* #endif */
  394. -webkit-box-orient: vertical;
  395. -webkit-flex-direction: column;
  396. flex-direction: column;
  397. }
  398. .flex-grow-0 {
  399. min-width: 0;
  400. -webkit-box-flex: 0;
  401. -webkit-flex-grow: 0;
  402. -ms-flex-positive: 0;
  403. flex-grow: 0;
  404. -webkit-flex-shrink: 0;
  405. -ms-flex-negative: 0;
  406. flex-shrink: 0;
  407. }
  408. .flex-grow-1 {
  409. min-width: 0;
  410. -webkit-box-flex: 1;
  411. -webkit-flex-grow: 1;
  412. -ms-flex-positive: 1;
  413. flex-grow: 1;
  414. -webkit-flex-shrink: 1;
  415. -ms-flex-negative: 1;
  416. flex-shrink: 1;
  417. }
  418. .flex-x-center {
  419. display: -webkit-box;
  420. display: -webkit-flex;
  421. display: flex;
  422. -webkit-box-pack: center;
  423. -webkit-justify-content: center;
  424. -ms-flex-pack: center;
  425. justify-content: center;
  426. }
  427. .flex-x-between {
  428. display: -webkit-box;
  429. display: -webkit-flex;
  430. display: flex;
  431. -webkit-box-pack: space-between;
  432. -webkit-justify-content: space-between;
  433. -ms-flex-pack: space-between;
  434. justify-content: space-between;
  435. }
  436. .flex-x-bottom {
  437. display: -webkit-box;
  438. display: -webkit-flex;
  439. display: flex;
  440. -webkit-box-pack: end;
  441. -webkit-justify-content: flex-end;
  442. justify-content: flex-end;
  443. }
  444. .flex-y-center {
  445. display: -webkit-box;
  446. display: -webkit-flex;
  447. display: flex;
  448. -webkit-box-align: center;
  449. -webkit-align-items: center;
  450. -ms-flex-align: center;
  451. -ms-grid-row-align: center;
  452. align-items: center;
  453. }
  454. .flex-y-bottom {
  455. display: -webkit-box;
  456. display: -webkit-flex;
  457. display: flex;
  458. -webkit-box-align: end;
  459. -webkit-align-items: flex-end;
  460. -ms-flex-align: end;
  461. -ms-grid-row-align: flex-end;
  462. align-items: flex-end;
  463. }
  464. .flex-1 {
  465. display: -webkit-box;
  466. display: -webkit-flex;
  467. display: flex;
  468. flex: 1;
  469. }
  470. </style>