fix tbxSaleBonus
This commit is contained in:
parent
bfabdbac39
commit
d5b5dbba12
@ -26,7 +26,7 @@ export default function reactions(context: ProcessContext) {
|
||||
() => $calculation.element('selectProduct').getValue(),
|
||||
async (productId) => {
|
||||
if (!productId) {
|
||||
$calculation.element('tbxSaleBonus').resetValue().block();
|
||||
$calculation.element('tbxSaleBonus').resetValue();
|
||||
|
||||
return;
|
||||
}
|
||||
@ -34,19 +34,38 @@ export default function reactions(context: ProcessContext) {
|
||||
const coefficient = await getCoefficient(productId);
|
||||
|
||||
if (!coefficient?.evo_sot_coefficient) {
|
||||
$calculation.element('tbxSaleBonus').resetValue().block();
|
||||
$calculation.element('tbxSaleBonus').resetValue();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100;
|
||||
$calculation.element('tbxSaleBonus').setValue(maxBonus).unblock();
|
||||
$calculation.element('tbxSaleBonus').setValue(maxBonus);
|
||||
},
|
||||
{
|
||||
fireImmediately: true,
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectProduct').getValue(),
|
||||
async (productId) => {
|
||||
if (!productId) {
|
||||
$calculation.element('tbxSaleBonus').block();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const coefficient = await getCoefficient(productId);
|
||||
|
||||
if (coefficient?.evo_sot_coefficient) {
|
||||
$calculation.element('tbxSaleBonus').unblock();
|
||||
} else {
|
||||
$calculation.element('tbxSaleBonus').block();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* если в Продукте evo_cut_proportion_bonus_director " = Да,
|
||||
* то tbxBonusCoefficient = tbxSaleBonus/evo_sot_coefficient,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user