From cb9c7650145abce31fab4564ad6e50754ee93242 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 05 三月 2021 15:16:40 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/custOrder/custOrder.js |   63 +++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/src/main/webapp/static/js/custOrder/custOrder.js b/src/main/webapp/static/js/custOrder/custOrder.js
index e153007..99453ed 100644
--- a/src/main/webapp/static/js/custOrder/custOrder.js
+++ b/src/main/webapp/static/js/custOrder/custOrder.js
@@ -33,7 +33,7 @@
             ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
             // ,{field: 'memo', align: 'center',title: '澶囨敞'}
 
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:100}
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width: 120}
         ]],
         request: {
             pageName: 'curr',
@@ -243,24 +243,12 @@
                     }
                 });
                 break;
-            // 缂栬緫
-            case 'edit':
-                layer.open({
-                    type: 2,
-                    title: '淇敼',
-                    maxmin: true,
-                    area: [top.detailWidth, top.detailHeight],
-                    content: 'custOrder_detail.html',
-                    success: function(layero, index){
-                        layer.getChildFrame('#data-detail-submit-save', index).hide();
-                        setFormVal(layer.getChildFrame('#detail', index), data, false);
-                        top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false);
-                        top.convertDisabled(layer.getChildFrame('', index), true);
-                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
-                        layero.find('iframe')[0].contentWindow.layui.form.render('select');
-                        layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
-                    }
-                });
+            // 鎵撳嵃
+            case 'print':
+                layer.confirm('寮�濮嬫墦鍗�' +data.number + ' 鎹¤揣鍗曪紵', {shadeClose: true}, function(){
+                    layer.closeAll();
+                    printPakouts(data.number);
+                })
                 break;
 
         }
@@ -277,9 +265,42 @@
             contentType:'application/json;charset=UTF-8',
             method: 'POST',
             success: function (res) {
-                console.log(res)
                 if (res.code === 200){
-                    alert(JSON.stringify(res.data));
+                    res.data["barcodeUrl"]=baseUrl+"/custOrder/code/auth?type=2&param="+res.data.docNum;
+                    var tpl = $('#pakoutPrintTpl').html();
+                    var template = Handlebars.compile(tpl);
+                    var html = template(res);
+                    console.log(html)
+                    console.log(res)
+                    var box = $("#pakoutPrintBox");
+                    box.html(html);box.show();
+                    box.print({
+                        mediaPrint:true,
+                        deferred: $.Deferred().done(function () {
+                            layer.confirm('[閲嶈] 鎵撳嵃鏄惁鎴愬姛锛�',  {btn: ['Yes', 'No']}, function(){
+                                $.ajax({
+                                    url: baseUrl+"/pakout/print/auth",
+                                    headers: {'token': localStorage.getItem('token')},
+                                    data: {
+                                        docNume: docNumber
+                                    },
+                                    method: 'POST',
+                                    success: function (res) {
+                                        if (res.code === 200){
+                                            layer.closeAll();
+                                            $(".layui-laypage-btn")[0].click();
+                                            layer.msg(res.msg, {icon: 1})
+                                        } else if (res.code === 403){
+                                            top.location.href = baseUrl+"/";
+                                        } else {
+                                            layer.msg(res.msg, {icon: 2})
+                                        }
+                                    }
+                                })
+                            });
+                        })
+                    });
+                    box.hide();
                 } else if (res.code === 403){
                     top.location.href = baseUrl+"/";
                 } else {

--
Gitblit v1.9.1