@pisell/pisellos 2.2.254 → 2.2.256
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/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +9 -1
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +2 -0
- package/dist/server/index.js +1 -0
- package/dist/server/modules/order/index.d.ts +4 -4
- package/dist/server/modules/order/index.js +4 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +8 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +2 -0
- package/lib/server/modules/order/index.d.ts +4 -4
- package/lib/server/modules/order/index.js +4 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -125,6 +125,13 @@ function resolveProductTitle(product, booking, sourceProduct) {
|
|
|
125
125
|
var metadata = product.metadata || {};
|
|
126
126
|
return (_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_title = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title !== void 0 ? _title : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.name) !== null && _ref5 !== void 0 ? _ref5 : metadata.product_title) !== null && _ref4 !== void 0 ? _ref4 : metadata.product_name) !== null && _ref3 !== void 0 ? _ref3 : booking === null || booking === void 0 || (_booking$product = booking.product) === null || _booking$product === void 0 ? void 0 : _booking$product.title) !== null && _ref2 !== void 0 ? _ref2 : booking === null || booking === void 0 || (_booking$detail = booking.detail) === null || _booking$detail === void 0 ? void 0 : _booking$detail.product_title) !== null && _ref !== void 0 ? _ref : '';
|
|
127
127
|
}
|
|
128
|
+
function resolveMainProductPrice(product, fallback) {
|
|
129
|
+
var _metadata$main_produc;
|
|
130
|
+
var metadata = product.metadata || {};
|
|
131
|
+
var value = (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : metadata.source_product_price;
|
|
132
|
+
var parsed = Number(value);
|
|
133
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
134
|
+
}
|
|
128
135
|
|
|
129
136
|
/**
|
|
130
137
|
* catalog 缺 product_resource 时,从 booking.resources 反推最小 product_resource 结构,
|
|
@@ -182,6 +189,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
182
189
|
var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
|
|
183
190
|
var selling = Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
184
191
|
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
192
|
+
var mainProductPrice = resolveMainProductPrice(product, selling);
|
|
185
193
|
var startDate = safeFormat(booking.start_date, 'YYYY-MM-DD');
|
|
186
194
|
var endDate = safeFormat(booking.end_date, 'YYYY-MM-DD');
|
|
187
195
|
var startTime = normalizeTimeString(booking.start_time);
|
|
@@ -208,7 +216,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
208
216
|
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
|
|
209
217
|
product_name: productTitle,
|
|
210
218
|
note: (_ref8 = (_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 && _ref8 !== void 0 ? _ref8 : '',
|
|
211
|
-
price:
|
|
219
|
+
price: mainProductPrice,
|
|
212
220
|
total: selling,
|
|
213
221
|
origin_total: original,
|
|
214
222
|
resource: resource,
|
|
@@ -431,7 +431,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
431
431
|
generateIdempotencyToken(): string;
|
|
432
432
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
433
433
|
createOrder(params: CommitOrderParams['query']): {
|
|
434
|
-
type: "
|
|
434
|
+
type: "appointment_booking" | "virtual";
|
|
435
435
|
platform: string;
|
|
436
436
|
sales_channel: string;
|
|
437
437
|
order_sales_channel: string;
|
|
@@ -5385,6 +5385,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5385
5385
|
_context43.next = 2;
|
|
5386
5386
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
5387
5387
|
with: ['products', 'bookings']
|
|
5388
|
+
}, {
|
|
5389
|
+
osServer: true
|
|
5388
5390
|
});
|
|
5389
5391
|
case 2:
|
|
5390
5392
|
res = _context43.sent;
|
package/dist/server/index.js
CHANGED
|
@@ -4022,6 +4022,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4022
4022
|
shop_order_number: next.shop_order_number,
|
|
4023
4023
|
shop_full_order_number: next.shop_full_order_number
|
|
4024
4024
|
});
|
|
4025
|
+
// 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
|
|
4025
4026
|
return _context42.abrupt("return", next);
|
|
4026
4027
|
case 28:
|
|
4027
4028
|
_context42.prev = 28;
|
|
@@ -32,10 +32,10 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
32
32
|
private emitOrdersChanged;
|
|
33
33
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
* 记录信息日志
|
|
36
|
+
* @param title 日志标题
|
|
37
|
+
* @param metadata 日志元数据
|
|
38
|
+
*/
|
|
39
39
|
private logInfo;
|
|
40
40
|
/**
|
|
41
41
|
* 记录错误日志
|
|
@@ -172,10 +172,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
172
172
|
return initialize;
|
|
173
173
|
}()
|
|
174
174
|
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
* 记录信息日志
|
|
176
|
+
* @param title 日志标题
|
|
177
|
+
* @param metadata 日志元数据
|
|
178
|
+
*/
|
|
179
179
|
}, {
|
|
180
180
|
key: "logInfo",
|
|
181
181
|
value: function logInfo(title, metadata) {
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 2 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -136,6 +136,12 @@ function resolveProductTitle(product, booking, sourceProduct) {
|
|
|
136
136
|
const metadata = product.metadata || {};
|
|
137
137
|
return (sourceProduct == null ? void 0 : sourceProduct.title) ?? (sourceProduct == null ? void 0 : sourceProduct.name) ?? metadata.product_title ?? metadata.product_name ?? ((_a = booking == null ? void 0 : booking.product) == null ? void 0 : _a.title) ?? ((_b = booking == null ? void 0 : booking.detail) == null ? void 0 : _b.product_title) ?? "";
|
|
138
138
|
}
|
|
139
|
+
function resolveMainProductPrice(product, fallback) {
|
|
140
|
+
const metadata = product.metadata || {};
|
|
141
|
+
const value = metadata.main_product_original_price ?? metadata.source_product_price;
|
|
142
|
+
const parsed = Number(value);
|
|
143
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
144
|
+
}
|
|
139
145
|
function synthesizeProductResourceFromBooking(booking) {
|
|
140
146
|
const rows = booking == null ? void 0 : booking.resources;
|
|
141
147
|
if (!Array.isArray(rows) || rows.length === 0)
|
|
@@ -172,6 +178,7 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
172
178
|
const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
|
|
173
179
|
const selling = Number(product.selling_price ?? 0);
|
|
174
180
|
const original = Number(product.original_price ?? selling);
|
|
181
|
+
const mainProductPrice = resolveMainProductPrice(product, selling);
|
|
175
182
|
const startDate = safeFormat(booking.start_date, "YYYY-MM-DD");
|
|
176
183
|
const endDate = safeFormat(booking.end_date, "YYYY-MM-DD");
|
|
177
184
|
const startTime = normalizeTimeString(booking.start_time);
|
|
@@ -198,7 +205,7 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
198
205
|
quantity: product.num ?? 1,
|
|
199
206
|
product_name: productTitle,
|
|
200
207
|
note: product.note ?? ((_b = booking == null ? void 0 : booking.detail) == null ? void 0 : _b.note) ?? "",
|
|
201
|
-
price:
|
|
208
|
+
price: mainProductPrice,
|
|
202
209
|
total: selling,
|
|
203
210
|
origin_total: original,
|
|
204
211
|
resource,
|
|
@@ -431,7 +431,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
431
431
|
generateIdempotencyToken(): string;
|
|
432
432
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
433
433
|
createOrder(params: CommitOrderParams['query']): {
|
|
434
|
-
type: "
|
|
434
|
+
type: "appointment_booking" | "virtual";
|
|
435
435
|
platform: string;
|
|
436
436
|
sales_channel: string;
|
|
437
437
|
order_sales_channel: string;
|
|
@@ -3892,6 +3892,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3892
3892
|
async getOrderInfo(order_id) {
|
|
3893
3893
|
const res = await this.request.get(`/order/sales/${order_id}`, {
|
|
3894
3894
|
with: ["products", "bookings"]
|
|
3895
|
+
}, {
|
|
3896
|
+
osServer: true
|
|
3895
3897
|
});
|
|
3896
3898
|
return res;
|
|
3897
3899
|
}
|
|
@@ -32,10 +32,10 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
32
32
|
private emitOrdersChanged;
|
|
33
33
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
* 记录信息日志
|
|
36
|
+
* @param title 日志标题
|
|
37
|
+
* @param metadata 日志元数据
|
|
38
|
+
*/
|
|
39
39
|
private logInfo;
|
|
40
40
|
/**
|
|
41
41
|
* 记录错误日志
|
|
@@ -110,10 +110,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
* 记录信息日志
|
|
114
|
+
* @param title 日志标题
|
|
115
|
+
* @param metadata 日志元数据
|
|
116
|
+
*/
|
|
117
117
|
logInfo(title, metadata) {
|
|
118
118
|
try {
|
|
119
119
|
if (this.logger) {
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 2 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|