123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- 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){
- $('<div class="form-group c-card_bank">\
- <label for="c-card_bank" class="control-label col-xs-12 col-sm-2">* 收款开户银行:</label>\
- <div class="col-xs-12 col-sm-8">\
- <input id="c-card_bank" data-rule="required" class="form-control" name="row[bankname]" type="text" >\
- </div>\
- </div>').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==''){
- // $('<span class="msg-box n-right" for=" c-card_bank" style=""><span role="alert" class="msg-wrap n-error"><span class="n-icon"></span><span class="n-msg">此处不能为空</span></span></span>').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 "<a href='/admin/rewardcollect/recollect?caid="+row.admin_id+"'>赏金统计</a>";
- }
- },
- ]
- ],
- 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;
- });
|