@pisell/pisellos 2.3.56 → 2.3.58

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.
@@ -1186,19 +1186,27 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1186
1186
  return false;
1187
1187
  });
1188
1188
 
1189
- // 用户显式点击某张折扣卡时,本次选择优先于自动排序和扫码默认选择。
1189
+ // 用户显式点击某张卡券时,本次选择优先于自动排序和扫码默认选择。
1190
1190
  // 目标仍必须在当前商品的 applicableDiscounts 中,因此不会绕过 Holder、时间或商品范围校验。
1191
- var explicitlySelectedDiscountCard = (options === null || options === void 0 ? void 0 : options.isSelected) === true && options.discountId !== undefined ? applicableDiscounts.find(function (discount) {
1191
+ var explicitlySelectedDiscount = (options === null || options === void 0 ? void 0 : options.isSelected) === true && options.discountId !== undefined ? applicableDiscounts.find(function (discount) {
1192
1192
  var discountType = discount.tag || discount.type;
1193
- return String(discount.id) === String(options.discountId) && ['discount_card', 'product_discount_card'].includes(discountType);
1193
+ return String(discount.id) === String(options.discountId) && ['good_pass', 'discount_card', 'product_discount_card'].includes(discountType);
1194
1194
  }) : undefined;
1195
+ // 折扣卡会复用于整条商品行;商品券必须继续按单张拆分,不能复用该分支。
1196
+ var explicitlySelectedDiscountCard = explicitlySelectedDiscount && (explicitlySelectedDiscount.tag || explicitlySelectedDiscount.type) !== 'good_pass' ? explicitlySelectedDiscount : undefined;
1195
1197
 
1196
1198
  // 没有显式选择时保持现有行为:扫码且已选中的折扣卡优先,否则使用自动排序第一项。
1197
1199
  var scannedSelectedDiscountCard = applicableDiscounts.find(function (n) {
1198
1200
  return n.isScan && n.isSelected && (n.tag || n.type) !== 'good_pass';
1199
1201
  });
1200
1202
  var selectedDiscountCard = explicitlySelectedDiscountCard || scannedSelectedDiscountCard;
1201
- var selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
1203
+ var selectedDiscount = explicitlySelectedDiscount || selectedDiscountCard || applicableDiscounts[0];
1204
+ var prioritizedApplicableDiscounts = explicitlySelectedDiscount && (explicitlySelectedDiscount.tag || explicitlySelectedDiscount.type) === 'good_pass' ? [explicitlySelectedDiscount].concat(_toConsumableArray(applicableDiscounts.filter(function (discount) {
1205
+ var discountType = discount.tag || discount.type;
1206
+ return discountType === 'good_pass' && String(discount.id) !== String(explicitlySelectedDiscount.id);
1207
+ })), _toConsumableArray(applicableDiscounts.filter(function (discount) {
1208
+ return (discount.tag || discount.type) !== 'good_pass';
1209
+ }))) : applicableDiscounts;
1202
1210
 
1203
1211
  // 如果是手动折扣,则不适用优惠券
1204
1212
  var isManualDiscount = false;
@@ -1440,8 +1448,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1440
1448
  }
1441
1449
  for (var i = 0; i < splitCount; i++) {
1442
1450
  var _originProduct4, _selectedDiscount$con, _product$options, _product$options2, _selectedDiscount$met, _selectedDiscount$met2, _reapplyDiscountPerce;
1443
- // 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
1444
- var _selectedDiscount = selectedDiscountCard || applicableDiscounts[i];
1451
+ var _selectedDiscount = isNeedSplit ? prioritizedApplicableDiscounts[i] : selectedDiscountCard || applicableDiscounts[i];
1445
1452
  // 标记优惠券为已使用
1446
1453
  usedDiscounts.set(_selectedDiscount.id, true);
1447
1454
  // 🔥 更新 product_id 使用计数
@@ -1586,7 +1593,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1586
1593
  // 生成有折扣的商品(每张商品券对应 num: 1)
1587
1594
  for (var _i = 0; _i < discountNum; _i++) {
1588
1595
  var _selectedDiscount2$me;
1589
- var _selectedDiscount2 = applicableDiscounts[_i];
1596
+ var _selectedDiscount2 = prioritizedApplicableDiscounts[_i];
1590
1597
  usedDiscounts.set(_selectedDiscount2.id, true);
1591
1598
  // 🔥 更新 product_id 使用计数
1592
1599
  if ((_selectedDiscount2.tag || _selectedDiscount2.type) === 'good_pass') {
@@ -164,6 +164,12 @@ declare class Server {
164
164
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
165
165
  */
166
166
  refreshOrdersInBackground(): Promise<void>;
167
+ /**
168
+ * 编辑正式订单时强制查询 Server 最新快照并覆盖本地缓存。
169
+ * 商品成员增删由 OrderModule 在 SQLite/Store 更新完成后广播,
170
+ * UI 可复用 order:onRemoteProductMembershipChanged 处理冲突。
171
+ */
172
+ checkRemoteOrderProductMembership(orderId: string | number): Promise<void>;
167
173
  /**
168
174
  * 清空所有server模块的IndexedDB缓存
169
175
  * @returns Promise<void>