|  |  |  | 
|---|
|  |  |  | <div class="layui-btn-container"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverOne">导出待发货订单,系统自动发货</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="confirmOrder">确认到货</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="printSelect">自定义打印</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="goodsStatistics">统计商品份数</button> | 
|---|
|  |  |  | <!--        <button id="printSelect" type="button" class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain">自定义打印</button>--> | 
|---|
|  |  |  | <!--        <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverTwo">导出未发货订单(快递)</button>--> | 
|---|
|  |  |  | <!--        <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" id="importDeliver" lay-event="importDeliver">导入发货</button>--> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | var event = obj.event; | 
|---|
|  |  |  | var id = obj.config.id; | 
|---|
|  |  |  | var checkStatus = table.checkStatus(id); | 
|---|
|  |  |  | if(event === 'confirmOrder'){ | 
|---|
|  |  |  | let uniqueCodeValue = $searchForm.find("select[name='uniqueCode']").val(); | 
|---|
|  |  |  | if(uniqueCodeValue == '' || uniqueCodeValue == null){ | 
|---|
|  |  |  | febs.alert.warn('请选择团长'); | 
|---|
|  |  |  | if(event === 'printSelect'){ | 
|---|
|  |  |  | var checkStatus = table.checkStatus('orderTable') | 
|---|
|  |  |  | console.log(checkStatus) | 
|---|
|  |  |  | // 判断是否选中数据 | 
|---|
|  |  |  | if (checkStatus.data.length === 0) { | 
|---|
|  |  |  | layer.msg('请选择数据', { | 
|---|
|  |  |  | icon: 2 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | printSelect(checkStatus.data) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(event === 'goodsStatistics'){ | 
|---|
|  |  |  | var data = checkStatus.data; | 
|---|
|  |  |  | let statistics = 0; | 
|---|
|  |  |  | for(let i = 0;i < data.length;i++){ | 
|---|
|  |  |  | statistics = statistics+ "," + data[i].id; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(statistics == null || statistics == ""){ | 
|---|
|  |  |  | febs.alert.warn('请选择需要统计的订单'); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | febs.modal.open( '商品数量统计', 'modules/order/goodsStatistics/'+statistics, { | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // febs.get(ctx + 'admin/order/goodsStatistics?orderIds='+ids, null, function () { | 
|---|
|  |  |  | //     febs.alert.success('操作成功'); | 
|---|
|  |  |  | //     $query.click(); | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | // window.location.href = ctx + "admin/order/confirmOrder?takeUniqueCode="+uniqueCodeValue+"&orderIds="+ids; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(event === 'confirmOrder'){ | 
|---|
|  |  |  | let uniqueCodeValue = $searchForm.find("select[name='uniqueCode']").val(); | 
|---|
|  |  |  | // if(uniqueCodeValue == '' || uniqueCodeValue == null){ | 
|---|
|  |  |  | //     febs.alert.warn('请选择团长'); | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | var data = checkStatus.data; | 
|---|
|  |  |  | let ids = ""; | 
|---|
|  |  |  | for(let i = 0;i < data.length;i++){ | 
|---|
|  |  |  | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox', fixed: 'left'}, | 
|---|
|  |  |  | {field: 'orderNo', title: '订单编号', minWidth: 200,align:'left'}, | 
|---|
|  |  |  | {field: 'memberName', title: '购买人', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | {field: 'memberName', title: '购买人', minWidth: 100,align:'left'}, | 
|---|
|  |  |  | {field: 'memberPhone', title: '联系方式', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | // {field: 'memberBindPhone', title: '联系方式', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | {field: 'goodsName', title: '商品', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | {field: 'amount', title: '订单金额', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | {field: 'goodsName', title: '商品', minWidth: 160,align:'left'}, | 
|---|
|  |  |  | {field: 'amount', title: '订单金额', minWidth: 80,align:'left'}, | 
|---|
|  |  |  | {field: 'leaderName', title: '团长', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | {field: 'orderTime', title: '下单时间', minWidth: 200,align:'left'}, | 
|---|
|  |  |  | {field: 'isHome', title: '配送方式', | 
|---|
|  |  |  | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, minWidth: 120,align:'center'}, | 
|---|
|  |  |  | }, minWidth: 100,align:'center'}, | 
|---|
|  |  |  | {field: 'status', title: '状态', | 
|---|
|  |  |  | templet: function (d) { | 
|---|
|  |  |  | if (d.status === 1) { | 
|---|
|  |  |  | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, minWidth: 120,align:'center'}, | 
|---|
|  |  |  | {field: 'payMethod', title: '支付方式', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | {field: 'payTime', title: '支付时间', minWidth: 200,align:'left'}, | 
|---|
|  |  |  | {field: 'wxOrderNo', title: '支付订单号', minWidth: 200,align:'left'}, | 
|---|
|  |  |  | }, minWidth: 80,align:'center'}, | 
|---|
|  |  |  | {field: 'payMethod', title: '支付方式', minWidth: 100,align:'left'}, | 
|---|
|  |  |  | {field: 'payTime', title: '支付时间', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | {field: 'wxOrderNo', title: '支付订单号', minWidth: 120,align:'left'}, | 
|---|
|  |  |  | {title: '操作', | 
|---|
|  |  |  | templet: function (d) { | 
|---|
|  |  |  | return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | * layui打印表格自定义函数 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | function print(tablelayid) { | 
|---|
|  |  |  | var v = document.createElement("div"); | 
|---|
|  |  |  | var f = ["<head>", "<style>", "body{font-size: 12px; color: #666;}", | 
|---|
|  |  |  | "table{width: 100%; border-collapse: collapse; border-spacing: 0;}", | 
|---|
|  |  |  | "th,td{line-height: 20px; padding: 9px 15px; border: 1px solid #ccc; text-align: left; font-size: 12px; color: #666;}", | 
|---|
|  |  |  | "a{color: #666; text-decoration:none;}", "*.layui-hide{display: none}", "</style>", "</head>" | 
|---|
|  |  |  | ].join(""); | 
|---|
|  |  |  | $(v).append($(".layui-table-box").find(".layui-table-header").html()); | 
|---|
|  |  |  | $(v).find("tr").after($("[lay-id=\"" + tablelayid + "\"] .layui-table-body.layui-table-main table").html()); | 
|---|
|  |  |  | $(v).find("th.layui-table-patch").remove(); | 
|---|
|  |  |  | $(v).find(".layui-table-col-special").remove(); | 
|---|
|  |  |  | var h = window.open("打印窗口", "_blank"); | 
|---|
|  |  |  | h.document.write(f + $(v).prop("outerHTML")); | 
|---|
|  |  |  | h.document.close(); | 
|---|
|  |  |  | h.print(); | 
|---|
|  |  |  | h.close(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 监听打印选中行按钮 */ | 
|---|
|  |  |  | // $('#printSelect').click(function() { | 
|---|
|  |  |  | //     layui.use(['table', 'layer'], function() { | 
|---|
|  |  |  | //         var table = layui.table, | 
|---|
|  |  |  | //             layer = layui.layer; | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //         var checkStatus = table.checkStatus('orderTable') | 
|---|
|  |  |  | //         console.log(checkStatus) | 
|---|
|  |  |  | //         // 判断是否选中数据 | 
|---|
|  |  |  | //         if (checkStatus.data.length === 0) { | 
|---|
|  |  |  | //             layer.msg('请选择数据', { | 
|---|
|  |  |  | //                 icon: 2 | 
|---|
|  |  |  | //             }) | 
|---|
|  |  |  | //         } else { | 
|---|
|  |  |  | //             printSelect(checkStatus.data) | 
|---|
|  |  |  | //         } | 
|---|
|  |  |  | //     }) | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | * [自定义打印选中行数据] | 
|---|
|  |  |  | * @param  {[type]}  allData [传入选中行] | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | function printSelect(allData) { | 
|---|
|  |  |  | //用于包含内容 | 
|---|
|  |  |  | var v = document.createElement("div"); | 
|---|
|  |  |  | //页面头部,导入css  ,media="print"表示打印时使用该样式 | 
|---|
|  |  |  | var f = ["<head>", "<style>", "div{font-size:8px;}", ".main{width:100%;height:20%}", | 
|---|
|  |  |  | ".main div{width:100%;display:inline-block;}", "</style>", "</head>" | 
|---|
|  |  |  | ].join(""); | 
|---|
|  |  |  | var contentHtml = ""; | 
|---|
|  |  |  | for (let i = 0; i < allData.length; i++) { | 
|---|
|  |  |  | let data = allData[i] | 
|---|
|  |  |  | var template = | 
|---|
|  |  |  | "<div class='main'>" + | 
|---|
|  |  |  | // "<div style='text-align: center;font-size: 22px;font-weight: bold;margin-bottom: 30px'>订单详情</div>" + | 
|---|
|  |  |  | "<div>姓名:" + data.name + "</div><br><br>" + | 
|---|
|  |  |  | "<div>电话:" + data.phone + "</div><br><br>" + | 
|---|
|  |  |  | "<div>地址:" + data.address + "</div><br><br>" + | 
|---|
|  |  |  | "<div>编号:" + data.orderNo + "</div><br><br>" + | 
|---|
|  |  |  | "<div>商品:" + data.goodsName + "</div><br><br>" + | 
|---|
|  |  |  | "</div>" | 
|---|
|  |  |  |  | 
|---|
|  |  |  | contentHtml += template; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //contentHtml为已拼凑好的内容 | 
|---|
|  |  |  | $(v).append(contentHtml) | 
|---|
|  |  |  | //新建窗口 | 
|---|
|  |  |  | var h = window.open("打印窗口", "_blank"); | 
|---|
|  |  |  | //写入拼凑内容 | 
|---|
|  |  |  | h.document.write(f + $(v).prop("outerHTML")); | 
|---|
|  |  |  | //调用打印 | 
|---|
|  |  |  | h.print(); | 
|---|
|  |  |  | //关闭页面 | 
|---|
|  |  |  | h.close(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | </script> | 
|---|