额外额度计算修改

master
liyang 4 years ago
parent 82d8487bf9
commit e008e14046

@ -181,11 +181,11 @@
<td>
{$record.bind_role_name}
</td>
<td>{$record.base_quota}</td>
<td>{$record.other_quota}</td>
<td>{$record.quota}</td>
<td class="base_quota">{$record.base_quota}</td>
<td class="other_quota">{$record.other_quota}</td>
<td class="quota">{$record.quota}</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.apply_amount}</td>
<td>{$record.status}</td>
@ -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')

Loading…
Cancel
Save