@pisell/pisellos 2.2.182 → 2.2.183
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 +1 -1
- package/dist/modules/Order/index.js +7 -13
- package/dist/solution/BaseSales/index.js +39 -38
- 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 +1 -1
- package/lib/modules/Order/index.js +2 -48
- package/lib/solution/BaseSales/index.js +1 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
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 } from "./examples";
|
|
@@ -264,7 +264,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
264
264
|
private logSubmitBackendRejected;
|
|
265
265
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
266
266
|
createOrder(params: CommitOrderParams['query']): {
|
|
267
|
-
type: "
|
|
267
|
+
type: "virtual" | "appointment_booking";
|
|
268
268
|
platform: string;
|
|
269
269
|
sales_channel: string;
|
|
270
270
|
order_sales_channel: string;
|
|
@@ -3215,34 +3215,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3215
3215
|
key: "hydrateTempOrderFromRecord",
|
|
3216
3216
|
value: (function () {
|
|
3217
3217
|
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(record, options) {
|
|
3218
|
-
var raw,
|
|
3218
|
+
var raw, nextTempOrder;
|
|
3219
3219
|
return _regeneratorRuntime().wrap(function _callee31$(_context33) {
|
|
3220
3220
|
while (1) switch (_context33.prev = _context33.next) {
|
|
3221
3221
|
case 0:
|
|
3222
3222
|
raw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
|
|
3223
|
-
|
|
3224
|
-
nextTempOrder = _objectSpread({}, defaults);
|
|
3225
|
-
TEMP_ORDER_KEYS = ['order_id', 'external_sale_number', 'order_number', 'shop_order_number', 'shop_full_order_number', 'type', 'business_code', 'platform', 'sales_channel', 'order_sales_channel', 'vouchers', 'status', 'payment_status', 'shipping_status', 'customer_id', 'customer_name', 'country_calling_code', 'phone', 'email', 'customer', 'is_price_include_tax', 'tax_title', 'tax_country_code', 'currency_code', 'currency_symbol', 'currency_format', 'is_deposit', 'deposit_amount', 'shop_discount', 'surcharge_fee', 'note', 'buzzer', 'delivery_type', 'table_number', 'schedule_date', 'created_at', 'request_unique_idempotency_token'];
|
|
3226
|
-
TEMP_ORDER_KEYS.forEach(function (key) {
|
|
3227
|
-
if (raw[key] !== undefined) {
|
|
3228
|
-
nextTempOrder[key] = raw[key];
|
|
3229
|
-
}
|
|
3230
|
-
});
|
|
3223
|
+
nextTempOrder = this.normalizeTempOrderForRuntime(raw);
|
|
3231
3224
|
this.store.tempOrder = nextTempOrder;
|
|
3232
3225
|
this.store.summary = raw.summary && _typeof(raw.summary) === 'object' ? _objectSpread(_objectSpread({}, createEmptySummary()), raw.summary) : createEmptySummary();
|
|
3233
3226
|
this.store.lastOrderInfo = raw.lastOrderInfo || raw;
|
|
3234
3227
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
3235
|
-
_context33.next =
|
|
3228
|
+
_context33.next = 8;
|
|
3236
3229
|
break;
|
|
3237
3230
|
}
|
|
3238
|
-
_context33.next =
|
|
3231
|
+
_context33.next = 8;
|
|
3239
3232
|
return this.recalculateSummary({
|
|
3240
3233
|
createIfMissing: false
|
|
3241
3234
|
});
|
|
3242
|
-
case
|
|
3235
|
+
case 8:
|
|
3243
3236
|
this.persistTempOrder();
|
|
3244
3237
|
return _context33.abrupt("return", nextTempOrder);
|
|
3245
|
-
case
|
|
3238
|
+
case 10:
|
|
3246
3239
|
case "end":
|
|
3247
3240
|
return _context33.stop();
|
|
3248
3241
|
}
|
|
@@ -3303,6 +3296,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3303
3296
|
if ((options === null || options === void 0 ? void 0 : options.ensureIdentity) !== false) {
|
|
3304
3297
|
this.ensureExternalSaleNumber(nextTempOrder);
|
|
3305
3298
|
}
|
|
3299
|
+
nextTempOrder.vouchers = raw.vouchers || [];
|
|
3306
3300
|
return nextTempOrder;
|
|
3307
3301
|
}
|
|
3308
3302
|
}, {
|
|
@@ -606,102 +606,103 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
606
606
|
orderId: orderIdOrParams
|
|
607
607
|
};
|
|
608
608
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
609
|
+
debugger;
|
|
609
610
|
if (params.forceRemote) {
|
|
610
|
-
_context5.next =
|
|
611
|
+
_context5.next = 36;
|
|
611
612
|
break;
|
|
612
613
|
}
|
|
613
614
|
if (!(params.orderId !== undefined)) {
|
|
614
|
-
_context5.next =
|
|
615
|
+
_context5.next = 12;
|
|
615
616
|
break;
|
|
616
617
|
}
|
|
617
|
-
_context5.next =
|
|
618
|
+
_context5.next = 9;
|
|
618
619
|
return this.store.order.getLocalOrderByOrderId(params.orderId);
|
|
619
|
-
case
|
|
620
|
+
case 9:
|
|
620
621
|
_context5.t0 = _context5.sent;
|
|
621
|
-
_context5.next =
|
|
622
|
+
_context5.next = 27;
|
|
622
623
|
break;
|
|
623
|
-
case
|
|
624
|
+
case 12:
|
|
624
625
|
if (!externalSaleNumber) {
|
|
625
|
-
_context5.next =
|
|
626
|
+
_context5.next = 18;
|
|
626
627
|
break;
|
|
627
628
|
}
|
|
628
|
-
_context5.next =
|
|
629
|
+
_context5.next = 15;
|
|
629
630
|
return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
|
|
630
|
-
case
|
|
631
|
+
case 15:
|
|
631
632
|
_context5.t1 = _context5.sent;
|
|
632
|
-
_context5.next =
|
|
633
|
+
_context5.next = 26;
|
|
633
634
|
break;
|
|
634
|
-
case
|
|
635
|
+
case 18:
|
|
635
636
|
if (!params.orderNumber) {
|
|
636
|
-
_context5.next =
|
|
637
|
+
_context5.next = 24;
|
|
637
638
|
break;
|
|
638
639
|
}
|
|
639
|
-
_context5.next =
|
|
640
|
+
_context5.next = 21;
|
|
640
641
|
return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
|
|
641
|
-
case
|
|
642
|
+
case 21:
|
|
642
643
|
_context5.t2 = _context5.sent;
|
|
643
|
-
_context5.next =
|
|
644
|
+
_context5.next = 25;
|
|
644
645
|
break;
|
|
645
|
-
case 23:
|
|
646
|
-
_context5.t2 = null;
|
|
647
646
|
case 24:
|
|
648
|
-
_context5.
|
|
647
|
+
_context5.t2 = null;
|
|
649
648
|
case 25:
|
|
650
|
-
_context5.
|
|
649
|
+
_context5.t1 = _context5.t2;
|
|
651
650
|
case 26:
|
|
651
|
+
_context5.t0 = _context5.t1;
|
|
652
|
+
case 27:
|
|
652
653
|
localRecord = _context5.t0;
|
|
653
654
|
if (!localRecord) {
|
|
654
|
-
_context5.next =
|
|
655
|
+
_context5.next = 36;
|
|
655
656
|
break;
|
|
656
657
|
}
|
|
657
|
-
_context5.next =
|
|
658
|
+
_context5.next = 31;
|
|
658
659
|
return this.store.order.hydrateTempOrderFromRecord(localRecord, {
|
|
659
660
|
recalcOnHydrate: false
|
|
660
661
|
});
|
|
661
|
-
case
|
|
662
|
+
case 31:
|
|
662
663
|
_sales = _context5.sent;
|
|
663
664
|
this.currentSalesDetail = _sales;
|
|
664
|
-
_context5.next =
|
|
665
|
+
_context5.next = 35;
|
|
665
666
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
666
667
|
sales: _sales
|
|
667
668
|
});
|
|
668
|
-
case 34:
|
|
669
|
-
return _context5.abrupt("return", _sales);
|
|
670
669
|
case 35:
|
|
670
|
+
return _context5.abrupt("return", _sales);
|
|
671
|
+
case 36:
|
|
671
672
|
if (!(params.orderId === undefined || params.orderId === null)) {
|
|
672
|
-
_context5.next =
|
|
673
|
+
_context5.next = 38;
|
|
673
674
|
break;
|
|
674
675
|
}
|
|
675
676
|
throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
|
|
676
|
-
case
|
|
677
|
-
_context5.next =
|
|
677
|
+
case 38:
|
|
678
|
+
_context5.next = 40;
|
|
678
679
|
return this.store.order.getOrderInfoByRemote(Number(params.orderId));
|
|
679
|
-
case
|
|
680
|
+
case 40:
|
|
680
681
|
res = _context5.sent;
|
|
681
682
|
if (!(!res || res.code !== 200)) {
|
|
682
|
-
_context5.next =
|
|
683
|
+
_context5.next = 44;
|
|
683
684
|
break;
|
|
684
685
|
}
|
|
685
686
|
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
|
|
686
687
|
throw new Error(message);
|
|
687
|
-
case
|
|
688
|
-
_context5.next =
|
|
688
|
+
case 44:
|
|
689
|
+
_context5.next = 46;
|
|
689
690
|
return this.store.order.hydrateTempOrderFromRecord(res.data, {
|
|
690
691
|
recalcOnHydrate: false
|
|
691
692
|
});
|
|
692
|
-
case
|
|
693
|
+
case 46:
|
|
693
694
|
sales = _context5.sent;
|
|
694
|
-
_context5.next =
|
|
695
|
+
_context5.next = 49;
|
|
695
696
|
return this.store.order.saveDraft();
|
|
696
|
-
case
|
|
697
|
+
case 49:
|
|
697
698
|
this.currentSalesDetail = sales;
|
|
698
|
-
_context5.next =
|
|
699
|
+
_context5.next = 52;
|
|
699
700
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
700
701
|
sales: sales
|
|
701
702
|
});
|
|
702
|
-
case 51:
|
|
703
|
-
return _context5.abrupt("return", sales);
|
|
704
703
|
case 52:
|
|
704
|
+
return _context5.abrupt("return", sales);
|
|
705
|
+
case 53:
|
|
705
706
|
case "end":
|
|
706
707
|
return _context5.stop();
|
|
707
708
|
}
|
|
@@ -278,7 +278,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
278
278
|
* 获取当前的客户搜索条件
|
|
279
279
|
* @returns 当前搜索条件
|
|
280
280
|
*/
|
|
281
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
281
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
282
282
|
/**
|
|
283
283
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
284
284
|
* @returns 客户状态
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -264,7 +264,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
264
264
|
private logSubmitBackendRejected;
|
|
265
265
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
266
266
|
createOrder(params: CommitOrderParams['query']): {
|
|
267
|
-
type: "
|
|
267
|
+
type: "virtual" | "appointment_booking";
|
|
268
268
|
platform: string;
|
|
269
269
|
sales_channel: string;
|
|
270
270
|
order_sales_channel: string;
|
|
@@ -2254,54 +2254,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2254
2254
|
*/
|
|
2255
2255
|
async hydrateTempOrderFromRecord(record, options) {
|
|
2256
2256
|
const raw = record && typeof record === "object" && record.data && record.order_id == null ? record.data : record || {};
|
|
2257
|
-
const
|
|
2258
|
-
const nextTempOrder = {
|
|
2259
|
-
...defaults
|
|
2260
|
-
};
|
|
2261
|
-
const TEMP_ORDER_KEYS = [
|
|
2262
|
-
"order_id",
|
|
2263
|
-
"external_sale_number",
|
|
2264
|
-
"order_number",
|
|
2265
|
-
"shop_order_number",
|
|
2266
|
-
"shop_full_order_number",
|
|
2267
|
-
"type",
|
|
2268
|
-
"business_code",
|
|
2269
|
-
"platform",
|
|
2270
|
-
"sales_channel",
|
|
2271
|
-
"order_sales_channel",
|
|
2272
|
-
"vouchers",
|
|
2273
|
-
"status",
|
|
2274
|
-
"payment_status",
|
|
2275
|
-
"shipping_status",
|
|
2276
|
-
"customer_id",
|
|
2277
|
-
"customer_name",
|
|
2278
|
-
"country_calling_code",
|
|
2279
|
-
"phone",
|
|
2280
|
-
"email",
|
|
2281
|
-
"customer",
|
|
2282
|
-
"is_price_include_tax",
|
|
2283
|
-
"tax_title",
|
|
2284
|
-
"tax_country_code",
|
|
2285
|
-
"currency_code",
|
|
2286
|
-
"currency_symbol",
|
|
2287
|
-
"currency_format",
|
|
2288
|
-
"is_deposit",
|
|
2289
|
-
"deposit_amount",
|
|
2290
|
-
"shop_discount",
|
|
2291
|
-
"surcharge_fee",
|
|
2292
|
-
"note",
|
|
2293
|
-
"buzzer",
|
|
2294
|
-
"delivery_type",
|
|
2295
|
-
"table_number",
|
|
2296
|
-
"schedule_date",
|
|
2297
|
-
"created_at",
|
|
2298
|
-
"request_unique_idempotency_token"
|
|
2299
|
-
];
|
|
2300
|
-
TEMP_ORDER_KEYS.forEach((key) => {
|
|
2301
|
-
if (raw[key] !== void 0) {
|
|
2302
|
-
nextTempOrder[key] = raw[key];
|
|
2303
|
-
}
|
|
2304
|
-
});
|
|
2257
|
+
const nextTempOrder = this.normalizeTempOrderForRuntime(raw);
|
|
2305
2258
|
this.store.tempOrder = nextTempOrder;
|
|
2306
2259
|
this.store.summary = raw.summary && typeof raw.summary === "object" ? { ...(0, import_utils.createEmptySummary)(), ...raw.summary } : (0, import_utils.createEmptySummary)();
|
|
2307
2260
|
this.store.lastOrderInfo = raw.lastOrderInfo || raw;
|
|
@@ -2349,6 +2302,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2349
2302
|
if ((options == null ? void 0 : options.ensureIdentity) !== false) {
|
|
2350
2303
|
this.ensureExternalSaleNumber(nextTempOrder);
|
|
2351
2304
|
}
|
|
2305
|
+
nextTempOrder.vouchers = raw.vouchers || [];
|
|
2352
2306
|
return nextTempOrder;
|
|
2353
2307
|
}
|
|
2354
2308
|
normalizeHydratedOrderProduct(product) {
|
|
@@ -430,6 +430,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
430
430
|
throw new Error("order 模块未初始化");
|
|
431
431
|
const params = typeof orderIdOrParams === "object" ? orderIdOrParams : { orderId: orderIdOrParams };
|
|
432
432
|
const externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
433
|
+
debugger;
|
|
433
434
|
if (!params.forceRemote) {
|
|
434
435
|
const localRecord = params.orderId !== void 0 ? await this.store.order.getLocalOrderByOrderId(params.orderId) : externalSaleNumber ? await this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber) : params.orderNumber ? await this.store.order.getLocalOrderByOrderNumber(params.orderNumber) : null;
|
|
435
436
|
if (localRecord) {
|
|
@@ -278,7 +278,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
278
278
|
* 获取当前的客户搜索条件
|
|
279
279
|
* @returns 当前搜索条件
|
|
280
280
|
*/
|
|
281
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
281
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
282
282
|
/**
|
|
283
283
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
284
284
|
* @returns 客户状态
|