@pisell/pisellos 2.1.134 → 2.1.135
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/Cart/utils/cartProduct.js +1 -1
- package/dist/modules/Order/utils.js +15 -12
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/utils.js +5 -5
- package/lib/modules/Cart/utils/cartProduct.js +1 -1
- package/lib/modules/Order/utils.js +1 -12
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/utils.js +2 -2
- package/package.json +1 -1
|
@@ -350,7 +350,7 @@ export var formatBundleToOrigin = function formatBundleToOrigin(bundle) {
|
|
|
350
350
|
option: formatOptionsToOrigin(getBundleValueByKey('option')),
|
|
351
351
|
discount_list: d.discount_list,
|
|
352
352
|
"bundle_selling_price": d === null || d === void 0 ? void 0 : d.price,
|
|
353
|
-
"custom_price": d
|
|
353
|
+
// "custom_price": d?.price,
|
|
354
354
|
metadata: {
|
|
355
355
|
custom_product_bundle_map_id: d._id,
|
|
356
356
|
product_discount_difference: product_discount_difference
|
|
@@ -334,13 +334,16 @@ function toBundleCustomPriceString(value) {
|
|
|
334
334
|
function formatSubmitBundleItems(bundle) {
|
|
335
335
|
if (!Array.isArray(bundle)) return [];
|
|
336
336
|
return bundle.map(function (b) {
|
|
337
|
-
var _rawBundle$bundle_sel, _rawBundle$price_type,
|
|
337
|
+
var _rawBundle$bundle_sel, _rawBundle$price_type, _rawBundle$surcharge_, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$extension_, _rawBundle$extension_2, _rawBundle$price_type2, _ref5, _rawBundle$custom_pri;
|
|
338
338
|
var rawBundle = b && _typeof(b) === 'object' ? b : {};
|
|
339
339
|
var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
|
|
340
340
|
var sellingPriceNum = toBundleNumber((_rawBundle$bundle_sel = rawBundle.bundle_selling_price) !== null && _rawBundle$bundle_sel !== void 0 ? _rawBundle$bundle_sel : rawBundle.price, 0);
|
|
341
341
|
var priceNum = toBundleNumber(rawBundle.price, sellingPriceNum);
|
|
342
342
|
var priceType = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : '';
|
|
343
|
-
|
|
343
|
+
// const customPriceStr = toBundleCustomPriceString(
|
|
344
|
+
// rawBundle.custom_price ?? rawBundle.bundle_selling_price ?? rawBundle.price,
|
|
345
|
+
// );
|
|
346
|
+
|
|
344
347
|
var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
|
|
345
348
|
var surchargeFee = toBundleNumber((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee, 0);
|
|
346
349
|
var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
|
|
@@ -354,8 +357,8 @@ function formatSubmitBundleItems(bundle) {
|
|
|
354
357
|
price: priceNum,
|
|
355
358
|
price_type: priceType,
|
|
356
359
|
price_type_ext: (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : '',
|
|
357
|
-
custom_price: customPriceStr,
|
|
358
|
-
custom_price_type: (
|
|
360
|
+
// custom_price: customPriceStr,
|
|
361
|
+
custom_price_type: (_ref5 = (_rawBundle$custom_pri = rawBundle.custom_price_type) !== null && _rawBundle$custom_pri !== void 0 ? _rawBundle$custom_pri : priceType) !== null && _ref5 !== void 0 ? _ref5 : '',
|
|
359
362
|
bundle_selling_price: sellingPriceNum,
|
|
360
363
|
option: formatSubmitOptionItems(rawBundle.option),
|
|
361
364
|
bundle_group_id: rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.group_id,
|
|
@@ -517,7 +520,7 @@ export function createDefaultTempOrder(params) {
|
|
|
517
520
|
};
|
|
518
521
|
}
|
|
519
522
|
export function buildSubmitPayload(params) {
|
|
520
|
-
var _ref7, _ref8,
|
|
523
|
+
var _ref6, _ref7, _ref8, _tempOrder$is_price_i, _tempOrder$is_deposit;
|
|
521
524
|
var tempOrder = params.tempOrder,
|
|
522
525
|
cacheId = params.cacheId,
|
|
523
526
|
_params$now = params.now,
|
|
@@ -565,10 +568,10 @@ export function buildSubmitPayload(params) {
|
|
|
565
568
|
var payload = _objectSpread(_objectSpread({}, tempOrderRest), {}, {
|
|
566
569
|
platform: normalizeSubmitPlatform(platform !== null && platform !== void 0 ? platform : tempOrder.platform),
|
|
567
570
|
request_unique_idempotency_token: cacheId,
|
|
568
|
-
type: (
|
|
569
|
-
business_code: (
|
|
571
|
+
type: (_ref6 = type !== null && type !== void 0 ? type : tempOrder.type) !== null && _ref6 !== void 0 ? _ref6 : 'table-order',
|
|
572
|
+
business_code: (_ref7 = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code) !== null && _ref7 !== void 0 ? _ref7 : 'table-order',
|
|
570
573
|
sales_channel: tempOrder.sales_channel || 'my_pisel',
|
|
571
|
-
order_sales_channel: (
|
|
574
|
+
order_sales_channel: (_ref8 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref8 !== void 0 ? _ref8 : 'online_store',
|
|
572
575
|
status: tempOrder.status || 'normal',
|
|
573
576
|
payment_status: tempOrder.payment_status || 'payment_processing',
|
|
574
577
|
// shipping_status: tempOrder.shipping_status || 'unfulfilled',
|
|
@@ -592,10 +595,10 @@ export function buildSubmitPayload(params) {
|
|
|
592
595
|
// holder: tempOrder.holder || null,
|
|
593
596
|
// summary,
|
|
594
597
|
metadata: function () {
|
|
595
|
-
var
|
|
596
|
-
_collectPax =
|
|
597
|
-
_tableOccupancyDuration =
|
|
598
|
-
rest = _objectWithoutProperties(
|
|
598
|
+
var _ref9 = tempOrder.metadata || {},
|
|
599
|
+
_collectPax = _ref9.collect_pax,
|
|
600
|
+
_tableOccupancyDuration = _ref9.table_occupancy_duration,
|
|
601
|
+
rest = _objectWithoutProperties(_ref9, _excluded3);
|
|
599
602
|
return _objectSpread({}, rest);
|
|
600
603
|
}(),
|
|
601
604
|
products: (tempOrder.products || []).map(function (product) {
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
357
357
|
};
|
|
358
358
|
setOtherData(key: string, value: any): void;
|
|
359
359
|
getOtherData(key: string): any;
|
|
360
|
-
getProductTypeById(id: number): Promise<"
|
|
360
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
361
361
|
/**
|
|
362
362
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
363
363
|
*
|
|
@@ -483,10 +483,10 @@ export function normalizeOrderProduct(product) {
|
|
|
483
483
|
metadata.unique_identification_number = resolvedIdentityKey;
|
|
484
484
|
}
|
|
485
485
|
var normalizedBundle = (product.product_bundle || []).map(function (item) {
|
|
486
|
-
var _ref2, _item$bundle_selling_
|
|
486
|
+
var _ref2, _item$bundle_selling_;
|
|
487
487
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
488
|
-
bundle_selling_price: (_ref2 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00'
|
|
489
|
-
custom_price:
|
|
488
|
+
bundle_selling_price: (_ref2 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00'
|
|
489
|
+
// custom_price: item.custom_price ?? item.bundle_selling_price ?? item.price ?? '0.00',
|
|
490
490
|
});
|
|
491
491
|
});
|
|
492
492
|
var normalizedOptions = product.product_option_item || [];
|
|
@@ -506,7 +506,7 @@ export function normalizeOrderProduct(product) {
|
|
|
506
506
|
var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
|
|
507
507
|
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
508
508
|
})) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
|
|
509
|
-
var resolvedSource = function (_product$_origin, _product$_origin2,
|
|
509
|
+
var resolvedSource = function (_product$_origin, _product$_origin2, _ref3, _product$original_pri) {
|
|
510
510
|
if (metadata.source_product_price !== undefined) {
|
|
511
511
|
return String(metadata.source_product_price);
|
|
512
512
|
}
|
|
@@ -524,7 +524,7 @@ export function normalizeOrderProduct(product) {
|
|
|
524
524
|
if (!isV2 && metadata.main_product_original_price !== undefined) {
|
|
525
525
|
return String(metadata.main_product_original_price);
|
|
526
526
|
}
|
|
527
|
-
return (
|
|
527
|
+
return (_ref3 = (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product.selling_price) !== null && _ref3 !== void 0 ? _ref3 : '0.00';
|
|
528
528
|
}();
|
|
529
529
|
|
|
530
530
|
// 2) 派生 main_product_original_price(含 option、不含折扣)
|
|
@@ -313,7 +313,7 @@ var formatBundleToOrigin = (bundle) => {
|
|
|
313
313
|
option: formatOptionsToOrigin(getBundleValueByKey("option")),
|
|
314
314
|
discount_list: d.discount_list,
|
|
315
315
|
"bundle_selling_price": d == null ? void 0 : d.price,
|
|
316
|
-
"custom_price": d
|
|
316
|
+
// "custom_price": d?.price,
|
|
317
317
|
metadata: {
|
|
318
318
|
custom_product_bundle_map_id: d._id,
|
|
319
319
|
product_discount_difference
|
|
@@ -246,14 +246,6 @@ function toBundleNumber(value, fallback = 0) {
|
|
|
246
246
|
const parsed = Number(value);
|
|
247
247
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
248
248
|
}
|
|
249
|
-
function toBundleCustomPriceString(value) {
|
|
250
|
-
const parsed = Number(value);
|
|
251
|
-
if (Number.isFinite(parsed))
|
|
252
|
-
return parsed.toFixed(2);
|
|
253
|
-
if (value === null || value === void 0 || value === "")
|
|
254
|
-
return "0.00";
|
|
255
|
-
return String(value);
|
|
256
|
-
}
|
|
257
249
|
function formatSubmitBundleItems(bundle) {
|
|
258
250
|
if (!Array.isArray(bundle))
|
|
259
251
|
return [];
|
|
@@ -266,9 +258,6 @@ function formatSubmitBundleItems(bundle) {
|
|
|
266
258
|
);
|
|
267
259
|
const priceNum = toBundleNumber(rawBundle.price, sellingPriceNum);
|
|
268
260
|
const priceType = rawBundle.price_type ?? "";
|
|
269
|
-
const customPriceStr = toBundleCustomPriceString(
|
|
270
|
-
rawBundle.custom_price ?? rawBundle.bundle_selling_price ?? rawBundle.price
|
|
271
|
-
);
|
|
272
261
|
const relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
|
|
273
262
|
const surchargeFee = toBundleNumber(
|
|
274
263
|
rawBundle.surcharge_fee ?? existedMetadata.surcharge_fee,
|
|
@@ -289,7 +278,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
289
278
|
price: priceNum,
|
|
290
279
|
price_type: priceType,
|
|
291
280
|
price_type_ext: rawBundle.price_type_ext ?? "",
|
|
292
|
-
custom_price: customPriceStr,
|
|
281
|
+
// custom_price: customPriceStr,
|
|
293
282
|
custom_price_type: rawBundle.custom_price_type ?? priceType ?? "",
|
|
294
283
|
bundle_selling_price: sellingPriceNum,
|
|
295
284
|
option: formatSubmitOptionItems(rawBundle.option),
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
357
357
|
};
|
|
358
358
|
setOtherData(key: string, value: any): void;
|
|
359
359
|
getOtherData(key: string): any;
|
|
360
|
-
getProductTypeById(id: number): Promise<"
|
|
360
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
361
361
|
/**
|
|
362
362
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
363
363
|
*
|
|
@@ -408,8 +408,8 @@ function normalizeOrderProduct(product) {
|
|
|
408
408
|
}
|
|
409
409
|
const normalizedBundle = (product.product_bundle || []).map((item) => ({
|
|
410
410
|
...item,
|
|
411
|
-
bundle_selling_price: item.bundle_selling_price ?? item.price ?? "0.00"
|
|
412
|
-
custom_price: item.custom_price ?? item.bundle_selling_price ?? item.price ??
|
|
411
|
+
bundle_selling_price: item.bundle_selling_price ?? item.price ?? "0.00"
|
|
412
|
+
// custom_price: item.custom_price ?? item.bundle_selling_price ?? item.price ?? '0.00',
|
|
413
413
|
}));
|
|
414
414
|
const normalizedOptions = product.product_option_item || [];
|
|
415
415
|
const optionSum = (0, import_utils.sumOptionUnitPrice)(normalizedOptions);
|