@pisell/pisellos 0.10.7 → 0.10.9
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/core/index.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +18 -12
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +32 -6
- package/dist/modules/Order/index.js +1165 -819
- package/dist/modules/Order/types.d.ts +32 -4
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/dist/modules/Order/utils/virtualSettlement.js +271 -0
- package/dist/modules/Order/utils.js +89 -48
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +235 -60
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +15 -2
- package/dist/modules/ProductList/index.js +92 -13
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +28 -2
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +894 -781
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +261 -96
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +41 -7
- package/dist/solution/BaseSales/index.js +1405 -974
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +79 -13
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +221 -162
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.js +25 -64
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +51 -39
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -1
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +37 -3
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +32 -6
- package/lib/modules/Order/index.js +518 -148
- package/lib/modules/Order/types.d.ts +32 -4
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/lib/modules/Order/utils/virtualSettlement.js +300 -0
- package/lib/modules/Order/utils.js +65 -21
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +198 -17
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +15 -2
- package/lib/modules/ProductList/index.js +85 -3
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +10 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +30 -2
- package/lib/server/index.d.ts +15 -0
- package/lib/server/index.js +105 -14
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +75 -5
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +41 -7
- package/lib/solution/BaseSales/index.js +325 -39
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +62 -12
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +31 -6
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.js +17 -54
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +35 -26
- package/package.json +1 -1
|
@@ -213,11 +213,11 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
213
213
|
value: function () {
|
|
214
214
|
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
215
215
|
var _this$store$surcharge, _ref;
|
|
216
|
-
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
216
|
+
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, _params$virtualSettle, virtualSettlementMode, summaryChannel, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
217
217
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
218
218
|
while (1) switch (_context4.prev = _context4.next) {
|
|
219
219
|
case 0:
|
|
220
|
-
_params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel;
|
|
220
|
+
_params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel, _params$virtualSettle = params.virtualSettlementMode, virtualSettlementMode = _params$virtualSettle === void 0 ? false : _params$virtualSettle;
|
|
221
221
|
summaryChannel = channel || this.resolveChannel();
|
|
222
222
|
if (!(summaryChannel !== this.surchargeListChannel)) {
|
|
223
223
|
_context4.next = 5;
|
|
@@ -255,7 +255,8 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
255
255
|
surchargeList: this.store.surchargeList,
|
|
256
256
|
scheduleById: scheduleById,
|
|
257
257
|
isInScheduleByDate: ScheduleModule.isInScheduleByDate,
|
|
258
|
-
shopDiscount: shopDiscount
|
|
258
|
+
shopDiscount: shopDiscount,
|
|
259
|
+
virtualSettlementMode: virtualSettlementMode
|
|
259
260
|
});
|
|
260
261
|
summaryWithTaxMeta = _objectSpread(_objectSpread({}, summary), {}, {
|
|
261
262
|
tax_title: taxConfig.taxTitle || '',
|
|
@@ -87,7 +87,13 @@ function getUnitOriginalTotal(product) {
|
|
|
87
87
|
function isGeneratedVoucherProduct(product) {
|
|
88
88
|
var record = product;
|
|
89
89
|
var metadata = (record === null || record === void 0 ? void 0 : record.metadata) || {};
|
|
90
|
-
|
|
90
|
+
var isGeneratedChild = metadata.parent_order_detail_id !== undefined || metadata.gift_card_type !== undefined;
|
|
91
|
+
if (isGeneratedChild) return true;
|
|
92
|
+
|
|
93
|
+
// `product_voucher` 既可能是当前购物车生成的零价子券,也可能是独立售卖的
|
|
94
|
+
// gift card。已有 order_detail_id 且没有 parent 标记的是后者,必须继续计价。
|
|
95
|
+
var isPersisted = (record === null || record === void 0 ? void 0 : record.order_detail_id) !== undefined && (record === null || record === void 0 ? void 0 : record.order_detail_id) !== null;
|
|
96
|
+
return (record === null || record === void 0 ? void 0 : record.extension_type) === 'product_voucher' && !isPersisted;
|
|
91
97
|
}
|
|
92
98
|
function buildSurchargeServiceItems(products) {
|
|
93
99
|
return products.map(function (product) {
|
|
@@ -1033,12 +1039,32 @@ export function calculateSalesSummary(params) {
|
|
|
1033
1039
|
_params$scheduleById = params.scheduleById,
|
|
1034
1040
|
scheduleById = _params$scheduleById === void 0 ? {} : _params$scheduleById,
|
|
1035
1041
|
isInScheduleByDate = params.isInScheduleByDate,
|
|
1036
|
-
shopDiscount = params.shopDiscount
|
|
1042
|
+
shopDiscount = params.shopDiscount,
|
|
1043
|
+
_params$virtualSettle = params.virtualSettlementMode,
|
|
1044
|
+
virtualSettlementMode = _params$virtualSettle === void 0 ? false : _params$virtualSettle;
|
|
1037
1045
|
if (!(products !== null && products !== void 0 && products.length)) return createEmptySalesSummary();
|
|
1038
1046
|
var summaryProducts = products.filter(function (product) {
|
|
1039
1047
|
return !isGeneratedVoucherProduct(product);
|
|
1040
1048
|
});
|
|
1041
1049
|
if (!summaryProducts.length) return createEmptySalesSummary();
|
|
1050
|
+
if (virtualSettlementMode) {
|
|
1051
|
+
var _productQuantity = summaryProducts.reduce(function (sum, item) {
|
|
1052
|
+
return sum + getSafeNum(item.num);
|
|
1053
|
+
}, 0);
|
|
1054
|
+
var _productAmount = summaryProducts.reduce(function (sum, item) {
|
|
1055
|
+
return sum.plus(toDecimal(item.selling_price).times(getSafeNum(item.num)));
|
|
1056
|
+
}, new Decimal(0));
|
|
1057
|
+
var amount = toFixed2(_productAmount);
|
|
1058
|
+
return _objectSpread(_objectSpread({}, createEmptySalesSummary()), {}, {
|
|
1059
|
+
product_quantity: _productQuantity,
|
|
1060
|
+
product_original_amount: amount,
|
|
1061
|
+
product_amount: amount,
|
|
1062
|
+
product_expect_amount: amount,
|
|
1063
|
+
expect_amount: amount,
|
|
1064
|
+
total_amount: amount,
|
|
1065
|
+
is_price_include_tax: isPriceIncludeTax
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1042
1068
|
var productQuantity = summaryProducts.reduce(function (sum, item) {
|
|
1043
1069
|
return sum + getSafeNum(item.num);
|
|
1044
1070
|
}, 0);
|
package/dist/server/index.d.ts
CHANGED
|
@@ -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>
|
|
@@ -257,6 +263,11 @@ declare class Server {
|
|
|
257
263
|
* 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
|
|
258
264
|
*/
|
|
259
265
|
private recomputeAndNotifySubscriber;
|
|
266
|
+
/**
|
|
267
|
+
* 根据餐牌 ID 获取其绑定日程中的全部时间点。
|
|
268
|
+
* 商品查询定时器与 schedule-time-points 路由共用此逻辑。
|
|
269
|
+
*/
|
|
270
|
+
private getMenuScheduleTimePoints;
|
|
260
271
|
/**
|
|
261
272
|
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
262
273
|
*/
|
|
@@ -512,6 +523,10 @@ declare class Server {
|
|
|
512
523
|
private handleOrderDraftSubmit;
|
|
513
524
|
private handlePendingSyncCheckoutOrder;
|
|
514
525
|
private buildPendingSyncCheckoutOrder;
|
|
526
|
+
/**
|
|
527
|
+
* Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
|
|
528
|
+
*/
|
|
529
|
+
private shouldAutoPrintCheckoutReceipt;
|
|
515
530
|
private shouldBuildSmallTicketData;
|
|
516
531
|
private shouldPrintSyncedOrder;
|
|
517
532
|
private hasPaymentStatus;
|