define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'vipwithdraw/index', add_url: 'vipwithdraw/add', edit_url: 'vipwithdraw/edit', multi_url: 'vipwithdraw/multi/ids', table: 'withdraw', export_url:'historyExport', } }); //book_but $(document).on('click','.book_but',function () { Fast.api.open($(this).attr('href'), '数据列表', {}); return false; }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', showToggle: false, showColumns: false, search: false, commonSearch: false, columns: [ [ {checkbox: true}, {field: 'name', title: '公众号', oprate: false}, {field: 'username', title: __('用户名')}, {field: 'recharge_money', title: __('总充值金额(不含当日)')}, {field: 'split_money', title: __('总分账金额(不含当日)')}, {field: 'recharge_money_benefit', title: __('结算总金额(不含当日)')}, {field: 'no_cash_money', title: __('未提现')}, {field: 'cash_money', title: __('提现中'),}, {field: 'count_cash_money', title: __('已打款')}, /*{ field: 'admin_id', title: __('Operate'), table: table, buttons: [ { name: 'add_cash', text: '申请提现', title: '申请提现', icon: '', classname: 'btn btn-xs btn-danger btn-dialog', url: '/admin/vipwithdraw/add', callback: function (data) { } }, ], oprate: false, formatter: Table.api.formatter.buttons },*/ { field: 'admin_id', title: __('Operate'), buttons: [ ], formatter: Controller.api.formatter.withdrawbuttons }, ] ] }); // 为表格绑定事件 Table.api.bindevent(table); // $(document).on("click", "input", function () { // var ids = Table.api.selectedids(table); // }); $(document).on("click", "#toolbar .layer-open", function () { var ids = Table.api.selectedids(table); ids = ids.join(","); var href = "vipwithdraw/multi/ids/" + ids; Fast.api.open(href, '批量提现', {}); }); }, historymoney: function () { console.log('historymoney'); // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'vipwithdraw/historymoney', export_url:'historyExport', } }); // 为表格绑定事件 var table = $("#historytable"); table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', search: false, columns: [ [ { field: 'service_name', title: __('公众号名称'), operate: false, }, { field: 'username', title: __('用户名'), }, { field: 'nickname', title: __('昵称'), }, { field: 'withdraw.createtime', title: __('提现时间'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime, visible:false }, { field: 'createtime', title: __('提现时间'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime, operate:false }, { field: 'finishtime', title: __('划账日期'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime }, {field: 'money', title: __('Money'), operate: 'BETWEEN'}, { field: 'state', title: __('State'), operate: false, formatter: Controller.api.formatter.states }, ] ] }); Table.api.bindevent(table); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, multi: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); $('#c-money').keyup(function () { var money = parseInt($('#c-money').val()); if(isNaN(money)){ money = 0; } var service_recharge =0; if(money+service_recharge >Config.no_cash_money){ money = '超出可提现金额'; service_recharge = 0; } $('.money').val(money); // $('.ServiceCharge').val(service_recharge); }); $(document).on("click", ".multisubmit", function () { var ids = $(".multiids").val(); console.log(ids); var url = "vipwithdraw/multi/ids/" + ids; $.ajax({ url: url, data: {ids: ids}, type: 'POST', success: function (data) { if(data.code == 1){ // Toastr.success("操作成功"); // setTimeout(function() { // window.location.reload(); parent.location.reload(); // },2000); }else if (data.code == -1) { $('#total_popup_box').show(); if (data.data.limitinfos && data.data.limitinfos.length > 0) { var strHtml = '
频繁提现
'; data.data.limitinfos.forEach(function (item, index, arr) { strHtml += '
\n' + '' + item.name + '\n' + '' + item.username + '\n' + '
' }); $('.tp_list_box').html(strHtml); } if (data.data.lowids && data.data.lowids.length > 0) { var strHtml = '
余额满10元才能申请提现
'; data.data.lowids.forEach(function (item, index, arr) { strHtml += '
\n' + '' + item.name + '\n' + '' + item.username + '\n' + '
' }); $('.tp_list_box').html(strHtml); } // document.getElementById('total_popup_box').style.display = 'block'; } }, error: function (XMLHttpRequest, textStatus, errorThrown) { consoleMain('异常错误,请刷新页面重试'); cpslog([703, { map: { xdtype: goodsCategory, result: 4, book_id: sbookid, adid: goodsId, chapter_id: schapterid, money: smoney, XMLHttpRequest: XMLHttpRequest.status, textStatus: textStatus, errorThrown: errorThrown } }, 'xdjg']); paystop = true; } }); }); }, formatter:{ dkfs:function(value,row,index){ if(value ==1){ return '银行卡对公'; }else if(value == 2){ return '银行卡对私'; }else if(value == 3){ return '微信'; }else{ return '支付宝'; } }, states:function(value,row,index){ if(value ==1){ return '提现中'; }else if(value == 2){ return '打款中'; }else if(value == 3){ return '已打款'; } }, states_span:function(value,row,index){ if(value =='提现中'){ return '提现中'; }else if(value == '打款中'){ return '打款中'; }else if(value == '已打款'){ return '已打款'; } }, withdrawbuttons: function (value, row, index) { ahtml = ' 申请提现'; ahtml += ' 提现记录'; return ahtml; }, } } }; return Controller; });