@pisell/pisellos 2.2.248 → 2.2.249
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/server/index.d.ts +4 -0
- package/dist/server/index.js +370 -263
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +131 -71
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +5 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/lib/server/index.d.ts +4 -0
- package/lib/server/index.js +67 -4
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +60 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +5 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/package.json +1 -1
|
@@ -1183,6 +1183,55 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
return result;
|
|
1185
1185
|
}
|
|
1186
|
+
getPaymentMergeKey(payment) {
|
|
1187
|
+
var _a;
|
|
1188
|
+
const record = payment;
|
|
1189
|
+
if (!record)
|
|
1190
|
+
return "";
|
|
1191
|
+
const uniquePaymentNumber = (_a = record.metadata) == null ? void 0 : _a.unique_payment_number;
|
|
1192
|
+
if (!this.isBlankIdentityValue(uniquePaymentNumber)) {
|
|
1193
|
+
return `unique:${String(uniquePaymentNumber)}`;
|
|
1194
|
+
}
|
|
1195
|
+
const orderPaymentId = record.order_payment_id;
|
|
1196
|
+
if (!this.isBlankIdentityValue(orderPaymentId))
|
|
1197
|
+
return `order_payment:${String(orderPaymentId)}`;
|
|
1198
|
+
const code = record.code;
|
|
1199
|
+
const customPaymentId = record.custom_payment_id;
|
|
1200
|
+
if (!this.isBlankIdentityValue(code) && !this.isBlankIdentityValue(customPaymentId)) {
|
|
1201
|
+
return `custom:${String(code)}#${String(customPaymentId)}`;
|
|
1202
|
+
}
|
|
1203
|
+
return "";
|
|
1204
|
+
}
|
|
1205
|
+
mergeOrderPaymentLists(existing, incoming) {
|
|
1206
|
+
const existingList = Array.isArray(existing) ? existing : [];
|
|
1207
|
+
const incomingList = Array.isArray(incoming) ? incoming : [];
|
|
1208
|
+
if (incomingList.length === 0)
|
|
1209
|
+
return (0, import_lodash_es.cloneDeep)(existingList);
|
|
1210
|
+
if (existingList.length === 0)
|
|
1211
|
+
return (0, import_lodash_es.cloneDeep)(incomingList);
|
|
1212
|
+
const existingByKey = /* @__PURE__ */ new Map();
|
|
1213
|
+
for (const payment of existingList) {
|
|
1214
|
+
const key = this.getPaymentMergeKey(payment);
|
|
1215
|
+
if (!key)
|
|
1216
|
+
continue;
|
|
1217
|
+
existingByKey.set(key, payment);
|
|
1218
|
+
}
|
|
1219
|
+
return incomingList.map((payment) => {
|
|
1220
|
+
const incomingPayment = payment;
|
|
1221
|
+
const key = this.getPaymentMergeKey(incomingPayment);
|
|
1222
|
+
const existingPayment = key ? existingByKey.get(key) : void 0;
|
|
1223
|
+
if (!existingPayment)
|
|
1224
|
+
return (0, import_lodash_es.cloneDeep)(incomingPayment);
|
|
1225
|
+
return {
|
|
1226
|
+
...(0, import_lodash_es.cloneDeep)(existingPayment),
|
|
1227
|
+
...(0, import_lodash_es.cloneDeep)(incomingPayment),
|
|
1228
|
+
metadata: {
|
|
1229
|
+
...(0, import_lodash_es.cloneDeep)(existingPayment.metadata || {}),
|
|
1230
|
+
...(0, import_lodash_es.cloneDeep)(incomingPayment.metadata || {})
|
|
1231
|
+
}
|
|
1232
|
+
};
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1186
1235
|
mergeOrderRecords(existing, incoming, options) {
|
|
1187
1236
|
const preferred = this.pickPreferredOrder(existing, incoming);
|
|
1188
1237
|
const secondary = preferred === existing ? incoming : existing;
|
|
@@ -1204,7 +1253,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1204
1253
|
"updated_at",
|
|
1205
1254
|
"shop_discount",
|
|
1206
1255
|
"summary",
|
|
1207
|
-
"payments",
|
|
1208
1256
|
"products",
|
|
1209
1257
|
"bookings"
|
|
1210
1258
|
];
|
|
@@ -1212,6 +1260,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1212
1260
|
const preferredRecord = preferred;
|
|
1213
1261
|
const secondaryRecord = secondary;
|
|
1214
1262
|
const incomingRecord = incoming;
|
|
1263
|
+
const previousRecord = preferred === incoming ? secondaryRecord : preferredRecord;
|
|
1215
1264
|
for (const field of fieldsToPreserve) {
|
|
1216
1265
|
if (!this.isBlankIdentityValue(preferredRecord[field])) {
|
|
1217
1266
|
mergedRecord[field] = preferredRecord[field];
|
|
@@ -1233,6 +1282,16 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1233
1282
|
mergedRecord[field] = (0, import_lodash_es.cloneDeep)(incomingRecord[field]);
|
|
1234
1283
|
}
|
|
1235
1284
|
mergedRecord.products = shouldUseIncomingProductsSnapshot ? (0, import_lodash_es.cloneDeep)(incomingRecord.products) : this.mergeOrderProductLists(preferredRecord.products, secondaryRecord.products);
|
|
1285
|
+
if (Object.prototype.hasOwnProperty.call(incomingRecord, "payments")) {
|
|
1286
|
+
if (Array.isArray(incomingRecord.payments)) {
|
|
1287
|
+
mergedRecord.payments = this.mergeOrderPaymentLists(
|
|
1288
|
+
previousRecord.payments,
|
|
1289
|
+
incomingRecord.payments
|
|
1290
|
+
);
|
|
1291
|
+
} else if (incomingRecord.payments !== void 0 && incomingRecord.payments !== null) {
|
|
1292
|
+
mergedRecord.payments = (0, import_lodash_es.cloneDeep)(incomingRecord.payments);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1236
1295
|
if (!this.isPendingSyncOrder(preferred) || !this.isPendingSyncOrder(secondary)) {
|
|
1237
1296
|
merged.need_sync = 0;
|
|
1238
1297
|
}
|
|
@@ -207,6 +207,10 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
207
207
|
if (uniqueIdentificationNumber) {
|
|
208
208
|
metadata.unique_identification_number = String(uniqueIdentificationNumber);
|
|
209
209
|
}
|
|
210
|
+
const productTitle = {
|
|
211
|
+
...(sourceProduct == null ? void 0 : sourceProduct.title_i18n) || {},
|
|
212
|
+
original: (sourceProduct == null ? void 0 : sourceProduct.title) || ""
|
|
213
|
+
};
|
|
210
214
|
return {
|
|
211
215
|
product_id: productId,
|
|
212
216
|
product_variant_id: productVariantId,
|
|
@@ -231,6 +235,7 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
231
235
|
),
|
|
232
236
|
metadata,
|
|
233
237
|
note: payload.note != null ? String(payload.note) : "",
|
|
238
|
+
product_title: productTitle,
|
|
234
239
|
_origin: {
|
|
235
240
|
...sourceProduct || {},
|
|
236
241
|
callbackData: payload
|
|
@@ -441,19 +441,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
441
441
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
442
442
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
443
443
|
*/
|
|
444
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
445
|
-
action: "reloadCatalog";
|
|
446
|
-
} | {
|
|
447
|
-
action: "add";
|
|
448
|
-
cacheItem: any;
|
|
449
|
-
} | {
|
|
450
|
-
action: "requiresDetail";
|
|
451
|
-
payload: AddProductRequiresDetailPayload;
|
|
452
|
-
} | {
|
|
453
|
-
action: "requiresBookingEdit";
|
|
454
|
-
cacheItem: any;
|
|
455
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
456
|
-
};
|
|
444
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
457
445
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
458
446
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
459
447
|
/**
|