@pisell/pisellos 2.2.198 → 2.2.200
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/buildNormalProductCacheItemFromOrderLine.js +7 -3
- package/dist/modules/Cart/utils/cartProduct.js +11 -1
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Order/index.js +155 -104
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Order/utils.d.ts +33 -2
- package/dist/modules/Order/utils.js +112 -55
- package/dist/modules/SalesSummary/utils.js +97 -63
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +294 -190
- package/dist/server/modules/order/index.d.ts +8 -0
- package/dist/server/modules/order/index.js +536 -317
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +2 -1
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +19 -4
- package/dist/solution/BookingTicket/index.d.ts +23 -0
- package/dist/solution/BookingTicket/index.js +291 -196
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
- package/dist/solution/ScanOrder/types.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +26 -9
- package/dist/solution/VenueBooking/index.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +4 -1
- package/lib/modules/Cart/utils/cartProduct.js +11 -1
- package/lib/modules/Cart/utils/changePrice.js +12 -20
- package/lib/modules/Order/index.js +58 -6
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Order/utils.d.ts +33 -2
- package/lib/modules/Order/utils.js +44 -9
- package/lib/modules/SalesSummary/utils.js +41 -44
- package/lib/server/index.d.ts +3 -0
- package/lib/server/index.js +82 -3
- package/lib/server/modules/order/index.d.ts +8 -0
- package/lib/server/modules/order/index.js +106 -4
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +2 -1
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -1
- package/lib/solution/BookingTicket/index.d.ts +23 -0
- package/lib/solution/BookingTicket/index.js +60 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
- package/lib/solution/ScanOrder/types.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +28 -10
- package/lib/solution/VenueBooking/index.js +2 -1
- package/package.json +1 -1
|
@@ -393,6 +393,8 @@ export interface OrderData {
|
|
|
393
393
|
/** 本地辅助字段 */
|
|
394
394
|
shop_id?: number;
|
|
395
395
|
create_date?: string;
|
|
396
|
+
/** 本地待同步标记:1 表示需要后续同步到云端 */
|
|
397
|
+
need_sync?: 0 | 1 | number;
|
|
396
398
|
/** 兼容:部分场景仍使用顶层 total_amount */
|
|
397
399
|
total_amount?: OrderMoneyString | number;
|
|
398
400
|
/** 扩展字段(物流、标签等);使用 any 以便筛选与数据源扩展 */
|
|
@@ -2033,7 +2033,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2033
2033
|
var products = tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.filter(function (n) {
|
|
2034
2034
|
return n.product_id;
|
|
2035
2035
|
});
|
|
2036
|
-
|
|
2036
|
+
var walletProducts = products.map(function (product) {
|
|
2037
2037
|
var _product$product_vari2, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
|
|
2038
2038
|
var metadata = product.metadata || {};
|
|
2039
2039
|
return {
|
|
@@ -2079,6 +2079,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2079
2079
|
})
|
|
2080
2080
|
};
|
|
2081
2081
|
});
|
|
2082
|
+
return walletProducts;
|
|
2082
2083
|
}
|
|
2083
2084
|
}, {
|
|
2084
2085
|
key: "initWalletData",
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import { composeLinePrice, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
|
|
7
|
+
import { composeLinePrice, getBundleSellingMagnitude, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
|
|
8
8
|
import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
|
|
9
9
|
function toNumber(value) {
|
|
10
10
|
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -49,18 +49,33 @@ function normalizeBundleItems(bundleItems) {
|
|
|
49
49
|
var preferPriceField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
50
50
|
if (!Array.isArray(bundleItems)) return [];
|
|
51
51
|
return bundleItems.map(function (bundleItem) {
|
|
52
|
-
var _ref2, _ref3, _ref4, _bundleItem$price, _ref5, _ref6, _ref7, _bundleItem$bundle_se, _bundleItem$num, _bundleItem$quantity, _bundleItem$
|
|
52
|
+
var _ref2, _ref3, _ref4, _bundleItem$price, _ref5, _ref6, _ref7, _bundleItem$bundle_se, _bundleItem$num, _bundleItem$price2, _bundleItem$quantity, _bundleItem$price3, _ref8, _ref9, _bundleItem$original_, _normalizedItem$price;
|
|
53
53
|
var unitSelling = preferPriceField ? (_ref2 = (_ref3 = (_ref4 = (_bundleItem$price = bundleItem.price) !== null && _bundleItem$price !== void 0 ? _bundleItem$price : bundleItem.bundle_selling_price) !== null && _ref4 !== void 0 ? _ref4 : bundleItem.custom_price) !== null && _ref3 !== void 0 ? _ref3 : bundleItem.product_price) !== null && _ref2 !== void 0 ? _ref2 : '0' : (_ref5 = (_ref6 = (_ref7 = (_bundleItem$bundle_se = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se !== void 0 ? _bundleItem$bundle_se : bundleItem.price) !== null && _ref7 !== void 0 ? _ref7 : bundleItem.custom_price) !== null && _ref6 !== void 0 ? _ref6 : bundleItem.product_price) !== null && _ref5 !== void 0 ? _ref5 : '0';
|
|
54
54
|
var unitStr = toPriceString(unitSelling, '0.00');
|
|
55
55
|
var num = toSafePositiveInt((_bundleItem$num = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.num) !== null && _bundleItem$num !== void 0 ? _bundleItem$num : bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity, 1);
|
|
56
|
-
|
|
56
|
+
var magnitudeSource = _objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
57
|
+
option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option),
|
|
58
|
+
bundle_selling_price: unitStr,
|
|
59
|
+
// 计算 markdown 净额时,只传真实毛价;仅有 bundle_selling_price 时按历史净额兜底。
|
|
60
|
+
price: (_bundleItem$price2 = bundleItem.price) !== null && _bundleItem$price2 !== void 0 ? _bundleItem$price2 : bundleItem.custom_price
|
|
61
|
+
});
|
|
62
|
+
var normalizedItem = _objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
57
63
|
num: num,
|
|
58
64
|
quantity: (_bundleItem$quantity = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity) !== null && _bundleItem$quantity !== void 0 ? _bundleItem$quantity : num,
|
|
59
|
-
|
|
65
|
+
// price 保留毛价(markdown 仍为正),由 price_type 决定符号。
|
|
66
|
+
price: (_bundleItem$price3 = bundleItem.price) !== null && _bundleItem$price3 !== void 0 ? _bundleItem$price3 : unitStr,
|
|
60
67
|
bundle_selling_price: unitStr,
|
|
61
68
|
original_price: (_ref8 = (_ref9 = (_bundleItem$original_ = bundleItem.original_price) !== null && _bundleItem$original_ !== void 0 ? _bundleItem$original_ : bundleItem.product_price) !== null && _ref9 !== void 0 ? _ref9 : bundleItem.price) !== null && _ref8 !== void 0 ? _ref8 : unitStr,
|
|
62
69
|
option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option)
|
|
63
70
|
});
|
|
71
|
+
// bundle_selling_price 落「正净额」:markdown = |price| − Σoptions;markup/原价维持原值。
|
|
72
|
+
normalizedItem.bundle_selling_price = getBundleSellingMagnitude(magnitudeSource).toFixed(2);
|
|
73
|
+
if (((_normalizedItem$price = normalizedItem.price_type) !== null && _normalizedItem$price !== void 0 ? _normalizedItem$price : normalizedItem.custom_price_type) === 'markdown' && (normalizedItem.price_type_ext === '' || normalizedItem.price_type_ext === undefined || normalizedItem.price_type_ext === null)) {
|
|
74
|
+
var _normalizedItem$custo;
|
|
75
|
+
normalizedItem.custom_price = (_normalizedItem$custo = normalizedItem.custom_price) !== null && _normalizedItem$custo !== void 0 ? _normalizedItem$custo : normalizedItem.price;
|
|
76
|
+
normalizedItem.price = normalizedItem.bundle_selling_price;
|
|
77
|
+
}
|
|
78
|
+
return normalizedItem;
|
|
64
79
|
});
|
|
65
80
|
}
|
|
66
81
|
function findVariantById(origin, variantId) {
|
|
@@ -12,6 +12,8 @@ import { AddProductDecideContext, AddProductRequiresDetailPayload } from './util
|
|
|
12
12
|
import { type BuildCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildCacheItemFromOrderLine';
|
|
13
13
|
import { type BuildNormalProductCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine';
|
|
14
14
|
import type { AddProductBookingInput, OrderProduct, OrderProductIdentity, UpdateOrderProductParams } from '../../modules/Order/types';
|
|
15
|
+
import { type TransitionChildBookingParams } from './utils/bookingStatus';
|
|
16
|
+
export type { BookingTransitionAction, TransitionChildBookingParams, } from './utils/bookingStatus';
|
|
15
17
|
export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
16
18
|
protected defaultName: string;
|
|
17
19
|
protected defaultVersion: string;
|
|
@@ -68,6 +70,27 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
68
70
|
* @returns 接口返回的 data
|
|
69
71
|
*/
|
|
70
72
|
setBookingStatus(status: string): Promise<any>;
|
|
73
|
+
/**
|
|
74
|
+
* 子预约状态机转移(POST /schedule/booking-transition/{schedule_event_id})。
|
|
75
|
+
*
|
|
76
|
+
* 与 `setBookingStatus`(父预约 PUT appointment-status)不同,本方法按子预约
|
|
77
|
+
* `schedule_event_id` 调用状态转移接口,body 为 `{ action }`。
|
|
78
|
+
*
|
|
79
|
+
* 流程:能解析出目标状态时先乐观更新对应子预约的 `appointment_status`,
|
|
80
|
+
* 再调 POST;成功后强制刷新销售详情;失败则回滚该子预约本地状态并抛错。
|
|
81
|
+
* `reschedule` 暂未启用状态矩阵,跳过乐观更新仅调接口。
|
|
82
|
+
*
|
|
83
|
+
* @param params.schedule_event_id 子预约 schedule_event_id
|
|
84
|
+
* @param params.action 转移动作:confirm | reject | arrive | start | complete | cancel | no_show | reschedule
|
|
85
|
+
* @returns 接口返回的 data
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* await bookingTicket.transitionChildBooking({
|
|
89
|
+
* schedule_event_id: 301,
|
|
90
|
+
* action: 'confirm',
|
|
91
|
+
* });
|
|
92
|
+
*/
|
|
93
|
+
transitionChildBooking(params: TransitionChildBookingParams): Promise<any>;
|
|
71
94
|
/**
|
|
72
95
|
* 基于当前 tempOrder.order_id 强制从远端重新拉取销售详情。
|
|
73
96
|
*
|