@pisell/pisellos 0.0.136 → 0.0.137
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.
|
@@ -283,7 +283,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
283
283
|
// 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
|
|
284
284
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
285
285
|
// 如果优惠券已被使用,则跳过
|
|
286
|
-
|
|
286
|
+
var targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
287
|
+
if (targetUsedDiscounts && discount.type === 'good_pass') return false;
|
|
287
288
|
var limitedData = discount.limited_relation_product_data;
|
|
288
289
|
|
|
289
290
|
// 判断优惠券是否适用于该商品
|
|
@@ -559,24 +559,28 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
559
559
|
key: "storeProduct",
|
|
560
560
|
value: function () {
|
|
561
561
|
var _storeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(productData) {
|
|
562
|
-
var activeAccount, _ref4, bundle, options, origin, product_variant_id, _ref4$quantity, quantity, rowKey, cartItems, targetCartItem, product, addCartItem;
|
|
562
|
+
var activeAccount, _ref4, bundle, options, origin, product_variant_id, _ref4$quantity, quantity, rowKey, cartItems, targetCartItem, currentAccount, targetAccount, isSameAccount, product, addCartItem;
|
|
563
563
|
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
564
564
|
while (1) switch (_context8.prev = _context8.next) {
|
|
565
565
|
case 0:
|
|
566
566
|
// 往购物车加商品数据的时候,默认用当前 activeAccount 填充到 product 的 account 里面
|
|
567
567
|
activeAccount = this.getActiveAccount();
|
|
568
568
|
_ref4 = productData || {}, bundle = _ref4.bundle, options = _ref4.options, origin = _ref4.origin, product_variant_id = _ref4.product_variant_id, _ref4$quantity = _ref4.quantity, quantity = _ref4$quantity === void 0 ? 1 : _ref4$quantity, rowKey = _ref4.rowKey; // 检查购物车里是否已经存在 rowKey相同的数据,如果是则更新数量
|
|
569
|
+
// 还需要判断账号是否一致
|
|
569
570
|
cartItems = this.store.cart.getItems();
|
|
570
571
|
if (!rowKey) {
|
|
571
|
-
_context8.next =
|
|
572
|
+
_context8.next = 12;
|
|
572
573
|
break;
|
|
573
574
|
}
|
|
574
575
|
targetCartItem = cartItems.find(function (n) {
|
|
575
576
|
var _n$_productOrigin;
|
|
576
577
|
return ((_n$_productOrigin = n._productOrigin) === null || _n$_productOrigin === void 0 ? void 0 : _n$_productOrigin.rowKey) === rowKey;
|
|
577
578
|
});
|
|
578
|
-
|
|
579
|
-
|
|
579
|
+
currentAccount = this.store.accountList.getActiveAccount();
|
|
580
|
+
targetAccount = targetCartItem === null || targetCartItem === void 0 ? void 0 : targetCartItem.holder_id;
|
|
581
|
+
isSameAccount = (currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.getId()) === targetAccount;
|
|
582
|
+
if (!(targetCartItem && isNormalProduct(targetCartItem._productOrigin) && isSameAccount)) {
|
|
583
|
+
_context8.next = 12;
|
|
580
584
|
break;
|
|
581
585
|
}
|
|
582
586
|
this.store.cart.updateItem({
|
|
@@ -587,7 +591,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
587
591
|
// 这里需要单独触发一个,购物车商品数量发生改变的 hook
|
|
588
592
|
this.core.effects.emit("".concat(this.store.cart.name, ":onUpdateCartItemNums"), {});
|
|
589
593
|
return _context8.abrupt("return");
|
|
590
|
-
case
|
|
594
|
+
case 12:
|
|
591
595
|
product = _objectSpread(_objectSpread({}, origin), {}, {
|
|
592
596
|
product_variant_id: product_variant_id,
|
|
593
597
|
rowKey: rowKey
|
|
@@ -602,7 +606,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
602
606
|
addCartItem.account = activeAccount;
|
|
603
607
|
}
|
|
604
608
|
this.store.cart.addItem(addCartItem);
|
|
605
|
-
case
|
|
609
|
+
case 16:
|
|
606
610
|
case "end":
|
|
607
611
|
return _context8.stop();
|
|
608
612
|
}
|
|
@@ -191,7 +191,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
194
|
-
|
|
194
|
+
const targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
195
|
+
if (targetUsedDiscounts && discount.type === "good_pass")
|
|
195
196
|
return false;
|
|
196
197
|
const limitedData = discount.limited_relation_product_data;
|
|
197
198
|
if (limitedData.type === "product_all") {
|
|
@@ -351,7 +351,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
351
351
|
var _a;
|
|
352
352
|
return ((_a = n._productOrigin) == null ? void 0 : _a.rowKey) === rowKey;
|
|
353
353
|
});
|
|
354
|
-
|
|
354
|
+
const currentAccount = this.store.accountList.getActiveAccount();
|
|
355
|
+
const targetAccount = targetCartItem == null ? void 0 : targetCartItem.holder_id;
|
|
356
|
+
const isSameAccount = (currentAccount == null ? void 0 : currentAccount.getId()) === targetAccount;
|
|
357
|
+
if (targetCartItem && (0, import_utils4.isNormalProduct)(targetCartItem._productOrigin) && isSameAccount) {
|
|
355
358
|
this.store.cart.updateItem({
|
|
356
359
|
_id: targetCartItem._id,
|
|
357
360
|
product: {
|