@pisell/pisellos 2.2.246 → 2.2.247
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Order/index.d.ts +4 -0
- package/dist/modules/Order/index.js +173 -120
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Payment/walletpass.js +1 -1
- package/dist/server/utils/small-ticket.d.ts +1 -0
- package/dist/server/utils/small-ticket.js +81 -41
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.d.ts +4 -0
- package/lib/modules/Order/index.js +44 -5
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Payment/walletpass.js +1 -1
- package/lib/server/utils/small-ticket.d.ts +1 -0
- package/lib/server/utils/small-ticket.js +40 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -57,6 +57,7 @@ var LABELS = {
|
|
|
57
57
|
remainingPoints: "Remaining points",
|
|
58
58
|
table: "Table",
|
|
59
59
|
orderDiscount: "Order discount",
|
|
60
|
+
manualDiscount: "Manual discount",
|
|
60
61
|
payProcessingFee: "Pay processing fee",
|
|
61
62
|
rounding: "Rounding"
|
|
62
63
|
},
|
|
@@ -80,6 +81,7 @@ var LABELS = {
|
|
|
80
81
|
remainingPoints: "剩余积分",
|
|
81
82
|
table: "桌台",
|
|
82
83
|
orderDiscount: "整单折扣",
|
|
84
|
+
manualDiscount: "手动折扣",
|
|
83
85
|
payProcessingFee: "支付手续费",
|
|
84
86
|
rounding: "抹零"
|
|
85
87
|
},
|
|
@@ -103,6 +105,7 @@ var LABELS = {
|
|
|
103
105
|
remainingPoints: "剩餘積分",
|
|
104
106
|
table: "桌台",
|
|
105
107
|
orderDiscount: "整單折扣",
|
|
108
|
+
manualDiscount: "手動折扣",
|
|
106
109
|
payProcessingFee: "支付手續費",
|
|
107
110
|
rounding: "抹零"
|
|
108
111
|
}
|
|
@@ -184,6 +187,7 @@ function buildProducts(order, locale, productMap) {
|
|
|
184
187
|
parentProduct
|
|
185
188
|
});
|
|
186
189
|
const resolvedVariant = resolveProductVariantText({ product, parentProduct, locale });
|
|
190
|
+
const discountList = normalizeProductDiscounts({ product, locale, currencySymbol });
|
|
187
191
|
return {
|
|
188
192
|
product_title: productTitle,
|
|
189
193
|
product_quantity: quantity,
|
|
@@ -191,12 +195,40 @@ function buildProducts(order, locale, productMap) {
|
|
|
191
195
|
original_price: formatMoney(originalPrice, currencySymbol),
|
|
192
196
|
total_original_price: formatMoney(new import_decimal.default(toMoneyNumber(originalPrice)).mul(quantity), currencySymbol),
|
|
193
197
|
extension_list: Array.isArray(product.extension_list) ? product.extension_list : [],
|
|
198
|
+
...discountList.length ? { discount_list: discountList } : {},
|
|
194
199
|
...options.length ? { options } : {},
|
|
195
200
|
...resolvedVariant ? { variant: resolvedVariant } : {},
|
|
196
201
|
...Array.isArray(product.combinations) ? { combinations: product.combinations } : combinations.length ? { combinations } : {}
|
|
197
202
|
};
|
|
198
203
|
});
|
|
199
204
|
}
|
|
205
|
+
function normalizeProductDiscounts(params) {
|
|
206
|
+
const { product, locale, currencySymbol } = params;
|
|
207
|
+
return normalizeArray(product.discount_list).map((discount) => {
|
|
208
|
+
const title = resolveDiscountTitle(discount, locale);
|
|
209
|
+
const amount = discount.amount ?? discount.value ?? discount.discount_amount;
|
|
210
|
+
const formattedAmount = formatNegativeMoney(amount, currencySymbol);
|
|
211
|
+
return {
|
|
212
|
+
...discount,
|
|
213
|
+
item: title,
|
|
214
|
+
name: title,
|
|
215
|
+
title,
|
|
216
|
+
value: formattedAmount
|
|
217
|
+
};
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function resolveDiscountTitle(discount, locale) {
|
|
221
|
+
var _a, _b, _c;
|
|
222
|
+
const title = getLocalizedValue(
|
|
223
|
+
((_a = discount.discount) == null ? void 0 : _a.name) ?? ((_b = discount.discount) == null ? void 0 : _b.title) ?? ((_c = discount.discount) == null ? void 0 : _c.message) ?? discount.name ?? discount.title ?? discount.message,
|
|
224
|
+
locale
|
|
225
|
+
);
|
|
226
|
+
if (title)
|
|
227
|
+
return title;
|
|
228
|
+
if (discount.type === "product")
|
|
229
|
+
return label(locale, "manualDiscount");
|
|
230
|
+
return "";
|
|
231
|
+
}
|
|
200
232
|
function resolveProductTitle(params) {
|
|
201
233
|
const { product, productMap, locale } = params;
|
|
202
234
|
const ownTitle = getProductTitleSource(product, locale);
|
|
@@ -480,11 +512,11 @@ function buildFees(params) {
|
|
|
480
512
|
value: formatMoney(value, currencySymbol)
|
|
481
513
|
});
|
|
482
514
|
}
|
|
483
|
-
const discountAmount =
|
|
515
|
+
const discountAmount = order.shop_discount ?? summary.discount_amount ?? order.discount_amount;
|
|
484
516
|
if (isNonZero(discountAmount)) {
|
|
485
517
|
fees.push({
|
|
486
518
|
item: label(locale, "orderDiscount"),
|
|
487
|
-
value:
|
|
519
|
+
value: formatNegativeMoney(discountAmount, currencySymbol)
|
|
488
520
|
});
|
|
489
521
|
}
|
|
490
522
|
const taxFee = summary.tax_fee || order.tax_fee;
|
|
@@ -712,8 +744,9 @@ function getLocalizedValue(value, locale) {
|
|
|
712
744
|
if (typeof value !== "object")
|
|
713
745
|
return stringify(value);
|
|
714
746
|
const dashedLocale = locale.replace("_", "-");
|
|
747
|
+
const underscoredLocale = locale.replace("-", "_");
|
|
715
748
|
return stringify(
|
|
716
|
-
value[locale] ?? value[dashedLocale] ?? value.default ?? value.en ?? ""
|
|
749
|
+
value[locale] ?? value[dashedLocale] ?? value[underscoredLocale] ?? value.original ?? value.auto ?? value.default ?? value.en ?? ""
|
|
717
750
|
);
|
|
718
751
|
}
|
|
719
752
|
function buildShopAddress(shopInfo) {
|
|
@@ -742,6 +775,10 @@ function formatMoney(value, currencySymbol) {
|
|
|
742
775
|
const amount = new import_decimal.default(toMoneyNumber(value));
|
|
743
776
|
return `${currencySymbol}${amount.toFixed(2)}`;
|
|
744
777
|
}
|
|
778
|
+
function formatNegativeMoney(value, currencySymbol) {
|
|
779
|
+
const amount = new import_decimal.default(toMoneyNumber(value)).abs();
|
|
780
|
+
return `-${currencySymbol}${amount.toFixed(2)}`;
|
|
781
|
+
}
|
|
745
782
|
function calculateReceiptPaidAmount(order, summary) {
|
|
746
783
|
const paidAmount = sumPayments(order.payments);
|
|
747
784
|
const payProcessingFee = new import_decimal.default(
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
322
322
|
* 获取当前的客户搜索条件
|
|
323
323
|
* @returns 当前搜索条件
|
|
324
324
|
*/
|
|
325
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
325
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
326
326
|
/**
|
|
327
327
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
328
328
|
* @returns 客户状态
|