PageSourceSearch

https://www.ubackup.com/assets/lib/pricing-vat.js

js ubackup.com collected 2026-09-24 06:23:59 UTC 32,062 bytes, 951 lines download raw bytes

1$(function() {
2  /**
3   * Price allocation of multilingual Euro
4   * @type {{symbol: string, format: string, decimal: string, thousand: string, precision: number}}
5   */
6  var pricingSettings = __gc.getCurrencySettings(__gc.currentLang);
7  /**
8   *Configure checked page styles /class
9   */
10  var pricingCheckbox = {
11    iconElem: ".pricing-cb",
12    active: "pricing-checked",
13    inactive: "pricing-unchecked",
14  };
15
16  /**
17   * Configure page styles for radio selection /class
18   */
19  var pricingRadio = {
20    iconElem: ".pricing-radio",
21    closest: ".pricing-radios",
22    active: "pricing-checked",
23  };
24
25  /**
26   * Configuration drop-down selection quantity page style /class
27   */
28  var pricingSelect = {
29    active: "select-expanded",
30    inactive: "pricing-unchecked",
31  };
32
33  var $this,
34    $pin = $("[data-pin]"),
35    $header = $("#header"),
36    $body = $("body"),
37    headerHeight = $header.height();
38
39  var vat = 0;
40
41  /**
42   * Display floating price or not
43   * @param operator
44   */
45  function showPinContainer(operator) {
46    operator ? $pin.show() : $pin.hide();
47  }
48
49  /**
50   * Price after getting discount
51   * @param unitPrice
52   * @param coupon
53   * @returns {number}
54   */
55  function getSaleUnitPrice(unitPrice, coupon) {
56    if (!coupon) {
57      return unitPrice;
58    }
59
60    var discount = discountSettings[coupon];
61
62    if (discount > 1) {
63      return unitPrice - discount;
64    } else if (discount > 0 && discount < 1) {
65      return unitPrice * (1 - discount);
66    }
67  }
68
69  /**
70   * Get a single discount(Percentage or number)
71   * @param  coupon
72   * @returns string or false
73   */
74  function getEachSale(coupon) {
75    var discount = discountSettings[coupon];
76    if (!discount) {
77      return false;
78    }
79
80    if (discount > 1) {
81      return (discount =
82        accounting.formatMoney(discount, pricingSettings).replace(".00", "") +
83        " OFF");
84    } else if (discount > 0 && discount < 1) {
85      return (discount = Math.round(discount * 100) + "% OFF");
86    }
87  }
88
89  /**
90   * 区分大小写
91   * 设置形如 params=VM_10;VHost=100,该值表示用户购买的产品属性
92   */
93  function urlParamsString(extraParams) {
94    // extraParams = "";
95    if (extraParams !== "" && typeof extraParams === "string") {
96      extraParams = $.parseJSON(extraParams);
97    }
98
99    var qs = "";
100
101    if (extraParams && Object.keys(extraParams).length) {
102      for (var key in extraParams) {
103        qs += ";" + key + "_" + extraParams[key];
104      }
105    }
106
107    if (qs === "") {
108      return qs;
109    }
110
111    return "&params=" + qs.substring(1);
112  }
113  /**
114   * 修改ga事件跟踪
115   * @param {Object} options
116   * @param {string} options.ga 原始ga跟踪
117   * @param {string} options.currentProductName 当前产品名
118   * @param {string} options.num 当前产品数量
119   * @param  jqObj   $purchaseLinkElem 要更换得jq元素
120   * @returns {string} 更新过得ga跟踪
121   */
122  function gaEvent(options, $purchaseLinkElem) {
123    if ($purchaseLinkElem.attr("onclick") && options.currentProductName) {
124      var gaEventArr = $purchaseLinkElem.attr("onclick").split(",");
125      if (options > 1) {
126        gaEventArr[2] =
127          "'" + options.currentProductName + "X" + options.num + "'";
128      } else {
129        gaEventArr[2] = "'" + options.currentProductName + "'";
130      }
131      var ga = gaEventArr.join(",");
132      //   console.log(ga);
133      $purchaseLinkElem.attr("onclick", ga);
134    }
135  }
136
137  // 格式化将货币符号和数字分开
138  function formatAnotherPrice(number) {
139    var _salePricePre = accounting.formatMoney(number, pricingSettings);
140    var _salePriceNumber = _salePricePre.replace(pricingSettings.symbol, "");
141    var _salePriceOther = pricingSettings.format
142      .replace(
143        "%s",
144        '<span class="symbol">' + pricingSettings.symbol + "</span>"
145      )
146      .replace("%v", '<span class="num">' + _salePriceNumber + "</span>");
147    return _salePriceOther;
148  }
149
150  function formatAnotherNewPrice(number) {
151    var $salePriceElemSplit = accounting
152      .formatMoney(number, pricingSettings)
153      .replace(pricingSettings.symbol, "")
154      .split(pricingSettings.decimal);
155    var $salePriceElemSym = $salePriceElemSplit[0].replace(
156      pricingSettings.symbol,
157      ""
158    );
159    var $salePriceElemDec = $salePriceElemSplit[1];
160    $salePriceElemDec == undefined ?
161      ($salePriceElemDec = "") :
162      ($salePriceElemDec = $salePriceElemDec);
163    var $salePriceDecimal = $salePriceElemDec ?
164      pricingSettings.decimal + $salePriceElemDec :
165      "";
166    var salePriceElemHtml =
167      '<span class="integer f-fs40">' +
168      $salePriceElemSym +
169      "</span>" +
170      '<span class="decimal">' +
171      $salePriceDecimal +
172      "</span>" +
173      '<span class="currency">' +
174
175      pricingSettings.symbol +
176      "</span>";
177    return salePriceElemHtml;
178  }
179  /**
180   * 傲梅云购买
181   *
182   */
183  function aomeiCloudClick() {
184    $("[data-param-url]").on("click", function() {
185      $("body").after(
186        '<input type="hidden" id="url-param" value="' +
187        $(this).attr("data-param-url") +
188        '">'
189      );
190    });
191  }
192
193  // accounting.formatMoney
194  /**
195   * 构建购买链接
196   * https://order.shareit.com/cart/new?vendorid=200100548&theme=200100548-9&PRODUCT[300868985]=1&COUPON1=AOME-8VJ6-ABPO&sp=true&BU=1&affiliate=
197   */
198  function buildPurchaseLink(options, $purchaseLinkElem) {
199    var hasAmmActive = $purchaseLinkElem
200      .parents('[data-elem="pricing-box"]')
201      .find('[data-elem="amm-check"]')
202      .hasClass("active");
203
204    if (options.plink) {
205      var buildedLink = options.plink;
206    } else {
207      var settings = $.extend({
208          theme: "200100548-9",
209          vendorid: "200100548",
210          sp: "true",
211          googleTrackingAffiliate: "UBC", //这是BU网站,所以添加BU,这里值,与 https://account.mycommerce.com/Cp/Index#/tracking/edit.html 设置的 "Affiliate parameter" 相同
212          quantity: "1",
213        },
214        options || {}
215      );
216      var purchaseLinkTpl = "https://go.ubackup.com/buy?pk[{productID}]={quantity}";
217      var $checkoutPhp = $('[data-checkout-php="true"]');
218      if ($checkoutPhp.length > 0) {
219        purchaseLinkTpl = "https://go.ubackup.com/buy?pk[{productID}]={quantity}";
220      } else if (options.linkJson) {
221        purchaseLinkTpl =
222          "https://go.ubackup.com/buy?pk[{productID}]={quantity}&iv={iv}&dpr={dpr}";
223        if (settings.productID2 != "") {
224          purchaseLinkTpl =
225            "https://go.ubackup.com/buy?pk[{productID}]={quantity}&pk[{productID2}]={quantity}&params={paramsStr}&dpr={dpr}";
226        }
227      }
228      var buildedLink = purchaseLinkTpl
229        .replace("{productID}", settings.productID)
230        .replace(/{quantity}/g, settings.quantity);
231      if (options.linkJson) {
232        var pricingInfo = options.linkJson;
233        var iv = settings.linkJson.iv;
234        // console.log(JSON.stringify(pricingInfo));
235
236        var dynamicParamsString = encodeURIComponent(
237          base64_encode(encodeURIComponent(JSON.stringify(pricingInfo)))
238        );
239        // console.log(pricingInfo);
240        buildedLink = buildedLink
241          .replace("{iv}", iv)
242          .replace("{dpr}", dynamicParamsString);
243        buildedLink += "&lc=true&eu=false";
244        if (settings.productID2 != "") {
245          buildedLink = buildedLink
246            .replace("{productID2}", settings.productID2)
247            .replace("{paramsStr}", pricingInfo.sps + ":" + settings.productID);
248        }
249      }
250      if (hasAmmActive) {
251        // addAMM
252        buildedLink += "&pk[169]=" + settings.quantity;
253      }
254      var vmlink = $("[data-pricing-vmlink]").length;
255      if ($("[data-pricing-vmlink]").data("pricingVmlink")) {
256        settings.vmlinkCoupon ?
257          (buildedLink += "&cp=" + settings.vmlinkCoupon) :
258          "";
259      } else if (settings.coupon != null && settings.productID2 == "") {
260        buildedLink += "&cp=" + settings.coupon;
261      } else if (settings.productID2 != "") {
262        buildedLink += "&cp=" + settings.trueCp;
263      }
264    }
265
266    options.ep ? "" : (buildedLink += "&pc=1");
267    options.ep ? (buildedLink += "&ep=cb") : ""; //cb link
268    vmlink > 0 ? (buildedLink += "&showpricescale=false") : "";
269    if (options.reParameter) {
270      buildedLink += "&rcmd=" + options.reParameter;
271    }
272    // console.log(buildedLink);
273    if (options.isAttrUrl) {
274      // aomei cloud
275      $purchaseLinkElem.attr({
276        "data-param-url": buildedLink,
277        href: "javascript:void(0)",
278      });
279    } else {
280      // other product
281      $purchaseLinkElem
282        .attr({
283          href: buildedLink,
284        })
285        .removeAttr("data-param-url");
286    }
287    aomeiCloudClick();
288  }
289
290  function calcSavePrice(salePrice) {
291    var txt = {
292      en: "Save ",
293      de: "gespart: ",
294      fr: "Économiser ",
295      jp: "値下げ: ",
296      tw: "優惠",
297      it: "Risparmia ",
298      es: "Ahorra ",
299    };
300
301    var _txt = txt["en"];
302
303    if (!txt.hasOwnProperty(__gc.currentLang)) {
304      _txt = txt["en"];
305    } else {
306      _txt = txt[__gc.currentLang];
307    }
308    return _txt + accounting.formatMoney(salePrice, pricingSettings);
309  }
310
311  /**
312   * 设置价格,构建购买链接
313   * @param state
314   * @param quantity
315   */
316  function setPrice(productData, state, quantity, index, $el, vat) {
317    var $elem = $el.closest("[data-pricing-product]"); //获取最外层的购买元素
318    var $purchaseLinkElem = $elem.find('[data-pricing-link="true"]'); //购买链接元素
319    var $priority_coupon = $elem.attr("data-priority"); //获取是否存在 data-priority-coupon 属性
320    var $priority_linkJson = $elem.attr("data-linkjson"); //获取是否存在 data-priority-coupon 属性
321    var isEpCb =
322      $elem.attr("data-ep") === "cb" ||
323      productData[state].purchasePlatform === "cb"; //获取是否是cb链接
324    var isAttrUrl = state === "uncheckedCloud" || state === "uncheckedSoftCloud" || state === "checkedSoftCloud" || false; // 是否将购买链接添加到data-url-param
325    var $limit = $elem.find('[data-toplimit="no"]'); // 存在就表示没有上限
326    var licenseTxt = productData[state]["licenseTxt"];
327    var reParameter = productData[state]["reParameter"];
328    var trueCp = productData[state]["trueCp"] || ""
329    if (licenseTxt) {
330      $elem.find('[data-product-txt="licenseTxt"]').text(licenseTxt);
331    }
332    // 如果存在 link 属性
333
334    var plink = productData[state]["plink"]; //
335
336    var _vat = vat;
337    $('[data-vat="parent"]').length > 0 && (_vat = 0);
338
339    var unitPrice = productData[state]["unitPrice"] * (1 + _vat); //销售原价的单价
340    var productID = productData[state]["productID"]; //产品ID
341    var productID2 = productData[state]["productID2"] || ""; //产品ID
342    var totalPrice = unitPrice * quantity; //销售单价 * 数量 => 销售的总价
343    var totalPrice2 = accounting.formatMoney(totalPrice, pricingSettings);
344    if (
345      $priority_linkJson &&
346      typeof productData[state][$priority_linkJson] !== "undefined"
347    ) {
348      var linkJson = productData[state][$priority_linkJson];
349    }
350    if (
351      $priority_coupon &&
352      typeof productData[state][$priority_coupon] !== "undefined"
353    ) {
354      //如果使用了优先折扣码
355      var coupon = productData[state][$priority_coupon][index - 1]; //优先使用的折扣码
356    } else {
357      var coupon = productData[state]["coupon"][index - 1]; //coupon信息
358    }
359
360    // console.log($priority_coupon, coupon); //debug 是否有对应的coupon
361
362    var saleUnitPrice = getSaleUnitPrice(unitPrice, coupon); //优惠后的销售单价
363    var saleTotalPrice = saleUnitPrice * quantity; //销售总价
364    var saleTotalPriceVat = saleTotalPrice * (1 + vat); //税后销售总价
365    var eachSale = getEachSale(coupon, vat); //单个优惠或优惠比
366    var salePrice = unitPrice * quantity - saleTotalPrice; //总优惠
367    var $totalPriceElem2 = $elem.find('[data-pricing-for="total-price2"]'); //amm加其他产品,总价显示为 $0.0 + $0.0
368    var $salePriceElem = $elem.find('[data-pricing-for="sale-price"]'); //优惠后的销售总价
369    var $salePriceElemOther = $elem.find(
370      '[data-pricing-for="sale-price-other"]'
371    ); //优惠后的销售总价
372
373    var $salePriceElemNewOther = $elem.find(
374      '[data-pricing-for="sale-price-new"]'
375    ); //优惠后的销售总价
376
377    var $salePriceElemVat = $elem.find('[data-vat="after-tax"]');
378    var $saleUnitPriceElem = $elem.find('[data-pricing-for="sale-unit-price"]'); //优惠后的销售单价
379    var $totalPriceElem = $elem.find('[data-pricing-for="total-price"]'); //销售总价
380    var $eachSaleElem = $elem.find('[data-pricing-for="each-save"]'); //单个优惠或优惠比
381    var $onlyEachSaleElem = $elem.find('[data-pricing-for="only-num"]'); //单个优惠或优惠比
382    var $salePrice = $elem.find('[data-pricing-for="save-price"]'); //总优惠
383
384    var hasAmmActive = $el
385      .parents('[data-elem="pricing-box"]')
386      .find('[data-elem="amm-check"]')
387      .hasClass("active"); // addAMM
388    var ggClick =
389      $purchaseLinkElem.attr("onclick") &&
390      $purchaseLinkElem.attr("onclick").split(",");
391    var str = ggClick && ggClick[2] && ggClick[2].replace(/\'/g, "");
392    var oldstr = str && ggClick && str.split("+")[0];
393
394    //console.log(ggClick, str, oldstr);
395
396    if (hasAmmActive) {
397      // addAMM
398      var multiPrice = {
399        de: 1269,
400        en: 1299,
401        fr: 1269,
402        jp: 209980,
403        pt: 1299,
404        tw: 41999,
405        it: 1269,
406        es: 1269,
407        pl: 1269,
408        nl: 1269,
409      };
410      var couponobj = {
411        551: 0.5,
412        553: 0.4,
413        552: 0.45,
414        550: 0.6,
415        428: 0.4,
416        429: 0.45,
417      };
418      // var extrPrice = 0;
419      // if (!multiPrice.hasOwnProperty(__gc.currentLang)) {
420      //     extrPrice = multiPrice["en"] * (1 + _vat);
421      // } else {
422      //     extrPrice = multiPrice[__gc.currentLang] * (1 + _vat);
423      //     console.log(multiPrice[__gc.currentLang], (1 + _vat));
424      //     console.log(extrPrice);
425      // }
426      var extrPrice =
427        multiPrice[__gc.currentLang] * (1 + _vat) ||
428        multiPrice["en"] * (1 + _vat);
429      coupon = "551";
430      var couponRate = 0.5;
431      if (__gc.showCurrentLang() === "de") {
432        //de高折扣AMM
433        var $topParent = $el.parents('[data-elem="pricing-box"]');
434        coupon = !$topParent.find(".pricing-cb").hasClass("pricing-checked") ?
435          "428" :
436          "552"; // 当前版折扣428,终身版折扣552
437        couponRate = couponobj[coupon];
438        couponRatePercentage = Math.round(couponRate * 100);
439        $topParent
440          .find('[data-elem="amm-product"] .bottom strong')
441          .text(couponRatePercentage);
442      } else if (/es|it|en|fr|jp|tw/.test(__gc.showCurrentLang())) {
443        var $amm = $el
444          .parents('[data-elem="pricing-box"]')
445          .find('[data-elem="amm-product"]');
446
447        if (__gc.showCurrentLang() == "en" || __gc.showCurrentLang() == "tw") {
448          coupon = $amm.attr("data-coupon") || "553";
449          couponRate = couponobj[coupon] || 0.4;
450        } else {
451          coupon = $amm.attr("data-coupon") || "552";
452          couponRate = couponobj[coupon] || 0.55;
453        }
454      }
455
456      if (isNaN(coupon)) {
457        var couponArr = productData["checked"][coupon];
458        var couponIndex = index - 1 || 0;
459        couponRate = discountSettings[couponArr[couponIndex]];
460        coupon = couponArr[couponIndex];
461      }
462
463      totalPrice = unitPrice * quantity + extrPrice * quantity;
464      // console.log(unitPrice * quantity);
465      saleUnitPrice = getSaleUnitPrice(unitPrice, coupon);
466      saleTotalPrice =
467        (unitPrice * quantity + extrPrice * quantity) * (1 - couponRate); //销售总价
468      saleTotalPriceVat = saleTotalPrice * (1 + vat); //税后总价
469      salePrice = unitPrice * quantity + extrPrice * quantity - saleTotalPrice; //总优惠
470      eachSale = getEachSale(coupon, vat);
471
472      totalPrice2 =
473        accounting.formatMoney(unitPrice * quantity, pricingSettings) +
474        "+" +
475        accounting.formatMoney(extrPrice, pricingSettings);
476
477      if (ggClick) {
478        str = "'" + oldstr.trim() + " + AMM'";
479        ggClick[2] = str;
480      }
481    } else {
482      if (ggClick) {
483        ggClick[2] = "'" + oldstr + "'";
484      }
485    }
486
487    if (ggClick) {
488      $purchaseLinkElem.attr("onclick", ggClick.join(","));
489    }
490
491    // 在页面上显示价格和一些购买相关的信息 begin
492    $salePriceElemOther.html(formatAnotherPrice(saleTotalPrice)); // 货币符号和价格分开的格式
493    $salePriceElem.html(
494      accounting.formatMoney(saleTotalPrice, pricingSettings)
495    );
496    $salePriceElemNewOther.html(formatAnotherNewPrice(saleTotalPrice));
497    $salePriceElemVat.text(
498      "(税込" + accounting.formatMoney(saleTotalPriceVat, pricingSettings) + ")"
499    );
500    saleTotalPrice !== totalPrice ?
501      $totalPriceElem.html(
502        accounting.formatMoney(totalPrice, pricingSettings)
503      ) :
504      $totalPriceElem.html("");
505    $saleUnitPriceElem.length > 0 &&
506      $saleUnitPriceElem.html(
507        accounting.formatMoney(saleUnitPrice, pricingSettings)
508      );
509    salePrice ? $eachSaleElem.html(eachSale) : $eachSaleElem.html("");
510    salePrice > 0 ?
511      $salePrice.html(calcSavePrice(salePrice)) :
512      $salePrice.html("");
513    salePrice
514      ?
515      $eachSaleElem
516      .html("<span>" + eachSale + "</span>")
517      .removeClass("not-save") :
518      $eachSaleElem.html("").addClass("not-save");
519
520    if (salePrice && $onlyEachSaleElem.length > 0) {
521      $eachSaleElem
522        .html(eachSale.split("%")[0])
523        .parents('[data-pricing-for="only-num"]')
524        .removeClass("not-save");
525    } else if ($onlyEachSaleElem.length > 0) {
526      $eachSaleElem
527        .html("")
528        .parents('[data-pricing-for="only-num"]')
529        .addClass("not-save");
530    }
531
532    // 在页面上显示价格和一些购买相关的信息 end
533    saleTotalPrice !== totalPrice ?
534      $totalPriceElem2.html(totalPrice2) :
535      $totalPriceElem2.html("");
536    // 在页面上显示价格和一些购买相关的信息 end
537
538    // 设置购买链接
539    buildPurchaseLink({
540        productID: productID,
541        productID2: productID2,
542        coupon: coupon,
543        quantity: quantity,
544        plink: plink,
545        ep: isEpCb,
546        extraParams: $elem.attr("data-params") || "", // 购买平台,默认是不添加平台
547        isAttrUrl: isAttrUrl, //aomei cloud used
548        linkJson,
549        trueCp,
550        reParameter,
551      },
552      $purchaseLinkElem
553    );
554
555    // 更新ga跟踪
556    gaEvent({
557        currentProductName: productData[state]["name"],
558        num: quantity,
559      },
560      $purchaseLinkElem
561    );
562  }
563
564  function base64_encode(input) {
565    var keyStr =
566      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
566+/=";
567    var output = "";
568    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
569    var i = 0;
570    input = utf8_encode(input);
571    while (i < input.length) {
572      chr1 = input.charCodeAt(i++);
573      chr2 = input.charCodeAt(i++);
574      chr3 = input.charCodeAt(i++);
575      enc1 = chr1 >> 2;
576      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
577      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
578      enc4 = chr3 & 63;
579      if (isNaN(chr2)) {
580        enc3 = enc4 = 64;
581      } else if (isNaN(chr3)) {
582        enc4 = 64;
583      }
584      output =
585        output +
586        keyStr.charAt(enc1) +
587        keyStr.charAt(enc2) +
588        keyStr.charAt(enc3) +
589        keyStr.charAt(enc4);
590    }
591    return output;
592  }
593
594  function utf8_encode(string) {
595    string = string.replace(/\r\n/g, "\n");
596    var utftext = "";
597    for (var n = 0; n < string.length; n++) {
598      var c = string.charCodeAt(n);
599      if (c < 128) {
600        utftext += String.fromCharCode(c);
601      } else if (c > 127 && c < 2048) {
602        utftext += String.fromCharCode((c >> 6) | 192);
603        utftext += String.fromCharCode((c & 63) | 128);
604      } else {
605        utftext += String.fromCharCode((c >> 12) | 224);
606        utftext += String.fromCharCode(((c >> 6) & 63) | 128);
607        utftext += String.fromCharCode((c & 63) | 128);
608      }
609    }
610    return utftext;
611  }
612  /**
613   * set url params
614   * data-params
615   * one product with a data-params of json
616   * one or more keys in one data-params of json, and update by data-pricing-product
617   */
618  function setUrlParams($outer) {
619    var $paramsElems = $outer.find("[data-param]");
620    if ($paramsElems.length > 0) {
621      var paramsJson = $.parseJSON($outer.attr("data-params"));
622      if ($paramsElems.length > 0) {
623        $paramsElems.each(function(i) {
624          var paramKey = $paramsElems.eq(i).attr("data-param");
625          if (typeof paramsJson[paramKey] !== "undefined") {
626            paramsJson[paramKey] = parseInt($paramsElems.eq(i).val());
627          }
628        });
629      }
630
631      $outer.attr("data-params", JSON.stringify(paramsJson));
632    }
633  }
634
635  $("[data-pricing-product]").each(function(i) {
636    $this = $(this);
637    var productName = $this.attr("data-pricing-product");
638    var productData = pricingData[productName];
639    var $checkboxIcon = $this.find(pricingCheckbox.iconElem);
640    var $selectElem = $this.find('[data-pricing-select="true"]');
641    var $checkboxElem = $this.find('[data-pricing-checkbox="true"]');
642    var $radioElem = $this.find('[data-pricing-radio="true"]');
643    var $checkElem = $this.find('[data-pricing-check="true"]');
644    var $addReduceBoxElem = $this.find('[data-pricing-add="true"]');
645    var $ammCheckElem = $this.find('.check-pro,[data-elem="amm-check"]');
646
647    var state = "checked";
648    var quantity = 1;
649    var index = 1;
650
651    /**
652     * checkbox勾选
653     */
654    $this.on("click", $checkboxElem.selector, function(e) {
655      $this = $(this);
656      var coupEle = $this.closest('[data-elem="pricing-box"]').find(".coup");
657
658      if ($checkboxIcon.hasClass(pricingCheckbox.active)) {
659        $checkboxIcon
660          .removeClass(pricingCheckbox.active)
661          .addClass(pricingCheckbox.inactive);
662        coupEle.addClass("hide");
663        state = "unchecked";
664      } else {
665        $checkboxIcon
666          .addClass(pricingCheckbox.active)
667          .removeClass(pricingCheckbox.inactive);
668        coupEle.removeClass("hide");
669        state = "checked";
670      }
671
672      setPrice(productData, state, quantity, index, $this, __gc.currentVat); //设置价格,设置购买链接
673
674      e.stopImmediatePropagation();
675      return false;
676    });
677
678    /**
679     * 选择下拉选择数量的操作,点击下拉头部的事件
680     */
681    $this.on(
682      "click",
683      $selectElem.find(".pricing-select-header").selector,
684      function() {
685        $this = $(this);
686        if ($selectElem.hasClass(pricingSelect.active)) {
687          $selectElem.removeClass(pricingSelect.active);
688        } else {
689          if (
690            $selectElem
691            .parents(["data-pricing-product"])
692            .siblings()
693            .find(".pricing-select")
694            .hasClass(pricingSelect.active)
695          ) {
696            $selectElem
697              .parents(["data-pricing-product"])
698              .siblings()
699              .find(".pricing-select")
700              .removeClass(pricingSelect.active);
701          }
702          $selectElem.addClass(pricingSelect.active);
703        }
704
705        return false;
706      }
707    );
708
709    /**
710     * 选择下拉选择数量的操作,点击下拉options的事件
711     */
712    $this.on(
713      "click",
714      $selectElem.find('.pricing-select-options li:not([data-mark="disabled"])')
715      .selector,
716      function() {
717        $this = $(this);
718        // $selectElem
719        //   .find(".pricing-select-header")
720        //   .find(".pricing-quantity-text")
721        //   .html($this.html());
722        $selectElem.find(".pricing-select-options").hasClass("has-price") ?
723          $selectElem
724          .find(".pricing-select-header")
725          .find(".pricing-quantity-text")
726          .html($this.find("[data-options='txt']").html()) :
727          $selectElem
728          .find(".pricing-select-header")
729          .find(".pricing-quantity-text")
730          .html($this.html());
731        $selectElem.removeClass(pricingSelect.active);
732        if ($this.attr("data-status")) {
733          // 当选择产品时
734          state = $this.attr("data-status");
735        } else {
736          // 选择数量
737          index = $this.index() + 1;
738          quantity = parseInt(
739            $this.data("pricing-quantity") ?
740            $this.attr("data-pricing-quantity") :
741            index
742          );
743        }
744
745        setPrice(productData, state, quantity, index, $this, __gc.currentVat); //设置价格,设置购买链接
746
747        return false;
748      }
749    );
750
751    /**
752     * 单选
753     */
754    $radioElem.length > 0 &&
755      $this.on("click", $radioElem.selector, function() {
756        $this = $(this);
757        var parent = $this.parents('[data-elem="pricing-box"]');
758        $this
759          .find(pricingRadio.iconElem)
760          .addClass(pricingRadio.active)
761          .parents('[data-elem="radio-item"]')
762          .siblings()
763          .find(pricingRadio.iconElem)
764          .removeClass(pricingRadio.active);
765        state = $this.index() === 0 ? "checked" : "unchecked";
766        state = $this.attr("data-pricing-state");
767        $this.addClass("active").siblings().removeClass("active");
768        setPrice(productData, state, quantity, index, $this, __gc.currentVat); //设置价格,设置购买链接
769        return false;
770      });
771
772    $this.on("click", $checkElem.selector, function() {
773      $this = $(this);
774      var isChecked = $this.is(":checked");
775      var checkType = $this.data("checkType")
776      // console.log(checkType);
777      if (isChecked) {
778        state = checkType != undefined ? checkType.split(",")[1] : "uncheckedCloud"
779      } else {
780        state = checkType != undefined ? checkType.split(",")[0] : "unchecked"
781      }
782      setPrice(productData, state, quantity, index, $this, __gc.currentVat); //设置价格,设置购买链接
783    });
784
785    function inputChangeNum($elem, type) {
786      var $_this = $elem;
787      var $outer = $_this.closest("[data-pricing-product]");
788      var $parent = $_this.parents('[data-pricing-add="true"]');
789      var $limit = $_this.parents("[data-toplimit]");
790      var limitCnt =
791        $limit.attr("data-toplimit") == "no" ?
792        $limit.attr("data-toplimit") :
793        JSON.parse($limit.attr("data-toplimit"));
794      var num = quantity;
795      var maxNum = limitCnt === "no" ? Infinity : limitCnt[limitCnt.length - 1]; //判断是否可以无限加
796      var type = type || $_this.data("type");
797      $(".toplimit").removeClass("toplimit");
798
799      if (type == "reduce") {
800        $outer.removeClass("toplimit");
801        $parent.find('[data-type="add"]').removeClass("notallow");
802        num <= 1 ? $_this.addClass("notallow") : (num = Number(num) - 1);
803      } else if (type == "add") {
804        $parent.find('[data-type="reduce"]').removeClass("notallow");
805        num = Number(num) + 1;
806      } else if (type == "input") {
807        num =
808          isNaN(parseInt($_this.val())) || parseInt($_this.val()) < 1 ?
809          1 :
810          parseInt($_this.val());
811      }
812
813      if ($.isArray(limitCnt)) {
814        $.each(limitCnt, function(i, n) {
815          if (num <= limitCnt[0]) {
816            return (index = 1);
817          } else if (num > limitCnt[i] && num <= limitCnt[i + 1]) {
818            // console.log(i + 2, 55555555555555555);
819            return (index = i + 2);
820          } else if (num > limitCnt[limitCnt.length - 1]) {
821            return (index = limitCnt.length);
822          }
823        });
824      } else {
825        index = num;
826      }
827      //   console.log(num);
828      //   console.log(index, "indexindex");
829      if (num > maxNum) {
830        $outer.addClass("toplimit");
831        num = maxNum;
832      } else {
833        $outer.removeClass("toplimit");
834      }
835      quantity = num;
836
837      var inputTxt = $parent.find("[data-unit]").length ?
838        num > 1 ?
839        num + " " + $parent.find("[data-unit]").attr("data-unit") + "s" :
840        num + " " + $parent.find("[data-unit]").attr("data-unit") :
841        num;
842
843      // 判断标签是不是可以输入的input
844      $parent.find(".txt").prop("tagName") == "INPUT" ?
845        $parent.find(".txt").val(inputTxt) - 0 :
846        $parent.find(".txt").text(inputTxt);
847
848      setUrlParams($outer);
849      setPrice(productData, state, quantity, index, $_this); //设置价格,设置购买链接
850    }
851
852    // 加减数量
853    $this.on(
854      "click",
855      $addReduceBoxElem.find("[data-type]").selector,
856      function() {
857        var $_this = $(this);
858        inputChangeNum($_this);
859      }
860    );
861    $addReduceBoxElem.find('[data-type="reduce"]').trigger("click");
862
863    // 控制input输入数量
864    // input propertychange
865    $this
866      .on(
867        "blur",
868        $addReduceBoxElem.find('[data-input="change"]').selector,
869        function() {
870          var $_this = $(this);
871          inputChangeNum($_this, "input");
872        }
873      )
874      .on(
875        "keyup",
876        $addReduceBoxElem.find('[data-input="change"]').selector,
877        function(e) {
878          var $_this = $(this);
879          var keyCode = e.keyCode;
880          if (keyCode === 13) {
881            inputChangeNum($_this, "input");
882          }
883        }
884      );
885    $this.on(
886      "focus",
887      $addReduceBoxElem.find('[data-input="change"]').selector,
888      function() {
889        var $_this = $(this);
890        $_this.val("");
891      }
892    );
893
894    $ammCheckElem.on("click", function(e) {
895      // addAMM
896      e.stopImmediatePropagation();
897      var $this = $(this);
898      $this.toggleClass("active");
899      $this.parents('[data-elem="amm-product"]').toggleClass("checked");
900
901      var productName = $this
902        .parents('[data-elem="pricing-box"]')
903        .attr("data-pricing-product");
904      var productData = pricingData[productName];
905
906      var state = $this
907        .parents('[data-elem="pricing-box"]')
908        .find(".pricing-cb")
909        .hasClass("pricing-checked") ?
910        "checked" :
911        "unchecked";
912
913      // setPrice(
914      //     productData,
915      //     state,
916      //     quantity,
917      //     index,
918      //     $this
919      //     .parents('[data-elem="pricing-box"]')
920      //     .find('[data-pricing-checkbox]'),
921      //     __gc.currentVat
922      // ); //设置价格,设置购买链接
923      setPrice(productData, state, quantity, index, $this, __gc.currentVat); //设置价格,设置购买链接
924    });
925  });
926
927  // /**点击body处,取消购买的下拉**/
928
929  $(document).on("click", "body", function(e) {
930    var $pricingSelect = $(".pricing-select");
931    if ($pricingSelect.hasClass("select-expanded")) {
932      $pricingSelect.removeClass("select-expanded");
933    }
934  });
935
936  /**
937   * 价格或者链接的悬浮功能
938   * @type {number}
939   */
940  var toPinHeight =
941    $pin.length > 0 ?
942    headerHeight + $header.next().height() - $pin.height() :
943    headerHeight;
944  showPinContainer($(window).scrollTop() >= toPinHeight);
945  $(window).scroll(function() {
946    $this = $(this);
947    var t = $this.scrollTop();
948
949    showPinContainer(t >= toPinHeight);
950  });
951});

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.