ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
define([
|
||||
'uiComponent',
|
||||
'ko',
|
||||
'Magento_Checkout/js/model/quote',
|
||||
'jquery',
|
||||
'mage/url',
|
||||
'Magento_Checkout/js/model/full-screen-loader'
|
||||
], function (Component, ko, quote, $, url, fullScreenLoader) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
defaults: {
|
||||
template: 'Lts_Checkout/additional-input',
|
||||
},
|
||||
|
||||
initObservable: function () {
|
||||
console.log('quote', quote);
|
||||
|
||||
this._super()
|
||||
.observe({otherRefNum: ko.observable(window.checkoutConfig.quoteData.other_ref_num)});
|
||||
|
||||
self = this;
|
||||
this.otherRefNum.subscribe(function (newValue) {
|
||||
const linkUrls = url.build('lts_checkout/index/savePoNumber');
|
||||
|
||||
const formKey = $("input[name=form_key]").val();
|
||||
fullScreenLoader.startLoader();
|
||||
|
||||
$.ajax({
|
||||
url: linkUrls,
|
||||
data: {poNumber : newValue},
|
||||
type: "POST",
|
||||
form_key: formKey,
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
fullScreenLoader.stopLoader();
|
||||
},
|
||||
error: function (res) {
|
||||
fullScreenLoader.stopLoader();
|
||||
},
|
||||
complete: function (res) {
|
||||
fullScreenLoader.stopLoader();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
<div class="field custom-comment">
|
||||
<label for="other_ref_num"><b data-bind="i18n: 'PO Number:'"></b></label>
|
||||
<input type="text" name="other_ref_num" maxlength="45" data-bind="value: otherRefNum" class="input-text" id="other_ref_num" />
|
||||
</div>
|
||||
Reference in New Issue
Block a user