add added bonus count
This commit is contained in:
parent
67f2ddeb8c
commit
0ab6a127d2
4 changed files with 39 additions and 8 deletions
|
@ -96,6 +96,9 @@ BX.namespace('BX.Sale.OrderAjaxComponent');
|
|||
init: function(parameters) {
|
||||
this.initializePrimaryFields();
|
||||
|
||||
this.willBeCredited = parameters.willBeCredited || 0;
|
||||
this.bonusCurrency = parameters.bonusCurrency || '# руб.';
|
||||
|
||||
this.result = parameters.result || {};
|
||||
this.prepareLocations(parameters.locations);
|
||||
this.params = parameters.params || {};
|
||||
|
@ -8306,10 +8309,19 @@ BX.namespace('BX.Sale.OrderAjaxComponent');
|
|||
|
||||
//добавление строки с бонусами
|
||||
if (this.result.TOTAL.BONUS_PAYMENT !== undefined && this.result.TOTAL.BONUS_PAYMENT > 0) {
|
||||
const bonusPayment = this.result.TOTAL.BONUS_PAYMENT.toString();
|
||||
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Бонусы:', bonusPayment, {highlighted: true}));
|
||||
let bonusPayment = this.result.TOTAL.BONUS_PAYMENT.toString();
|
||||
bonusPayment = this.bonusCurrency
|
||||
.replace('₽', '₽')
|
||||
.replace('€', '€')
|
||||
.replace('₴', '¥')
|
||||
.replace('#', bonusPayment);
|
||||
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Бонусная скидка:', bonusPayment));
|
||||
}
|
||||
|
||||
const willBeCredited = this.willBeCredited;
|
||||
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Будет начислено бонусов:', willBeCredited, {highlighted: true}));
|
||||
|
||||
|
||||
if (this.options.showPayedFromInnerBudget)
|
||||
{
|
||||
this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message('SOA_SUM_IT'), total.ORDER_TOTAL_PRICE_FORMATED));
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
<?php
|
||||
|
||||
use Bitrix\Currency\CurrencyLangTable;
|
||||
use Bitrix\Main\Loader;
|
||||
use Intaro\RetailCrm\Component\ConfigProvider;
|
||||
use Intaro\RetailCrm\Service\LoyaltyService;
|
||||
|
||||
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
|
||||
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* @var array $arParams
|
||||
* @var array $arResult
|
||||
* @var array $arParams
|
||||
* @var array $arResult
|
||||
* @var SaleOrderAjax $component
|
||||
*/
|
||||
|
||||
|
@ -25,10 +28,22 @@ if ($calculate->success) {
|
|||
$arResult['AVAILABLE_BONUSES'] = $calculate->order->bonusesChargeTotal;
|
||||
$arResult['TOTAL_BONUSES_COUNT'] = $calculate->order->loyaltyAccount->amount;
|
||||
$arResult['LP_CALCULATE_SUCCESS'] = $calculate->success;
|
||||
$arResult['WILL_BE_CREDITED'] = $calculate->order->bonusesCreditTotal;
|
||||
}*/
|
||||
//TODO убрать заглушку после появления реальных методов
|
||||
$arResult['LP_CALCULATE_SUCCESS'] = true;
|
||||
$arResult['AVAILABLE_BONUSES'] = 300;
|
||||
$arResult['TOTAL_BONUSES_COUNT'] = 600;
|
||||
$component = $this->__component;
|
||||
$arResult['AVAILABLE_BONUSES'] = 300; //доступно
|
||||
$arResult['TOTAL_BONUSES_COUNT'] = 600; //всего на щету
|
||||
$arResult['WILL_BE_CREDITED'] = 245; //будет начислено
|
||||
$component = $this->__component;
|
||||
$component::scaleImages($arResult['JS_DATA'], $arParams['SERVICES_IMAGES_SCALING']);
|
||||
|
||||
$currency = CurrencyLangTable::query()
|
||||
->setSelect(['FORMAT_STRING'])
|
||||
->where([
|
||||
['CURRENCY', '=', RetailcrmConfigProvider::getCurrencyOrDefault()],
|
||||
['LID', '=', 'LANGUAGE_ID'],
|
||||
])
|
||||
->fetch();
|
||||
|
||||
$arResult['BONUS_CURRENCY'] = $currency['FORMAT_STRING'];
|
||||
|
|
|
@ -572,6 +572,8 @@ if (strlen($request->get('ORDER_ID')) > 0) {
|
|||
siteID: '<?=CUtil::JSEscape($component->getSiteId())?>',
|
||||
ajaxUrl: '<?=CUtil::JSEscape($component->getPath() . '/ajax.php')?>',
|
||||
templateFolder: '<?=CUtil::JSEscape($templateFolder)?>',
|
||||
willBeCredited: '<?=$arResult['WILL_BE_CREDITED']?>',
|
||||
bonusCurrency: '<?=$arResult['BONUS_CURRENCY']?>',
|
||||
propertyValidation: true,
|
||||
showWarnings: true,
|
||||
pickUpMap: {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
namespace Intaro\RetailCrm\Model\Api\Response;
|
||||
|
||||
use Intaro\RetailCrm\Model\Api\AbstractApiModel;
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
|
||||
/**
|
||||
* Class AbstractApiResponseModel
|
||||
|
|
Loading…
Add table
Reference in a new issue