@pisell/pisellos 2.2.14 → 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/Order/index.js +18 -13
- package/dist/modules/Payment/index.d.ts +1 -0
- package/dist/modules/Payment/index.js +505 -470
- 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/Order/index.js +20 -18
- package/lib/modules/Payment/index.d.ts +1 -0
- package/lib/modules/Payment/index.js +17 -3
- 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
|
@@ -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 },
|
|
@@ -193,31 +193,33 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
193
193
|
* @returns 后端返回的订单数据(包含订单ID等)
|
|
194
194
|
*/
|
|
195
195
|
async createOrderByCheckout(params) {
|
|
196
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
196
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
197
|
+
const onlineStorePaymentCodeList = ["WXPAY", "WECHAT", "ALIPAY", "APPLE_PAY", "CREDIT_CARD_3DS", "CREDIT_CARD_TOKEN", "GOOGLE_PAY", "GOOGLE_PAY_3DS", "CREDIT_CARD"];
|
|
198
|
+
params.payments = (_a = params.payments) == null ? void 0 : _a.filter((p) => !onlineStorePaymentCodeList.includes(p.code));
|
|
197
199
|
this.logInfo("createOrderByCheckout called", {
|
|
198
200
|
type: params.type,
|
|
199
201
|
platform: params.platform,
|
|
200
202
|
is_deposit: params.is_deposit,
|
|
201
203
|
customer_id: params.customer_id,
|
|
202
|
-
bookingsCount: ((
|
|
203
|
-
relationProductsCount: ((
|
|
204
|
-
paymentsCount: ((
|
|
204
|
+
bookingsCount: ((_b = params.bookings) == null ? void 0 : _b.length) || 0,
|
|
205
|
+
relationProductsCount: ((_c = params.relation_products) == null ? void 0 : _c.length) || 0,
|
|
206
|
+
paymentsCount: ((_d = params.payments) == null ? void 0 : _d.length) || 0,
|
|
205
207
|
depositAmount: params.deposit_amount,
|
|
206
208
|
productTaxFee: params.product_tax_fee,
|
|
207
209
|
note: params.note,
|
|
208
210
|
scheduleDate: params.schedule_date,
|
|
209
211
|
hasOrderId: !!params.order_id,
|
|
210
212
|
orderIdIncluded: params.order_id,
|
|
211
|
-
paymentMethods: ((
|
|
213
|
+
paymentMethods: ((_e = params.payments) == null ? void 0 : _e.map((p) => p.code)) || []
|
|
212
214
|
});
|
|
213
215
|
console.log("[Order] createOrderByCheckout 开始创建订单:", {
|
|
214
216
|
type: params.type,
|
|
215
217
|
platform: params.platform,
|
|
216
218
|
is_deposit: params.is_deposit,
|
|
217
219
|
customer_id: params.customer_id,
|
|
218
|
-
bookingsCount: ((
|
|
219
|
-
relationProductsCount: ((
|
|
220
|
-
paymentsCount: ((
|
|
220
|
+
bookingsCount: ((_f = params.bookings) == null ? void 0 : _f.length) || 0,
|
|
221
|
+
relationProductsCount: ((_g = params.relation_products) == null ? void 0 : _g.length) || 0,
|
|
222
|
+
paymentsCount: ((_h = params.payments) == null ? void 0 : _h.length) || 0
|
|
221
223
|
});
|
|
222
224
|
try {
|
|
223
225
|
const orderData = {
|
|
@@ -234,7 +236,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
234
236
|
...params
|
|
235
237
|
// 使用传入的参数覆盖默认值
|
|
236
238
|
};
|
|
237
|
-
if ((
|
|
239
|
+
if ((_i = orderData.payments) == null ? void 0 : _i.length) {
|
|
238
240
|
orderData.small_ticket_data_flag = 1;
|
|
239
241
|
}
|
|
240
242
|
if (!params.order_id && !orderData.schedule_date) {
|
|
@@ -246,10 +248,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
246
248
|
platform: orderData.platform,
|
|
247
249
|
isDeposit: orderData.is_deposit,
|
|
248
250
|
customerId: orderData.customer_id,
|
|
249
|
-
bookingsCount: ((
|
|
250
|
-
relationProductsCount: ((
|
|
251
|
-
paymentsCount: ((
|
|
252
|
-
paymentsMethods: ((
|
|
251
|
+
bookingsCount: ((_j = orderData.bookings) == null ? void 0 : _j.length) || 0,
|
|
252
|
+
relationProductsCount: ((_k = orderData.relation_products) == null ? void 0 : _k.length) || 0,
|
|
253
|
+
paymentsCount: ((_l = orderData.payments) == null ? void 0 : _l.length) || 0,
|
|
254
|
+
paymentsMethods: ((_m = orderData.payments) == null ? void 0 : _m.map((p) => p.code)) || []
|
|
253
255
|
});
|
|
254
256
|
this.logInfo("Calling backend checkout API", {
|
|
255
257
|
url: "/order/checkout",
|
|
@@ -258,10 +260,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
258
260
|
isDeposit: orderData.is_deposit,
|
|
259
261
|
customerId: orderData.customer_id,
|
|
260
262
|
depositAmount: orderData.deposit_amount,
|
|
261
|
-
bookingsCount: ((
|
|
262
|
-
relationProductsCount: ((
|
|
263
|
-
paymentsCount: ((
|
|
264
|
-
paymentMethods: ((
|
|
263
|
+
bookingsCount: ((_n = orderData.bookings) == null ? void 0 : _n.length) || 0,
|
|
264
|
+
relationProductsCount: ((_o = orderData.relation_products) == null ? void 0 : _o.length) || 0,
|
|
265
|
+
paymentsCount: ((_p = orderData.payments) == null ? void 0 : _p.length) || 0,
|
|
266
|
+
paymentMethods: ((_q = orderData.payments) == null ? void 0 : _q.map((p) => ({
|
|
265
267
|
code: p.code,
|
|
266
268
|
amount: p.amount,
|
|
267
269
|
type: p.type,
|
|
@@ -280,7 +282,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
280
282
|
});
|
|
281
283
|
console.log("[Order] 订单创建成功,后端响应:", {
|
|
282
284
|
success: !!response,
|
|
283
|
-
hasOrderId: !!(((
|
|
285
|
+
hasOrderId: !!(((_r = response == null ? void 0 : response.data) == null ? void 0 : _r.order_id) || (response == null ? void 0 : response.order_id))
|
|
284
286
|
});
|
|
285
287
|
return response;
|
|
286
288
|
} catch (error) {
|
|
@@ -175,6 +175,20 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
+
async filterPayMethods(payMethods) {
|
|
179
|
+
payMethods.filter((method) => method.status === 1 && method.disable === 0);
|
|
180
|
+
const walletPassMethod = payMethods.find((method) => method.code === "WALLET_PASS");
|
|
181
|
+
if (walletPassMethod) {
|
|
182
|
+
payMethods.forEach((method) => {
|
|
183
|
+
if (method.code === "PRODUCTVOUCHER" || method.code === "GIFTCARD" || method.code === "POINTCARD") {
|
|
184
|
+
method.channel_application = walletPassMethod.channel_application;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
} else {
|
|
188
|
+
payMethods = payMethods.filter((method) => method.code !== "PRODUCTVOUCHER" && method.code !== "GIFTCARD" && method.code !== "POINTCARD");
|
|
189
|
+
}
|
|
190
|
+
return payMethods;
|
|
191
|
+
}
|
|
178
192
|
/**
|
|
179
193
|
* 获取支付方式列表
|
|
180
194
|
*/
|
|
@@ -193,7 +207,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
193
207
|
return cachedMethods;
|
|
194
208
|
}
|
|
195
209
|
const response = await this.request.get("/pay/custom-payment/all");
|
|
196
|
-
response.data = response.data
|
|
210
|
+
response.data = this.filterPayMethods(response.data);
|
|
197
211
|
const payMethods = response.data || [];
|
|
198
212
|
try {
|
|
199
213
|
for (const method of payMethods) {
|
|
@@ -227,7 +241,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
227
241
|
try {
|
|
228
242
|
console.log("[PaymentModule] 后台刷新支付方式列表...");
|
|
229
243
|
const response = await this.request.get("/pay/custom-payment/all");
|
|
230
|
-
response.data = response.data
|
|
244
|
+
response.data = this.filterPayMethods(response.data);
|
|
231
245
|
const newPayMethods = response.data || [];
|
|
232
246
|
const hasChanges = this.hasPaymentMethodsChanged(
|
|
233
247
|
cachedMethods,
|
|
@@ -625,7 +639,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
625
639
|
this.logInfo("更新订单支付项完成", {
|
|
626
640
|
orderUuid
|
|
627
641
|
});
|
|
628
|
-
this.core.effects.emit(
|
|
642
|
+
this.core.effects.emit(`${this.name}:onPaymentAdded`, {
|
|
629
643
|
orderUuid,
|
|
630
644
|
payment: newPaymentItem
|
|
631
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
|
}
|