@pisell/pisellos 2.2.15 → 2.2.16
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/Customer/index.js +1 -1
- package/dist/modules/Payment/index.js +2 -2
- package/dist/modules/Payment/types.d.ts +1 -0
- package/dist/modules/Payment/walletpass.js +3 -1
- package/dist/modules/ProductList/index.js +8 -9
- package/dist/modules/Rules/index.js +63 -22
- package/dist/solution/BookingByStep/index.js +29 -8
- package/dist/solution/BookingByStep/utils/products.d.ts +6 -0
- package/dist/solution/BookingByStep/utils/products.js +10 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +61 -17
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Payment/index.js +1 -1
- package/lib/modules/Payment/types.d.ts +1 -0
- package/lib/modules/Payment/walletpass.js +10 -1
- package/lib/modules/ProductList/index.js +0 -7
- package/lib/modules/Rules/index.js +40 -21
- package/lib/solution/BookingByStep/index.js +15 -2
- package/lib/solution/BookingByStep/utils/products.d.ts +6 -0
- package/lib/solution/BookingByStep/utils/products.js +8 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +66 -17
- package/package.json +2 -2
|
@@ -154,7 +154,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
154
154
|
skip: skip,
|
|
155
155
|
num: num,
|
|
156
156
|
sort_by: SORT_BY,
|
|
157
|
-
with: ['latestWalletDetail.wallet'],
|
|
157
|
+
with: ['latestWalletDetail.wallet', 'contactsInfo'],
|
|
158
158
|
search_wallet_flag: 1,
|
|
159
159
|
search_wallet_pass_flag: 1
|
|
160
160
|
}, search && {
|
|
@@ -21,7 +21,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
22
|
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); }
|
|
23
23
|
import { BaseModule } from "../BaseModule";
|
|
24
|
-
import { PaymentStatus,
|
|
24
|
+
import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
|
|
25
25
|
import { getUniqueId } from "../Cart/utils";
|
|
26
26
|
import { CashPaymentImpl } from "./cash";
|
|
27
27
|
import { EftposPaymentImpl } from "./eftpos";
|
|
@@ -1237,7 +1237,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1237
1237
|
this.logInfo('更新订单支付项完成', {
|
|
1238
1238
|
orderUuid: orderUuid
|
|
1239
1239
|
});
|
|
1240
|
-
this.core.effects.emit(
|
|
1240
|
+
this.core.effects.emit("".concat(this.name, ":onPaymentAdded"), {
|
|
1241
1241
|
orderUuid: orderUuid,
|
|
1242
1242
|
payment: newPaymentItem
|
|
1243
1243
|
});
|
|
@@ -64,12 +64,14 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
64
64
|
amountInfo = businessData.amountInfo,
|
|
65
65
|
products = businessData.products,
|
|
66
66
|
order_wait_pay_amount = businessData.order_wait_pay_amount,
|
|
67
|
-
payment_order_id = businessData.payment_order_id
|
|
67
|
+
payment_order_id = businessData.payment_order_id,
|
|
68
|
+
is_price_include_tax = businessData.is_price_include_tax;
|
|
68
69
|
|
|
69
70
|
// 转换金额为数字类型
|
|
70
71
|
var totalAmount = Number(amountInfo.totalAmount);
|
|
71
72
|
var subTotal = Number(amountInfo.subTotal);
|
|
72
73
|
var walletParams = {
|
|
74
|
+
is_price_include_tax: is_price_include_tax,
|
|
73
75
|
sale_channel: 'pos',
|
|
74
76
|
customer_id: customer_id || 0,
|
|
75
77
|
// 提供默认值,确保类型为 number
|
|
@@ -140,17 +140,16 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
140
140
|
productsData = _context3.sent;
|
|
141
141
|
sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
|
|
142
142
|
return Number(b.sort) - Number(a.sort);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
143
|
+
}); // if (sortedList.length) {
|
|
144
|
+
// sortedList.forEach((n: any) => {
|
|
145
|
+
// if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
|
|
146
|
+
// n.is_eject = 1
|
|
147
|
+
// }
|
|
148
|
+
// })
|
|
149
|
+
// }
|
|
151
150
|
this.addProduct(sortedList);
|
|
152
151
|
return _context3.abrupt("return", sortedList);
|
|
153
|
-
case
|
|
152
|
+
case 10:
|
|
154
153
|
case "end":
|
|
155
154
|
return _context3.stop();
|
|
156
155
|
}
|
|
@@ -24,10 +24,12 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
25
|
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); }
|
|
26
26
|
import { BaseModule } from "../BaseModule";
|
|
27
|
-
import { uniqueById, getDiscountAmount, getDiscountListAmountTotal, getDiscountListAmount
|
|
27
|
+
import { uniqueById, getDiscountAmount, filterDiscountListByBookingTime, getDiscountListAmountTotal, getDiscountListAmount } from "../../solution/ShopDiscount/utils";
|
|
28
28
|
import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
|
|
29
29
|
import Decimal from 'decimal.js';
|
|
30
|
+
import { isBoolean } from 'lodash-es';
|
|
30
31
|
import dayjs from 'dayjs';
|
|
32
|
+
|
|
31
33
|
// 临时变量
|
|
32
34
|
var flatItem;
|
|
33
35
|
export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
@@ -447,7 +449,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
447
449
|
var isBundleAvailable = _this3.checkPackageSubItemUsageRules(discount, flatItem);
|
|
448
450
|
|
|
449
451
|
// 判断优惠券是否适用于该商品
|
|
450
|
-
if (isAvailableProduct && isLimitedProduct &&
|
|
452
|
+
if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable) {
|
|
451
453
|
var _discountApplicabilit, _discount$metadata;
|
|
452
454
|
// 记录此优惠券适用的商品
|
|
453
455
|
(_discountApplicabilit = discountApplicability.get(discount.id)) === null || _discountApplicabilit === void 0 || _discountApplicabilit.push(product.id);
|
|
@@ -537,7 +539,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
537
539
|
})) && (discount.tag || discount.type) === 'good_pass') return false;
|
|
538
540
|
|
|
539
541
|
// 折扣卡商品价格为0时不可用
|
|
540
|
-
if ((Number(product.price)
|
|
542
|
+
if ((Number(product.price) <= 0 || !product.price) && !((_product$discount_lis4 = product.discount_list) !== null && _product$discount_lis4 !== void 0 && _product$discount_lis4.find(function (n) {
|
|
541
543
|
var _n$discount2;
|
|
542
544
|
return ((_n$discount2 = n.discount) === null || _n$discount2 === void 0 ? void 0 : _n$discount2.resource_id) === discount.id;
|
|
543
545
|
})) && (discount.tag || discount.type) !== 'good_pass') return false;
|
|
@@ -675,7 +677,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
675
677
|
}
|
|
676
678
|
|
|
677
679
|
// 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
|
|
678
|
-
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
680
|
+
if (applicableDiscounts.length === 0 || isManualDiscount || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
679
681
|
if (flatItem.type === 'main') {
|
|
680
682
|
// 主商品:保持原有逻辑
|
|
681
683
|
if (product.isClient) {
|
|
@@ -701,7 +703,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
701
703
|
discount_list: []
|
|
702
704
|
}))]);
|
|
703
705
|
} else {
|
|
704
|
-
processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {
|
|
706
|
+
processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {
|
|
707
|
+
price: product.price,
|
|
708
|
+
main_product_selling_price: product.price
|
|
709
|
+
} : {
|
|
705
710
|
_id: product._id.split('___')[0] + '___' + index,
|
|
706
711
|
total: product.origin_total || product.total,
|
|
707
712
|
price: product.price,
|
|
@@ -714,7 +719,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
714
719
|
// bundle子商品:保存到扁平化Map
|
|
715
720
|
processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
716
721
|
discount_list: [],
|
|
717
|
-
price: flatItem.bundleItem.original_price,
|
|
722
|
+
price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
718
723
|
processed: true
|
|
719
724
|
})]);
|
|
720
725
|
}
|
|
@@ -1114,14 +1119,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1114
1119
|
var allDiscountAmount = getDiscountListAmountTotal(mainDiscountList);
|
|
1115
1120
|
newTotalWithDiscount = (_Decimal$minus$toNumb = new Decimal(mainProductData.price || 0).minus(allDiscountAmount).toNumber()) !== null && _Decimal$minus$toNumb !== void 0 ? _Decimal$minus$toNumb : newTotalWithDiscount;
|
|
1116
1121
|
newOriginTotalWithDiscount = (_mainProductData$orig = mainProductData.origin_total) !== null && _mainProductData$orig !== void 0 ? _mainProductData$orig : newOriginTotalWithDiscount;
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
// 累加bundle的价格(只累加一次)
|
|
1125
|
+
if (newBundleWithDiscount.length > 0) {
|
|
1126
|
+
newBundleWithDiscount.forEach(function (item) {
|
|
1127
|
+
newTotalWithDiscount += Number(item.price) * Number(item.num);
|
|
1128
|
+
});
|
|
1129
|
+
newBundleWithDiscount.forEach(function (item) {
|
|
1130
|
+
var _item$discount_list2;
|
|
1131
|
+
var originalPrice = ((_item$discount_list2 = item.discount_list) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2[0]) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2.discount) === null || _item$discount_list2 === void 0 ? void 0 : _item$discount_list2.original_amount) || item.price;
|
|
1132
|
+
newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
|
|
1133
|
+
});
|
|
1125
1134
|
}
|
|
1126
1135
|
|
|
1127
1136
|
// 累加options的价格(options不参与折扣,在最终设置total时处理)
|
|
@@ -1184,12 +1193,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1184
1193
|
var _allDiscountAmount = getDiscountListAmount(mainDiscountListOriginal);
|
|
1185
1194
|
newTotalOriginal = (_Decimal$minus$toNumb2 = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount).toNumber()) !== null && _Decimal$minus$toNumb2 !== void 0 ? _Decimal$minus$toNumb2 : newTotalOriginal;
|
|
1186
1195
|
newOriginTotalOriginal = (_mainProductData$orig2 = mainProductData.origin_total) !== null && _mainProductData$orig2 !== void 0 ? _mainProductData$orig2 : newOriginTotalOriginal;
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// 累加bundle的价格(只累加一次)
|
|
1199
|
+
if (newBundleOriginal.length > 0) {
|
|
1200
|
+
newBundleOriginal.forEach(function (item) {
|
|
1201
|
+
newTotalOriginal += Number(item.price) * Number(item.num);
|
|
1202
|
+
newOriginTotalOriginal += Number(item.price) * Number(item.num);
|
|
1203
|
+
});
|
|
1193
1204
|
}
|
|
1194
1205
|
|
|
1195
1206
|
// 累加options的价格(options不参与折扣,在最终设置total时处理)
|
|
@@ -1284,8 +1295,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1284
1295
|
// 累加bundle的价格(只累加一次)
|
|
1285
1296
|
if (newBundle.length > 0) {
|
|
1286
1297
|
newBundle.forEach(function (item) {
|
|
1287
|
-
var _item$discount_list3;
|
|
1288
1298
|
newTotal += Number(item.price) * Number(item.num);
|
|
1299
|
+
});
|
|
1300
|
+
|
|
1301
|
+
// 计算原始总价(不考虑折扣)
|
|
1302
|
+
newBundle.forEach(function (item) {
|
|
1303
|
+
var _item$discount_list3;
|
|
1289
1304
|
var originalPrice = ((_item$discount_list3 = item.discount_list) === null || _item$discount_list3 === void 0 || (_item$discount_list3 = _item$discount_list3[0]) === null || _item$discount_list3 === void 0 || (_item$discount_list3 = _item$discount_list3.discount) === null || _item$discount_list3 === void 0 ? void 0 : _item$discount_list3.original_amount) || item.price;
|
|
1290
1305
|
newOriginTotal += Number(originalPrice) * Number(item.num);
|
|
1291
1306
|
});
|
|
@@ -1464,8 +1479,34 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1464
1479
|
// 套餐中购买时,判断是否为原价
|
|
1465
1480
|
var _priceType = (_flatItem$bundleItem7 = flatItem.bundleItem) === null || _flatItem$bundleItem7 === void 0 ? void 0 : _flatItem$bundleItem7.price_type;
|
|
1466
1481
|
var _priceTypeExt = (_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.price_type_ext;
|
|
1482
|
+
|
|
1483
|
+
// original_price 对应:
|
|
1484
|
+
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
1485
|
+
// markup_price 对应:
|
|
1486
|
+
// price_type: "markup" && price_type_ext: ""
|
|
1487
|
+
/** 原价 */
|
|
1488
|
+
var _isOriginalPrice = _priceType === 'markup' && _priceTypeExt === 'product_price';
|
|
1489
|
+
/** 加价 */
|
|
1490
|
+
var _isMarkupPrice = _priceType === 'markup' && (_priceTypeExt === '' || !_priceTypeExt);
|
|
1491
|
+
|
|
1492
|
+
// 检查 rules
|
|
1493
|
+
if (rules.length > 0) {
|
|
1494
|
+
// 检查原价
|
|
1495
|
+
if (_isOriginalPrice && rules.includes('original_price')) {
|
|
1496
|
+
return true;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
// 检查加价
|
|
1500
|
+
if (_isMarkupPrice && rules.includes('markup_price')) {
|
|
1501
|
+
return true;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
// 如果都不匹配,则不可用
|
|
1505
|
+
return false;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1467
1508
|
// 原价包括:price_type: "markup" && price_type_ext: "product_price"
|
|
1468
|
-
return
|
|
1509
|
+
return _isOriginalPrice;
|
|
1469
1510
|
}
|
|
1470
1511
|
return false;
|
|
1471
1512
|
}
|
|
@@ -31,7 +31,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
31
31
|
import { BaseModule } from "../../modules/BaseModule";
|
|
32
32
|
import { createModule } from "./types";
|
|
33
33
|
import { formatProductToCartItem, createCartItemOrigin, getUniqueId, handleVariantProduct, formatDateToCartItem, formatAccountToCartItem } from "../../modules/Cart/utils";
|
|
34
|
-
import { getAvailableProductResources } from "./utils/products";
|
|
34
|
+
import { getAvailableProductResources, isSessionProduct } from "./utils/products";
|
|
35
35
|
import { getResourcesByProduct, getTimeSlicesByResource, getTimeSlicesByResources, getIsUsableByTimeItem, getOthersSelectedResources, getOthersCartSelectedResources, filterScheduleByDateRange, checkSessionProductLeadTime, sortCombinedResources, filterResourcesByFormItem, checkTwoResourcesIntersection, isConflict } from "./utils/resources";
|
|
36
36
|
import dayjs from 'dayjs';
|
|
37
37
|
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
@@ -238,19 +238,29 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
238
238
|
key: "loadProducts",
|
|
239
239
|
value: (function () {
|
|
240
240
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
241
|
-
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date;
|
|
241
|
+
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, res;
|
|
242
242
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
243
243
|
while (1) switch (_context2.prev = _context2.next) {
|
|
244
244
|
case 0:
|
|
245
245
|
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date;
|
|
246
|
-
|
|
246
|
+
_context2.next = 3;
|
|
247
|
+
return this.store.products.loadProducts({
|
|
247
248
|
category_ids: category_ids,
|
|
248
249
|
product_ids: product_ids,
|
|
249
250
|
collection: collection,
|
|
250
251
|
schedule_date: schedule_date,
|
|
251
252
|
cacheId: this.cacheId
|
|
252
|
-
})
|
|
253
|
-
case
|
|
253
|
+
});
|
|
254
|
+
case 3:
|
|
255
|
+
res = _context2.sent;
|
|
256
|
+
// 预拉取当天的资源数据
|
|
257
|
+
this.getAvailableDate({
|
|
258
|
+
startDate: schedule_date || dayjs().format('YYYY-MM-DD'),
|
|
259
|
+
endDate: schedule_date || dayjs().format('YYYY-MM-DD'),
|
|
260
|
+
products: _toConsumableArray(res)
|
|
261
|
+
});
|
|
262
|
+
return _context2.abrupt("return", res);
|
|
263
|
+
case 6:
|
|
254
264
|
case "end":
|
|
255
265
|
return _context2.stop();
|
|
256
266
|
}
|
|
@@ -282,7 +292,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
282
292
|
value: (function () {
|
|
283
293
|
var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
|
|
284
294
|
var _schedule$product_ids;
|
|
285
|
-
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds;
|
|
295
|
+
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds, res;
|
|
286
296
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
287
297
|
while (1) switch (_context3.prev = _context3.next) {
|
|
288
298
|
case 0:
|
|
@@ -329,8 +339,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
329
339
|
schedule_date: date
|
|
330
340
|
});
|
|
331
341
|
case 10:
|
|
332
|
-
|
|
333
|
-
|
|
342
|
+
res = _context3.sent;
|
|
343
|
+
return _context3.abrupt("return", res);
|
|
344
|
+
case 12:
|
|
334
345
|
case "end":
|
|
335
346
|
return _context3.stop();
|
|
336
347
|
}
|
|
@@ -1150,6 +1161,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1150
1161
|
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
1151
1162
|
product_variant_id: product_variant_id
|
|
1152
1163
|
});
|
|
1164
|
+
debugger;
|
|
1165
|
+
// 保护,如果进来的是 session 商品,则必须要有 date 和时间片,否则不允许添加
|
|
1166
|
+
if (isSessionProduct(productData)) {
|
|
1167
|
+
if (!date || !date.startTime || !date.endTime) {
|
|
1168
|
+
return {
|
|
1169
|
+
success: false,
|
|
1170
|
+
errorCode: 'date_or_time_required'
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1153
1174
|
|
|
1154
1175
|
// 库存检测
|
|
1155
1176
|
var currentCartItems = this.store.cart.getItems();
|
|
@@ -9,3 +9,9 @@ export declare const getAvailableProductResources: (products: ProductData[]) =>
|
|
|
9
9
|
rules: any[];
|
|
10
10
|
resourcesMap: Record<number, ProductResourceItem>;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* 判断商品是否是 session 商品
|
|
14
|
+
* @param product 商品数据
|
|
15
|
+
* @returns 是否是 session 商品
|
|
16
|
+
*/
|
|
17
|
+
export declare const isSessionProduct: (product: ProductData) => boolean;
|
|
@@ -47,4 +47,14 @@ export var getAvailableProductResources = function getAvailableProductResources(
|
|
|
47
47
|
rules: rules,
|
|
48
48
|
resourcesMap: resourcesMap
|
|
49
49
|
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 判断商品是否是 session 商品
|
|
54
|
+
* @param product 商品数据
|
|
55
|
+
* @returns 是否是 session 商品
|
|
56
|
+
*/
|
|
57
|
+
export var isSessionProduct = function isSessionProduct(product) {
|
|
58
|
+
var _product$scheduleIds, _product$scheduleIds2;
|
|
59
|
+
return ((_product$scheduleIds = product === null || product === void 0 || (_product$scheduleIds2 = product['schedule.ids']) === null || _product$scheduleIds2 === void 0 ? void 0 : _product$scheduleIds2.length) !== null && _product$scheduleIds !== void 0 ? _product$scheduleIds : 0) > 0;
|
|
50
60
|
};
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -396,23 +396,66 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
396
396
|
return pre + (item.amount || 0);
|
|
397
397
|
}, 0);
|
|
398
398
|
};
|
|
399
|
-
var
|
|
400
|
-
return {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
399
|
+
var formatProduct = function formatProduct(items) {
|
|
400
|
+
return items.map(function (item) {
|
|
401
|
+
var _item$is_charge_tax;
|
|
402
|
+
return {
|
|
403
|
+
product_id: item.product_id,
|
|
404
|
+
product_variant_id: item.product_variant_id,
|
|
405
|
+
quantity: item.num,
|
|
406
|
+
// 商品是否含税:1;0
|
|
407
|
+
is_charge_tax: (_item$is_charge_tax = item.is_charge_tax) !== null && _item$is_charge_tax !== void 0 ? _item$is_charge_tax : 0,
|
|
408
|
+
// 若商品不含税,计算得到的税费,单位(元)
|
|
409
|
+
tax_fee: item.tax_fee,
|
|
410
|
+
// 整个商品折扣后的总金额
|
|
411
|
+
selling_price: item.calculated_selling_price,
|
|
412
|
+
// 使用者id
|
|
413
|
+
holder_id: item.holder_id,
|
|
414
|
+
// 整个商品折扣前的总金额
|
|
415
|
+
original_price: item.calculated_original_price,
|
|
416
|
+
// 主商品折扣前金额,不包含套餐子商品
|
|
417
|
+
main_product_original_price: item.price,
|
|
418
|
+
// 主商品折扣后金额,不包含套餐子商品
|
|
419
|
+
main_product_selling_price: item.main_product_selling_price,
|
|
420
|
+
metadata: {
|
|
421
|
+
// 主商品+非原价(加减价)子商品税费
|
|
422
|
+
"main_product_attached_bundle_tax_fee": item.metadata.main_product_attached_bundle_tax_fee,
|
|
423
|
+
// 主商品+非原价(加减价)子商品附加费
|
|
424
|
+
"main_product_attached_bundle_surcharge_fee": item.metadata.main_product_attached_bundle_surcharge_fee,
|
|
425
|
+
// 可选,附加费均摊舍入金额
|
|
426
|
+
"surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
|
|
427
|
+
},
|
|
428
|
+
product_bundle: item.product_bundle.map(function (bundle) {
|
|
429
|
+
return {
|
|
430
|
+
bundle_id: bundle.bundle_id,
|
|
431
|
+
bundle_product_id: bundle.bundle_product_id,
|
|
432
|
+
bundle_variant_id: bundle.bundle_variant_id,
|
|
433
|
+
price_type: bundle.price_type,
|
|
434
|
+
price_type_ext: bundle.price_type_ext,
|
|
435
|
+
// 套餐子商品总价,不包含折扣金额
|
|
436
|
+
bundle_sum_price: bundle.bundle_sum_price,
|
|
437
|
+
// 套餐子商品折扣后金额
|
|
438
|
+
bundle_selling_price: bundle.bundle_selling_price,
|
|
439
|
+
num: bundle.num,
|
|
440
|
+
is_charge_tax: bundle.is_charge_tax,
|
|
441
|
+
tax_fee: bundle.tax_fee,
|
|
442
|
+
metadata: {
|
|
443
|
+
// 子商品单数量附加费
|
|
444
|
+
"surcharge_fee": bundle.metadata.surcharge_fee,
|
|
445
|
+
// 可选,附加费均摊舍入金额
|
|
446
|
+
"surcharge_rounding_remainder": bundle.metadata.surcharge_rounding_remainder
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
})
|
|
450
|
+
};
|
|
451
|
+
}) || [];
|
|
452
|
+
};
|
|
453
|
+
var productList = formatProduct(((_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.original_order_data) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.bookings) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.map(function (item) {
|
|
454
|
+
return _objectSpread(_objectSpread({}, item.product), {}, {
|
|
405
455
|
holder_id: _this3.getHolderIdFromBooking(item)
|
|
406
|
-
};
|
|
407
|
-
})) || [];
|
|
408
|
-
var relationProducts = ((_this$store$currentOr2 = this.store.currentOrder.order_info) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.original_order_data) === null || _this$store$currentOr2 === void 0
|
|
409
|
-
return {
|
|
410
|
-
product_id: item.product_id,
|
|
411
|
-
product_variant_id: item.product_variant_id,
|
|
412
|
-
quantity: item.num,
|
|
413
|
-
selling_price: item.source_product_price
|
|
414
|
-
};
|
|
415
|
-
})) || [];
|
|
456
|
+
});
|
|
457
|
+
})) || []);
|
|
458
|
+
var relationProducts = formatProduct(((_this$store$currentOr2 = this.store.currentOrder.order_info) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.original_order_data) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.relation_products) || []);
|
|
416
459
|
return [].concat(_toConsumableArray(productList), _toConsumableArray(relationProducts));
|
|
417
460
|
}
|
|
418
461
|
}, {
|
|
@@ -447,7 +490,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
447
490
|
depositAmount: (_this$store$currentOr5 = this.store.currentOrder) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.deposit_amount,
|
|
448
491
|
isDeposit: (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.is_deposit
|
|
449
492
|
},
|
|
450
|
-
products: this.getProductListByOrder()
|
|
493
|
+
products: this.getProductListByOrder(),
|
|
494
|
+
is_price_include_tax: this.otherParams.is_price_include_tax
|
|
451
495
|
}, params); // 判断订单是否已经同步,如果是则追加payment_order_id参数
|
|
452
496
|
if (this.store.isOrderSynced) {
|
|
453
497
|
walletBusinessData.payment_order_id = (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.order_id;
|
|
@@ -102,7 +102,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
102
102
|
skip,
|
|
103
103
|
num,
|
|
104
104
|
sort_by: import_constants.SORT_BY,
|
|
105
|
-
with: ["latestWalletDetail.wallet"],
|
|
105
|
+
with: ["latestWalletDetail.wallet", "contactsInfo"],
|
|
106
106
|
search_wallet_flag: 1,
|
|
107
107
|
search_wallet_pass_flag: 1,
|
|
108
108
|
...search && { search },
|
|
@@ -639,7 +639,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
639
639
|
this.logInfo("更新订单支付项完成", {
|
|
640
640
|
orderUuid
|
|
641
641
|
});
|
|
642
|
-
this.core.effects.emit(
|
|
642
|
+
this.core.effects.emit(`${this.name}:onPaymentAdded`, {
|
|
643
643
|
orderUuid,
|
|
644
644
|
payment: newPaymentItem
|
|
645
645
|
});
|
|
@@ -51,10 +51,19 @@ var WalletPassPaymentImpl = class {
|
|
|
51
51
|
*/
|
|
52
52
|
generateWalletParams(businessData) {
|
|
53
53
|
var _a, _b;
|
|
54
|
-
const {
|
|
54
|
+
const {
|
|
55
|
+
customer_id,
|
|
56
|
+
holder,
|
|
57
|
+
amountInfo,
|
|
58
|
+
products,
|
|
59
|
+
order_wait_pay_amount,
|
|
60
|
+
payment_order_id,
|
|
61
|
+
is_price_include_tax
|
|
62
|
+
} = businessData;
|
|
55
63
|
const totalAmount = Number(amountInfo.totalAmount);
|
|
56
64
|
const subTotal = Number(amountInfo.subTotal);
|
|
57
65
|
const walletParams = {
|
|
66
|
+
is_price_include_tax,
|
|
58
67
|
sale_channel: "pos",
|
|
59
68
|
customer_id: customer_id || 0,
|
|
60
69
|
// 提供默认值,确保类型为 number
|
|
@@ -103,13 +103,6 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
103
103
|
{ osServer: true }
|
|
104
104
|
);
|
|
105
105
|
const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
106
|
-
if (sortedList.length) {
|
|
107
|
-
sortedList.forEach((n) => {
|
|
108
|
-
if (n.is_eject !== 1 && n["schedule.ids"] && n["schedule.ids"].length) {
|
|
109
|
-
n.is_eject = 1;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
106
|
this.addProduct(sortedList);
|
|
114
107
|
return sortedList;
|
|
115
108
|
}
|
|
@@ -36,6 +36,7 @@ var import_BaseModule = require("../BaseModule");
|
|
|
36
36
|
var import_utils = require("../../solution/ShopDiscount/utils");
|
|
37
37
|
var import_utils2 = require("../Cart/utils");
|
|
38
38
|
var import_decimal = __toESM(require("decimal.js"));
|
|
39
|
+
var import_lodash_es = require("lodash-es");
|
|
39
40
|
var import_dayjs = __toESM(require("dayjs"));
|
|
40
41
|
var RulesModule = class extends import_BaseModule.BaseModule {
|
|
41
42
|
constructor(name, version) {
|
|
@@ -296,7 +297,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
296
297
|
const isLimitedProduct = (limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
|
|
297
298
|
const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_c = product == null ? void 0 : product.discount_list) == null ? void 0 : _c.length) && ((_d = product == null ? void 0 : product.discount_list) == null ? void 0 : _d.every((discount2) => discount2.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount2.tag || discount2.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && ((_f = (_e = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _e.metadata) == null ? void 0 : _f.custom_product_bundle_map_id));
|
|
298
299
|
const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
|
|
299
|
-
if (isAvailableProduct && isLimitedProduct &&
|
|
300
|
+
if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable) {
|
|
300
301
|
(_g = discountApplicability.get(discount.id)) == null ? void 0 : _g.push(product.id);
|
|
301
302
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
302
303
|
const discountType = discount.tag || discount.type;
|
|
@@ -364,7 +365,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
364
365
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
365
366
|
})) && (discount.tag || discount.type) === "good_pass")
|
|
366
367
|
return false;
|
|
367
|
-
if ((Number(product.price)
|
|
368
|
+
if ((Number(product.price) <= 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.find((n) => {
|
|
368
369
|
var _a3;
|
|
369
370
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
370
371
|
})) && (discount.tag || discount.type) !== "good_pass")
|
|
@@ -473,7 +474,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
473
474
|
}))) {
|
|
474
475
|
isManualDiscount = false;
|
|
475
476
|
}
|
|
476
|
-
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
477
|
+
if (applicableDiscounts.length === 0 || isManualDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
477
478
|
if (flatItem.type === "main") {
|
|
478
479
|
if (product.isClient) {
|
|
479
480
|
processedProductsMap.set(
|
|
@@ -505,7 +506,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
505
506
|
processedProductsMap.set(
|
|
506
507
|
product._id,
|
|
507
508
|
[this.hooks.setProduct(originProduct, {
|
|
508
|
-
...isManualDiscount ? {
|
|
509
|
+
...isManualDiscount ? {
|
|
510
|
+
price: product.price,
|
|
511
|
+
main_product_selling_price: product.price
|
|
512
|
+
} : {
|
|
509
513
|
_id: product._id.split("___")[0] + "___" + index,
|
|
510
514
|
total: product.origin_total || product.total,
|
|
511
515
|
price: product.price,
|
|
@@ -519,7 +523,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
519
523
|
processedFlatItemsMap.set(flatItem._id, [{
|
|
520
524
|
...flatItem,
|
|
521
525
|
discount_list: [],
|
|
522
|
-
price: flatItem.bundleItem.original_price,
|
|
526
|
+
price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
523
527
|
processed: true
|
|
524
528
|
}]);
|
|
525
529
|
}
|
|
@@ -859,14 +863,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
859
863
|
const allDiscountAmount = (0, import_utils.getDiscountListAmountTotal)(mainDiscountList);
|
|
860
864
|
newTotalWithDiscount = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotalWithDiscount;
|
|
861
865
|
newOriginTotalWithDiscount = mainProductData.origin_total ?? newOriginTotalWithDiscount;
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
866
|
+
}
|
|
867
|
+
if (newBundleWithDiscount.length > 0) {
|
|
868
|
+
newBundleWithDiscount.forEach((item) => {
|
|
869
|
+
newTotalWithDiscount += Number(item.price) * Number(item.num);
|
|
870
|
+
});
|
|
871
|
+
newBundleWithDiscount.forEach((item) => {
|
|
872
|
+
var _a, _b, _c;
|
|
873
|
+
const originalPrice = ((_c = (_b = (_a = item.discount_list) == null ? void 0 : _a[0]) == null ? void 0 : _b.discount) == null ? void 0 : _c.original_amount) || item.price;
|
|
874
|
+
newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
|
|
875
|
+
});
|
|
870
876
|
}
|
|
871
877
|
if (product == null ? void 0 : product.options) {
|
|
872
878
|
newTotalWithDiscount = product.options.reduce((accumulator, currentValue) => {
|
|
@@ -918,12 +924,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
918
924
|
const allDiscountAmount = (0, import_utils.getDiscountListAmount)(mainDiscountListOriginal);
|
|
919
925
|
newTotalOriginal = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotalOriginal;
|
|
920
926
|
newOriginTotalOriginal = mainProductData.origin_total ?? newOriginTotalOriginal;
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}
|
|
927
|
+
}
|
|
928
|
+
if (newBundleOriginal.length > 0) {
|
|
929
|
+
newBundleOriginal.forEach((item) => {
|
|
930
|
+
newTotalOriginal += Number(item.price) * Number(item.num);
|
|
931
|
+
newOriginTotalOriginal += Number(item.price) * Number(item.num);
|
|
932
|
+
});
|
|
927
933
|
}
|
|
928
934
|
if (product == null ? void 0 : product.options) {
|
|
929
935
|
newTotalOriginal = product.options.reduce((accumulator, currentValue) => {
|
|
@@ -998,8 +1004,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
998
1004
|
}
|
|
999
1005
|
if (newBundle.length > 0) {
|
|
1000
1006
|
newBundle.forEach((item) => {
|
|
1001
|
-
var _a2, _b2, _c2;
|
|
1002
1007
|
newTotal += Number(item.price) * Number(item.num);
|
|
1008
|
+
});
|
|
1009
|
+
newBundle.forEach((item) => {
|
|
1010
|
+
var _a2, _b2, _c2;
|
|
1003
1011
|
const originalPrice = ((_c2 = (_b2 = (_a2 = item.discount_list) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.discount) == null ? void 0 : _c2.original_amount) || item.price;
|
|
1004
1012
|
newOriginTotal += Number(originalPrice) * Number(item.num);
|
|
1005
1013
|
});
|
|
@@ -1140,7 +1148,18 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1140
1148
|
if (isBundleItem) {
|
|
1141
1149
|
const priceType = (_c = flatItem.bundleItem) == null ? void 0 : _c.price_type;
|
|
1142
1150
|
const priceTypeExt = (_d = flatItem.bundleItem) == null ? void 0 : _d.price_type_ext;
|
|
1143
|
-
|
|
1151
|
+
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1152
|
+
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1153
|
+
if (rules.length > 0) {
|
|
1154
|
+
if (isOriginalPrice && rules.includes("original_price")) {
|
|
1155
|
+
return true;
|
|
1156
|
+
}
|
|
1157
|
+
if (isMarkupPrice && rules.includes("markup_price")) {
|
|
1158
|
+
return true;
|
|
1159
|
+
}
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
return isOriginalPrice;
|
|
1144
1163
|
}
|
|
1145
1164
|
return false;
|
|
1146
1165
|
}
|
|
@@ -185,13 +185,19 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
185
185
|
collection = [],
|
|
186
186
|
schedule_date
|
|
187
187
|
}) {
|
|
188
|
-
|
|
188
|
+
const res = await this.store.products.loadProducts({
|
|
189
189
|
category_ids,
|
|
190
190
|
product_ids,
|
|
191
191
|
collection,
|
|
192
192
|
schedule_date,
|
|
193
193
|
cacheId: this.cacheId
|
|
194
194
|
});
|
|
195
|
+
this.getAvailableDate({
|
|
196
|
+
startDate: schedule_date || (0, import_dayjs.default)().format("YYYY-MM-DD"),
|
|
197
|
+
endDate: schedule_date || (0, import_dayjs.default)().format("YYYY-MM-DD"),
|
|
198
|
+
products: [...res]
|
|
199
|
+
});
|
|
200
|
+
return res;
|
|
195
201
|
}
|
|
196
202
|
/**
|
|
197
203
|
* 通过 schedule 来读取商品,适用于 session 类商品
|
|
@@ -228,11 +234,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
228
234
|
const allProductIds = [...newProductIds, ...otherProductsIds].filter(
|
|
229
235
|
(n, index, self) => self.indexOf(n) === index
|
|
230
236
|
);
|
|
231
|
-
|
|
237
|
+
const res = await this.loadProducts({
|
|
232
238
|
product_ids: allProductIds,
|
|
233
239
|
category_ids,
|
|
234
240
|
schedule_date: date
|
|
235
241
|
});
|
|
242
|
+
return res;
|
|
236
243
|
}
|
|
237
244
|
/**
|
|
238
245
|
* 更新完商品数据、切换日期、或者在较后的流程里登录了,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
|
|
@@ -599,6 +606,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
599
606
|
quantity = 1
|
|
600
607
|
} = product || {};
|
|
601
608
|
const productData = { ...origin, product_variant_id };
|
|
609
|
+
debugger;
|
|
610
|
+
if ((0, import_products.isSessionProduct)(productData)) {
|
|
611
|
+
if (!date || !date.startTime || !date.endTime) {
|
|
612
|
+
return { success: false, errorCode: "date_or_time_required" };
|
|
613
|
+
}
|
|
614
|
+
}
|
|
602
615
|
const currentCartItems = this.store.cart.getItems();
|
|
603
616
|
const stockCheckResult = (0, import_stock.checkProductStock)({
|
|
604
617
|
productData,
|
|
@@ -9,3 +9,9 @@ export declare const getAvailableProductResources: (products: ProductData[]) =>
|
|
|
9
9
|
rules: any[];
|
|
10
10
|
resourcesMap: Record<number, ProductResourceItem>;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* 判断商品是否是 session 商品
|
|
14
|
+
* @param product 商品数据
|
|
15
|
+
* @returns 是否是 session 商品
|
|
16
|
+
*/
|
|
17
|
+
export declare const isSessionProduct: (product: ProductData) => boolean;
|
|
@@ -19,7 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/solution/BookingByStep/utils/products.ts
|
|
20
20
|
var products_exports = {};
|
|
21
21
|
__export(products_exports, {
|
|
22
|
-
getAvailableProductResources: () => getAvailableProductResources
|
|
22
|
+
getAvailableProductResources: () => getAvailableProductResources,
|
|
23
|
+
isSessionProduct: () => isSessionProduct
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(products_exports);
|
|
25
26
|
var getAvailableProductResources = (products) => {
|
|
@@ -57,7 +58,12 @@ var getAvailableProductResources = (products) => {
|
|
|
57
58
|
});
|
|
58
59
|
return { resourceIds: [...new Set(resourceIds)], rules, resourcesMap };
|
|
59
60
|
};
|
|
61
|
+
var isSessionProduct = (product) => {
|
|
62
|
+
var _a;
|
|
63
|
+
return (((_a = product == null ? void 0 : product["schedule.ids"]) == null ? void 0 : _a.length) ?? 0) > 0;
|
|
64
|
+
};
|
|
60
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
61
66
|
0 && (module.exports = {
|
|
62
|
-
getAvailableProductResources
|
|
67
|
+
getAvailableProductResources,
|
|
68
|
+
isSessionProduct
|
|
63
69
|
});
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -216,23 +216,70 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
216
216
|
return pre + (item.amount || 0);
|
|
217
217
|
}, 0);
|
|
218
218
|
};
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
219
|
+
const formatProduct = (items) => {
|
|
220
|
+
return items.map(
|
|
221
|
+
(item) => ({
|
|
222
|
+
product_id: item.product_id,
|
|
223
|
+
product_variant_id: item.product_variant_id,
|
|
224
|
+
quantity: item.num,
|
|
225
|
+
// 商品是否含税:1;0
|
|
226
|
+
is_charge_tax: item.is_charge_tax ?? 0,
|
|
227
|
+
// 若商品不含税,计算得到的税费,单位(元)
|
|
228
|
+
tax_fee: item.tax_fee,
|
|
229
|
+
// 整个商品折扣后的总金额
|
|
230
|
+
selling_price: item.calculated_selling_price,
|
|
231
|
+
// 使用者id
|
|
232
|
+
holder_id: item.holder_id,
|
|
233
|
+
// 整个商品折扣前的总金额
|
|
234
|
+
original_price: item.calculated_original_price,
|
|
235
|
+
// 主商品折扣前金额,不包含套餐子商品
|
|
236
|
+
main_product_original_price: item.price,
|
|
237
|
+
// 主商品折扣后金额,不包含套餐子商品
|
|
238
|
+
main_product_selling_price: item.main_product_selling_price,
|
|
239
|
+
metadata: {
|
|
240
|
+
// 主商品+非原价(加减价)子商品税费
|
|
241
|
+
"main_product_attached_bundle_tax_fee": item.metadata.main_product_attached_bundle_tax_fee,
|
|
242
|
+
// 主商品+非原价(加减价)子商品附加费
|
|
243
|
+
"main_product_attached_bundle_surcharge_fee": item.metadata.main_product_attached_bundle_surcharge_fee,
|
|
244
|
+
// 可选,附加费均摊舍入金额
|
|
245
|
+
"surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
|
|
246
|
+
},
|
|
247
|
+
product_bundle: item.product_bundle.map((bundle) => {
|
|
248
|
+
return {
|
|
249
|
+
bundle_id: bundle.bundle_id,
|
|
250
|
+
bundle_product_id: bundle.bundle_product_id,
|
|
251
|
+
bundle_variant_id: bundle.bundle_variant_id,
|
|
252
|
+
price_type: bundle.price_type,
|
|
253
|
+
price_type_ext: bundle.price_type_ext,
|
|
254
|
+
// 套餐子商品总价,不包含折扣金额
|
|
255
|
+
bundle_sum_price: bundle.bundle_sum_price,
|
|
256
|
+
// 套餐子商品折扣后金额
|
|
257
|
+
bundle_selling_price: bundle.bundle_selling_price,
|
|
258
|
+
num: bundle.num,
|
|
259
|
+
is_charge_tax: bundle.is_charge_tax,
|
|
260
|
+
tax_fee: bundle.tax_fee,
|
|
261
|
+
metadata: {
|
|
262
|
+
// 子商品单数量附加费
|
|
263
|
+
"surcharge_fee": bundle.metadata.surcharge_fee,
|
|
264
|
+
// 可选,附加费均摊舍入金额
|
|
265
|
+
"surcharge_rounding_remainder": bundle.metadata.surcharge_rounding_remainder
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
})
|
|
269
|
+
})
|
|
270
|
+
) || [];
|
|
271
|
+
};
|
|
272
|
+
const productList = formatProduct(
|
|
273
|
+
((_c = (_b = (_a = this.store.currentOrder.order_info) == null ? void 0 : _a.original_order_data) == null ? void 0 : _b.bookings) == null ? void 0 : _c.map(
|
|
274
|
+
(item) => {
|
|
275
|
+
return {
|
|
276
|
+
...item.product,
|
|
277
|
+
holder_id: this.getHolderIdFromBooking(item)
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
)) || []
|
|
281
|
+
);
|
|
282
|
+
const relationProducts = formatProduct(((_e = (_d = this.store.currentOrder.order_info) == null ? void 0 : _d.original_order_data) == null ? void 0 : _e.relation_products) || []);
|
|
236
283
|
return [...productList, ...relationProducts];
|
|
237
284
|
}
|
|
238
285
|
async initWalletData(params) {
|
|
@@ -257,6 +304,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
257
304
|
isDeposit: (_h = this.store.currentOrder) == null ? void 0 : _h.is_deposit
|
|
258
305
|
},
|
|
259
306
|
products: this.getProductListByOrder(),
|
|
307
|
+
is_price_include_tax: this.otherParams.is_price_include_tax,
|
|
308
|
+
// core 有
|
|
260
309
|
...params
|
|
261
310
|
};
|
|
262
311
|
if (this.store.isOrderSynced) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@pisell/pisellos",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.16",
|
|
5
5
|
"description": "一个可扩展的前端模块化SDK框架,支持插件系统",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -69,4 +69,4 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|