| <div class="layui-fluid layui-anim febs-anim" id="febs-invoice" lay-title="发票管理"> | 
|     <div class="layui-row febs-container"> | 
|         <div class="layui-col-md12"> | 
|             <div class="layui-card"> | 
|                 <div class="layui-card-body febs-table-full"> | 
|                     <form class="layui-form layui-table-form" lay-filter="user-table-form"> | 
|                         <div class="layui-form-item"> | 
|                             <div class="layui-col-md10"> | 
|                                 <div class="layui-inline"> | 
|                                     <label class="layui-form-label">编号:</label> | 
|                                     <div class="layui-input-inline"> | 
|                                         <input type="text" placeholder="发票申请单号/微信支付订单号" name="payOrderNo" 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> | 
|                                     <div class="layui-input-inline"> | 
|                                         <select name="state"> | 
|                                             <option value="">请选择</option> | 
|                                             <option value="0">待申请</option> | 
|                                             <option value="1">待开票</option> | 
|                                             <option value="2">已开票</option> | 
|                                         </select> | 
|                                     </div> | 
|                                 </div> | 
|                             </div> | 
|   | 
|                             <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> | 
|                                 <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> | 
|                                     <i class="layui-icon"></i> | 
|                                 </div> | 
|                                 <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> | 
|                                     <i class="layui-icon"></i> | 
|                                 </div> | 
|                             </div> | 
|                             <div class="layui-col-md10"> | 
|                                 <label class="layui-form-label layui-form-label-sm">注意:</label> | 
|                                 <div class="layui-inline"> | 
|                                     <div class="layui-form-mid layui-word-aux"> | 
|                                         <span style="color:red;">订单状态【已完成】,才能开具发票。</span> | 
|                                     </div> | 
|                                     <div class="layui-form-mid layui-word-aux"> | 
|                                         <span style="color:red;">开具发票之前,请先点击【更新抬头】按钮,确保用户提供了抬头信息。</span> | 
|                                     </div> | 
|                                 </div> | 
|                             </div> | 
|                         </div> | 
|                     </form> | 
|                     <table lay-filter="invoiceTable" lay-data="{id: 'invoiceTable'}"></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 | 
|                         } | 
|   | 
|                         ::-webkit-scrollbar { | 
|                             height: 20px !important; | 
|                             background-color: #f4f4f4; | 
|                         } | 
|                     </style> | 
|                 </div> | 
|             </div> | 
|         </div> | 
|     </div> | 
| </div> | 
| <!-- 表格操作栏 start --> | 
| <script type="text/html" id="user-option"> | 
|     <span shiro:lacksPermission="user:view,user:update,user:delete"> | 
|         <span class="layui-badge-dot febs-bg-orange"></span> 无权限 | 
|     </span> | 
|     <a lay-event="edit" shiro:hasPermission="user:update"><i | 
|             class="layui-icon febs-edit-area febs-blue"></i></a> | 
| </script> | 
| <!-- 表格操作栏 end --> | 
| <script data-th-inline="none" type="text/javascript"> | 
|     // 引入组件并初始化 | 
|     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-invoice'), | 
|             $query = $view.find('#query'), | 
|             $reset = $view.find('#reset'), | 
|             $searchForm = $view.find('form'), | 
|             $add = $view.find('#add'), | 
|             sortObject = {field: 'orderTime', type: 'desc'}, | 
|             formSelects = layui.formSelects, | 
|             laydate = layui.laydate, | 
|             tableIns; | 
|   | 
|         let currPageOrder = 1;//首先默认值为1,防止出错 | 
|         //获取当前页 | 
|         currPageOrder = $view.find(".layui-laypage-em").next().html(); | 
|   | 
|         form.render(); | 
|   | 
|         formSelects.render(); | 
|   | 
|         // 表格初始化 | 
|         initInvoiceTable(); | 
|   | 
|         // 初始化表格操作栏各个按钮功能 | 
|         table.on('tool(invoiceTable)', function (obj) { | 
|             var data = obj.data, | 
|                 layEvent = obj.event; | 
|             if (layEvent === 'seeInvoiceDetail') { | 
|                 febs.modal.open('开票信息', 'modules/order/invoiceDetail/'+ data.id, { | 
|                     area:['100%','100%'], | 
|                 }); | 
|             } | 
|             if (layEvent === 'updateInvoiceDetail') { | 
|                 febs.modal.confirm('更新', '是否更新用户的抬头信息?', function () { | 
|                     updateInvoiceDetail(data.id); | 
|                 }); | 
|             } | 
|             if (layEvent === 'updateOrderDetail') { | 
|                 febs.modal.confirm('更新', '是否更新订单状态信息?', function () { | 
|                     updateOrderDetail(data.id); | 
|                 }); | 
|             } | 
|         }); | 
|   | 
|         function updateOrderDetail(id) { | 
|             febs.get(ctx + 'admin/order/updateOrderDetail/' + id, null, function () { | 
|                 febs.alert.success('操作成功'); | 
|                 $query.click(); | 
|             }); | 
|         } | 
|   | 
|         function updateInvoiceDetail(id) { | 
|             febs.get(ctx + 'admin/order/updateInvoiceDetail/' + id, null, function () { | 
|                 febs.alert.success('操作成功'); | 
|                 $query.click(); | 
|             }); | 
|         } | 
|   | 
|         // 查询按钮 | 
|         $query.on('click', function () { | 
|             var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); | 
|             tableIns.reload({where: params, page: {curr: currPageOrder}}); | 
|         }); | 
|   | 
|         // 刷新按钮 | 
|         $reset.on('click', function () { | 
|             $searchForm[0].reset(); | 
|             sortObject.type = 'null'; | 
|             tableIns.reload({where: getQueryParams(), page: {curr: currPageOrder}, initSort: sortObject}); | 
|         }); | 
|   | 
|         function initInvoiceTable() { | 
|             tableIns = febs.table.init({ | 
|                 elem: $view.find('table'), | 
|                 id: 'invoiceTable', | 
|                 url: ctx + 'admin/order/invoiceList', | 
|                 defaultToolbar: [], | 
|                 //系统自带打印导出 | 
|                 totalRow : true, | 
|                 cols: [[ | 
|                         {field: 'orderNo', title: '订单编号', minWidth: 100,align:'left' ,totalRowText:"合计"}, | 
|                         {field: 'fapiaoApplyId', title: '发票申请单号', minWidth: 150,align:'left'}, | 
|                         {field: 'type', title: '购买方类型', | 
|                             templet: function (d) { | 
|                                 if (d.type === 'INDIVIDUAL') { | 
|                                     return '<span style="color:red;">个人</span>' | 
|                                 } else if (d.type === 'ORGANIZATION') { | 
|                                     return '<span style="color:green;">单位</span>' | 
|                                 }else{ | 
|                                     return '' | 
|                                 } | 
|                             }, minWidth: 80,align:'center'}, | 
|                         {field: 'name', title: '名称', minWidth: 120,align:'left'}, | 
|                         {field: 'taxpayerId', title: '纳税人识别号', minWidth: 100,align:'left'}, | 
|                         {field: 'address', title: '地址', minWidth: 200,align:'left'}, | 
|                         {field: 'telephone', title: '电话', minWidth: 100,align:'left'}, | 
|                         {field: 'bankName', title: '开户银行', minWidth: 100,align:'left', totalRow:true}, | 
|                         {field: 'bankAccount', title: '银行账号', minWidth: 100,align:'left', totalRow:true}, | 
|                         {field: 'state', title: '状态', | 
|                             templet: function (d) { | 
|                                 if (d.state === 0) { | 
|                                     return '<span style="color:red;">待申请</span>' | 
|                                 } else if (d.state === 1) { | 
|                                     return '<span style="color:green;">待开票</span>' | 
|                                 }else if (d.state === 2) { | 
|                                     return '<span style="color:green;">已开票</span>' | 
|                                 }else{ | 
|                                     return '' | 
|                                 } | 
|                             }, 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>' | 
|                             }else{ | 
|                                 return '' | 
|                             } | 
|                         }, minWidth: 100,align:'center'}, | 
|                         {title: '操作', | 
|                             templet: function (d) { | 
|                                 if(d.status === 4){ | 
|                                     return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeInvoiceDetail" shiro:hasPermission="user:update">开票信息</button>' + | 
|                                        '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="updateOrderDetail" shiro:hasPermission="user:update">更新订单状态</button>'+ | 
|                                         '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="updateInvoiceDetail" shiro:hasPermission="user:update">更新抬头</button>' | 
|                                 }else{ | 
|                                     return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="updateOrderDetail" shiro:hasPermission="user:update">更新订单状态</button>' | 
|                                 } | 
|                             },minWidth: 300,align:'center', fixed:'right'} | 
|                 ]] | 
|             }); | 
|         } | 
|   | 
|         // 获取查询参数 | 
|         function getQueryParams() { | 
|             return { | 
|                 orderNo: $searchForm.find('input[name="orderNo"]').val().trim(), | 
|                 payOrderNo: $searchForm.find('input[name="payOrderNo"]').val().trim(), | 
|                 state: $searchForm.find("select[name='state']").val(), | 
|             }; | 
|         } | 
|     }) | 
| </script> |