define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { // $(".submit button").click(function(){ // // if(!varify()){ // // alert("请补全信息再提交哦"); // // return false; // // }; // var add_url = 'reward/inviterecord/agentapply'; // var data = $("#add-form").serialize(); // $.ajax({ // url:add_url, // type:"post", // data:data, // success:function(res){ // if(res.status==1){ // window.location = "invsuccess?invid="+res.data.invite_id+"&username="+res.data.username; // } // } // }) // }) // function checkUser(){ // var userName = document.getElementById(user_inp).value; // // if (userName.length<=0 || userName==请输入邮箱帐号/手机号){ // showTips(用户名不能为空!); // return false; // } // // if (sNumReg.test(userName)){ // if(userName.length!=11){ // showTips(手机号格式不正确!); // return false; // } // showTips(); // return true; // } // // if(!sEmailReg.test(userName)){ // showTips(邮箱输入有误,请重新输入!); // return false; // } // showTips(); // return true; // } $("#c-pay_type").change(function(){ if($(this).val()==3){ $('
\ \
\ \
\
').insertAfter($('#c-card_num').parents('.form-group')); }else{ $(".c-card_bank").remove(); } }); // function varify(){ // // var sEmailReg =/^[w-]+(.[w-]+)*@[w-]+(.[w-]+)+$/; // var sNumReg = /^d+$/ // // var user = $("#username").val(); // if(!$.trim(user) || user.length<3 || user.length>12){ // return false; // } // // var nick = $("#nickname").val(); // if(!$.trim(nick)){ // return false; // } // // var name = $("#c-card_holder").val(); // if(!$.trim(name)){ // return false; // } // // var number = $("") // // var account = $("#c-card_num").val(); // if(!$.trim(account)){ // return false; // } // // if($("#c-pay_type").val==3){ // var bank = $("#c-card_bank").val(); // if(!$.trim(bank)){ // return false; // } // } // return true; // } // // $(".agentapply").data("validator-options", { // ignore: ':hidden', // beforeSubmit: function (form) { // if($('#c-pay_type').val() == '3'){ // var sBankVal = $.trim($('#c-card_bank').val()); // if(sBankVal==''){ // $('此处不能为空').insertAfter($('#c-card_bank')); // return false; // } // } // } // }); // Form.api.bindevent($(".agentapply")); var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'reward/inviterecord/index', add_url: 'reward/inviterecord/add', edit_url: 'reward/inviterecord/edit', del_url: 'reward/inviterecord/del', multi_url: 'reward/inviterecord/multi', table: 'invite_record', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', searchFormVisible: true, search:false, columns: [ [ {checkbox: true}, {field: 'id', title: __('ID'),operate:false}, {field: 'a.username', title: __('Username'),formatter:function(value,row){return row.username;}}, {field: 'nickname', title: __('Nickname'),operate:false,formatter:function(value,row,index){ if(row.status!=0) return row.realnickname; return value; }}, {field: 'realnickname', title: __('RealNickname'),operate:false,visible:false}, {field: 'dayreward', title: __('今日赏金'),operate:false}, {field: 'totalreward', title: __('累计赏金'),operate:false}, {field: 'email', title: __('Email'),operate:false,visible:false}, {field: 'phone', title: __('Phone'),operate:false,visible:false}, {field: 'pay_type', title: __('Pay_type'), visible:false, searchList: {"pay_type 1":__('Pay_type 1'),"pay_type 2":__('Pay_type 2'),"pay_type 3":__('Pay_type 3')},operate:false}, {field: 'pay_type_text', title: __('Pay_type'), operate:false}, {field: 'name', title: __('Name'),operate:false,visible:false}, {field: 'account', title: __('Account'),operate:false,visible:false}, {field: 'invite_id', title: __('Invite_id'),operate:false,visible:false}, {field: 'a.status', title: __('Status'), visible:false, searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}}, {field: 'status_text', title: __('Status'), operate:false}, {field: 'invite_time', title: __('Invite_time'), addclass:'datetimerange', formatter: Table.api.formatter.datetime, operate:false}, {field: 'createtime', title: __('Createtime'), addclass:'datetimerange', formatter: Table.api.formatter.datetime, operate:false,visible:false}, {field: 'updatetime', title: __('Updatetime'), addclass:'datetimerange', formatter: Table.api.formatter.datetime, operate:false,visible:false}, {field: 'oprate', title: __('数据'), table: table, operate:false,formatter:function(value,row,index){ if(row.status==0) return; return "赏金统计"; } }, ] ], onLoadSuccess: function (data) { $("#todayreward").text("¥"+data.countdata.todayreward); $("#totalreward").text("¥"+data.countdata.totalreward); } }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });