|
@@ -121,7 +121,7 @@
|
|
|
<li><font class="new_bossok" onclick="bosslkhexcel('bosslkhexcel')">下载结果</font></li>
|
|
<li><font class="new_bossok" onclick="bosslkhexcel('bosslkhexcel')">下载结果</font></li>
|
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
-<ul class="search excelshop" style="border-bottom: 1px solid #ccc;padding:16px 0">
|
|
|
|
|
|
|
+<ul class="search bossshopexcel" style="border-bottom: 1px solid #ccc;padding:16px 0">
|
|
|
<p style="color:#333;font-size: 18px;line-height:50px;">下载店铺数据: <font style="color:#888;font-size: 16px;">数据包含本店全部订单,含店内单和线下单。</font></p>
|
|
<p style="color:#333;font-size: 18px;line-height:50px;">下载店铺数据: <font style="color:#888;font-size: 16px;">数据包含本店全部订单,含店内单和线下单。</font></p>
|
|
|
<li>
|
|
<li>
|
|
|
店铺:<select name="shop" class="select">
|
|
店铺:<select name="shop" class="select">
|
|
@@ -135,7 +135,8 @@
|
|
|
<option value="dtime">订单时间</option>
|
|
<option value="dtime">订单时间</option>
|
|
|
</select> :<input id="outk" value="{date('Y-m-d',time()-24*3600)} 0:00" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})" readonly>
|
|
</select> :<input id="outk" value="{date('Y-m-d',time()-24*3600)} 0:00" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})" readonly>
|
|
|
至 <input id="outj" value="{date('Y-m-d',time())} 23:59" name="timetj" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})" readonly></li>
|
|
至 <input id="outj" value="{date('Y-m-d',time())} 23:59" name="timetj" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})" readonly></li>
|
|
|
-<li><font class="bossok" data-c="excelshop" data-u="excelshop" data-e="1">下载结果</font></li>
|
|
|
|
|
|
|
+<!-- <li><font class="bossok" data-c="excelshop" data-u="excelshop" data-e="1">下载结果</font></li> -->
|
|
|
|
|
+<li><font class="new_bossok" onclick="bossshopexcel('bossshopexcel')">下载结果</font></li>
|
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
<ul class="search excelpass" style="border-bottom: 1px solid #ccc;padding:16px 0">
|
|
<ul class="search excelpass" style="border-bottom: 1px solid #ccc;padding:16px 0">
|
|
@@ -414,6 +415,92 @@ var f = {}; var i = 0;
|
|
|
}
|
|
}
|
|
|
},'json')
|
|
},'json')
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ function bossshopexcel(id_name){
|
|
|
|
|
+ layx.load('loadId','处理中,请稍后');
|
|
|
|
|
+ var f = "";
|
|
|
|
|
+ $("."+id_name+" input:text").each(function() {
|
|
|
|
|
+ var str2 = escape($(this).val());
|
|
|
|
|
+ str2 = $(this).val().replace(/\</g,"<");
|
|
|
|
|
+ str2 = str2.replace(/\>/g,">");
|
|
|
|
|
+ str2 = str2.replace(/\+/g,"%2B");
|
|
|
|
|
+ str2 = str2.replace(/&/g,"%26");
|
|
|
|
|
+ f = f + $(this).attr("name") + "=" + str2 + "&";
|
|
|
|
|
+ });
|
|
|
|
|
+ $("."+id_name+" .select").each(function() {
|
|
|
|
|
+ f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ let url = "/boss/excelshopjs?"+f;
|
|
|
|
|
+ $.get(url,function(res){
|
|
|
|
|
+ if(res.code==0){
|
|
|
|
|
+ layx.destroy('loadId');
|
|
|
|
|
+ layx.confirm('提示',res.msg,null,{
|
|
|
|
|
+ buttons:[
|
|
|
|
|
+ {
|
|
|
|
|
+ label:'确定',
|
|
|
|
|
+ callback:function(id, button, event){
|
|
|
|
|
+
|
|
|
|
|
+ layx.destroy(id);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ],dialogIcon:'error',shadable:0.6
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ const fileName = res.filename+'.xlsx' ;
|
|
|
|
|
+ // 将数据转换为工作表
|
|
|
|
|
+
|
|
|
|
|
+ let list = [];
|
|
|
|
|
+ let data = res.data;
|
|
|
|
|
+ for(let item in data){
|
|
|
|
|
+ list.push({
|
|
|
|
|
+ "时间":data[item][0],
|
|
|
|
|
+ "店铺":data[item][1],
|
|
|
|
|
+ "订单数":data[item][2],
|
|
|
|
|
+ "订单金额":data[item][3],
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ const worksheet = XLSX.utils.json_to_sheet(list);
|
|
|
|
|
+ // 创建工作簿
|
|
|
|
|
+ const workbook = XLSX.utils.book_new();
|
|
|
|
|
+
|
|
|
|
|
+ worksheet['!cols'] =
|
|
|
|
|
+ [
|
|
|
|
|
+ { wch: 15 },
|
|
|
|
|
+ { wch: 20 },
|
|
|
|
|
+ { wch: 10 },
|
|
|
|
|
+ { wch: 10 },
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ const range = XLSX.utils.decode_range(worksheet['!ref']);
|
|
|
|
|
+
|
|
|
|
|
+ for (let row = range.s.r; row <= range.e.r; row++) {
|
|
|
|
|
+ for (let col = range.s.c; col <= range.e.c; col++) {
|
|
|
|
|
+ const cellAddress = XLSX.utils.encode_cell({ r: row, c: col });
|
|
|
|
|
+
|
|
|
|
|
+ if (worksheet[cellAddress]) {
|
|
|
|
|
+ // 初始化样式对象
|
|
|
|
|
+ worksheet[cellAddress].s = worksheet[cellAddress].s || {};
|
|
|
|
|
+ worksheet[cellAddress].s.alignment = worksheet[cellAddress].s.alignment || {};
|
|
|
|
|
+
|
|
|
|
|
+ // 只为前两列(名称和中文)设置自动换行
|
|
|
|
|
+ if (col <= 1) { // 0=名称列, 1=中文列
|
|
|
|
|
+ worksheet[cellAddress].s.alignment.wrapText = true;
|
|
|
|
|
+ worksheet[cellAddress].s.alignment.vertical = 'top';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 将工作表添加到工作簿
|
|
|
|
|
+ XLSX.utils.book_append_sheet(workbook, worksheet, res.filename);
|
|
|
|
|
+
|
|
|
|
|
+ // 导出文件
|
|
|
|
|
+ XLSX.writeFile(workbook, fileName);
|
|
|
|
|
+ layx.destroy('loadId');
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ },'json')
|
|
|
|
|
+ }
|
|
|
</script>
|
|
</script>
|
|
|
<script type="text/javascript" src="{$theme}js/excel/xlxs.js" ></script>
|
|
<script type="text/javascript" src="{$theme}js/excel/xlxs.js" ></script>
|
|
|
{Template footer}
|
|
{Template footer}
|