@pisell/pisellos 2.1.160 → 2.1.162
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/Discount/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +0 -1
- package/dist/modules/Order/index.js +1 -18
- package/dist/modules/Order/types.d.ts +0 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Product/types.d.ts +0 -7
- package/dist/modules/Rules/index.js +13 -0
- package/dist/modules/Summary/utils.js +42 -21
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.d.ts +0 -15
- package/dist/solution/BookingByStep/index.js +204 -276
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/ScanOrder/index.js +1 -1
- package/dist/solution/ScanOrder/types.d.ts +0 -1
- package/dist/solution/VenueBooking/index.d.ts +0 -19
- package/dist/solution/VenueBooking/index.js +733 -963
- package/dist/solution/VenueBooking/types.d.ts +0 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/modules/Discount/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +0 -1
- package/lib/modules/Order/index.js +0 -14
- package/lib/modules/Order/types.d.ts +0 -2
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Product/types.d.ts +0 -7
- package/lib/modules/Rules/index.js +8 -0
- package/lib/modules/Summary/utils.js +23 -3
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.d.ts +0 -15
- package/lib/solution/BookingByStep/index.js +0 -39
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/ScanOrder/index.js +1 -1
- package/lib/solution/ScanOrder/types.d.ts +0 -1
- package/lib/solution/VenueBooking/index.d.ts +0 -19
- package/lib/solution/VenueBooking/index.js +16 -134
- package/lib/solution/VenueBooking/types.d.ts +0 -2
- package/lib/types/index.d.ts +0 -1
- package/package.json +2 -2
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
|
@@ -33,6 +33,8 @@ interface Limitedrelationproductdata {
|
|
|
33
33
|
product_ids: number[];
|
|
34
34
|
product_collection_id: number[];
|
|
35
35
|
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
36
|
+
exclude_product_ids?: number[];
|
|
37
|
+
filter?: 0 | 1;
|
|
36
38
|
}
|
|
37
39
|
interface ApplicableProductDetails {
|
|
38
40
|
amount: string;
|
|
@@ -57,7 +57,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
57
57
|
private getTempOrderStorageKey;
|
|
58
58
|
private restoreTempOrderFromStorage;
|
|
59
59
|
persistTempOrder(): void;
|
|
60
|
-
notifyTempOrderChanged(): void;
|
|
61
60
|
private createDefaultTempOrderInstance;
|
|
62
61
|
ensureTempOrder(): ScanOrderTempOrder;
|
|
63
62
|
restoreOrder(): ScanOrderTempOrder;
|
|
@@ -25,7 +25,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
25
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
26
26
|
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); }
|
|
27
27
|
import { BaseModule } from "../BaseModule";
|
|
28
|
-
import { generateDuration, getAllDiscountList, mergeRelationForms,
|
|
28
|
+
import { generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, filterProductsForScanOrderMore, isTempOrder } from "./utils";
|
|
29
29
|
import { isNormalProduct } from "../Product/utils";
|
|
30
30
|
import dayjs from 'dayjs';
|
|
31
31
|
import { buildProductLineFingerprint, getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
|
|
@@ -439,16 +439,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
439
439
|
if (!this.window) return;
|
|
440
440
|
this.window.localStorage.setItem(key, JSON.stringify(this.store.tempOrder));
|
|
441
441
|
}
|
|
442
|
-
}, {
|
|
443
|
-
key: "notifyTempOrderChanged",
|
|
444
|
-
value: function notifyTempOrderChanged() {
|
|
445
|
-
if (!this.store.tempOrder) return;
|
|
446
|
-
this.store.tempOrder = _objectSpread(_objectSpread({}, this.store.tempOrder), {}, {
|
|
447
|
-
products: _toConsumableArray(this.store.tempOrder.products),
|
|
448
|
-
bookings: this.store.tempOrder.bookings ? _toConsumableArray(this.store.tempOrder.bookings) : []
|
|
449
|
-
});
|
|
450
|
-
this.persistTempOrder();
|
|
451
|
-
}
|
|
452
442
|
|
|
453
443
|
// ─── TempOrder: 创建 & 获取 ───
|
|
454
444
|
}, {
|
|
@@ -870,7 +860,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
870
860
|
}, {
|
|
871
861
|
key: "createOrder",
|
|
872
862
|
value: function createOrder(params) {
|
|
873
|
-
var _this2 = this;
|
|
874
863
|
var order = _objectSpread({
|
|
875
864
|
type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
|
|
876
865
|
// 要从外面拿,virtual
|
|
@@ -888,7 +877,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
888
877
|
var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
|
|
889
878
|
if (params.cartItems.length > 0) {
|
|
890
879
|
params.cartItems.forEach(function (item) {
|
|
891
|
-
var _params$extraData;
|
|
892
880
|
if (!item._origin.duration) {
|
|
893
881
|
var _generateDuration = generateDuration(item),
|
|
894
882
|
duration = _generateDuration.duration,
|
|
@@ -899,11 +887,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
899
887
|
var discountList = getAllDiscountList(item);
|
|
900
888
|
item._origin.product.discount_list = discountList;
|
|
901
889
|
|
|
902
|
-
// 为预约补齐 holder 信息
|
|
903
|
-
if (params !== null && params !== void 0 && (_params$extraData = params.extraData) !== null && _params$extraData !== void 0 && _params$extraData.is_add_holder_info) {
|
|
904
|
-
ensureCartItemOriginHolder(item, _this2.window);
|
|
905
|
-
}
|
|
906
|
-
|
|
907
890
|
// 购物车是否为普通商品
|
|
908
891
|
if (isNormalProduct(item._origin)) {
|
|
909
892
|
var _order$relation_forms;
|
|
@@ -235,8 +235,6 @@ export interface OrderModuleAPI {
|
|
|
235
235
|
updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<ScanOrderOrderProduct[]>;
|
|
236
236
|
removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
|
|
237
237
|
persistTempOrder: () => void;
|
|
238
|
-
/** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
|
|
239
|
-
notifyTempOrderChanged: () => void;
|
|
240
238
|
submitTempOrder: <T = any>(params?: {
|
|
241
239
|
cacheId?: string;
|
|
242
240
|
platform?: string;
|
|
@@ -2,7 +2,6 @@ import Decimal from 'decimal.js';
|
|
|
2
2
|
import { CartItem } from "../Cart";
|
|
3
3
|
import type { ScanOrderSubmitPayload, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
|
|
4
4
|
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
|
-
import type { WindowPlugin } from '../../plugins';
|
|
6
5
|
/**
|
|
7
6
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
8
7
|
*
|
|
@@ -87,15 +86,6 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
87
86
|
form_id: number;
|
|
88
87
|
form_record_ids: number[];
|
|
89
88
|
}[];
|
|
90
|
-
export interface CartOrderHolder {
|
|
91
|
-
customer_id?: number;
|
|
92
|
-
form_id: number | string;
|
|
93
|
-
form_record: (number | string)[] | null;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
97
|
-
*/
|
|
98
|
-
export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
|
|
99
89
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
100
90
|
export declare function createUuidV4(): string;
|
|
101
91
|
export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
|
|
@@ -18,7 +18,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
18
18
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
19
|
import dayjs from "dayjs";
|
|
20
20
|
import Decimal from 'decimal.js';
|
|
21
|
-
import { getProductHolderConfig } from "../Holder/utils";
|
|
22
21
|
import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
23
22
|
/**
|
|
24
23
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
@@ -260,41 +259,10 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
|
|
|
260
259
|
return item.form_record_ids.length > 0;
|
|
261
260
|
}); // 过滤掉没有有效记录的表单
|
|
262
261
|
};
|
|
263
|
-
function getCustomerIdFromStorage(window) {
|
|
264
|
-
try {
|
|
265
|
-
var _window$getLocalStora;
|
|
266
|
-
var customer = JSON.parse((window === null || window === void 0 || (_window$getLocalStora = window.getLocalStorage) === null || _window$getLocalStora === void 0 ? void 0 : _window$getLocalStora.call(window, 'customer')) || '{}');
|
|
267
|
-
var customerId = Number(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
268
|
-
return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
|
|
269
|
-
} catch (_unused) {
|
|
270
|
-
return undefined;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
276
|
-
*/
|
|
277
|
-
export function ensureCartItemOriginHolder(cartItem, window) {
|
|
278
|
-
var _cartItem$_origin, _cartItem$_productIni;
|
|
279
|
-
if (cartItem !== null && cartItem !== void 0 && (_cartItem$_origin = cartItem._origin) !== null && _cartItem$_origin !== void 0 && _cartItem$_origin.holder) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
var holderConfig = getProductHolderConfig((_cartItem$_productIni = cartItem === null || cartItem === void 0 ? void 0 : cartItem._productInit) !== null && _cartItem$_productIni !== void 0 ? _cartItem$_productIni : cartItem === null || cartItem === void 0 ? void 0 : cartItem._productOrigin);
|
|
283
|
-
var formRecordId = cartItem === null || cartItem === void 0 ? void 0 : cartItem.holder_id;
|
|
284
|
-
if (!(holderConfig !== null && holderConfig !== void 0 && holderConfig.resource_id) || formRecordId == null) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
cartItem._origin.holder = {
|
|
288
|
-
customer_id: getCustomerIdFromStorage(window),
|
|
289
|
-
form_id: holderConfig.resource_id,
|
|
290
|
-
form_record: [formRecordId]
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
;
|
|
294
262
|
export var getAllDiscountList = function getAllDiscountList(cartItem) {
|
|
295
|
-
var _cartItem$
|
|
296
|
-
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$
|
|
297
|
-
((cartItem === null || cartItem === void 0 || (_cartItem$
|
|
263
|
+
var _cartItem$_origin, _cartItem$_origin2;
|
|
264
|
+
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin = cartItem._origin) === null || _cartItem$_origin === void 0 || (_cartItem$_origin = _cartItem$_origin.product) === null || _cartItem$_origin === void 0 ? void 0 : _cartItem$_origin.discount_list) || [];
|
|
265
|
+
((cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.product_bundle) || []).forEach(function (item) {
|
|
298
266
|
discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
299
267
|
item.discount_list = undefined;
|
|
300
268
|
});
|
|
@@ -189,13 +189,6 @@ export interface ProductData {
|
|
|
189
189
|
};
|
|
190
190
|
/** 购物车行键,用于唯一标识购物车中的商品,用于相同 SKU商品合并 */
|
|
191
191
|
rowKey?: string;
|
|
192
|
-
/** holder 表单配置 */
|
|
193
|
-
holder_config?: {
|
|
194
|
-
required?: number;
|
|
195
|
-
resource_id?: number;
|
|
196
|
-
status?: string;
|
|
197
|
-
[key: string]: any;
|
|
198
|
-
};
|
|
199
192
|
}
|
|
200
193
|
/**
|
|
201
194
|
* 商品媒体信息接口
|
|
@@ -538,6 +538,15 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
538
538
|
return priceB.minus(priceA).toNumber();
|
|
539
539
|
});
|
|
540
540
|
|
|
541
|
+
// 检查商品是否被排除(全品类)
|
|
542
|
+
var isProductIncludedByLimitedData = function isProductIncludedByLimitedData(limitedData, productId) {
|
|
543
|
+
var excludedIds = (limitedData === null || limitedData === void 0 ? void 0 : limitedData.exclude_product_ids) || [];
|
|
544
|
+
var isExcluded = (limitedData === null || limitedData === void 0 ? void 0 : limitedData.filter) === 1 && excludedIds.some(function (id) {
|
|
545
|
+
return String(id) === String(productId);
|
|
546
|
+
});
|
|
547
|
+
return !isExcluded;
|
|
548
|
+
};
|
|
549
|
+
|
|
541
550
|
/**
|
|
542
551
|
// 对productList按价格降序排序(用于应用优惠券时优先选择高价商品) 价格相同时使用quantity 排序
|
|
543
552
|
const sortedProductList = [...productList].sort((a, b) => {
|
|
@@ -926,6 +935,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
926
935
|
|
|
927
936
|
// 判断优惠券是否适用于该商品
|
|
928
937
|
if (limitedData.type === 'product_all') {
|
|
938
|
+
if (!isProductIncludedByLimitedData(limitedData, product.id)) {
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
|
|
929
942
|
// 检查 package_sub_item_usage_rules
|
|
930
943
|
if (!_this3.checkPackageSubItemUsageRules(discount, flatItem)) {
|
|
931
944
|
return false;
|
|
@@ -595,6 +595,27 @@ export var calculateTaxFee = function calculateTaxFee(shopInfo, items) {
|
|
|
595
595
|
}, new Decimal(0));
|
|
596
596
|
return totalTaxFee;
|
|
597
597
|
};
|
|
598
|
+
var getCartItemDepositData = function getCartItemDepositData(item) {
|
|
599
|
+
var _target$_productOrigi, _target$_origin, _target$_origin2;
|
|
600
|
+
var target = item;
|
|
601
|
+
return (target === null || target === void 0 || (_target$_productOrigi = target._productOrigin) === null || _target$_productOrigi === void 0 ? void 0 : _target$_productOrigi.custom_deposit_data) || (target === null || target === void 0 || (_target$_origin = target._origin) === null || _target$_origin === void 0 ? void 0 : _target$_origin.custom_deposit_data) || (target === null || target === void 0 || (_target$_origin2 = target._origin) === null || _target$_origin2 === void 0 || (_target$_origin2 = _target$_origin2.product) === null || _target$_origin2 === void 0 ? void 0 : _target$_origin2.custom_deposit_data);
|
|
602
|
+
};
|
|
603
|
+
var getCartItemQuantity = function getCartItemQuantity(item) {
|
|
604
|
+
return new Decimal((item === null || item === void 0 ? void 0 : item.num) || 1);
|
|
605
|
+
};
|
|
606
|
+
var calculateCartItemDepositTotal = function calculateCartItemDepositTotal(item) {
|
|
607
|
+
var _item$deposit;
|
|
608
|
+
var depositData = getCartItemDepositData(item);
|
|
609
|
+
if ((depositData === null || depositData === void 0 ? void 0 : depositData.has_deposit) == 1 && typeof (depositData === null || depositData === void 0 ? void 0 : depositData.deposit_fixed) === 'string' && typeof (depositData === null || depositData === void 0 ? void 0 : depositData.deposit_percentage) === 'string') {
|
|
610
|
+
var _ref7, _summaryTotal;
|
|
611
|
+
var lineTotal = new Decimal((_ref7 = (_summaryTotal = item.summaryTotal) !== null && _summaryTotal !== void 0 ? _summaryTotal : item.total) !== null && _ref7 !== void 0 ? _ref7 : 0);
|
|
612
|
+
var quantity = getCartItemQuantity(item);
|
|
613
|
+
var fixedTotal = new Decimal(depositData.deposit_fixed || 0).times(quantity);
|
|
614
|
+
var percentageTotal = new Decimal(depositData.deposit_percentage || 0).times(lineTotal);
|
|
615
|
+
return fixedTotal.plus(percentageTotal);
|
|
616
|
+
}
|
|
617
|
+
return new Decimal((item === null || item === void 0 || (_item$deposit = item.deposit) === null || _item$deposit === void 0 ? void 0 : _item$deposit.total) || 0);
|
|
618
|
+
};
|
|
598
619
|
|
|
599
620
|
/**
|
|
600
621
|
* @title: 计算定金
|
|
@@ -609,9 +630,9 @@ export var calculateDeposit = function calculateDeposit(items) {
|
|
|
609
630
|
var hasDeposit = false;
|
|
610
631
|
var total = items.reduce(function (sum, item) {
|
|
611
632
|
if (item !== null && item !== void 0 && item.deposit) {
|
|
612
|
-
var _item$
|
|
633
|
+
var _item$deposit2;
|
|
613
634
|
hasDeposit = true;
|
|
614
|
-
var cartItemTotalPrice =
|
|
635
|
+
var cartItemTotalPrice = calculateCartItemDepositTotal(item);
|
|
615
636
|
// 将协议数据去重合并
|
|
616
637
|
item === null || item === void 0 || (_item$deposit2 = item.deposit) === null || _item$deposit2 === void 0 || (_item$deposit2 = _item$deposit2.protocols) === null || _item$deposit2 === void 0 || _item$deposit2.forEach(function (protocol) {
|
|
617
638
|
if (protocols.findIndex(function (p) {
|
|
@@ -648,9 +669,9 @@ export var calculateDeposit = function calculateDeposit(items) {
|
|
|
648
669
|
* @param options.isEdit 是否处于“编辑中”。`false` 时会优先走后端金额直取逻辑(若存在)
|
|
649
670
|
* @returns 订单附加费金额(number,金额单位与商品价格一致)
|
|
650
671
|
*/
|
|
651
|
-
export var getSurchargeAmount = function getSurchargeAmount(
|
|
652
|
-
var bookingDetail =
|
|
653
|
-
bookingId =
|
|
672
|
+
export var getSurchargeAmount = function getSurchargeAmount(_ref8, surcharge, options) {
|
|
673
|
+
var bookingDetail = _ref8.bookingDetail,
|
|
674
|
+
bookingId = _ref8.bookingId;
|
|
654
675
|
var isEdit = options.isEdit;
|
|
655
676
|
// 订单未变更过
|
|
656
677
|
if (!isEdit) {
|
|
@@ -695,17 +716,17 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
|
695
716
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
696
717
|
*/
|
|
697
718
|
var getMainProductTotal = function getMainProductTotal(item) {
|
|
698
|
-
var
|
|
719
|
+
var _ref9, _ref10, _item$main_product_se, _item$metadata, _item$metadata2, _item$metadata3, _item$metadata4;
|
|
699
720
|
// 新语义 v2 下 `main_product_selling_price` / `metadata.main_product_selling_price`
|
|
700
721
|
// 已经是"含 option、含主商品折扣"的主价,直接作为主商品基准,无需再减折扣或加 option。
|
|
701
722
|
// 仅需叠加 markup / markdown 类 bundle(原价 bundle 的税费单独处理)。
|
|
702
|
-
var total = new Decimal((
|
|
723
|
+
var total = new Decimal((_ref9 = (_ref10 = (_item$main_product_se = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se !== void 0 ? _item$main_product_se : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.main_product_selling_price) !== null && _ref10 !== void 0 ? _ref10 : item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.main_product_original_price) !== null && _ref9 !== void 0 ? _ref9 : 0);
|
|
703
724
|
|
|
704
725
|
// 做个兜底 如果新语义价格字段都没有,则切换回老逻辑
|
|
705
726
|
var hasMainProductPrice = (item === null || item === void 0 ? void 0 : item.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.main_product_original_price) != null;
|
|
706
727
|
if (!hasMainProductPrice) {
|
|
707
|
-
var
|
|
708
|
-
total = new Decimal((
|
|
728
|
+
var _ref11, _ref12, _item$main_product_se2, _item$metadata5, _item$_origin3, _item$_originData;
|
|
729
|
+
total = new Decimal((_ref11 = (_ref12 = (_item$main_product_se2 = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se2 !== void 0 ? _item$main_product_se2 : item === null || item === void 0 || (_item$metadata5 = item.metadata) === null || _item$metadata5 === void 0 ? void 0 : _item$metadata5.main_product_selling_price) !== null && _ref12 !== void 0 ? _ref12 : item.price) !== null && _ref11 !== void 0 ? _ref11 : 0);
|
|
709
730
|
var discount = (item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.discount_list) || (item === null || item === void 0 || (_item$_originData = item._originData) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.product) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.discount_list) === null || _item$_originData === void 0 ? void 0 : _item$_originData.filter(function (item) {
|
|
710
731
|
var _item$metadata6;
|
|
711
732
|
return !(item !== null && item !== void 0 && (_item$metadata6 = item.metadata) !== null && _item$metadata6 !== void 0 && _item$metadata6.custom_product_bundle_map_id);
|
|
@@ -726,9 +747,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
726
747
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
727
748
|
var bundleItem = _step4.value;
|
|
728
749
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
729
|
-
var
|
|
750
|
+
var _ref13, _bundleItem$bundle_se2;
|
|
730
751
|
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
731
|
-
var bundleItemTotal = new Decimal((
|
|
752
|
+
var bundleItemTotal = new Decimal((_ref13 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref13 !== void 0 ? _ref13 : 0);
|
|
732
753
|
total = total.add(bundleItemTotal);
|
|
733
754
|
}
|
|
734
755
|
}
|
|
@@ -848,12 +869,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
848
869
|
* @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
|
|
849
870
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
850
871
|
*/
|
|
851
|
-
export var getSurcharge = function getSurcharge(
|
|
872
|
+
export var getSurcharge = function getSurcharge(_ref14, options) {
|
|
852
873
|
var _service$filter;
|
|
853
|
-
var service =
|
|
854
|
-
addons =
|
|
855
|
-
bookingDetail =
|
|
856
|
-
bookingId =
|
|
874
|
+
var service = _ref14.service,
|
|
875
|
+
addons = _ref14.addons,
|
|
876
|
+
bookingDetail = _ref14.bookingDetail,
|
|
877
|
+
bookingId = _ref14.bookingId;
|
|
857
878
|
var isEdit = options.isEdit,
|
|
858
879
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
859
880
|
surcharge_list = options.surcharge_list,
|
|
@@ -975,11 +996,11 @@ export var getSurcharge = function getSurcharge(_ref13, options) {
|
|
|
975
996
|
scheduleById: scheduleById || {},
|
|
976
997
|
isInScheduleByDate: isInScheduleByDate
|
|
977
998
|
})) {
|
|
978
|
-
var
|
|
999
|
+
var _ref15, _bundleItem$bundle_se3;
|
|
979
1000
|
var _mainQuantity = item.num || 1;
|
|
980
1001
|
matchedItems.push({
|
|
981
1002
|
isMain: false,
|
|
982
|
-
total: Number((
|
|
1003
|
+
total: Number((_ref15 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref15 !== void 0 ? _ref15 : 0),
|
|
983
1004
|
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
984
1005
|
item: bundleItem,
|
|
985
1006
|
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
@@ -1195,9 +1216,9 @@ export var getSurcharge = function getSurcharge(_ref13, options) {
|
|
|
1195
1216
|
}
|
|
1196
1217
|
return surchargeWithAmount;
|
|
1197
1218
|
};
|
|
1198
|
-
function resetItemsSurchargeSideEffects(
|
|
1199
|
-
var service =
|
|
1200
|
-
addons =
|
|
1219
|
+
function resetItemsSurchargeSideEffects(_ref16) {
|
|
1220
|
+
var service = _ref16.service,
|
|
1221
|
+
addons = _ref16.addons;
|
|
1201
1222
|
var resetItem = function resetItem(item) {
|
|
1202
1223
|
if (!item) return;
|
|
1203
1224
|
item.surcharge_fee = 0;
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
package/dist/plugins/window.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { ITime } from '../../modules/Date/types';
|
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
12
12
|
import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
|
|
13
|
-
import { IAppendFormRecordParams } from '../../modules/Holder/types';
|
|
14
13
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
15
14
|
protected defaultName: string;
|
|
16
15
|
protected defaultVersion: string;
|
|
@@ -127,20 +126,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
127
126
|
* @param params
|
|
128
127
|
*/
|
|
129
128
|
fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* 获取 holder 表单 map
|
|
132
|
-
*/
|
|
133
|
-
getHolderFormMap(): import("../../modules").HolderFormMap;
|
|
134
|
-
/**
|
|
135
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
136
|
-
*/
|
|
137
|
-
refreshAllHolderFormRecords(params?: {
|
|
138
|
-
customer_id?: number;
|
|
139
|
-
}): Promise<import("../../modules").HolderFormMap>;
|
|
140
|
-
/**
|
|
141
|
-
* 添加表单记录
|
|
142
|
-
*/
|
|
143
|
-
appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
|
|
144
129
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
145
130
|
clearDateRange(): void;
|
|
146
131
|
getDateRange(): Promise<ITime[]>;
|