main.php 22 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. <!---->
  190. <!---->
  191. <!-- </ul>-->
  192. <!-- </div>-->
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <div class="row" >
  199. <div class="col-lg-12">
  200. <div class="ibox float-e-margins">
  201. <div class="ibox-title">
  202. <h5>用户</h5>
  203. </div>
  204. <div class="ibox-content">
  205. <div class="row">
  206. <div class="col-lg-12">
  207. <div class="flot-chart">
  208. <div class="flot-chart-content" ref="user_echart" id="flot-dashboard-chart2"></div>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. {/block}
  218. {block name="script"}
  219. <style scoped>
  220. .box{width:0px;}
  221. </style>
  222. <script>
  223. require(['vue','axios','layer'],function(Vue,axios,layer){
  224. new Vue({
  225. el:"#app",
  226. data:{
  227. option:{},
  228. myChart:{},
  229. active:'thirtyday',
  230. cyclename:'最近30天',
  231. precyclename:'上个30天',
  232. cyclecount:0,
  233. cycleprice:0,
  234. cyclecount_percent:0,
  235. cycleprice_percent:0,
  236. cyclecount_is_plus:0,
  237. cycleprice_is_plus:0,
  238. pre_cyclecount:0,
  239. pre_cycleprice:0
  240. },
  241. methods:{
  242. info:function () {
  243. var that=this;
  244. axios.get("{:Url('userchart')}").then((res)=>{
  245. that.myChart.user_echart.setOption(that.userchartsetoption(res.data.data));
  246. });
  247. },
  248. getlist:function (e) {
  249. var that=this;
  250. var cycle = e!=null ? e :'thirtyday';
  251. axios.get("{:Url('orderchart')}?cycle="+cycle).then((res)=>{
  252. that.myChart.order_echart.clear();
  253. that.myChart.order_echart.setOption(that.orderchartsetoption(res.data.data));
  254. that.active = cycle;
  255. switch (cycle){
  256. case 'thirtyday':
  257. that.cyclename = '最近30天';
  258. that.precyclename = '上个30天';
  259. break;
  260. case 'week':
  261. that.precyclename = '上周';
  262. that.cyclename = '本周';
  263. break;
  264. case 'month':
  265. that.precyclename = '上月';
  266. that.cyclename = '本月';
  267. break;
  268. case 'year':
  269. that.cyclename = '去年';
  270. that.precyclename = '今年';
  271. break;
  272. default:
  273. break;
  274. }
  275. var data=res.data.data;
  276. if(data) {
  277. that.cyclecount = data.cycle.count.data;
  278. that.cyclecount_percent = data.cycle.count.percent;
  279. that.cyclecount_is_plus = data.cycle.count.is_plus;
  280. that.cycleprice = data.cycle.price.data;
  281. that.cycleprice_percent = data.cycle.price.percent;
  282. that.cycleprice_is_plus = data.cycle.price.is_plus;
  283. that.pre_cyclecount = data.pre_cycle.count.data;
  284. that.pre_cycleprice = data.pre_cycle.price.data;
  285. }
  286. });
  287. },
  288. orderchartsetoption:function(data){
  289. data = data == undefined ? {} : data;
  290. this.option = {
  291. tooltip: {
  292. trigger: 'axis',
  293. axisPointer: {
  294. type: 'cross',
  295. crossStyle: {
  296. color: '#999'
  297. }
  298. }
  299. },
  300. toolbox: {
  301. feature: {
  302. dataView: {show: true, readOnly: false},
  303. magicType: {show: true, type: ['line', 'bar']},
  304. restore: {show: false},
  305. saveAsImage: {show: true}
  306. }
  307. },
  308. legend: {
  309. data: data.legend || []
  310. },
  311. grid: {
  312. x: 70,
  313. x2: 50,
  314. y: 60,
  315. y2: 50
  316. },
  317. xAxis: [
  318. {
  319. type: 'category',
  320. data: data.xAxis,
  321. axisPointer: {
  322. type: 'shadow'
  323. },
  324. axisLabel:{
  325. interval: 0,
  326. rotate:40
  327. }
  328. }
  329. ],
  330. yAxis:[{type : 'value'}],
  331. // yAxis: [
  332. // {
  333. // type: 'value',
  334. // name: '',
  335. // min: 0,
  336. // max: data.yAxis.maxprice,
  337. //// interval: 0,
  338. // axisLabel: {
  339. // formatter: '{value} 元'
  340. // }
  341. // },
  342. // {
  343. // type: 'value',
  344. // name: '',
  345. // min: 0,
  346. // max: data.yAxis.maxnum,
  347. // interval: 5,
  348. // axisLabel: {
  349. // formatter: '{value} 个'
  350. // }
  351. // }
  352. // ],
  353. series: data.series
  354. };
  355. return this.option;
  356. },
  357. userchartsetoption:function(data){
  358. this.option = {
  359. tooltip: {
  360. trigger: 'axis',
  361. axisPointer: {
  362. type: 'cross',
  363. crossStyle: {
  364. color: '#999'
  365. }
  366. }
  367. },
  368. toolbox: {
  369. feature: {
  370. dataView: {show: false, readOnly: false},
  371. magicType: {show: true, type: ['line', 'bar']},
  372. restore: {show: false},
  373. saveAsImage: {show: false}
  374. }
  375. },
  376. legend: {
  377. data:data.legend
  378. },
  379. grid: {
  380. x: 70,
  381. x2: 50,
  382. y: 60,
  383. y2: 50
  384. },
  385. xAxis: [
  386. {
  387. type: 'category',
  388. data: data.xAxis,
  389. axisPointer: {
  390. type: 'shadow'
  391. }
  392. }
  393. ],
  394. yAxis: [
  395. {
  396. type: 'value',
  397. name: '人数',
  398. min: 0,
  399. max: data.yAxis.maxnum,
  400. interval: 5,
  401. axisLabel: {
  402. formatter: '{value} 人'
  403. }
  404. }
  405. ],
  406. // series: data.series
  407. series : [ {
  408. name : '人数',
  409. type : 'bar',
  410. barWidth : '50%',
  411. itemStyle: {
  412. normal: {
  413. label: {
  414. show: true, //开启显示
  415. position: 'top', //在上方显示
  416. textStyle: { //数值样式
  417. color: '#666',
  418. fontSize: 12
  419. }
  420. }
  421. }
  422. },
  423. data : data.series
  424. } ]
  425. };
  426. return this.option;
  427. },
  428. setChart:function(name,myChartname){
  429. this.myChart[myChartname] = echarts.init(name,'macarons');//初始化echart
  430. }
  431. },
  432. mounted:function () {
  433. const self = this;
  434. this.setChart(self.$refs.order_echart,'order_echart');//订单图表
  435. this.setChart(self.$refs.user_echart,'user_echart');//用户图表
  436. this.info();
  437. this.getlist();
  438. $('.opFrames').on('click',function () {
  439. parent.addframes($(this).data('href'),'',$(this).data('name'));
  440. });
  441. }
  442. });
  443. });
  444. </script>
  445. {/block}