| | |
| | | success: function (res) { |
| | | console.log(res) |
| | | if (res.code === 200){ |
| | | alert(JSON.stringify(res.data)); |
| | | var tpl = $('#pakoutPrintTpl').html(); |
| | | var template = Handlebars.compile(tpl); |
| | | var html = template(res); |
| | | var box = $("#box"); |
| | | box.html(html);box.show(); |
| | | box.print({ |
| | | mediaPrint:true, |
| | | deferred: $.Deferred().done(function () { |
| | | layer.confirm('[重要] 打印是否成功?', {btn: ['Yes', 'No']}, function(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/trayCode/print/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | 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 { |