@pisell/pisellos 0.0.510 → 0.0.512

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.
@@ -1244,7 +1244,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1244
1244
  }
1245
1245
  /** 勾选/取消勾选某张折扣券,重新计算折扣并持久化 */
1246
1246
  async setDiscountSelected(params) {
1247
- var _a, _b, _c, _d, _e, _f;
1247
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1248
1248
  this.logMethodStart("setDiscountSelected", params);
1249
1249
  try {
1250
1250
  if (!this.store.order)
@@ -1311,11 +1311,18 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1311
1311
  (sum, pd) => sum + (pd.amount || 0),
1312
1312
  0
1313
1313
  );
1314
- const newSellingPrice = new import_decimal.default(product.original_price || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
1315
- product.selling_price = newSellingPrice;
1314
+ const optionSum = (0, import_utils3.sumOptionUnitPrice)(product.product_option_item);
1315
+ const sourcePrice = ((_d = product.metadata) == null ? void 0 : _d.source_product_price) ?? (((_e = product.metadata) == null ? void 0 : _e.main_product_original_price) != null ? new import_decimal.default(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : product.original_price ?? "0");
1316
+ const newSourceSellingPrice = new import_decimal.default(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
1317
+ const newMainSellingPrice = new import_decimal.default(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
1316
1318
  if (product.metadata) {
1317
- product.metadata.main_product_selling_price = newSellingPrice;
1319
+ product.metadata.main_product_selling_price = newMainSellingPrice;
1320
+ product.metadata.price_schema_version = 2;
1318
1321
  }
1322
+ product.selling_price = (0, import_utils3.composeLinePrice)({
1323
+ mainPrice: newMainSellingPrice,
1324
+ bundle: product.product_bundle
1325
+ });
1319
1326
  }
1320
1327
  import_Order.OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1321
1328
  await (discountModule == null ? void 0 : discountModule.setDiscountList(nextDiscountList));
@@ -1323,8 +1330,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1323
1330
  const afterApplyTarget = this.store.order.getDiscountList().find((d) => d.id === params.discountId) || null;
1324
1331
  await this.store.order.recalculateSummary({ createIfMissing: true });
1325
1332
  this.store.order.persistTempOrder();
1326
- const finalSummary = ((_d = this.store.order.getTempOrder()) == null ? void 0 : _d.summary) || null;
1327
- const finalProduct = ((_f = (_e = this.store.order.getTempOrder()) == null ? void 0 : _e.products) == null ? void 0 : _f[0]) || null;
1333
+ const finalSummary = ((_f = this.store.order.getTempOrder()) == null ? void 0 : _f.summary) || null;
1334
+ const finalProduct = ((_h = (_g = this.store.order.getTempOrder()) == null ? void 0 : _g.products) == null ? void 0 : _h[0]) || null;
1328
1335
  this.logMethodSuccess("setDiscountSelected", params);
1329
1336
  const finalTarget = this.store.order.getDiscountList().find((d) => d.id === params.discountId) || null;
1330
1337
  return this.store.order.getDiscountList();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.510",
4
+ "version": "0.0.512",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",