@pisell/pisellos 2.2.273 → 2.2.274
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.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +0 -8
- package/dist/modules/Order/index.d.ts +13 -32
- package/dist/modules/Order/index.js +555 -771
- package/dist/modules/Order/types.d.ts +22 -36
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.js +6 -10
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +27 -29
- package/dist/modules/Payment/types.js +3 -5
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +39 -55
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +0 -16
- package/dist/server/index.js +1036 -1933
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +25 -59
- package/dist/solution/BaseSales/index.js +490 -767
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +36 -93
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +5 -21
- package/dist/solution/BookingTicket/index.js +49 -126
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.js +20 -31
- package/dist/solution/VenueBooking/index.js +19 -30
- package/dist/types/index.d.ts +0 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +0 -5
- package/lib/modules/Order/index.d.ts +13 -32
- package/lib/modules/Order/index.js +142 -201
- package/lib/modules/Order/types.d.ts +22 -36
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.js +4 -11
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +27 -29
- package/lib/modules/Payment/types.js +3 -3
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +22 -41
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +0 -16
- package/lib/server/index.js +18 -670
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +25 -59
- package/lib/solution/BaseSales/index.js +79 -246
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +17 -65
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +5 -21
- package/lib/solution/BookingTicket/index.js +8 -59
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.js +0 -8
- package/lib/solution/VenueBooking/index.js +0 -8
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -12,8 +12,6 @@ export declare const PROMOTION_ACTION_TYPES: {
|
|
|
12
12
|
readonly X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE";
|
|
13
13
|
/** 买X送Y(买X件送Y件,可累计) */
|
|
14
14
|
readonly BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE";
|
|
15
|
-
/** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
|
|
16
|
-
readonly ITEM_REWARD: "ITEM_REWARD";
|
|
17
15
|
/** 固定折扣 */
|
|
18
16
|
readonly DISCOUNT_RATE: "DISCOUNT_RATE";
|
|
19
17
|
/** 固定减价 */
|
|
@@ -68,59 +66,6 @@ export interface BuyXGetYFreeConfig {
|
|
|
68
66
|
/** 可选的赠品列表 */
|
|
69
67
|
giftProducts?: ProductIdentifier[];
|
|
70
68
|
}
|
|
71
|
-
/**
|
|
72
|
-
* 商品奖励优惠方式
|
|
73
|
-
*
|
|
74
|
-
* - free: 目标商品最终价为 0
|
|
75
|
-
* - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
|
|
76
|
-
* - amount_off: 每个目标商品固定减免 rewardValue
|
|
77
|
-
* - fixed_price: 目标商品改为固定价 rewardValue
|
|
78
|
-
*/
|
|
79
|
-
export type ItemRewardMethod = 'free' | 'percent_off' | 'amount_off' | 'fixed_price';
|
|
80
|
-
/**
|
|
81
|
-
* 商品奖励数量规则
|
|
82
|
-
*
|
|
83
|
-
* - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
|
|
84
|
-
* - all_targets: 满足条件后奖励全部目标商品
|
|
85
|
-
* - max_per_order: 满足条件后每单最多奖励固定数量目标商品
|
|
86
|
-
*/
|
|
87
|
-
export type ItemRewardQuantityRule = 'per_condition_quantity' | 'all_targets' | 'max_per_order';
|
|
88
|
-
/** 商品奖励目标选择规则 */
|
|
89
|
-
export type ItemRewardTargetSelection = 'consumer_best';
|
|
90
|
-
/**
|
|
91
|
-
* 商品奖励 - Action Value
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* value: {
|
|
95
|
-
* rewardMethod: 'free',
|
|
96
|
-
* quantityRule: 'per_condition_quantity',
|
|
97
|
-
* triggerQuantity: 1,
|
|
98
|
-
* rewardQuantity: 1,
|
|
99
|
-
* }
|
|
100
|
-
*/
|
|
101
|
-
export interface ItemRewardValue {
|
|
102
|
-
/** 奖励方式 */
|
|
103
|
-
rewardMethod: ItemRewardMethod;
|
|
104
|
-
/** 奖励值:percent_off/amount_off/fixed_price 使用,free 可省略 */
|
|
105
|
-
rewardValue?: number;
|
|
106
|
-
/** 奖励数量规则 */
|
|
107
|
-
quantityRule: ItemRewardQuantityRule;
|
|
108
|
-
/** 每满足 N 个条件商品;默认 1 */
|
|
109
|
-
triggerQuantity?: number;
|
|
110
|
-
/** 奖励 Y 个目标商品;默认 1 */
|
|
111
|
-
rewardQuantity?: number;
|
|
112
|
-
/** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
|
|
113
|
-
maxRewardQuantity?: number;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* 商品奖励 - Action Config
|
|
117
|
-
*/
|
|
118
|
-
export interface ItemRewardConfig {
|
|
119
|
-
/** 奖励对象,本期支持指定商品/变体;product_variant_id=0 表示任意变体 */
|
|
120
|
-
rewardTargets?: ProductIdentifier[];
|
|
121
|
-
/** 目标商品超额时的选择规则;本期支持 consumer_best */
|
|
122
|
-
targetSelection?: ItemRewardTargetSelection;
|
|
123
|
-
}
|
|
124
69
|
/**
|
|
125
70
|
* 商品标识
|
|
126
71
|
*
|
|
@@ -157,19 +102,10 @@ export interface BuyXGetYFreeAction extends Omit<ActionEffect, 'type' | 'value'
|
|
|
157
102
|
valueType: 'object';
|
|
158
103
|
config?: BuyXGetYFreeConfig;
|
|
159
104
|
}
|
|
160
|
-
/**
|
|
161
|
-
* 商品奖励 Action
|
|
162
|
-
*/
|
|
163
|
-
export interface ItemRewardAction extends Omit<ActionEffect, 'type' | 'value' | 'config'> {
|
|
164
|
-
type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
|
|
165
|
-
value: ItemRewardValue;
|
|
166
|
-
valueType: 'object';
|
|
167
|
-
config?: ItemRewardConfig;
|
|
168
|
-
}
|
|
169
105
|
/**
|
|
170
106
|
* 促销活动 Action 联合类型
|
|
171
107
|
*/
|
|
172
|
-
export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction
|
|
108
|
+
export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction;
|
|
173
109
|
/**
|
|
174
110
|
* 促销相关运算符
|
|
175
111
|
*/
|
|
@@ -234,8 +170,6 @@ export interface PromotionProduct {
|
|
|
234
170
|
quantity: number;
|
|
235
171
|
/** 原价 */
|
|
236
172
|
original_price?: number;
|
|
237
|
-
/** 内部字段:编辑态订单行只允许参与 ITEM_REWARD,避免旧促销误算历史行 */
|
|
238
|
-
_promotionOnlyForItemReward?: boolean;
|
|
239
173
|
}
|
|
240
174
|
/**
|
|
241
175
|
* 促销活动适配器转换结果
|
|
@@ -261,7 +195,7 @@ export interface PromotionTransformResult {
|
|
|
261
195
|
/**
|
|
262
196
|
* Action 详情联合类型
|
|
263
197
|
*/
|
|
264
|
-
export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail
|
|
198
|
+
export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail;
|
|
265
199
|
/**
|
|
266
200
|
* X件Y元 Action 详情
|
|
267
201
|
*/
|
|
@@ -292,28 +226,6 @@ export interface BuyXGetYFreeActionDetail {
|
|
|
292
226
|
/** 可选的赠品列表 */
|
|
293
227
|
giftProducts: ProductIdentifier[];
|
|
294
228
|
}
|
|
295
|
-
/**
|
|
296
|
-
* 商品奖励 Action 详情
|
|
297
|
-
*/
|
|
298
|
-
export interface ItemRewardActionDetail {
|
|
299
|
-
type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
|
|
300
|
-
/** 奖励方式 */
|
|
301
|
-
rewardMethod: ItemRewardMethod;
|
|
302
|
-
/** 奖励值:percent_off/amount_off/fixed_price 使用,free 为 0 */
|
|
303
|
-
rewardValue: number;
|
|
304
|
-
/** 奖励数量规则 */
|
|
305
|
-
quantityRule: ItemRewardQuantityRule;
|
|
306
|
-
/** 每满足 N 个条件商品;默认 1 */
|
|
307
|
-
triggerQuantity: number;
|
|
308
|
-
/** 奖励 Y 个目标商品;默认 1 */
|
|
309
|
-
rewardQuantity: number;
|
|
310
|
-
/** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
|
|
311
|
-
maxRewardQuantity?: number;
|
|
312
|
-
/** 奖励对象,本期支持指定商品/变体 */
|
|
313
|
-
rewardTargets: ProductIdentifier[];
|
|
314
|
-
/** 目标商品超额时的选择规则 */
|
|
315
|
-
targetSelection: ItemRewardTargetSelection;
|
|
316
|
-
}
|
|
317
229
|
/**
|
|
318
230
|
* X件Y元 - 业务层计算结果
|
|
319
231
|
*
|
|
@@ -16,8 +16,6 @@ export var PROMOTION_ACTION_TYPES = {
|
|
|
16
16
|
X_ITEMS_FOR_Y_PRICE: 'X_ITEMS_FOR_Y_PRICE',
|
|
17
17
|
/** 买X送Y(买X件送Y件,可累计) */
|
|
18
18
|
BUY_X_GET_Y_FREE: 'BUY_X_GET_Y_FREE',
|
|
19
|
-
/** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
|
|
20
|
-
ITEM_REWARD: 'ITEM_REWARD',
|
|
21
19
|
/** 固定折扣 */
|
|
22
20
|
DISCOUNT_RATE: 'DISCOUNT_RATE',
|
|
23
21
|
/** 固定减价 */
|
|
@@ -56,41 +54,6 @@ export var PROMOTION_ACTION_TYPES = {
|
|
|
56
54
|
* 买X送Y - Action Config
|
|
57
55
|
*/
|
|
58
56
|
|
|
59
|
-
/**
|
|
60
|
-
* 商品奖励优惠方式
|
|
61
|
-
*
|
|
62
|
-
* - free: 目标商品最终价为 0
|
|
63
|
-
* - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
|
|
64
|
-
* - amount_off: 每个目标商品固定减免 rewardValue
|
|
65
|
-
* - fixed_price: 目标商品改为固定价 rewardValue
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 商品奖励数量规则
|
|
70
|
-
*
|
|
71
|
-
* - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
|
|
72
|
-
* - all_targets: 满足条件后奖励全部目标商品
|
|
73
|
-
* - max_per_order: 满足条件后每单最多奖励固定数量目标商品
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
/** 商品奖励目标选择规则 */
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* 商品奖励 - Action Value
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* value: {
|
|
83
|
-
* rewardMethod: 'free',
|
|
84
|
-
* quantityRule: 'per_condition_quantity',
|
|
85
|
-
* triggerQuantity: 1,
|
|
86
|
-
* rewardQuantity: 1,
|
|
87
|
-
* }
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 商品奖励 - Action Config
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
57
|
// ============================================
|
|
95
58
|
// 商品标识
|
|
96
59
|
// ============================================
|
|
@@ -115,10 +78,6 @@ export var PROMOTION_ACTION_TYPES = {
|
|
|
115
78
|
* 买X送Y Action
|
|
116
79
|
*/
|
|
117
80
|
|
|
118
|
-
/**
|
|
119
|
-
* 商品奖励 Action
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
81
|
/**
|
|
123
82
|
* 促销活动 Action 联合类型
|
|
124
83
|
*/
|
|
@@ -187,10 +146,6 @@ var obj = {
|
|
|
187
146
|
* 买X送Y Action 详情
|
|
188
147
|
*/
|
|
189
148
|
|
|
190
|
-
/**
|
|
191
|
-
* 商品奖励 Action 详情
|
|
192
|
-
*/
|
|
193
|
-
|
|
194
149
|
// ============================================
|
|
195
150
|
// 业务层输出类型(供参考)
|
|
196
151
|
// ============================================
|
|
@@ -134,9 +134,11 @@ function resolveMainProductPrice(product, fallback) {
|
|
|
134
134
|
}
|
|
135
135
|
function mapOrderBundleToOtherBundle(bundle) {
|
|
136
136
|
return bundle.map(function (item) {
|
|
137
|
-
var _ref7, _item$original_price;
|
|
137
|
+
var _ref7, _ref8, _item$original_price;
|
|
138
138
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
139
|
-
|
|
139
|
+
// 后端历史订单可能没有 original_price;此时 price 是折前毛价,
|
|
140
|
+
// bundle_selling_price 已包含折扣,不能把它当成编辑时的新原价。
|
|
141
|
+
original_price: (_ref7 = (_ref8 = (_item$original_price = item.original_price) !== null && _item$original_price !== void 0 ? _item$original_price : item.product_price) !== null && _ref8 !== void 0 ? _ref8 : item.price) !== null && _ref7 !== void 0 ? _ref7 : item.bundle_selling_price
|
|
140
142
|
});
|
|
141
143
|
});
|
|
142
144
|
}
|
|
@@ -167,10 +169,10 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
167
169
|
});
|
|
168
170
|
if (relationIdsByForm.size === 0) return undefined;
|
|
169
171
|
return {
|
|
170
|
-
resources: Array.from(relationIdsByForm.entries()).map(function (
|
|
171
|
-
var
|
|
172
|
-
formId =
|
|
173
|
-
relationIds =
|
|
172
|
+
resources: Array.from(relationIdsByForm.entries()).map(function (_ref9) {
|
|
173
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
174
|
+
formId = _ref10[0],
|
|
175
|
+
relationIds = _ref10[1];
|
|
174
176
|
return {
|
|
175
177
|
id: formId,
|
|
176
178
|
status: 1,
|
|
@@ -190,7 +192,7 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
190
192
|
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
191
193
|
*/
|
|
192
194
|
export function buildCacheItemFromOrderLine(input) {
|
|
193
|
-
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num,
|
|
195
|
+
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref11, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref12, _extension_type, _booking$product2, _booking$product3, _price, _product$product_sku, _product$order_detail, _ref13, _booking$id;
|
|
194
196
|
var product = input.product,
|
|
195
197
|
booking = input.booking,
|
|
196
198
|
sourceProduct = input.sourceProduct;
|
|
@@ -225,7 +227,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
225
227
|
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
|
|
226
228
|
product_name: productTitle,
|
|
227
229
|
product_cover: productCover,
|
|
228
|
-
note: (
|
|
230
|
+
note: (_ref11 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref11 !== void 0 ? _ref11 : '',
|
|
229
231
|
price: mainProductPrice,
|
|
230
232
|
total: selling,
|
|
231
233
|
origin_total: original,
|
|
@@ -260,7 +262,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
260
262
|
var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
261
263
|
id: resolvedId,
|
|
262
264
|
product_id: resolvedId,
|
|
263
|
-
extension_type: (
|
|
265
|
+
extension_type: (_ref12 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref12 !== void 0 ? _ref12 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
|
|
264
266
|
title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
|
|
265
267
|
price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
|
|
266
268
|
selling_price: product.selling_price,
|
|
@@ -274,7 +276,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
274
276
|
new: 0,
|
|
275
277
|
autoClose: false,
|
|
276
278
|
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
277
|
-
booking_id: (
|
|
279
|
+
booking_id: (_ref13 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref13 !== void 0 ? _ref13 : 0
|
|
278
280
|
});
|
|
279
281
|
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
|
|
280
282
|
base.capacity = sourceProduct.capacity;
|
|
@@ -27,8 +27,6 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
27
27
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
28
28
|
getOpenData(): OpenDataConfig | null;
|
|
29
29
|
getLastFetchedAt(): number | null;
|
|
30
|
-
/** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
|
|
31
|
-
clearCache(): void;
|
|
32
30
|
checkAvailability(scheduleModule?: ScheduleModule): OpenDataAvailabilityResult;
|
|
33
31
|
storeChange(): void;
|
|
34
32
|
}
|
|
@@ -166,14 +166,6 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
166
166
|
var _this$store$lastFetch;
|
|
167
167
|
return (_this$store$lastFetch = this.store.lastFetchedAt) !== null && _this$store$lastFetch !== void 0 ? _this$store$lastFetch : null;
|
|
168
168
|
}
|
|
169
|
-
|
|
170
|
-
/** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
|
|
171
|
-
}, {
|
|
172
|
-
key: "clearCache",
|
|
173
|
-
value: function clearCache() {
|
|
174
|
-
this.store.data = null;
|
|
175
|
-
this.store.lastFetchedAt = null;
|
|
176
|
-
}
|
|
177
169
|
}, {
|
|
178
170
|
key: "checkAvailability",
|
|
179
171
|
value: function checkAvailability(scheduleModule) {
|
|
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData,
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -14,7 +14,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
14
14
|
private request;
|
|
15
15
|
private logger;
|
|
16
16
|
private window;
|
|
17
|
-
private appPlugin;
|
|
18
17
|
private cacheId;
|
|
19
18
|
private salesSummaryModuleName;
|
|
20
19
|
private rulesHooksOverride?;
|
|
@@ -177,9 +176,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
177
176
|
};
|
|
178
177
|
private calculateDepositPaidAmount;
|
|
179
178
|
private resolveNextOrderPaymentType;
|
|
180
|
-
private getPaymentNumberAppData;
|
|
181
|
-
private getPaymentNumberDevicePrefixSync;
|
|
182
|
-
private getPaymentNumberDevicePrefixAsync;
|
|
183
179
|
private normalizePaymentSource;
|
|
184
180
|
private updateTempOrderPaymentStatus;
|
|
185
181
|
private shouldKeepPaymentStatusAfterAmountRecalc;
|
|
@@ -311,20 +307,19 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
311
307
|
* 用一组支付来源覆盖当前订单支付项。
|
|
312
308
|
*
|
|
313
309
|
* 入参允许来自 PaymentModule 的 PaymentItem,内部统一映射为 Sales 协议:
|
|
314
|
-
*
|
|
310
|
+
* uuid -> metadata.unique_payment_number,id -> custom_payment_id,
|
|
315
311
|
* isSynced 等运行态字段不会进入 tempOrder.payments。
|
|
316
312
|
*/
|
|
317
313
|
setOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
|
|
318
|
-
/**
|
|
314
|
+
/** 追加单个支付项,并立即持久化当前 tempOrder。 */
|
|
319
315
|
addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
|
|
320
|
-
/** 异步入口:创建支付项时读取最新 IoT 设备短号。 */
|
|
321
|
-
addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
|
|
322
|
-
private addOrderPaymentWithDevicePrefix;
|
|
323
316
|
/**
|
|
324
|
-
*
|
|
325
|
-
*
|
|
317
|
+
* 按支付唯一号、后端支付 ID、自定义支付方式 ID 或旧 uuid 更新支付项。
|
|
318
|
+
*
|
|
319
|
+
* 该方法服务 PaymentModal 的 void / 编辑场景;更新 metadata 时会做浅合并,
|
|
320
|
+
* 避免覆盖 unique_payment_number、现金实付/找零等已有元数据。
|
|
326
321
|
*/
|
|
327
|
-
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any
|
|
322
|
+
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
|
|
328
323
|
/** 从当前订单支付项中移除指定支付项。 */
|
|
329
324
|
deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
|
|
330
325
|
private confirmPendingVoucherPaymentsInList;
|
|
@@ -347,11 +342,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
347
342
|
*/
|
|
348
343
|
updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
|
|
349
344
|
status?: 'paid' | 'payment_pending';
|
|
350
|
-
devicePrefix?: string;
|
|
351
345
|
}): OrderPaymentData[];
|
|
352
|
-
updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
|
|
353
|
-
status?: 'paid' | 'payment_pending';
|
|
354
|
-
}): Promise<OrderPaymentData[]>;
|
|
355
346
|
private shouldMergeProductToOrder;
|
|
356
347
|
private hasOrderProductLineNote;
|
|
357
348
|
/**
|
|
@@ -383,7 +374,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
383
374
|
* await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
|
|
384
375
|
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
385
376
|
*/
|
|
386
|
-
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
|
|
377
|
+
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<OrderProduct[]>;
|
|
387
378
|
/**
|
|
388
379
|
* 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
|
|
389
380
|
*
|
|
@@ -421,8 +412,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
421
412
|
* @example
|
|
422
413
|
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
423
414
|
*/
|
|
424
|
-
removeProductsFromOrder(identities: OrderProductIdentity[]): Promise<OrderProduct[]>;
|
|
425
|
-
removeProductFromOrder(identity: OrderProductIdentity): Promise<OrderProduct[]>;
|
|
415
|
+
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
416
|
+
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
426
417
|
/**
|
|
427
418
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
428
419
|
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
@@ -436,14 +427,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
436
427
|
type?: string;
|
|
437
428
|
}): import("./types").OrderSubmitPayload;
|
|
438
429
|
applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
|
|
439
|
-
saveTempOrderAsDraft<T = any>(params?: {
|
|
440
|
-
cacheId?: string;
|
|
441
|
-
platform?: string;
|
|
442
|
-
businessCode?: string;
|
|
443
|
-
channel?: string;
|
|
444
|
-
type?: string;
|
|
445
|
-
enhancePayload?: SubmitPayloadEnhancer;
|
|
446
|
-
}): Promise<T>;
|
|
447
430
|
/**
|
|
448
431
|
* 提交当前 Sales tempOrder。
|
|
449
432
|
*
|
|
@@ -485,7 +468,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
485
468
|
generateIdempotencyToken(): string;
|
|
486
469
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
487
470
|
createOrder(params: CommitOrderParams['query']): {
|
|
488
|
-
type: "
|
|
471
|
+
type: "appointment_booking" | "virtual";
|
|
489
472
|
platform: string;
|
|
490
473
|
sales_channel: string;
|
|
491
474
|
order_sales_channel: string;
|
|
@@ -548,8 +531,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
548
531
|
*/
|
|
549
532
|
private seedAnonymousBookingUidsFromProducts;
|
|
550
533
|
private normalizeTempOrderForRuntime;
|
|
551
|
-
private isSyntheticDraftOrderIdForRuntime;
|
|
552
|
-
private withoutSyntheticDraftOrderIdForRuntime;
|
|
553
534
|
private hydrateLinkedBookingIdentity;
|
|
554
535
|
private pickHydratedDisplayText;
|
|
555
536
|
private formatHydratedNamePair;
|
|
@@ -560,4 +541,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
560
541
|
getOrderInfo(order_id: number): Promise<any>;
|
|
561
542
|
getVouchers(): any[];
|
|
562
543
|
}
|
|
563
|
-
export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
544
|
+
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|