ga_productinfo.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. {Template header}
  2. <script src="{$theme}js/base64.min.js"></script>
  3. <body>
  4. <div class="warp">
  5. <div class="title default " style="margin-bottom:20px;">{$productName}</div>
  6. <div class='card-list'>
  7. </div>
  8. <div class="box">
  9. <div class="contiant">
  10. <div class="paihangtitle">
  11. <div><span class="selected_days">近{$days}天</span>sku销量</div>
  12. </div>
  13. <div style="width: 100%;height: 350px; overflow-y: scroll;">
  14. <table class="sku" style="border-collapse:collapse; width: 100%; font-size: 13px; ">
  15. <tr style="background-color: rgb(241,243,249); height: 40px; color:rgb(168,168,185) ;">
  16. <th width="5%"></th>
  17. <th width="30%">商品sku</th>
  18. <th width="10%"></th>
  19. <th width="10%">收入</th>
  20. <th width="10%"></th>
  21. <th width="10%">订单数</th>
  22. <th width="10%"></th>
  23. <th width="10%">购买数量</th>
  24. </tr>
  25. <tbody class="tbody">
  26. </tbody>
  27. </table>
  28. </div>
  29. </div>
  30. <!-- <div class="contiant" >
  31. <div class="paihangtitle">
  32. <div><span class="selected_days">近七天</span>地区销量排行</div>
  33. </div>
  34. <div style="width: 100%;height: 350px; overflow-y: scroll;">
  35. <table class="sell" style="border-collapse:collapse; width: 100%; font-size: 13px; ">
  36. <tr style="background-color: rgb(241,243,249); height: 40px; color:rgb(168,168,185) ;">
  37. <th width="5%"></th>
  38. <th width="20%">地区</th>
  39. <th width="12.5%"></th>
  40. <th width="12.5%">订单量</th>
  41. <th width="12.5%"></th>
  42. <th width="18%">占比</th>
  43. </tr>
  44. <tbody class="tbody">
  45. </tbody>
  46. </table>
  47. </div>
  48. </div> -->
  49. <!-- <div class="contiant" >
  50. <div class="paihangtitle">
  51. <div><span class="selected_days">近七天</span>Google Ads 广告系列效果</div>
  52. </div>
  53. <div style="width: 100%;height: 350px; overflow-y: scroll;">
  54. <table class="ads" style="border-collapse:collapse; width: 100%; font-size: 13px; ">
  55. <tr style="background-color: rgb(241,243,249); height: 40px; color:rgb(168,168,185) ;">
  56. <th width="5%"></th>
  57. <th width="20%">广告系列</th>
  58. <th width="12.5%"></th>
  59. <th width="12.5%">点击次数</th>
  60. <th width="12.5%"></th>
  61. <th width="18%">费用</th>
  62. <th width="12.5%"></th>
  63. <th width="12.5%">收入</th>
  64. </tr>
  65. <tbody class="tbody">
  66. </tbody>
  67. </table>
  68. </div>
  69. </div> -->
  70. <div class="contiant" style="width:60%;">
  71. <div class="paihangtitle">
  72. <div><span class="selected_days">近{$days}天</span>店铺销量数据</div>
  73. </div>
  74. <ul>
  75. <li class="time_btn hour" data-type="hour">分时</li>
  76. <li class="time_btn day active" data-type="day">日</li>
  77. <li class="time_btn week" data-type="week">周</li>
  78. <li class="time_btn month" data-type="month">月</li>
  79. </ul>
  80. <div id="sell" style="height: 800px;">
  81. </div>
  82. </div>
  83. </div>
  84. <style>
  85. th{
  86. font-weight: 100;
  87. }
  88. tbody tr{
  89. height: 50px;
  90. }
  91. .paiming{
  92. width: 20px;
  93. height: 20px;
  94. line-height: 20px;
  95. font-weight: 600;
  96. color: #FFFFFF;
  97. background-color: rgb(182,180,182);
  98. }
  99. .box{
  100. display: flex;
  101. flex-flow: row wrap;
  102. justify-content: space-around;
  103. margin: 25px;
  104. }
  105. table tr:nth-child(even){
  106. background: rgb(249,249,251);
  107. }
  108. .paimingone,.paiming1 {
  109. background-color: rgb(255,197,50);
  110. }
  111. .paimingtwo,.paiming2{
  112. background-color: rgb(244,144,111);
  113. }
  114. .paimingthree,.paiming3{
  115. background-color: rgb(37,208,234);
  116. }
  117. .contiant{
  118. width: 600px;
  119. height: 400px;
  120. box-sizing: border-box;
  121. padding: 20px;
  122. background-color: #fff;
  123. border-radius: 5px;
  124. box-shadow:2px 2px 5px #999999;
  125. display: flex;
  126. flex-direction: column;
  127. margin: 20px;
  128. }
  129. .paihangtitle{
  130. display: flex;
  131. justify-content: space-between;
  132. margin-bottom: 10px;
  133. }
  134. .paihangtitle div{
  135. color: rgb(5,55,72);
  136. font-weight: 600;
  137. }
  138. .paihangtitle a{
  139. text-decoration: none;
  140. color:rgb(168,168,185);
  141. font-weight: 100;
  142. }
  143. .card-list {
  144. display: flex;
  145. flex-wrap: wrap;
  146. justify-content: left;
  147. margin: auto;
  148. }
  149. .card-item {
  150. margin: 20px;
  151. /* box-sizing: border-box; */
  152. padding: 20px;
  153. width: 150px;
  154. border-radius: 5px;
  155. box-shadow: 2px 2px 5px #999999;
  156. text-align: center;
  157. background-color: #fff;
  158. }
  159. .time_btn{
  160. display: block;
  161. float: left;
  162. background-color: #f3f3f3;
  163. padding: 8px 7px;
  164. font: bold 11px 'Roboto',sans-serif;
  165. color: #444;
  166. border: 1px solid #ccc;
  167. background-image: -webkit-linear-gradient(top,#fefefe,#f3f3f3);
  168. background-image: -moz-linear-gradient(top,#fefefe,#f3f3f3);
  169. cursor: pointer;
  170. min-width: 18px;
  171. text-align: center;
  172. }
  173. .time_btn.active{
  174. background-color: #dfdfdf;
  175. background-image: -webkit-linear-gradient(top,#f0f0f0,#dfdfdf);
  176. background-image: -moz-linear-gradient(top,#f0f0f0,#dfdfdf);
  177. border-color: #ccc;
  178. box-shadow: inset 0px 1px 5px rgba(0,0,0,.3);
  179. color: #222;
  180. }
  181. </style>
  182. </div>
  183. <script src="{$theme}js/echarts.min.js?v=201911220005"></script>
  184. <script type="text/javascript">
  185. var sellChart = echarts.init(document.getElementById('sell'));
  186. var sell
  187. var cur_date
  188. var cur_data
  189. sell='{$sell}'
  190. sell=JSON.parse(sell)
  191. var sku='{$sku}';
  192. var sku=JSON.parse(sku)
  193. console.log(sku);
  194. $(".default span").click(function() {
  195. defaultgo();
  196. });
  197. $(document).ready(function() {
  198. defaultgo();
  199. })
  200. $('.time_btn').click(function(){
  201. $(this).addClass("active").siblings().removeClass("active");
  202. $type=$(this).data('type')
  203. var data=[];
  204. cur_date=$type;
  205. cur_data=sell.data[$type];
  206. date=sell.date[$type];
  207. for(var key in cur_data){
  208. data.push(cur_data[key].itemQuantity)
  209. }
  210. option = {
  211. xAxis: {
  212. data: date
  213. },
  214. series: [{
  215. name:"销量",
  216. data: data,
  217. type: 'line',
  218. smooth:true,
  219. }],
  220. dataZoom:[
  221. { // 这个dataZoom组件,默认控制x轴。
  222. type: 'slider', //
  223. show:false,
  224. start: 0, // 左边在 10% 的位置。
  225. end: 100 // 右边在 60% 的位置。
  226. },
  227. { // 这个dataZoom组件,默认控制x轴。
  228. type: 'inside', //
  229. show:false,
  230. start: 0, // 左边在 10% 的位置。
  231. end: 100 // 右边在 60% 的位置。
  232. }
  233. ],
  234. };
  235. if($type=="hour"){
  236. option.dataZoom=[
  237. { // 这个dataZoom组件,默认控制x轴。
  238. type: 'slider', //
  239. show:true,
  240. start: 60, // 左边在 10% 的位置。
  241. end: 100 // 右边在 60% 的位置。
  242. },
  243. { // 这个dataZoom组件,默认控制x轴。
  244. type: 'inside', //
  245. show:true,
  246. start: 60, // 左边在 10% 的位置。
  247. end: 100 // 右边在 60% 的位置。
  248. }
  249. ];
  250. }
  251. sellChart.setOption(option);
  252. // sellChart.pagere
  253. })
  254. function getSellChart(sell){
  255. console.log(sell);
  256. cur_date="day";
  257. cur_data=sell.data.day
  258. var data = [];
  259. // day_data.forEach(function(data,item){
  260. // console.log(data);
  261. // console.log(item);
  262. // },[]);
  263. for(var key in cur_data){
  264. data.push(cur_data[key].itemQuantity)
  265. }
  266. option = {
  267. xAxis: {
  268. type: 'category',
  269. data: sell.date.day
  270. },
  271. yAxis: {
  272. type: 'value'
  273. },
  274. tooltip: {
  275. trigger: 'axis',
  276. formatter:function(params){
  277. name=params[0].name;
  278. // console.log(cur_data[name]);
  279. str="";
  280. str+="<span>销量: "+cur_data[name].itemQuantity+"</span><br/>";
  281. str+="<span>交易次数: "+cur_data[name].transactions+"</span><br/>";
  282. str+="<span>总金额: $"+cur_data[name].transactionRevenue+"</span>";
  283. return str;
  284. }
  285. },
  286. series: [{
  287. name:"销量",
  288. data: data,
  289. type: 'line',
  290. smooth:true,
  291. }],
  292. dataZoom:[
  293. { // 这个dataZoom组件,默认控制x轴。
  294. type: 'slider', //
  295. show:false,
  296. start: 0, // 左边在 10% 的位置。
  297. end: 100 // 右边在 60% 的位置。
  298. },
  299. { // 这个dataZoom组件,默认控制x轴。
  300. type: 'inside', //
  301. show:false,
  302. start: 0, // 左边在 10% 的位置。
  303. end: 100 // 右边在 60% 的位置。
  304. }
  305. ],
  306. };
  307. // 使用刚指定的配置项和数据显示图表。
  308. sellChart.setOption(option);
  309. }
  310. function defaultgo() {
  311. // days=$("[name='days']").val();
  312. // shop=$("[name='shop']").val();
  313. // selday_str=$(".select.days option:selected").text();
  314. // $('.selected_days').text(selday_str);
  315. // $('.sell .tbody').html("");
  316. // $('.sku .tbody').html("");
  317. // $(".card-list").html("")
  318. // $.ajax({
  319. // url: "/ga/productioninfo/",
  320. // data: {"days":days,"shop":shop},
  321. // type: "POST",
  322. // dataType: "json",
  323. // success: function(a) {
  324. // if (a && a.success) {
  325. //sell
  326. sku.map((item,index)=>{
  327. // var h='"/ga/productinfo/'+shop+'/'+days+'/'+Base64.encode(item.productName)+'"'
  328. var Tdom ='<tr ><th><div class="paiming paiming'+parseInt(index+1)+'">'+parseInt(index+1)+'</div></th><th width="20%"><div>'+item.productSku+'</div></th><th width="10%"></th><th width="10%"><div>'+item.itemRevenue+'</div></th><th width="10%"></th><th width="10%"><div><div>'+item.uniquePurchases+'</div></div></div></th><th width="10%"></th><th width="10%"><div><div>'+item.itemQuantity+'</div></div></th></tr>'
  329. $('.sku .tbody').append(Tdom)
  330. })
  331. // 基于准备好的dom,初始化echarts实例
  332. getSellChart(sell);
  333. }
  334. // }
  335. // });
  336. // };
  337. </script>
  338. <script type="text/javascript" src="{$theme}js/laydate.js"></script>
  339. {Template footer}