withdraw.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'withdraw/index',
  8. add_url: 'withdraw/add',
  9. edit_url: 'withdraw/edit',
  10. multi_url: 'withdraw/multi',
  11. table: 'withdraw',
  12. }
  13. });
  14. //book_but
  15. $(document).on('click','.book_but',function () {
  16. Fast.api.open($(this).attr('href'), '数据列表', {});
  17. return false;
  18. });
  19. var table = $("#table");
  20. var group = Config.group;
  21. // $('#state1').text(Config.state1);
  22. // $('#state2').text(Config.state2);
  23. // $('#state3').text(Config.state3);
  24. // 初始化表格
  25. if(group < 3){ //管理员
  26. table.bootstrapTable({
  27. url: $.fn.bootstrapTable.defaults.extend.index_url,
  28. pk: 'id',
  29. sortName: 'id',
  30. search: true,
  31. showToggle:false,
  32. showColumns: false,
  33. showExport: true,
  34. searchFormVisible: true,
  35. columns: [
  36. [
  37. {checkbox: true},
  38. {field: 'admin.nickname', title: __('渠道商')},
  39. {field: 'withdraw.createtime', title: __('提现时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  40. {field: 'finishtime', title: __('划账日期'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  41. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  42. {field: 'dkfs', title: __('打款方式'),operate:false,formatter: Controller.api.formatter.dkfs},
  43. {field: 'card_holder', title: __('开户人'),operate:false},
  44. {field: 'card_bank', title: __('银行'),operate:false},
  45. {field: 'card_num', title: __('卡号'),operate:false},
  46. {field: 'idcard_no', title: __('身份证号'),operate:false},
  47. {field: 'state', title: __('State'), visible:false, searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}},
  48. {field: 'state_text', title: __('State'), operate:false,formatter: Controller.api.formatter.states_span},
  49. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  50. ]
  51. ],
  52. exportOptions: {
  53. type: 'excel',
  54. ignoreColumn: [10],
  55. onMsoNumberFormat: function(cell, row, col) {
  56. if(row > 0){
  57. if(col == 7 || col == 8){
  58. return '\\@';
  59. }else{
  60. return '';
  61. }
  62. }
  63. }},
  64. onLoadSuccess: function (data) {
  65. $('#state1').text(data.others.state1);
  66. $('#state2').text(data.others.state2);
  67. $('#state3').text(data.others.state3);
  68. }
  69. });
  70. }
  71. if(group == 3){ //渠道商
  72. table.bootstrapTable({
  73. url: $.fn.bootstrapTable.defaults.extend.index_url,
  74. pk: 'id',
  75. sortName: 'id',
  76. search: true,
  77. showToggle:false,
  78. showColumns: false,
  79. showExport: true,
  80. searchFormVisible: true,
  81. columns: [
  82. [
  83. {checkbox: true},
  84. {field: 'admin.nickname', title: '代理商'},
  85. {field: 'withdraw.createtime', title: '提现时间', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  86. {field: 'finishtime', title: '划账日期', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  87. {field: 'money', title: __('Money'), operate:'BETWEEN',operate:false},
  88. {field: 'dkfs', title: '打款方式',operate:false,formatter: Controller.api.formatter.dkfs,operate:false},
  89. {field: 'card_holder', title: __('开户人'),operate:false},
  90. {field: 'card_bank', title: __('银行'),operate:false},
  91. {field: 'card_num', title: __('卡号'),operate:false},
  92. {field: 'idcard_no', title: __('身份证号'),operate:false},
  93. {field: 'state', title: __('State'), visible:false, searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}},
  94. {field: 'state_text', title: __('State'), operate:false,formatter: Controller.api.formatter.states_span},
  95. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  96. ]
  97. ],
  98. exportOptions: {
  99. type: 'excel',
  100. ignoreColumn: [10],
  101. onMsoNumberFormat: function(cell, row, col) {
  102. if(row > 0){
  103. if(col == 7 || col == 8){
  104. return '\\@';
  105. }else{
  106. return '';
  107. }
  108. }
  109. }},
  110. onLoadSuccess: function (data) {
  111. $('#state1').text(data.others.state1);
  112. $('#state2').text(data.others.state2);
  113. $('#state3').text(data.others.state3);
  114. }
  115. });
  116. }
  117. if(group == 4){ //代理商
  118. table.bootstrapTable({
  119. url: $.fn.bootstrapTable.defaults.extend.index_url,
  120. pk: 'id',
  121. sortName: 'id',
  122. columns: [
  123. [
  124. {field: 'withdraw.createtime', title: __('提现时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  125. {field: 'finishtime', title: __('划账日期'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  126. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  127. {field: 'state', title: __('State'),operate:false,formatter: Controller.api.formatter.states},
  128. ]
  129. ]
  130. });
  131. }
  132. // 为表格绑定事件
  133. Table.api.bindevent(table);
  134. // console.log('test');
  135. // console.log(Config);
  136. // 弹窗绑定
  137. // $(document).on('click','.btn-success',function () {
  138. // $('#state1').text(Config.state1);
  139. // $('#state2').text(Config.state2);
  140. // $('#state3').text(Config.state3);
  141. //return false;
  142. // })
  143. },
  144. add: function () {
  145. Controller.api.bindevent();
  146. },
  147. edit: function () {
  148. Controller.api.bindevent();
  149. },
  150. mywithdraw:function () {
  151. // 初始化表格参数配置
  152. Table.api.init({
  153. extend: {
  154. index_url: 'withdraw/mywithdraw',
  155. add_url: 'withdraw/add',
  156. multi_url: 'withdraw/multi',
  157. table: 'withdraw',
  158. }
  159. });
  160. // 为表格绑定事件
  161. var table = $("#table");
  162. table.bootstrapTable({
  163. url: $.fn.bootstrapTable.defaults.extend.index_url,
  164. pk: 'id',
  165. sortName: 'id',
  166. columns: [
  167. [
  168. {field: 'createtime', title: __('提现时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  169. {field: 'finishtime', title: __('划账日期'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  170. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  171. {field: 'state', title: __('State'),operate:false,formatter: Controller.api.formatter.states},
  172. ]
  173. ]
  174. });
  175. Table.api.bindevent(table);
  176. },
  177. api: {
  178. bindevent: function () {
  179. Form.api.bindevent($("form[role=form]"));
  180. $('#c-money').keyup(function () {
  181. var money = parseInt($('#c-money').val());
  182. if(isNaN(money)){
  183. money = 0;
  184. }
  185. var service_recharge =0;
  186. // if(money <10 ){
  187. // money = 0;
  188. // service_recharge = 0;
  189. // }
  190. // if(money < 500 && money >=10 ){
  191. // money = money-5;
  192. // service_recharge = 5;
  193. // }
  194. // if(money <= 5000 && money >=500 ){
  195. // service_recharge = money*0.01;
  196. // money = money-money*0.01;
  197. // }
  198. // if(money > 5000 ){
  199. // money = money-50;
  200. // service_recharge = 50;
  201. // }
  202. if(money+service_recharge >Config.no_cash_money){
  203. money = '超出可提现金额';
  204. service_recharge = 0;
  205. }
  206. $('.money').val(money);
  207. // $('.ServiceCharge').val(service_recharge);
  208. });
  209. },
  210. formatter:{
  211. dkfs:function(value,row,index){
  212. if(value ==1){
  213. return '银行卡对公';
  214. }else if(value == 2){
  215. return '银行卡对私';
  216. }else if(value == 3){
  217. return '微信';
  218. }else{
  219. return '支付宝';
  220. }
  221. },
  222. states:function(value,row,index){
  223. if(value ==1){
  224. return '提现中';
  225. }else if(value == 2){
  226. return '打款中';
  227. }else if(value == 3){
  228. return '已打款';
  229. }
  230. },
  231. states_span:function(value,row,index){
  232. if(value =='提现中'){
  233. return '<span class="ord_red">提现中</span>';
  234. }else if(value == '打款中'){
  235. return '<span class="ord_yellow">打款中</span>';
  236. }else if(value == '已打款'){
  237. return '<span class="ord_green">已打款</span>';
  238. }
  239. }
  240. }
  241. }
  242. };
  243. return Controller;
  244. });