@pisell/pisellos 2.2.167 → 2.2.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +51 -15
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +11 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +26 -2
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +122 -77
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +5 -10
- package/dist/modules/Order/index.js +53 -9
- package/dist/modules/Order/types.d.ts +8 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +212 -0
- package/dist/modules/Order/utils.d.ts +4 -0
- package/dist/modules/Order/utils.js +25 -10
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +26 -10
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/solution/BaseSales/index.js +11 -5
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +37 -6
- package/dist/solution/BaseSales/utils.js +11 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +9 -0
- package/dist/solution/BookingTicket/index.js +372 -192
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/dist/solution/ScanOrder/utils.js +11 -2
- package/dist/solution/VenueBooking/index.d.ts +1 -6
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +42 -9
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +11 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +22 -1
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +18 -3
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +5 -10
- package/lib/modules/Order/index.js +52 -5
- package/lib/modules/Order/types.d.ts +8 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils.d.ts +4 -0
- package/lib/modules/Order/utils.js +46 -10
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +22 -14
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/solution/BaseSales/index.js +6 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +42 -4
- package/lib/solution/BaseSales/utils.js +10 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +9 -0
- package/lib/solution/BookingTicket/index.js +78 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/lib/solution/ScanOrder/utils.js +10 -2
- package/lib/solution/VenueBooking/index.d.ts +1 -6
- package/package.json +1 -1
|
@@ -222,6 +222,22 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
222
222
|
return item.type === type || item.tag === type;
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
+
|
|
226
|
+
/** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
|
|
227
|
+
}, {
|
|
228
|
+
key: "excludeDiscountListByType",
|
|
229
|
+
value: function excludeDiscountListByType(discountList, type) {
|
|
230
|
+
return (discountList || []).filter(function (item) {
|
|
231
|
+
return item.type !== type && item.tag !== type;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
236
|
+
}, {
|
|
237
|
+
key: "resolveDiscountListForManualOverride",
|
|
238
|
+
value: function resolveDiscountListForManualOverride(discountList) {
|
|
239
|
+
return this.excludeDiscountListByType(discountList, 'promotion');
|
|
240
|
+
}
|
|
225
241
|
// 获取券不可用的原因
|
|
226
242
|
}, {
|
|
227
243
|
key: "getUnavailableReason",
|
|
@@ -1208,7 +1224,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1208
1224
|
price: product.price,
|
|
1209
1225
|
options: restoredOptions
|
|
1210
1226
|
}), {}, {
|
|
1211
|
-
discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1227
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(product.discount_list) : _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1212
1228
|
}))]);
|
|
1213
1229
|
} else {
|
|
1214
1230
|
var _ref13, _product$_promotion$f, _product13, _product$origin_total;
|
|
@@ -1231,14 +1247,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1231
1247
|
main_product_selling_price: main_product_selling_price,
|
|
1232
1248
|
options: restoredOptions
|
|
1233
1249
|
}), {}, {
|
|
1234
|
-
discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1250
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(product.discount_list) : _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1235
1251
|
}))]);
|
|
1236
1252
|
}
|
|
1237
1253
|
} else {
|
|
1238
|
-
var _flatItem$bundleItem8;
|
|
1254
|
+
var _flatItem$bundleItem8, _flatItem$bundleItem9;
|
|
1239
1255
|
// bundle子商品:保存到扁平化Map
|
|
1240
1256
|
processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1241
|
-
discount_list: _this3.
|
|
1257
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(((_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.discount_list) || []) : _this3.filterDiscountListByType(((_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.discount_list) || [], 'promotion'),
|
|
1242
1258
|
price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
1243
1259
|
processed: true
|
|
1244
1260
|
})]);
|
|
@@ -2069,10 +2085,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2069
2085
|
return true; // 单独购买时可用
|
|
2070
2086
|
}
|
|
2071
2087
|
if (isBundleItem) {
|
|
2072
|
-
var _flatItem$
|
|
2088
|
+
var _flatItem$bundleItem10, _flatItem$bundleItem11, _flatItem$originProdu, _flatItem$parentProdu10;
|
|
2073
2089
|
// 套餐中购买时,判断是否为原价
|
|
2074
|
-
var priceType = (_flatItem$
|
|
2075
|
-
var priceTypeExt = (_flatItem$
|
|
2090
|
+
var priceType = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type;
|
|
2091
|
+
var priceTypeExt = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type_ext;
|
|
2076
2092
|
// 主商品id
|
|
2077
2093
|
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 || (_flatItem$originProdu = _flatItem$originProdu._productOrigin) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.id) || (flatItem === null || flatItem === void 0 || (_flatItem$parentProdu10 = flatItem.parentProduct) === null || _flatItem$parentProdu10 === void 0 ? void 0 : _flatItem$parentProdu10.id) || 0;
|
|
2078
2094
|
// original_price 对应:
|
|
@@ -2139,10 +2155,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2139
2155
|
return false; // 单独购买时不可用
|
|
2140
2156
|
}
|
|
2141
2157
|
if (isBundleItem) {
|
|
2142
|
-
var _flatItem$
|
|
2158
|
+
var _flatItem$bundleItem12, _flatItem$bundleItem13;
|
|
2143
2159
|
// 套餐中购买时,判断是否为原价
|
|
2144
|
-
var _priceType = (_flatItem$
|
|
2145
|
-
var _priceTypeExt = (_flatItem$
|
|
2160
|
+
var _priceType = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type;
|
|
2161
|
+
var _priceTypeExt = (_flatItem$bundleItem13 = flatItem.bundleItem) === null || _flatItem$bundleItem13 === void 0 ? void 0 : _flatItem$bundleItem13.price_type_ext;
|
|
2146
2162
|
|
|
2147
2163
|
// original_price 对应:
|
|
2148
2164
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
/** 从订单 payments 提取支付方式 code,与 UI 筛选选项及 filterBookings 一致 */
|
|
3
|
+
function getOrderPaymentCodes(order) {
|
|
4
|
+
var payments = order.payments;
|
|
5
|
+
if (!Array.isArray(payments) || payments.length === 0) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
return payments.map(function (item) {
|
|
9
|
+
return item === null || item === void 0 ? void 0 : item.code;
|
|
10
|
+
}).filter(function (code) {
|
|
11
|
+
return typeof code === 'string' && code.length > 0;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
2
15
|
/**
|
|
3
16
|
* 订单过滤函数
|
|
4
17
|
* @param orders 原始订单列表
|
|
@@ -126,22 +139,23 @@ export function filterOrders(orders, filters) {
|
|
|
126
139
|
}
|
|
127
140
|
}
|
|
128
141
|
|
|
129
|
-
// payment_methods -
|
|
142
|
+
// payment_methods - 支付方式(按 payments[].code 匹配,不再使用 order.payment_methods)
|
|
130
143
|
if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
|
|
131
|
-
|
|
144
|
+
var orderPaymentCodes = getOrderPaymentCodes(order);
|
|
145
|
+
if (orderPaymentCodes.length === 0) {
|
|
132
146
|
rejected.push({
|
|
133
147
|
order_id: order.order_id,
|
|
134
148
|
order_number: order.order_number,
|
|
135
149
|
reason: {
|
|
136
150
|
field: 'payment_methods',
|
|
137
|
-
actual: order.
|
|
151
|
+
actual: order.payments,
|
|
138
152
|
expected: safeFilters.payment_methods
|
|
139
153
|
}
|
|
140
154
|
});
|
|
141
155
|
return false;
|
|
142
156
|
}
|
|
143
|
-
var hasMatch =
|
|
144
|
-
return safeFilters.payment_methods.includes(
|
|
157
|
+
var hasMatch = orderPaymentCodes.some(function (code) {
|
|
158
|
+
return safeFilters.payment_methods.includes(code);
|
|
145
159
|
});
|
|
146
160
|
if (!hasMatch) {
|
|
147
161
|
rejected.push({
|
|
@@ -149,7 +163,7 @@ export function filterOrders(orders, filters) {
|
|
|
149
163
|
order_number: order.order_number,
|
|
150
164
|
reason: {
|
|
151
165
|
field: 'payment_methods',
|
|
152
|
-
actual:
|
|
166
|
+
actual: orderPaymentCodes,
|
|
153
167
|
expected: safeFilters.payment_methods
|
|
154
168
|
}
|
|
155
169
|
});
|
|
@@ -1348,17 +1348,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1348
1348
|
});
|
|
1349
1349
|
case 48:
|
|
1350
1350
|
this.store.order.persistTempOrder();
|
|
1351
|
-
|
|
1351
|
+
this.effectsEmit('onDiscountApplied', {
|
|
1352
|
+
productList: tempOrder.products,
|
|
1353
|
+
discountList: nextDiscountList,
|
|
1354
|
+
selectedDiscountList: tempOrder.discount_list,
|
|
1355
|
+
tempOrder: tempOrder
|
|
1356
|
+
});
|
|
1357
|
+
_context14.next = 55;
|
|
1352
1358
|
break;
|
|
1353
|
-
case
|
|
1354
|
-
_context14.prev =
|
|
1359
|
+
case 52:
|
|
1360
|
+
_context14.prev = 52;
|
|
1355
1361
|
_context14.t1 = _context14["catch"](0);
|
|
1356
1362
|
throw _context14.t1;
|
|
1357
|
-
case
|
|
1363
|
+
case 55:
|
|
1358
1364
|
case "end":
|
|
1359
1365
|
return _context14.stop();
|
|
1360
1366
|
}
|
|
1361
|
-
}, _callee14, this, [[0,
|
|
1367
|
+
}, _callee14, this, [[0, 52], [16, 36, 39, 42]]);
|
|
1362
1368
|
}));
|
|
1363
1369
|
function setDiscountSelected(_x9) {
|
|
1364
1370
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -4,6 +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 { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
|
|
7
8
|
function toNumber(value) {
|
|
8
9
|
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
9
10
|
var parsedValue = Number(value);
|
|
@@ -74,7 +75,7 @@ function findVariantById(origin, variantId) {
|
|
|
74
75
|
* 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
|
|
75
76
|
*/
|
|
76
77
|
export function transformBaseProductToOrderProduct(params) {
|
|
77
|
-
var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _payload$option, _payload$bundle, _payload$unique_ident, _payload$quantity, _ref25, _ref26,
|
|
78
|
+
var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _payload$option, _payload$bundle, _payload$unique_ident, _payload$quantity, _payload$_extend2, _extend, _extend2, _ref25, _ref26, _origin$base_price, _ref27, _ref28, _payload$line_total2, _payload$_extend3, _payload$_extend4, _extend3, _payload$_extend5, _payload$_extend6, _ref29, _ref30, _payload$tax_fee, _ref31, _ref32, _payload$is_charge_ta;
|
|
78
79
|
var payload = params.payload,
|
|
79
80
|
_params$fallbackProdu = params.fallbackProductId,
|
|
80
81
|
fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
|
|
@@ -92,6 +93,34 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
92
93
|
var productOptionItem = normalizeOptionItems((_ref24 = (_payload$option = payload.option) !== null && _payload$option !== void 0 ? _payload$option : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item);
|
|
93
94
|
var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle, hasPriceOverride);
|
|
94
95
|
var uniqueIdentificationNumber = (_payload$unique_ident = payload.unique_identification_number) !== null && _payload$unique_ident !== void 0 ? _payload$unique_ident : payload.unique;
|
|
96
|
+
var resolvedQuantity = toSafePositiveInt((_payload$quantity = payload.quantity) !== null && _payload$quantity !== void 0 ? _payload$quantity : payload.num, 1);
|
|
97
|
+
var originTotal = resolveManualDiscountOriginTotal({
|
|
98
|
+
originTotal: payload.origin_total,
|
|
99
|
+
extendOriginTotal: (_payload$_extend2 = payload._extend) === null || _payload$_extend2 === void 0 ? void 0 : _payload$_extend2.origin_total,
|
|
100
|
+
originExtendOriginTotal: origin === null || origin === void 0 || (_extend = origin._extend) === null || _extend === void 0 ? void 0 : _extend.origin_total,
|
|
101
|
+
sourceExtendOriginTotal: sourceProduct === null || sourceProduct === void 0 || (_extend2 = sourceProduct._extend) === null || _extend2 === void 0 ? void 0 : _extend2.origin_total,
|
|
102
|
+
catalogUnitPrice: (_ref25 = (_ref26 = (_origin$base_price = origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _origin$base_price !== void 0 ? _origin$base_price : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref26 !== void 0 ? _ref26 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price) !== null && _ref25 !== void 0 ? _ref25 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price,
|
|
103
|
+
quantity: resolvedQuantity
|
|
104
|
+
});
|
|
105
|
+
var sellingTotal = Number((_ref27 = (_ref28 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref28 !== void 0 ? _ref28 : (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.total) !== null && _ref27 !== void 0 ? _ref27 : lineCompositeTotal);
|
|
106
|
+
var discountReason = resolveManualDiscountReasonFromSources({
|
|
107
|
+
discountReason: payload.discount_reason,
|
|
108
|
+
extendDiscountReason: (_payload$_extend4 = payload._extend) === null || _payload$_extend4 === void 0 ? void 0 : _payload$_extend4.discount_reason,
|
|
109
|
+
originExtendDiscountReason: origin === null || origin === void 0 || (_extend3 = origin._extend) === null || _extend3 === void 0 ? void 0 : _extend3.discount_reason
|
|
110
|
+
});
|
|
111
|
+
var lineOriginalPrice = hasPriceOverride && Number.isFinite(originTotal) ? toPriceString(originTotal) : lineCompositeTotal;
|
|
112
|
+
var manualDiscountList = shouldBuildManualProductDiscount({
|
|
113
|
+
hasPriceOverride: hasPriceOverride,
|
|
114
|
+
originTotal: originTotal,
|
|
115
|
+
sellingTotal: sellingTotal
|
|
116
|
+
}) ? mergeManualProductDiscountIntoList(payload.discount_list, buildManualProductDiscountItem({
|
|
117
|
+
originTotal: Number.isFinite(originTotal) ? originTotal : Number(lineOriginalPrice),
|
|
118
|
+
sellingTotal: Number.isFinite(sellingTotal) ? sellingTotal : Number(lineCompositeTotal),
|
|
119
|
+
quantity: resolvedQuantity,
|
|
120
|
+
message: discountReason,
|
|
121
|
+
discountway: (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.discountway,
|
|
122
|
+
discount_per: (_payload$_extend6 = payload._extend) === null || _payload$_extend6 === void 0 ? void 0 : _payload$_extend6.discount_per
|
|
123
|
+
})) : payload.discount_list || [];
|
|
95
124
|
var metadata = _objectSpread(_objectSpread({
|
|
96
125
|
unique: payload.unique,
|
|
97
126
|
session: payload.session,
|
|
@@ -107,7 +136,8 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
107
136
|
main_product_selling_price: sourceProductPrice,
|
|
108
137
|
main_product_original_price: sourceProductPrice
|
|
109
138
|
}, hasPriceOverride ? {
|
|
110
|
-
price_override: String(payload.price_override)
|
|
139
|
+
price_override: String(payload.price_override),
|
|
140
|
+
is_manual_discount: 1
|
|
111
141
|
} : {}), payload.bundle_edit !== undefined ? {
|
|
112
142
|
bundle_edit: payload.bundle_edit
|
|
113
143
|
} : {});
|
|
@@ -118,14 +148,15 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
118
148
|
product_id: productId,
|
|
119
149
|
product_variant_id: productVariantId,
|
|
120
150
|
unique_identification_number: uniqueIdentificationNumber ? String(uniqueIdentificationNumber) : undefined,
|
|
121
|
-
num:
|
|
151
|
+
num: resolvedQuantity,
|
|
122
152
|
product_option_item: productOptionItem,
|
|
123
153
|
product_bundle: productBundle,
|
|
154
|
+
discount_list: manualDiscountList,
|
|
124
155
|
// 折后行价由 normalizeOrderProduct 按 main + bundle 合成;手动改价时 bundle 已为分摊后单价
|
|
125
156
|
selling_price: lineCompositeTotal,
|
|
126
|
-
original_price:
|
|
127
|
-
tax_fee: toPriceString((
|
|
128
|
-
is_charge_tax: toNumber((
|
|
157
|
+
original_price: lineOriginalPrice,
|
|
158
|
+
tax_fee: toPriceString((_ref29 = (_ref30 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref30 !== void 0 ? _ref30 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref29 !== void 0 ? _ref29 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
|
|
159
|
+
is_charge_tax: toNumber((_ref31 = (_ref32 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref32 !== void 0 ? _ref32 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref31 !== void 0 ? _ref31 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
|
|
129
160
|
metadata: metadata,
|
|
130
161
|
note: payload.note != null ? String(payload.note) : '',
|
|
131
162
|
_origin: _objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
@@ -6,6 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
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
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
import { composeLinePrice, createUuidV4, resolveManualOverrideLineOriginalPrice, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
9
|
+
import { ensureManualProductDiscountList } from "../../modules/Order/utils/manualProductDiscount";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* 构建金额全为 0 的空 summary。
|
|
@@ -231,8 +232,16 @@ export function normalizeOrderProduct(product) {
|
|
|
231
232
|
});
|
|
232
233
|
var finalOriginalPrice = resolveManualOverrideLineOriginalPrice({
|
|
233
234
|
num: product.num,
|
|
234
|
-
metadata: metadata
|
|
235
|
+
metadata: metadata,
|
|
236
|
+
lineOriginalPrice: product.original_price
|
|
235
237
|
}, composedOriginalPrice);
|
|
238
|
+
var discountList = ensureManualProductDiscountList({
|
|
239
|
+
discountList: product.discount_list,
|
|
240
|
+
metadata: metadata,
|
|
241
|
+
originalPrice: finalOriginalPrice,
|
|
242
|
+
sellingPrice: composedSellingPrice,
|
|
243
|
+
quantity: getSafeProductNum(product.num)
|
|
244
|
+
});
|
|
236
245
|
return {
|
|
237
246
|
order_detail_id: product.order_detail_id || null,
|
|
238
247
|
product_id: product.product_id,
|
|
@@ -243,7 +252,7 @@ export function normalizeOrderProduct(product) {
|
|
|
243
252
|
original_price: finalOriginalPrice,
|
|
244
253
|
tax_fee: product.tax_fee || '0.00',
|
|
245
254
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
246
|
-
discount_list:
|
|
255
|
+
discount_list: discountList,
|
|
247
256
|
product_bundle: normalizedBundle,
|
|
248
257
|
metadata: metadata,
|
|
249
258
|
note: product.note != null ? String(product.note) : ''
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -4,6 +4,7 @@ import type { ProductData } from '../../modules';
|
|
|
4
4
|
import { type BookingContextConfig, type BookingContextDateInput, type BookingContextResource, type BookingContextResourceMap, type BookingContextState, type InitBookingContextParams, type LoadBookingConfigParams, type LoadBookingResourcesParams, type ResourceError, type BookingCalcContext } from '../../modules/BookingContext';
|
|
5
5
|
import type { OrderCustomerView } from '../../modules/Order/types';
|
|
6
6
|
import { BaseSalesImpl } from '../BaseSales';
|
|
7
|
+
import type { BaseSalesScanCodeResult } from '../BaseSales/types';
|
|
7
8
|
import type { ISalesDetail } from '../BaseSales/utils/parseSalesResponse';
|
|
8
9
|
import type { LoadSalesDetailParams } from '../../modules/Order/types';
|
|
9
10
|
import { AddProductDecideContext, AddProductRequiresDetailPayload } from './utils/addProductDecision';
|
|
@@ -43,6 +44,14 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
43
44
|
* 让现有 setActiveCustomer / getActiveCustomer 调用方零成本拿到详情态客户。
|
|
44
45
|
*/
|
|
45
46
|
loadSalesDetail(orderIdOrParams: number | string | LoadSalesDetailParams): Promise<ISalesDetail>;
|
|
47
|
+
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
48
|
+
private hydrateOrderCustomerFromScanDiscounts;
|
|
49
|
+
private getDiscountCustomerId;
|
|
50
|
+
private resolveCustomerByDiscountCustomerId;
|
|
51
|
+
private findCustomerById;
|
|
52
|
+
private normalizeCustomer;
|
|
53
|
+
private getRawCustomerId;
|
|
54
|
+
private hasUsableCustomerDetails;
|
|
46
55
|
/**
|
|
47
56
|
* 更新当前预约的 appointment_status。
|
|
48
57
|
*
|