diff --git a/Application/Admin/View/TestingResource/index.html b/Application/Admin/View/TestingResource/index.html index f9afa4690..cd80743a5 100644 --- a/Application/Admin/View/TestingResource/index.html +++ b/Application/Admin/View/TestingResource/index.html @@ -181,11 +181,11 @@ {$record.bind_role_name} - {$record.base_quota} - {$record.other_quota} - {$record.quota} + {$record.base_quota} + {$record.other_quota} + {$record.quota} {$record.verify_amount} - {$record.provide_amount} + {$record.provide_amount} {$record.today_amount} {$record.apply_amount} {$record.status} @@ -341,11 +341,21 @@ return true } $('.set-quota-btn').click(function () { + + var _this = $(this).parent().parent(); + var base_quota = _this.find(".base_quota").text(); + var quota = _this.find(".quota").text(); + var provide_amount = _this.find(".provide_amount").text(); + var box = $('#other-quota-box') var tr = $(this).parents('tr').eq(0) var id = tr.attr('data-id') var otherQuota = tr.attr('data-other-quota') var otherQuotaRemark = tr.attr('data-other-quota-remark') + console.log(tr) + + + box.find('[name=id]').val(id) box.find('[name=other_quota]').val(otherQuota) box.find('[name=other_quota_remark]').val(otherQuotaRemark) @@ -356,44 +366,53 @@ area: ['500px', '400px'], zIndex: 250, }) + quota_submit(base_quota,quota,provide_amount); }) - $('#quota-submit').on({ - click: function() { - var box = $('#other-quota-box') - var id = box.find('[name=id]').val() - var otherQuota = box.find('[name=other_quota]').val() - var otherQuotaRemark = box.find('[name=other_quota_remark]').val() - if (!(parseInt(otherQuota, 10) == otherQuota)){ - return layer.msg('额外额度只能为整数') - } - // 初始金额+奖金(累计金额)+额外额度-累计已发放 - base_quota = parseInt(base_quota,10) //初始金额 - quota = parseInt(quota,10) //奖金=累计额度 - otherQuota = parseInt(otherQuota,10) //额外额度 - provide_amount = parseInt(provide_amount,10) //累计已发放 - if ((base_quota+quota+otherQuota-provide_amount) < 0){ - return layer.msg('额度不足,请重新设置') - } - $.ajax({ - url: "{:U('setOtherQuota')}", - type: "POST", - dataType: "json", - data: { id: id, other_quota: otherQuota,otherQuotaRemark: otherQuotaRemark }, - success: function (result) { - if (result.status == 0) { - layer.msg(result.message); - } else { - layer.msg(result.message, function(){ - window.location.href = window.location.href - }) - } - }, - error: function () { + function quota_submit(base_quota,quota,provide_amount) { + $('#quota-submit').on({ + click: function() { + var box = $('#other-quota-box') + var id = box.find('[name=id]').val() + var otherQuota = box.find('[name=other_quota]').val() + var otherQuotaRemark = box.find('[name=other_quota_remark]').val() + if (!(parseInt(otherQuota, 10) == otherQuota)){ + return layer.msg('额外额度只能为整数') + } + // 初始金额+奖金(累计金额)+额外额度-累计已发放 + base_quota = parseInt(base_quota,10) //初始金额 + quota = parseInt(quota,10) //奖金=累计额度 + otherQuota = parseInt(otherQuota,10) //额外额度 + provide_amount = parseInt(provide_amount,10) //累计已发放 + console.log(base_quota) + console.log(quota) + console.log(otherQuota) + console.log(provide_amount) + if ((base_quota+quota+otherQuota-provide_amount) < 0){ + return layer.msg('额度不足,请重新设置') } - }) - } - }) + $.ajax({ + url: "{:U('setOtherQuota')}", + type: "POST", + dataType: "json", + data: { id: id, other_quota: otherQuota,otherQuotaRemark: otherQuotaRemark }, + success: function (result) { + if (result.status == 0) { + layer.msg(result.message); + } else { + layer.msg(result.message, function(){ + window.location.href = window.location.href + }) + } + }, + error: function () { + + } + }) + } + }) + } + $('.unbind-btn').click(function () { var tr = $(this).parents('tr').eq(0) var bindingId = tr.attr('data-binding-id')