@pisell/pisellos 2.2.13 → 2.2.15
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/Order/index.js +18 -13
- package/dist/modules/Payment/index.d.ts +1 -0
- package/dist/modules/Payment/index.js +537 -500
- 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/Order/index.js +20 -18
- package/lib/modules/Payment/index.d.ts +1 -0
- package/lib/modules/Payment/index.js +19 -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
|
@@ -175,6 +175,20 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
+
async filterPayMethods(payMethods) {
|
|
179
|
+
payMethods.filter((method) => method.status === 1 && method.disable === 0);
|
|
180
|
+
const walletPassMethod = payMethods.find((method) => method.code === "WALLET_PASS");
|
|
181
|
+
if (walletPassMethod) {
|
|
182
|
+
payMethods.forEach((method) => {
|
|
183
|
+
if (method.code === "PRODUCTVOUCHER" || method.code === "GIFTCARD" || method.code === "POINTCARD") {
|
|
184
|
+
method.channel_application = walletPassMethod.channel_application;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
} else {
|
|
188
|
+
payMethods = payMethods.filter((method) => method.code !== "PRODUCTVOUCHER" && method.code !== "GIFTCARD" && method.code !== "POINTCARD");
|
|
189
|
+
}
|
|
190
|
+
return payMethods;
|
|
191
|
+
}
|
|
178
192
|
/**
|
|
179
193
|
* 获取支付方式列表
|
|
180
194
|
*/
|
|
@@ -192,7 +206,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
192
206
|
this.refreshPaymentMethodsInBackground(cachedMethods);
|
|
193
207
|
return cachedMethods;
|
|
194
208
|
}
|
|
195
|
-
const response = await this.request.get("/pay/custom-payment/
|
|
209
|
+
const response = await this.request.get("/pay/custom-payment/all");
|
|
210
|
+
response.data = this.filterPayMethods(response.data);
|
|
196
211
|
const payMethods = response.data || [];
|
|
197
212
|
try {
|
|
198
213
|
for (const method of payMethods) {
|
|
@@ -225,7 +240,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
225
240
|
});
|
|
226
241
|
try {
|
|
227
242
|
console.log("[PaymentModule] 后台刷新支付方式列表...");
|
|
228
|
-
const response = await this.request.get("/pay/custom-payment/
|
|
243
|
+
const response = await this.request.get("/pay/custom-payment/all");
|
|
244
|
+
response.data = this.filterPayMethods(response.data);
|
|
229
245
|
const newPayMethods = response.data || [];
|
|
230
246
|
const hasChanges = this.hasPaymentMethodsChanged(
|
|
231
247
|
cachedMethods,
|
|
@@ -623,7 +639,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
623
639
|
this.logInfo("更新订单支付项完成", {
|
|
624
640
|
orderUuid
|
|
625
641
|
});
|
|
626
|
-
this.core.effects.emit(
|
|
642
|
+
this.core.effects.emit(import_types.PaymentHooks.OnPaymentAdded, {
|
|
627
643
|
orderUuid,
|
|
628
644
|
payment: newPaymentItem
|
|
629
645
|
});
|
|
@@ -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 客户状态
|
|
@@ -216,70 +216,23 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
216
216
|
return pre + (item.amount || 0);
|
|
217
217
|
}, 0);
|
|
218
218
|
};
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
main_product_original_price: item.price,
|
|
237
|
-
// 主商品折扣后金额,不包含套餐子商品
|
|
238
|
-
main_product_selling_price: item.main_product_selling_price,
|
|
239
|
-
metadata: {
|
|
240
|
-
// 主商品+非原价(加减价)子商品税费
|
|
241
|
-
"main_product_attached_bundle_tax_fee": item.metadata.main_product_attached_bundle_tax_fee,
|
|
242
|
-
// 主商品+非原价(加减价)子商品附加费
|
|
243
|
-
"main_product_attached_bundle_surcharge_fee": item.metadata.main_product_attached_bundle_surcharge_fee,
|
|
244
|
-
// 可选,附加费均摊舍入金额
|
|
245
|
-
"surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
|
|
246
|
-
},
|
|
247
|
-
product_bundle: item.product_bundle.map((bundle) => {
|
|
248
|
-
return {
|
|
249
|
-
bundle_id: bundle.bundle_id,
|
|
250
|
-
bundle_product_id: bundle.bundle_product_id,
|
|
251
|
-
bundle_variant_id: bundle.bundle_variant_id,
|
|
252
|
-
price_type: bundle.price_type,
|
|
253
|
-
price_type_ext: bundle.price_type_ext,
|
|
254
|
-
// 套餐子商品总价,不包含折扣金额
|
|
255
|
-
bundle_sum_price: bundle.bundle_sum_price,
|
|
256
|
-
// 套餐子商品折扣后金额
|
|
257
|
-
bundle_selling_price: bundle.bundle_selling_price,
|
|
258
|
-
num: bundle.num,
|
|
259
|
-
is_charge_tax: bundle.is_charge_tax,
|
|
260
|
-
tax_fee: bundle.tax_fee,
|
|
261
|
-
metadata: {
|
|
262
|
-
// 子商品单数量附加费
|
|
263
|
-
"surcharge_fee": bundle.metadata.surcharge_fee,
|
|
264
|
-
// 可选,附加费均摊舍入金额
|
|
265
|
-
"surcharge_rounding_remainder": bundle.metadata.surcharge_rounding_remainder
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
})
|
|
269
|
-
})
|
|
270
|
-
) || [];
|
|
271
|
-
};
|
|
272
|
-
const productList = formatProduct(
|
|
273
|
-
((_c = (_b = (_a = this.store.currentOrder.order_info) == null ? void 0 : _a.original_order_data) == null ? void 0 : _b.bookings) == null ? void 0 : _c.map(
|
|
274
|
-
(item) => {
|
|
275
|
-
return {
|
|
276
|
-
...item.product,
|
|
277
|
-
holder_id: this.getHolderIdFromBooking(item)
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
)) || []
|
|
281
|
-
);
|
|
282
|
-
const relationProducts = formatProduct(((_e = (_d = this.store.currentOrder.order_info) == null ? void 0 : _d.original_order_data) == null ? void 0 : _e.relation_products) || []);
|
|
219
|
+
const productList = ((_b = (_a = this.store.currentOrder.order_info) == null ? void 0 : _a.original_order_data.bookings) == null ? void 0 : _b.map(
|
|
220
|
+
(item) => ({
|
|
221
|
+
product_id: item.product.product_id,
|
|
222
|
+
product_variant_id: item.product.product_variant_id,
|
|
223
|
+
quantity: item.product.num,
|
|
224
|
+
selling_price: item.product.calculated_selling_price,
|
|
225
|
+
holder_id: this.getHolderIdFromBooking(item)
|
|
226
|
+
})
|
|
227
|
+
)) || [];
|
|
228
|
+
const relationProducts = ((_e = (_d = (_c = this.store.currentOrder.order_info) == null ? void 0 : _c.original_order_data) == null ? void 0 : _d.relation_products) == null ? void 0 : _e.map(
|
|
229
|
+
(item) => ({
|
|
230
|
+
product_id: item.product_id,
|
|
231
|
+
product_variant_id: item.product_variant_id,
|
|
232
|
+
quantity: item.num,
|
|
233
|
+
selling_price: item.source_product_price
|
|
234
|
+
})
|
|
235
|
+
)) || [];
|
|
283
236
|
return [...productList, ...relationProducts];
|
|
284
237
|
}
|
|
285
238
|
async initWalletData(params) {
|
|
@@ -304,8 +257,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
304
257
|
isDeposit: (_h = this.store.currentOrder) == null ? void 0 : _h.is_deposit
|
|
305
258
|
},
|
|
306
259
|
products: this.getProductListByOrder(),
|
|
307
|
-
is_price_include_tax: this.otherParams.is_price_include_tax,
|
|
308
|
-
// core 有
|
|
309
260
|
...params
|
|
310
261
|
};
|
|
311
262
|
if (this.store.isOrderSynced) {
|
|
@@ -1030,7 +981,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1030
981
|
if (Number(remainingAmount) > 0) {
|
|
1031
982
|
this.logInfo("订单金额还有待付的,同步 EFTPOS 支付");
|
|
1032
983
|
const isEftposPayment = ((_a = paymentItem.type) == null ? void 0 : _a.toLowerCase()) === "eftpos" || ((_b = paymentItem.code) == null ? void 0 : _b.toUpperCase().includes("EFTPOS"));
|
|
1033
|
-
const
|
|
984
|
+
const isCash = (0, import_utils.isCashPayment)(paymentItem);
|
|
1034
985
|
const isCustomePayment = paymentItem.type === "custom";
|
|
1035
986
|
this.logInfo("EFTPOS 支付检查:", {
|
|
1036
987
|
paymentCode: paymentItem.code,
|
|
@@ -1038,7 +989,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1038
989
|
isEftposPayment,
|
|
1039
990
|
currentOrderSynced: this.store.isOrderSynced
|
|
1040
991
|
});
|
|
1041
|
-
if (isEftposPayment ||
|
|
992
|
+
if (isEftposPayment || isCash || isCustomePayment) {
|
|
1042
993
|
this.logInfo("检测到 EFTPOS 支付,立即同步订单到后端...");
|
|
1043
994
|
try {
|
|
1044
995
|
const syncResult = await this.syncOrderToBackendWithReturn(true);
|
|
@@ -1767,7 +1718,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1767
1718
|
* @returns 处理后的支付项(包含找零信息)
|
|
1768
1719
|
*/
|
|
1769
1720
|
async processCashPaymentItem(paymentItem) {
|
|
1770
|
-
const cashPayment = (0, import_utils.isCashPayment)(paymentItem
|
|
1721
|
+
const cashPayment = (0, import_utils.isCashPayment)(paymentItem);
|
|
1771
1722
|
if (!cashPayment) {
|
|
1772
1723
|
return paymentItem;
|
|
1773
1724
|
}
|
|
@@ -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;
|
|
@@ -326,13 +326,15 @@ function shouldSyncOrderForPayment(paymentCode, paymentType) {
|
|
|
326
326
|
}
|
|
327
327
|
return true;
|
|
328
328
|
}
|
|
329
|
-
function isCashPayment(
|
|
330
|
-
|
|
331
|
-
const
|
|
329
|
+
function isCashPayment(paymentItem) {
|
|
330
|
+
var _a, _b, _c;
|
|
331
|
+
const codeUpper = ((_a = paymentItem.code) == null ? void 0 : _a.toUpperCase()) || "";
|
|
332
|
+
const typeUpper = ((_b = paymentItem.type) == null ? void 0 : _b.toUpperCase()) || "";
|
|
333
|
+
const isNameCash = (_c = paymentItem.name) == null ? void 0 : _c.toLowerCase().includes("cash");
|
|
332
334
|
const cashIdentifiers = ["CASH", "CASHMANUAL", "MANUAL"];
|
|
333
335
|
return cashIdentifiers.some(
|
|
334
336
|
(identifier) => codeUpper.includes(identifier) || typeUpper.includes(identifier)
|
|
335
|
-
);
|
|
337
|
+
) || isNameCash;
|
|
336
338
|
}
|
|
337
339
|
// Annotate the CommonJS export names for ESM import in node:
|
|
338
340
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@pisell/pisellos",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.15",
|
|
5
5
|
"description": "一个可扩展的前端模块化SDK框架,支持插件系统",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -69,4 +69,4 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|