main.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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">{$fertilizer}</h1>
  98. <small><a href="javascript:;" class="opFrames" data-name="会员管理" data-href="{:Url('user.user/index')}">剩余肥料</a></small>
  99. </div>
  100. </div>
  101. </div>
  102. <div class="col-sm-3 ui-sortable">
  103. <div class="ibox float-e-margins">
  104. <div class="ibox-title">
  105. <span class="label label-info pull-right">总</span>
  106. <h5>阳光</h5>
  107. </div>
  108. <div class="ibox-content">
  109. <h1 class="no-margins">{$integral}</h1>
  110. <small><a href="javascript:;" class="opFrames" data-name="会员管理" data-href="{:Url('user.user/index')}">剩余阳光</a></small>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. <div id="app">
  116. <div class="row">
  117. <div class="col-lg-12">
  118. <div class="ibox float-e-margins">
  119. <div class="ibox-title">
  120. <h5>订单</h5>
  121. <div class="pull-right">
  122. <div class="btn-group">
  123. <button type="button" class="btn btn-xs btn-white" :class="{'active': active == 'thirtyday'}" v-on:click="getlist('thirtyday')">30天</button>
  124. <button type="button" class="btn btn-xs btn-white" :class="{'active': active == 'week'}" v-on:click="getlist('week')">周</button>
  125. <button type="button" class="btn btn-xs btn-white" :class="{'active': active == 'month'}" v-on:click="getlist('month')">月</button>
  126. <button type="button" class="btn btn-xs btn-white" :class="{'active': active == 'year'}" v-on:click="getlist('year')">年</button>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="ibox-content">
  131. <div class="row">
  132. <div class="col-lg-9">
  133. <div class="flot-chart-content echarts" ref="order_echart" id="flot-dashboard-chart1"></div>
  134. </div>
  135. <div class="col-lg-3">
  136. <ul class="stat-list">
  137. <li>
  138. <h2 class="no-margins ">{{pre_cycleprice}}</h2>
  139. <small>{{precyclename}}销售额</small>
  140. </li>
  141. <li>
  142. <h2 class="no-margins ">{{cycleprice}}</h2>
  143. <small>{{cyclename}}销售额</small>
  144. <div class="stat-percent text-navy" v-if='cycleprice_is_plus ===1'>
  145. {{cycleprice_percent}}%
  146. <i class="fa fa-level-up"></i>
  147. </div>
  148. <div class="stat-percent text-danger" v-else-if='cycleprice_is_plus === -1'>
  149. {{cycleprice_percent}}%
  150. <i class="fa fa-level-down"></i>
  151. </div>
  152. <div class="stat-percent" v-else>
  153. {{cycleprice_percent}}%
  154. </div>
  155. <div class="progress progress-mini">
  156. <div :style="{width:cycleprice_percent+'%'}" class="progress-bar box"></div>
  157. </div>
  158. </li>
  159. <li>
  160. <h2 class="no-margins ">{{pre_cyclecount}}</h2>
  161. <small>{{precyclename}}订单总数</small>
  162. </li>
  163. <li>
  164. <h2 class="no-margins">{{cyclecount}}</h2>
  165. <small>{{cyclename}}订单总数</small>
  166. <div class="stat-percent text-navy" v-if='cyclecount_is_plus ===1'>
  167. {{cyclecount_percent}}%
  168. <i class="fa fa-level-up"></i>
  169. </div>
  170. <div class="stat-percent text-danger" v-else-if='cyclecount_is_plus === -1'>
  171. {{cyclecount_percent}}%
  172. <i class="fa fa-level-down"></i>
  173. </div>
  174. <div class="stat-percent " v-else>
  175. {{cyclecount_percent}}%
  176. </div>
  177. <div class="progress progress-mini">
  178. <div :style="{width:cyclecount_percent+'%'}" class="progress-bar box"></div>
  179. </div>
  180. </li>
  181. </ul>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. <div class="row" >
  189. <div class="col-lg-12">
  190. <div class="ibox float-e-margins">
  191. <div class="ibox-title">
  192. <h5>用户</h5>
  193. </div>
  194. <div class="ibox-content">
  195. <div class="row">
  196. <div class="col-lg-12">
  197. <div class="flot-chart">
  198. <div class="flot-chart-content" ref="user_echart" id="flot-dashboard-chart2"></div>
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. {/block}
  208. {block name="script"}
  209. <style scoped>
  210. .box{width:0px;}
  211. </style>
  212. <script>
  213. require(['vue','axios','layer'],function(Vue,axios,layer){
  214. new Vue({
  215. el:"#app",
  216. data:{
  217. option:{},
  218. myChart:{},
  219. active:'thirtyday',
  220. cyclename:'最近30天',
  221. precyclename:'上个30天',
  222. cyclecount:0,
  223. cycleprice:0,
  224. cyclecount_percent:0,
  225. cycleprice_percent:0,
  226. cyclecount_is_plus:0,
  227. cycleprice_is_plus:0,
  228. pre_cyclecount:0,
  229. pre_cycleprice:0
  230. },
  231. methods:{
  232. info:function () {
  233. var that=this;
  234. axios.get("{:Url('userchart')}").then((res)=>{
  235. that.myChart.user_echart.setOption(that.userchartsetoption(res.data.data));
  236. });
  237. },
  238. getlist:function (e) {
  239. var that=this;
  240. var cycle = e!=null ? e :'thirtyday';
  241. axios.get("{:Url('orderchart')}?cycle="+cycle).then((res)=>{
  242. that.myChart.order_echart.clear();
  243. that.myChart.order_echart.setOption(that.orderchartsetoption(res.data.data));
  244. that.active = cycle;
  245. switch (cycle){
  246. case 'thirtyday':
  247. that.cyclename = '最近30天';
  248. that.precyclename = '上个30天';
  249. break;
  250. case 'week':
  251. that.precyclename = '上周';
  252. that.cyclename = '本周';
  253. break;
  254. case 'month':
  255. that.precyclename = '上月';
  256. that.cyclename = '本月';
  257. break;
  258. case 'year':
  259. that.cyclename = '去年';
  260. that.precyclename = '今年';
  261. break;
  262. default:
  263. break;
  264. }
  265. var data=res.data.data;
  266. if(data) {
  267. that.cyclecount = data.cycle.count.data;
  268. that.cyclecount_percent = data.cycle.count.percent;
  269. that.cyclecount_is_plus = data.cycle.count.is_plus;
  270. that.cycleprice = data.cycle.price.data;
  271. that.cycleprice_percent = data.cycle.price.percent;
  272. that.cycleprice_is_plus = data.cycle.price.is_plus;
  273. that.pre_cyclecount = data.pre_cycle.count.data;
  274. that.pre_cycleprice = data.pre_cycle.price.data;
  275. }
  276. });
  277. },
  278. orderchartsetoption:function(data){
  279. data = data == undefined ? {} : data;
  280. this.option = {
  281. tooltip: {
  282. trigger: 'axis',
  283. axisPointer: {
  284. type: 'cross',
  285. crossStyle: {
  286. color: '#999'
  287. }
  288. }
  289. },
  290. toolbox: {
  291. feature: {
  292. dataView: {show: true, readOnly: false},
  293. magicType: {show: true, type: ['line', 'bar']},
  294. restore: {show: false},
  295. saveAsImage: {show: true}
  296. }
  297. },
  298. legend: {
  299. data: data.legend || []
  300. },
  301. grid: {
  302. x: 70,
  303. x2: 50,
  304. y: 60,
  305. y2: 50
  306. },
  307. xAxis: [
  308. {
  309. type: 'category',
  310. data: data.xAxis,
  311. axisPointer: {
  312. type: 'shadow'
  313. },
  314. axisLabel:{
  315. interval: 0,
  316. rotate:40
  317. }
  318. }
  319. ],
  320. yAxis:[{type : 'value'}],
  321. // yAxis: [
  322. // {
  323. // type: 'value',
  324. // name: '',
  325. // min: 0,
  326. // max: data.yAxis.maxprice,
  327. //// interval: 0,
  328. // axisLabel: {
  329. // formatter: '{value} 元'
  330. // }
  331. // },
  332. // {
  333. // type: 'value',
  334. // name: '',
  335. // min: 0,
  336. // max: data.yAxis.maxnum,
  337. // interval: 5,
  338. // axisLabel: {
  339. // formatter: '{value} 个'
  340. // }
  341. // }
  342. // ],
  343. series: data.series
  344. };
  345. return this.option;
  346. },
  347. userchartsetoption:function(data){
  348. this.option = {
  349. tooltip: {
  350. trigger: 'axis',
  351. axisPointer: {
  352. type: 'cross',
  353. crossStyle: {
  354. color: '#999'
  355. }
  356. }
  357. },
  358. toolbox: {
  359. feature: {
  360. dataView: {show: false, readOnly: false},
  361. magicType: {show: true, type: ['line', 'bar']},
  362. restore: {show: false},
  363. saveAsImage: {show: false}
  364. }
  365. },
  366. legend: {
  367. data:data.legend
  368. },
  369. grid: {
  370. x: 70,
  371. x2: 50,
  372. y: 60,
  373. y2: 50
  374. },
  375. xAxis: [
  376. {
  377. type: 'category',
  378. data: data.xAxis,
  379. axisPointer: {
  380. type: 'shadow'
  381. }
  382. }
  383. ],
  384. yAxis: [
  385. {
  386. type: 'value',
  387. name: '人数',
  388. min: 0,
  389. max: data.yAxis.maxnum,
  390. interval: 5,
  391. axisLabel: {
  392. formatter: '{value} 人'
  393. }
  394. }
  395. ],
  396. // series: data.series
  397. series : [ {
  398. name : '人数',
  399. type : 'bar',
  400. barWidth : '50%',
  401. itemStyle: {
  402. normal: {
  403. label: {
  404. show: true, //开启显示
  405. position: 'top', //在上方显示
  406. textStyle: { //数值样式
  407. color: '#666',
  408. fontSize: 12
  409. }
  410. }
  411. }
  412. },
  413. data : data.series
  414. } ]
  415. };
  416. return this.option;
  417. },
  418. setChart:function(name,myChartname){
  419. this.myChart[myChartname] = echarts.init(name,'macarons');//初始化echart
  420. }
  421. },
  422. mounted:function () {
  423. const self = this;
  424. this.setChart(self.$refs.order_echart,'order_echart');//订单图表
  425. this.setChart(self.$refs.user_echart,'user_echart');//用户图表
  426. this.info();
  427. this.getlist();
  428. $('.opFrames').on('click',function () {
  429. parent.addframes($(this).data('href'),'',$(this).data('name'));
  430. });
  431. }
  432. });
  433. });
  434. </script>
  435. {/block}