main.php 22 KB

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