123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'withdraw/index',
- add_url: 'withdraw/add',
- edit_url: 'withdraw/edit',
- multi_url: 'withdraw/multi',
- table: 'withdraw',
- }
- });
- //book_but
- $(document).on('click','.book_but',function () {
- Fast.api.open($(this).attr('href'), '数据列表', {});
- return false;
- });
- var table = $("#table");
- var group = Config.group;
- // $('#state1').text(Config.state1);
- // $('#state2').text(Config.state2);
- // $('#state3').text(Config.state3);
- // 初始化表格
- if(group < 3){ //管理员
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- search: true,
- showToggle:false,
- showColumns: false,
- showExport: true,
- searchFormVisible: true,
- columns: [
- [
- {checkbox: true},
- {field: 'admin.nickname', title: __('渠道商')},
- {field: 'withdraw.createtime', title: __('提现时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'finishtime', title: __('划账日期'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'money', title: __('Money'), operate:'BETWEEN'},
- {field: 'dkfs', title: __('打款方式'),operate:false,formatter: Controller.api.formatter.dkfs},
- {field: 'card_holder', title: __('开户人'),operate:false},
- {field: 'card_bank', title: __('银行'),operate:false},
- {field: 'card_num', title: __('卡号'),operate:false},
- {field: 'idcard_no', title: __('身份证号'),operate:false},
- {field: 'state', title: __('State'), visible:false, searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}},
- {field: 'state_text', title: __('State'), operate:false,formatter: Controller.api.formatter.states_span},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ],
- exportOptions: {
- type: 'excel',
- ignoreColumn: [10],
- onMsoNumberFormat: function(cell, row, col) {
- if(row > 0){
- if(col == 7 || col == 8){
- return '\\@';
- }else{
- return '';
- }
- }
- }},
- onLoadSuccess: function (data) {
- $('#state1').text(data.others.state1);
- $('#state2').text(data.others.state2);
- $('#state3').text(data.others.state3);
- }
- });
- }
- if(group == 3){ //渠道商
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- search: true,
- showToggle:false,
- showColumns: false,
- showExport: true,
- searchFormVisible: true,
- columns: [
- [
- {checkbox: true},
- {field: 'admin.nickname', title: '代理商'},
- {field: 'withdraw.createtime', title: '提现时间', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'finishtime', title: '划账日期', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'money', title: __('Money'), operate:'BETWEEN',operate:false},
- {field: 'dkfs', title: '打款方式',operate:false,formatter: Controller.api.formatter.dkfs,operate:false},
- {field: 'card_holder', title: __('开户人'),operate:false},
- {field: 'card_bank', title: __('银行'),operate:false},
- {field: 'card_num', title: __('卡号'),operate:false},
- {field: 'idcard_no', title: __('身份证号'),operate:false},
- {field: 'state', title: __('State'), visible:false, searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}},
- {field: 'state_text', title: __('State'), operate:false,formatter: Controller.api.formatter.states_span},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ],
- exportOptions: {
- type: 'excel',
- ignoreColumn: [10],
- onMsoNumberFormat: function(cell, row, col) {
- if(row > 0){
- if(col == 7 || col == 8){
- return '\\@';
- }else{
- return '';
- }
- }
- }},
- onLoadSuccess: function (data) {
- $('#state1').text(data.others.state1);
- $('#state2').text(data.others.state2);
- $('#state3').text(data.others.state3);
- }
- });
- }
- if(group == 4){ //代理商
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'withdraw.createtime', title: __('提现时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {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);
- // console.log('test');
- // console.log(Config);
- // 弹窗绑定
- // $(document).on('click','.btn-success',function () {
- // $('#state1').text(Config.state1);
- // $('#state2').text(Config.state2);
- // $('#state3').text(Config.state3);
- //return false;
- // })
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- mywithdraw:function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'withdraw/mywithdraw',
- add_url: 'withdraw/add',
- multi_url: 'withdraw/multi',
- table: 'withdraw',
- }
- });
- // 为表格绑定事件
- var table = $("#table");
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'createtime', title: __('提现时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {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);
- },
- 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 <10 ){
- // money = 0;
- // service_recharge = 0;
- // }
- // if(money < 500 && money >=10 ){
- // money = money-5;
- // service_recharge = 5;
- // }
- // if(money <= 5000 && money >=500 ){
- // service_recharge = money*0.01;
- // money = money-money*0.01;
- // }
- // if(money > 5000 ){
- // money = money-50;
- // service_recharge = 50;
- // }
- if(money+service_recharge >Config.no_cash_money){
- money = '超出可提现金额';
- service_recharge = 0;
- }
- $('.money').val(money);
- // $('.ServiceCharge').val(service_recharge);
- });
- },
- 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>';
- }
- }
- }
- }
- };
- return Controller;
- });
|