123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- define(['jquery', 'bootstrap', 'backend', 'form'], function ($, undefined, Backend, Form) {
- var Controller = {
- index: function () {
- // 初始化表单
- Form.api.bindevent($("form[role=form]"), function (data, ret) {
- // 表单提交成功后的处理
- Layer.alert(ret.msg, {
- icon: 1,
- time: 2000
- }, function() {
- // 关闭弹窗后刷新页面
- location.reload();
- });
- });
- // 实时验证金额
- $('input[name="row[min_amount]"], input[name="row[max_amount]"]').on('blur', function() {
- var minAmount = parseFloat($('input[name="row[min_amount]"]').val() || 0);
- var maxAmount = parseFloat($('input[name="row[max_amount]"]').val() || 0);
-
- if (minAmount > 0 && maxAmount > 0 && minAmount >= maxAmount) {
- Layer.msg('最小提现金额不能大于或等于最大提现金额', {icon: 2});
- $(this).focus();
- return false;
- }
- });
- // 实时验证手续费率
- $('input[name="row[charge_rate]"]').on('blur', function() {
- var rate = parseFloat($(this).val() || 0);
- if (rate < 0 || rate > 100) {
- Layer.msg('手续费率必须在0-100之间', {icon: 2});
- $(this).focus();
- return false;
- }
- });
- // 提现方式变更时自动调整自动到账选项
- $('input[name="row[methods][]"]').on('change', function() {
- var checkedMethods = [];
- $('input[name="row[methods][]"]:checked').each(function() {
- checkedMethods.push($(this).val());
- });
-
- // 取消未选中提现方式的自动到账选项
- $('input[name="row[auto_arrival][]"]').each(function() {
- if (checkedMethods.indexOf($(this).val()) === -1) {
- $(this).prop('checked', false);
- }
- });
- });
- }
- };
-
- return Controller;
- });
|