@pisell/pisellos 2.2.13 → 2.2.14
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.
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Payment/index.js +84 -82
- package/dist/modules/Payment/types.d.ts +0 -1
- package/dist/modules/Payment/walletpass.js +1 -3
- package/dist/modules/ProductList/index.js +9 -8
- package/dist/modules/Rules/index.js +34 -66
- package/dist/solution/BookingByStep/index.js +8 -29
- package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
- package/dist/solution/BookingByStep/utils/products.js +0 -10
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +21 -65
- package/dist/solution/Checkout/utils/index.d.ts +2 -1
- package/dist/solution/Checkout/utils/index.js +6 -4
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Payment/index.js +5 -3
- package/lib/modules/Payment/types.d.ts +0 -1
- package/lib/modules/Payment/walletpass.js +1 -10
- package/lib/modules/ProductList/index.js +7 -0
- package/lib/modules/Rules/index.js +36 -46
- package/lib/solution/BookingByStep/index.js +2 -15
- package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
- package/lib/solution/BookingByStep/utils/products.js +2 -8
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +20 -69
- package/lib/solution/Checkout/utils/index.d.ts +2 -1
- package/lib/solution/Checkout/utils/index.js +6 -4
- package/package.json +2 -2
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -396,66 +396,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
396
396
|
return pre + (item.amount || 0);
|
|
397
397
|
}, 0);
|
|
398
398
|
};
|
|
399
|
-
var
|
|
400
|
-
return
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
quantity: item.num,
|
|
406
|
-
// 商品是否含税:1;0
|
|
407
|
-
is_charge_tax: (_item$is_charge_tax = item.is_charge_tax) !== null && _item$is_charge_tax !== void 0 ? _item$is_charge_tax : 0,
|
|
408
|
-
// 若商品不含税,计算得到的税费,单位(元)
|
|
409
|
-
tax_fee: item.tax_fee,
|
|
410
|
-
// 整个商品折扣后的总金额
|
|
411
|
-
selling_price: item.calculated_selling_price,
|
|
412
|
-
// 使用者id
|
|
413
|
-
holder_id: item.holder_id,
|
|
414
|
-
// 整个商品折扣前的总金额
|
|
415
|
-
original_price: item.calculated_original_price,
|
|
416
|
-
// 主商品折扣前金额,不包含套餐子商品
|
|
417
|
-
main_product_original_price: item.price,
|
|
418
|
-
// 主商品折扣后金额,不包含套餐子商品
|
|
419
|
-
main_product_selling_price: item.main_product_selling_price,
|
|
420
|
-
metadata: {
|
|
421
|
-
// 主商品+非原价(加减价)子商品税费
|
|
422
|
-
"main_product_attached_bundle_tax_fee": item.metadata.main_product_attached_bundle_tax_fee,
|
|
423
|
-
// 主商品+非原价(加减价)子商品附加费
|
|
424
|
-
"main_product_attached_bundle_surcharge_fee": item.metadata.main_product_attached_bundle_surcharge_fee,
|
|
425
|
-
// 可选,附加费均摊舍入金额
|
|
426
|
-
"surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
|
|
427
|
-
},
|
|
428
|
-
product_bundle: item.product_bundle.map(function (bundle) {
|
|
429
|
-
return {
|
|
430
|
-
bundle_id: bundle.bundle_id,
|
|
431
|
-
bundle_product_id: bundle.bundle_product_id,
|
|
432
|
-
bundle_variant_id: bundle.bundle_variant_id,
|
|
433
|
-
price_type: bundle.price_type,
|
|
434
|
-
price_type_ext: bundle.price_type_ext,
|
|
435
|
-
// 套餐子商品总价,不包含折扣金额
|
|
436
|
-
bundle_sum_price: bundle.bundle_sum_price,
|
|
437
|
-
// 套餐子商品折扣后金额
|
|
438
|
-
bundle_selling_price: bundle.bundle_selling_price,
|
|
439
|
-
num: bundle.num,
|
|
440
|
-
is_charge_tax: bundle.is_charge_tax,
|
|
441
|
-
tax_fee: bundle.tax_fee,
|
|
442
|
-
metadata: {
|
|
443
|
-
// 子商品单数量附加费
|
|
444
|
-
"surcharge_fee": bundle.metadata.surcharge_fee,
|
|
445
|
-
// 可选,附加费均摊舍入金额
|
|
446
|
-
"surcharge_rounding_remainder": bundle.metadata.surcharge_rounding_remainder
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
})
|
|
450
|
-
};
|
|
451
|
-
}) || [];
|
|
452
|
-
};
|
|
453
|
-
var productList = formatProduct(((_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.original_order_data) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.bookings) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.map(function (item) {
|
|
454
|
-
return _objectSpread(_objectSpread({}, item.product), {}, {
|
|
399
|
+
var productList = ((_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.original_order_data.bookings) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.map(function (item) {
|
|
400
|
+
return {
|
|
401
|
+
product_id: item.product.product_id,
|
|
402
|
+
product_variant_id: item.product.product_variant_id,
|
|
403
|
+
quantity: item.product.num,
|
|
404
|
+
selling_price: item.product.calculated_selling_price,
|
|
455
405
|
holder_id: _this3.getHolderIdFromBooking(item)
|
|
456
|
-
}
|
|
457
|
-
})) || []
|
|
458
|
-
var relationProducts =
|
|
406
|
+
};
|
|
407
|
+
})) || [];
|
|
408
|
+
var relationProducts = ((_this$store$currentOr2 = this.store.currentOrder.order_info) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.original_order_data) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.relation_products) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.map(function (item) {
|
|
409
|
+
return {
|
|
410
|
+
product_id: item.product_id,
|
|
411
|
+
product_variant_id: item.product_variant_id,
|
|
412
|
+
quantity: item.num,
|
|
413
|
+
selling_price: item.source_product_price
|
|
414
|
+
};
|
|
415
|
+
})) || [];
|
|
459
416
|
return [].concat(_toConsumableArray(productList), _toConsumableArray(relationProducts));
|
|
460
417
|
}
|
|
461
418
|
}, {
|
|
@@ -490,8 +447,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
490
447
|
depositAmount: (_this$store$currentOr5 = this.store.currentOrder) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.deposit_amount,
|
|
491
448
|
isDeposit: (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.is_deposit
|
|
492
449
|
},
|
|
493
|
-
products: this.getProductListByOrder()
|
|
494
|
-
is_price_include_tax: this.otherParams.is_price_include_tax
|
|
450
|
+
products: this.getProductListByOrder()
|
|
495
451
|
}, params); // 判断订单是否已经同步,如果是则追加payment_order_id参数
|
|
496
452
|
if (this.store.isOrderSynced) {
|
|
497
453
|
walletBusinessData.payment_order_id = (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.order_id;
|
|
@@ -1487,7 +1443,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1487
1443
|
key: "addPaymentItemAsync",
|
|
1488
1444
|
value: (function () {
|
|
1489
1445
|
var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(paymentItem) {
|
|
1490
|
-
var orderPaymentType, processedPaymentItem, metadata, paymentItemWithType, remainingAmount, _paymentItem$type, _paymentItem$code, isEftposPayment,
|
|
1446
|
+
var orderPaymentType, processedPaymentItem, metadata, paymentItemWithType, remainingAmount, _paymentItem$type, _paymentItem$code, isEftposPayment, isCash, isCustomePayment, syncResult;
|
|
1491
1447
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1492
1448
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1493
1449
|
case 0:
|
|
@@ -1537,7 +1493,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1537
1493
|
this.logInfo('订单金额还有待付的,同步 EFTPOS 支付');
|
|
1538
1494
|
// 检查是否是 EFTPOS 支付,如果是则立即同步订单
|
|
1539
1495
|
isEftposPayment = ((_paymentItem$type = paymentItem.type) === null || _paymentItem$type === void 0 ? void 0 : _paymentItem$type.toLowerCase()) === 'eftpos' || ((_paymentItem$code = paymentItem.code) === null || _paymentItem$code === void 0 ? void 0 : _paymentItem$code.toUpperCase().includes('EFTPOS'));
|
|
1540
|
-
|
|
1496
|
+
isCash = isCashPayment(paymentItem);
|
|
1541
1497
|
isCustomePayment = paymentItem.type === 'custom';
|
|
1542
1498
|
this.logInfo('EFTPOS 支付检查:', {
|
|
1543
1499
|
paymentCode: paymentItem.code,
|
|
@@ -1545,7 +1501,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1545
1501
|
isEftposPayment: isEftposPayment,
|
|
1546
1502
|
currentOrderSynced: this.store.isOrderSynced
|
|
1547
1503
|
});
|
|
1548
|
-
if (!(isEftposPayment ||
|
|
1504
|
+
if (!(isEftposPayment || isCash || isCustomePayment)) {
|
|
1549
1505
|
_context16.next = 39;
|
|
1550
1506
|
break;
|
|
1551
1507
|
}
|
|
@@ -2658,7 +2614,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2658
2614
|
while (1) switch (_context28.prev = _context28.next) {
|
|
2659
2615
|
case 0:
|
|
2660
2616
|
// 检查是否是现金支付
|
|
2661
|
-
cashPayment = isCashPayment(paymentItem
|
|
2617
|
+
cashPayment = isCashPayment(paymentItem);
|
|
2662
2618
|
if (cashPayment) {
|
|
2663
2619
|
_context28.next = 3;
|
|
2664
2620
|
break;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CheckoutInitParams, CheckoutError, CheckoutErrorType, LocalOrderData, CartSummaryItem, ExtractedAmountInfo } from '../types';
|
|
2
2
|
import { CartItem } from '../../../modules/Cart/types';
|
|
3
|
+
import { PaymentItemInput } from '../../../modules/Payment/types';
|
|
3
4
|
/**
|
|
4
5
|
* 验证结账数据
|
|
5
6
|
*/
|
|
@@ -118,4 +119,4 @@ export declare function shouldSyncOrderForPayment(paymentCode: string, paymentTy
|
|
|
118
119
|
* @param paymentType 支付方式类型
|
|
119
120
|
* @returns 是否为现金支付
|
|
120
121
|
*/
|
|
121
|
-
export declare function isCashPayment(
|
|
122
|
+
export declare function isCashPayment(paymentItem: PaymentItemInput): boolean;
|
|
@@ -499,13 +499,15 @@ export function shouldSyncOrderForPayment(paymentCode, paymentType) {
|
|
|
499
499
|
* @param paymentType 支付方式类型
|
|
500
500
|
* @returns 是否为现金支付
|
|
501
501
|
*/
|
|
502
|
-
export function isCashPayment(
|
|
503
|
-
var
|
|
504
|
-
var
|
|
502
|
+
export function isCashPayment(paymentItem) {
|
|
503
|
+
var _paymentItem$code, _paymentItem$type, _paymentItem$name;
|
|
504
|
+
var codeUpper = ((_paymentItem$code = paymentItem.code) === null || _paymentItem$code === void 0 ? void 0 : _paymentItem$code.toUpperCase()) || '';
|
|
505
|
+
var typeUpper = ((_paymentItem$type = paymentItem.type) === null || _paymentItem$type === void 0 ? void 0 : _paymentItem$type.toUpperCase()) || '';
|
|
506
|
+
var isNameCash = (_paymentItem$name = paymentItem.name) === null || _paymentItem$name === void 0 ? void 0 : _paymentItem$name.toLowerCase().includes('cash');
|
|
505
507
|
|
|
506
508
|
// 现金支付识别规则
|
|
507
509
|
var cashIdentifiers = ['CASH', 'CASHMANUAL', 'MANUAL'];
|
|
508
510
|
return cashIdentifiers.some(function (identifier) {
|
|
509
511
|
return codeUpper.includes(identifier) || typeUpper.includes(identifier);
|
|
510
|
-
});
|
|
512
|
+
}) || isNameCash;
|
|
511
513
|
}
|
|
@@ -102,7 +102,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
102
102
|
skip,
|
|
103
103
|
num,
|
|
104
104
|
sort_by: import_constants.SORT_BY,
|
|
105
|
-
with: ["latestWalletDetail.wallet"
|
|
105
|
+
with: ["latestWalletDetail.wallet"],
|
|
106
106
|
search_wallet_flag: 1,
|
|
107
107
|
search_wallet_pass_flag: 1,
|
|
108
108
|
...search && { search },
|
|
@@ -192,7 +192,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
192
192
|
this.refreshPaymentMethodsInBackground(cachedMethods);
|
|
193
193
|
return cachedMethods;
|
|
194
194
|
}
|
|
195
|
-
const response = await this.request.get("/pay/custom-payment/
|
|
195
|
+
const response = await this.request.get("/pay/custom-payment/all");
|
|
196
|
+
response.data = response.data.filter((method) => method.status === 1 && method.disable === 0);
|
|
196
197
|
const payMethods = response.data || [];
|
|
197
198
|
try {
|
|
198
199
|
for (const method of payMethods) {
|
|
@@ -225,7 +226,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
225
226
|
});
|
|
226
227
|
try {
|
|
227
228
|
console.log("[PaymentModule] 后台刷新支付方式列表...");
|
|
228
|
-
const response = await this.request.get("/pay/custom-payment/
|
|
229
|
+
const response = await this.request.get("/pay/custom-payment/all");
|
|
230
|
+
response.data = response.data.filter((method) => method.status === 1 && method.disable === 0);
|
|
229
231
|
const newPayMethods = response.data || [];
|
|
230
232
|
const hasChanges = this.hasPaymentMethodsChanged(
|
|
231
233
|
cachedMethods,
|
|
@@ -623,7 +625,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
623
625
|
this.logInfo("更新订单支付项完成", {
|
|
624
626
|
orderUuid
|
|
625
627
|
});
|
|
626
|
-
this.core.effects.emit(
|
|
628
|
+
this.core.effects.emit(import_types.PaymentHooks.OnPaymentAdded, {
|
|
627
629
|
orderUuid,
|
|
628
630
|
payment: newPaymentItem
|
|
629
631
|
});
|
|
@@ -51,19 +51,10 @@ var WalletPassPaymentImpl = class {
|
|
|
51
51
|
*/
|
|
52
52
|
generateWalletParams(businessData) {
|
|
53
53
|
var _a, _b;
|
|
54
|
-
const {
|
|
55
|
-
customer_id,
|
|
56
|
-
holder,
|
|
57
|
-
amountInfo,
|
|
58
|
-
products,
|
|
59
|
-
order_wait_pay_amount,
|
|
60
|
-
payment_order_id,
|
|
61
|
-
is_price_include_tax
|
|
62
|
-
} = businessData;
|
|
54
|
+
const { customer_id, holder, amountInfo, products, order_wait_pay_amount, payment_order_id } = businessData;
|
|
63
55
|
const totalAmount = Number(amountInfo.totalAmount);
|
|
64
56
|
const subTotal = Number(amountInfo.subTotal);
|
|
65
57
|
const walletParams = {
|
|
66
|
-
is_price_include_tax,
|
|
67
58
|
sale_channel: "pos",
|
|
68
59
|
customer_id: customer_id || 0,
|
|
69
60
|
// 提供默认值,确保类型为 number
|
|
@@ -103,6 +103,13 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
103
103
|
{ osServer: true }
|
|
104
104
|
);
|
|
105
105
|
const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
106
|
+
if (sortedList.length) {
|
|
107
|
+
sortedList.forEach((n) => {
|
|
108
|
+
if (n.is_eject !== 1 && n["schedule.ids"] && n["schedule.ids"].length) {
|
|
109
|
+
n.is_eject = 1;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
106
113
|
this.addProduct(sortedList);
|
|
107
114
|
return sortedList;
|
|
108
115
|
}
|
|
@@ -36,7 +36,6 @@ var import_BaseModule = require("../BaseModule");
|
|
|
36
36
|
var import_utils = require("../../solution/ShopDiscount/utils");
|
|
37
37
|
var import_utils2 = require("../Cart/utils");
|
|
38
38
|
var import_decimal = __toESM(require("decimal.js"));
|
|
39
|
-
var import_lodash_es = require("lodash-es");
|
|
40
39
|
var import_dayjs = __toESM(require("dayjs"));
|
|
41
40
|
var RulesModule = class extends import_BaseModule.BaseModule {
|
|
42
41
|
constructor(name, version) {
|
|
@@ -297,7 +296,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
297
296
|
const isLimitedProduct = (limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
|
|
298
297
|
const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_c = product == null ? void 0 : product.discount_list) == null ? void 0 : _c.length) && ((_d = product == null ? void 0 : product.discount_list) == null ? void 0 : _d.every((discount2) => discount2.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount2.tag || discount2.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && ((_f = (_e = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _e.metadata) == null ? void 0 : _f.custom_product_bundle_map_id));
|
|
299
298
|
const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
|
|
300
|
-
if (isAvailableProduct && isLimitedProduct &&
|
|
299
|
+
if (isAvailableProduct && isLimitedProduct && isBundleAvailable && timeLimit) {
|
|
301
300
|
(_g = discountApplicability.get(discount.id)) == null ? void 0 : _g.push(product.id);
|
|
302
301
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
303
302
|
const discountType = discount.tag || discount.type;
|
|
@@ -327,7 +326,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
327
326
|
});
|
|
328
327
|
const processedFlatItemsMap = /* @__PURE__ */ new Map();
|
|
329
328
|
sortedFlattenedList.forEach((flatItem, index) => {
|
|
330
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
329
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
331
330
|
let product, originProduct;
|
|
332
331
|
if (flatItem.type === "main") {
|
|
333
332
|
product = flatItem.product;
|
|
@@ -365,7 +364,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
365
364
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
366
365
|
})) && (discount.tag || discount.type) === "good_pass")
|
|
367
366
|
return false;
|
|
368
|
-
if ((Number(product.price)
|
|
367
|
+
if ((Number(product.price) === 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.find((n) => {
|
|
369
368
|
var _a3;
|
|
370
369
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
371
370
|
})) && (discount.tag || discount.type) !== "good_pass")
|
|
@@ -465,7 +464,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
465
464
|
}
|
|
466
465
|
}
|
|
467
466
|
}
|
|
468
|
-
if (
|
|
467
|
+
if ((options == null ? void 0 : options.selectedList) && ((_t = product.discount_list) == null ? void 0 : _t.some((item) => {
|
|
468
|
+
var _a2;
|
|
469
|
+
return (_a2 = options == null ? void 0 : options.selectedList) == null ? void 0 : _a2.some((n) => {
|
|
470
|
+
var _a3;
|
|
471
|
+
return n.discountId === ((_a3 = item.discount) == null ? void 0 : _a3.resource_id);
|
|
472
|
+
});
|
|
473
|
+
}))) {
|
|
474
|
+
isManualDiscount = false;
|
|
475
|
+
}
|
|
476
|
+
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
469
477
|
if (flatItem.type === "main") {
|
|
470
478
|
if (product.isClient) {
|
|
471
479
|
processedProductsMap.set(
|
|
@@ -497,10 +505,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
497
505
|
processedProductsMap.set(
|
|
498
506
|
product._id,
|
|
499
507
|
[this.hooks.setProduct(originProduct, {
|
|
500
|
-
...isManualDiscount ? {
|
|
501
|
-
price: product.price,
|
|
502
|
-
main_product_selling_price: product.price
|
|
503
|
-
} : {
|
|
508
|
+
...isManualDiscount ? {} : {
|
|
504
509
|
_id: product._id.split("___")[0] + "___" + index,
|
|
505
510
|
total: product.origin_total || product.total,
|
|
506
511
|
price: product.price,
|
|
@@ -514,7 +519,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
514
519
|
processedFlatItemsMap.set(flatItem._id, [{
|
|
515
520
|
...flatItem,
|
|
516
521
|
discount_list: [],
|
|
517
|
-
price:
|
|
522
|
+
price: flatItem.bundleItem.original_price,
|
|
518
523
|
processed: true
|
|
519
524
|
}]);
|
|
520
525
|
}
|
|
@@ -541,10 +546,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
541
546
|
usedDiscounts.set(selectedDiscount2.id, true);
|
|
542
547
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
543
548
|
let productOriginTotal = product.origin_total || product.total || 0;
|
|
544
|
-
if (((
|
|
549
|
+
if (((_u = product.discount_list) == null ? void 0 : _u.length) && product.origin_total) {
|
|
545
550
|
productOriginTotal = product.origin_total;
|
|
546
551
|
}
|
|
547
|
-
if (Number(((
|
|
552
|
+
if (Number(((_v = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _v.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
|
|
548
553
|
productOriginTotal = product.total;
|
|
549
554
|
}
|
|
550
555
|
const targetProductTotal = (0, import_utils.getDiscountAmount)(selectedDiscount2, product.price, product.price);
|
|
@@ -555,7 +560,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
555
560
|
amount,
|
|
556
561
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : discountType,
|
|
557
562
|
discount: {
|
|
558
|
-
discount_card_type: (
|
|
563
|
+
discount_card_type: (_w = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _w.discount_card_type,
|
|
559
564
|
fixed_amount: amount,
|
|
560
565
|
resource_id: selectedDiscount2.id,
|
|
561
566
|
title: selectedDiscount2.format_title,
|
|
@@ -677,7 +682,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
677
682
|
amount: new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber() * (product.num || 1),
|
|
678
683
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
|
|
679
684
|
discount: {
|
|
680
|
-
discount_card_type: (
|
|
685
|
+
discount_card_type: (_x = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _x.discount_card_type,
|
|
681
686
|
fixed_amount: new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber(),
|
|
682
687
|
resource_id: selectedDiscount2.id,
|
|
683
688
|
title: selectedDiscount2.format_title,
|
|
@@ -690,7 +695,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
690
695
|
custom_product_bundle_map_id: uniqueId,
|
|
691
696
|
num: product.num || 1
|
|
692
697
|
},
|
|
693
|
-
_num: (product.num || 1) * (((
|
|
698
|
+
_num: (product.num || 1) * (((_y = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _y.num) || 1)
|
|
694
699
|
};
|
|
695
700
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
696
701
|
appliedProducts.push(discountDetail);
|
|
@@ -854,16 +859,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
854
859
|
const allDiscountAmount = (0, import_utils.getDiscountListAmountTotal)(mainDiscountList);
|
|
855
860
|
newTotalWithDiscount = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotalWithDiscount;
|
|
856
861
|
newOriginTotalWithDiscount = mainProductData.origin_total ?? newOriginTotalWithDiscount;
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
|
|
866
|
-
});
|
|
862
|
+
if (newBundleWithDiscount.length > 0) {
|
|
863
|
+
newBundleWithDiscount.forEach((item) => {
|
|
864
|
+
var _a, _b, _c;
|
|
865
|
+
newTotalWithDiscount += Number(item.price) * Number(item.num);
|
|
866
|
+
const originalPrice = ((_c = (_b = (_a = item.discount_list) == null ? void 0 : _a[0]) == null ? void 0 : _b.discount) == null ? void 0 : _c.original_amount) || item.price;
|
|
867
|
+
newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
|
|
868
|
+
});
|
|
869
|
+
}
|
|
867
870
|
}
|
|
868
871
|
if (product == null ? void 0 : product.options) {
|
|
869
872
|
newTotalWithDiscount = product.options.reduce((accumulator, currentValue) => {
|
|
@@ -915,12 +918,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
915
918
|
const allDiscountAmount = (0, import_utils.getDiscountListAmount)(mainDiscountListOriginal);
|
|
916
919
|
newTotalOriginal = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotalOriginal;
|
|
917
920
|
newOriginTotalOriginal = mainProductData.origin_total ?? newOriginTotalOriginal;
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
}
|
|
921
|
+
if (newBundleOriginal.length > 0) {
|
|
922
|
+
newBundleOriginal.forEach((item) => {
|
|
923
|
+
newTotalOriginal += Number(item.price) * Number(item.num);
|
|
924
|
+
newOriginTotalOriginal += Number(item.price) * Number(item.num);
|
|
925
|
+
});
|
|
926
|
+
}
|
|
924
927
|
}
|
|
925
928
|
if (product == null ? void 0 : product.options) {
|
|
926
929
|
newTotalOriginal = product.options.reduce((accumulator, currentValue) => {
|
|
@@ -994,11 +997,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
994
997
|
newOriginTotal = mainProductData.origin_total ?? newOriginTotal;
|
|
995
998
|
}
|
|
996
999
|
if (newBundle.length > 0) {
|
|
997
|
-
newBundle.forEach((item) => {
|
|
998
|
-
newTotal += Number(item.price) * Number(item.num);
|
|
999
|
-
});
|
|
1000
1000
|
newBundle.forEach((item) => {
|
|
1001
1001
|
var _a2, _b2, _c2;
|
|
1002
|
+
newTotal += Number(item.price) * Number(item.num);
|
|
1002
1003
|
const originalPrice = ((_c2 = (_b2 = (_a2 = item.discount_list) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.discount) == null ? void 0 : _c2.original_amount) || item.price;
|
|
1003
1004
|
newOriginTotal += Number(originalPrice) * Number(item.num);
|
|
1004
1005
|
});
|
|
@@ -1139,18 +1140,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1139
1140
|
if (isBundleItem) {
|
|
1140
1141
|
const priceType = (_c = flatItem.bundleItem) == null ? void 0 : _c.price_type;
|
|
1141
1142
|
const priceTypeExt = (_d = flatItem.bundleItem) == null ? void 0 : _d.price_type_ext;
|
|
1142
|
-
|
|
1143
|
-
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1144
|
-
if (rules.length > 0) {
|
|
1145
|
-
if (isOriginalPrice && rules.includes("original_price")) {
|
|
1146
|
-
return true;
|
|
1147
|
-
}
|
|
1148
|
-
if (isMarkupPrice && rules.includes("markup_price")) {
|
|
1149
|
-
return true;
|
|
1150
|
-
}
|
|
1151
|
-
return false;
|
|
1152
|
-
}
|
|
1153
|
-
return isOriginalPrice;
|
|
1143
|
+
return priceType === "markup" && priceTypeExt === "product_price";
|
|
1154
1144
|
}
|
|
1155
1145
|
return false;
|
|
1156
1146
|
}
|
|
@@ -185,19 +185,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
185
185
|
collection = [],
|
|
186
186
|
schedule_date
|
|
187
187
|
}) {
|
|
188
|
-
|
|
188
|
+
return this.store.products.loadProducts({
|
|
189
189
|
category_ids,
|
|
190
190
|
product_ids,
|
|
191
191
|
collection,
|
|
192
192
|
schedule_date,
|
|
193
193
|
cacheId: this.cacheId
|
|
194
194
|
});
|
|
195
|
-
this.getAvailableDate({
|
|
196
|
-
startDate: schedule_date || (0, import_dayjs.default)().format("YYYY-MM-DD"),
|
|
197
|
-
endDate: schedule_date || (0, import_dayjs.default)().format("YYYY-MM-DD"),
|
|
198
|
-
products: [...res]
|
|
199
|
-
});
|
|
200
|
-
return res;
|
|
201
195
|
}
|
|
202
196
|
/**
|
|
203
197
|
* 通过 schedule 来读取商品,适用于 session 类商品
|
|
@@ -234,12 +228,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
234
228
|
const allProductIds = [...newProductIds, ...otherProductsIds].filter(
|
|
235
229
|
(n, index, self) => self.indexOf(n) === index
|
|
236
230
|
);
|
|
237
|
-
|
|
231
|
+
return await this.loadProducts({
|
|
238
232
|
product_ids: allProductIds,
|
|
239
233
|
category_ids,
|
|
240
234
|
schedule_date: date
|
|
241
235
|
});
|
|
242
|
-
return res;
|
|
243
236
|
}
|
|
244
237
|
/**
|
|
245
238
|
* 更新完商品数据、切换日期、或者在较后的流程里登录了,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
|
|
@@ -606,12 +599,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
606
599
|
quantity = 1
|
|
607
600
|
} = product || {};
|
|
608
601
|
const productData = { ...origin, product_variant_id };
|
|
609
|
-
debugger;
|
|
610
|
-
if ((0, import_products.isSessionProduct)(productData)) {
|
|
611
|
-
if (!date || !date.startTime || !date.endTime) {
|
|
612
|
-
return { success: false, errorCode: "date_or_time_required" };
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
602
|
const currentCartItems = this.store.cart.getItems();
|
|
616
603
|
const stockCheckResult = (0, import_stock.checkProductStock)({
|
|
617
604
|
productData,
|
|
@@ -9,9 +9,3 @@ export declare const getAvailableProductResources: (products: ProductData[]) =>
|
|
|
9
9
|
rules: any[];
|
|
10
10
|
resourcesMap: Record<number, ProductResourceItem>;
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
13
|
-
* 判断商品是否是 session 商品
|
|
14
|
-
* @param product 商品数据
|
|
15
|
-
* @returns 是否是 session 商品
|
|
16
|
-
*/
|
|
17
|
-
export declare const isSessionProduct: (product: ProductData) => boolean;
|
|
@@ -19,8 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/solution/BookingByStep/utils/products.ts
|
|
20
20
|
var products_exports = {};
|
|
21
21
|
__export(products_exports, {
|
|
22
|
-
getAvailableProductResources: () => getAvailableProductResources
|
|
23
|
-
isSessionProduct: () => isSessionProduct
|
|
22
|
+
getAvailableProductResources: () => getAvailableProductResources
|
|
24
23
|
});
|
|
25
24
|
module.exports = __toCommonJS(products_exports);
|
|
26
25
|
var getAvailableProductResources = (products) => {
|
|
@@ -58,12 +57,7 @@ var getAvailableProductResources = (products) => {
|
|
|
58
57
|
});
|
|
59
58
|
return { resourceIds: [...new Set(resourceIds)], rules, resourcesMap };
|
|
60
59
|
};
|
|
61
|
-
var isSessionProduct = (product) => {
|
|
62
|
-
var _a;
|
|
63
|
-
return (((_a = product == null ? void 0 : product["schedule.ids"]) == null ? void 0 : _a.length) ?? 0) > 0;
|
|
64
|
-
};
|
|
65
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
61
|
0 && (module.exports = {
|
|
67
|
-
getAvailableProductResources
|
|
68
|
-
isSessionProduct
|
|
62
|
+
getAvailableProductResources
|
|
69
63
|
});
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|