PageSourceSearch

https://www.ubackup.com/resource/acbn/js/store-pricing.js

js ubackup.com collected 2026-10-01 06:44:17 UTC 74,544 bytes, 1,715 lines download raw bytes

1$(function () {
2    /**
3     * 多语言【欧元】的价格配置
4     * @type {{symbol: string, format: string, decimal: string, thousand: string, precision: number}}
5     */
6    if (window.location.href.indexOf("/landing/aomei-store") > -1) {
7        // var pricingSettings = __gc.getCurrencySettings("en");
8        var pricingSettings = __gc.getCurrencySettings(__gc.currentLang);
9    } else {
10        var pricingSettings = __gc.getCurrencySettings(__gc.currentLang);
11    }
12
13    var isEpCb = false;
14    var ___k = '202306061504';
15
16    /**
17     * 配置勾选的页面样式 class
18     */
19    var pricingCheckbox = {
20        iconElem: ".pricing-cb",
21        active: "pricing-checked",
22        inactive: "pricing-unchecked",
23    };
24    /**
25     * 配置单选的页面样式 class
26     */
27    var pricingRadio = {
28        iconElem: ".pricing-radio",
29        closest: ".pricing-radios",
30        active: "pricing-checked",
31    };
32
33    let lang = window.location.pathname.substring(1).split("/")[0];
34
35    /**
36     * 配置下拉选择数量页面样式 class
37     */
38    var pricingSelect = {
39        active: "select-expanded",
40        inactive: "pricing-unchecked",
41    };
42    var $this,
43        $pin = $("[data-pin]"),
44        $header = $("#header"),
45        $body = $("body"),
46        headerHeight = $header.height();
47
48    // 解决返回缓存问题-只刷新一次
49    window.addEventListener('pageshow', function (event) {
50        if (event.persisted || window.performance && window.performance.navigation.type == 2) {
51            this.window.location.reload() //后退强制刷新
52        }
53    }, false);
54
55    function base64_encode(input) {
56        var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
57        var output = "";
58        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
59        var i = 0;
60        input = utf8_encode(input);
61        while (i < input.length) {
62            chr1 = input.charCodeAt(i++);
63            chr2 = input.charCodeAt(i++);
64            chr3 = input.charCodeAt(i++);
65            enc1 = chr1 >> 2;
66            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
67            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
68            enc4 = chr3 & 63;
69            if (isNaN(chr2)) {
70                enc3 = enc4 = 64;
71            } else if (isNaN(chr3)) {
72                enc4 = 64;
73            }
74            output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
75        }
76        return output;
77    }
78    function utf8_encode(string) {
79        string = string.replace(/\r\n/g, "\n");
80        var utftext = "";
81        for (var n = 0; n < string.length; n++) {
82            var c = string.charCodeAt(n);
83            if (c < 128) {
84                utftext += String.fromCharCode(c);
85            } else if ((c > 127) && (c < 2048)) {
86                utftext += String.fromCharCode((c >> 6) | 192);
87                utftext += String.fromCharCode((c & 63) | 128);
88            } else {
89                utftext += String.fromCharCode((c >> 12) | 224);
90                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
91                utftext += String.fromCharCode((c & 63) | 128);
92            }
93        }
94        return utftext;
95    }
96
97
98    /**
99     * 是否显示悬浮价格
100     * @param operator
101     */
102    function showPinContainer(operator) {
103        operator ? $pin.show() : $pin.hide();
104    }
105
106    /**
107     * 获取优惠后的价格
108     * @param unitPrice
109     * @param coupon
110     * @returns {number}
111     */
112    function getSaleUnitPrice(unitPrice, coupon) {
113        if (!coupon) {
114            return unitPrice;
115        }
116        var discount = discountSettings[coupon];
117        if (discount > 1) {
118            return unitPrice - discount;
119        } else if (discount > 0 && discount < 1) {
120            return unitPrice * (1 - discount);
121        }
122    }
123
124    function ___crypt(data, key) {
125        var result = "";
126        for (var i = 0; i < data.length; i++) {
127            result += String.fromCharCode(data.charCodeAt(i) ^ key.charCo
127deAt(i % key.length))
128        }
129        return result
130    }
131
132    /**
133     * 获取单个折扣(百分比或者数字)
134     * @param  coupon
135     * @returns string or false
136     */
137    function getEachSale(coupon) {
138        var discount = discountSettings[coupon];
139        var discountSymbol = {
140            en: " OFF",
141            es: " DTO.",
142        };
143        var currentDisSym = discountSymbol[__gc.showCurrentLang()] || " OFF";
144        if (!discount) {
145            return false;
146        }
147        if (discount > 1) {
148            return (discount =
149                accounting.formatMoney(discount, pricingSettings).replace(".00", "") +
150                currentDisSym);
151        } else if (discount > 0 && discount < 1) {
152            return (discount = Math.round(discount * 100) + "%" + currentDisSym);
153        }
154    }
155    /**
156     * 区分大小写
157     * 设置形如 params=VM_10;VHost=100,该值表示用户购买的产品属性
158     */
159    function urlParamsString(extraParams) {
160        // extraParams = "";
161        if (extraParams !== "" && typeof extraParams === "string") {
162            extraParams = $.parseJSON(extraParams);
163        }
164        var qs = "";
165        if (extraParams && Object.keys(extraParams).length) {
166            for (var key in extraParams) {
167                qs += ";" + key + "_" + extraParams[key];
168            }
169        }
170        if (qs === "") {
171            return qs;
172        }
173        return "&params=" + qs.substring(1);
174    }
175
176    /**
177     * 修改ga事件跟踪
178     * @param {Object} options
179     * @param {string} options.ga 原始ga跟踪
180     * @param {string} options.currentProductName 当前产品名
181     * @param {string} options.num 当前产品数量
182     * @param  jqObj   $purchaseLinkElem 要更换得jq元素
183     * @returns {string} 更新过得ga跟踪
184     */
185    function gaEvent(options, $purchaseLinkElem) {
186        if ($purchaseLinkElem.attr("onclick") && options.currentProductName) {
187            var gaEventArr = $purchaseLinkElem.attr("onclick").split(",");
188            if (options > 1) {
189                gaEventArr[2] =
190                    "'" + options.currentProductName + "X" + options.num + "'";
191            } else {
192                gaEventArr[2] = "'" + options.currentProductName + "'";
193            }
194            var ga = gaEventArr.join(",");
195            $purchaseLinkElem.attr("onclick", ga);
196        }
197    }
198
199    /**
200     * 傲梅云购买
201     *
202     */
203    function aomeiCloudClick() {
204        $("[data-param-url]").on("click", function () {
205            $("body").after(
206                '<input type="hidden" id="url-param" value="' +
207                $(this).attr("data-param-url") +
208                '">'
209            );
210        });
211    }
212
213    // accounting.formatMoney
214    /**
215     * 构建购买链接
216     * https://order.shareit.com/cart/new?vendorid=200100548&theme=200100548-9&PRODUCT[300868985]=1&COUPON1=10&sp=true&BU=1&affiliate=
217     */
218    function buildPurchaseLink(options, $purchaseLinkElem) {
219        var hasAmmActive = $purchaseLinkElem
220            .parents('[data-elem="pricing-box"]')
221            .find('[data-elem="amm-check"]')
222            .hasClass("active");
223        if (options.plink) {
224            var buildedLink = options.plink;
225        } else {
226            var settings = $.extend(
227                {
228                    theme: "200100548-9",
229                    vendorid: "200100548",
230                    sp: "true",
231                    googleTrackingAffiliate: "UBC", //这是BU网站,所以添加BU,这里值,与 https://account.mycommerce.com/Cp/Index#/tracking/edit.html 设置的 "Affiliate parameter" 相同
232                    quantity: "1",
233                    extraParams: "", //默认是空
234                },
235                options || {}
236            );
237            var purchaseLinkTpl = "https://go.ubackup.com/buy?pk[{productID}]={quantity}";
238            //add checkout.php
239            var $checkoutPhp = $('[data-checkout-php="true"]');
240            if ($checkoutPhp.length > 0) {
241                purchaseLinkTpl = "https://go.ubackup.com/buy?pk[{productID}]={quantity}";
242            }
243            //add checkout.php end
244            var buildedLink = purchaseLinkTpl
245                .replace("{productID}", settings.productID)
246                .replace("{quantity}", settings.quantity);
247            if (hasAmmActive) {
248                // addAMM
249                buildedLink += "&pk[169]=" + settings.quantity;
250            }
251            if ($("[data-pricing-vmlink]").data("pricingVmlink")) {
252                settings.vmlinkCoupon
253                    ? (buildedLink += "&cp=" + settings.vmlinkCoupon)
254                    : "";
255            } else if (settings.coupon != null) {
256                buildedLink += "&cp=" + settings.coupon;
257            }
258            options.ep ? "" : (buildedLink += "&pc=1");
259            options.ep ? (buildedLink += "&ep=cb") : ""; //cb link
260            // vmlink > 0 ? (buildedLink += "&showpricescale=false") : "";
261            if ($purchaseLinkElem.hasClass("vmlink")) {
262                buildedLink += "&showpricescale=false";
263                buildedLink += "&lc=true";
264            } else {
265                // vmlink > 0 ? (buildedLink += "&showpricescale=false") : "";
266            }
267        }
268        if (options.extraParams) {
269            buildedLink +=
270                urlParamsString(options.extraParams) + ":" + options.productID;
271        }
272        if (options.isAttrUrl) {
273            // aomei cloud
274            $purchaseLinkElem.attr({
275                "data-param-url": buildedLink,
276                href: "javascript:void(0)",
277            });
278        } else {
279            // other product
280            $purchaseLinkElem
281                .attr({
282                    href: buildedLink,
283                })
284                .removeAttr("data-param-url");
285        }
286        aomeiCloudClick();
287    }
288    function calcSavePrice(salePrice) {
289        var txt = {
290            en: "Save ",
291            de: "gespart: ",
292            fr: "Économiser ",
293            jp: "値下げ: ",
294            tw: "優惠",
295            it: "Risparmia ",
296            es: "Ahorra ",
297        };
298        var _txt = txt["en"];
299        if (!txt.hasOwnProperty(__gc.currentLang)) {
300            _txt = txt["en"];
301        } else {
302            _txt = txt[__gc.currentLang];
303        }
304        return _txt + accounting.formatMoney(salePrice, pricingSettings);
305    }
306
307    // 格式化将货币符号和数字分开
308    function formatAnotherPrice(number) {
309        var _salePricePre = accounting.formatMoney(number, pricingSettings);
310        var _salePriceNumber = _salePricePre.replace(pricingSettings.symbol, "");
311        var _salePriceOther = pricingSettings.format
312            .replace(
313                "%s",
314                '<span class="symbol">' + pricingSettings.symbol + "</span>"
315            )
316            .replace("%v", '<span class="num">' + _salePriceNumber + "</span>");
317        return _salePriceOther;
318    }
319
320    function formatAnotherNewPrice(number) {
321        var $salePriceElemSplit = accounting
322            .formatMoney(number, pricingSettings)
323            .replace(pricingSettings.symbol, "")
324            .split(pricingSettings.decimal);
325        var $salePriceElemSym = $salePriceElemSplit[0].replace(
326            pricingSettings.symbol,
327            ""
328        );
329        var $salePriceElemDec = $salePriceElemSplit[1];
330        $salePriceElemDec == undefined
331            ? ($salePriceElemDec = "")
332            : ($salePriceElemDec = $salePriceElemDec);
333        var $salePriceDecimal = $salePriceElemDec
334            ? pricingSettings.decimal + $salePriceElemDec
335            : "";
336        var salePriceElemHtml = "";
337        if (__gc.showCurrentLang() == "tw" || __gc.showCurrentLang() == "en") {
338            salePriceElemHtml =
339                '<span class="currency">' +
340                pricingSettings.symbol +
341                "</span>" +
342                '<span class="integer f-fs40">' +
343                $
344                +
345                "</span>" +
346                '<span class="decimal">' +
347                $salePriceDecimal +
348                "</span>";
349        } else {
350            salePriceElemHtml =
351                '<span class="integer f-fs40">' +
352                "</span>" +
353                '<span class="decimal">' +
354                $salePriceDecimal +
355                "</span>" +
356                '<span class="currency">' +
357                pricingSettings.symbol +
358                "</span>";
359        }
360        return salePriceElemHtml;
361    }
362    /**
363     * 设置价格,构建购买链接
364     * @param state
365     * @param quantity
366     */
367    function setPrice(productData, state, quantity, index, $el) {
368        var $elem = $el.closest("[data-pricing-product]"); //获取最外层的购买元素
369        var $purchaseLinkElem = $elem.find('[data-pricing-link="true"]'); //购买链接元素
370        var $priority_coupon = $elem.attr("data-priority"); //获取是否存在 data-priority-coupon 属性
371        var isEpCb =
372            $elem.attr("data-ep") === "cb" ||
373            productData[state].purchasePlatform === "cb"; //获取是否是cb链接
374        var isAttrUrl = state === "uncheckedCloud" || false; // 是否将购买链接添加到data-url-param上
375        var $limit = $elem.find('[data-toplimit="no"]'); // 存在就表示没有上限
376        // 如果存在 link 属性
377        var plink = productData[state]["plink"]; //
378        var unitPrice = productData[state]["unitPrice"]; //销售原价的单价
379        var productID = productData[state]["productID"]; //产品ID
380        var totalPrice = unitPrice * quantity; //销售单价 * 数量 => 销售的总价
381        var totalPrice2 = accounting.formatMoney(totalPrice, pricingSettings);
382        var truecoupon = $elem.attr("data-turecoupon"); //获取ture-coupon  链接显示 cp=
383        var vmlinkCoupon = productData[state][truecoupon];
384        if (
385            $priority_coupon &&
386            typeof productData[state][$priority_coupon] !== "undefined"
387        ) {
388            //如果使用了优先折扣码
389            var coupon =
390                $limit.length > 0
391                    ? productData[state][$priority_coupon][0]
392                    : productData[state][$priority_coupon][index - 1]; //优先使用的折扣码
393        } else {
394            var coupon = productData[state]["coupon"][index - 1]; //coupon信息
395        }
396        var saleUnitPrice = getSaleUnitPrice(unitPrice, coupon); //优惠后的销售单价
397        var saleTotalPrice = saleUnitPrice * quantity; //销售总价
398        var eachSale = getEachSale(coupon); //单个优惠或优惠比
399        var salePrice = unitPrice * quantity - saleTotalPrice; //总优惠
400        var $salePriceElem = $elem.find('[data-pricing-for="sale-price"]'); //优惠后的销售总价
401        var $salePriceElemOther = $elem.find(
402            '[data-pricing-for="sale-price-other"]'
403        ); //优惠后的销售总价
404        var $salePriceElemNewOther = $elem.find(
405            '[data-pricing-for="sale-price-new"]'
406        ); //优惠后的销售总价
407        var $saleUnitPriceElem = $elem.find('[data-pricing-for="sale-unit-price"]'); //优惠后的销售单价
408        var $totalPriceElem = $elem.find('[data-pricing-for="total-price"]'); //销售总价
409        var $eachSaleElem = $elem.find('[data-pricing-for="each-save"]'); //单个优惠或优惠比
410        var $salePrice = $elem.find('[data-pricing-for="save-price"]'); //总优惠
411        var $totalPriceElem2 = $elem.find('[data-pricing-for="total-price2"]'); //amm加其他产品,总价显示为 $0.0 + $0.0
412        var hasAmmActive = $el
413            .parents('[data-elem="pricing-box"]')
414            .find('[data-elem="amm-check"]')
415            .hasClass("active"); // addAMM
416        var ggClick =
417            $purchaseLinkElem.attr("onclick") &&
418            $purchaseLinkElem.attr("onclick").split(",");
419        var str = ggClick && ggClick[2] && ggClick[2].replace(/\'/g, "");
420        var oldstr = str && ggClick && str.split("+")[0];
421        if (hasAmmActive) {
422            // addAMM
423            var multiPrice = {
424                de: 1699,
425                en: 1499,
426                fr: 1699,
427                jp: 209980,
428                pt: 1299,
429                tw: 49699,
430                it: 1699,
431                es: 1699,
432                pl: 1269,
433                nl: 1269,
434            };
435            var couponobj = {
436                551: 0.5,
437                553: 0.4,
438                552: 0.45,
439                428: 0.4,
440            };
441            // var extrPrice = 0;
442            var extrPrice = multiPrice[__gc.currentLang] || multiPrice["en"];
443            coupon = "553";
444            var couponRate = 0.4;
445            if (__gc.showCurrentLang() === "de") {
446                var $topParent = $el.parents('[data-elem="pricing-box"]');
447                coupon = !$topParent.find(".pricing-cb").hasClass("pricing-checked")
448                    ? "428"
449                    : "552"; // 当前版折扣428,终身版折扣552
450                couponRate = couponobj[coupon];
451                couponRatePercentage = Math.round(couponRate * 100);
452                $topParent
453                    .find('[data-elem="amm-product"] .bottom strong')
454                    .text(couponRatePercentage);
455            } else if (/es|it|en|fr|tw/.test(__gc.showCurrentLang())) {
456                var $amm = $el
457                    .parents('[data-elem="pricing-box"]')
458                    .find('[data-elem="amm-product"]');
459                if (__gc.showCurrentLang() == "en" || __gc.showCurrentLang() == "tw") {
460                    coupon = $amm.attr("data-coupon") || "553";
461                    couponRate = couponobj[coupon] || 0.4;
462                } else {
463                    coupon = $amm.attr("data-coupon") || "552";
464                    couponRate = couponobj[coupon] || 0.55;
465                }
466            }
467            if (window.location.pathname === "/de/purchase.html") {
468                var $amm = $el
469                    .parents('[data-elem="pricing-box"]')
470                    .find('[data-elem="amm-product"]');
471                if (__gc.showCurrentLang() == "en" || __gc.showCurrentLang() == "tw") {
472                    coupon = $amm.attr("data-coupon") || "553";
473                    couponRate = couponobj[coupon] || 0.4;
474                } else {
475                    coupon = $amm.attr("data-coupon") || "552";
476                    couponRate = couponobj[coupon] || 0.55;
477                }
478            }
479            if (isNaN(coupon)) {
480                var couponArr = productData["checked"][coupon];
481                var couponIndex = index - 1 || 0;
482                couponRate = discountSettings[couponArr[couponIndex]];
483                coupon = couponArr[couponIndex];
484            }
485            totalPrice = unitPrice * quantity + extrPrice * quantity;
486            saleUnitPrice = getSaleUnitPrice(unitPrice, coupon);
487            saleTotalPrice =
488                (unitPrice * quantity + extrPrice * quantity) * (1 - couponRate); //销售总价
489            salePrice = unitPrice * quantity + extrPrice * quantity - saleTotalPrice; //总优惠
490            eachSale = getEachSale(coupon);
491            totalPrice2 =
492                accounting.formatMoney(unitPrice * quantity, pricingSettings) +
493                "+" +
494                accounting.formatMoney(extrPrice, pricingSettings);
495            if (ggClick) {
496                str = "'" + oldstr.trim() + " + AMM'";
497                ggClick[2] = str;
498            }
499        } else {
500            if (ggClick) {
501                ggClick[2] = "'" + oldstr + "'";
502            }
503        }
504        if (ggClick) {
505            $purchaseLinkElem.attr("onclick", ggClick.join(","));
506        }
507        // 在页面上显示价格和一些购买相关的信息 begin
508        $salePriceElemOther.html(formatAnotherPrice(saleTotalPrice)); // 货币符号和价格分开的格式
509        $salePriceElem.html(
510            accounting.formatMoney(saleTotalPrice, pricingSettings)
511        );
512        $salePriceElemNewOther.html(formatAnotherNewPrice(saleTotalPrice));
513        saleTotalPrice !== totalPrice
514            ? $totalPriceElem.html(
515                accounting.formatMoney(totalPrice, pricingSettings)
516            )
517            : $totalPriceElem.html("");
518        $saleUnitPriceElem.length > 0 &&
519            $saleUnitPriceElem.html(
520                accounting.formatMoney(saleUnitPrice, pricingSettings)
521            );
522        salePrice
523            ? $eachSaleElem.html(eachSale).removeClass("not-save")
524            : $eachSaleElem.html("").addClass("not-save");
525        // 表格上方的折扣显示
526        $eachSaleElem.data("anotherlocation")
527            ? $("[data-anotherlocation]").html(eachSale)
528            : "";
529        salePrice > 0
530            ? $salePrice.html(calcSavePrice(salePrice))
531            : $salePrice.html("");
532        saleTotalPrice !== totalPrice
533            ? $totalPriceElem2.html(totalPrice2)
534            : $totalPriceElem2.html("");
535        // 在页面上显示价格和一些购买相关的信息 end
536        // 设置购买链接
537        buildPurchaseLink(
538            {
539                productID: productID,
540                coupon: coupon,
541                quantity: quantity,
542                plink: plink,
543                ep: isEpCb,
544                extraParams: $elem.attr("data-params") || "", // 购买平台,默认是不添加平台
545                isAttrUrl: isAttrUrl, //aomei cloud used
546                vmlinkCoupon: vmlinkCoupon,
547            },
548            $purchaseLinkElem
549        );
550        // 更新ga跟踪
551        gaEvent(
552            {
553                currentProductName: productData[state]["name"],
554                num: quantity,
555            },
556            $purchaseLinkElem
557        );
558    }
559
560    /**
561     * set url params
562     * data-params
563     * one product with a data-params of json
564     * one or more keys in one data-params of json, and update by data-pricing-product
565     */
566    function setUrlParams($outer) {
567        var $paramsElems = $outer.find("[data-param]");
568        if ($paramsElems.length > 0) {
569            var paramsJson = $.parseJSON($outer.attr("data-params"));
570            if ($paramsElems.length > 0) {
571                $paramsElems.each(function (i) {
572                    var paramKey = $paramsElems.eq(i).attr("data-param");
573                    if (typeof paramsJson[paramKey] !== "undefined") {
574                        paramsJson[paramKey] = parseInt($paramsElems.eq(i).val());
575                    }
576                });
577            }
578            $outer.attr("data-params", JSON.stringify(paramsJson));
579        }
580    }
581
582    /**
583     * 增减数量
584     */
585    function scaleProperty($this, propertyPriceData, type, propertyProductData, couponCode, val) {
586        var key = getPropertyItemName($this);
587        var $property = $this.closest('[data-property-itemname]');
588        var $scaleQuantityElem = $property.find('[data-incr-elem="true"] input');
589        var $propertyBox = $this.closest('[data-pricing-product]');
590        var $scalePriceItemElem = $property.find('[data-property-price="true"]');
591        var currentNum = parseInt($scaleQuantityElem.val());
592        var propertyPrice = typeof propertyPriceData[key] !== 'undefined' ? propertyPriceData[key] : false;
593        var coupon = $propertyBox.attr('data-priority') || false;
594        var couponDiscount = 0;
595
596        if (!propertyPrice) {
597            console.info('Key ' + key + ' does not exist in propertyPriceData.');
598            return false;
599        }
600
601        if (propertyPrice.hasOwnProperty('step') && propertyPrice['step']) {
602            var num = getScaleNum(propertyPrice, currentNum, type);
603            if (type == '-') {
604                if (num < val) {
605                    num = 0
606                }
607            } else {
608                if (num != 0 && num < val) {
609                    num = val
610                }
611            }
612            setScaleQuantity(propertyPrice, num, $scaleQuantityElem);
613
614            // 单个属性的总价
615            var protertyPriceArray = getPropertyPriceByName(propertyPrice, key, num, coupon);
616            var protertyTotalPrice = protertyPriceArray[0];
617            var protertySalePrice = protertyPriceArray[1];
618            couponDiscount = protertyPriceArray[2];
619            couponCode = protertyPriceArray[3];
620            var propertyVPrice = protertyPriceArray[3];
621            var isPerpetual = propertyPrice['isPerpetual'];
622            //如果倒计时了,_coupon = false;
623
624            var _coupon = $('body').hasClass('timeout') ? false : undefined;
625            setPropertyPriceDom($scalePriceItemElem, protertyTotalPrice, isPerpetual, coupon, protertySalePrice, couponDiscount, num, propertyVPrice);
626            setPropertyProductValue($propertyBox, propertyPriceData, propertyProductData, _coupon);
627        }
628
629    }
630    /**
631     * 根据页面来源展示对应的卡片
632     */
633    function showCardByReferrer() {
634        var refsPos = {
635            "enterprise/sql-backup.html": "SQLServer",
636            "enterprise/vmware-backup.html": "VM",
637            "enterprise/hyper-v-backup.html": "VM",
638        };
639        var $propertyItemDm = $('[data-property-itemname]');
640        $propertyItemDm.find('[data-option="true"]').prop('checked', true);
641        var $inputListen = $propertyItemDm.find('[data-input="listen"]');
642        $inputListen.each(function () {
643            var $this = $(this);
644            var v = $this.val();
645            $this.val(v).trigger('blur');
646        });
647
648        var prevod = window.location.href;
649        var refs = /[?&]prevod=([^&]+)/.exec(prevod);
650        var ref = null;
651        var delimiter = ':';
652        if (refs && typeof refs[1] !== 'undefined') {
653            ref = decodeURIComponent(refs[1]);
654            if (ref.indexOf(delimiter) !== -1) {
655                ref = ref.split(delimiter)[0];
656            }
657
658            ref = ref.replace('.html', '') + '.html';
659
660            if (/^\//.test(ref)) {
661                ref = ref.substring(1);
662            }
663        } else {
664            var docRef = document.referrer;
665            ref = docRef.replace('https://' + window.location.host + '/', '');
666        }
667
668        if (refsPos.hasOwnProperty(ref)) {
669            var $propertyItemBox = $('[data-property---name="' + refsPos[ref] + '"]');
670
671            if (refsPos[ref].indexOf(',') > -1) {
672                var t = refsPos[ref].split(',');
673                var p = '';
674                for (var i = 0; i < t.length; i++) {
675                    p += ',[data-property---name="' + t[i] + '"]';
676                }
677                $propertyItemBox = $(p.substring(1));
678            }
679
680            if ($propertyItemBox.length > 0) {
681                // $propertyItemBox.siblings().find('[data-mutiple-property="true"]').prop('checked', false);
682                $propertyItemBox.siblings().find('[data-input="listen"]').val(0).trigger('blur');
683            }
684        }
685    }
686
687    /**
688     * 获取增减的数量
689     * @param propertyPrice
690     * @param currentNum
691     * @param type
692     * @returns {*|number}
693     */
694    function getScaleNum(propertyPrice, currentNum, type) {
695
696        if (type === '+' || type === '-') {
697            var step = parseInt(propertyPrice['step']);
698            var num = type === '+' ? (step + currentNum) : (currentNum - step);
699            var max = typeof propertyPrice['max'] !== 'undefined' ? parseInt(propertyPrice['max']) : false;
700            var min = typeof propertyPrice['min'] !== 'undefined' ? parseInt(propertyPrice['min']) : 0;
701
702            if (num <= min) {
703                num = min;
704            }
705        } else {
706            num = currentNum;
707        }
708
709        return num;
710    }
711
712
713
714    /**
715     * 有属性的产品时,设置其相关链接
716     */
717    function setPropertyProductLink($buyLinkElem, propertyProductData, paramsString, dynamicParamsString) {
718        var pId = propertyProductData['pId'];
719        var params = '';
720        var couponCode = typeof propertyProductData['couponCode'] !== 'undefined' && propertyProductData['couponCode'] ? propertyProductData['couponCode'] : '';
721        if (typeof paramsString !== 'undefined' && paramsString) {
722            params = '&params=' + paramsString + ':' + pId;
723        }
724
725        var link = 'https://go.ubackup.com/buy?pk[' + pId + ']=1&ep=cb&sps=false&lc=true';
726        if (typeof couponCode !== 'undefined' && couponCode) {
727            link += '&cp=' + couponCode;
728        } else {
729            link += '&cp=vt-code';
730        }
731
732        link += params;
733
734        // TODO:// 设置动态价格链接
735        dynamicParamsString = encodeURIComponent(base64_encode(encodeURIComponent(dynamicParamsString)));
736        link += '&dpr=' + dynamicParamsString;
737
738        $buyLinkElem.attr('href', link);
739    }
740
741    /**
742     * 设置属性对应数量
743     * @param propertyPrice
744     * @param num
745     * @param $scaleQuantityElem
746     */
747    function setScaleQuantity(propertyPrice, num, $scaleQuantityElem) {
748
749        num = parseInt(num);
750        var $box = $scaleQuantityElem.closest('[data-property-itemname]');
751
752        $scaleQuantityElem.val(num);
753        $box.find('[data-mutiple-property="true"]').prop('checked', num > 0);
754    }
755
756    /**
757     * 通过属性名称+数量,获取对应的属性的总价
758     * @param propertyPrice
759     * @param name
760     * @param num
761     * @param coupon
762     * @returns [{number}]
763     */
764    function getPropertyPriceByName(propertyPrice, name, num, coupon, discount, data) {
765        // 单个属性的总价
766        var step = parseInt(propertyPrice['step']);
767        var index = Math.floor(num / step);
768        var protertyTotalPrice = 0;
769        var _totalProductValue = 0;
770        var protertySalePrice = 0;
771        var couponDiscount = 0;
772        // 多语言的阶梯型加价
773        ProductIncreaseData = [
774            {
775                name: "en/fr/de/es/it", year_vm: 14, year_SQLServer: 5, year_PC: 8, year_Server: 50,
776                lifelong_vm: 34, lifelong_SQLServer: 14, lifelong_PC: 22, lifelong_Server: 150
777            },
778            {
779                name: "jp", year_vm: 2100, year_SQLServer: 750, year_PC: 1200, year_Server: 7500,
780                lifelong_vm: 5000, lifelong_SQLServer: 2100, lifelong_PC: 3300, lifelong_Server: 22500
781            },
782            {
783                name: "tw", year_vm: 450, year_SQLServer: 160, year_PC: 260, year_Server: 1700,
784                lifelong_vm: 1100, lifelong_SQLServer: 450, lifelong_PC: 710, lifelong_Server: 4799
785            }
786        ]
787        let langIncreaseData = ProductIncreaseData.find(item => item.name == lang)
788        langIncreaseData == undefined ? langIncreaseData = ProductIncreaseData[0] : ''
789        if (propertyPrice.hasOwnProperty('oneTimePayment') && propertyPrice['oneTimePayment']) {
790            _totalProductValue = protertyTotalPrice = propertyPrice['oneTimePayment'];
791
792            if (coupon) {
793                protertySalePrice = propertyPrice['couponLevel'];
794                couponDiscount = propertyPrice['couponDiscount'];
795            }
796        } else {
797            var valueKey = getPriceDataPropertyRangeIndex(propertyPrice, index, num, name);
798            protertyTotalPrice = parseFloat(propertyPrice['value'][valueKey]) * num;
799            _totalProductValue = parseFloat(propertyPrice['value'][0]) * num;
800            let endprotertyTotalPrice = parseFloat(propertyPrice['value'][19]) * 20;
801            let endSeverTotalPrice = parseFloat(propertyPrice['value'][9]) * 10;
802            if ($('.box-wrap').is(':visible')) {
803                if (name == 'VM' && num > 20) {
804                    protertyTotalPrice = endprotertyTotalPrice + ((num - 20) * langIncreaseData.year_vm);
805                }
806                if (name == 'SQLServer' && num > 20) {
807                    protertyTotalPrice = endprotertyTotalPrice + ((num - 20) * langIncreaseData.year_SQLServer);
808                }
809                if (name == 'PC' && num > 20) {
810                    protertyTotalPrice = endprotertyTotalPrice + ((num - 20) * langIncreaseData.year_PC);
811                }
812                if (name == 'Server' && num > 10) {
813                    protertyTotalPrice = endSeverTotalPrice + ((num - 10) * langIncreaseData.year_Server);
814                }
815            } else {
816                if (name == 'VM' && num > 20) {
817                    protertyTotalPrice = endprotertyTotalPrice + ((num - 20) * langIncreaseData.lifelong_vm);
818                }
819                if (name == 'SQLServer' && num > 20) {
820                    protertyTotalPrice = endprotertyTotalPrice + ((num - 20) * langIncreaseData.lifelong_SQLServer);
821                }
822                if (name == 'PC' && num > 20) {
823                    protertyTotalPrice = endprotertyTotalPrice + ((num - 20) * langIncreaseData.lifelong_PC);
824                }
825                if (name == 'Server' && num > 10) {
826                    protertyTotalPrice = endSeverTotalPrice + ((num - 10) * langIncreaseData.lifelong_Server);
827                }
828            }
829            if (coupon) {
830                // protertySalePrice = parseFloat(propertyPrice['couponLevel'][valueKey]) * num;
831                // couponDiscount = parseFloat(propertyPrice['couponDiscount'][valueKey]);
832            }
833        }
834        return [protertyTotalPrice, protertySalePrice, couponDiscount, _totalProductValue];
835    }
836    function getPriceDataPropertyRangeIndex(propertyPrice, index, num, name) {
837        var maxLen = propertyPrice['value'].length;
838        if (index >= maxLen) {
839            index = maxLen;
840        }
841
842        var valueKey = index - 1;
843        if (valueKey <= 0) {
844            valueKey = 0;
845        }
846
847        if (propertyPrice.hasOwnProperty('range') && propertyPrice['range']) {
848
849            for (var i = 0; i < propertyPrice['range'].length; i++) {
850                var isNumber = /^\d+$/.test(propertyPrice['range'][i]);
851
852                if (isNumber) {
853                    var max = propertyPrice['range'][i];
854                    var min = propertyPrice['range'][i];
855                } else {
856                    var min = propertyPrice['range'][i][0];
857                    var max = propertyPrice['range'][i][1];
858                }
859
860                if (num >= min && num <= max) {
861                    valueKey = i;
862                    break;
863                }
864            }
865        }
866
867        return valueKey;
868    }
869
870    /**
871     * 设置产品所所有属性价格
872     */
873    function setPropertyProductValue($propertyBox, propertyPriceData, propertyProductData, _coupon, cc) {
874        var $propertyItems = $propertyBox.find('[data-property-itemname]');
875        var $dynamicParamsElem = $propertyBox.find('[data-pricing-attrs="name"]');
876        // var $dynamicParamsElem = $propertyBox.find('[data-pricing-product="name"]');
877
878        var $buyLinkElem = $propertyBox.find('[data-pricing-link="true"]');
879        var propertyProductTotalPrice = 0;
880        var propertyProductSalePrice = 0;
881        var propertyVPrice = 0;
882        var isPerpetual = false;
883        var paramsString = '';
884        var showParamsString = '';// 在购物车中展示的实际的文字
885        var coupon = _coupon || $propertyBox.attr('data-discount-apply') || false;
886        var couponDiscount = couponCode = '';
887        var $propertyPriceElem = $this.find('[data-property-price="true"]');
888        var isPermanent = false// year or 永久
889        $propertyBox.attr('data-pricing-product') == 'ACBN_Customized_Perpetual' ? isPermanent = true : isPermanent = false
890        $propertyBox.attr('data-pricing-product') == 'ACBN_Unlimited_Yearly' ? coupon = 'coupon' : coupon = ''
891        $propertyItems.each(function (i, el) {
892            var $this = $(this);
893            var isChecked = parseInt($this.find('[data-input="listen"]').val()) > 0 || $this.find('[data-mutiple-property="true"]').is(':checked');
894            var name = $this.attr('data-property-itemname');
895            var $propertyBox = $this.closest('[data-pricing-product]');
896            var _name = $this.attr('data-property---name');
897            var propertyPrice = propertyPriceData[name];
898            var $input = $this.find('[data-incr-elem="true"] input');
899            var inputNum = $input.length > 0 ? parseInt($input.val()) : 0;
900
901
902            if (isChecked) {
903                if (propertyPrice.hasOwnProperty('isPerpetual') && propertyPrice['isPerpetual']) {
904                    isPerpetual = propertyPrice['isPerpetual'];
905                }
906
907                var propertyProuctPriceArray = getPropertyPriceByName(propertyPrice, name, inputNum, coupon, isPermanent);
908                propertyProductTotalPrice += propertyProuctPriceArray[0];
909                propertyProductSalePrice += propertyProuctPriceArray[1];
910                couponDiscount = propertyProuctPriceArray[2];
911                propertyVPrice += propertyProuctPriceArray[3];
912
913                if (inputNum) {
914                    paramsString += ';' + name + '_' + inputNum;
915                    showParamsString += ';' + _name + '_' + inputNum;
916                } else if (propertyPrice.hasOwnProperty('count') && propertyPrice['count']) {
917                    paramsString += ';' + name + '_' + propertyPrice['count'];
918                    showParamsString += ';' + _name + '_' + propertyPrice['count'];
919                }
920
921            } else {
922                propertyProductTotalPrice += 0;
923                paramsString += '';
924                showParamsString += '';
925            }
926
927        });
928
929        if (/^;/.test(paramsString)) {
930            paramsString = paramsString.substring(1);
931            showParamsString = showParamsString.substring(1);
932        }
933
934        if (paramsString === '') {
935            $buyLinkElem.closest('[data-pricing-product]').find('[data-mutiple-property="true"]').prop('checked', false);
936            $buyLinkElem.attr('disabled', 'disabled');
937        } else {
938            $buyLinkElem.removeAttr('disabled');
939        }
940
941        var $propertyProductElem = $propertyBox.find('[data-pricing-for="total-property"]');
942        var dynamicParamsText = $dynamicParamsElem.text();
943        var dynamicParamsString = dynamicParamsText.replace(/(^\s+|\s+$)/, '', dynamicParamsText);
944
945        setPropertyProductDom($propertyProductElem, propertyProductTotalPrice, isPerpetual,
946            coupon, propertyProductSalePrice, (1 - propertyProductSalePrice / propertyVPrice), propertyVPrice, cc, isPermanent);
947        // ======================================================
948        var settings = {
949            symbol: '$',
950            format: '%v',
951            decimal: '.',
952            thousand: ',',
953            precision: 2,
954            grouping: 3
955        };
956        var propertyProductSalePrice
957        var discount = 0
958        switch (cc) {
959            case 2:
960                discount = 1
961                break;
962            case 3:
963                discount = 2
964                break;
965            case 4:
966                discount = 3
967                break;
968        }
969        if (langNetWork) {
970            coupon = "coupon",
971                discount = 3,
972                isPermanent = false
973        }
974        if (isPermanent) {
975            var propertyProductSalePrice = (accounting.formatMoney(propertyProductTotalPrice, settings).replace(',', '') - 0).toFixed(2) - 0;
976        } else {
977            var propertyProductSalePrice = (accounting.formatMoney(propertyProductTotalPrice * Number(1 - discount / 10), settings).replace(',', '') - 0).toFixed(2) - 0;
978        }
979        // ======================================================
980
981        var sym = (lang == "de" || lang == "fr" || lang == "es" || lang == "it") ? "EUR" : "USD"
982        if (lang == "jp") {
983            sym = "JPY"
984        }
985        if (lang == "tw") {
986            sym = "TWD"
987        }
988        var dynamicJson = { "tp": propertyProductTotalPrice, "sp": propertyProductSalePrice, "vp": propertyVPrice, "cc": sym, "dps": dynamicParamsString, "sps": showParamsString, "is_cp": coupon };
989        if (langNetWork) {
990            var dynamicJson = { "tp": propertyProductTotalPrice, "sp": propertyProductSalePrice, "vp": propertyProductTotalPrice, "cc": sym, "dps": dynamicParamsString, "sps": showParamsString, "is_cp": coupon };
991        }
992        setPropertyProductLink($buyLinkElem, propertyProductData, paramsString, JSON.stringify(dynamicJson));
993        // (propertyProductSalePrice <= 0 ? propertyProductTotalPrice : propertyProductSalePrice)
994        // + '|USD|' + dynamicParamsString + '|' + showParamsString+'|'+propertyVPrice;
995    }
996
997    function setPropertyProductDom($propertyProductElem, totalPropertyProductPrice, isPerpetual, coupon, salePropertyProductPrice, couponDiscount, propertyVPrice, cc, isPermanent) {
998        langArr = [
999            { "name": "fr", "Symbol1": "/&nbspAn", "Symbol2": "/&nbspPerpétuel" },
1000            { "name": "de", "Symbol1": "/&nbspJahr", "Symbol2": "/&nbspDauerhaft" },
1001            { "name": "tw", "Symbol1": "/&nbsp年", "Symbol2": "/&nbsp终身" },
1002            { "name": "es", "Symbol1": "&nbsp/&nbspAño", "Symbol2": "&nbsp/&nbspPerpetua" },
1003            { "name": "it", "Symbol1": "/&nbspAnno", "Symbol2": "/&nbspPerpetuo" },
1004            { "name": "jp", "Symbol1": "/&nbsp年間", "Symbol2": "/&nbsp無期限" },
1005            { "name": "en", "Symbol1": "/&nbspYear", "Symbol2": "/&nbspPerpetual" },
1006            { "name": "landing", "Symbol1": "/&nbspYear", "Symbol2": "/&nbspPerpetual" },
1007            { "name": "store.html", "Symbol1": "/&nbspYear", "Symbol2": "/&nbspPerpetual" },
1008            { "name": "enterprise", "Symbol1": "/&nbspYear", "Symbol2": "/&nbspPerpetual" },
1009        ]
1010        // 多语言区分
1011        let endLangs = langArr.find(item => item.name == lang)
1012        endLangs == undefined ? endLangs = { "name": "en", "Symbol1": "/&nbspYear", "Symbol2": "/&nbspPerpetual" } : '';
1013        var propertyPriceValueArray = [0, 0, 0];
1014        let discount = 0
1015        switch (cc) {
1016            case 2:
1017                discount = 1
1018                break;
1019            case 3:
1020                discount = 2
1021                break;
1022            case 4:
1023                discount = 3
1024                break;
1025        }
1026        // 这对万圣节活动
1027        if (langNetWork) {
1028            langNetWork ? couponDiscount = 0.3 : '',
1029                coupon = "coupon",
1030                discount = 3
1031        }
1032        if (isPermanent) {
1033            var propertyProductTotalPrice = accounting.formatMoney(totalPropertyProductPrice, pricingSettings);
1034        } else {
1035            var propertyProductTotalPrice = accounting.formatMoney(totalPropertyProductPrice * Number(1 - discount / 10), pricingSettings);
1036        }
1037        if(pricingSettings.symbol == "円"){
1038        var propertyProductSalePrice = accounting.formatMoney((totalPropertyProductPrice * Number(1 - discount / 10))*1.1, pricingSettings)
1039
1040        }else{
1041            var propertyProductSalePrice = accounting.formatMoney(totalPropertyProductPrice * Number(1 - discount / 10), pricingSettings)
1042
1043        }
1044        var VProductSalePrice = accounting.formatMoney(propertyVPrice, pricingSettings);
1045        var couponDiscountText = '';
1046        if (coupon) {
1047            propertyPriceValueArray = propertyProductSalePrice.split(pricingSettings.decimal);
1048        } else {
1049            propertyPriceValueArray = propertyProductTotalPrice.split(pricingSettings.decimal);
1050        }
1051        if (pricingSettings.symbol !== "円" && pricingSettings.symbol !== "NT$") {
1052            var isSymbol = pricingSettings.symbol
1053            propertyPriceValueArray[1].indexOf(pricingSettings.symbol) !== -1 ? isSymbol = '' : isSymbol = pricingSettings.symbol
1054        }
1055        var html = '<strong class="price-current">\n'
1056        if (pricingSettings.symbol == "NT$") {
1057            var isSymbol = pricingSettings.symbol
1058        }
1059        pricingSettings.symbol == "円" ? html += '<span class="integer f-fs40">\n' + propertyProductSalePrice.replace(pricingSettings.symbol, "") + '</span>' : html += '<span class="currency">' + isSymbol + '</span>\n' + '<span class="integer f-fs40">\n' + propertyPriceValueArray[0].replace(pricingSettings.symbol, "") + '</span>';
1060
1061        html += '<span class="sub1">';
1062        if (!isPerpetual && !isPermanent) {
1063            html += '<span class="subtype">\n';
1064            html += '<small class="txt">' + endLangs.Symbol1 + '</small>\n';
1065            html += '</span>';
1066        } else {
1067            html += '<span class="subtype">\n';
1068            html += '<small class="txt">' + endLangs.Symbol2 + '</small>\n';
1069            html += '</span>';
1070        };
1071        if (pricingSettings.symbol == "NT$") {
1072            html += '<span class="decimal"><span class="currency"></span>\n' + '</span>'
1073        } else {
1074            pricingSettings.symbol == "円" ? html += '<span class="decimal"><span class="currency">' + pricingSettings.symbol + '</span>\n' + '</span>' : html += '<span class="decimal">' + pricingSettings.decimal + propertyPriceValueArray[1] + '<span class="currency"></span>\n' + '</span>';
1075        }
1076        html += '</span>';
1077        if (coupon && !Number.isNaN(couponDiscount)) {
1078            if (couponDiscount <= 1) {
1079                couponDiscountText = Math.round(couponDiscount * 100) + '%';
1080            } else {
1081
1082                couponDiscountText = '-' + Math.abs(couponDiscount);
1083            }
1084            if (cc > 1) {
1085                couponDiscountText = Math.round(discount * 10) + '%';
1086                if (endLangs != undefined) {
1087                    html += '<span class="subr">\n' +
1088                        '<del class="tt-sale">\n' + VProductSalePrice + '\n' +
1089                        '</del>\n' +
1090                        '<span class="discount f-fs14">\n' +
1091                        '     ' + couponDiscountText + ' OFF\n' +
1092                        '</span>\n' +
1093                        '</span>';
1094                }
1095                else {
1096                    html += '<span class="subr">\n' +
1097                        '<del class="tt-sale">\n' +
1098                        '     $' + VProductSalePrice + '\n' +
1099                        '</del>\n' +
1100                        '<span class="discount f-fs14">\n' +
1101                        '     ' + couponDiscountText + ' OFF\n' +
1102                        '</span>\n' +
1103                        '</span>';
1104                }
1105            }
1106            if (langNetWork) {
1107                if (endLangs != undefined) {
1108                    html += '<span class="subr">\n' +
1109                        '<del class="tt-sale">\n' + accounting.formatMoney(totalPropertyProductPrice, pricingSettings) + '\n' +
1110                        '</del>\n' +
1111                        // '<span class="discount f-fs14">\n' +
1112                        // '     ' + couponDiscountText + ' OFF\n' +
1113                        // '</span>\n' +
1114                        '</span>';
1115                }
1116                else {
1117                    html += '<span class="subr">\n' +
1118                        '<del class="tt-sale">\n' +
1119                        '     $' + VProductSalePrice + '\n' +
1120                        '</del>\n' +
1121                        '<span class="discount f-fs14">\n' +
1122                        '     ' + couponDiscountText + ' OFF\n' +
1123                        '</span>\n' +
1124                        '</span>';
1125                }
1126            }
1127        }
1128
1129        html += '\n</strong>\n';
1130
1131        $propertyProductElem.attr('data-prod-property-value', totalPropertyProductPrice).html(html);
1132    }
1133    function setPropertyPriceDom($propertyPriceElem, totalPropertyPrice, isPerpetual, coupon, protertySalePrice, couponDiscount, num, propertyVPrice, cc, isPermanent) {
1134        langArr = [
1135            { "name": "fr", "Symbol1": "&nbsp/&nbspAn", "Symbol2": "&nbsp/&nbspPerpétuel" },
1136            { "name": "de", "Symbol1": "&nbsp/&nbspJahr", "Symbol2": "&nbsp/&nbspDauerhaft" },
1137            { "name": "tw", "Symbol1": "&nbsp/&nbsp年", "Symbol2": "&nbsp/&nbsp终身" },
1138            { "name": "es", "Symbol1": "&nbsp/&nbspAño", "Symbol2": "&nbsp/&nbspPerpetua" },
1139            { "name": "it", "Symbol1": "&nbsp/&nbspAnno", "Symbol2": "&nbsp/&nbspPerpetuo" },
1140            { "name": "jp", "Symbol1": "&nbsp/&nbsp年間", "Symbol2": "&nbsp/&nbsp無期限" },
1141            { "name": "landing", "Symbol1": "&nbsp/&nbspYear", "Symbol2": "&nbsp/&nbspPerpetual" },
1142            { "name": "store.html", "Symbol1": "&nbsp/&nbspYear", "Symbol2": "&nbsp/&nbspPerpetual" },
1143            { "name": "enterprise", "Symbol1": "&nbsp/&nbspYear", "Symbol2": "&nbsp/&nbspPerpetual" },
1144        ]
1145        currencyArr = [
1146            {
1147                name: "de",
1148                currency: "&nbsp€"
1149            },
1150            {
1151                name: "fr",
1152                currency: "&nbsp€"
1153            },
1154            {
1155                name: "es",
1156                currency: "&nbsp€"
1157            },
1158            {
1159                name: "it",
1160                currency: "&nbsp€"
1161            },
1162            {
1163                name: "tw",
1164                currency: "NT$"
1165            },
1166            {
1167                name: "jp",
1168                currency: "&nbsp円"
1169            },
1170        ]
1171        // 货币
1172        let findCurrency = currencyArr.find(item => item.name == lang)
1173        if (findCurrency == undefined) {
1174            var currency = "$"
1175        } else {
1176            var currency = findCurrency.currency
1177        }
1178        // 多语言区分
1179        let endLangs = langArr.find(item => item.name == lang)
1180        endLangs == undefined ? endLangs = { "name": "enterprise", "Symbol1": "&nbsp/&nbspYear", "Symbol2": "&nbsp/&nbspPerpetual" } : '';
1181        var propertyPriceValueArray = [0, 0, 0];
1182        var propertyTotalPrice = accounting.formatMoney(totalPropertyPrice, pricingSettings);
1183        var propertySalePrice = accounting.formatMoney(protertySalePrice, pricingSettings);
1184        var _propertyVPrice = accounting.formatMoney(propertyVPrice, pricingSettings);
1185        let discount = 0
1186        switch (cc) {
1187            case 2:
1188                discount = 1
1189                break;
1190            case 3:
1191                discount = 2
1192                break;
1193            case 4:
1194                discount = 3
1195                break;
1196        }
1197        langNetWork ? discount = 3 : ''
1198        if (isPermanent) {
1199            var propertyTotalPrice = accounting.formatMoney(totalPropertyPrice, pricingSettings);
1200        } else {
1201            if(pricingSettings.symbol == "円"){
1202                var propertyTotalPrice = accounting.formatMoney((totalPropertyPrice * Number(1 - discount / 10)) * 1.1, pricingSettings);
1203
1204            }else{
1205            var propertyTotalPrice = accounting.formatMoney(totalPropertyPrice * Number(1 - discount / 10), pricingSettings);
1206
1207            }
1208        }
1209        // console.log(totalPropertyPrice);
1210        var couponDiscountText = '';
1211        if (coupon) {
1212            propertyPriceValueArray = propertySalePrice.split(pricingSettings.decimal);
1213        } else {
1214            propertyPriceValueArray = propertyTotalPrice.split(pricingSettings.decimal);
1215        }
1216        langNetWork ? coupon = 'coupon' : ''
1217
1218        var html = ""
1219        pricingSettings.symbol == "円" || pricingSettings.symbol == "NT$" ? html = '<span class="i-amount">' + propertySalePrice + '</span>\n' : html = '<span class="i-amount">' + propertyPriceValueArray[0] + '</span>\n';
1220        // console.log(propertyPriceValueArray,propertySalePrice.split(pricingSettings.decimal));
1221
1222        var html = '<span class="i-amount">' + propertyPriceValueArray[0] + '</span>\n';
1223
1224        html += '<span class="sub2">'
1225        pricingSettings.symbol == "円" || pricingSettings.symbol == "NT$" ? html += '' : html += '<span class="i-tail">' + pricingSettings.decimal + propertyPriceValueArray[1] + '</span>' + '<span class="i-currency"></span>\n';
1226
1227        if (!isPerpetual && !isPermanent) {
1228            html += '\n<span class="i-subt">' + endLangs.Symbol1 + '</span>';
1229        } else {
1230            html += '\n<span class="i-subt">' + endLangs.Symbol2 + '</span>';
1231        }
1232        html += '</span>';
1233        if (coupon && num > 0) {
1234            if (couponDiscount < 1) {
1235                couponDiscountText = Math.round(couponDiscount * 100) + '%';
1236            } else {
1237                var disc = Math.round(((couponDiscount * num) / propertyVPrice) * 100) + '%';
1238                couponDiscountText = '-' + Math.abs(couponDiscount);
1239            }
1240            if (endLangs != undefined) {
1241                html += '<span class="subr">\n' +
1242                    '<del class="tt-sale">\n' + accounting.formatMoney(totalPropertyPrice, pricingSettings) + '\n' +
1243                    '</del>\n' +
1244                    '</span>';
1245            } else {
1246                html += '<span class="subr">\n' +
1247                    '<span class="discount f-fs14">\n' +
1248                    '     ' + couponDiscountText + ' OFF\n' +
1249                    '</span>\n' +
1250                    '<del class="tt-sale">\n' +
1251                    '     $' + _propertyVPrice + '\n' +
1252                    '</del>\n' +
1253                    '</span>';
1254            }
1255        }
1256
1257        $propertyPriceElem.attr('data-property-value', totalPropertyPrice).html(html);
1258    }
1259    /**
1260     * 获取属性名称
1261     * @param $this
1262     * @returns {*}
1263     */
1264    function getPropertyItemName($this) {
1265        return $this.closest('[data-property-itemname]').attr('data-property-itemname');
1266    }
1267    let langNetWork = window.location.pathname.substring(1) == "enterprise/cpxs-lmj.html";
1268    let dataPricingProduct = $(".acbn--boxs").find($("[data-pricing-product]"))
1269    // 活动页的特殊处理
1270    langNetWork ? dataPricingProduct = $("[data-pricing-product]") : ''
1271    dataPricingProduct.each(function (i) {
1272        $this = $(this);
1273        var propertyPriceData = null, propertyProductData = null;
1274        var productName = $this.attr("data-pricing-product");
1275        var productData = pricingData[productName];
1276        var $checkboxIcon = $this.find(pricingCheckbox.iconElem);
1277        var $selectElem = $this.find('[data-pricing-select="true"]');
1278        var $checkboxElem = $this.find('[data-pricing-checkbox="true"]');
1279        var $radioElem = $this.find('[data-pricing-radio="true"]');
1280        var $addReduceBoxElem = $this.find('[data-pricing-add="true"]');
1281        var $incrElem = $this.find('[data-incr-elem="true"]');// 控制增减的元素
1282        var $multiplePropertySelect = $this.find('[data-mutiple-property="true"]');
1283        var $ammCheckElem = $this.find('.check-pro,[data-elem="amm-check"]');
1284        // var $calcElem = $this.find('[data-pricing-calc^="el"]');// license - or +
1285        // var $numCalcElem = $calcElem.parent().find('[data-pricing-calc="number"]');// license 份数的 element
1286        var state = "checked";
1287        var couponCode = '';
1288
1289        var quantity = 1;
1290        if ($addReduceBoxElem.data()) {
1291            $addReduceBoxElem.data().minnum
1292                ? (quantity = $addReduceBoxElem.data().minnum)
1293                : "";
1294        }
1295        var index = 1;
1296        var couponArry = productData[state][$this.attr("data-priority")]
1297            ? productData[state][$this.attr("data-priority")]
1298            : productData[state]["coupon"];
1299
1300        // 如果存在 propertyPrice
1301        if (typeof productData[state]['propertyPrice'] !== 'undefined') {
1302            propertyPriceData = productData[state]['propertyPrice'];
1303            propertyProductData = productData[state];
1304        }
1305
1306        if (typeof productData[state]['couponCode'] !== 'undefined' && productData[state]['couponCode']) {
1307            couponCode = productData[state]['couponCode'];
1308        }
1309
1310        $this.on("click", $checkboxElem.selector, function (e) {
1311            $this = $(this);
1312            if ($checkboxIcon.hasClass(pricingCheckbox.active)) {
1313                $checkboxIcon
1314                    .removeClass(pricingCheckbox.active)
1315                    .addClass(pricingCheckbox.inactive);
1316                state = "unchecked";
1317            } else {
1318                $checkboxIcon
1319                    .addClass(pricingCheckbox.active)
1320                    .removeClass(pricingCheckbox.inactive);
1321                state = "checked";
1322            }
1323            productName = $this
1324                .parents('[data-elem="pricing-box"]')
1325                .attr("data-pricing-product");
1326            productData = pricingData[productName];
1327            setPrice(productData, state, quantity, index, $this); //设置价格,设置购买链接
1328            e.stopImmediatePropagation();
1329            return false;
1330        });
1331
1332        // data-property-click="on"
1333        $this.on('click', '[data-property-click="on"]', function (e) {
1334
1335            var $this = $(this);
1336            $this.find('[data-mutiple-property="true"]').trigger('click');
1337            e.stopImmediatePropagation();
1338            return false;
1339        });
1340        // 属性选择
1341        $this.on('click', $multiplePropertySelect.selector, function (e) {
1342            var checked = $(this).is(':checked');
1343            var $parents = $(this).parents(".item-set")
1344            var $endItem = $(this).parents(".item-set").children(".price")
1345
1346            var cc = 0
1347            $parents.find(".item").each(function (i) {
1348                var allChecked = $(this).find("input").is(':checked');
1349                allChecked && cc++
1350            })
1351            var $this = $(e.target);
1352            var $propertyBox = $this.closest('[data-pricing-product]');
1353            var $propertyItemBox = $this.closest('[data-property-itemname]');
1354
1355            if (checked && $propertyItemBox.attr('data-property-click') === 'on') {
1356                $propertyItemBox.addClass('bordered');
1357            } else {
1358                $propertyItemBox.removeClass('bordered');
1359            }
1360
1361            if ($propertyBox.find('[data-mutiple-property="true"]:checked').length <= 0) {
1362                $propertyBox.find('[data-pricing-link="true"]').attr('disabled', 'disabled');
1363            } else {
1364                $propertyBox.find('[data-pricing-link="true"]').removeAttr('disabled');
1365            }
1366
1367            var _coupon = $('body').hasClass('timeout') ? false : undefined;
1368            setPropertyProductValue($propertyBox, propertyPriceData, propertyProductData, _coupon, cc);
1369            e.stopImmediatePropagation();
1370        });
1371
1372        // 加数量
1373        $this.on('click', $incrElem.find('[data-type="add"]').selector, function (e) {
1374            let val = e.target.dataset.unit //最小值
1375            var $this = $(e.target);
1376            scaleProperty($this, propertyPriceData, '+', propertyProductData, couponCode, val);
1377            return false;
1378        });
1379        // 减数量
1380        $this.on('click', $incrElem.find('[data-type="reduce"]').selector, function (e) {
1381            let val = e.target.dataset.unit //最小值
1382            var $this = $(e.target);
1383            scaleProperty($this, propertyPriceData, '-', propertyProductData, couponCode, val);
1384            return false;
1385        });
1386        /**
1387         * 监听点击事件,将readonly取消
1388         */
1389        // $this.on('click', '[data-input="listen"]', function (e) {
1390        //     var $_this = $(e.target);
1391        //     $_this.attr('readonly', 'readonly');
1392        //     return false;
1393        // });
1394        // function tip(params) {
1395        //     var tips = $('#popup--flex')
1396        //     var tipsOver = $('#over')
1397        //     var tipsLittle = $('#little')
1398        //     if (params == 'little') {
1399        //         tips.addClass('active').fadeOut(5000)
1400        //         tipsLittle.addClass('active').fadeOut(5000)
1401        //         setTimeout(() => {
1402        //             tips.removeClass('active')
1403        //             tipsLittle.removeClass('active')
1404        //         }, 5000);
1405        //     }
1406        //     else {
1407        //         tips.addClass('active').fadeOut(5000)
1408        //         tipsOver.addClass('active').fadeOut(5000)
1409        //         setTimeout(() => {
1410        //             tips.removeClass('active')
1411        //             tipsOver.removeClass('active')
1412        //         }, 5000);
1413        //     }
1414        // }
1415        // $this.on('blur', '[data-input="listen"]', function (e) {
1416        //     let $clickThis = $(this)
1417        //     let item = $clickThis.parents('.item')
1418        //     item.removeClass('df')
1419        // })
1420        $this.on('blur', '[data-input="listen"]', function (e) {
1421            let val = e.target.dataset.unit //最小值
1422            let $clickThis = $(this)
1423            let buyBox = $clickThis.parents('.item-box').find(".buyBox")
1424            let emailBox = $clickThis.parents('.item-box').find(".email")
1425            let tips = $clickThis.parents('.choosebox-wrap').find(".little")
1426            let item = $clickThis.parents('.choosebox')
1427            tips.removeClass('active')
1428            if (e.target.value == "") {
1429                e.target.value = 5;
1430                var $_this = $(e.target);
1431                scaleProperty($_this, propertyPriceData, false, propertyProductData, couponCode)
1432            }
1433            if (Number(e.target.value) >= Number(val) && e.target.value <= 1000 || e.target.value == 0) {
1434                var $_this = $(e.target);
1435                scaleProperty($_this, propertyPriceData, false, propertyProductData, couponCode)
1436                buyBox.removeClass('display')
1437                emailBox.addClass('display')
1438                item.removeClass('df')
1439                return false;
1440            }
1441            else {
1442                // tips
1443                if (Number(e.target.value) < Number(val)) {
1444                    e.target.value = 5;
1445                    var $_this = $(e.target);
1446                    scaleProperty($_this, propertyPriceData, false, propertyProductData, couponCode)
1447                    buyBox.removeClass('display')
1448                    emailBox.addClass('display')
1449                    item.removeClass('df')
1450                    return false;
1451                } else {
1452                    buyBox.addClass('display')
1453                    emailBox.removeClass('display')
1454                }
1455            }
1456        });
1457        $this.on('input', '[data-input="listen"]', function (e) {
1458            let val = e.target.dataset.unit //最小值
1459            let $clickThis = $(this)
1460            let buyBox = $clickThis.parents('.item-box').find(".buyBox")
1461            let emailBox = $clickThis.parents('.item-box').find(".email")
1462            let tips = $clickThis.parents('.choosebox-wrap').find(".little")
1463            let $setItems = $clickThis.parents('.item-set').find(".num.txt")
1464            let item = $clickThis.parents('.choosebox')
1465            if (Number(e.target.value) >= Number(val) && e.target.value <= 1000 || e.target.value == 0) {
1466                var $_this = $(e.target);
1467                scaleProperty($_this, propertyPriceData, false, propertyProductData, couponCode)
1468                buyBox.removeClass('display')
1469                emailBox.addClass('display')
1470                item.removeClass('df')
1471                tips.removeClass('active')
1472                $setItems.removeAttr("disabled");
1473                return false;
1474            }
1475            else {
1476                // tips
1477                if (Number(e.target.value) < Number(val)) {
1478                    // e.target.value = 5;
1479                    var $_this = $(e.target);
1480                    scaleProperty($_this, propertyPriceData, false, propertyProductData, couponCode)
1481                    tips.addClass('active')
1482                    item.addClass('df')
1483                    buyBox.removeClass('display')
1484                    emailBox.addClass('display')
1485                    $setItems.removeAttr("disabled");
1486                    return false;
1487                } else {
1488                    item.addClass('df')
1489                    buyBox.addClass('display')
1490                    emailBox.removeClass('display')
1491                    $setItems.attr('disabled', "disabled")
1492                    $clickThis.removeAttr("disabled");
1493                }
1494            }
1495        });
1496
1497        /**
1498         * 选择下拉选择数量的操作,点击下拉头部的事件
1499         */
1500        $this.on("click", $selectElem.find(".pricing-select-header").selector, function () {
1501            $this = $(this);
1502            if ($selectElem.hasClass(pricingSelect.active)) {
1503                $selectElem.removeClass(pricingSelect.active);
1504            } else {
1505                if (
1506                    $selectElem
1507                        .parents(["data-pricing-product"])
1508                        .siblings()
1509                        .find(".pricing-select")
1510                        .hasClass(pricingSelect.active)
1511                ) {
1512                    $selectElem
1513                        .parents(["data-pricing-product"])
1514                        .siblings()
1515                        .find(".pricing-select")
1516                        .removeClass(pricingSelect.active);
1517                }
1518                $selectElem.addClass(pricingSelect.active);
1519            }
1520            return false;
1521        });
1522        /**
1523         * 选择下拉选择数量的操作,点击下拉options的事件
1524         */
1525        $this.on("click", $selectElem.find('.pricing-select-options li:not([data-mark="disabled"])').selector, function () {
1526            $this = $(this);
1527            $selectElem
1528                .find(".pricing-select-header")
1529                .find(".pricing-quantity-text")
1530                .html($this.html());
1531            $selectElem.removeClass(pricingSelect.active);
1532            if ($this.attr("data-status")) {
1533                // 当选择产品时
1534                state = $this.attr("data-status");
1535            } else {
1536                // 选择数量
1537                index = $this.index() + 1;
1538                quantity = parseInt(
1539                    $this.data("pricing-quantity")
1540                        ? $this.attr("data-pricing-quantity")
1541                        : index
1542                );
1543            }
1544            setPrice(productData, state, quantity, index, $this); //设置价格,设置购买链接
1545            return false;
1546        });
1547        // 下拉框下折扣信息展示到每一台
1548        // function select(){
1549        // }
1550        /**
1551         * 单选
1552         */
1553        $this.on("click", $radioElem.selector, function () {
1554            $this = $(this);
1555            $this
1556                .find(pricingRadio.iconElem)
1557                .addClass(pricingRadio.active)
1558                .parents('[data-elem="radio-item"]')
1559                .siblings()
1560                .find(pricingRadio.iconElem)
1561                .removeClass(pricingRadio.active);
1562            $this.addClass("active").siblings().removeClass("active");
1563            state = $this.index() === 0 ? "checked" : "unchecked";
1564            state = $this.attr("data-pricing-state");
1565            setPrice(productData, state, quantity, index, $this); //设置价格,设置购买链接
1566            return false;
1567        });
1568
1569        function inputChangeNum($elem, type) {
1570            var $_this = $elem;
1571            var $outer = $_this.closest("[data-pricing-product]");
1572            var $parent = $_this.parents('[data-pricing-add="true"]');
1573            var $limit = $_this.parents("[data-toplimit]");
1574            var $step = 1;
1575            var $minnum = 1;
1576            if ($parent.data().step) {
1577                var $minnum = $parent.data().minnum;
1578                $step = $parent.data().step;
1579            }
1580            var limitCnt =
1581                $limit.attr("data-toplimit") == "no"
1582                    ? $limit.attr("data-toplimit")
1583                    : JSON.parse($limit.attr("data-toplimit"));
1584            var num = quantity;
1585            var maxNum = limitCnt === "no" ? Infinity : limitCnt[limitCnt.length - 1]; //判断是否可以无限加
1586            var type = type || $_this.data("type");
1587            $(".toplimit").removeClass("toplimit");
1588            if (type == "reduce") {
1589                $outer.removeClass("toplimit");
1590                $parent.find('[data-type="add"]').removeClass("notallow");
1591                num <= $minnum
1592                    ? $_this.addClass("notallow")
1593                    : (num = Number(num) - $step);
1594            } else if (type == "add") {
1595                $parent.find('[data-type="reduce"]').removeClass("notallow");
1596                num = Number(num) + $step;
1597            } else if (type == "input") {
1598                num =
1599                    isNaN(parseInt($_this.val())) || parseInt($_this.val()) < 1
1600                        ? 1
1601                        : parseInt($_this.val());
1602            }
1603            if ($.isArray(limitCnt)) {
1604                $.each(limitCnt, function (i, n) {
1605                    if (num <= limitCnt[0]) {
1606                        return (index = 1);
1607                    } else if (num > limitCnt[i] && num <= limitCnt[i + 1]) {
1608                        return (index = i + 2);
1609                    } else if (num > limitCnt[limitCnt.length - 1]) {
1610                        return (index = limitCnt.length);
1611                    }
1612                });
1613            } else {
1614                index = num;
1615            }
1616            if (num > maxNum) {
1617                $outer.addClass("toplimit");
1618                num = maxNum;
1619            } else {
1620                $outer.removeClass("toplimit");
1621            }
1622            quantity = num;
1623            var inputTxt = $parent.find("[data-unit]").length
1624                ? num > 1
1625                    ? num + " " + $parent.find("[data-unit]").attr("data-unit") + "s"
1626                    : num + " " + $parent.find("[data-unit]").attr("data-unit")
1627                : num;
1628            // 判断标签是不是可以输入的input
1629            $parent.find(".txt").prop("tagName") == "INPUT"
1630                ? $parent.find(".txt").val(inputTxt) - 0
1631                : $parent.find(".txt").text(inputTxt);
1632            setUrlParams($outer);
1633            setPrice(productData, state, quantity, index, $_this); //设置价格,设置购买链接
1634        }
1635
1636        // 加减数量
1637        $this.on("click", $addReduceBoxElem.find("[data-type]").selector, function () {
1638            var $_this = $(this);
1639            inputChangeNum($_this);
1640        });
1641        $addReduceBoxElem.find('[data-type="reduce"]').trigger("click");
1642        // // 控制input输入数量
1643        // // input propertychange
1644        // $this.on("blur", $addReduceBoxElem.find('[data-input="change"]').selector, function () {
1645        //     var $_this = $(this);
1646        //     inputChangeNum($_this, "input");
1647        // }).on("keyup", $addReduceBoxElem.find('[data-input="change"]').selector, function (e) {
1648        //     var $_this = $(this);
1649        //     var keyCode = e.keyCode;
1650        //     if (keyCode === 13) {
1651        //         inputChangeNum($_this, "input");
1652        //     }
1653        // });
1654        $this.on("focus", $addReduceBoxElem.find('[data-input="change"]').selector, function () {
1655            var $_this = $(this);
1656            $_this.val("");
1657        });
1658        $ammCheckElem.on("click", function (e) {
1659            // addAMM
1660            e.stopImmediatePropagation();
1661            var $this = $(this);
1662            var $parent = $this.parents('[data-elem="pricing-box"]');
1663            var isRadio =
1664                $parent.find('[data-elem="radio-item"]').length > 0 ? true : false;
1665            $this.toggleClass("active");
1666            var productName = $this
1667                .parents('[data-elem="pricing-box"]')
1668                .attr("data-pricing-product");
1669            var productData = pricingData[productName];
1670            var state = "";
1671            if (isRadio) {
1672                state = $parent
1673                    .find('[data-pricing-state="checked"]')
1674                    .hasClass("active")
1675                    ? "checked"
1676                    : "unchecked";
1677            } else {
1678                state = $this
1679                    .parents('[data-elem="pricing-box"]')
1680                    .find(".pricing-cb")
1681                    .hasClass("pricing-checked")
1682                    ? "checked"
1683                    : "unchecked";
1684            }
1685            setPrice(productData, state, quantity, index, $this); //设置价格,设置购买链接
1686        });
1687    });
1688
1689    showCardByReferrer();
1690    $(".out").click(function (e) {
1691        e.stopPropagation();
1692    })
1693
1694    // /**点击body处,取消购买的下拉**/
1695    $(document).on("click", "body", function (e) {
1696        var $pricingSelect = $(".pricing-select");
1697        if ($pricingSelect.hasClass("select-expanded")) {
1698            $pricingSelect.removeClass("select-expanded");
1699        }
1700    });
1701    /**
1702     * 价格或者链接的悬浮功能
1703     * @type {number}
1704     */
1705    var toPinHeight =
1706        $pin.length > 0
1707            ? headerHeight + $header.next().height() - $pin.height()
1708            : headerHeight;
1709    showPinContainer($(window).scrollTop() >= toPinHeight);
1710    $(window).scroll(function () {
1711        $this = $(this);
1712        var t = $this.scrollTop();
1713        showPinContainer(t >= toPinHeight);
1714    });
1715});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.