123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- 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 = '<div class="tpl_tit">频繁提现</div>';
- data.data.limitinfos.forEach(function (item, index, arr) {
- strHtml += '<div class="tpl_li">\n' +
- '<strong>' + item.name + '</strong>\n' +
- '<em>' + item.username + '</em>\n' +
- '</div>'
- });
- $('.tp_list_box').html(strHtml);
- }
- if (data.data.lowids && data.data.lowids.length > 0) {
- var strHtml = '<div class="tpl_tit">余额满10元才能申请提现</div>';
- data.data.lowids.forEach(function (item, index, arr) {
- strHtml += '<div class="tpl_li">\n' +
- '<strong>' + item.name + '</strong>\n' +
- '<em>' + item.username + '</em>\n' +
- '</div>'
- });
- $('.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 '<span class="ord_red">提现中</span>';
- }else if(value == '打款中'){
- return '<span class="ord_yellow">打款中</span>';
- }else if(value == '已打款'){
- return '<span class="ord_green">已打款</span>';
- }
- },
- withdrawbuttons: function (value, row, index) {
- ahtml = '<a href="/admin/vipwithdraw/add/ids/' + row.id + '" class="btn btn-xs btn-danger btn-dialog " title="申请提现" data-table-id="table" data-field-index="8" data-row-index="0" data-button-index="0"><i class=""></i> 申请提现</a>';
- ahtml += '<a href="/admin/withdraw/myhistorydraw/admin_id/' + row.admin_id + '" class="btn btn-xs btn-danger btn-dialog " title="提现记录" data-table-id="table" data-field-index="8" data-row-index="0" data-button-index="1"><i class=""></i> 提现记录</a>';
- return ahtml;
- },
- }
- }
- };
- return Controller;
- });
|