ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,3 @@
.amasty-hide-price-button {
margin-bottom: 40px;
}
@@ -0,0 +1,48 @@
@media all and (min-width: 768px), print {
.amhideprice-form {
max-width: 700px;
width: 40%;
}
}
@media all and (max-width: 767px), print {
.amhideprice-form {
width: 80%;
}
}
.amhideprice-form {
position: relative;
padding: 30px;
vertical-align: middle;
background: #fafafa;
}
div.message.am-hide-message {
display: inline-block;
padding: 13px 70px;
}
.fancyambox-stage .amhideprice-form .legend span {
font-size: 1.8rem;
}
.amhideprice-close {
position: absolute;
top: 10px;
right: 10px;
width: 15px;
height: 15px;
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTMiIGhlaWdodD0iMTMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEgMWwxMSAxMW0wLTExTDEgMTIiIHN0cm9rZT0iI0IyQjJCMiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjwvc3ZnPg==) no-repeat center;
background-size: contain;
cursor: pointer;
}
.amhideprice-close:hover {
background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMyIgaGVpZ2h0PSIxMyIgZmlsbD0ibm9uZSI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIvPjxnIGNsYXNzPSJjdXJyZW50TGF5ZXIiPjxwYXRoIGQ9Ik0xIDFsMTEgMTFtMC0xMUwxIDEyIiBzdHJva2U9IiMxZGExZjIiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIGNsYXNzPSJzZWxlY3RlZCIvPjwvZz48L3N2Zz4=) no-repeat center;
background-size: contain;
}
a.amasty-hide-price-container {
cursor: pointer;
}
@@ -0,0 +1,43 @@
define([
'jquery',
'Magento_Ui/js/modal/modal'
], function ($) {
$.widget('mage.amhideprice', {
options: {},
_create: function () {
if (this.element) {
var parent = this.element.parents(this.options['parent']).first();
if (!parent) {
return;
}
var button = parent.find(this.options['button']),
addButton = parent.find('.actions-primary form button');
if (button && button[0]
&& (this.options['hide_addtocart'] === '1' || this.options['hide_addtocart'] === '2')
) {
button[0].outerHTML = this.options['html'];
eval($('<div>').html(this.options['html']).find('script').html());
}
if (addButton.length > 0 && this.options['hide_addtocart'] === '1') {
addButton.remove();
}
if (this.options['hide_addtocart'] === '1') {
$('[data-role="all-tocart"]').remove();
}
if (this.options['hide_compare'] === '1') {
parent.find('a.tocompare').remove();
}
if (this.options['hide_wishlist'] === '1') {
parent.find('a.towishlist').remove();
}
}
}
});
return $.mage.amhideprice;
});
@@ -0,0 +1,187 @@
define([
'jquery',
'uiClass',
'amasty-fancyambox'
], function ($, Class, fancyambox) {
var amHidePriceForm = Class.extend({
products: {},
customer: null,
selectors: {
amHidePricePopup: '[data-amhide="AmastyHidePricePopup"][data-product-id="%s"]:not(.observed)',
onClickPopup: 'observed',
amHideClosePopup: '[data-amhide-js="close-popup"]',
formClass: '.amform-form.amhideprice-form',
formId: '#amhideprice-form',
fancyBoxContainer: '.fancyambox-container .amhideprice-form',
hideProductIdName: '[name="hide_product_id"]',
hideProductId: 'hide_product_id',
productName: '.product-name',
productIdAttr: 'data-product-id',
successMessage: 'success am-hide-message',
errorMessage: 'error am-hide-message',
},
initialize: function (options) {
},
addProduct: function (product) {
this.products[product['id']] = product['name'];
this.customer = product['customer'];
this.url = product['url'];
this._createButtonObserver(product['id']);
},
_createButtonObserver: function (id) {
var self = this,
popupSelector = self._getPopupSelectorById(id);
$(popupSelector).click(function (e) {
e.stopPropagation();
self._showPopup(this);
}).addClass(
self.selectors.onClickPopup
);
$(document).on('click', self.selectors.amHideClosePopup, function () {
$.fancyambox.close();
});
},
_getPopupSelectorById: function (id) {
return this.selectors.amHidePricePopup.replace(/%s/, id);
},
_showPopup: function (element) {
var id = $(element).attr(this.selectors.productIdAttr),
form = $(this.selectors.formClass);
if (!form.length) {
form = this._getFilledForm(id);
} else {
if (form.find(this.selectors.hideProductIdName).length === 0) {
form.append(
$('<input>', {
'name': this.selectors.hideProductId,
'type': 'hidden',
'value': id
})
);
}
}
if (!form) {
console.warn('We can`t find the form for displaying. Please check your module configuration.');
}
$.fancyambox.open(form, {
touch: false
});
},
_getFilledForm: function (id) {
var form = $(this.selectors.formId),
product = this.products[id];
if (!form.length) {
return false;
}
var productName = form.find(this.selectors.productName);
if (productName && product) {
productName.html(product);
}
var productId = form.find('[name="product_id"]');
if (productId) {
productId.val(id);
}
var name = form.find('[name="name"]');
if (name && this.customer.name) {
name.val(this.customer.name);
}
var phone = form.find('[name="phone"]');
if (phone && this.customer.phone) {
phone.val(this.customer.phone);
}
var email = form.find('[name="email"]');
if (email && this.customer.email) {
email.val(this.customer.email);
}
var self = this;
form.on('submit', function (e) {
e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
var validator = $(this).validation({ radioCheckboxClosest: '.nested'});
if (validator.valid()) {
self.submitForm($(this));
}
return false;
});
return form;
},
submitForm: function (form) {
form = $(form);
var self = this;
var data = form.serialize();
this._clearForm(form);
$.ajax({
url: self.url,
data: data,
type: 'post',
dataType: 'json',
beforeSend: function () {
$(self.selectors.fancyBoxContainer).remove();
$.fancyambox.getInstance().showLoading();
},
success: function (response) {
$.fancyambox.getInstance().hideLoading();
var result = $('<div>',
{class: 'message'}
);
var html = $('<div>');
if (response.success) {
html.html(response.success).appendTo(result);
result.addClass(self.selectors.successMessage);
}
if (response.error) {
html.html(response.error).appendTo(result);
result.addClass(self.selectors.errorMessage);
}
$.fancyambox.close();
$.fancyambox.open(result);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$.fancyambox.getInstance().hideLoading();
$.fancyambox.close();
$.fancyambox.open(errorThrown);
}
});
},
_clearForm: function (form) {
var key = form.find('[name="form_key"]'),
value = key.val();
$(form)[0].reset();
key.val(value);
}
});
window.amHidePriceForm = amHidePriceForm();
return window.amHidePriceForm;
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,73 @@
/**
* Amasty swatch render mixin. Hiding simple product price that is part of configurable product
*/
define([
'jquery',
'underscore',
], function ($, _) {
'use strict';
return function (widget) {
$.widget('mage.SwatchRenderer', widget, {
options: {
selectors: {
buttons: '.box-tocart, .tocart',
dataOptionSelected: 'data-option-selected',
optionSelected: 'option-selected',
dataAttributeId: 'data-attribute-id',
attributeId: 'attribute-id'
}
},
_UpdatePrice: function () {
var $widget = this,
$selectors = $widget.options.selectors,
$product = $widget.element.parents($widget.options.selectorProduct),
$productPrice = $product.find($widget.options.selectorProductPrice),
$productButton = $product.find($selectors.buttons),
attributeClass = $widget.options.classes.attributeClass,
selectedDataOptionSelector = '.' + attributeClass + '[' + $selectors.dataOptionSelected + ']',
selectedOptionSelector = '.' + attributeClass + '[' + $selectors.optionSelected + ']',
options = _.object(_.keys($widget.optionsMap), {}),
selectedValues = [],
result,
isNotAllSelected;
$widget.element
.find(selectedDataOptionSelector + ', ' + selectedOptionSelector)
.each(function () {
var attributeId = $(this).attr($selectors.dataAttributeId)
|| $(this).attr($selectors.attributeId);
options[attributeId] = $(this).attr($selectors.dataOptionSelected)
|| $(this).attr($selectors.optionSelected);
});
for (const property in options) {
selectedValues.push(options[property]);
}
isNotAllSelected = selectedValues.some(function (element) {
return typeof element === 'undefined';
});
result = $widget._getNewPrices();
if (!isNotAllSelected) {
this._super();
}
if (result && result.finalPrice && result.finalPrice.amount === 0 && !isNotAllSelected) {
$productPrice.hide();
$productButton.hide();
} else {
$productPrice.show();
$productButton.show();
}
}
});
return $.mage.SwatchRenderer;
}
});
@@ -0,0 +1,48 @@
define([
'jquery'
], function ($) {
'use strict';
return function (widget) {
$.widget('mage.validation', widget, {
listenFormValidateHandler: function (event, validation) {
var firstActive = $(validation.errorList[0].element || []),
lastActive = $(validation.findLastActive() || validation.errorList.length && validation.errorList[0].element || []),
parent, windowHeight, successList,
noFocus = validation.currentForm.dataset.nofocus ? validation.currentForm.dataset.nofocus : false;
if (lastActive.is(':hidden')) {
parent = lastActive.parent();
windowHeight = $(window).height();
$('html, body').animate({
scrollTop: parent.offset().top - windowHeight / 2
});
}
// ARIA (removing aria attributes if success)
successList = validation.successList;
if (successList.length) {
$.each(successList, function () {
$(this)
.removeAttr('aria-describedby')
.removeAttr('aria-invalid');
});
}
// Override -- Added focus status for form to include disabling focus functionality //
if (firstActive.length && !noFocus) {
$('html, body').stop().animate({
scrollTop: firstActive.offset().top
});
firstActive.focus();
} else {
$(window).unbind('scroll');
}
// Override //
}
});
return $.mage.validation;
}
});