| | |
| | | <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 class="layui-form-item"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" placeholder="用户名" name="name" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">订单编号:</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" placeholder="订单编号" name="orderNo" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">订单状态</label> |
| | | <label class="layui-form-label">购买人:</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" placeholder="购买人" name="name" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">商品信息:</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" placeholder="商品信息" name="goodsName" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">状态:</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="status"> |
| | | <option value="">请选择</option> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">支付状态</label> |
| | | <label class="layui-form-label">开始时间:</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="payResult"> |
| | | <option value="">请选择</option> |
| | | <option value="1">成功</option> |
| | | <option value="2">未成功</option> |
| | | </select> |
| | | <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">结束时间:</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> |
| | |
| | | <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="exportDeliver">导出未发货订单</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" id="importDeliver" lay-event="importDeliver">导入发货</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverDone">导出已发货订单</button> |
| | | <!-- <button type="button" class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" onclick="print('tool(orderTable)')">layui自定义打印表格</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="getCheckData">获取选中行数据</button>--> |
| | | <!-- <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="getCheckLength">获取选中数目</button>--> |
| | | <!-- <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="isAll">验证是否全选</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', '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}, |
| | | laydate = layui.laydate, |
| | | tableIns; |
| | | |
| | | //日期范围 |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date-start' |
| | | }); |
| | | |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date-end' |
| | | }); |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initTable(); |
| | | |
| | | table.on('toolbar(orderTable)', function(obj){ |
| | | var event = obj.event; |
| | | |
| | | if (event == 'exportDeliver') { |
| | | window.location.href = ctx + "admin/order/exportOrderList?orderType=1&status=2"; |
| | | } |
| | | |
| | | if (event == 'exportDeliverDone') { |
| | | window.location.href = ctx + "admin/order/exportOrderList?orderType=1&status=3"; |
| | | } |
| | | }); |
| | | |
| | | 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 === 'takeGoods') { |
| | | febs.modal.confirm('自提商品', '确认自提商品?', function () { |
| | | takeGoods(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'delOrder') { |
| | | febs.modal.confirm('删除订单', '确认删除订单?', function () { |
| | | delOrder(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'orderMoneyFlow') { |
| | | febs.modal.open( '订单流水', 'modules/order/orderMoneyFlow/' + data.id, { |
| | | maxmin: true, |
| | | }); |
| | | } |
| | | if (layEvent === 'seePayImage') { |
| | | var t = $view.find('#seePayImage'+data.id+''); |
| | | //页面层 |
| | |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | function takeGoods(id) { |
| | | febs.get(ctx + 'admin/order/takeGoods/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | function cancelOrder(id) { |
| | | febs.get(ctx + 'admin/order/cancelOrder/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | function delOrder(id) { |
| | | febs.get(ctx + 'admin/order/delOrder/' + 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', |
| | | totalRow: true ,// 开启合计行 |
| | | cols: [[ |
| | | {field: 'orderNo', title: '订单编号', minWidth: 120,align:'left'}, |
| | | {type: 'checkbox',fixed: 'left'}, |
| | | {field: 'orderNo', title: '订单编号', minWidth: 120,align:'left', totalRowText: '合计:'}, |
| | | {field: 'memberName', title: '购买人', minWidth: 120,align:'left'}, |
| | | {field: 'memberPhone', title: '联系方式', minWidth: 120,align:'left'}, |
| | | {field: 'amount', title: '订单金额', minWidth: 120,align:'left'}, |
| | | {field: 'orderTime', title: '下单时间', minWidth: 120,align:'left'}, |
| | | {field: 'payMethod', title: '支付方式', minWidth: 120,align:'left'}, |
| | | {field: 'payTime', title: '支付时间', minWidth: 120,align:'left'}, |
| | | {field: 'payOrderNo', title: '支付订单号', minWidth: 120,align:'left'}, |
| | | {field: 'payImage', title: '支付凭证', |
| | | {field: 'memberPhone', title: '账号', minWidth: 120,align:'left'}, |
| | | {field: 'memberBindPhone', title: '联系方式', minWidth: 120,align:'left'}, |
| | | {field: 'goodsName', title: '商品信息', minWidth: 200,align:'left'}, |
| | | {field: 'remark', title: '备注', minWidth: 200,align:'left'}, |
| | | {field: 'amount', title: '订单金额', minWidth: 120,align:'left',totalRow: '{{= parseInt(d.amount) }}'}, |
| | | {field: 'deliverType', title: '配送方式', |
| | | templet: function (d) { |
| | | return '<a lay-event="seePayImage"><img id="seePayImage'+d.id+'" src="'+d.payImage+'" alt=""></a>'; |
| | | }, minWidth: 100,align:'center'}, |
| | | {field: 'status', title: '状态', |
| | | templet: function (d) { |
| | | if (d.status === 1) { |
| | | return '<span style="color:red;">待支付</span>' |
| | | } else if (d.status === 2) { |
| | | return '<span style="color:green;">待发货</span>' |
| | | }else if (d.status === 3) { |
| | | return '<span style="color:green;">待收货</span>' |
| | | }else if (d.status === 4) { |
| | | return '<span style="color:green;">已完成</span>' |
| | | }else if (d.status === 5) { |
| | | return '<span style="color:green;">退款中</span>' |
| | | }else if (d.status === 6) { |
| | | return '<span style="color:green;">已退款</span>' |
| | | }else if (d.status === 7) { |
| | | return '<span style="color:green;">已取消</span>' |
| | | if (d.deliverType === 1) { |
| | | return '<span style="color:green;">快递寄送</span>' |
| | | } else if (d.deliverType === 2) { |
| | | return '<span style="color:blue;">到店自提</span>' |
| | | }else{ |
| | | return '' |
| | | return '<span style="color:green;">快递寄送</span>' |
| | | } |
| | | }, minWidth: 80,align:'center'}, |
| | | {title: '操作', |
| | | }, minWidth: 120,align:'center'}, |
| | | {field: 'status', 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>' |
| | | +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" 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.status === 1) { |
| | | return '<span style="color:red;">待支付</span>' |
| | | } else if (d.status === 2) { |
| | | return '<span style="color:green;">待发货</span>' |
| | | }else if (d.status === 3) { |
| | | return '<span style="color:green;">待收货</span>' |
| | | }else if (d.status === 4) { |
| | | return '<span style="color:green;">已完成</span>' |
| | | }else if (d.status === 5) { |
| | | return '<span style="color:green;">退款中</span>' |
| | | }else if (d.status === 6) { |
| | | return '<span style="color:green;">已退款</span>' |
| | | }else if (d.status === 7) { |
| | | return '<span style="color:green;">已取消</span>' |
| | | }else{ |
| | | return '' |
| | | } |
| | | }, minWidth: 80,align:'center'}, |
| | | {field: 'carriage', title: '运费', minWidth: 120,align:'left'}, |
| | | {field: 'orderTime', title: '下单时间', minWidth: 200,align:'left'}, |
| | | {field: 'payMethod', title: '支付方式', minWidth: 120,align:'left'}, |
| | | {field: 'payTime', title: '支付时间', minWidth: 200,align:'left'}, |
| | | {field: 'payOrderNo', title: '支付订单号', minWidth: 200,align:'left'}, |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | if (d.status === 2) { |
| | | if(d.deliverType ===2){ |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-success" lay-event="takeGoods" shiro:hasPermission="user:update">自提</button>' |
| | | +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' |
| | | +'<button class="layui-btn layui-btn-normal layui-btn-xs" shiro:hasPermission="user:update" lay-event="orderMoneyFlow">资金流水</button>' |
| | | }else{ |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-success" lay-event="deliverGoods" shiro:hasPermission="user:update">发货</button>' |
| | | +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' |
| | | +'<button class="layui-btn layui-btn-normal layui-btn-xs" shiro:hasPermission="user:update" lay-event="orderMoneyFlow">资金流水</button>' |
| | | } |
| | | }else if(d.status === 7){ |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' |
| | | +'<button class="layui-btn layui-btn-xs layui-btn-normal layui-btn-danger" lay-event="delOrder" 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>' |
| | | +'<button class="layui-btn layui-btn-normal layui-btn-xs" shiro:hasPermission="user:update" lay-event="orderMoneyFlow">资金流水</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(), |
| | | goodsName: $searchForm.find('input[name="goodsName"]').val().trim(), |
| | | status: $searchForm.find("select[name='status']").val(), |
| | | }; |
| | | } |
| | | |
| | | /* |
| | | * 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:16px;}", ".main{width:100%;height:100%}", |
| | | ".main div{width:100%;display:inline-block;}", "</style>", "</head>" |
| | | ].join(""); |
| | | var contentHtml = ""; |
| | | for (let i = 0; i < allData.length; i++) { |
| | | let statusStr = ''; |
| | | let data = allData[i] |
| | | if (data.status === 1) { |
| | | statusStr = "待支付"; |
| | | } else if (data.status === 2) { |
| | | statusStr = "待发货"; |
| | | }else if (data.status === 3) { |
| | | statusStr = "待收货"; |
| | | }else if (data.status === 4) { |
| | | statusStr = "已完成"; |
| | | }else if (data.status === 5) { |
| | | statusStr = "退款中"; |
| | | return '<span style="color:green;">退款中</span>' |
| | | }else if (data.status === 6) { |
| | | statusStr = "已退款"; |
| | | return '<span style="color:green;">已退款</span>' |
| | | }else if (data.status === 7) { |
| | | statusStr = "已取消"; |
| | | }else{ |
| | | statusStr = ""; |
| | | } |
| | | |
| | | let payTimeStr = ''; |
| | | if(data.payTime == '' || data.payTime == null){ |
| | | payTimeStr = ""; |
| | | }else{ |
| | | payTimeStr = data.payTime; |
| | | } |
| | | |
| | | let payMethodStr = ''; |
| | | if(data.payMethod == '' || data.payMethod == null){ |
| | | payMethodStr = ""; |
| | | }else{ |
| | | payMethodStr = data.payMethod; |
| | | } |
| | | var template = |
| | | "<div class='main'>" + |
| | | "<div style='text-align: center;font-size: 22px;font-weight: bold;margin-bottom: 30px'>订单详情</div>" + |
| | | "<div>编号:" + data.orderNo + "</div><br><br>" + |
| | | "<div>商品:" + data.goodsName + "</div><br><br>" + |
| | | "<div>金额:" + data.amount + "</div><br><br>" + |
| | | "<div>账号:" + data.memberPhone + "</div><br><br>" + |
| | | "<div>购买人:" + data.memberName + "</div><br><br>" + |
| | | "<div>联系方式:" + data.memberBindPhone + "</div><br><br>" + |
| | | "<div>地址:" + data.address + "</div><br><br>" + |
| | | "<div>状态:" + statusStr + "</div><br><br>" + |
| | | "<div>下单时间:" + payTimeStr + "</div><br><br>" + |
| | | "<div>支付方式:" + payMethodStr + "</div><br><br>" + |
| | | "<div>备注:" + data.remark + "</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> |