123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'withdraw/index',
- export_url: '/admin/withdraw/export',
- 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;
- console.log(group);
- // 初始化表格
- if ([1, 2, 12].indexOf(group)) { //管理员
- var payer = Config.payer;
- if(typeof payer == "string"){
- payer = JSON.parse(payer);
- }
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- search: true,
- showToggle:false,
- showColumns: false,
- showExport: false,
- searchFormVisible: true,
- columns: [
- [
- {checkbox: true},
- {field: 'admin_id',title:__('渠道商id'),operate:false},
- {field: 'admin_extend.admin_id', title: __('渠道商id'),visible:false, operate:"LIKE %...%"},
- {field: 'admin.nickname', title: __('渠道商'), operate:"LIKE %...%"},
- {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: 'create_by', title: __('商务负责人'),operate:false},
- {field: 'benefit', title: __('分成比例'),operate:false},
- {field: 'name', title: __('付款方名称'),operate:false},
- {field: 'admin_extend.payerid',title:__('付款方'),visible:false,searchList: payer},
- {field: 'section',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: [17],
- onMsoNumberFormat: function(cell, row, col) {
- if(row > 0){
- if(col == 9 || col == 10){
- 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,
- search: true,
- showToggle:false,
- showColumns: false,
- showExport: false,
- 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();
- $(function () {
- $('input[name="type"]').click(function(){
- if ($(this).val() == 1) {
- $('.month').hide();
- $('.withdraw-month').hide();
- $('.withdraw-all').show();
- } else {
- $('.month').show();
- $('.withdraw-month').show();
- $('.withdraw-all').hide();
- }
- });
- });
- },
- 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',
- export_url:'mywithdrawexport',
- }
- });
- // 为表格绑定事件
- 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: 'range', title: __('提现周期'), operate:false, addclass:'datetimerange', formatter: function(value,row){
- if (!row.stime) {
- row.stime = '';
- }
- return row.stime+'-'+row.etime;
- }},
- {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);
- },
- myhistorydraw: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'withdraw/myhistorydraw',
- }
- });
- // 为表格绑定事件
- var table = $("#historytable");
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- queryParams: queryParams,
- 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;
- });
- function queryParams(params) {
- var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
- admin_id: $("#admin_id").val(),
- };
- return temp;
- }
|