add lodash and refresh after input bonus count
This commit is contained in:
parent
c9173bac0e
commit
82f4f33718
6 changed files with 49 additions and 34 deletions
|
@ -42,7 +42,7 @@ if (empty($action))
|
|||
global $APPLICATION;
|
||||
|
||||
$APPLICATION->IncludeComponent(
|
||||
'bitrix:sale.order.ajax',
|
||||
'intaro:sale.order.ajax',
|
||||
'.default',
|
||||
$params
|
||||
);
|
|
@ -8320,8 +8320,6 @@ BX.namespace('BX.Sale.OrderAjaxComponent');
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
//ПРАВИЛ. отображает все службы доставок
|
||||
BX.Sale.OrderAjaxComponent.editPaySystemItems = function(paySystemNode) {
|
||||
if (!this.result.PAY_SYSTEM || this.result.PAY_SYSTEM.length <= 0)
|
||||
return;
|
||||
|
@ -8331,9 +8329,8 @@ BX.namespace('BX.Sale.OrderAjaxComponent');
|
|||
|
||||
for (i = 0; i < this.paySystemPagination.currentPage.length; i++) {
|
||||
|
||||
//скрываем бонусный способ оплаты
|
||||
if (this.paySystemPagination.currentPage[i].CODE === 'INTARO_BONUS' && this.loyaltyStatus === "Y") {
|
||||
|
||||
document.getElementById('available-bonuses').innerText = 'Бонусов доступно: ';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -8346,6 +8343,4 @@ BX.namespace('BX.Sale.OrderAjaxComponent');
|
|||
|
||||
paySystemNode.appendChild(paySystemItemsContainer);
|
||||
};
|
||||
|
||||
|
||||
})();
|
|
@ -10,5 +10,6 @@ if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
|
|||
|
||||
$arResult['LOYALTY_STATUS'] = ConfigProvider::getLoyaltyProgramStatus();
|
||||
$arResult['AVAILABLE_BONUSES'] = 300;
|
||||
$arResult['TOTAL_BONUSES_COUNT'] = 600;
|
||||
$component = $this->__component;
|
||||
$component::scaleImages($arResult['JS_DATA'], $arParams['SERVICES_IMAGES_SCALING']);
|
|
@ -1,7 +1,18 @@
|
|||
function calculateBonuses(leading) {
|
||||
console.log(leading);
|
||||
}
|
||||
$(document).ready(function() {
|
||||
let intervalId;
|
||||
|
||||
jQuery('#bonus-input').on('click', _.debounce(calculateBonuses, 300, {
|
||||
'leading': 'test',
|
||||
}));
|
||||
function make_ajax_request(e) {
|
||||
setTimeout(function() {
|
||||
BX.Sale.OrderAjaxComponent.sendRequest();
|
||||
console.log('test');
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
$('#bonus-input')
|
||||
.on('keydown', function() {
|
||||
clearInterval(intervalId);
|
||||
})
|
||||
|
||||
$('#bonus-input').on('keydown',
|
||||
_.debounce(make_ajax_request, 1300));
|
||||
});
|
|
@ -264,6 +264,7 @@ $APPLICATION->SetAdditionalCSS($templateFolder . '/style.css', true);
|
|||
$this->addExternalJs($templateFolder . '/order_ajax.js');
|
||||
PropertyValueCollection::initJs();
|
||||
$this->addExternalJs($templateFolder . '/script.js');
|
||||
CJSCore::Init(["jquery"]);
|
||||
$this->addExternalJs($templateFolder . '/scripts/lodash.js');
|
||||
$this->addExternalJs($templateFolder . '/scripts/intaro.js');
|
||||
?>
|
||||
|
@ -424,27 +425,29 @@ if (strlen($request->get('ORDER_ID')) > 0) {
|
|||
<? endif ?>
|
||||
|
||||
<!-- INTARO BONUS BLOCK -->
|
||||
<? if ($arResult['LOYALTY_STATUS'] === 'Y'): ?>
|
||||
<div id="bx-soa-intaro" data-visited="true" class="bx-soa-section bx-selected">
|
||||
<div class="bx-soa-section-title-container">
|
||||
<h2 class="bx-soa-section-title col-sm-9">
|
||||
<span class="bx-soa-section-title-count"></span> Оплата бонусами
|
||||
</h2>
|
||||
<div class="col-xs-12 col-sm-3 text-right"><a href="javascript:void(0)" class="bx-soa-editstep"><?=$arParams['MESS_EDIT']?></a></div>
|
||||
</div>
|
||||
<div class="bx-soa-section-content container-fluid" id="bx-soa-intaro-content">
|
||||
|
||||
<div class="bx-soa-coupon">
|
||||
Сколько бонусов потратить:
|
||||
<div class="bx-soa-coupon-block">
|
||||
<div class="bx-input"><input class="form-control" type="text" id='bonus-input'>
|
||||
<a href="javascript:void(0)" class="pull-right btn btn-default btn-md" onclick="updateOrder()">Пересчитать</a>
|
||||
</div>
|
||||
<? if ($arResult['LOYALTY_STATUS'] === 'Y'): ?>
|
||||
<div id="bx-soa-intaro" data-visited="true" class="bx-soa-section bx-selected">
|
||||
<div class="bx-soa-section-title-container">
|
||||
<h2 class="bx-soa-section-title col-sm-9">
|
||||
<span class="bx-soa-section-title-count"></span> Оплата бонусами
|
||||
</h2>
|
||||
<div class="col-xs-12 col-sm-3 text-right"><a href="javascript:void(0)" class="bx-soa-editstep"><?=$arParams['MESS_EDIT']?></a></div>
|
||||
</div>
|
||||
<div class="bx-soa-section-content container-fluid" id="bx-soa-intaro-content">
|
||||
|
||||
<div class="bx-soa-coupon">
|
||||
Сколько бонусов потратить:
|
||||
<div class="bx-soa-coupon-block">
|
||||
<div class="bx-input">
|
||||
<input name='bonus-input' class="form-control" type="number" max="<?=$arResult['AVAILABLE_BONUSES']?>" id='bonus-input'>
|
||||
<input name="available-bonuses" class="form-control" type="hidden" id='bonus-input' value="<?=$arResult['AVAILABLE_BONUSES']?>">
|
||||
</div>
|
||||
</div>
|
||||
<div>Всего бонусов: <label id="total-bonuses-count"><?=$arResult['TOTAL_BONUSES_COUNT']?></label></div>
|
||||
<div>Можно применить: <label id="available-bonuses"><?=$arResult['AVAILABLE_BONUSES']?></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bx-soa-coupon-label">Доступно бонусов: <label id="available-bonuses"><?= $arResult['AVAILABLE_BONUSES']?></label></div>
|
||||
</div>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<!-- ORDER SAVE BLOCK -->
|
||||
|
@ -593,7 +596,7 @@ if (strlen($request->get('ORDER_ID')) > 0) {
|
|||
pickUpBlockId: 'bx-soa-pickup',
|
||||
propsBlockId: 'bx-soa-properties',
|
||||
totalBlockId: 'bx-soa-total',
|
||||
loyaltyStatus: '<?=$arResult['LOYALTY_STATUS']?>'
|
||||
loyaltyStatus: '<?=$arResult['LOYALTY_STATUS']?>'
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
|
@ -668,4 +671,4 @@ if (strlen($request->get('ORDER_ID')) > 0) {
|
|||
</script>
|
||||
<?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,4 +95,9 @@ class EventsHandlers
|
|||
AddMessage2Log('OnSaleComponentOrderOneStepProcessHandler work! '. $arUserResult. $arParams);
|
||||
return $arResult;
|
||||
}
|
||||
|
||||
public function OnSaleComponentOrderResultPrepared($order, $arUserResult, $request, $arParams, $arResult)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue