@pisell/pisellos 2.3.206 → 2.3.207
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 +9 -0
- package/dist/server/index.js +26 -13
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +6 -5
- package/dist/solution/UnifiedBookingSales/index.js +34 -23
- package/lib/server/index.js +9 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/UnifiedBookingSales/index.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
package/dist/server/index.js
CHANGED
|
@@ -6081,7 +6081,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6081
6081
|
key: "ensureCheckoutOrderNumbers",
|
|
6082
6082
|
value: function () {
|
|
6083
6083
|
var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(data, title) {
|
|
6084
|
-
var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
|
|
6084
|
+
var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator, _idGenerator$getConfi, _biz;
|
|
6085
6085
|
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
6086
6086
|
while (1) switch (_context61.prev = _context61.next) {
|
|
6087
6087
|
case 0:
|
|
@@ -6123,36 +6123,49 @@ var Server = /*#__PURE__*/function () {
|
|
|
6123
6123
|
case 15:
|
|
6124
6124
|
next.shop_order_number = _context61.sent;
|
|
6125
6125
|
case 16:
|
|
6126
|
-
if (!
|
|
6127
|
-
_context61.next =
|
|
6126
|
+
if (!needsShopFullOrderNumber) {
|
|
6127
|
+
_context61.next = 26;
|
|
6128
6128
|
break;
|
|
6129
6129
|
}
|
|
6130
|
-
|
|
6130
|
+
_biz = next.business_code || 'ticket';
|
|
6131
|
+
if (!(((_idGenerator$getConfi = idGenerator.getConfig) === null || _idGenerator$getConfi === void 0 || (_idGenerator$getConfi = _idGenerator$getConfi.call(idGenerator, _biz)) === null || _idGenerator$getConfi === void 0 ? void 0 : _idGenerator$getConfi.enableShortNumber) === false)) {
|
|
6132
|
+
_context61.next = 22;
|
|
6133
|
+
break;
|
|
6134
|
+
}
|
|
6135
|
+
next.shop_full_order_number = next.shop_order_number;
|
|
6136
|
+
_context61.next = 26;
|
|
6137
|
+
break;
|
|
6138
|
+
case 22:
|
|
6139
|
+
if (!idGenerator.generateReceiptId) {
|
|
6140
|
+
_context61.next = 26;
|
|
6141
|
+
break;
|
|
6142
|
+
}
|
|
6143
|
+
_context61.next = 25;
|
|
6131
6144
|
return idGenerator.generateReceiptId({
|
|
6132
|
-
biz:
|
|
6145
|
+
biz: _biz
|
|
6133
6146
|
});
|
|
6134
|
-
case
|
|
6147
|
+
case 25:
|
|
6135
6148
|
next.shop_full_order_number = _context61.sent;
|
|
6136
|
-
case
|
|
6149
|
+
case 26:
|
|
6137
6150
|
this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
|
|
6138
6151
|
shop_order_number: next.shop_order_number,
|
|
6139
6152
|
shop_full_order_number: next.shop_full_order_number
|
|
6140
6153
|
});
|
|
6141
|
-
_context61.next =
|
|
6154
|
+
_context61.next = 32;
|
|
6142
6155
|
break;
|
|
6143
|
-
case
|
|
6144
|
-
_context61.prev =
|
|
6156
|
+
case 29:
|
|
6157
|
+
_context61.prev = 29;
|
|
6145
6158
|
_context61.t0 = _context61["catch"](11);
|
|
6146
6159
|
this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
|
|
6147
6160
|
error: _context61.t0 instanceof Error ? _context61.t0.message : String(_context61.t0)
|
|
6148
6161
|
});
|
|
6149
|
-
case
|
|
6162
|
+
case 32:
|
|
6150
6163
|
return _context61.abrupt("return", this.finalizeCheckoutSalesNotes(next, title));
|
|
6151
|
-
case
|
|
6164
|
+
case 33:
|
|
6152
6165
|
case "end":
|
|
6153
6166
|
return _context61.stop();
|
|
6154
6167
|
}
|
|
6155
|
-
}, _callee61, this, [[11,
|
|
6168
|
+
}, _callee61, this, [[11, 29]]);
|
|
6156
6169
|
}));
|
|
6157
6170
|
function ensureCheckoutOrderNumbers(_x65, _x66) {
|
|
6158
6171
|
return _ensureCheckoutOrderNumbers.apply(this, arguments);
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
date: string;
|
|
343
343
|
status: string;
|
|
344
344
|
week: string;
|
|
345
|
-
weekNum: 0 |
|
|
345
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
346
346
|
}[]>;
|
|
347
347
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
348
348
|
private getScheduleDataByIds;
|
|
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
366
366
|
* 获取当前的客户搜索条件
|
|
367
367
|
* @returns 当前搜索条件
|
|
368
368
|
*/
|
|
369
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
369
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
370
370
|
/**
|
|
371
371
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
372
372
|
* @returns 客户状态
|
|
@@ -630,7 +630,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
630
630
|
value: function () {
|
|
631
631
|
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
632
632
|
var _this$otherParams5, _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
633
|
-
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
|
|
633
|
+
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9, _openDataConfig10;
|
|
634
634
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
635
635
|
while (1) switch (_context10.prev = _context10.next) {
|
|
636
636
|
case 0:
|
|
@@ -691,12 +691,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
691
691
|
return idGenerator.configure({
|
|
692
692
|
biz: businessCode,
|
|
693
693
|
config: {
|
|
694
|
+
enableShortNumber: ((_openDataConfig7 = openDataConfig) === null || _openDataConfig7 === void 0 ? void 0 : _openDataConfig7['sale.enable_short_number']) !== false,
|
|
694
695
|
prefix: prefix,
|
|
695
696
|
deviceCode: deviceId,
|
|
696
|
-
padReceiptSequence: ((
|
|
697
|
+
padReceiptSequence: ((_openDataConfig8 = openDataConfig) === null || _openDataConfig8 === void 0 ? void 0 : _openDataConfig8['sale.pad_with_leading_zeros']) === true,
|
|
697
698
|
receiptSequenceLength: receiptSequenceLength,
|
|
698
|
-
receiptSequenceMax: this.normalizeShortNumberMaximum((
|
|
699
|
-
randomReceiptSequence: ((
|
|
699
|
+
receiptSequenceMax: this.normalizeShortNumberMaximum((_openDataConfig9 = openDataConfig) === null || _openDataConfig9 === void 0 ? void 0 : _openDataConfig9['sale.maximum_number']),
|
|
700
|
+
randomReceiptSequence: ((_openDataConfig10 = openDataConfig) === null || _openDataConfig10 === void 0 ? void 0 : _openDataConfig10['sale.short_number_random']) === true,
|
|
700
701
|
resetReceiptSequenceDaily: resetReceiptSequenceDaily,
|
|
701
702
|
receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
|
|
702
703
|
receiptSequenceStart: receiptSequenceStart,
|
|
@@ -3503,7 +3504,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3503
3504
|
_context44.next = 9;
|
|
3504
3505
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3505
3506
|
case 9:
|
|
3506
|
-
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3507
|
+
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || Object.prototype.hasOwnProperty.call(params !== null && params !== void 0 ? params : {}, 'openData'))) {
|
|
3507
3508
|
_context44.next = 12;
|
|
3508
3509
|
break;
|
|
3509
3510
|
}
|
|
@@ -2548,8 +2548,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2548
2548
|
key: "ensureLocalOrderNumbersForCheckout",
|
|
2549
2549
|
value: (function () {
|
|
2550
2550
|
var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
2551
|
-
var _this$otherParams19, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
|
|
2552
|
-
var order, tempOrder, biz, idGenerator;
|
|
2551
|
+
var _this$otherParams19, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2, _idGenerator$getConfi;
|
|
2552
|
+
var order, tempOrder, biz, idGenerator, useLongNumber;
|
|
2553
2553
|
return _regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
2554
2554
|
while (1) switch (_context10.prev = _context10.next) {
|
|
2555
2555
|
case 0:
|
|
@@ -2581,56 +2581,67 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2581
2581
|
throw new Error('当前订单缺少业务类型,无法生成订单编号');
|
|
2582
2582
|
case 11:
|
|
2583
2583
|
idGenerator = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getAp = _this$appPlugin.getApp) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp = _this$appPlugin$getAp.call(_this$appPlugin)) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp2 = _this$appPlugin$getAp.getPlugin) === null || _this$appPlugin$getAp2 === void 0 ? void 0 : _this$appPlugin$getAp2.call(_this$appPlugin$getAp, 'idGenerator');
|
|
2584
|
-
|
|
2585
|
-
|
|
2584
|
+
useLongNumber = (idGenerator === null || idGenerator === void 0 || (_idGenerator$getConfi = idGenerator.getConfig) === null || _idGenerator$getConfi === void 0 || (_idGenerator$getConfi = _idGenerator$getConfi.call(idGenerator, biz)) === null || _idGenerator$getConfi === void 0 ? void 0 : _idGenerator$getConfi.enableShortNumber) === false;
|
|
2585
|
+
if (!(!tempOrder.shop_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateShopOrderNumber) !== 'function' || !tempOrder.shop_full_order_number && !useLongNumber && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateReceiptId) !== 'function')) {
|
|
2586
|
+
_context10.next = 15;
|
|
2586
2587
|
break;
|
|
2587
2588
|
}
|
|
2588
2589
|
throw new Error('订单编号生成器不可用,请重启应用后重试');
|
|
2589
|
-
case
|
|
2590
|
-
_context10.prev =
|
|
2590
|
+
case 15:
|
|
2591
|
+
_context10.prev = 15;
|
|
2591
2592
|
if (tempOrder.shop_order_number) {
|
|
2592
|
-
_context10.next =
|
|
2593
|
+
_context10.next = 20;
|
|
2593
2594
|
break;
|
|
2594
2595
|
}
|
|
2595
|
-
_context10.next =
|
|
2596
|
+
_context10.next = 19;
|
|
2596
2597
|
return idGenerator.generateShopOrderNumber({
|
|
2597
2598
|
biz: biz
|
|
2598
2599
|
});
|
|
2599
|
-
case 18:
|
|
2600
|
-
tempOrder.shop_order_number = _context10.sent;
|
|
2601
2600
|
case 19:
|
|
2601
|
+
tempOrder.shop_order_number = _context10.sent;
|
|
2602
|
+
case 20:
|
|
2602
2603
|
if (tempOrder.shop_full_order_number) {
|
|
2603
|
-
_context10.next =
|
|
2604
|
+
_context10.next = 29;
|
|
2604
2605
|
break;
|
|
2605
2606
|
}
|
|
2606
|
-
|
|
2607
|
+
if (!useLongNumber) {
|
|
2608
|
+
_context10.next = 25;
|
|
2609
|
+
break;
|
|
2610
|
+
}
|
|
2611
|
+
_context10.t0 = tempOrder.shop_order_number;
|
|
2612
|
+
_context10.next = 28;
|
|
2613
|
+
break;
|
|
2614
|
+
case 25:
|
|
2615
|
+
_context10.next = 27;
|
|
2607
2616
|
return idGenerator.generateReceiptId({
|
|
2608
2617
|
biz: biz
|
|
2609
2618
|
});
|
|
2610
|
-
case
|
|
2611
|
-
|
|
2612
|
-
case
|
|
2619
|
+
case 27:
|
|
2620
|
+
_context10.t0 = _context10.sent;
|
|
2621
|
+
case 28:
|
|
2622
|
+
tempOrder.shop_full_order_number = _context10.t0;
|
|
2623
|
+
case 29:
|
|
2613
2624
|
if (!(order.getTempOrder() !== tempOrder)) {
|
|
2614
|
-
_context10.next =
|
|
2625
|
+
_context10.next = 31;
|
|
2615
2626
|
break;
|
|
2616
2627
|
}
|
|
2617
2628
|
throw new Error('当前订单已切换,请重新发起支付');
|
|
2618
|
-
case
|
|
2629
|
+
case 31:
|
|
2619
2630
|
if (!(!tempOrder.shop_order_number || !tempOrder.shop_full_order_number)) {
|
|
2620
|
-
_context10.next =
|
|
2631
|
+
_context10.next = 33;
|
|
2621
2632
|
break;
|
|
2622
2633
|
}
|
|
2623
2634
|
throw new Error('订单编号生成失败,请重试');
|
|
2624
|
-
case
|
|
2625
|
-
_context10.prev =
|
|
2635
|
+
case 33:
|
|
2636
|
+
_context10.prev = 33;
|
|
2626
2637
|
// 部分生成成功时也保留号码,后续只补仍然缺失的字段。
|
|
2627
2638
|
if (order.getTempOrder() === tempOrder) order.persistTempOrder();
|
|
2628
|
-
return _context10.finish(
|
|
2629
|
-
case
|
|
2639
|
+
return _context10.finish(33);
|
|
2640
|
+
case 36:
|
|
2630
2641
|
case "end":
|
|
2631
2642
|
return _context10.stop();
|
|
2632
2643
|
}
|
|
2633
|
-
}, _callee9, this, [[
|
|
2644
|
+
}, _callee9, this, [[15,, 33, 36]]);
|
|
2634
2645
|
}));
|
|
2635
2646
|
function ensureLocalOrderNumbersForCheckout() {
|
|
2636
2647
|
return _ensureLocalOrderNumbersForCheckout.apply(this, arguments);
|
package/lib/server/index.js
CHANGED
|
@@ -3833,10 +3833,15 @@ class Server {
|
|
|
3833
3833
|
biz: next.business_code || 'ticket'
|
|
3834
3834
|
});
|
|
3835
3835
|
}
|
|
3836
|
-
if (needsShopFullOrderNumber
|
|
3837
|
-
next.
|
|
3838
|
-
|
|
3839
|
-
|
|
3836
|
+
if (needsShopFullOrderNumber) {
|
|
3837
|
+
const biz = next.business_code || 'ticket';
|
|
3838
|
+
if (idGenerator.getConfig?.(biz)?.enableShortNumber === false) {
|
|
3839
|
+
next.shop_full_order_number = next.shop_order_number;
|
|
3840
|
+
} else if (idGenerator.generateReceiptId) {
|
|
3841
|
+
next.shop_full_order_number = await idGenerator.generateReceiptId({
|
|
3842
|
+
biz
|
|
3843
|
+
});
|
|
3844
|
+
}
|
|
3840
3845
|
}
|
|
3841
3846
|
this.logInfo(`${title}: checkout 订单号已准备`, {
|
|
3842
3847
|
shop_order_number: next.shop_order_number,
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
date: string;
|
|
343
343
|
status: string;
|
|
344
344
|
week: string;
|
|
345
|
-
weekNum: 0 |
|
|
345
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
346
346
|
}[]>;
|
|
347
347
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
348
348
|
private getScheduleDataByIds;
|
|
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
366
366
|
* 获取当前的客户搜索条件
|
|
367
367
|
* @returns 当前搜索条件
|
|
368
368
|
*/
|
|
369
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
369
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
370
370
|
/**
|
|
371
371
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
372
372
|
* @returns 客户状态
|
|
@@ -385,6 +385,7 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
385
385
|
await idGenerator.configure({
|
|
386
386
|
biz: businessCode,
|
|
387
387
|
config: {
|
|
388
|
+
enableShortNumber: openDataConfig?.['sale.enable_short_number'] !== false,
|
|
388
389
|
prefix,
|
|
389
390
|
deviceCode: deviceId,
|
|
390
391
|
padReceiptSequence: openDataConfig?.['sale.pad_with_leading_zeros'] === true,
|
|
@@ -2077,7 +2078,7 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
2077
2078
|
if (invoiceContextChanged) {
|
|
2078
2079
|
await this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
2079
2080
|
}
|
|
2080
|
-
if (params?.businessCode !== undefined || params?.business_code !== undefined) {
|
|
2081
|
+
if (params?.businessCode !== undefined || params?.business_code !== undefined || Object.prototype.hasOwnProperty.call(params ?? {}, 'openData')) {
|
|
2081
2082
|
await this.configureIdGeneratorFromOpenData();
|
|
2082
2083
|
}
|
|
2083
2084
|
}
|
|
@@ -2001,7 +2001,8 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2001
2001
|
const biz = this.getBookingTicketBusinessCode();
|
|
2002
2002
|
if (!biz) throw new Error('当前订单缺少业务类型,无法生成订单编号');
|
|
2003
2003
|
const idGenerator = this.appPlugin?.getApp?.()?.getPlugin?.('idGenerator');
|
|
2004
|
-
|
|
2004
|
+
const useLongNumber = idGenerator?.getConfig?.(biz)?.enableShortNumber === false;
|
|
2005
|
+
if (!tempOrder.shop_order_number && typeof idGenerator?.generateShopOrderNumber !== 'function' || !tempOrder.shop_full_order_number && !useLongNumber && typeof idGenerator?.generateReceiptId !== 'function') {
|
|
2005
2006
|
throw new Error('订单编号生成器不可用,请重启应用后重试');
|
|
2006
2007
|
}
|
|
2007
2008
|
try {
|
|
@@ -2011,7 +2012,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2011
2012
|
});
|
|
2012
2013
|
}
|
|
2013
2014
|
if (!tempOrder.shop_full_order_number) {
|
|
2014
|
-
tempOrder.shop_full_order_number = await idGenerator.generateReceiptId({
|
|
2015
|
+
tempOrder.shop_full_order_number = useLongNumber ? tempOrder.shop_order_number : await idGenerator.generateReceiptId({
|
|
2015
2016
|
biz
|
|
2016
2017
|
});
|
|
2017
2018
|
}
|