@pisell/pisellos 0.0.147 → 0.0.148

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.
@@ -442,24 +442,25 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
442
442
  (item.discount_list || []).forEach(function (discount) {
443
443
  if (discount.id && ['good_pass', 'discount_card'].includes(discount.type)) {
444
444
  var index = editModeDiscountList.findIndex(function (n) {
445
- return n.id === discount.id;
445
+ var _discount$discount;
446
+ return n.id === ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
446
447
  });
447
448
  if (index !== -1) {
448
449
  editModeDiscountList[index] = _objectSpread(_objectSpread({}, editModeDiscountList[index]), {}, {
449
450
  amount: discount.amount + editModeDiscountList[index].amount
450
451
  });
451
452
  } else {
452
- var _discount$discount, _discount$discount2, _discount$discount3;
453
+ var _discount$discount2, _discount$discount3, _discount$discount4;
453
454
  editModeDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
454
455
  isEditMode: true,
455
456
  limited_relation_product_data: {},
456
457
  savedAmount: discount.amount * ((product === null || product === void 0 ? void 0 : product.num) || 1),
457
458
  isAvailable: true,
458
- id: ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id,
459
- format_title: ((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.title) || discount.format_title,
459
+ id: ((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) || discount.id,
460
+ format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
460
461
  isDisabled: true,
461
462
  isSelected: true,
462
- product_id: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.product_id) || discount.product_id
463
+ product_id: ((_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.product_id) || discount.product_id
463
464
  }));
464
465
  }
465
466
  }
@@ -276,7 +276,10 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
276
276
  (item.discount_list || []).forEach((discount) => {
277
277
  var _a3, _b, _c;
278
278
  if (discount.id && ["good_pass", "discount_card"].includes(discount.type)) {
279
- const index = editModeDiscountList.findIndex((n) => n.id === discount.id);
279
+ const index = editModeDiscountList.findIndex((n) => {
280
+ var _a4;
281
+ return n.id === ((_a4 = discount.discount) == null ? void 0 : _a4.resource_id) || discount.id;
282
+ });
280
283
  if (index !== -1) {
281
284
  editModeDiscountList[index] = {
282
285
  ...editModeDiscountList[index],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.147",
4
+ "version": "0.0.148",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",