index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. {extend name="app/shop/view/base.html"/}
  2. {block name="resources"}
  3. <style>
  4. /* 总样式 */
  5. .summary-wrap { display: flex}
  6. .body-content {background: none !important;padding: 0 !important;margin: 0 !important;}
  7. .summary-wrap .common-wrap{margin:15px 15px 0 15px; flex: 1;padding: 15px; background: #fff;position: relative}
  8. .summary-wrap .common-wrap .head{display: flex;align-items: center;}
  9. .summary-wrap .common-wrap .head .title{font-size: 16px;font-weight: bolder;}
  10. /* 佣金概览 */
  11. .commission-wrap{height: 120px;background: #fff;position: relative;margin:35px 15px 0 15px;padding: 15px}
  12. .commission-wrap .commission-overview{display: flex;}
  13. .commission-wrap .header{font-weight: bolder;position: absolute;top: 19px;left: 16px;font-size: 16px;color: #333;}
  14. .commission-wrap .li{width: 25%;height: 120px;text-align: left;display: flex;flex-direction: column;padding: 0 15px 10px 15px}
  15. .commission-wrap .li .title{display: flex;align-items: center;font-size: 14px;margin-top: 50px;color: #909399;}
  16. .commission-wrap .li .money{margin-top: 10px;font-size: 26px;color: #303133;}
  17. /* 分销商概览 */
  18. .summary-wrap .fenxiao-wrap{height: 120px;width: 40%;background: #fff;position: relative; margin:15px 0px 0 15px;padding: 15px}
  19. .summary-wrap .fenxiao-wrap .member-overview{display: flex;}
  20. .summary-wrap .fenxiao-wrap .header{font-weight: bolder;position: absolute;top: 19px;left: 16px;font-size: 16px;color: #333;}
  21. .summary-wrap .fenxiao-wrap .li{width: 50%;height: 120px;text-align: left;display: flex;flex-direction: column;padding: 0 15px 10px 15px}
  22. .summary-wrap .fenxiao-wrap .li .title{display: flex;align-items: center;font-size: 14px;margin-top: 50px;color: #909399;}
  23. .summary-wrap .fenxiao-wrap .li .num{margin-top: 10px;font-size: 26px;color: #303133;}
  24. /* 分销订单金额概览 */
  25. .summary-wrap .order-wrap{height: 120px;width: 40%;background: #fff;position: relative; flex:1;margin:15px 15px 0 15px;padding: 15px}
  26. .summary-wrap .order-wrap .order-overview{display: flex;}
  27. .summary-wrap .order-wrap .header{font-weight: bolder;position: absolute;top: 19px;left: 16px;font-size: 16px;color: #333;}
  28. .summary-wrap .order-wrap .li{width: 33%;height: 120px;text-align: left;display: flex;flex-direction: column;padding: 0 15px 10px 15px}
  29. .summary-wrap .order-wrap .li .title{display: flex;align-items: center;font-size: 14px;margin-top: 50px;color: #909399;}
  30. .summary-wrap .order-wrap .li .num{margin-top: 10px;font-size: 26px;color: #303133;}
  31. .summary-wrap .order-wrap .li .money{margin-top: 10px;font-size: 26px;color: #303133;}
  32. /* 分销商人数报表 */
  33. .summary-wrap .common-wrap:nth-child(1){margin-right: 0}
  34. /* 分销订单金额报表 */
  35. .trend-wrap {margin:15px 15px 0 15px;padding: 15px; background: #fff}
  36. .trend-wrap .head{display: flex;align-items: center;}
  37. .trend-wrap .head .title{font-size: 16px;font-weight: bolder;}
  38. /* 分销商等级比例 */
  39. .summary-wrap .common-wrap .body.level{position: absolute;top: 50%;margin-top: -75px !important;width: calc(100% - 30px)}
  40. </style>
  41. {/block}
  42. {block name="main"}
  43. <div class="commission-wrap">
  44. <div class="header">
  45. <span>佣金概览</span>
  46. </div>
  47. <div class="commission-overview">
  48. <div class="li">
  49. <div class="title prompt-block">
  50. 可提现佣金(元)
  51. <div class="prompt">
  52. <i class="iconfont iconwenhao1"></i>
  53. <div class="prompt-box">
  54. <div class="prompt-con">所有分销订单已完成,佣金已结算,可以提现的佣金(不包含已提现的佣金)</div>
  55. </div>
  56. </div>
  57. </div>
  58. <p class="money">{$fenxiao_account}</p>
  59. </div>
  60. <div class="li">
  61. <div class="title prompt-block">
  62. 提现待审核(元)
  63. <div class="prompt">
  64. <i class="iconfont iconwenhao1"></i>
  65. <div class="prompt-box">
  66. <div class="prompt-con">已申请提现等待管理审核的佣金</div>
  67. </div>
  68. </div>
  69. </div>
  70. <p class="money">{if $account_data.account_withdraw_apply == null} 0.00 {else/}{$account_data.account_withdraw_apply}{/if}</p>
  71. </div>
  72. <div class="li">
  73. <div class="title prompt-block">
  74. 提现佣金(元)
  75. <div class="prompt">
  76. <i class="iconfont iconwenhao1"></i>
  77. <div class="prompt-box">
  78. <div class="prompt-con">所有已经提现成功的佣金总和</div>
  79. </div>
  80. </div>
  81. </div>
  82. <p class="money">{if $account_data.account_withdraw == null} 0.00 {else/}{$account_data.account_withdraw}{/if}</p>
  83. </div>
  84. <div class="li">
  85. <div class="title prompt-block">
  86. 进行中佣金(元)
  87. <div class="prompt">
  88. <i class="iconfont iconwenhao1"></i>
  89. <div class="prompt-box">
  90. <div class="prompt-con">指所有分销订单待结算佣金的和</div>
  91. </div>
  92. </div>
  93. </div>
  94. <p class="money">{$commission_money}</p>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="summary-wrap">
  99. <div class="fenxiao-wrap">
  100. <div class="header">
  101. <span>分销商概览</span>
  102. </div>
  103. <div class="member-overview">
  104. <div class="li">
  105. <div class="title">待审核(人)</div>
  106. <p class="num">{$fenxiao_apply_num}</p>
  107. </div>
  108. <div class="li">
  109. <div class="title">分销商(人)</div>
  110. <p class="num">{$fenxiao_num}</p>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="order-wrap">
  115. <div class="header">
  116. <span>分销概览</span>
  117. </div>
  118. <div class="order-overview">
  119. <div class="li">
  120. <div class="title prompt-block">
  121. 分销订单总额(元)
  122. <div class="prompt">
  123. <i class="iconfont iconwenhao1"></i>
  124. <div class="prompt-box">
  125. <div class="prompt-con">指所有分销订单实付金额的和 (包含退款)</div>
  126. </div>
  127. </div>
  128. </div>
  129. <p class="num">{$shop_commission.real_goods_money}</p>
  130. </div>
  131. <div class="li">
  132. <div class="title prompt-block">
  133. 分销佣金总额(元)
  134. <div class="prompt">
  135. <i class="iconfont iconwenhao1"></i>
  136. <div class="prompt-box">
  137. <div class="prompt-con">指所有分销订单所得佣金的和</div>
  138. </div>
  139. </div>
  140. </div>
  141. <p class="num">{$shop_commission.commission}</p>
  142. </div>
  143. <div class="li">
  144. <div class="title">分销商品数(个)</div>
  145. <p class="money">{$fenxiao_goods_num}</p>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. <div class="summary-wrap">
  151. <div class="common-wrap">
  152. <div class="head">
  153. <div class="title">新增分销商数(人)</div>
  154. </div>
  155. <div class="body">
  156. <div id="fenxiao_member" style="width: 100%; height: 300px;"></div>
  157. </div>
  158. </div>
  159. <div class="common-wrap">
  160. <div class="head">
  161. <div class="title">分销商等级比例</div>
  162. </div>
  163. <div class="body level">
  164. <div id="fenxiao_level" style="width: 100%; height: 150px;"></div>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="trend-wrap">
  169. <div class="head">
  170. <div class="title">分销订单金额(元)</div>
  171. </div>
  172. <div class="body">
  173. <div id="order_money" style="width: 100%; height: 300px;"></div>
  174. </div>
  175. </div>
  176. {/block}
  177. {block name="script"}
  178. <script src="SHOP_JS/echarts.min.js"></script>
  179. <script src="SHOP_JS/china.js"></script>
  180. <script>
  181. var baseColor = getComputedStyle(document.documentElement).getPropertyValue('--base-color');
  182. function getDay(day){
  183. var today = new Date();
  184. var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
  185. today.setTime(targetday_milliseconds); //注意,这行是关键代码
  186. var tYear = today.getFullYear();
  187. var tMonth = today.getMonth();
  188. var tDate = today.getDate();
  189. tMonth = doHandleMonth(tMonth + 1);
  190. tDate = doHandleMonth(tDate);
  191. return tMonth + "-" + tDate;
  192. }
  193. function doHandleMonth(month){
  194. var m = month;
  195. if(month.toString().length == 1){
  196. m = "0" + month;
  197. }
  198. return m;
  199. }
  200. getFenxiaoOrder();
  201. getFenxiaoLevel();
  202. getFenixaoMmeber();
  203. //图形统计
  204. function getFenxiaoOrder() {
  205. var dateObj = new Date(Date.now() - 1296000000);
  206. var date = dateObj.getFullYear() + '-' + (dateObj.getMonth() + 1) + '-' + (dateObj.getDate() + 1);
  207. $.ajax({
  208. type:'post',
  209. dataType:'json',
  210. url:ns.url("shop/stat/getStatData"),
  211. data : {
  212. start_time: new Date(date).getTime() / 1000
  213. },
  214. success:function(res){
  215. dealWithChart(res.fenxiao_order_total_money);
  216. }
  217. })
  218. }
  219. function getFenixaoMmeber(){
  220. $.ajax({
  221. type:'post',
  222. dataType:'json',
  223. url:ns.url("shop/stat/getStatData"),
  224. success:function(res){
  225. dealWithChartTo(res.add_fenxiao_member_count);
  226. }
  227. })
  228. }
  229. function dealWithChart(ten_day_json){
  230. var data = [getDay(-14), getDay(-13), getDay(-12), getDay(-11), getDay(-10), getDay(-9), getDay(-8), getDay(-7), getDay(-6), getDay(-5), getDay(-4), getDay(-3), getDay(-2), getDay(-1), getDay(0)];
  231. // 基于准备好的dom,初始化echarts实例
  232. var baseColor = getComputedStyle(document.documentElement).getPropertyValue('--base-color');
  233. // 指定图表的配置项和数据
  234. // 基于准备好的dom,初始化echarts实例
  235. var moneyChart = echarts.init(document.getElementById('order_money'));
  236. // 指定图表的配置项和数据
  237. moneyOption = {
  238. xAxis: {
  239. type: 'category',
  240. data: data
  241. },
  242. yAxis: {
  243. type: 'value'
  244. },
  245. grid: {
  246. top: '8%',
  247. bottom: '9%',
  248. left: '5%',
  249. right: '4%'
  250. },
  251. tooltip: {
  252. trigger: 'axis',
  253. showContent: true,
  254. backgroundColor: 'rgba(0, 0, 0, 0.5)',
  255. padding: [5, 10],
  256. textStyle: {
  257. color: '#fff',
  258. lineHeight: 30,
  259. },
  260. formatter: function(params, ticket, callback) {
  261. return "日期:" + params[0].axisValue + '<br />' + params[0].seriesName + ":" + params[0].value + "元";
  262. },
  263. },
  264. series: [{
  265. name: ['订单金额'],
  266. data: ten_day_json,
  267. type: 'line',
  268. smooth: true,
  269. itemStyle: {
  270. color: baseColor
  271. },
  272. areaStyle: {
  273. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  274. offset: 0,
  275. color: baseColor
  276. }, {
  277. offset: 1,
  278. color: '#fff'
  279. }])
  280. }
  281. }]
  282. };
  283. // 使用刚指定的配置项和数据显示图表。
  284. moneyChart.setOption(moneyOption);
  285. }
  286. function getFenxiaoLevel(){
  287. $.ajax({
  288. dataType: 'JSON',
  289. type: 'POST',
  290. url: ns.url("fenxiao://shop/level/lists"),
  291. data: {
  292. page_size: 0,
  293. },
  294. success: function(res) {
  295. var level = res.data.list;
  296. var echart = echarts.init(document.getElementById('fenxiao_level'));
  297. // 指定图表的配置项和数据
  298. var option = {
  299. tooltip: {
  300. trigger: 'item',
  301. formatter: '{a} <br/>{b}: {c} ({d}%)'
  302. },
  303. legend: {
  304. orient: 'vertical',
  305. left: '50%',
  306. top: '10%',
  307. align: 'auto',
  308. data: level.map(function (item) {
  309. return {
  310. name: item.level_name,
  311. icon: 'circle',
  312. }
  313. })
  314. },
  315. color: level.map(function (item) {
  316. return getRandomColor();
  317. }),
  318. series: [{
  319. width: 150,
  320. height: 150,
  321. top: '0',
  322. left: '10%',
  323. name: '',
  324. type: 'pie',
  325. radius: ['50%', '70%'],
  326. avoidLabelOverlap: false,
  327. label: {
  328. show: false,
  329. position: 'center'
  330. },
  331. emphasis: {
  332. label: {
  333. show: true,
  334. fontSize: '12',
  335. color: baseColor
  336. }
  337. },
  338. labelLine: {
  339. show: false
  340. },
  341. data: level.map(function (item) {
  342. return {
  343. value: item.fenxiao_num,
  344. name: item.level_name,
  345. tooltip: {
  346. trigger: 'item',
  347. backgroundColor: 'rgba(255, 255, 255, 0.7)',
  348. borderColor: '#999',
  349. borderWidth: 1,
  350. padding: 10,
  351. textStyle: {
  352. fontSize: 12,
  353. color: '#333'
  354. }
  355. }
  356. }
  357. })
  358. }]
  359. };
  360. // 使用刚指定的配置项和数据显示图表。
  361. echart.setOption(option);
  362. }
  363. })
  364. }
  365. function getRandomColor(){
  366. return '#' + (function(color){
  367. return (color += '0123456789abcdef'[Math.floor(Math.random()*16)])
  368. && (color.length == 6) ? color : arguments.callee(color);
  369. })('');
  370. }
  371. function dealWithChartTo(ten_day_json){
  372. var data = [getDay(-6), getDay(-5), getDay(-4), getDay(-3), getDay(-2), getDay(-1), getDay(0)];
  373. // 基于准备好的dom,初始化echarts实例
  374. var baseColor = getComputedStyle(document.documentElement).getPropertyValue('--base-color');
  375. // 指定图表的配置项和数据
  376. // 基于准备好的dom,初始化echarts实例
  377. var moneyChart = echarts.init(document.getElementById('fenxiao_member'));
  378. // 指定图表的配置项和数据
  379. moneyOption = {
  380. xAxis: {
  381. type: 'category',
  382. data: data
  383. },
  384. yAxis: {
  385. type: 'value'
  386. },
  387. grid: {
  388. top: '8%',
  389. bottom: '9%',
  390. left: '8%',
  391. right: '4%'
  392. },
  393. tooltip: {
  394. trigger: 'axis',
  395. showContent: true,
  396. backgroundColor: 'rgba(0, 0, 0, 0.5)',
  397. padding: [5, 10],
  398. textStyle: {
  399. color: '#fff',
  400. lineHeight: 30,
  401. },
  402. formatter: function(params, ticket, callback) {
  403. return "日期:" + params[0].axisValue + '<br />' + params[0].seriesName + ":" + params[0].value + "人";
  404. },
  405. },
  406. series: [{
  407. name: ['新增分销商数'],
  408. data: ten_day_json,
  409. type: 'line',
  410. smooth: true,
  411. itemStyle: {
  412. color: baseColor
  413. },
  414. areaStyle: {
  415. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  416. offset: 0,
  417. color: baseColor
  418. }, {
  419. offset: 1,
  420. color: '#fff'
  421. }])
  422. }
  423. }]
  424. };
  425. // 使用刚指定的配置项和数据显示图表。
  426. moneyChart.setOption(moneyOption);
  427. }
  428. </script>
  429. {/block}