|  |  | 
 |  |  | <div class="layui-fluid layui-anim febs-anim" id="febs-order" lay-title="商品列表"> | 
 |  |  | <div class="layui-fluid layui-anim febs-anim" id="febs-order" lay-title="订单列表"> | 
 |  |  |     <div class="layui-row febs-container"> | 
 |  |  |         <div class="layui-col-md12"> | 
 |  |  |             <div class="layui-card"> | 
 |  |  | 
 |  |  |                                     </div> | 
 |  |  |                                 </div> | 
 |  |  |                                 <div class="layui-inline"> | 
 |  |  |                                     <label class="layui-form-label">团长:</label> | 
 |  |  |                                     <div class="layui-input-inline"> | 
 |  |  |                                         <select name="uniqueCode" class="order-takeUniqueCode"> | 
 |  |  |                                             <option value="">请选择</option> | 
 |  |  |                                         </select> | 
 |  |  |                                     </div> | 
 |  |  |                                 </div> | 
 |  |  |                                 <div class="layui-inline"> | 
 |  |  |                                     <label class="layui-form-label layui-form-label-sm">配送方式</label> | 
 |  |  |                                     <div class="layui-input-inline"> | 
 |  |  |                                         <select name="isHome"> | 
 |  |  |                                             <option value="">请选择</option> | 
 |  |  |                                             <option value="1">送货上门</option> | 
 |  |  |                                             <option value="2">自提</option> | 
 |  |  |                                         </select> | 
 |  |  |                                     </div> | 
 |  |  |                                 </div> | 
 |  |  |                                 <div class="layui-inline"> | 
 |  |  |                                     <label class="layui-form-label layui-form-label-sm">支付状态</label> | 
 |  |  |                                     <div class="layui-input-inline"> | 
 |  |  |                                         <select name="payResult"> | 
 |  |  | 
 |  |  |                                             <option value="2">未成功</option> | 
 |  |  |                                         </select> | 
 |  |  |                                     </div> | 
 |  |  |                                 </div> | 
 |  |  |                                 <div class="layui-inline"> | 
 |  |  |                                         <label class="layui-form-label layui-form-label-sm">开始时间</label> | 
 |  |  |                                         <div class="layui-input-inline"> | 
 |  |  |                                             <input type="text" name="startTime" id="febs-form-group-date-start" lay-verify="date" | 
 |  |  |                                                    placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input"> | 
 |  |  |                                         </div> | 
 |  |  |                                 </div> | 
 |  |  |                                 <div class="layui-inline"> | 
 |  |  |                                         <label class="layui-form-label layui-form-label-sm">结束时间</label> | 
 |  |  |                                         <div class="layui-input-inline"> | 
 |  |  |                                             <input type="text" name="endTime" id="febs-form-group-date-end" lay-verify="date" | 
 |  |  |                                                    placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input"> | 
 |  |  |                                         </div> | 
 |  |  |                                 </div> | 
 |  |  |                             </div> | 
 |  |  |  | 
 |  |  | 
 |  |  |                         </div> | 
 |  |  |                     </form> | 
 |  |  |                     <table lay-filter="orderTable" lay-data="{id: 'orderTable'}"></table> | 
 |  |  |                     <style type="text/css"> | 
 |  |  |                         .layui-table-cell{ | 
 |  |  |                             text-align:center; | 
 |  |  |                             height: auto; | 
 |  |  |                             white-space: nowrap; /*文本不会换行,在同一行显示*/ | 
 |  |  |                             overflow: hidden; /*超出隐藏*/ | 
 |  |  |                             text-overflow: ellipsis; /*省略号显示*/ | 
 |  |  |                         } | 
 |  |  |                         .layui-table img{ | 
 |  |  |                             max-width:100px | 
 |  |  |                         } | 
 |  |  |                     </style> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  | 
 |  |  |     <a lay-event="edit" shiro:hasPermission="user:update"><i | 
 |  |  |             class="layui-icon febs-edit-area febs-blue"></i></a> | 
 |  |  | </script> | 
 |  |  | <script type="text/html" id="tableToolBar"> | 
 |  |  |     <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="exportDeliverTwo">导出未发货订单(快递)</button>--> | 
 |  |  | <!--        <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" id="importDeliver" lay-event="importDeliver">导入发货</button>--> | 
 |  |  |     </div> | 
 |  |  | </script> | 
 |  |  | <!-- 表格操作栏 end --> | 
 |  |  | <script data-th-inline="none" type="text/javascript"> | 
 |  |  |     // 引入组件并初始化 | 
 |  |  |     layui.use([ 'jquery', 'form', 'table', 'febs'], function () { | 
 |  |  |     layui.use([ 'jquery', 'form', 'table', 'febs', 'formSelects', 'upload','laydate'], function () { | 
 |  |  |         var $ = layui.jquery, | 
 |  |  |             febs = layui.febs, | 
 |  |  |             form = layui.form, | 
 |  |  |             table = layui.table, | 
 |  |  |             upload = layui.upload, | 
 |  |  |             $view = $('#febs-order'), | 
 |  |  |             $query = $view.find('#query'), | 
 |  |  |             $reset = $view.find('#reset'), | 
 |  |  |             $searchForm = $view.find('form'), | 
 |  |  |             $add = $view.find('#add'), | 
 |  |  |             sortObject = {field: 'phone', type: null}, | 
 |  |  |             formSelects = layui.formSelects, | 
 |  |  |             laydate = layui.laydate, | 
 |  |  |             tableIns; | 
 |  |  |  | 
 |  |  |         //日期范围 | 
 |  |  |         laydate.render({ | 
 |  |  |             elem: '#febs-form-group-date-start' | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         laydate.render({ | 
 |  |  |             elem: '#febs-form-group-date-end' | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         form.render(); | 
 |  |  |  | 
 |  |  |         formSelects.render(); | 
 |  |  |         //(下拉框) | 
 |  |  |         $.get(ctx + 'admin/leader/selectList', function (data) { | 
 |  |  |             for (var k in data) | 
 |  |  |             { | 
 |  |  |                 $(".order-takeUniqueCode").append("<option value='" + data[k].uniqueCode + "'>" + data[k].name + "</option>"); | 
 |  |  |             } | 
 |  |  |             layui.use('form', function () { | 
 |  |  |                 var form = layui.form; | 
 |  |  |                 form.render(); | 
 |  |  |             }); | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         // 表格初始化 | 
 |  |  |         initTable(); | 
 |  |  |  | 
 |  |  |         table.on('toolbar(orderTable)', function(obj){ | 
 |  |  |             var event = obj.event; | 
 |  |  |             var id = obj.config.id; | 
 |  |  |             var checkStatus = table.checkStatus(id); | 
 |  |  |             if(event === 'confirmOrder'){ | 
 |  |  |                 var data = checkStatus.data; | 
 |  |  |                 let ids = ""; | 
 |  |  |                 for(let i = 0;i < data.length;i++){ | 
 |  |  |                     ids = ids + data[i].id+"," | 
 |  |  |                 } | 
 |  |  |                 // layer.alert(layui.util.escape(JSON.stringify(data))); | 
 |  |  |                 console.log(ids); | 
 |  |  |                 if(ids == null || ids == ""){ | 
 |  |  |                     febs.alert.warn('请选择确认到货的订单'); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 let uniqueCodeValue = $searchForm.find("select[name='uniqueCode']").val(); | 
 |  |  |                 if(uniqueCodeValue == '' || uniqueCodeValue == null){ | 
 |  |  |                     febs.alert.warn('请选择团长'); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 febs.get(ctx + 'admin/order/confirmOrder?takeUniqueCode='+uniqueCodeValue+'&orderIds='+ids, null, function () { | 
 |  |  |                     febs.alert.success('操作成功'); | 
 |  |  |                     $query.click(); | 
 |  |  |                 }); | 
 |  |  |                 // window.location.href = ctx + "admin/order/confirmOrder?takeUniqueCode="+uniqueCodeValue+"&orderIds="+ids; | 
 |  |  |             } | 
 |  |  |             if (event == 'exportDeliverOne') { | 
 |  |  |                 let uniqueCodeValue = $searchForm.find("select[name='uniqueCode']").val(); | 
 |  |  |                 if(uniqueCodeValue == '' || uniqueCodeValue == null){ | 
 |  |  |                     febs.alert.warn('请选择团长'); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 window.location.href = ctx + "admin/order/exportOrderListOne?orderType=1&status=2&deliveryType=1&takeUniqueCode="+uniqueCodeValue; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (event == 'exportDeliverTwo') { | 
 |  |  |                 window.location.href = ctx + "admin/order/exportOrderList?orderType=1&status=2&deliveryType=2"; | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         upload.render({ | 
 |  |  |             elem: '#importDeliver' | 
 |  |  |             ,url: 'admin/order/importDeliver' //此处配置你自己的上传接口即可 | 
 |  |  |             ,accept: 'file' //普通文件 | 
 |  |  |             ,done: function(res){ | 
 |  |  |                 console.log("123"); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         // 初始化表格操作栏各个按钮功能 | 
 |  |  |         table.on('tool(orderTable)', function (obj) { | 
 |  |  | 
 |  |  |                     maxmin: true, | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |             if (layEvent === 'cancelOrder') { | 
 |  |  |                 febs.modal.confirm('取消订单', '确认取消订单?', function () { | 
 |  |  |                     cancelOrder(data.id); | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |             if (layEvent === 'seePayImage') { | 
 |  |  |                 var t = $view.find('#seePayImage'+data.id+''); | 
 |  |  |                 //页面层 | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 1, | 
 |  |  |                     title: "支付凭证", | 
 |  |  |                     skin: 'layui-layer-rim', //加上边框 | 
 |  |  |                     area: ['80%', '80%'], //宽高 | 
 |  |  |                     shadeClose: true, //开启遮罩关闭 | 
 |  |  |                     end: function (index, layero) { | 
 |  |  |                         return false; | 
 |  |  |                     }, | 
 |  |  |                     content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         function cancelOrder(id) { | 
 |  |  |             febs.get(ctx + 'admin/order/cancelOrder/' + id, null, function () { | 
 |  |  |                 febs.alert.success('操作成功'); | 
 |  |  |                 $query.click(); | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 查询按钮 | 
 |  |  |         $query.on('click', function () { | 
 |  |  | 
 |  |  |             tableIns = febs.table.init({ | 
 |  |  |                 elem: $view.find('table'), | 
 |  |  |                 id: 'orderTable', | 
 |  |  |                 url: ctx + 'admin/order/orderList', | 
 |  |  |                 url: ctx + 'admin/order/orderList?orderType=1', | 
 |  |  |                 defaultToolbar: [], | 
 |  |  |                 toolbar: '#tableToolBar', | 
 |  |  |                 cols: [[ | 
 |  |  |                         {field: 'orderNo', title: '商品名称', minWidth: 150,align:'left'}, | 
 |  |  |                         {type: 'checkbox', fixed: 'left'}, | 
 |  |  |                         {field: 'orderNo', title: '订单编号', minWidth: 200,align:'left'}, | 
 |  |  |                         {field: 'memberName', title: '购买人', minWidth: 120,align:'left'}, | 
 |  |  |                         {field: 'memberPhone', title: '联系方式', minWidth: 120,align:'left'}, | 
 |  |  |                         // {field: 'memberBindPhone', title: '联系方式', minWidth: 120,align:'left'}, | 
 |  |  |                         {field: 'amount', title: '订单金额', minWidth: 120,align:'left'}, | 
 |  |  |                         {field: 'leaderName', title: '团长', minWidth: 120,align:'left'}, | 
 |  |  |                         {field: 'orderTime', title: '下单时间', minWidth: 200,align:'left'}, | 
 |  |  |                         {field: 'isHome', title: '配送方式', | 
 |  |  |                             templet: function (d) { | 
 |  |  |                                 if (d.isHome === 2) { | 
 |  |  |                                     return '<span style="color:dodgerblue;">自提</span>' | 
 |  |  |                                 } else if (d.isHome === 1) { | 
 |  |  |                                     return '<span style="color:forestgreen;">送货上门</span>' | 
 |  |  |                                 }else{ | 
 |  |  |                                     return '' | 
 |  |  |                                 } | 
 |  |  |                             }, minWidth: 120,align:'center'}, | 
 |  |  |                         {field: 'status', title: '状态', | 
 |  |  |                             templet: function (d) { | 
 |  |  |                                 if (d.status === 1) { | 
 |  |  | 
 |  |  |                                     return '' | 
 |  |  |                                 } | 
 |  |  |                             }, minWidth: 80,align:'center'}, | 
 |  |  |                     //     {field: 'accountStatus', title: '账号状态', | 
 |  |  |                     //         templet: function (d) { | 
 |  |  |                     //             if (d.accountStatus === 1) { | 
 |  |  |                     //                 return '<span style="color:green;">正常</span>' | 
 |  |  |                     //             } else if (d.accountStatus === 2) { | 
 |  |  |                     //                 return '<span style="color:red;">禁用</span>' | 
 |  |  |                     //             }else{ | 
 |  |  |                     //                 return '' | 
 |  |  |                     //             } | 
 |  |  |                     //         }, minWidth: 80,align:'center'}, | 
 |  |  |                     //     {field: 'createdTime', title: '注册时间', minWidth: 180,align:'center'}, | 
 |  |  |                     {title: '操作', | 
 |  |  |                     {field: 'deliveryState', title: '配送状态', | 
 |  |  |                         templet: function (d) { | 
 |  |  |                              if (d.status === 2) { | 
 |  |  |                                 return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="deliverGoods" shiro:hasPermission="user:update">发货</button>' | 
 |  |  |                              }else{ | 
 |  |  |                                  return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' | 
 |  |  |                              } | 
 |  |  |                         },minWidth: 300,align:'center'} | 
 |  |  |                             if (d.deliveryState === 1) { | 
 |  |  |                                 return '<span style="color:dodgerblue;">待配送</span>' | 
 |  |  |                             } else if (d.deliveryState === 2) { | 
 |  |  |                                 return '<span style="color:forestgreen;">配送中</span>' | 
 |  |  |                             } else if (d.deliveryState === 3) { | 
 |  |  |                                 return '<span style="color:forestgreen;">已送达</span>' | 
 |  |  |                             }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'}, | 
 |  |  |                         {title: '操作', | 
 |  |  |                             templet: function (d) { | 
 |  |  |                                         return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' | 
 |  |  |                             },minWidth: 200,align:'center', fixed:'right'} | 
 |  |  |                 ]] | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 获取查询参数 | 
 |  |  |         function getQueryParams() { | 
 |  |  |             let startTimestr = $searchForm.find('input[name="startTime"]').val().trim(); | 
 |  |  |             let endTimeStr = $searchForm.find('input[name="endTime"]').val().trim(); | 
 |  |  |             if(startTimestr != '' && endTimeStr != '' && startTimestr >= endTimeStr){ | 
 |  |  |                 febs.alert.warn('开始时间需要小于结束时间'); | 
 |  |  |                 return{}; | 
 |  |  |             } | 
 |  |  |             return { | 
 |  |  |                 startTime: $searchForm.find('input[name="startTime"]').val().trim(), | 
 |  |  |                 endTime: $searchForm.find('input[name="endTime"]').val().trim(), | 
 |  |  |                 name: $searchForm.find('input[name="name"]').val().trim(), | 
 |  |  |                 orderNo: $searchForm.find('input[name="orderNo"]').val().trim(), | 
 |  |  |                 payResult: $searchForm.find("select[name='payResult']").val(), | 
 |  |  |                 status: $searchForm.find("select[name='status']").val(), | 
 |  |  |                 isHome: $searchForm.find("select[name='isHome']").val(), | 
 |  |  |                 uniqueCode: $searchForm.find("select[name='uniqueCode']").val(), | 
 |  |  |             }; | 
 |  |  |         } | 
 |  |  |  |