inviterecord.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. // $(".submit button").click(function(){
  3. // // if(!varify()){
  4. // // alert("请补全信息再提交哦");
  5. // // return false;
  6. // // };
  7. // var add_url = 'reward/inviterecord/agentapply';
  8. // var data = $("#add-form").serialize();
  9. // $.ajax({
  10. // url:add_url,
  11. // type:"post",
  12. // data:data,
  13. // success:function(res){
  14. // if(res.status==1){
  15. // window.location = "invsuccess?invid="+res.data.invite_id+"&username="+res.data.username;
  16. // }
  17. // }
  18. // })
  19. // })
  20. // function checkUser(){
  21. // var userName = document.getElementById(user_inp).value;
  22. //
  23. // if (userName.length<=0 || userName==请输入邮箱帐号/手机号){
  24. // showTips(用户名不能为空!);
  25. // return false;
  26. // }
  27. //
  28. // if (sNumReg.test(userName)){
  29. // if(userName.length!=11){
  30. // showTips(手机号格式不正确!);
  31. // return false;
  32. // }
  33. // showTips();
  34. // return true;
  35. // }
  36. //
  37. // if(!sEmailReg.test(userName)){
  38. // showTips(邮箱输入有误,请重新输入!);
  39. // return false;
  40. // }
  41. // showTips();
  42. // return true;
  43. // }
  44. $("#c-pay_type").change(function(){
  45. if($(this).val()==3){
  46. $('<div class="form-group c-card_bank">\
  47. <label for="c-card_bank" class="control-label col-xs-12 col-sm-2">* 收款开户银行:</label>\
  48. <div class="col-xs-12 col-sm-8">\
  49. <input id="c-card_bank" data-rule="required" class="form-control" name="row[bankname]" type="text" >\
  50. </div>\
  51. </div>').insertAfter($('#c-card_num').parents('.form-group'));
  52. }else{
  53. $(".c-card_bank").remove();
  54. }
  55. });
  56. // function varify(){
  57. //
  58. // var sEmailReg =/^[w-]+(.[w-]+)*@[w-]+(.[w-]+)+$/;
  59. // var sNumReg = /^d+$/
  60. //
  61. // var user = $("#username").val();
  62. // if(!$.trim(user) || user.length<3 || user.length>12){
  63. // return false;
  64. // }
  65. //
  66. // var nick = $("#nickname").val();
  67. // if(!$.trim(nick)){
  68. // return false;
  69. // }
  70. //
  71. // var name = $("#c-card_holder").val();
  72. // if(!$.trim(name)){
  73. // return false;
  74. // }
  75. //
  76. // var number = $("")
  77. //
  78. // var account = $("#c-card_num").val();
  79. // if(!$.trim(account)){
  80. // return false;
  81. // }
  82. //
  83. // if($("#c-pay_type").val==3){
  84. // var bank = $("#c-card_bank").val();
  85. // if(!$.trim(bank)){
  86. // return false;
  87. // }
  88. // }
  89. // return true;
  90. // }
  91. //
  92. // $(".agentapply").data("validator-options", {
  93. // ignore: ':hidden',
  94. // beforeSubmit: function (form) {
  95. // if($('#c-pay_type').val() == '3'){
  96. // var sBankVal = $.trim($('#c-card_bank').val());
  97. // if(sBankVal==''){
  98. // $('<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'));
  99. // return false;
  100. // }
  101. // }
  102. // }
  103. // });
  104. // Form.api.bindevent($(".agentapply"));
  105. var Controller = {
  106. index: function () {
  107. // 初始化表格参数配置
  108. Table.api.init({
  109. extend: {
  110. index_url: 'reward/inviterecord/index',
  111. add_url: 'reward/inviterecord/add',
  112. edit_url: 'reward/inviterecord/edit',
  113. del_url: 'reward/inviterecord/del',
  114. multi_url: 'reward/inviterecord/multi',
  115. table: 'invite_record',
  116. }
  117. });
  118. var table = $("#table");
  119. // 初始化表格
  120. table.bootstrapTable({
  121. url: $.fn.bootstrapTable.defaults.extend.index_url,
  122. pk: 'id',
  123. sortName: 'id',
  124. searchFormVisible: true,
  125. search:false,
  126. columns: [
  127. [
  128. {checkbox: true},
  129. {field: 'id', title: __('ID'),operate:false},
  130. {field: 'a.username', title: __('Username'),formatter:function(value,row){return row.username;}},
  131. {field: 'nickname', title: __('Nickname'),operate:false,formatter:function(value,row,index){
  132. if(row.status!=0)
  133. return row.realnickname;
  134. return value;
  135. }},
  136. {field: 'realnickname', title: __('RealNickname'),operate:false,visible:false},
  137. {field: 'dayreward', title: __('今日赏金'),operate:false},
  138. {field: 'totalreward', title: __('累计赏金'),operate:false},
  139. {field: 'email', title: __('Email'),operate:false,visible:false},
  140. {field: 'phone', title: __('Phone'),operate:false,visible:false},
  141. {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},
  142. {field: 'pay_type_text', title: __('Pay_type'), operate:false},
  143. {field: 'name', title: __('Name'),operate:false,visible:false},
  144. {field: 'account', title: __('Account'),operate:false,visible:false},
  145. {field: 'invite_id', title: __('Invite_id'),operate:false,visible:false},
  146. {field: 'a.status', title: __('Status'), visible:false, searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}},
  147. {field: 'status_text', title: __('Status'), operate:false},
  148. {field: 'invite_time', title: __('Invite_time'), addclass:'datetimerange', formatter: Table.api.formatter.datetime, operate:false},
  149. {field: 'createtime', title: __('Createtime'), addclass:'datetimerange', formatter: Table.api.formatter.datetime, operate:false,visible:false},
  150. {field: 'updatetime', title: __('Updatetime'), addclass:'datetimerange', formatter: Table.api.formatter.datetime, operate:false,visible:false},
  151. {field: 'oprate', title: __('数据'), table: table, operate:false,formatter:function(value,row,index){
  152. if(row.status==0)
  153. return;
  154. return "<a href='/admin/rewardcollect/recollect?caid="+row.admin_id+"'>赏金统计</a>";
  155. }
  156. },
  157. ]
  158. ],
  159. onLoadSuccess: function (data) {
  160. $("#todayreward").text("¥"+data.countdata.todayreward);
  161. $("#totalreward").text("¥"+data.countdata.totalreward);
  162. }
  163. });
  164. // 为表格绑定事件
  165. Table.api.bindevent(table);
  166. },
  167. add: function () {
  168. Controller.api.bindevent();
  169. },
  170. edit: function () {
  171. Controller.api.bindevent();
  172. },
  173. api: {
  174. bindevent: function () {
  175. Form.api.bindevent($("form[role=form]"));
  176. }
  177. }
  178. };
  179. return Controller;
  180. });