@pisell/pisellos 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -401,7 +401,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
401
401
  var isNeedSplit = (selectedDiscount.tag || selectedDiscount.type) === 'good_pass';
402
402
 
403
403
  // 需要拆分出来的数量
404
- var splitCount = isNeedSplit ? Math.min(product.quantity, applicableDiscounts.filter(function (item) {
404
+ var splitCount = isNeedSplit ? Math.min(product.quantity || product.num || 1, applicableDiscounts.filter(function (item) {
405
405
  return (item.tag || item.type) === 'good_pass';
406
406
  }).length) : 1;
407
407
  var arr = [];
@@ -441,8 +441,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
441
441
  var _originProduct$_produ;
442
442
  var variant = (_originProduct$_produ = originProduct._productOrigin.variant) === null || _originProduct$_produ === void 0 ? void 0 : _originProduct$_produ.map(function (n) {
443
443
  if (n.id === originProduct._productOrigin.product_variant_id) {
444
- n.original_price = n.price;
445
- var _targetProductPrice = selectedDiscount.tag === 'good_pass' ? '0' : new Decimal(100).minus(selectedDiscount.par_value || 0).div(100).mul(new Decimal(n.price || 0)).toFixed(2);
444
+ n.original_price = originProduct._productInit.price;
445
+ var _targetProductPrice = selectedDiscount.tag === 'good_pass' ? '0' : new Decimal(100).minus(selectedDiscount.par_value || 0).div(100).mul(new Decimal(originProduct._productInit.price || 0)).toFixed(2);
446
446
  n.price = _targetProductPrice;
447
447
  }
448
448
  return n;
@@ -279,7 +279,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
279
279
  return;
280
280
  }
281
281
  const isNeedSplit = (selectedDiscount.tag || selectedDiscount.type) === "good_pass";
282
- const splitCount = isNeedSplit ? Math.min(product.quantity, applicableDiscounts.filter((item) => (item.tag || item.type) === "good_pass").length) : 1;
282
+ const splitCount = isNeedSplit ? Math.min(product.quantity || product.num || 1, applicableDiscounts.filter((item) => (item.tag || item.type) === "good_pass").length) : 1;
283
283
  const arr = [];
284
284
  if (splitCount < product.quantity && isNeedSplit) {
285
285
  arr.push(this.hooks.setProduct(originProduct, {
@@ -310,8 +310,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
310
310
  if (product.isClient) {
311
311
  const variant = (_f = originProduct._productOrigin.variant) == null ? void 0 : _f.map((n) => {
312
312
  if (n.id === originProduct._productOrigin.product_variant_id) {
313
- n.original_price = n.price;
314
- const targetProductPrice2 = selectedDiscount2.tag === "good_pass" ? "0" : new import_decimal.default(100).minus(selectedDiscount2.par_value || 0).div(100).mul(new import_decimal.default(n.price || 0)).toFixed(2);
313
+ n.original_price = originProduct._productInit.price;
314
+ const targetProductPrice2 = selectedDiscount2.tag === "good_pass" ? "0" : new import_decimal.default(100).minus(selectedDiscount2.par_value || 0).div(100).mul(new import_decimal.default(originProduct._productInit.price || 0)).toFixed(2);
315
315
  n.price = targetProductPrice2;
316
316
  }
317
317
  return n;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "1.0.13",
4
+ "version": "1.0.15",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",