@pisell/pisellos 2.2.294 → 2.2.296
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/itemRule/adapter.d.ts +1 -4
- package/dist/model/strategy/adapter/itemRule/adapter.js +35 -135
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +1 -8
- package/dist/model/strategy/adapter/itemRule/evaluator.js +1 -25
- package/dist/model/strategy/adapter/itemRule/type.d.ts +0 -44
- package/dist/model/strategy/adapter/itemRule/type.js +1 -19
- package/dist/modules/Order/index.d.ts +3 -18
- package/dist/modules/Order/index.js +485 -885
- package/dist/modules/Order/types.d.ts +5 -91
- package/dist/modules/Order/types.js +0 -5
- package/dist/modules/Order/utils.js +10 -22
- package/dist/modules/ProductList/index.d.ts +1 -2
- package/dist/modules/ProductList/index.js +20 -100
- package/dist/modules/ProductList/types.d.ts +0 -10
- package/dist/server/index.d.ts +0 -6
- package/dist/server/index.js +3 -43
- package/dist/server/utils/small-ticket.js +49 -1
- package/dist/solution/BaseSales/index.d.ts +1 -9
- package/dist/solution/BaseSales/index.js +706 -894
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/orderCustomer.js +2 -3
- package/dist/solution/RegisterAndLogin/config.d.ts +3 -9
- package/dist/solution/RegisterAndLogin/config.js +40 -95
- package/dist/solution/RegisterAndLogin/index.js +1 -4
- package/dist/solution/ScanOrder/index.d.ts +0 -1
- package/dist/solution/ScanOrder/index.js +27 -31
- package/dist/solution/ScanOrder/utils.d.ts +0 -1
- package/dist/solution/ScanOrder/utils.js +0 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -15
- package/dist/solution/UnifiedBookingSales/index.js +484 -752
- package/dist/solution/UnifiedBookingSales/types.d.ts +1 -14
- package/dist/solution/VenueBooking/index.d.ts +0 -1
- package/dist/solution/VenueBooking/index.js +4 -8
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +1 -4
- package/lib/model/strategy/adapter/itemRule/adapter.js +4 -73
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +1 -8
- package/lib/model/strategy/adapter/itemRule/evaluator.js +1 -23
- package/lib/model/strategy/adapter/itemRule/type.d.ts +0 -44
- package/lib/model/strategy/adapter/itemRule/type.js +1 -19
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Order/index.d.ts +3 -18
- package/lib/modules/Order/index.js +28 -325
- package/lib/modules/Order/types.d.ts +5 -91
- package/lib/modules/Order/types.js +0 -4
- package/lib/modules/Order/utils.js +1 -13
- package/lib/modules/ProductList/index.d.ts +1 -2
- package/lib/modules/ProductList/index.js +2 -47
- package/lib/modules/ProductList/types.d.ts +0 -10
- package/lib/server/index.d.ts +0 -6
- package/lib/server/index.js +3 -37
- package/lib/server/utils/small-ticket.js +50 -1
- package/lib/solution/BaseSales/index.d.ts +1 -9
- package/lib/solution/BaseSales/index.js +1 -105
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/orderCustomer.js +1 -2
- package/lib/solution/RegisterAndLogin/config.d.ts +3 -9
- package/lib/solution/RegisterAndLogin/config.js +8 -49
- package/lib/solution/RegisterAndLogin/index.js +1 -4
- package/lib/solution/ScanOrder/index.d.ts +0 -1
- package/lib/solution/ScanOrder/index.js +1 -5
- package/lib/solution/ScanOrder/utils.d.ts +0 -1
- package/lib/solution/ScanOrder/utils.js +0 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -15
- package/lib/solution/UnifiedBookingSales/index.js +1 -125
- package/lib/solution/UnifiedBookingSales/types.d.ts +1 -14
- package/lib/solution/VenueBooking/index.d.ts +0 -1
- package/lib/solution/VenueBooking/index.js +1 -5
- package/package.json +1 -1
- package/dist/modules/Order/salesNotes.d.ts +0 -31
- package/dist/modules/Order/salesNotes.js +0 -492
- package/lib/modules/Order/salesNotes.d.ts +0 -31
- package/lib/modules/Order/salesNotes.js +0 -382
|
@@ -9,7 +9,6 @@ var _types = require("./types");
|
|
|
9
9
|
var _utils = require("./utils");
|
|
10
10
|
var _utils2 = require("../Product/utils");
|
|
11
11
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
12
|
-
var _salesNotes = require("./salesNotes");
|
|
13
12
|
var _paymentUtils = require("./payment-utils");
|
|
14
13
|
var _paymentNumber = require("../../utils/payment-number");
|
|
15
14
|
var _cartPromotion = require("../../solution/BaseSales/utils/cartPromotion");
|
|
@@ -905,7 +904,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
905
904
|
this.store.tempOrder = {
|
|
906
905
|
...this.store.tempOrder,
|
|
907
906
|
products: [...this.store.tempOrder.products],
|
|
908
|
-
notes: [...(this.store.tempOrder.notes || [])],
|
|
909
907
|
bookings: this.store.tempOrder.bookings ? [...this.store.tempOrder.bookings] : []
|
|
910
908
|
};
|
|
911
909
|
this.persistTempOrder();
|
|
@@ -2238,179 +2236,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
2238
2236
|
getTempOrderNote() {
|
|
2239
2237
|
return this.store.tempOrder?.note || '';
|
|
2240
2238
|
}
|
|
2241
|
-
ensureSalesNotesRuntimeState(tempOrder) {
|
|
2242
|
-
const hadNotesSnapshot = Array.isArray(tempOrder.notes);
|
|
2243
|
-
if (!Array.isArray(tempOrder.notes)) tempOrder.notes = [];
|
|
2244
|
-
if (!tempOrder._extend || typeof tempOrder._extend !== 'object') {
|
|
2245
|
-
tempOrder._extend = {
|
|
2246
|
-
productsByUid: {}
|
|
2247
|
-
};
|
|
2248
|
-
}
|
|
2249
|
-
if (!tempOrder._extend.salesNotesState) {
|
|
2250
|
-
tempOrder._extend.salesNotesState = {
|
|
2251
|
-
loaded: hadNotesSnapshot,
|
|
2252
|
-
dirty: false
|
|
2253
|
-
};
|
|
2254
|
-
}
|
|
2255
|
-
return tempOrder._extend.salesNotesState;
|
|
2256
|
-
}
|
|
2257
|
-
ensureSalesNotesLoadedForMutation(tempOrder) {
|
|
2258
|
-
const state = this.ensureSalesNotesRuntimeState(tempOrder);
|
|
2259
|
-
if (state.loaded) return;
|
|
2260
|
-
if (tempOrder.order_id === null || tempOrder.order_id === undefined) {
|
|
2261
|
-
state.loaded = true;
|
|
2262
|
-
tempOrder.notes = [];
|
|
2263
|
-
return;
|
|
2264
|
-
}
|
|
2265
|
-
throw new Error('[Order Notes] 当前订单 Notes 尚未完整加载,禁止提交部分快照');
|
|
2266
|
-
}
|
|
2267
|
-
normalizeSalesNoteUuid(value, field) {
|
|
2268
|
-
const uuid = String(value ?? '').trim();
|
|
2269
|
-
if (!uuid) throw new Error(`[Order Notes] ${field} 不能为空`);
|
|
2270
|
-
if (uuid.length > 255) {
|
|
2271
|
-
throw new Error(`[Order Notes] ${field} 不能超过 255 个字符`);
|
|
2272
|
-
}
|
|
2273
|
-
return uuid;
|
|
2274
|
-
}
|
|
2275
|
-
getSalesNotePrimaryRelation(note) {
|
|
2276
|
-
return note.note_relations.find(relation => relation.is_primary === 1) || null;
|
|
2277
|
-
}
|
|
2278
|
-
removeSalesNotesForMissingProductLines(tempOrder) {
|
|
2279
|
-
const state = this.ensureSalesNotesRuntimeState(tempOrder);
|
|
2280
|
-
if (!state.loaded || !Array.isArray(tempOrder.notes) || tempOrder.notes.length === 0) {
|
|
2281
|
-
return;
|
|
2282
|
-
}
|
|
2283
|
-
const remainingProductUids = new Set((tempOrder.products || []).map(product => product.metadata?.unique_identification_number || product.unique_identification_number).filter(uid => typeof uid === 'string' && uid.length > 0));
|
|
2284
|
-
const nextNotes = tempOrder.notes.filter(note => {
|
|
2285
|
-
const primary = this.getSalesNotePrimaryRelation(note);
|
|
2286
|
-
if (!primary || primary.target_type !== 'order_detail') return true;
|
|
2287
|
-
return remainingProductUids.has(primary.target_uuid);
|
|
2288
|
-
});
|
|
2289
|
-
if (nextNotes.length === tempOrder.notes.length) return;
|
|
2290
|
-
tempOrder.notes = nextNotes;
|
|
2291
|
-
state.dirty = true;
|
|
2292
|
-
}
|
|
2293
|
-
setSalesNoteOnTempOrder(tempOrder, input) {
|
|
2294
|
-
this.ensureSalesNotesLoadedForMutation(tempOrder);
|
|
2295
|
-
const note_type = String(input.note_type || '').trim();
|
|
2296
|
-
const policy = (0, _salesNotes.getSalesNotePolicy)(note_type);
|
|
2297
|
-
if (!policy) {
|
|
2298
|
-
throw new Error(`[Order Notes] 当前未注册备注类型: ${note_type || '(empty)'}`);
|
|
2299
|
-
}
|
|
2300
|
-
if (input.target?.target_type !== 'order_detail') {
|
|
2301
|
-
throw new Error('[Order Notes] 本期只支持 order_detail 作为主体');
|
|
2302
|
-
}
|
|
2303
|
-
const target_uuid = this.normalizeSalesNoteUuid(input.target.target_uuid, 'target_uuid');
|
|
2304
|
-
const targetProductExists = (tempOrder.products || []).some(product => {
|
|
2305
|
-
const productLineUid = product.metadata?.unique_identification_number || product.unique_identification_number;
|
|
2306
|
-
return String(productLineUid ?? '') === target_uuid;
|
|
2307
|
-
});
|
|
2308
|
-
if (!targetProductExists) {
|
|
2309
|
-
throw new Error('[Order Notes] 目标商品行不存在');
|
|
2310
|
-
}
|
|
2311
|
-
const text = (0, _salesNotes.buildSalesNoteText)(input.text);
|
|
2312
|
-
const notes = tempOrder.notes || [];
|
|
2313
|
-
// 当前 allergy policy 固定同一商品行只保留一条;业务调用方不参与去重规则。
|
|
2314
|
-
const existingIndex = policy.uniquePerPrimaryTarget ? notes.findIndex(note => {
|
|
2315
|
-
const primary = this.getSalesNotePrimaryRelation(note);
|
|
2316
|
-
return note.note_type === note_type && primary?.target_type === 'order_detail' && primary.target_uuid === target_uuid;
|
|
2317
|
-
}) : -1;
|
|
2318
|
-
const existing = existingIndex >= 0 ? notes[existingIndex] : null;
|
|
2319
|
-
const existingPrimary = existing?.note_relations.find(relation => relation.is_primary === 1 && relation.target_type === 'order_detail');
|
|
2320
|
-
const existingOrderRelation = existing?.note_relations.find(relation => relation.is_primary === 0 && relation.target_type === 'order');
|
|
2321
|
-
const note = {
|
|
2322
|
-
uuid: existing?.uuid || (0, _utils.createUuidV4)(),
|
|
2323
|
-
note_type: policy.note_type,
|
|
2324
|
-
content: {
|
|
2325
|
-
text
|
|
2326
|
-
},
|
|
2327
|
-
importance: policy.importance,
|
|
2328
|
-
note_relations: [{
|
|
2329
|
-
uuid: existingPrimary?.uuid || (0, _utils.createUuidV4)(),
|
|
2330
|
-
relation_type: policy.primary_relation_type,
|
|
2331
|
-
target_type: 'order_detail',
|
|
2332
|
-
target_uuid,
|
|
2333
|
-
is_primary: 1
|
|
2334
|
-
}, {
|
|
2335
|
-
uuid: existingOrderRelation?.uuid || (0, _utils.createUuidV4)(),
|
|
2336
|
-
relation_type: policy.secondary_order_relation_type,
|
|
2337
|
-
target_type: 'order',
|
|
2338
|
-
target_uuid: String(tempOrder.shop_order_number ?? ''),
|
|
2339
|
-
is_primary: 0
|
|
2340
|
-
}]
|
|
2341
|
-
};
|
|
2342
|
-
const duplicateIndex = notes.findIndex((item, index) => item.uuid === note.uuid && index !== existingIndex);
|
|
2343
|
-
if (duplicateIndex >= 0) {
|
|
2344
|
-
throw new Error('[Order Notes] uuid 已被其他 Note 使用');
|
|
2345
|
-
}
|
|
2346
|
-
tempOrder.notes = existingIndex >= 0 ? notes.map((item, index) => index === existingIndex ? note : item) : [...notes, note];
|
|
2347
|
-
const state = this.ensureSalesNotesRuntimeState(tempOrder);
|
|
2348
|
-
state.loaded = true;
|
|
2349
|
-
state.dirty = true;
|
|
2350
|
-
return note;
|
|
2351
|
-
}
|
|
2352
|
-
getSalesNotes() {
|
|
2353
|
-
const tempOrder = this.ensureTempOrder();
|
|
2354
|
-
this.ensureSalesNotesRuntimeState(tempOrder);
|
|
2355
|
-
return (0, _lodashEs.cloneDeep)(tempOrder.notes || []);
|
|
2356
|
-
}
|
|
2357
|
-
createSalesNotesMutationSnapshot() {
|
|
2358
|
-
const tempOrder = this.ensureTempOrder();
|
|
2359
|
-
const state = this.ensureSalesNotesRuntimeState(tempOrder);
|
|
2360
|
-
return {
|
|
2361
|
-
orderIdentity: {
|
|
2362
|
-
orderId: tempOrder.order_id ?? null,
|
|
2363
|
-
externalSaleNumber: String(tempOrder.external_sale_number || '')
|
|
2364
|
-
},
|
|
2365
|
-
notes: (0, _lodashEs.cloneDeep)(tempOrder.notes || []),
|
|
2366
|
-
state: (0, _lodashEs.cloneDeep)(state)
|
|
2367
|
-
};
|
|
2368
|
-
}
|
|
2369
|
-
restoreSalesNotesMutationSnapshot(snapshot) {
|
|
2370
|
-
if (!snapshot || !Array.isArray(snapshot.notes) || !snapshot.orderIdentity || typeof snapshot.orderIdentity.externalSaleNumber !== 'string' || typeof snapshot.state?.loaded !== 'boolean' || typeof snapshot.state?.dirty !== 'boolean') {
|
|
2371
|
-
throw new Error('[Order Notes] 无效的 mutation snapshot');
|
|
2372
|
-
}
|
|
2373
|
-
const tempOrder = this.store.tempOrder;
|
|
2374
|
-
if (!tempOrder) throw new Error('[Order Notes] 当前订单不存在');
|
|
2375
|
-
const snapshotOrderId = snapshot.orderIdentity.orderId;
|
|
2376
|
-
const currentOrderId = tempOrder.order_id;
|
|
2377
|
-
const hasSnapshotOrderId = snapshotOrderId !== null && snapshotOrderId !== undefined && String(snapshotOrderId).trim().length > 0;
|
|
2378
|
-
const hasCurrentOrderId = currentOrderId !== null && currentOrderId !== undefined && String(currentOrderId).trim().length > 0;
|
|
2379
|
-
const isSameOrder = hasSnapshotOrderId && hasCurrentOrderId ? String(snapshotOrderId) === String(currentOrderId) : Boolean(snapshot.orderIdentity.externalSaleNumber) && snapshot.orderIdentity.externalSaleNumber === String(tempOrder.external_sale_number || '');
|
|
2380
|
-
if (!isSameOrder) {
|
|
2381
|
-
throw new Error('[Order Notes] 当前订单已切换,拒绝恢复旧订单快照');
|
|
2382
|
-
}
|
|
2383
|
-
this.ensureSalesNotesRuntimeState(tempOrder);
|
|
2384
|
-
tempOrder.notes = (0, _lodashEs.cloneDeep)(snapshot.notes);
|
|
2385
|
-
tempOrder._extend.salesNotesState = (0, _lodashEs.cloneDeep)(snapshot.state);
|
|
2386
|
-
this.notifyTempOrderChanged();
|
|
2387
|
-
}
|
|
2388
|
-
async setSalesNote(input) {
|
|
2389
|
-
const tempOrder = this.ensureTempOrder();
|
|
2390
|
-
const note = this.setSalesNoteOnTempOrder(tempOrder, input);
|
|
2391
|
-
this.notifyTempOrderChanged();
|
|
2392
|
-
return (0, _lodashEs.cloneDeep)(note);
|
|
2393
|
-
}
|
|
2394
|
-
async removeSalesNote(uuid) {
|
|
2395
|
-
const tempOrder = this.ensureTempOrder();
|
|
2396
|
-
this.ensureSalesNotesLoadedForMutation(tempOrder);
|
|
2397
|
-
const normalizedUuid = this.normalizeSalesNoteUuid(uuid, 'uuid');
|
|
2398
|
-
const notes = tempOrder.notes || [];
|
|
2399
|
-
const nextNotes = notes.filter(note => note.uuid !== normalizedUuid);
|
|
2400
|
-
if (nextNotes.length === notes.length) return;
|
|
2401
|
-
tempOrder.notes = nextNotes;
|
|
2402
|
-
const state = this.ensureSalesNotesRuntimeState(tempOrder);
|
|
2403
|
-
state.dirty = true;
|
|
2404
|
-
this.notifyTempOrderChanged();
|
|
2405
|
-
}
|
|
2406
|
-
async clearSalesNotes() {
|
|
2407
|
-
const tempOrder = this.ensureTempOrder();
|
|
2408
|
-
tempOrder.notes = [];
|
|
2409
|
-
const state = this.ensureSalesNotesRuntimeState(tempOrder);
|
|
2410
|
-
state.loaded = true;
|
|
2411
|
-
state.dirty = true;
|
|
2412
|
-
this.notifyTempOrderChanged();
|
|
2413
|
-
}
|
|
2414
2239
|
updateTempOrderShopDiscount(amount) {
|
|
2415
2240
|
const tempOrder = this.ensureTempOrder();
|
|
2416
2241
|
const discount = _decimal.default.max(new _decimal.default(Number(amount) || 0), 0).toDecimalPlaces(2).toFixed(2);
|
|
@@ -2450,31 +2275,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
2450
2275
|
this.persistTempOrder();
|
|
2451
2276
|
return tempOrder.buzzer;
|
|
2452
2277
|
}
|
|
2453
|
-
updateTempOrderShopServiceData(patch) {
|
|
2454
|
-
const tempOrder = this.ensureTempOrder();
|
|
2455
|
-
const metadata = tempOrder.metadata && typeof tempOrder.metadata === 'object' && !Array.isArray(tempOrder.metadata) ? tempOrder.metadata : {};
|
|
2456
|
-
const currentShopServiceData = metadata.shop_service_data && typeof metadata.shop_service_data === 'object' && !Array.isArray(metadata.shop_service_data) ? metadata.shop_service_data : {};
|
|
2457
|
-
const shopServiceData = {
|
|
2458
|
-
...currentShopServiceData,
|
|
2459
|
-
...patch
|
|
2460
|
-
};
|
|
2461
|
-
tempOrder.metadata = {
|
|
2462
|
-
...metadata,
|
|
2463
|
-
shop_service_data: shopServiceData
|
|
2464
|
-
};
|
|
2465
|
-
this.persistTempOrder();
|
|
2466
|
-
return shopServiceData;
|
|
2467
|
-
}
|
|
2468
|
-
updateTempOrderPickupReferenceMode(mode) {
|
|
2469
|
-
return this.updateTempOrderShopServiceData({
|
|
2470
|
-
pickup_reference_mode: mode
|
|
2471
|
-
});
|
|
2472
|
-
}
|
|
2473
|
-
updateTempOrderServiceType(serviceType) {
|
|
2474
|
-
return this.updateTempOrderShopServiceData({
|
|
2475
|
-
service_type: serviceType
|
|
2476
|
-
});
|
|
2477
|
-
}
|
|
2478
2278
|
updateTempOrderContactsInfo(contactsInfo) {
|
|
2479
2279
|
const tempOrder = this.ensureTempOrder();
|
|
2480
2280
|
tempOrder.contacts_info = contactsInfo && typeof contactsInfo === 'object' && !Array.isArray(contactsInfo) ? contactsInfo : null;
|
|
@@ -3064,7 +2864,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3064
2864
|
const matchedProduct = matchedIndex === -1 ? null : tempOrder.products[matchedIndex];
|
|
3065
2865
|
const existedFingerprint = matchedProduct ? (0, _utils3.buildProductLineFingerprint)((0, _utils.getProductSkuOptions)(matchedProduct), matchedProduct.product_bundle) : '';
|
|
3066
2866
|
const commitProductLine = shouldMerge => {
|
|
3067
|
-
let committedProduct;
|
|
3068
2867
|
if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
|
|
3069
2868
|
this.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
|
|
3070
2869
|
if (linked) {
|
|
@@ -3080,7 +2879,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3080
2879
|
} else {
|
|
3081
2880
|
tempOrder.products = [...tempOrder.products, normalizedIncoming];
|
|
3082
2881
|
}
|
|
3083
|
-
committedProduct = normalizedIncoming;
|
|
3084
2882
|
} else {
|
|
3085
2883
|
const targetProduct = matchedProduct;
|
|
3086
2884
|
const targetUid = targetProduct.metadata?.unique_identification_number;
|
|
@@ -3116,7 +2914,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3116
2914
|
num: nextNum
|
|
3117
2915
|
};
|
|
3118
2916
|
this.captureProductRuntime(tempOrder, productToAdd, tempOrder.products[matchedIndex], targetUid);
|
|
3119
|
-
committedProduct = tempOrder.products[matchedIndex];
|
|
3120
2917
|
if (matchedIndex !== tempOrder.products.length - 1) {
|
|
3121
2918
|
const mergedProduct = tempOrder.products[matchedIndex];
|
|
3122
2919
|
tempOrder.products = [...tempOrder.products.slice(0, matchedIndex), ...tempOrder.products.slice(matchedIndex + 1), mergedProduct];
|
|
@@ -3125,10 +2922,10 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3125
2922
|
if (linked) {
|
|
3126
2923
|
tempOrder.bookings = [...(tempOrder.bookings || []), linked.booking];
|
|
3127
2924
|
}
|
|
3128
|
-
return committedProduct;
|
|
3129
2925
|
};
|
|
3130
2926
|
if (!matchedProduct) {
|
|
3131
|
-
|
|
2927
|
+
commitProductLine(false);
|
|
2928
|
+
return;
|
|
3132
2929
|
}
|
|
3133
2930
|
const shouldMerge = this.shouldMergeProductToOrder({
|
|
3134
2931
|
incomingProduct: productToAdd,
|
|
@@ -3143,7 +2940,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3143
2940
|
if (shouldMerge && typeof shouldMerge === 'object' && typeof shouldMerge.then === 'function') {
|
|
3144
2941
|
return Promise.resolve(shouldMerge).then(commitProductLine);
|
|
3145
2942
|
}
|
|
3146
|
-
|
|
2943
|
+
commitProductLine(shouldMerge);
|
|
3147
2944
|
}
|
|
3148
2945
|
|
|
3149
2946
|
/**
|
|
@@ -3155,102 +2952,36 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3155
2952
|
*/
|
|
3156
2953
|
async addProductToOrder(product, booking, options) {
|
|
3157
2954
|
const tempOrder = this.ensureTempOrder();
|
|
3158
|
-
const salesNoteDrafts = (options?.salesNotes || []).map(draft => ({
|
|
3159
|
-
note_type: String(draft.note_type || '').trim(),
|
|
3160
|
-
text: {
|
|
3161
|
-
kind: 'resolved',
|
|
3162
|
-
text: (0, _salesNotes.buildSalesNoteText)(draft.text)
|
|
3163
|
-
}
|
|
3164
|
-
}));
|
|
3165
|
-
const mutationSnapshot = salesNoteDrafts.length > 0 ? {
|
|
3166
|
-
products: (0, _lodashEs.cloneDeep)(tempOrder.products || []),
|
|
3167
|
-
bookings: (0, _lodashEs.cloneDeep)(tempOrder.bookings || []),
|
|
3168
|
-
notes: (0, _lodashEs.cloneDeep)(tempOrder.notes || []),
|
|
3169
|
-
extend: (0, _lodashEs.cloneDeep)(tempOrder._extend || {})
|
|
3170
|
-
} : null;
|
|
3171
|
-
const attachSalesNoteDrafts = orderProduct => {
|
|
3172
|
-
if (!salesNoteDrafts.length) return;
|
|
3173
|
-
const productLineUid = orderProduct.metadata?.unique_identification_number || orderProduct.unique_identification_number;
|
|
3174
|
-
if (!productLineUid) {
|
|
3175
|
-
throw new Error('[Order Notes] 商品行缺少 unique_identification_number');
|
|
3176
|
-
}
|
|
3177
|
-
salesNoteDrafts.forEach(draft => {
|
|
3178
|
-
this.setSalesNoteOnTempOrder(tempOrder, {
|
|
3179
|
-
note_type: draft.note_type,
|
|
3180
|
-
target: {
|
|
3181
|
-
target_type: 'order_detail',
|
|
3182
|
-
target_uuid: String(productLineUid)
|
|
3183
|
-
},
|
|
3184
|
-
text: draft.text
|
|
3185
|
-
});
|
|
3186
|
-
});
|
|
3187
|
-
};
|
|
3188
|
-
const rollbackProductAndNotesMutation = () => {
|
|
3189
|
-
if (!mutationSnapshot) return;
|
|
3190
|
-
tempOrder.products = mutationSnapshot.products;
|
|
3191
|
-
tempOrder.bookings = mutationSnapshot.bookings;
|
|
3192
|
-
tempOrder.notes = mutationSnapshot.notes;
|
|
3193
|
-
tempOrder._extend = mutationSnapshot.extend;
|
|
3194
|
-
};
|
|
3195
2955
|
const insertAfterProductUid = options?.insertAfterProductUid;
|
|
3196
2956
|
const anchorIndex = booking && insertAfterProductUid ? tempOrder.products.findIndex(line => {
|
|
3197
2957
|
const uid = line.metadata?.unique_identification_number || line.unique_identification_number;
|
|
3198
2958
|
return uid !== undefined && uid !== null && String(uid) === String(insertAfterProductUid);
|
|
3199
2959
|
}) : -1;
|
|
3200
2960
|
let insertAtIndex = anchorIndex >= 0 ? anchorIndex + 1 : undefined;
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
delete singleLine.product_quantity;
|
|
3211
|
-
if (i > 0) {
|
|
3212
|
-
delete singleLine.unique_identification_number;
|
|
3213
|
-
delete singleLine.identity_key;
|
|
3214
|
-
if (singleLine.metadata) {
|
|
3215
|
-
singleLine.metadata = {
|
|
3216
|
-
...singleLine.metadata
|
|
3217
|
-
};
|
|
3218
|
-
delete singleLine.metadata.unique_identification_number;
|
|
3219
|
-
delete singleLine.metadata.identity_key;
|
|
3220
|
-
}
|
|
3221
|
-
delete singleBooking.booking_uid;
|
|
3222
|
-
if (singleBooking.metadata) {
|
|
3223
|
-
singleBooking.metadata = {
|
|
3224
|
-
...singleBooking.metadata
|
|
3225
|
-
};
|
|
3226
|
-
delete singleBooking.metadata.unique_identification_number;
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
const committedProduct = await this.appendProductLineToTempOrder(tempOrder, singleLine, singleBooking, {
|
|
3230
|
-
insertAtIndex,
|
|
3231
|
-
disableMerge: options?.disableMerge
|
|
3232
|
-
});
|
|
3233
|
-
attachSalesNoteDrafts(committedProduct);
|
|
3234
|
-
if (insertAtIndex !== undefined) insertAtIndex += 1;
|
|
3235
|
-
}
|
|
3236
|
-
} else {
|
|
3237
|
-
const committedProduct = await this.appendProductLineToTempOrder(tempOrder, product, (0, _lodashEs.cloneDeep)(booking), {
|
|
2961
|
+
if (booking) {
|
|
2962
|
+
const productRecord = product;
|
|
2963
|
+
const splitCount = (0, _utils3.getSafeProductNum)(productRecord.num ?? productRecord.product_quantity ?? 1);
|
|
2964
|
+
if (splitCount > 1) {
|
|
2965
|
+
for (let i = 0; i < splitCount; i += 1) {
|
|
2966
|
+
const singleLine = (0, _lodashEs.cloneDeep)(productRecord);
|
|
2967
|
+
singleLine.num = 1;
|
|
2968
|
+
delete singleLine.product_quantity;
|
|
2969
|
+
const appendResult = this.appendProductLineToTempOrder(tempOrder, singleLine, (0, _lodashEs.cloneDeep)(booking), {
|
|
3238
2970
|
insertAtIndex,
|
|
3239
2971
|
disableMerge: options?.disableMerge
|
|
3240
2972
|
});
|
|
3241
|
-
|
|
2973
|
+
if (appendResult) await appendResult;
|
|
2974
|
+
if (insertAtIndex !== undefined) insertAtIndex += 1;
|
|
3242
2975
|
}
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
insertAtIndex,
|
|
3246
|
-
disableMerge: options?.disableMerge
|
|
3247
|
-
});
|
|
3248
|
-
attachSalesNoteDrafts(committedProduct);
|
|
2976
|
+
await this.finalizeProductOrderMutation(tempOrder);
|
|
2977
|
+
return tempOrder.products;
|
|
3249
2978
|
}
|
|
3250
|
-
} catch (error) {
|
|
3251
|
-
rollbackProductAndNotesMutation();
|
|
3252
|
-
throw error;
|
|
3253
2979
|
}
|
|
2980
|
+
const appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking, {
|
|
2981
|
+
insertAtIndex,
|
|
2982
|
+
disableMerge: options?.disableMerge
|
|
2983
|
+
});
|
|
2984
|
+
if (appendResult) await appendResult;
|
|
3254
2985
|
await this.finalizeProductOrderMutation(tempOrder);
|
|
3255
2986
|
this.logInfo('addProductToOrder success', {
|
|
3256
2987
|
product_id: product.product_id,
|
|
@@ -3695,12 +3426,10 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3695
3426
|
*/
|
|
3696
3427
|
async removeProductsFromOrder(identities, options) {
|
|
3697
3428
|
const tempOrder = this.ensureTempOrder();
|
|
3429
|
+
this.repairDuplicateProductLineIdentities(tempOrder);
|
|
3698
3430
|
if (!identities.length) {
|
|
3699
3431
|
return tempOrder.products;
|
|
3700
3432
|
}
|
|
3701
|
-
// 商品删除会同步删除以商品行为主关系的 Notes;快照不完整时禁止产生孤儿 Relation。
|
|
3702
|
-
this.ensureSalesNotesLoadedForMutation(tempOrder);
|
|
3703
|
-
this.repairDuplicateProductLineIdentities(tempOrder);
|
|
3704
3433
|
const productsBeforeRemove = tempOrder.products || [];
|
|
3705
3434
|
const bookingsBeforeRemove = tempOrder.bookings || [];
|
|
3706
3435
|
const preserveDisplayPosition = options?.preserveDisplayPosition;
|
|
@@ -3760,7 +3489,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3760
3489
|
tempOrder.products = nextProductIndex >= 0 ? [...productsWithoutRemaining.slice(0, nextProductIndex), remainingProduct, ...productsWithoutRemaining.slice(nextProductIndex)] : [...productsWithoutRemaining, remainingProduct];
|
|
3761
3490
|
}
|
|
3762
3491
|
}
|
|
3763
|
-
this.removeSalesNotesForMissingProductLines(tempOrder);
|
|
3764
3492
|
await this.finalizeAfterProductsMutation(tempOrder);
|
|
3765
3493
|
this.logInfo('removeProductsFromOrder success', {
|
|
3766
3494
|
identities
|
|
@@ -3773,14 +3501,12 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3773
3501
|
|
|
3774
3502
|
/**
|
|
3775
3503
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
3776
|
-
*
|
|
3504
|
+
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
3777
3505
|
*/
|
|
3778
3506
|
async clearOrderCartLines() {
|
|
3779
3507
|
const tempOrder = this.ensureTempOrder();
|
|
3780
|
-
this.ensureSalesNotesLoadedForMutation(tempOrder);
|
|
3781
3508
|
tempOrder.products = [];
|
|
3782
3509
|
tempOrder.bookings = [];
|
|
3783
|
-
this.removeSalesNotesForMissingProductLines(tempOrder);
|
|
3784
3510
|
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
3785
3511
|
if (tempOrder._extend && typeof tempOrder._extend === 'object') {
|
|
3786
3512
|
tempOrder._extend = {
|
|
@@ -3983,12 +3709,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
3983
3709
|
this.logSubmitBackendRejected(result, payload);
|
|
3984
3710
|
return result;
|
|
3985
3711
|
}
|
|
3986
|
-
const isLocalPendingSubmit = this.isLocalPendingSubmitResult(result);
|
|
3987
|
-
// need_sync=1 仅表示已进入本地同步队列,不能视为远端已确认 Notes。
|
|
3988
|
-
if (Object.prototype.hasOwnProperty.call(payload, 'notes') && !isLocalPendingSubmit) {
|
|
3989
|
-
const salesNotesState = this.ensureSalesNotesRuntimeState(tempOrder);
|
|
3990
|
-
salesNotesState.dirty = false;
|
|
3991
|
-
}
|
|
3992
3712
|
const submittedOrderId = this.extractOrderIdFromSubmitResult(result);
|
|
3993
3713
|
this.logInfo('runSubmitTempOrder: 提交成功', {
|
|
3994
3714
|
submittedOrderId,
|
|
@@ -4002,10 +3722,9 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4002
3722
|
tempOrder.order_id = submittedOrderId;
|
|
4003
3723
|
const resultRecord = result;
|
|
4004
3724
|
await this.markLocalOrderSynced(submittedOrderId, resultRecord?.data || resultRecord || {});
|
|
4005
|
-
}
|
|
4006
|
-
if (isLocalPendingSubmit) {
|
|
3725
|
+
} else if (this.isLocalPendingSubmitResult(result)) {
|
|
4007
3726
|
this.store.syncState = 'local';
|
|
4008
|
-
} else
|
|
3727
|
+
} else {
|
|
4009
3728
|
this.store.syncState = 'submitted';
|
|
4010
3729
|
}
|
|
4011
3730
|
return result;
|
|
@@ -4391,7 +4110,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4391
4110
|
params.forceRemote = false;
|
|
4392
4111
|
}
|
|
4393
4112
|
const res = await this.request.get(`/order/sales/${encodeURIComponent(lookup)}`, {
|
|
4394
|
-
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info', 'refunds'
|
|
4113
|
+
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info', 'refunds'],
|
|
4395
4114
|
...(params.forceRemote ? {
|
|
4396
4115
|
forceRemote: true
|
|
4397
4116
|
} : {})
|
|
@@ -4444,8 +4163,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4444
4163
|
const isMergedSalesDetailHydrate = options?.source === 'mergedSalesDetail';
|
|
4445
4164
|
const nextTempOrder = this.normalizeTempOrderForRuntime(raw, {
|
|
4446
4165
|
// merge 前已只给远端商品补标记;这里不能把本地未提交商品一并变成 saved item。
|
|
4447
|
-
makeEditMark: !isSessionStorageHydrate && !isMergedSalesDetailHydrate
|
|
4448
|
-
allowUnresolvedSalesNotes: isSessionStorageHydrate
|
|
4166
|
+
makeEditMark: !isSessionStorageHydrate && !isMergedSalesDetailHydrate
|
|
4449
4167
|
});
|
|
4450
4168
|
this.store.tempOrder = nextTempOrder;
|
|
4451
4169
|
if (isSessionStorageHydrate) {
|
|
@@ -4667,17 +4385,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4667
4385
|
nextTempOrder.payments = Array.isArray(raw.payments) ? raw.payments.map(p => ({
|
|
4668
4386
|
...(p || {})
|
|
4669
4387
|
})) : [];
|
|
4670
|
-
const rawHasSalesNotes = Object.prototype.hasOwnProperty.call(raw, 'notes');
|
|
4671
|
-
const restoredSalesNotesState = raw._extend?.salesNotesState;
|
|
4672
|
-
const allowUnresolvedSalesNotes = options?.allowUnresolvedSalesNotes === true || restoredSalesNotesState?.dirty === true || Number(raw.is_draft_order || 0) === 1;
|
|
4673
|
-
const decodedSalesNotes = rawHasSalesNotes ? (0, _salesNotes.decodeSalesNotesSnapshot)(raw.notes, {
|
|
4674
|
-
allowUnresolvedOrderTarget: allowUnresolvedSalesNotes
|
|
4675
|
-
}) : {
|
|
4676
|
-
notes: [],
|
|
4677
|
-
complete: false
|
|
4678
|
-
};
|
|
4679
|
-
const hasUnresolvedSalesNoteOrderTarget = decodedSalesNotes.notes.some(note => note.note_relations.some(relation => relation.is_primary === 0 && relation.relation_type === 'related_to' && relation.target_type === 'order' && relation.target_uuid === ''));
|
|
4680
|
-
nextTempOrder.notes = decodedSalesNotes.notes;
|
|
4681
4388
|
nextTempOrder.surcharges = Array.isArray(raw.surcharges) ? raw.surcharges.map(s => ({
|
|
4682
4389
|
...(s || {})
|
|
4683
4390
|
})) : [];
|
|
@@ -4697,10 +4404,6 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4697
4404
|
productsByUid: {}
|
|
4698
4405
|
};
|
|
4699
4406
|
const tempOrderExtend = nextTempOrder._extend;
|
|
4700
|
-
tempOrderExtend.salesNotesState = {
|
|
4701
|
-
loaded: rawHasSalesNotes ? decodedSalesNotes.complete : restoredSalesNotesState?.loaded === true,
|
|
4702
|
-
dirty: decodedSalesNotes.complete && (restoredSalesNotesState?.dirty === true || allowUnresolvedSalesNotes && hasUnresolvedSalesNoteOrderTarget)
|
|
4703
|
-
};
|
|
4704
4407
|
const productsByUid = tempOrderExtend.productsByUid || {};
|
|
4705
4408
|
for (const [index, product] of nextTempOrder.products.entries()) {
|
|
4706
4409
|
const uid = product.metadata?.unique_identification_number;
|
|
@@ -4875,7 +4578,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4875
4578
|
}
|
|
4876
4579
|
async getOrderInfo(order_id) {
|
|
4877
4580
|
const res = await this.request.get(`/order/sales/${order_id}`, {
|
|
4878
|
-
with: ['products', 'bookings'
|
|
4581
|
+
with: ['products', 'bookings']
|
|
4879
4582
|
}, {
|
|
4880
4583
|
osServer: true
|
|
4881
4584
|
});
|
|
@@ -8,13 +8,6 @@ import type { PaymentItem } from '../Payment/types';
|
|
|
8
8
|
import type { ICustomer } from '../AccountList/types';
|
|
9
9
|
import type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
10
10
|
export type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
11
|
-
export type PickupReferenceMode = 'counter_pickup' | 'table_service';
|
|
12
|
-
export type ShopServiceType = 'dine_in' | 'takeaway';
|
|
13
|
-
export interface ShopServiceData {
|
|
14
|
-
pickup_reference_mode?: PickupReferenceMode;
|
|
15
|
-
service_type?: ShopServiceType | '';
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
}
|
|
18
11
|
export declare enum OrderHooks {
|
|
19
12
|
OnOrderCreate = "order:onOrderCreate",
|
|
20
13
|
OnOrderUpdate = "order:onOrderUpdate",
|
|
@@ -245,72 +238,6 @@ export interface OrderSummary {
|
|
|
245
238
|
tax_title?: string;
|
|
246
239
|
tax_rate?: number;
|
|
247
240
|
}
|
|
248
|
-
export type SalesNoteRelationType = 'about' | 'related_to';
|
|
249
|
-
export type SalesNoteTargetType = 'order' | 'order_detail';
|
|
250
|
-
export type SalesNoteLocalizedText = string | Record<string, string>;
|
|
251
|
-
export interface SalesNoteLocalizedSelection {
|
|
252
|
-
id: string;
|
|
253
|
-
label: SalesNoteLocalizedText;
|
|
254
|
-
}
|
|
255
|
-
export type SalesNoteTextInput = {
|
|
256
|
-
kind: 'localizedSelections';
|
|
257
|
-
selections: SalesNoteLocalizedSelection[];
|
|
258
|
-
locale: string;
|
|
259
|
-
input?: string;
|
|
260
|
-
} | {
|
|
261
|
-
kind: 'plain';
|
|
262
|
-
input: string;
|
|
263
|
-
} | {
|
|
264
|
-
kind: 'resolved';
|
|
265
|
-
text: Record<string, string>;
|
|
266
|
-
};
|
|
267
|
-
export interface SalesNoteRelation {
|
|
268
|
-
uuid: string;
|
|
269
|
-
relation_type: SalesNoteRelationType;
|
|
270
|
-
target_type: SalesNoteTargetType;
|
|
271
|
-
target_uuid: string;
|
|
272
|
-
is_primary: 0 | 1;
|
|
273
|
-
}
|
|
274
|
-
export interface SalesNote {
|
|
275
|
-
uuid: string;
|
|
276
|
-
note_type: string;
|
|
277
|
-
content: {
|
|
278
|
-
text: Record<string, string>;
|
|
279
|
-
};
|
|
280
|
-
importance: string;
|
|
281
|
-
note_relations: SalesNoteRelation[];
|
|
282
|
-
}
|
|
283
|
-
export interface SalesNoteTarget {
|
|
284
|
-
target_type: 'order_detail';
|
|
285
|
-
target_uuid: string;
|
|
286
|
-
}
|
|
287
|
-
export interface SetSalesNoteInput {
|
|
288
|
-
note_type: string;
|
|
289
|
-
target: SalesNoteTarget;
|
|
290
|
-
text: SalesNoteTextInput;
|
|
291
|
-
}
|
|
292
|
-
export interface SalesNoteDraftInput {
|
|
293
|
-
note_type: string;
|
|
294
|
-
text: SalesNoteTextInput;
|
|
295
|
-
}
|
|
296
|
-
export interface SalesNotesRuntimeState {
|
|
297
|
-
loaded: boolean;
|
|
298
|
-
dirty: boolean;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Sales Notes 乐观写入前的可恢复快照。
|
|
302
|
-
* 该对象应视为 opaque token,只用于原样传回 restoreSalesNotesMutationSnapshot。
|
|
303
|
-
*/
|
|
304
|
-
export interface SalesNotesMutationSnapshot {
|
|
305
|
-
orderIdentity: {
|
|
306
|
-
orderId: number | string | null;
|
|
307
|
-
externalSaleNumber: string;
|
|
308
|
-
};
|
|
309
|
-
notes: SalesNote[];
|
|
310
|
-
state: SalesNotesRuntimeState;
|
|
311
|
-
}
|
|
312
|
-
export type SalesNoteProtocolRelation = SalesNoteRelation;
|
|
313
|
-
export type SalesNoteProtocol = SalesNote;
|
|
314
241
|
export interface OrderTempOrder {
|
|
315
242
|
order_id: number | null;
|
|
316
243
|
external_sale_number: string;
|
|
@@ -350,7 +277,6 @@ export interface OrderTempOrder {
|
|
|
350
277
|
created_at: string | undefined;
|
|
351
278
|
request_unique_idempotency_token?: string;
|
|
352
279
|
products: OrderProduct[];
|
|
353
|
-
notes: SalesNote[];
|
|
354
280
|
bookings: any[];
|
|
355
281
|
payments: any[];
|
|
356
282
|
surcharges: any[];
|
|
@@ -363,7 +289,6 @@ export interface OrderTempOrder {
|
|
|
363
289
|
summary?: OrderSummary;
|
|
364
290
|
_extend?: {
|
|
365
291
|
productsByUid?: Record<string, Record<string, any>>;
|
|
366
|
-
salesNotesState?: SalesNotesRuntimeState;
|
|
367
292
|
[key: string]: any;
|
|
368
293
|
};
|
|
369
294
|
}
|
|
@@ -372,7 +297,7 @@ export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identific
|
|
|
372
297
|
payment_price: string;
|
|
373
298
|
product_sku: OrderProductSku;
|
|
374
299
|
}
|
|
375
|
-
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '
|
|
300
|
+
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at'> {
|
|
376
301
|
platform: string;
|
|
377
302
|
created_at?: string | undefined;
|
|
378
303
|
request_unique_idempotency_token?: string;
|
|
@@ -381,7 +306,6 @@ export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'p
|
|
|
381
306
|
form_record_id: number | string;
|
|
382
307
|
}>;
|
|
383
308
|
products: OrderSubmitProduct[];
|
|
384
|
-
notes?: SalesNoteProtocol[];
|
|
385
309
|
summary?: OrderSummary;
|
|
386
310
|
small_ticket_data_flag?: number;
|
|
387
311
|
}
|
|
@@ -410,8 +334,6 @@ export interface AddProductToOrderOptions {
|
|
|
410
334
|
insertAfterProductUid?: string;
|
|
411
335
|
/** 跳过同商品/规格匹配,始终新增购物车行。 */
|
|
412
336
|
disableMerge?: boolean;
|
|
413
|
-
/** 商品行 UID 落定后,由 OrderModule 原子绑定到该行的 Sales Notes 草稿。 */
|
|
414
|
-
salesNotes?: SalesNoteDraftInput[];
|
|
415
337
|
}
|
|
416
338
|
/**
|
|
417
339
|
* 删除商品后的可选位置保持策略。
|
|
@@ -827,17 +749,9 @@ export interface OrderModuleAPI {
|
|
|
827
749
|
updateTempOrderShopDiscount: (amount: string | number) => string;
|
|
828
750
|
updateTempOrderDepositAmount: (amount: string | number) => OrderSummary;
|
|
829
751
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
830
|
-
updateTempOrderPickupReferenceMode: (mode: PickupReferenceMode) => ShopServiceData;
|
|
831
|
-
updateTempOrderServiceType: (serviceType: ShopServiceType) => ShopServiceData;
|
|
832
752
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
833
753
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
834
754
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
|
|
835
|
-
getSalesNotes: () => SalesNote[];
|
|
836
|
-
createSalesNotesMutationSnapshot: () => SalesNotesMutationSnapshot;
|
|
837
|
-
restoreSalesNotesMutationSnapshot: (snapshot: SalesNotesMutationSnapshot) => void;
|
|
838
|
-
setSalesNote: (input: SetSalesNoteInput) => Promise<SalesNote>;
|
|
839
|
-
removeSalesNote: (uuid: string) => Promise<void>;
|
|
840
|
-
clearSalesNotes: () => Promise<void>;
|
|
841
755
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
842
756
|
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
843
757
|
updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
|
|
@@ -985,10 +899,10 @@ export interface OrderModuleAPI {
|
|
|
985
899
|
/** 读取上次 applyPromotion 产出的赠品操作 diff(toAdd / toReduce / toRemove) */
|
|
986
900
|
getLastGiftActions: () => OrderLastGiftActions | null;
|
|
987
901
|
/**
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
902
|
+
* 取消订单
|
|
903
|
+
* @param params 取消订单参数
|
|
904
|
+
* @returns 后端返回结果
|
|
905
|
+
*/
|
|
992
906
|
cancelOrder: (params: CancelOrderParams) => Promise<any>;
|
|
993
907
|
/**
|
|
994
908
|
* 变更预约状态
|
|
@@ -59,10 +59,6 @@ let OrderHooks = exports.OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
59
59
|
* - `source`:缺省表示真实业务变更;`detailHydrate` 仅表示打开详情时快照已就绪
|
|
60
60
|
* 清空时整个 payload 为 null。
|
|
61
61
|
*/
|
|
62
|
-
/**
|
|
63
|
-
* Sales Notes 乐观写入前的可恢复快照。
|
|
64
|
-
* 该对象应视为 opaque token,只用于原样传回 restoreSalesNotesMutationSnapshot。
|
|
65
|
-
*/
|
|
66
62
|
/**
|
|
67
63
|
* 添加商品行时的顺序控制。
|
|
68
64
|
* 默认追加到 products 尾部;预约数量同步可插入到既有预约组的最新行之后,
|