main.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <!-- 全局js -->
  4. <script src="{__PLUG_PATH}echarts/echarts.common.min.js"></script>
  5. <script src="{__PLUG_PATH}echarts/theme/macarons.js"></script>
  6. <script src="{__PLUG_PATH}echarts/theme/westeros.js"></script>
  7. {/block}
  8. {block name="content"}
  9. <div class="row">
  10. <div class="col-sm-3 ui-sortable">
  11. <div class="ibox float-e-margins">
  12. <div class="ibox-title">
  13. <span class="label label-danger pull-right">急</span>
  14. <h5>订单</h5>
  15. </div>
  16. <div class="ibox-content">
  17. <h1 class="no-margins">{$topData.orderDeliveryNum}</h1>
  18. <small><a href="javascript:;" class="opFrames" data-name="订单管理" data-href="{:Url('order.store_order/index',['status'=>1])}">待发货</a> </small>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="col-sm-3 ui-sortable">
  23. <div class="ibox float-e-margins">
  24. <div class="ibox-title">
  25. <span class="label label-info pull-right">待</span>
  26. <h5>订单</h5>
  27. </div>
  28. <div class="ibox-content">
  29. <h1 class="no-margins">{$topData.orderRefundNum}</h1>
  30. <small><a href="javascript:;" class="opFrames" data-name="订单管理" data-href="{:Url('order.store_order/index',['status'=>-1])}">退换货</a></small>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="col-sm-3 ui-sortable" >
  35. <div class="ibox float-e-margins">
  36. <div class="ibox-title">
  37. <span class="label label-danger pull-right">急</span>
  38. <h5>商品</h5>
  39. </div>
  40. <div class="ibox-content">
  41. <h1 class="no-margins">{$topData.stockProduct}</h1>
  42. <small><a href="javascript:;" class="opFrames" data-name="商品管理" data-href="{:Url('store.store_product/index',array('type'=>5))}">库存预警</a></small>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="col-sm-3 ui-sortable">
  47. <div class="ibox float-e-margins">
  48. <div class="ibox-title">
  49. <span class="label label-danger pull-right">待</span>
  50. <h5>待提现</h5>
  51. </div>
  52. <div class="ibox-content">
  53. <h1 class="no-margins">{$topData.treatedExtract}</h1>
  54. <small><a href="javascript:;" class="opFrames" data-name="提现盛情" data-href="{:Url('finance.user_extract/index')}">待提现</a></small>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="col-sm-3 ui-sortable">
  59. <div class="ibox float-e-margins">
  60. <div class="ibox-title">
  61. <span class="label label-info pull-right">昨</span>
  62. <h5>订单</h5>
  63. </div>
  64. <div class="ibox-content">
  65. <h1 class="no-margins">{$first_line.d_num.data}</h1>
  66. <div class="stat-percent font-bold text-navy">
  67. {$first_line.d_num.percent}%
  68. {if condition='$first_line.d_num.is_plus egt 0'}<i class="fa {if condition='$first_line.d_num.is_plus eq 1'}fa-level-up{else /}fa-level-down{/if}"></i>{/if}
  69. </div>
  70. <small><a href="javascript:;" class="opFrames" data-name="订单管理" data-href="{:Url('order.store_order/index')}?data=yesterday">昨日支付订单数</a></small>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="col-sm-3 ui-sortable">
  75. <div class="ibox float-e-margins">
  76. <div class="ibox-title">
  77. <span class="label label-info pull-right">昨</span>
  78. <h5>交易</h5>
  79. </div>
  80. <div class="ibox-content">
  81. <h1 class="no-margins">{$first_line.d_price.data}</h1>
  82. <div class="stat-percent font-bold text-info">
  83. {$first_line.d_price.percent}%
  84. {if condition='$first_line.d_price.is_plus egt 0'}<i class="fa {if condition='$first_line.d_price.is_plus eq 1'}fa-level-up{else /}fa-level-down{/if}"></i>{/if}
  85. </div>
  86. <small><a href="javascript:;" class="opFrames" data-name="订单管理" data-href="{:Url('order.store_order/index')}?data=yesterday">昨日交易额</a></small>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="col-sm-3 ui-sortable">
  91. <div class="ibox float-e-margins">
  92. <div class="ibox-title">
  93. <span class="label label-info pull-right">今</span>
  94. <h5>粉丝</h5>
  95. </div>
  96. <div class="ibox-content">
  97. <h1 class="no-margins">{$first_line.day.data}</h1>
  98. <div class="stat-percent font-bold text-info">
  99. {$first_line.day.percent}%
  100. {if condition='$first_line.day.is_plus egt 0'}<i class="fa {if condition='$first_line.day.is_plus eq 1'}fa-level-up{else /}fa-level-down{/if}"></i>{/if}
  101. </div>
  102. <small><a href="javascript:;" class="opFrames" data-name="会员管理" data-href="{:Url('user.user/index')}">今日新增粉丝</a></small>
  103. </div>
  104. </div>
  105. </div>
  106. <div class="col-sm-3 ui-sortable">
  107. <div class="ibox float-e-margins">
  108. <div class="ibox-title">
  109. <span class="label label-info pull-right">月</span>
  110. <h5>粉丝</h5>
  111. </div>
  112. <div class="ibox-content">
  113. <h1 class="no-margins">{$first_line.month.data}</h1>
  114. <div class="stat-percent font-bold text-info">
  115. {$first_line.month.percent}%
  116. {if condition='$first_line.month.is_plus egt 0'}<i class="fa {if condition='$first_line.month.is_plus eq 1'}fa-level-up{else /}fa-level-down{/if}"></i>{/if}
  117. </div>
  118. <small><a href="javascript:;" class="opFrames" data-name="会员管理" data-href="{:Url('user.user/index')}">本月新增粉丝</a></small>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. <div id="app">
  124. <div class="row">
  125. <div class="col-lg-12">
  126. <div class="ibox float-e-margins">
  127. <div class="ibox-title">
  128. <h5>订单</h5>
  129. <div class="pull-right">
  130. <div class="btn-group">
  131. <button type="button" class="btn btn-xs btn-white" :class="{'active': active == 'thirtyday'}" v-on:click="getlist('thirtyday')">30天</button>
  132. <button type="button" class="btn btn-xs btn-white" :class="{'active': active == 'week'}" v-on:click="getlist('week')">周</button>
  133. <button type="button" class="btn btn-xs btn-white" :class="{'active': active == 'month'}" v-on:click="getlist('month')">月</button>
  134. <button type="button" class="btn btn-xs btn-white" :class="{'active': active == 'year'}" v-on:click="getlist('year')">年</button>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="ibox-content">
  139. <div class="row">
  140. <div class="col-lg-9">
  141. <div class="flot-chart-content echarts" ref="order_echart" id="flot-dashboard-chart1"></div>
  142. </div>
  143. <div class="col-lg-3">
  144. <ul class="stat-list">
  145. <li>
  146. <h2 class="no-margins ">{{pre_cycleprice}}</h2>
  147. <small>{{precyclename}}销售额</small>
  148. </li>
  149. <li>
  150. <h2 class="no-margins ">{{cycleprice}}</h2>
  151. <small>{{cyclename}}销售额</small>
  152. <div class="stat-percent text-navy" v-if='cycleprice_is_plus ===1'>
  153. {{cycleprice_percent}}%
  154. <i class="fa fa-level-up"></i>
  155. </div>
  156. <div class="stat-percent text-danger" v-else-if='cycleprice_is_plus === -1'>
  157. {{cycleprice_percent}}%
  158. <i class="fa fa-level-down"></i>
  159. </div>
  160. <div class="stat-percent" v-else>
  161. {{cycleprice_percent}}%
  162. </div>
  163. <div class="progress progress-mini">
  164. <div :style="{width:cycleprice_percent+'%'}" class="progress-bar box"></div>
  165. </div>
  166. </li>
  167. <li>
  168. <h2 class="no-margins ">{{pre_cyclecount}}</h2>
  169. <small>{{precyclename}}订单总数</small>
  170. </li>
  171. <li>
  172. <h2 class="no-margins">{{cyclecount}}</h2>
  173. <small>{{cyclename}}订单总数</small>
  174. <div class="stat-percent text-navy" v-if='cyclecount_is_plus ===1'>
  175. {{cyclecount_percent}}%
  176. <i class="fa fa-level-up"></i>
  177. </div>
  178. <div class="stat-percent text-danger" v-else-if='cyclecount_is_plus === -1'>
  179. {{cyclecount_percent}}%
  180. <i class="fa fa-level-down"></i>
  181. </div>
  182. <div class="stat-percent " v-else>
  183. {{cyclecount_percent}}%
  184. </div>
  185. <div class="progress progress-mini">
  186. <div :style="{width:cyclecount_percent+'%'}" class="progress-bar box"></div>
  187. </div>
  188. </li>
  189. </ul>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. <div class="row" >
  197. <div class="col-lg-12">
  198. <div class="ibox float-e-margins">
  199. <div class="ibox-title">
  200. <h5>用户</h5>
  201. </div>
  202. <div class="ibox-content">
  203. <div class="row">
  204. <div class="col-lg-12">
  205. <div class="flot-chart">
  206. <div class="flot-chart-content" ref="user_echart" id="flot-dashboard-chart2"></div>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. {/block}
  216. {block name="script"}
  217. <style scoped>
  218. .box{width:0px;}
  219. </style>
  220. <script>
  221. require(['vue','axios','layer'],function(Vue,axios,layer){
  222. new Vue({
  223. el:"#app",
  224. data:{
  225. option:{},
  226. myChart:{},
  227. active:'thirtyday',
  228. cyclename:'最近30天',
  229. precyclename:'上个30天',
  230. cyclecount:0,
  231. cycleprice:0,
  232. cyclecount_percent:0,
  233. cycleprice_percent:0,
  234. cyclecount_is_plus:0,
  235. cycleprice_is_plus:0,
  236. pre_cyclecount:0,
  237. pre_cycleprice:0
  238. },
  239. methods:{
  240. info:function () {
  241. var that=this;
  242. axios.get("{:Url('userchart')}").then((res)=>{
  243. that.myChart.user_echart.setOption(that.userchartsetoption(res.data.data));
  244. });
  245. },
  246. getlist:function (e) {
  247. var that=this;
  248. var cycle = e!=null ? e :'thirtyday';
  249. axios.get("{:Url('orderchart')}?cycle="+cycle).then((res)=>{
  250. that.myChart.order_echart.clear();
  251. that.myChart.order_echart.setOption(that.orderchartsetoption(res.data.data));
  252. that.active = cycle;
  253. switch (cycle){
  254. case 'thirtyday':
  255. that.cyclename = '最近30天';
  256. that.precyclename = '上个30天';
  257. break;
  258. case 'week':
  259. that.precyclename = '上周';
  260. that.cyclename = '本周';
  261. break;
  262. case 'month':
  263. that.precyclename = '上月';
  264. that.cyclename = '本月';
  265. break;
  266. case 'year':
  267. that.cyclename = '去年';
  268. that.precyclename = '今年';
  269. break;
  270. default:
  271. break;
  272. }
  273. var data=res.data.data;
  274. if(data) {
  275. that.cyclecount = data.cycle.count.data;
  276. that.cyclecount_percent = data.cycle.count.percent;
  277. that.cyclecount_is_plus = data.cycle.count.is_plus;
  278. that.cycleprice = data.cycle.price.data;
  279. that.cycleprice_percent = data.cycle.price.percent;
  280. that.cycleprice_is_plus = data.cycle.price.is_plus;
  281. that.pre_cyclecount = data.pre_cycle.count.data;
  282. that.pre_cycleprice = data.pre_cycle.price.data;
  283. }
  284. });
  285. },
  286. orderchartsetoption:function(data){
  287. data = data == undefined ? {} : data;
  288. this.option = {
  289. tooltip: {
  290. trigger: 'axis',
  291. axisPointer: {
  292. type: 'cross',
  293. crossStyle: {
  294. color: '#999'
  295. }
  296. }
  297. },
  298. toolbox: {
  299. feature: {
  300. dataView: {show: true, readOnly: false},
  301. magicType: {show: true, type: ['line', 'bar']},
  302. restore: {show: false},
  303. saveAsImage: {show: true}
  304. }
  305. },
  306. legend: {
  307. data: data.legend || []
  308. },
  309. grid: {
  310. x: 70,
  311. x2: 50,
  312. y: 60,
  313. y2: 50
  314. },
  315. xAxis: [
  316. {
  317. type: 'category',
  318. data: data.xAxis,
  319. axisPointer: {
  320. type: 'shadow'
  321. },
  322. axisLabel:{
  323. interval: 0,
  324. rotate:40
  325. }
  326. }
  327. ],
  328. yAxis:[{type : 'value'}],
  329. // yAxis: [
  330. // {
  331. // type: 'value',
  332. // name: '',
  333. // min: 0,
  334. // max: data.yAxis.maxprice,
  335. //// interval: 0,
  336. // axisLabel: {
  337. // formatter: '{value} 元'
  338. // }
  339. // },
  340. // {
  341. // type: 'value',
  342. // name: '',
  343. // min: 0,
  344. // max: data.yAxis.maxnum,
  345. // interval: 5,
  346. // axisLabel: {
  347. // formatter: '{value} 个'
  348. // }
  349. // }
  350. // ],
  351. series: data.series
  352. };
  353. return this.option;
  354. },
  355. userchartsetoption:function(data){
  356. this.option = {
  357. tooltip: {
  358. trigger: 'axis',
  359. axisPointer: {
  360. type: 'cross',
  361. crossStyle: {
  362. color: '#999'
  363. }
  364. }
  365. },
  366. toolbox: {
  367. feature: {
  368. dataView: {show: false, readOnly: false},
  369. magicType: {show: true, type: ['line', 'bar']},
  370. restore: {show: false},
  371. saveAsImage: {show: false}
  372. }
  373. },
  374. legend: {
  375. data:data.legend
  376. },
  377. grid: {
  378. x: 70,
  379. x2: 50,
  380. y: 60,
  381. y2: 50
  382. },
  383. xAxis: [
  384. {
  385. type: 'category',
  386. data: data.xAxis,
  387. axisPointer: {
  388. type: 'shadow'
  389. }
  390. }
  391. ],
  392. yAxis: [
  393. {
  394. type: 'value',
  395. name: '人数',
  396. min: 0,
  397. max: data.yAxis.maxnum,
  398. interval: 5,
  399. axisLabel: {
  400. formatter: '{value} 人'
  401. }
  402. }
  403. ],
  404. // series: data.series
  405. series : [ {
  406. name : '人数',
  407. type : 'bar',
  408. barWidth : '50%',
  409. itemStyle: {
  410. normal: {
  411. label: {
  412. show: true, //开启显示
  413. position: 'top', //在上方显示
  414. textStyle: { //数值样式
  415. color: '#666',
  416. fontSize: 12
  417. }
  418. }
  419. }
  420. },
  421. data : data.series
  422. } ]
  423. };
  424. return this.option;
  425. },
  426. setChart:function(name,myChartname){
  427. this.myChart[myChartname] = echarts.init(name,'macarons');//初始化echart
  428. }
  429. },
  430. mounted:function () {
  431. const self = this;
  432. this.setChart(self.$refs.order_echart,'order_echart');//订单图表
  433. this.setChart(self.$refs.user_echart,'user_echart');//用户图表
  434. this.info();
  435. this.getlist();
  436. $('.opFrames').on('click',function () {
  437. parent.addframes($(this).data('href'),'',$(this).data('name'));
  438. });
  439. }
  440. });
  441. });
  442. </script>
  443. {/block}