| <div class="layui-fluid layui-anim febs-anim" id="febs-charge-list" lay-title="购买VIP"> | 
|     <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-row"> | 
|                             <div class="layui-col-md10"> | 
|                                 <div class="layui-form-item"> | 
|                                     <div class="layui-inline"> | 
|                                         <label class="layui-form-label layui-form-label-sm">账号</label> | 
|                                         <div class="layui-input-inline"> | 
|                                             <input type="text" name="account"  placeholder="手机号/账号" 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="orderNo"  placeholder="编号" 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="2">进行中</option> | 
|                                                 <option value="1">成功</option> | 
|                                                 <option value="0">失败</option> | 
|                                             </select> | 
|                                         </div> | 
|                                     </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> | 
|                     </form> | 
|                     <table lay-filter="lhChargeTable" lay-data="{id: 'lhChargeTable'}"></table> | 
|                 </div> | 
|             </div> | 
|         </div> | 
|     </div> | 
| </div> | 
| <script type="text/html" id="statesType"> | 
|     {{# | 
|     var state = { | 
|     2: {title: '进行中', color: 'green'}, | 
|     1: {title: '成功', color: 'blue'}, | 
|     0: {title: '失败', color: 'red'} | 
|     }[d.state]; | 
|     }} | 
|     <span class="layui-badge febs-bg-{{state.color}}">{{ state.title }}</span> | 
| </script> | 
|   | 
| <script type="text/html" id="commissionOption"> | 
|     {{#  if(d.state == 2){ }} | 
|         <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="charge:update" lay-event="chargeAgreeEvent">确认</button> | 
|         <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="charge:update" lay-event="chargeDisAgreeEvent">取消</button> | 
|     {{#  } }} | 
| </script> | 
| <script data-th-inline="none" type="text/javascript"> | 
|     layui.use([ 'jquery', 'form', 'table', 'febs'], function () { | 
|         var $ = layui.jquery, | 
|             febs = layui.febs, | 
|             form = layui.form, | 
|             table = layui.table, | 
|             $view = $('#febs-charge-list'), | 
|             $query = $view.find('#query'), | 
|             $reset = $view.find('#reset'), | 
|             $searchForm = $view.find('form'), | 
|             sortObject = {field: null, type: null}, | 
|             tableIns; | 
|   | 
|         form.render(); | 
|         initlhChargeTable(); | 
|   | 
|         // 查询按钮 | 
|         $query.on('click', function () { | 
|             var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); | 
|             tableIns.reload({where: params, page: {curr: 1}}); | 
|         }); | 
|         // 刷新按钮 | 
|         $reset.on('click', function () { | 
|             $searchForm[0].reset(); | 
|             sortObject.type = 'null'; | 
|             tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); | 
|         }); | 
|         // 获取查询参数 | 
|         function getQueryParams() { | 
|             return { | 
|                 orderNo: $searchForm.find('input[name="orderNo"]').val(), | 
|                 account: $searchForm.find('input[name="account"]').val(), | 
|                 state: $searchForm.find("select[name='state']").val(), | 
|             }; | 
|         } | 
|         // 初始化表格操作栏各个按钮功能 | 
|         table.on('tool(lhChargeTable)', function (obj) { | 
|             var data = obj.data, | 
|                 layEvent = obj.event; | 
|             if (layEvent === 'chargeAgreeEvent') { | 
|                 febs.modal.confirm('确认', '确认支付?', function () { | 
|                     chargeAgreeEvent(1,data.id); | 
|                 }); | 
|             } | 
|             if (layEvent === 'chargeDisAgreeEvent') { | 
|                 febs.modal.confirm('取消', '取消支付?', function () { | 
|                     chargeAgreeEvent(0,data.id); | 
|                 }); | 
|             } | 
|         }); | 
|         function chargeAgreeEvent(state,id) { | 
|             febs.get(ctx + 'admin/runVip/chargeAgree/'+ state +'/'+ id, null, function (e) { | 
|                 febs.alert.success(e.message); | 
|                 $query.click(); | 
|             }); | 
|         } | 
|   | 
|         function initlhChargeTable() { | 
|             tableIns = febs.table.init({ | 
|                 elem: $view.find('table'), | 
|                 id: 'lhChargeTable', | 
|                 url: ctx + 'admin/runVip/buyList', | 
|                 toolbar:"#lhChargeTable", | 
|                 totalRow: true ,// 开启合计行 | 
|                 cols: [[ | 
|                     {type: 'numbers', title: '序号', width: 80}, | 
|                     {field: 'orderNo', title: '编号', minWidth: 100,align:'center', totalRowText: '合计'}, | 
|                     {field: 'account', title: '账号', minWidth: 150,align:'center'}, | 
|                     {field: 'vipName', title: '会员名称', minWidth: 100,align:'center'}, | 
|                     {field: 'amount', title: '金额', minWidth: 100,align:'center',totalRow: '{{= parseInt(d.amount) }}'}, | 
|                     {field: 'type', title: '链', minWidth: 100,align:'center'}, | 
|                     {field: 'address', title: '地址', minWidth: 100,align:'center'}, | 
|                     {title: '状态', templet: '#statesType', minWidth: 100,align:'center'}, | 
|                     {field: 'failTime', title: '失效时间', minWidth: 180,align:'center'}, | 
|                     {field: 'vipCnt', title: '数量', minWidth: 100,align:'center'}, | 
|                     {field: 'createdTime', title: '创建时间', minWidth: 180,align:'center'}, | 
|                     {title: '操作', toolbar: '#commissionOption', minWidth: 200} | 
|                 ]], | 
|                 done: function(res, curr, count) { | 
|                     // 遍历每一行数据 | 
|                     res.data.forEach(function(item, index) { | 
|                         // 根据状态值控制按钮显示 | 
|                         if (item.state === 2) { | 
|                             // 如果状态为1,显示 | 
|                             $('#commissionOption' + index).show(); | 
|                         } else { | 
|                             // 否则,隐藏 | 
|                             $('#commissionOption' + index).hide(); | 
|                         } | 
|                     }); | 
|                 } | 
|             }); | 
|         } | 
|   | 
|         table.on('toolbar(lhChargeTable)', function(obj){ | 
|             var data = obj.data, | 
|                 layEvent = obj.event; | 
|         }); | 
|     }) | 
| </script> |