额外额度计算修改

master
liyang 4 years ago
parent 82d8487bf9
commit e008e14046

@ -181,11 +181,11 @@
<td> <td>
{$record.bind_role_name} {$record.bind_role_name}
</td> </td>
<td>{$record.base_quota}</td> <td class="base_quota">{$record.base_quota}</td>
<td>{$record.other_quota}</td> <td class="other_quota">{$record.other_quota}</td>
<td>{$record.quota}</td> <td class="quota">{$record.quota}</td>
<td>{$record.verify_amount}</td> <td>{$record.verify_amount}</td>
<td>{$record.provide_amount}</td> <td class="provide_amount">{$record.provide_amount}</td>
<td>{$record.today_amount}</td> <td>{$record.today_amount}</td>
<td>{$record.apply_amount}</td> <td>{$record.apply_amount}</td>
<td>{$record.status}</td> <td>{$record.status}</td>
@ -341,11 +341,21 @@
return true return true
} }
$('.set-quota-btn').click(function () { $('.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 box = $('#other-quota-box')
var tr = $(this).parents('tr').eq(0) var tr = $(this).parents('tr').eq(0)
var id = tr.attr('data-id') var id = tr.attr('data-id')
var otherQuota = tr.attr('data-other-quota') var otherQuota = tr.attr('data-other-quota')
var otherQuotaRemark = tr.attr('data-other-quota-remark') var otherQuotaRemark = tr.attr('data-other-quota-remark')
console.log(tr)
box.find('[name=id]').val(id) box.find('[name=id]').val(id)
box.find('[name=other_quota]').val(otherQuota) box.find('[name=other_quota]').val(otherQuota)
box.find('[name=other_quota_remark]').val(otherQuotaRemark) box.find('[name=other_quota_remark]').val(otherQuotaRemark)
@ -356,44 +366,53 @@
area: ['500px', '400px'], area: ['500px', '400px'],
zIndex: 250, zIndex: 250,
}) })
quota_submit(base_quota,quota,provide_amount);
}) })
$('#quota-submit').on({ function quota_submit(base_quota,quota,provide_amount) {
click: function() { $('#quota-submit').on({
var box = $('#other-quota-box') click: function() {
var id = box.find('[name=id]').val() var box = $('#other-quota-box')
var otherQuota = box.find('[name=other_quota]').val() var id = box.find('[name=id]').val()
var otherQuotaRemark = box.find('[name=other_quota_remark]').val() var otherQuota = box.find('[name=other_quota]').val()
if (!(parseInt(otherQuota, 10) == otherQuota)){ var otherQuotaRemark = box.find('[name=other_quota_remark]').val()
return layer.msg('额外额度只能为整数') if (!(parseInt(otherQuota, 10) == otherQuota)){
} return layer.msg('额外额度只能为整数')
// 初始金额+奖金(累计金额)+额外额度-累计已发放 }
base_quota = parseInt(base_quota,10) //初始金额 // 初始金额+奖金(累计金额)+额外额度-累计已发放
quota = parseInt(quota,10) //奖金=累计额度 base_quota = parseInt(base_quota,10) //初始金额
otherQuota = parseInt(otherQuota,10) //额外额度 quota = parseInt(quota,10) //奖金=累计额度
provide_amount = parseInt(provide_amount,10) //累计已发放 otherQuota = parseInt(otherQuota,10) //额外额度
if ((base_quota+quota+otherQuota-provide_amount) < 0){ provide_amount = parseInt(provide_amount,10) //累计已发放
return layer.msg('额度不足,请重新设置') console.log(base_quota)
} console.log(quota)
$.ajax({ console.log(otherQuota)
url: "{:U('setOtherQuota')}", console.log(provide_amount)
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 () {
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 () { $('.unbind-btn').click(function () {
var tr = $(this).parents('tr').eq(0) var tr = $(this).parents('tr').eq(0)
var bindingId = tr.attr('data-binding-id') var bindingId = tr.attr('data-binding-id')

Loading…
Cancel
Save