@pisell/pisellos 2.2.235 → 2.2.236

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.
@@ -234,6 +234,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
234
234
  private findBookingIndexByUniqueIdentificationNumber;
235
235
  private removeLinkedBookingsForProduct;
236
236
  private getSalesSummary;
237
+ private applyOrderProductsDepositSummary;
237
238
  recalculateSummary(options?: {
238
239
  createIfMissing?: boolean;
239
240
  }): Promise<OrderSummary | null>;
@@ -30,7 +30,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
30
30
  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); }
31
31
  import { BaseModule } from "../BaseModule";
32
32
  import { OrderHooks } from "./types";
33
- import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, mergeOrderProductDisplayFields } from "./utils";
33
+ import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields } from "./utils";
34
34
  import { isNormalProduct } from "../Product/utils";
35
35
  import dayjs from 'dayjs';
36
36
  import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
@@ -2308,12 +2308,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2308
2308
  if (!this.salesSummaryModuleName) return null;
2309
2309
  return this.core.getModule(this.salesSummaryModuleName);
2310
2310
  }
2311
+ }, {
2312
+ key: "applyOrderProductsDepositSummary",
2313
+ value: function applyOrderProductsDepositSummary(tempOrder, summary) {
2314
+ var _tempOrder$_extend5;
2315
+ var depositSummary = calculateOrderProductsDeposit(tempOrder.products || [], {
2316
+ productsByUid: (_tempOrder$_extend5 = tempOrder._extend) === null || _tempOrder$_extend5 === void 0 ? void 0 : _tempOrder$_extend5.productsByUid
2317
+ });
2318
+ var nextSummary = _objectSpread(_objectSpread({}, summary), {}, {
2319
+ deposit_amount: depositSummary.totalText,
2320
+ deposit: depositSummary.hasDeposit ? {
2321
+ total: depositSummary.totalText,
2322
+ deposit_policy_ids: depositSummary.deposit_policy_ids,
2323
+ deposit_policy_data: depositSummary.protocols,
2324
+ hasDeposit: true
2325
+ } : undefined
2326
+ });
2327
+ tempOrder.deposit_amount = depositSummary.totalText;
2328
+ tempOrder.is_deposit = depositSummary.hasDeposit ? 1 : 0;
2329
+ return nextSummary;
2330
+ }
2311
2331
  }, {
2312
2332
  key: "recalculateSummary",
2313
2333
  value: function () {
2314
2334
  var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(options) {
2315
2335
  var _ref45, _salesSummaryResult$e;
2316
- var tempOrder, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
2336
+ var tempOrder, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
2317
2337
  return _regeneratorRuntime().wrap(function _callee10$(_context12) {
2318
2338
  while (1) switch (_context12.prev = _context12.next) {
2319
2339
  case 0:
@@ -2342,22 +2362,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2342
2362
  totalRefundAmount = existedSummary.total_refund_amount || '0.00';
2343
2363
  paidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
2344
2364
  if (salesSummary) {
2345
- _context12.next = 21;
2365
+ _context12.next = 23;
2346
2366
  break;
2347
2367
  }
2348
2368
  emptyBaseSummary = _objectSpread(_objectSpread(_objectSpread({}, createEmptySummary()), existedSummary), {}, {
2349
2369
  total_refund_amount: totalRefundAmount
2350
2370
  });
2351
- emptySummary = _objectSpread(_objectSpread({}, emptyBaseSummary), {}, {
2371
+ emptySummaryBase = _objectSpread(_objectSpread({}, emptyBaseSummary), {}, {
2352
2372
  customer_paid_amount: paidPaymentSummary.customerPaidAmount.toFixed(2),
2353
2373
  order_paid_amount: paidPaymentSummary.orderPaidAmount.toFixed(2),
2374
+ pay_service_charge_amount: paidPaymentSummary.payServiceChargeAmount.toFixed(2),
2375
+ rounding_amount: paidPaymentSummary.roundingAmount.toFixed(2)
2376
+ });
2377
+ emptySummaryWithDeposit = this.applyOrderProductsDepositSummary(tempOrder, emptySummaryBase);
2378
+ emptySummary = _objectSpread(_objectSpread({}, emptySummaryWithDeposit), {}, {
2354
2379
  amount_gap: this.calculateSummaryAmountGap({
2355
2380
  tempOrder: tempOrder,
2356
- summary: emptyBaseSummary,
2381
+ summary: emptySummaryWithDeposit,
2357
2382
  orderPaidAmount: paidPaymentSummary.gapPaidAmount
2358
- }),
2359
- pay_service_charge_amount: paidPaymentSummary.payServiceChargeAmount.toFixed(2),
2360
- rounding_amount: paidPaymentSummary.roundingAmount.toFixed(2)
2383
+ })
2361
2384
  });
2362
2385
  tempOrder.surcharge_fee = emptySummary.surcharge_fee;
2363
2386
  this.store.summary = emptySummary;
@@ -2366,14 +2389,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2366
2389
  summary: emptySummary
2367
2390
  });
2368
2391
  return _context12.abrupt("return", this.store.summary);
2369
- case 21:
2370
- _context12.next = 23;
2392
+ case 23:
2393
+ _context12.next = 25;
2371
2394
  return salesSummary.getSummary({
2372
2395
  products: summaryProducts,
2373
2396
  isPriceIncludeTax: tempOrder.is_price_include_tax,
2374
2397
  shopDiscount: tempOrder.shop_discount
2375
2398
  });
2376
- case 23:
2399
+ case 25:
2377
2400
  salesSummaryResult = _context12.sent;
2378
2401
  if (shouldFullRecalculateFromSnapshot) {
2379
2402
  tempOrder.products = summaryProducts;
@@ -2391,10 +2414,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2391
2414
  normalizedExpectAmountPatch = expectAmount && salesSummaryResult.expect_amount === undefined ? {
2392
2415
  expect_amount: expectAmount.toFixed(2)
2393
2416
  } : {};
2394
- summaryForGap = _objectSpread(_objectSpread(_objectSpread({}, salesSummaryResult), {}, {
2417
+ summaryForGap = this.applyOrderProductsDepositSummary(tempOrder, _objectSpread(_objectSpread(_objectSpread({}, salesSummaryResult), {}, {
2395
2418
  total_refund_amount: totalRefundAmount
2396
- }, amountPaymentPatch), normalizedExpectAmountPatch);
2397
- summary = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, salesSummaryResult), {}, {
2419
+ }, amountPaymentPatch), normalizedExpectAmountPatch));
2420
+ summary = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, summaryForGap), {}, {
2398
2421
  total_refund_amount: totalRefundAmount,
2399
2422
  customer_paid_amount: paidPaymentSummary.customerPaidAmount.toFixed(2),
2400
2423
  order_paid_amount: paidPaymentSummary.orderPaidAmount.toFixed(2)
@@ -2415,8 +2438,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2415
2438
  }
2416
2439
  tempOrder.surcharge_fee = summary.surcharge_fee;
2417
2440
  tempOrder.surcharges = summary.surcharges || [];
2418
- tempOrder.deposit_amount = summary.deposit_amount || '0.00';
2419
- tempOrder.is_deposit = summary.deposit_amount !== '0.00' ? 1 : 0;
2420
2441
  this.updateTempOrderPaymentStatus(tempOrder, {
2421
2442
  previousSummary: existedSummary,
2422
2443
  summary: summary
@@ -1,8 +1,19 @@
1
1
  import Decimal from 'decimal.js';
2
2
  import type { CartItem } from "../Cart";
3
- import type { OrderProductDiscountItem, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
3
+ import type { OrderProductDiscountItem, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
4
4
  import type { RulesParamsHooks } from '../Rules/types';
5
5
  import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
6
+ export interface OrderProductsDepositProtocol {
7
+ id: number;
8
+ title: string;
9
+ }
10
+ export interface OrderProductsDepositSummary {
11
+ total: number;
12
+ totalText: string;
13
+ protocols: OrderProductsDepositProtocol[];
14
+ deposit_policy_ids: number[];
15
+ hasDeposit: boolean;
16
+ }
6
17
  /**
7
18
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
8
19
  *
@@ -53,6 +64,15 @@ export declare function sumOptionUnitPrice(options?: Array<{
53
64
  price?: any;
54
65
  num?: any;
55
66
  }> | null): Decimal;
67
+ /**
68
+ * 仅基于 tempOrder.products 重算整单定金。
69
+ *
70
+ * 对齐 Checkout relation_products 分支:商品定金先按商品规则计算,
71
+ * 再扣减商品券/折扣卡抵扣金额;tempOrder.bookings 不参与这里的计算。
72
+ */
73
+ export declare function calculateOrderProductsDeposit(products?: OrderProduct[], options?: {
74
+ productsByUid?: Record<string, Record<string, any>>;
75
+ }): OrderProductsDepositSummary;
56
76
  /**
57
77
  * 判定套餐子商品是否为 markdown(减价)类型。
58
78
  * 与后端口径一致:price_type='markdown' 且 price_type_ext 非 'product_price'(原价子商品)。
@@ -107,6 +107,214 @@ export function sumOptionUnitPrice(options) {
107
107
  }
108
108
  return total;
109
109
  }
110
+ function getSafeOrderProductNum(num) {
111
+ var parsedNum = Number(num !== null && num !== void 0 ? num : 1);
112
+ if (!Number.isFinite(parsedNum) || parsedNum < 1) return 1;
113
+ return Math.floor(parsedNum);
114
+ }
115
+ function getOrderProductDepositUnitTotal(product) {
116
+ var _ref2;
117
+ var metadata = product.metadata || {};
118
+ var paymentPrice = metadata.main_product_attached_bundle_payment_price;
119
+ var mainSellingPrice = metadata.main_product_selling_price;
120
+ var fallbackPrice = product.selling_price;
121
+ return new Decimal(Number((_ref2 = paymentPrice !== null && paymentPrice !== void 0 ? paymentPrice : mainSellingPrice) !== null && _ref2 !== void 0 ? _ref2 : fallbackPrice) || 0);
122
+ }
123
+ function normalizeDepositProtocols(protocols) {
124
+ if (!Array.isArray(protocols)) return [];
125
+ return protocols.reduce(function (result, protocol) {
126
+ var id = Number(protocol === null || protocol === void 0 ? void 0 : protocol.id);
127
+ if (!Number.isFinite(id)) return result;
128
+ result.push({
129
+ id: Math.floor(id),
130
+ title: String((protocol === null || protocol === void 0 ? void 0 : protocol.title) || '')
131
+ });
132
+ return result;
133
+ }, []);
134
+ }
135
+ function getDepositPolicyIds(depositData) {
136
+ var ids = [].concat(_toConsumableArray(Array.isArray(depositData === null || depositData === void 0 ? void 0 : depositData.self_deposit_policy_ids) ? depositData.self_deposit_policy_ids : []), _toConsumableArray(Array.isArray(depositData === null || depositData === void 0 ? void 0 : depositData.deposit_policy_ids) ? depositData.deposit_policy_ids : []));
137
+ return ids.reduce(function (result, id) {
138
+ var normalizedId = Number(id);
139
+ if (!Number.isFinite(normalizedId)) return result;
140
+ result.push(Math.floor(normalizedId));
141
+ return result;
142
+ }, []);
143
+ }
144
+ function handleOrderProductDeposit(params) {
145
+ var depositData = params.depositData,
146
+ total = params.total,
147
+ num = params.num;
148
+ if (!depositData) return {
149
+ result: false,
150
+ depositTotal: new Decimal(0)
151
+ };
152
+ var deposit_fixed = depositData.deposit_fixed,
153
+ deposit_percentage = depositData.deposit_percentage;
154
+ if (typeof deposit_fixed !== 'string' || typeof deposit_percentage !== 'string') {
155
+ return {
156
+ result: false,
157
+ depositTotal: new Decimal(0)
158
+ };
159
+ }
160
+ var depositFixed = new Decimal(deposit_fixed || 0);
161
+ var depositPercent = new Decimal(deposit_percentage || 0);
162
+ var productTotalPrice = new Decimal(total || 0);
163
+ var deposit = depositFixed.plus(depositPercent.times(productTotalPrice));
164
+ return {
165
+ depositTotal: deposit.times(num),
166
+ result: true
167
+ };
168
+ }
169
+ function resolveOrderProductDepositSource(product, runtimeOrigin) {
170
+ var _ref3, _record$custom_deposi, _ref4, _record$variant;
171
+ var record = product;
172
+ var origin = record._origin || runtimeOrigin || {};
173
+ var originProduct = origin.product || {};
174
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, originProduct), origin), record), {}, {
175
+ custom_deposit_data: (_ref3 = (_record$custom_deposi = record.custom_deposit_data) !== null && _record$custom_deposi !== void 0 ? _record$custom_deposi : origin.custom_deposit_data) !== null && _ref3 !== void 0 ? _ref3 : originProduct.custom_deposit_data,
176
+ variant: (_ref4 = (_record$variant = record.variant) !== null && _record$variant !== void 0 ? _record$variant : origin.variant) !== null && _ref4 !== void 0 ? _ref4 : originProduct.variant
177
+ });
178
+ }
179
+ function getOrderProductDeposit(product, runtimeOrigin) {
180
+ var depositProduct = resolveOrderProductDepositSource(product, runtimeOrigin);
181
+ var depositData = depositProduct.custom_deposit_data;
182
+ if ((depositData === null || depositData === void 0 ? void 0 : depositData.has_deposit) != 1) return null;
183
+ var num = getSafeOrderProductNum(product.num);
184
+ var total = getOrderProductDepositUnitTotal(product).times(num);
185
+ var allProtocols = normalizeDepositProtocols(depositData.deposit_policy_data);
186
+ var protocolIds = [];
187
+ var depositTotal = new Decimal(0);
188
+ var hasDeposit = false;
189
+ if (typeof depositData.deposit_fixed === 'string' && typeof depositData.deposit_percentage === 'string') {
190
+ var result = handleOrderProductDeposit({
191
+ depositData: depositData,
192
+ total: total,
193
+ num: num
194
+ });
195
+ if (result.result) {
196
+ depositTotal = result.depositTotal;
197
+ protocolIds.push.apply(protocolIds, _toConsumableArray(getDepositPolicyIds({
198
+ self_deposit_policy_ids: depositData.self_deposit_policy_ids
199
+ })));
200
+ hasDeposit = true;
201
+ }
202
+ } else {
203
+ var _depositProduct$produ;
204
+ var productVariantId = (_depositProduct$produ = depositProduct.product_variant_id) !== null && _depositProduct$produ !== void 0 ? _depositProduct$produ : product.product_variant_id;
205
+ if (productVariantId) {
206
+ var variantProduct = (depositProduct.variant || []).find(function (item) {
207
+ return (item === null || item === void 0 ? void 0 : item.id) === productVariantId;
208
+ });
209
+ var variantDepositData = variantProduct === null || variantProduct === void 0 ? void 0 : variantProduct.custom_deposit_data;
210
+ var _result = handleOrderProductDeposit({
211
+ depositData: variantDepositData,
212
+ total: total,
213
+ num: num
214
+ });
215
+ if (_result.result) {
216
+ depositTotal = _result.depositTotal;
217
+ protocolIds.push.apply(protocolIds, _toConsumableArray(getDepositPolicyIds({
218
+ self_deposit_policy_ids: variantDepositData === null || variantDepositData === void 0 ? void 0 : variantDepositData.self_deposit_policy_ids
219
+ })));
220
+ hasDeposit = true;
221
+ }
222
+ }
223
+ if (Array.isArray(product.product_bundle) && product.product_bundle.length) {
224
+ depositTotal = product.product_bundle.reduce(function (accumulator, bundleProduct) {
225
+ var bundleDepositData = bundleProduct === null || bundleProduct === void 0 ? void 0 : bundleProduct.custom_deposit_data;
226
+ var result = handleOrderProductDeposit({
227
+ depositData: bundleDepositData,
228
+ total: bundleProduct === null || bundleProduct === void 0 ? void 0 : bundleProduct.price,
229
+ num: getSafeOrderProductNum((bundleProduct === null || bundleProduct === void 0 ? void 0 : bundleProduct.num) || 1)
230
+ });
231
+ if (!result.result) return accumulator;
232
+ protocolIds.push.apply(protocolIds, _toConsumableArray(getDepositPolicyIds({
233
+ self_deposit_policy_ids: bundleDepositData === null || bundleDepositData === void 0 ? void 0 : bundleDepositData.self_deposit_policy_ids
234
+ })));
235
+ hasDeposit = true;
236
+ return accumulator.plus(result.depositTotal);
237
+ }, new Decimal(0));
238
+ }
239
+ }
240
+ if (!hasDeposit) return null;
241
+ var protocolIdSet = new Set(protocolIds);
242
+ var protocols = allProtocols.filter(function (protocol) {
243
+ return protocolIdSet.has(protocol.id);
244
+ });
245
+ return {
246
+ total: depositTotal.toNumber(),
247
+ protocols: protocols
248
+ };
249
+ }
250
+
251
+ /**
252
+ * 仅基于 tempOrder.products 重算整单定金。
253
+ *
254
+ * 对齐 Checkout relation_products 分支:商品定金先按商品规则计算,
255
+ * 再扣减商品券/折扣卡抵扣金额;tempOrder.bookings 不参与这里的计算。
256
+ */
257
+ export function calculateOrderProductsDeposit() {
258
+ var products = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
259
+ var options = arguments.length > 1 ? arguments[1] : undefined;
260
+ var protocolMap = new Map();
261
+ var total = new Decimal(0);
262
+ var hasDeposit = false;
263
+ var _iterator3 = _createForOfIteratorHelper(products || []),
264
+ _step3;
265
+ try {
266
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
267
+ var _product$metadata, _options$productsByUi;
268
+ var product = _step3.value;
269
+ var productUid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
270
+ var runtimeOrigin = productUid ? options === null || options === void 0 || (_options$productsByUi = options.productsByUid) === null || _options$productsByUi === void 0 || (_options$productsByUi = _options$productsByUi[productUid]) === null || _options$productsByUi === void 0 ? void 0 : _options$productsByUi.origin : undefined;
271
+ var deposit = getOrderProductDeposit(product, runtimeOrigin);
272
+ product.deposit = deposit;
273
+ if (!(deposit !== null && deposit !== void 0 && deposit.total) || Number(deposit.total) <= 0) continue;
274
+ total = total.plus(deposit.total);
275
+ var _iterator4 = _createForOfIteratorHelper(product.discount_list || []),
276
+ _step4;
277
+ try {
278
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
279
+ var discount = _step4.value;
280
+ total = total.minus((discount === null || discount === void 0 ? void 0 : discount.amount) || 0);
281
+ }
282
+ } catch (err) {
283
+ _iterator4.e(err);
284
+ } finally {
285
+ _iterator4.f();
286
+ }
287
+ var _iterator5 = _createForOfIteratorHelper(deposit.protocols || []),
288
+ _step5;
289
+ try {
290
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
291
+ var protocol = _step5.value;
292
+ if (!protocolMap.has(protocol.id)) protocolMap.set(protocol.id, protocol);
293
+ }
294
+ } catch (err) {
295
+ _iterator5.e(err);
296
+ } finally {
297
+ _iterator5.f();
298
+ }
299
+ hasDeposit = true;
300
+ }
301
+ } catch (err) {
302
+ _iterator3.e(err);
303
+ } finally {
304
+ _iterator3.f();
305
+ }
306
+ var roundedTotal = total.toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
307
+ var protocols = _toConsumableArray(protocolMap.values());
308
+ return {
309
+ total: roundedTotal.toNumber(),
310
+ totalText: roundedTotal.toFixed(2),
311
+ protocols: protocols,
312
+ deposit_policy_ids: protocols.map(function (protocol) {
313
+ return protocol.id;
314
+ }),
315
+ hasDeposit: hasDeposit
316
+ };
317
+ }
110
318
 
111
319
  /**
112
320
  * 判定套餐子商品是否为 markdown(减价)类型。
@@ -129,12 +337,12 @@ export function isMarkdownBundle(bundle) {
129
337
  * - markup(加价)/原价子商品:维持 `+(bundle_selling_price ?? price)`,行为不变。
130
338
  */
131
339
  export function getBundleSignedUnit(bundle, options) {
132
- var _options$useOriginal, _ref8, _bundle$original_pric2, _bundle$bundle_sellin;
340
+ var _options$useOriginal, _ref11, _bundle$original_pric2, _bundle$bundle_sellin;
133
341
  if (!bundle || _typeof(bundle) !== 'object') return new Decimal(0);
134
342
  var useOriginal = (_options$useOriginal = options === null || options === void 0 ? void 0 : options.useOriginal) !== null && _options$useOriginal !== void 0 ? _options$useOriginal : false;
135
343
  if (isMarkdownBundle(bundle)) {
136
- var _ref2, _ref3, _ref4, _bundle$original_pric, _ref5, _ref6, _ref7, _bundle$custom_price;
137
- var catalog = useOriginal ? (_ref2 = (_ref3 = (_ref4 = (_bundle$original_pric = bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle.product_price) !== null && _ref4 !== void 0 ? _ref4 : bundle.custom_price) !== null && _ref3 !== void 0 ? _ref3 : bundle.base_price) !== null && _ref2 !== void 0 ? _ref2 : bundle.price : (_ref5 = (_ref6 = (_ref7 = (_bundle$custom_price = bundle.custom_price) !== null && _bundle$custom_price !== void 0 ? _bundle$custom_price : bundle.product_price) !== null && _ref7 !== void 0 ? _ref7 : bundle.original_price) !== null && _ref6 !== void 0 ? _ref6 : bundle.base_price) !== null && _ref5 !== void 0 ? _ref5 : bundle.price;
344
+ var _ref5, _ref6, _ref7, _bundle$original_pric, _ref8, _ref9, _ref10, _bundle$custom_price;
345
+ var catalog = useOriginal ? (_ref5 = (_ref6 = (_ref7 = (_bundle$original_pric = bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle.product_price) !== null && _ref7 !== void 0 ? _ref7 : bundle.custom_price) !== null && _ref6 !== void 0 ? _ref6 : bundle.base_price) !== null && _ref5 !== void 0 ? _ref5 : bundle.price : (_ref8 = (_ref9 = (_ref10 = (_bundle$custom_price = bundle.custom_price) !== null && _bundle$custom_price !== void 0 ? _bundle$custom_price : bundle.product_price) !== null && _ref10 !== void 0 ? _ref10 : bundle.original_price) !== null && _ref9 !== void 0 ? _ref9 : bundle.base_price) !== null && _ref8 !== void 0 ? _ref8 : bundle.price;
138
346
  if (catalog !== undefined && catalog !== null && catalog !== '') {
139
347
  var raw = new Decimal(Number(catalog) || 0);
140
348
  // 负值表示价格已是「带符号净额」(如 cart/changePrice 产出的 -3.7),直接取用不再扣 option,
@@ -145,7 +353,7 @@ export function getBundleSignedUnit(bundle, options) {
145
353
  // 仅剩净额(无毛价)兜底:直接取负,不再扣 option
146
354
  return new Decimal(Number(bundle.bundle_selling_price) || 0).abs().negated();
147
355
  }
148
- var rawPrice = useOriginal ? (_ref8 = (_bundle$original_pric2 = bundle.original_price) !== null && _bundle$original_pric2 !== void 0 ? _bundle$original_pric2 : bundle.product_price) !== null && _ref8 !== void 0 ? _ref8 : bundle.price : (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price;
356
+ var rawPrice = useOriginal ? (_ref11 = (_bundle$original_pric2 = bundle.original_price) !== null && _bundle$original_pric2 !== void 0 ? _bundle$original_pric2 : bundle.product_price) !== null && _ref11 !== void 0 ? _ref11 : bundle.price : (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price;
149
357
  return new Decimal(Number(rawPrice) || 0);
150
358
  }
151
359
 
@@ -314,8 +522,8 @@ export function createDefaultOrderRulesHooks() {
314
522
  return new Decimal(Number(totalLike) || 0).dividedBy(effectiveNum).toDecimalPlaces(2).toString();
315
523
  };
316
524
  var getBundleIdentity = function getBundleIdentity(bundle) {
317
- var _ref9, _bundle$bundle_id, _ref10, _ref11, _bundle$bundle_produc, _ref12, _ref13, _bundle$bundle_varian, _ref14, _bundle$bundle_group_;
318
- return [(_ref9 = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id) !== null && _ref9 !== void 0 ? _ref9 : '', (_ref10 = (_ref11 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref11 !== void 0 ? _ref11 : bundle.product_id) !== null && _ref10 !== void 0 ? _ref10 : '', (_ref12 = (_ref13 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref13 !== void 0 ? _ref13 : bundle.product_variant_id) !== null && _ref12 !== void 0 ? _ref12 : 0, (_ref14 = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id) !== null && _ref14 !== void 0 ? _ref14 : ''].join('|');
525
+ var _ref12, _bundle$bundle_id, _ref13, _ref14, _bundle$bundle_produc, _ref15, _ref16, _bundle$bundle_varian, _ref17, _bundle$bundle_group_;
526
+ return [(_ref12 = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id) !== null && _ref12 !== void 0 ? _ref12 : '', (_ref13 = (_ref14 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref14 !== void 0 ? _ref14 : bundle.product_id) !== null && _ref13 !== void 0 ? _ref13 : '', (_ref15 = (_ref16 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref16 !== void 0 ? _ref16 : bundle.product_variant_id) !== null && _ref15 !== void 0 ? _ref15 : 0, (_ref17 = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id) !== null && _ref17 !== void 0 ? _ref17 : ''].join('|');
319
527
  };
320
528
  var mergeRulesBundlePrices = function mergeRulesBundlePrices(currentBundle, rulesBundle) {
321
529
  if (!Array.isArray(rulesBundle)) return rulesBundle;
@@ -325,14 +533,14 @@ export function createDefaultOrderRulesHooks() {
325
533
  currentByIdentity.set(getBundleIdentity(bundle), bundle);
326
534
  });
327
535
  return rulesBundle.map(function (bundle) {
328
- var _bundle$price_type_ex2, _ref15, _ref16, _current$price, _ref17, _ref18, _ref19, _current$original_pri;
536
+ var _bundle$price_type_ex2, _ref18, _ref19, _current$price, _ref20, _ref21, _ref22, _current$original_pri;
329
537
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
330
538
  var current = currentByIdentity.get(getBundleIdentity(bundle));
331
539
  if (!current) return bundle;
332
540
  var isProductPriceBundle = ((_bundle$price_type_ex2 = bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : current.price_type_ext) === 'product_price';
333
541
  if (!isProductPriceBundle) return bundle;
334
- var sourcePrice = (_ref15 = (_ref16 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref16 !== void 0 ? _ref16 : current.original_price) !== null && _ref15 !== void 0 ? _ref15 : current.bundle_selling_price;
335
- var originalPrice = (_ref17 = (_ref18 = (_ref19 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref19 !== void 0 ? _ref19 : current.price) !== null && _ref18 !== void 0 ? _ref18 : current.custom_price) !== null && _ref17 !== void 0 ? _ref17 : sourcePrice;
542
+ var sourcePrice = (_ref18 = (_ref19 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref19 !== void 0 ? _ref19 : current.original_price) !== null && _ref18 !== void 0 ? _ref18 : current.bundle_selling_price;
543
+ var originalPrice = (_ref20 = (_ref21 = (_ref22 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref22 !== void 0 ? _ref22 : current.price) !== null && _ref21 !== void 0 ? _ref21 : current.custom_price) !== null && _ref20 !== void 0 ? _ref20 : sourcePrice;
336
544
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bundle), sourcePrice !== undefined ? {
337
545
  price: sourcePrice
338
546
  } : {}), originalPrice !== undefined ? {
@@ -344,7 +552,7 @@ export function createDefaultOrderRulesHooks() {
344
552
  };
345
553
  return {
346
554
  getProduct: function getProduct(product) {
347
- var _product$metadata, _product$metadata2, _product$metadata3, _product$metadata4, _product$metadata5, _metadataAny$_promoti;
555
+ var _product$metadata2, _product$metadata3, _product$metadata4, _product$metadata5, _product$metadata6, _metadataAny$_promoti;
348
556
  // source_product_price 是权威源;兜底链:source → mainSelling − options(反推)→ 行 selling_price
349
557
  var metadataAny = product.metadata || {};
350
558
  var optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
@@ -371,7 +579,7 @@ export function createDefaultOrderRulesHooks() {
371
579
  // 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
372
580
  // 不透明 identity 契约下,normalizeOrderProduct / hydrate 已保证唯一值存在;
373
581
  // 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
374
- _id: (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(product.metadata.unique_identification_number) : "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(buildProductLineFingerprint(getProductSkuOptions(product), product.product_bundle)),
582
+ _id: (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.unique_identification_number ? "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(product.metadata.unique_identification_number) : "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(buildProductLineFingerprint(getProductSkuOptions(product), product.product_bundle)),
375
583
  // Rules 内部 getProductTotalPrice / getProductOriginTotalPrice 会各自再叠加 bundle + option,
376
584
  // 所以这里必须喂 source-level(不含 option、不含 bundle、不含折扣)单价,避免双加 option。
377
585
  price: sourcePrice,
@@ -383,23 +591,23 @@ export function createDefaultOrderRulesHooks() {
383
591
  num: product.num || 1,
384
592
  discount_list: product.discount_list || [],
385
593
  bundle: product.product_bundle || [],
386
- booking_id: ((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.booking_id) || null,
594
+ booking_id: ((_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.booking_id) || null,
387
595
  isClient: false,
388
596
  // 勿写死 false:否则 Rules 不会走 total≠origin_total 的手动价推断,
389
597
  // 无券时会把 bundle 价还原成 original_price(手动改价套餐会从 20 回到 30)。
390
598
  isManualDiscount: resolveRulesManualDiscountFlag(metadataAny),
391
- holder_id: (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.holder_id,
392
- startDate: ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.start_date) || ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.startDate),
599
+ holder_id: (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.holder_id,
600
+ startDate: ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.start_date) || ((_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.startDate),
393
601
  main_product_selling_price: metadataAny.main_product_selling_price !== undefined ? new Decimal(Number(metadataAny.main_product_selling_price) || 0).minus(optionSum).toDecimalPlaces(2).toString() : undefined,
394
602
  inPromotion: ((_metadataAny$_promoti = metadataAny._promotion) === null || _metadataAny$_promoti === void 0 ? void 0 : _metadataAny$_promoti.inPromotion) === true,
395
603
  _promotion: metadataAny._promotion
396
604
  };
397
605
  },
398
606
  setProduct: function setProduct(product, values) {
399
- var _ref20, _values$quantity, _ref21, _metadataAny$source_p, _values$discount_list, _values$quantity2;
400
- var nextNum = Number((_ref20 = (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num) !== null && _ref20 !== void 0 ? _ref20 : 1) || 1;
607
+ var _ref23, _values$quantity, _ref24, _metadataAny$source_p, _values$discount_list, _values$quantity2;
608
+ var nextNum = Number((_ref23 = (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num) !== null && _ref23 !== void 0 ? _ref23 : 1) || 1;
401
609
  var metadataAny = product.metadata || {};
402
- var existedSource = (_ref21 = (_metadataAny$source_p = metadataAny.source_product_price) !== null && _metadataAny$source_p !== void 0 ? _metadataAny$source_p : product.selling_price) !== null && _ref21 !== void 0 ? _ref21 : '0';
610
+ var existedSource = (_ref24 = (_metadataAny$source_p = metadataAny.source_product_price) !== null && _metadataAny$source_p !== void 0 ? _metadataAny$source_p : product.selling_price) !== null && _ref24 !== void 0 ? _ref24 : '0';
403
611
  var nextOptions = getProductSkuOptions(product);
404
612
  var optionSum = sumOptionUnitPrice(nextOptions);
405
613
 
@@ -572,7 +780,7 @@ function toMoneyString(value) {
572
780
  function formatSubmitBundleItems(bundle) {
573
781
  if (!Array.isArray(bundle)) return [];
574
782
  return bundle.map(function (b) {
575
- var _ref22, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref23, _rawBundle$price_type, _ref24, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
783
+ var _ref25, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref26, _rawBundle$price_type, _ref27, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
576
784
  var rawBundle = b && _typeof(b) === 'object' ? b : {};
577
785
  var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
578
786
 
@@ -581,7 +789,7 @@ function formatSubmitBundleItems(bundle) {
581
789
  var sellingPrice = getBundleSellingMagnitude(rawBundle).toFixed(2);
582
790
  // payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
583
791
  var paymentPrice = rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
584
- var priceValue = (_ref22 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref22 !== void 0 ? _ref22 : rawBundle.bundle_selling_price;
792
+ var priceValue = (_ref25 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref25 !== void 0 ? _ref25 : rawBundle.bundle_selling_price;
585
793
  var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
586
794
  var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
587
795
  var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
@@ -594,8 +802,8 @@ function formatSubmitBundleItems(bundle) {
594
802
  extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
595
803
  extension_type: (_rawBundle$extension_2 = rawBundle.extension_type) !== null && _rawBundle$extension_2 !== void 0 ? _rawBundle$extension_2 : 'normal',
596
804
  price: priceValue,
597
- price_type: (_ref23 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref23 !== void 0 ? _ref23 : '',
598
- price_type_ext: (_ref24 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref24 !== void 0 ? _ref24 : '',
805
+ price_type: (_ref26 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref26 !== void 0 ? _ref26 : '',
806
+ price_type_ext: (_ref27 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref27 !== void 0 ? _ref27 : '',
599
807
  bundle_selling_price: sellingPrice,
600
808
  bundle_payment_price: paymentPrice,
601
809
  option: formatSubmitOptionItems(rawBundle.option),
@@ -629,9 +837,9 @@ function formatSubmitBundleItems(bundle) {
629
837
  */
630
838
  function normalizeSubmitProduct(product) {
631
839
  var _rawMetadata$product_, _submitProduct$produc, _submitProduct$paymen;
632
- var _ref25 = product,
633
- _runtimeUid = _ref25.unique_identification_number,
634
- submitProduct = _objectWithoutProperties(_ref25, _excluded);
840
+ var _ref28 = product,
841
+ _runtimeUid = _ref28.unique_identification_number,
842
+ submitProduct = _objectWithoutProperties(_ref28, _excluded);
635
843
  var num = submitProduct.num,
636
844
  _productSurchargeFee = submitProduct.surcharge_fee,
637
845
  _deprecatedDiscountAmount = submitProduct.discount_amount,
@@ -691,19 +899,19 @@ export function normalizeBookingSubType(booking) {
691
899
  export function normalizeSubmitBooking(booking) {
692
900
  var rawMetadata = booking.metadata || {};
693
901
  var cleanMetadata = {};
694
- var _iterator3 = _createForOfIteratorHelper(SUBMIT_BOOKING_METADATA_WHITELIST),
695
- _step3;
902
+ var _iterator6 = _createForOfIteratorHelper(SUBMIT_BOOKING_METADATA_WHITELIST),
903
+ _step6;
696
904
  try {
697
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
698
- var key = _step3.value;
905
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
906
+ var key = _step6.value;
699
907
  if (rawMetadata[key] !== undefined) {
700
908
  cleanMetadata[key] = rawMetadata[key];
701
909
  }
702
910
  }
703
911
  } catch (err) {
704
- _iterator3.e(err);
912
+ _iterator6.e(err);
705
913
  } finally {
706
- _iterator3.f();
914
+ _iterator6.f();
707
915
  }
708
916
  if (cleanMetadata.holder_id === undefined) cleanMetadata.holder_id = null;
709
917
  var bookingRecord = booking;
@@ -795,7 +1003,7 @@ export function createDefaultTempOrder(params) {
795
1003
  };
796
1004
  }
797
1005
  export function buildSubmitPayload(params) {
798
- var _tempOrder$customer_i, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref27, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
1006
+ var _tempOrder$customer_i, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref30, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
799
1007
  var tempOrder = params.tempOrder,
800
1008
  cacheId = params.cacheId,
801
1009
  _params$now = params.now,
@@ -808,26 +1016,26 @@ export function buildSubmitPayload(params) {
808
1016
  enhance = params.enhance;
809
1017
  var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
810
1018
  var bookingUuid = createUuidV4();
811
- var _ref26 = tempOrder,
812
- _extend = _ref26._extend,
813
- _relationId = _ref26.relation_id,
814
- _tableFormId = _ref26.table_form_id,
815
- _resourceId = _ref26.resource_id,
816
- _summary = _ref26.summary,
817
- _lastOrderInfo = _ref26.lastOrderInfo,
818
- _paidAmount = _ref26.paid_amount,
819
- _shopId = _ref26.shop_id,
820
- _shopNote = _ref26.shop_note,
821
- _shopServiceType = _ref26.shop_service_type,
822
- _startTime = _ref26.start_time,
823
- _customer = _ref26.customer,
824
- _discountList = _ref26.discount_list,
825
- _rootTaxFee = _ref26.tax_fee,
826
- _totalAmount = _ref26.total_amount,
827
- _totalRefundAmount = _ref26.total_refund_amount,
828
- _createDate = _ref26.create_date,
829
- _holderId = _ref26.holder_id,
830
- tempOrderRest = _objectWithoutProperties(_ref26, _excluded3);
1019
+ var _ref29 = tempOrder,
1020
+ _extend = _ref29._extend,
1021
+ _relationId = _ref29.relation_id,
1022
+ _tableFormId = _ref29.table_form_id,
1023
+ _resourceId = _ref29.resource_id,
1024
+ _summary = _ref29.summary,
1025
+ _lastOrderInfo = _ref29.lastOrderInfo,
1026
+ _paidAmount = _ref29.paid_amount,
1027
+ _shopId = _ref29.shop_id,
1028
+ _shopNote = _ref29.shop_note,
1029
+ _shopServiceType = _ref29.shop_service_type,
1030
+ _startTime = _ref29.start_time,
1031
+ _customer = _ref29.customer,
1032
+ _discountList = _ref29.discount_list,
1033
+ _rootTaxFee = _ref29.tax_fee,
1034
+ _totalAmount = _ref29.total_amount,
1035
+ _totalRefundAmount = _ref29.total_refund_amount,
1036
+ _createDate = _ref29.create_date,
1037
+ _holderId = _ref29.holder_id,
1038
+ tempOrderRest = _objectWithoutProperties(_ref29, _excluded3);
831
1039
  var submitType = type !== null && type !== void 0 ? type : tempOrder.type;
832
1040
  if (!submitType) {
833
1041
  var _tempOrder$bookings;
@@ -849,7 +1057,7 @@ export function buildSubmitPayload(params) {
849
1057
  type: submitType,
850
1058
  business_code: businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code,
851
1059
  sales_channel: tempOrder.sales_channel || 'my_pisel',
852
- order_sales_channel: (_ref27 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref27 !== void 0 ? _ref27 : 'online_store',
1060
+ order_sales_channel: (_ref30 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref30 !== void 0 ? _ref30 : 'online_store',
853
1061
  status: tempOrder.status || 'normal',
854
1062
  payment_status: tempOrder.payment_status || 'payment_processing',
855
1063
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
@@ -875,10 +1083,10 @@ export function buildSubmitPayload(params) {
875
1083
  // holder: tempOrder.holder || null,
876
1084
  summary: summary || tempOrder.summary || createEmptySummary(),
877
1085
  metadata: function () {
878
- var _ref28 = tempOrder.metadata || {},
879
- _collectPax = _ref28.collect_pax,
880
- _tableOccupancyDuration = _ref28.table_occupancy_duration,
881
- rest = _objectWithoutProperties(_ref28, _excluded4);
1086
+ var _ref31 = tempOrder.metadata || {},
1087
+ _collectPax = _ref31.collect_pax,
1088
+ _tableOccupancyDuration = _ref31.table_occupancy_duration,
1089
+ rest = _objectWithoutProperties(_ref31, _excluded4);
882
1090
  return _objectSpread({}, rest);
883
1091
  }(),
884
1092
  products: (tempOrder.products || []).map(function (product) {
@@ -1013,25 +1221,25 @@ export function clearTempOrderHolderAssignments(tempOrder) {
1013
1221
  target[key] = null;
1014
1222
  changed = true;
1015
1223
  };
1016
- var _iterator4 = _createForOfIteratorHelper(tempOrder.products || []),
1017
- _step4;
1224
+ var _iterator7 = _createForOfIteratorHelper(tempOrder.products || []),
1225
+ _step7;
1018
1226
  try {
1019
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1020
- var product = _step4.value;
1227
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1228
+ var product = _step7.value;
1021
1229
  if (product.metadata && _typeof(product.metadata) === 'object') {
1022
1230
  resetHolderField(product.metadata);
1023
1231
  }
1024
1232
  }
1025
1233
  } catch (err) {
1026
- _iterator4.e(err);
1234
+ _iterator7.e(err);
1027
1235
  } finally {
1028
- _iterator4.f();
1236
+ _iterator7.f();
1029
1237
  }
1030
- var _iterator5 = _createForOfIteratorHelper(tempOrder.bookings || []),
1031
- _step5;
1238
+ var _iterator8 = _createForOfIteratorHelper(tempOrder.bookings || []),
1239
+ _step8;
1032
1240
  try {
1033
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1034
- var booking = _step5.value;
1241
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1242
+ var booking = _step8.value;
1035
1243
  var bookingRecord = booking;
1036
1244
  if (booking.metadata && _typeof(booking.metadata) === 'object') {
1037
1245
  resetHolderField(booking.metadata);
@@ -1042,9 +1250,9 @@ export function clearTempOrderHolderAssignments(tempOrder) {
1042
1250
  }
1043
1251
  }
1044
1252
  } catch (err) {
1045
- _iterator5.e(err);
1253
+ _iterator8.e(err);
1046
1254
  } finally {
1047
- _iterator5.f();
1255
+ _iterator8.f();
1048
1256
  }
1049
1257
  var productsByUid = (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid;
1050
1258
  if (productsByUid && _typeof(productsByUid) === 'object') {
@@ -1070,9 +1278,9 @@ export function clearTempOrderHolderAssignments(tempOrder) {
1070
1278
  * getOrderProductLineUid({ metadata: { unique_identification_number: 'line-1' } }); // 'line-1'
1071
1279
  */
1072
1280
  export function getOrderProductLineUid(product) {
1073
- var _product$metadata$uni, _product$metadata6;
1281
+ var _product$metadata$uni, _product$metadata7;
1074
1282
  if (!product || _typeof(product) !== 'object') return null;
1075
- var uid = (_product$metadata$uni = (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product.unique_identification_number;
1283
+ var uid = (_product$metadata$uni = (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product.unique_identification_number;
1076
1284
  if (uid === undefined || uid === null || uid === '') return null;
1077
1285
  return String(uid);
1078
1286
  }
@@ -1944,7 +1944,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1944
1944
  var secondary = preferred === existing ? incoming : existing;
1945
1945
  var merged = _objectSpread(_objectSpread({}, secondary), preferred);
1946
1946
  var fieldsToPreserve = ['order_id', 'external_sale_number', 'order_number', 'shop_order_number', 'shop_full_order_number'];
1947
- var incomingPatchFields = ['payment_status', 'status', 'shipping_status', 'updated_at', 'summary', 'payments', 'products', 'bookings'];
1947
+ var incomingPatchFields = ['payment_status', 'status', 'shipping_status', 'updated_at', 'shop_discount', 'summary', 'payments', 'products', 'bookings'];
1948
1948
  var mergedRecord = merged;
1949
1949
  var preferredRecord = preferred;
1950
1950
  var secondaryRecord = secondary;
@@ -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 | 1 | 2 | 3 | 6 | 5 | 4;
314
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
@@ -234,6 +234,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
234
234
  private findBookingIndexByUniqueIdentificationNumber;
235
235
  private removeLinkedBookingsForProduct;
236
236
  private getSalesSummary;
237
+ private applyOrderProductsDepositSummary;
237
238
  recalculateSummary(options?: {
238
239
  createIfMissing?: boolean;
239
240
  }): Promise<OrderSummary | null>;
@@ -1645,6 +1645,25 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1645
1645
  return null;
1646
1646
  return this.core.getModule(this.salesSummaryModuleName);
1647
1647
  }
1648
+ applyOrderProductsDepositSummary(tempOrder, summary) {
1649
+ var _a;
1650
+ const depositSummary = (0, import_utils.calculateOrderProductsDeposit)(tempOrder.products || [], {
1651
+ productsByUid: (_a = tempOrder._extend) == null ? void 0 : _a.productsByUid
1652
+ });
1653
+ const nextSummary = {
1654
+ ...summary,
1655
+ deposit_amount: depositSummary.totalText,
1656
+ deposit: depositSummary.hasDeposit ? {
1657
+ total: depositSummary.totalText,
1658
+ deposit_policy_ids: depositSummary.deposit_policy_ids,
1659
+ deposit_policy_data: depositSummary.protocols,
1660
+ hasDeposit: true
1661
+ } : void 0
1662
+ };
1663
+ tempOrder.deposit_amount = depositSummary.totalText;
1664
+ tempOrder.is_deposit = depositSummary.hasDeposit ? 1 : 0;
1665
+ return nextSummary;
1666
+ }
1648
1667
  async recalculateSummary(options) {
1649
1668
  const tempOrder = (options == null ? void 0 : options.createIfMissing) ? this.ensureTempOrder() : this.store.tempOrder;
1650
1669
  if (!tempOrder)
@@ -1670,17 +1689,24 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1670
1689
  ...existedSummary,
1671
1690
  total_refund_amount: totalRefundAmount
1672
1691
  };
1673
- const emptySummary = {
1692
+ const emptySummaryBase = {
1674
1693
  ...emptyBaseSummary,
1675
1694
  customer_paid_amount: paidPaymentSummary.customerPaidAmount.toFixed(2),
1676
1695
  order_paid_amount: paidPaymentSummary.orderPaidAmount.toFixed(2),
1696
+ pay_service_charge_amount: paidPaymentSummary.payServiceChargeAmount.toFixed(2),
1697
+ rounding_amount: paidPaymentSummary.roundingAmount.toFixed(2)
1698
+ };
1699
+ const emptySummaryWithDeposit = this.applyOrderProductsDepositSummary(
1700
+ tempOrder,
1701
+ emptySummaryBase
1702
+ );
1703
+ const emptySummary = {
1704
+ ...emptySummaryWithDeposit,
1677
1705
  amount_gap: this.calculateSummaryAmountGap({
1678
1706
  tempOrder,
1679
- summary: emptyBaseSummary,
1707
+ summary: emptySummaryWithDeposit,
1680
1708
  orderPaidAmount: paidPaymentSummary.gapPaidAmount
1681
- }),
1682
- pay_service_charge_amount: paidPaymentSummary.payServiceChargeAmount.toFixed(2),
1683
- rounding_amount: paidPaymentSummary.roundingAmount.toFixed(2)
1709
+ })
1684
1710
  };
1685
1711
  tempOrder.surcharge_fee = emptySummary.surcharge_fee;
1686
1712
  this.store.summary = emptySummary;
@@ -1713,14 +1739,14 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1713
1739
  } : {}
1714
1740
  } : {};
1715
1741
  const normalizedExpectAmountPatch = expectAmount && salesSummaryResult.expect_amount === void 0 ? { expect_amount: expectAmount.toFixed(2) } : {};
1716
- const summaryForGap = {
1742
+ const summaryForGap = this.applyOrderProductsDepositSummary(tempOrder, {
1717
1743
  ...salesSummaryResult,
1718
1744
  total_refund_amount: totalRefundAmount,
1719
1745
  ...amountPaymentPatch,
1720
1746
  ...normalizedExpectAmountPatch
1721
- };
1747
+ });
1722
1748
  const summary = {
1723
- ...salesSummaryResult,
1749
+ ...summaryForGap,
1724
1750
  total_refund_amount: totalRefundAmount,
1725
1751
  customer_paid_amount: paidPaymentSummary.customerPaidAmount.toFixed(2),
1726
1752
  order_paid_amount: paidPaymentSummary.orderPaidAmount.toFixed(2),
@@ -1742,8 +1768,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1742
1768
  }
1743
1769
  tempOrder.surcharge_fee = summary.surcharge_fee;
1744
1770
  tempOrder.surcharges = summary.surcharges || [];
1745
- tempOrder.deposit_amount = summary.deposit_amount || "0.00";
1746
- tempOrder.is_deposit = summary.deposit_amount !== "0.00" ? 1 : 0;
1747
1771
  this.updateTempOrderPaymentStatus(tempOrder, {
1748
1772
  previousSummary: existedSummary,
1749
1773
  summary
@@ -1,8 +1,19 @@
1
1
  import Decimal from 'decimal.js';
2
2
  import type { CartItem } from "../Cart";
3
- import type { OrderProductDiscountItem, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
3
+ import type { OrderProductDiscountItem, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
4
4
  import type { RulesParamsHooks } from '../Rules/types';
5
5
  import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
6
+ export interface OrderProductsDepositProtocol {
7
+ id: number;
8
+ title: string;
9
+ }
10
+ export interface OrderProductsDepositSummary {
11
+ total: number;
12
+ totalText: string;
13
+ protocols: OrderProductsDepositProtocol[];
14
+ deposit_policy_ids: number[];
15
+ hasDeposit: boolean;
16
+ }
6
17
  /**
7
18
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
8
19
  *
@@ -53,6 +64,15 @@ export declare function sumOptionUnitPrice(options?: Array<{
53
64
  price?: any;
54
65
  num?: any;
55
66
  }> | null): Decimal;
67
+ /**
68
+ * 仅基于 tempOrder.products 重算整单定金。
69
+ *
70
+ * 对齐 Checkout relation_products 分支:商品定金先按商品规则计算,
71
+ * 再扣减商品券/折扣卡抵扣金额;tempOrder.bookings 不参与这里的计算。
72
+ */
73
+ export declare function calculateOrderProductsDeposit(products?: OrderProduct[], options?: {
74
+ productsByUid?: Record<string, Record<string, any>>;
75
+ }): OrderProductsDepositSummary;
56
76
  /**
57
77
  * 判定套餐子商品是否为 markdown(减价)类型。
58
78
  * 与后端口径一致:price_type='markdown' 且 price_type_ext 非 'product_price'(原价子商品)。
@@ -31,6 +31,7 @@ var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  buildManualProductDiscountItem: () => import_manualProductDiscount.buildManualProductDiscountItem,
33
33
  buildSubmitPayload: () => buildSubmitPayload,
34
+ calculateOrderProductsDeposit: () => calculateOrderProductsDeposit,
34
35
  clearTempOrderHolderAssignments: () => clearTempOrderHolderAssignments,
35
36
  composeLinePrice: () => composeLinePrice,
36
37
  createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
@@ -131,6 +132,175 @@ function sumOptionUnitPrice(options) {
131
132
  }
132
133
  return total;
133
134
  }
135
+ function getSafeOrderProductNum(num) {
136
+ const parsedNum = Number(num ?? 1);
137
+ if (!Number.isFinite(parsedNum) || parsedNum < 1)
138
+ return 1;
139
+ return Math.floor(parsedNum);
140
+ }
141
+ function getOrderProductDepositUnitTotal(product) {
142
+ const metadata = product.metadata || {};
143
+ const paymentPrice = metadata.main_product_attached_bundle_payment_price;
144
+ const mainSellingPrice = metadata.main_product_selling_price;
145
+ const fallbackPrice = product.selling_price;
146
+ return new import_decimal.default(Number(paymentPrice ?? mainSellingPrice ?? fallbackPrice) || 0);
147
+ }
148
+ function normalizeDepositProtocols(protocols) {
149
+ if (!Array.isArray(protocols))
150
+ return [];
151
+ return protocols.reduce((result, protocol) => {
152
+ const id = Number(protocol == null ? void 0 : protocol.id);
153
+ if (!Number.isFinite(id))
154
+ return result;
155
+ result.push({
156
+ id: Math.floor(id),
157
+ title: String((protocol == null ? void 0 : protocol.title) || "")
158
+ });
159
+ return result;
160
+ }, []);
161
+ }
162
+ function getDepositPolicyIds(depositData) {
163
+ const ids = [
164
+ ...Array.isArray(depositData == null ? void 0 : depositData.self_deposit_policy_ids) ? depositData.self_deposit_policy_ids : [],
165
+ ...Array.isArray(depositData == null ? void 0 : depositData.deposit_policy_ids) ? depositData.deposit_policy_ids : []
166
+ ];
167
+ return ids.reduce((result, id) => {
168
+ const normalizedId = Number(id);
169
+ if (!Number.isFinite(normalizedId))
170
+ return result;
171
+ result.push(Math.floor(normalizedId));
172
+ return result;
173
+ }, []);
174
+ }
175
+ function handleOrderProductDeposit(params) {
176
+ const { depositData, total, num } = params;
177
+ if (!depositData)
178
+ return { result: false, depositTotal: new import_decimal.default(0) };
179
+ const { deposit_fixed, deposit_percentage } = depositData;
180
+ if (typeof deposit_fixed !== "string" || typeof deposit_percentage !== "string") {
181
+ return { result: false, depositTotal: new import_decimal.default(0) };
182
+ }
183
+ const depositFixed = new import_decimal.default(deposit_fixed || 0);
184
+ const depositPercent = new import_decimal.default(deposit_percentage || 0);
185
+ const productTotalPrice = new import_decimal.default(total || 0);
186
+ const deposit = depositFixed.plus(depositPercent.times(productTotalPrice));
187
+ return { depositTotal: deposit.times(num), result: true };
188
+ }
189
+ function resolveOrderProductDepositSource(product, runtimeOrigin) {
190
+ const record = product;
191
+ const origin = record._origin || runtimeOrigin || {};
192
+ const originProduct = origin.product || {};
193
+ return {
194
+ ...originProduct,
195
+ ...origin,
196
+ ...record,
197
+ custom_deposit_data: record.custom_deposit_data ?? origin.custom_deposit_data ?? originProduct.custom_deposit_data,
198
+ variant: record.variant ?? origin.variant ?? originProduct.variant
199
+ };
200
+ }
201
+ function getOrderProductDeposit(product, runtimeOrigin) {
202
+ const depositProduct = resolveOrderProductDepositSource(product, runtimeOrigin);
203
+ const depositData = depositProduct.custom_deposit_data;
204
+ if ((depositData == null ? void 0 : depositData.has_deposit) != 1)
205
+ return null;
206
+ const num = getSafeOrderProductNum(product.num);
207
+ const total = getOrderProductDepositUnitTotal(product).times(num);
208
+ const allProtocols = normalizeDepositProtocols(depositData.deposit_policy_data);
209
+ const protocolIds = [];
210
+ let depositTotal = new import_decimal.default(0);
211
+ let hasDeposit = false;
212
+ if (typeof depositData.deposit_fixed === "string" && typeof depositData.deposit_percentage === "string") {
213
+ const result = handleOrderProductDeposit({
214
+ depositData,
215
+ total,
216
+ num
217
+ });
218
+ if (result.result) {
219
+ depositTotal = result.depositTotal;
220
+ protocolIds.push(...getDepositPolicyIds({
221
+ self_deposit_policy_ids: depositData.self_deposit_policy_ids
222
+ }));
223
+ hasDeposit = true;
224
+ }
225
+ } else {
226
+ const productVariantId = depositProduct.product_variant_id ?? product.product_variant_id;
227
+ if (productVariantId) {
228
+ const variantProduct = (depositProduct.variant || []).find(
229
+ (item) => (item == null ? void 0 : item.id) === productVariantId
230
+ );
231
+ const variantDepositData = variantProduct == null ? void 0 : variantProduct.custom_deposit_data;
232
+ const result = handleOrderProductDeposit({
233
+ depositData: variantDepositData,
234
+ total,
235
+ num
236
+ });
237
+ if (result.result) {
238
+ depositTotal = result.depositTotal;
239
+ protocolIds.push(...getDepositPolicyIds({
240
+ self_deposit_policy_ids: variantDepositData == null ? void 0 : variantDepositData.self_deposit_policy_ids
241
+ }));
242
+ hasDeposit = true;
243
+ }
244
+ }
245
+ if (Array.isArray(product.product_bundle) && product.product_bundle.length) {
246
+ depositTotal = product.product_bundle.reduce((accumulator, bundleProduct) => {
247
+ const bundleDepositData = bundleProduct == null ? void 0 : bundleProduct.custom_deposit_data;
248
+ const result = handleOrderProductDeposit({
249
+ depositData: bundleDepositData,
250
+ total: bundleProduct == null ? void 0 : bundleProduct.price,
251
+ num: getSafeOrderProductNum((bundleProduct == null ? void 0 : bundleProduct.num) || 1)
252
+ });
253
+ if (!result.result)
254
+ return accumulator;
255
+ protocolIds.push(...getDepositPolicyIds({
256
+ self_deposit_policy_ids: bundleDepositData == null ? void 0 : bundleDepositData.self_deposit_policy_ids
257
+ }));
258
+ hasDeposit = true;
259
+ return accumulator.plus(result.depositTotal);
260
+ }, new import_decimal.default(0));
261
+ }
262
+ }
263
+ if (!hasDeposit)
264
+ return null;
265
+ const protocolIdSet = new Set(protocolIds);
266
+ const protocols = allProtocols.filter((protocol) => protocolIdSet.has(protocol.id));
267
+ return {
268
+ total: depositTotal.toNumber(),
269
+ protocols
270
+ };
271
+ }
272
+ function calculateOrderProductsDeposit(products = [], options) {
273
+ var _a, _b, _c;
274
+ const protocolMap = /* @__PURE__ */ new Map();
275
+ let total = new import_decimal.default(0);
276
+ let hasDeposit = false;
277
+ for (const product of products || []) {
278
+ const productUid = (_a = product.metadata) == null ? void 0 : _a.unique_identification_number;
279
+ const runtimeOrigin = productUid ? (_c = (_b = options == null ? void 0 : options.productsByUid) == null ? void 0 : _b[productUid]) == null ? void 0 : _c.origin : void 0;
280
+ const deposit = getOrderProductDeposit(product, runtimeOrigin);
281
+ product.deposit = deposit;
282
+ if (!(deposit == null ? void 0 : deposit.total) || Number(deposit.total) <= 0)
283
+ continue;
284
+ total = total.plus(deposit.total);
285
+ for (const discount of product.discount_list || []) {
286
+ total = total.minus((discount == null ? void 0 : discount.amount) || 0);
287
+ }
288
+ for (const protocol of deposit.protocols || []) {
289
+ if (!protocolMap.has(protocol.id))
290
+ protocolMap.set(protocol.id, protocol);
291
+ }
292
+ hasDeposit = true;
293
+ }
294
+ const roundedTotal = total.toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP);
295
+ const protocols = [...protocolMap.values()];
296
+ return {
297
+ total: roundedTotal.toNumber(),
298
+ totalText: roundedTotal.toFixed(2),
299
+ protocols,
300
+ deposit_policy_ids: protocols.map((protocol) => protocol.id),
301
+ hasDeposit
302
+ };
303
+ }
134
304
  function isMarkdownBundle(bundle) {
135
305
  if (!bundle || typeof bundle !== "object")
136
306
  return false;
@@ -985,6 +1155,7 @@ function indexOrderProductsByUid(products) {
985
1155
  0 && (module.exports = {
986
1156
  buildManualProductDiscountItem,
987
1157
  buildSubmitPayload,
1158
+ calculateOrderProductsDeposit,
988
1159
  clearTempOrderHolderAssignments,
989
1160
  composeLinePrice,
990
1161
  createDefaultOrderRulesHooks,
@@ -1188,6 +1188,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1188
1188
  "status",
1189
1189
  "shipping_status",
1190
1190
  "updated_at",
1191
+ "shop_discount",
1191
1192
  "summary",
1192
1193
  "payments",
1193
1194
  "products",
@@ -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 | 1 | 2 | 3 | 6 | 5 | 4;
314
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.235",
4
+ "version": "2.2.236",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",