【发布时间】:2017-06-03 08:15:16
【问题描述】:
如果特殊佣金有任何值,我想添加佣金,否则我想将佣金默认设置为 2%%,如果用户将该字段留空,当我没有输入任何值时,计算是正确的,但当我输入任何值说 100 然后将该值连接到佣金而不是加法 请告诉我我的代码中的错误是什么?
这是我的功能:
$('body').delegate('.quantity,.price,.discount,.spl', 'keyup', function () {
var tr = $(this).parent().parent();
var qty = tr.find('.quantity').val();
var price = tr.find('.price').val();
var special_commision = 2/100;
if($('.spl').val()){
var special_commision = parseInt($('.spl').val()) + special_commision ;
}
var dis = tr.find('.discount').val();
var amt = (qty * price) - (qty * price * dis) / 100;
cal_spl = amt*special_commision;
tr.find('.amount').val(amt);
tr.find('.sm').val(cal_spl);
total();
});
【问题讨论】: