vipwithdraw.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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: 'vipwithdraw/index',
  8. add_url: 'vipwithdraw/add',
  9. edit_url: 'vipwithdraw/edit',
  10. multi_url: 'vipwithdraw/multi/ids',
  11. table: 'withdraw',
  12. export_url:'historyExport',
  13. }
  14. });
  15. //book_but
  16. $(document).on('click','.book_but',function () {
  17. Fast.api.open($(this).attr('href'), '数据列表', {});
  18. return false;
  19. });
  20. var table = $("#table");
  21. // 初始化表格
  22. table.bootstrapTable({
  23. url: $.fn.bootstrapTable.defaults.extend.index_url,
  24. pk: 'id',
  25. sortName: 'id',
  26. showToggle: false,
  27. showColumns: false,
  28. search: false,
  29. commonSearch: false,
  30. columns: [
  31. [
  32. {checkbox: true},
  33. {field: 'name', title: '公众号', oprate: false},
  34. {field: 'username', title: __('用户名')},
  35. {field: 'recharge_money', title: __('总充值金额(不含当日)')},
  36. {field: 'split_money', title: __('总分账金额(不含当日)')},
  37. {field: 'recharge_money_benefit', title: __('结算总金额(不含当日)')},
  38. {field: 'no_cash_money', title: __('未提现')},
  39. {field: 'cash_money', title: __('提现中'),},
  40. {field: 'count_cash_money', title: __('已打款')},
  41. /*{
  42. field: 'admin_id', title: __('Operate'), table: table,
  43. buttons: [
  44. {
  45. name: 'add_cash',
  46. text: '申请提现',
  47. title: '申请提现',
  48. icon: '',
  49. classname: 'btn btn-xs btn-danger btn-dialog',
  50. url: '/admin/vipwithdraw/add',
  51. callback: function (data) {
  52. }
  53. },
  54. ],
  55. oprate: false,
  56. formatter: Table.api.formatter.buttons
  57. },*/
  58. {
  59. field: 'admin_id',
  60. title: __('Operate'),
  61. buttons: [
  62. ],
  63. formatter: Controller.api.formatter.withdrawbuttons
  64. },
  65. ]
  66. ]
  67. });
  68. // 为表格绑定事件
  69. Table.api.bindevent(table);
  70. // $(document).on("click", "input", function () {
  71. // var ids = Table.api.selectedids(table);
  72. // });
  73. $(document).on("click", "#toolbar .layer-open", function () {
  74. var ids = Table.api.selectedids(table);
  75. ids = ids.join(",");
  76. var href = "vipwithdraw/multi/ids/" + ids;
  77. Fast.api.open(href, '批量提现', {});
  78. });
  79. },
  80. historymoney: function () {
  81. console.log('historymoney');
  82. // 初始化表格参数配置
  83. Table.api.init({
  84. extend: {
  85. index_url: 'vipwithdraw/historymoney',
  86. export_url:'historyExport',
  87. }
  88. });
  89. // 为表格绑定事件
  90. var table = $("#historytable");
  91. table.bootstrapTable({
  92. url: $.fn.bootstrapTable.defaults.extend.index_url,
  93. pk: 'id',
  94. sortName: 'id',
  95. search: false,
  96. columns: [
  97. [
  98. {
  99. field: 'service_name',
  100. title: __('公众号名称'),
  101. operate: false,
  102. },
  103. {
  104. field: 'username',
  105. title: __('用户名'),
  106. },
  107. {
  108. field: 'nickname',
  109. title: __('昵称'),
  110. },
  111. {
  112. field: 'withdraw.createtime',
  113. title: __('提现时间'),
  114. operate: 'RANGE',
  115. addclass: 'datetimerange',
  116. formatter: Table.api.formatter.datetime,
  117. visible:false
  118. },
  119. {
  120. field: 'createtime',
  121. title: __('提现时间'),
  122. operate: 'RANGE',
  123. addclass: 'datetimerange',
  124. formatter: Table.api.formatter.datetime,
  125. operate:false
  126. },
  127. {
  128. field: 'finishtime',
  129. title: __('划账日期'),
  130. operate: 'RANGE',
  131. addclass: 'datetimerange',
  132. formatter: Table.api.formatter.datetime
  133. },
  134. {field: 'money', title: __('Money'), operate: 'BETWEEN'},
  135. {
  136. field: 'state',
  137. title: __('State'),
  138. operate: false,
  139. formatter: Controller.api.formatter.states
  140. },
  141. ]
  142. ]
  143. });
  144. Table.api.bindevent(table);
  145. },
  146. add: function () {
  147. Controller.api.bindevent();
  148. },
  149. edit: function () {
  150. Controller.api.bindevent();
  151. },
  152. multi: function () {
  153. Controller.api.bindevent();
  154. },
  155. api: {
  156. bindevent: function () {
  157. Form.api.bindevent($("form[role=form]"));
  158. $('#c-money').keyup(function () {
  159. var money = parseInt($('#c-money').val());
  160. if(isNaN(money)){
  161. money = 0;
  162. }
  163. var service_recharge =0;
  164. if(money+service_recharge >Config.no_cash_money){
  165. money = '超出可提现金额';
  166. service_recharge = 0;
  167. }
  168. $('.money').val(money);
  169. // $('.ServiceCharge').val(service_recharge);
  170. });
  171. $(document).on("click", ".multisubmit", function () {
  172. var ids = $(".multiids").val();
  173. console.log(ids);
  174. var url = "vipwithdraw/multi/ids/" + ids;
  175. $.ajax({
  176. url: url, data: {ids: ids}, type: 'POST',
  177. success: function (data) {
  178. if(data.code == 1){
  179. // Toastr.success("操作成功");
  180. // setTimeout(function() {
  181. // window.location.reload();
  182. parent.location.reload();
  183. // },2000);
  184. }else if (data.code == -1) {
  185. $('#total_popup_box').show();
  186. if (data.data.limitinfos && data.data.limitinfos.length > 0) {
  187. var strHtml = '<div class="tpl_tit">频繁提现</div>';
  188. data.data.limitinfos.forEach(function (item, index, arr) {
  189. strHtml += '<div class="tpl_li">\n' +
  190. '<strong>' + item.name + '</strong>\n' +
  191. '<em>' + item.username + '</em>\n' +
  192. '</div>'
  193. });
  194. $('.tp_list_box').html(strHtml);
  195. }
  196. if (data.data.lowids && data.data.lowids.length > 0) {
  197. var strHtml = '<div class="tpl_tit">余额满10元才能申请提现</div>';
  198. data.data.lowids.forEach(function (item, index, arr) {
  199. strHtml += '<div class="tpl_li">\n' +
  200. '<strong>' + item.name + '</strong>\n' +
  201. '<em>' + item.username + '</em>\n' +
  202. '</div>'
  203. });
  204. $('.tp_list_box').html(strHtml);
  205. }
  206. // document.getElementById('total_popup_box').style.display = 'block';
  207. }
  208. }, error: function (XMLHttpRequest, textStatus, errorThrown) {
  209. consoleMain('异常错误,请刷新页面重试');
  210. cpslog([703, {
  211. map: {
  212. xdtype: goodsCategory,
  213. result: 4,
  214. book_id: sbookid,
  215. adid: goodsId,
  216. chapter_id: schapterid,
  217. money: smoney,
  218. XMLHttpRequest: XMLHttpRequest.status,
  219. textStatus: textStatus,
  220. errorThrown: errorThrown
  221. }
  222. }, 'xdjg']);
  223. paystop = true;
  224. }
  225. });
  226. });
  227. },
  228. formatter:{
  229. dkfs:function(value,row,index){
  230. if(value ==1){
  231. return '银行卡对公';
  232. }else if(value == 2){
  233. return '银行卡对私';
  234. }else if(value == 3){
  235. return '微信';
  236. }else{
  237. return '支付宝';
  238. }
  239. },
  240. states:function(value,row,index){
  241. if(value ==1){
  242. return '提现中';
  243. }else if(value == 2){
  244. return '打款中';
  245. }else if(value == 3){
  246. return '已打款';
  247. }
  248. },
  249. states_span:function(value,row,index){
  250. if(value =='提现中'){
  251. return '<span class="ord_red">提现中</span>';
  252. }else if(value == '打款中'){
  253. return '<span class="ord_yellow">打款中</span>';
  254. }else if(value == '已打款'){
  255. return '<span class="ord_green">已打款</span>';
  256. }
  257. },
  258. withdrawbuttons: function (value, row, index) {
  259. ahtml = '<a href="/admin/vipwithdraw/add/ids/' + row.id + '" class="btn btn-xs btn-danger btn-dialog " title="申请提现" data-table-id="table" data-field-index="8" data-row-index="0" data-button-index="0"><i class=""></i> 申请提现</a>';
  260. ahtml += '<a href="/admin/withdraw/myhistorydraw/admin_id/' + row.admin_id + '" class="btn btn-xs btn-danger btn-dialog " title="提现记录" data-table-id="table" data-field-index="8" data-row-index="0" data-button-index="1"><i class=""></i> 提现记录</a>';
  261. return ahtml;
  262. },
  263. }
  264. }
  265. };
  266. return Controller;
  267. });