config.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. define(['jquery', 'bootstrap', 'backend', 'form'], function ($, undefined, Backend, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表单
  5. Form.api.bindevent($("form[role=form]"), function (data, ret) {
  6. // 表单提交成功后的处理
  7. Layer.alert(ret.msg, {
  8. icon: 1,
  9. time: 2000
  10. }, function() {
  11. // 关闭弹窗后刷新页面
  12. location.reload();
  13. });
  14. });
  15. // 实时验证金额
  16. $('input[name="row[min_amount]"], input[name="row[max_amount]"]').on('blur', function() {
  17. var minAmount = parseFloat($('input[name="row[min_amount]"]').val() || 0);
  18. var maxAmount = parseFloat($('input[name="row[max_amount]"]').val() || 0);
  19. if (minAmount > 0 && maxAmount > 0 && minAmount >= maxAmount) {
  20. Layer.msg('最小提现金额不能大于或等于最大提现金额', {icon: 2});
  21. $(this).focus();
  22. return false;
  23. }
  24. });
  25. // 实时验证手续费率
  26. $('input[name="row[charge_rate]"]').on('blur', function() {
  27. var rate = parseFloat($(this).val() || 0);
  28. if (rate < 0 || rate > 100) {
  29. Layer.msg('手续费率必须在0-100之间', {icon: 2});
  30. $(this).focus();
  31. return false;
  32. }
  33. });
  34. // 提现方式变更时自动调整自动到账选项
  35. $('input[name="row[methods][]"]').on('change', function() {
  36. var checkedMethods = [];
  37. $('input[name="row[methods][]"]:checked').each(function() {
  38. checkedMethods.push($(this).val());
  39. });
  40. // 取消未选中提现方式的自动到账选项
  41. $('input[name="row[auto_arrival][]"]').each(function() {
  42. if (checkedMethods.indexOf($(this).val()) === -1) {
  43. $(this).prop('checked', false);
  44. }
  45. });
  46. });
  47. }
  48. };
  49. return Controller;
  50. });