Переглянути джерело

兼容不同快递的打印功能

xian 6 роки тому
батько
коміт
26f7a040d3

+ 77 - 52
watero-rst-web/src/main/webapp/WEB-INF/views/order/salesOrder/print_order.ftl

@@ -15,58 +15,69 @@
 </head>
 <body>
 <div class="page-container">
-    <div class="order-list">
 
+    <div class="order-list">
         <div>
-            本次共 <span style="color: red;">${(page.dataList?size)!"0"}</span> 个订单
+            本次共 <span style="color: red;">${(orderSize)!"0"}</span> 个订单&nbsp;&nbsp;未分配物流的订单数量: <span style="color: red;">${errorOrderNum}</span>
             <p style="margin-top: 5px;color: blue;">请设置好默认打印机:Windows开始菜单 >> 设备和打印机 >> 寻找到要打印的机器,将其设置为默认打印机</p>
         </div>
-        <div class="mt-20" style="height: 330px;overflow: auto;overflow-x: hidden;margin-bottom: 12px;border: 1px solid #ddd;">
-            <table class="table table-border table-bordered table-bg table-hover table-sort">
-                <thead>
-                <tr class="text-c">
-                    <th width="20">状态</th>
-                    <th width="70">订单编号</th>
-                    <th width="30">姓名</th>
-                    <th width="50">电话</th>
-                    <th width="100">收货地址</th>
-                    <th width="100">订单产品</th>
-                </tr>
-                </thead>
-                <tbody id="productHtml">
-                    <#if (page.dataList?size <= 0)>
-                        <tr class="text-c"><td colspan="12">暂无数据</td></tr>
-                    <#else>
-                        <#list page.dataList as o>
-                            <tr class="text-c wait-print-order" printState="1">
-                                <td>待处理</td>
-                                <td salesId="${o.salesId}">${(o.salesOrderId)!}</td>
-                                <td>${(o.salesAddressName)!}</td>
-                                <td>${(o.salesAddressTel)!}</td>
-                                <td>${(o.salesAddressInfo)!}</td>
-                                <td style="text-align: left;">
-                                    <#if o.salesOrderItemList ??>
-                                        <#list o.salesOrderItemList as d>
-                                            <span class="label label-success radius">${(d.itemProductName)!}(${(d.itemProductColor)!})*${(d.itemNum)!}</span>
-                                        </#list>
-                                    </#if>
-                                </td>
-                            </tr>
-                        </#list>
-                    </#if>
-                </tbody>
-            </table>
-        </div>
+        <div class="mt-20" style="height: 500px;overflow: auto;overflow-x: hidden;margin-bottom: 12px;border: 1px solid #ddd;">
 
-        <div class="formControls col-1 col-sm-1" style="width: 100%;">
-            <select class="select" id="all-post-select" style="margin-left: -15px;height: 31px;width: 150px">
-                <#list posts as d>
-                    <option value="${(d.logisticsRstCode)!}">${(d.logisticsName)!}</option>
+            <!-- 选项卡 头部 -->
+            <div id="tab_demo" class="HuiTab">
+                <div class="tabBar clearfix">
+                <#list page?keys as key>
+                    <span>${key}(${page[key]?size})</span>
                 </#list>
-            </select>
-            <select class="select" id="print-machine" style="height: 31px;width: 150px;display: none">
-            </select>
-            <button type="button" class="btn btn-primary" style="background: #32a3d8;color: #fff;" id="sub-post">开始打印</button>
+                </div>
+
+            <!-- 选项卡 内容 -->
+            <#assign x = 0>
+            <#list page?values as value>
+                <div class="tabCon">
+                    <table class="table table-border table-bordered table-bg table-hover table-sort">
+                        <thead>
+                        <tr class="text-c">
+                            <th width="20">状态</th>
+                            <th width="70">订单编号</th>
+                            <th width="30">姓名</th>
+                            <th width="50">电话</th>
+                            <th width="100">收货地址</th>
+                            <th width="100">订单产品</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                            <#if (value?size <= 0)>
+                            <tr class="text-c"><td colspan="12">暂无数据</td></tr>
+                            <#else>
+                                <#list value as o>
+                                <tr class="text-c ${x}-wait-print-order" printState="1">
+                                    <td>待处理</td>
+                                    <td salesId="${o.salesId}" post="${(o.salesPostFirm)!}">${(o.salesOrderId)!}</td>
+                                    <td>${(o.salesAddressName)!}</td>
+                                    <td>${(o.salesAddressTel)!}</td>
+                                    <td>${(o.salesAddressInfo)!}</td>
+                                    <td style="text-align: left;">
+                                        <#if o.salesOrderItemList ??>
+                                            <#list o.salesOrderItemList as d>
+                                                <span class="label label-success radius">${(d.itemProductName)!}(${(d.itemProductColor)!})*${(d.itemNum)!}</span>
+                                            </#list>
+                                        </#if>
+                                    </td>
+                                </tr>
+                                </#list>
+                            </#if>
+                        </tbody>
+                    </table>
+                </div>
+                <#assign x = x + 1>
+            </#list>
+
+            </div>
+        </div>
+
+        <div class="formControls col-1 col-sm-1" style="width: 100%;margin-left: -0.4%;">
+            <button type="button" class="btn btn-primary" style="background: #32a3d8;color: #fff;margin-left: -0.7%" id="sub-post">开始打印</button>
         </div>
 
         <div id="print-pageview-div" style="display: none"></div>
@@ -81,8 +92,11 @@
     // 选择打印设备
     var LODOP=getLodop();
     $(function () {
-        // 获取系统的打印机
-        setPrintMachine();
+        $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0");
+
+
+    // 获取系统的打印机
+        //setPrintMachine();
         function setPrintMachine() {
             var count = LODOP.GET_PRINTER_COUNT() - 1;
             for (var i = 0; i <= count; i++) {
@@ -93,8 +107,8 @@
         // 开始打印
         $("#sub-post").click(function() {
             LODOP.SELECT_PRINTER();
-
-            var orders = $(".wait-print-order");
+            var index = getCurrTab();
+            var orders = $("." + index + "-wait-print-order");
             if (orders == null || orders.length <= 0) {
                 layer.msg("未选中订单",{icon: 2,time:3000});
                 return;
@@ -104,7 +118,8 @@
         });
 
         function nextPrintOrder() {
-            var orders = $(".wait-print-order");
+            var index = getCurrTab();
+            var orders = $("." + index + "-wait-print-order");
             for(var i = 0; i < orders.length; i++) {
                 if ($(orders[i]).attr("printState") == "1") {
                     // 待打印
@@ -122,11 +137,12 @@
             var $td = $(order.find("td")[1]);
             var orderId = $td.text().trim();
             var salesId = $td.attr("salesId");
+            var post = $td.attr("post");
             // 单个打印
             $.ajax({
                 type: "POST",
                 data: {
-                    "post":$("#all-post-select").val(),
+                    "post":post,
                     "orderId":orderId,
                     "salesId":salesId
                 },
@@ -158,6 +174,15 @@
             });
         }
     });
+
+    function getCurrTab() {
+        var spans = $(".tabBar").find("span");
+        for (var i = 0 ; i < spans.length; i++) {
+            if ($(spans[i]).attr("class").indexOf("current") != -1) {
+                return i;
+            }
+        }
+    }
 </script>
 </body>
 </html>