@pisell/pisellos 2.2.10 → 2.2.11
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/Cart/utils/cartProduct.js +26 -41
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Discount/index.d.ts +0 -2
- package/dist/modules/Discount/index.js +36 -69
- package/dist/modules/Discount/types.d.ts +0 -16
- package/dist/modules/Order/index.js +1 -4
- package/dist/modules/Order/utils.d.ts +0 -1
- package/dist/modules/Order/utils.js +0 -9
- package/dist/modules/Payment/index.js +2 -2
- package/dist/modules/Payment/types.d.ts +0 -1
- package/dist/modules/Payment/walletpass.js +1 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +9 -8
- package/dist/modules/Rules/index.d.ts +0 -7
- package/dist/modules/Rules/index.js +196 -1065
- package/dist/modules/Rules/types.d.ts +1 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +8 -30
- package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
- package/dist/solution/BookingByStep/utils/products.js +0 -10
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +49 -93
- package/dist/solution/ShopDiscount/index.d.ts +0 -2
- package/dist/solution/ShopDiscount/index.js +19 -80
- package/dist/solution/ShopDiscount/types.d.ts +1 -4
- package/dist/solution/ShopDiscount/utils.d.ts +0 -55
- package/dist/solution/ShopDiscount/utils.js +3 -432
- package/lib/modules/Cart/utils/cartProduct.js +22 -35
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Discount/index.d.ts +0 -2
- package/lib/modules/Discount/index.js +4 -19
- package/lib/modules/Discount/types.d.ts +0 -16
- package/lib/modules/Order/index.js +0 -2
- package/lib/modules/Order/utils.d.ts +0 -1
- package/lib/modules/Order/utils.js +0 -11
- package/lib/modules/Payment/index.js +1 -1
- package/lib/modules/Payment/types.d.ts +0 -1
- package/lib/modules/Payment/walletpass.js +1 -10
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +7 -0
- package/lib/modules/Rules/index.d.ts +0 -7
- package/lib/modules/Rules/index.js +182 -824
- package/lib/modules/Rules/types.d.ts +1 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +2 -19
- package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
- package/lib/solution/BookingByStep/utils/products.js +2 -8
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +19 -68
- package/lib/solution/ShopDiscount/index.d.ts +0 -2
- package/lib/solution/ShopDiscount/index.js +9 -55
- package/lib/solution/ShopDiscount/types.d.ts +1 -4
- package/lib/solution/ShopDiscount/utils.d.ts +0 -55
- package/lib/solution/ShopDiscount/utils.js +3 -266
- package/package.json +2 -2
|
@@ -44,7 +44,6 @@ type ProductDetail = {
|
|
|
44
44
|
quantity: number;
|
|
45
45
|
vouchersApplicable?: boolean;
|
|
46
46
|
holder_id?: number;
|
|
47
|
-
startDate?: any;
|
|
48
47
|
};
|
|
49
48
|
export interface RulesParamsHooks {
|
|
50
49
|
getProduct: (product: Record<string, any>) => ProductDetail;
|
|
@@ -55,10 +54,8 @@ export interface RulesParamsHooks {
|
|
|
55
54
|
origin_total?: number;
|
|
56
55
|
price?: string | number;
|
|
57
56
|
variant?: any[];
|
|
58
|
-
original_price?: number
|
|
57
|
+
original_price?: number;
|
|
59
58
|
quantity?: number;
|
|
60
|
-
bundle?: any[];
|
|
61
|
-
main_product_selling_price?: string | number;
|
|
62
59
|
}) => Record<string, any>;
|
|
63
60
|
}
|
|
64
61
|
export {};
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
};
|
|
343
343
|
setOtherData(key: string, value: any): void;
|
|
344
344
|
getOtherData(key: string): any;
|
|
345
|
-
getProductTypeById(id: number): Promise<"
|
|
345
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
346
346
|
/**
|
|
347
347
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
348
348
|
*
|
|
@@ -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
|
|
34
|
+
import { getAvailableProductResources } 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,29 +238,19 @@ 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;
|
|
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
|
-
_context2.
|
|
247
|
-
return this.store.products.loadProducts({
|
|
246
|
+
return _context2.abrupt("return", this.store.products.loadProducts({
|
|
248
247
|
category_ids: category_ids,
|
|
249
248
|
product_ids: product_ids,
|
|
250
249
|
collection: collection,
|
|
251
250
|
schedule_date: schedule_date,
|
|
252
251
|
cacheId: this.cacheId
|
|
253
|
-
});
|
|
254
|
-
case
|
|
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:
|
|
252
|
+
}));
|
|
253
|
+
case 2:
|
|
264
254
|
case "end":
|
|
265
255
|
return _context2.stop();
|
|
266
256
|
}
|
|
@@ -292,7 +282,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
292
282
|
value: (function () {
|
|
293
283
|
var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
|
|
294
284
|
var _schedule$product_ids;
|
|
295
|
-
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds
|
|
285
|
+
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds;
|
|
296
286
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
297
287
|
while (1) switch (_context3.prev = _context3.next) {
|
|
298
288
|
case 0:
|
|
@@ -339,9 +329,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
339
329
|
schedule_date: date
|
|
340
330
|
});
|
|
341
331
|
case 10:
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
case 12:
|
|
332
|
+
return _context3.abrupt("return", _context3.sent);
|
|
333
|
+
case 11:
|
|
345
334
|
case "end":
|
|
346
335
|
return _context3.stop();
|
|
347
336
|
}
|
|
@@ -1161,16 +1150,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1161
1150
|
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
1162
1151
|
product_variant_id: product_variant_id
|
|
1163
1152
|
});
|
|
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
|
-
}
|
|
1174
1153
|
|
|
1175
1154
|
// 库存检测
|
|
1176
1155
|
var currentCartItems = this.store.cart.getItems();
|
|
@@ -2313,7 +2292,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2313
2292
|
}
|
|
2314
2293
|
});
|
|
2315
2294
|
});
|
|
2316
|
-
this.core.effects.emit("".concat(this.store.cart.name, ":onUpdateBookingDate"), {});
|
|
2317
2295
|
}
|
|
2318
2296
|
}, {
|
|
2319
2297
|
key: "getScheduleDataByIds",
|
|
@@ -9,9 +9,3 @@ 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,14 +47,4 @@ 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;
|
|
60
50
|
};
|
|
@@ -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, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -396,66 +396,23 @@ 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
|
-
|
|
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), {}, {
|
|
399
|
+
var productList = ((_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.original_order_data.bookings) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.map(function (item) {
|
|
400
|
+
return {
|
|
401
|
+
product_id: item.product.product_id,
|
|
402
|
+
product_variant_id: item.product.product_variant_id,
|
|
403
|
+
quantity: item.product.num,
|
|
404
|
+
selling_price: item.product.calculated_selling_price,
|
|
455
405
|
holder_id: _this3.getHolderIdFromBooking(item)
|
|
456
|
-
}
|
|
457
|
-
})) || []
|
|
458
|
-
var relationProducts =
|
|
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 || (_this$store$currentOr2 = _this$store$currentOr2.relation_products) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.map(function (item) {
|
|
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
|
+
})) || [];
|
|
459
416
|
return [].concat(_toConsumableArray(productList), _toConsumableArray(relationProducts));
|
|
460
417
|
}
|
|
461
418
|
}, {
|
|
@@ -490,8 +447,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
490
447
|
depositAmount: (_this$store$currentOr5 = this.store.currentOrder) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.deposit_amount,
|
|
491
448
|
isDeposit: (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.is_deposit
|
|
492
449
|
},
|
|
493
|
-
products: this.getProductListByOrder()
|
|
494
|
-
is_price_include_tax: this.otherParams.is_price_include_tax
|
|
450
|
+
products: this.getProductListByOrder()
|
|
495
451
|
}, params); // 判断订单是否已经同步,如果是则追加payment_order_id参数
|
|
496
452
|
if (this.store.isOrderSynced) {
|
|
497
453
|
walletBusinessData.payment_order_id = (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.order_id;
|
|
@@ -751,7 +707,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
751
707
|
key: "updateLocalOrderAsync",
|
|
752
708
|
value: (function () {
|
|
753
709
|
var _updateLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
754
|
-
var _params$orderData6, _params$orderData7, _params$cartSummary2, _params$totalInfo5, _params$totalInfo6, _params$totalInfo7, _params$totalInfo8;
|
|
710
|
+
var _params$orderData6, _params$orderData7, _params$cartSummary2, _params$totalInfo5, _params$totalInfo6, _params$totalInfo7, _params$totalInfo8, _this$store$currentOr9, _this$store$currentOr10;
|
|
755
711
|
var validation, amountInfo, customerInfo, allOrders, existingOrder, _updated$payment2, _existingOrder$paymen, _updated$payment, currentTime, formattedExistPayments, _isNeedDeposit, _updated, syncedPayments, _syncedAmount, _totalAmount, _remainingExpectAmount, _depositDiffAmount, totalAmount, activePayments, paidAmount, remaining, _isNeedDeposit2, updated, syncedAmount, remainingExpectAmount, depositDiffAmount, isNeedDeposit, created, _syncedPayments, _syncedAmount2;
|
|
756
712
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
757
713
|
while (1) switch (_context10.prev = _context10.next) {
|
|
@@ -1003,7 +959,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1003
959
|
this.store.currentOrder = created;
|
|
1004
960
|
|
|
1005
961
|
// 🔧 新增: 如果有云端支付项,需要计算正确的待付金额
|
|
1006
|
-
if (params.existPayment && params.existPayment.length > 0) {
|
|
962
|
+
if (params.existPayment && params.existPayment.length > 0 || (_this$store$currentOr9 = this.store.currentOrder) !== null && _this$store$currentOr9 !== void 0 && _this$store$currentOr9.order_id && !isVirtualOrderId((_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.order_id)) {
|
|
1007
963
|
// 标记订单已同步(因为订单和支付项都来自云端)
|
|
1008
964
|
this.store.isOrderSynced = true;
|
|
1009
965
|
|
|
@@ -1117,8 +1073,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1117
1073
|
}, {
|
|
1118
1074
|
key: "getOrderOriginalData",
|
|
1119
1075
|
value: function getOrderOriginalData() {
|
|
1120
|
-
var _this$store$
|
|
1121
|
-
return (_this$store$
|
|
1076
|
+
var _this$store$currentOr11;
|
|
1077
|
+
return (_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.order_info;
|
|
1122
1078
|
}
|
|
1123
1079
|
|
|
1124
1080
|
/**
|
|
@@ -1967,7 +1923,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1967
1923
|
key: "setDepositAmountAsync",
|
|
1968
1924
|
value: (function () {
|
|
1969
1925
|
var _setDepositAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(depositAmount) {
|
|
1970
|
-
var _this$store$
|
|
1926
|
+
var _this$store$currentOr12, _this$store$currentOr13;
|
|
1971
1927
|
var depositValue, formattedDepositAmount, oldDepositAmount, updateParams;
|
|
1972
1928
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1973
1929
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -1975,8 +1931,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1975
1931
|
this.logInfo('setDepositAmountAsync called', {
|
|
1976
1932
|
depositAmount: depositAmount,
|
|
1977
1933
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
1978
|
-
currentOrderId: (_this$store$
|
|
1979
|
-
currentTotalAmount: (_this$store$
|
|
1934
|
+
currentOrderId: (_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.order_id,
|
|
1935
|
+
currentTotalAmount: (_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.total_amount
|
|
1980
1936
|
});
|
|
1981
1937
|
_context20.prev = 1;
|
|
1982
1938
|
// 验证定金金额格式
|
|
@@ -2096,17 +2052,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2096
2052
|
key: "manualSyncOrderAsync",
|
|
2097
2053
|
value: (function () {
|
|
2098
2054
|
var _manualSyncOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
2099
|
-
var _this$store$
|
|
2100
|
-
var _this$store$
|
|
2055
|
+
var _this$store$currentOr14, _this$store$currentOr15, _this$store$currentOr16;
|
|
2056
|
+
var _this$store$currentOr17, orderUuid, oldOrderId, syncResult, finalOrderId, finalIsVirtual, newRes, _this$store$currentOr18, errorMessage;
|
|
2101
2057
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2102
2058
|
while (1) switch (_context21.prev = _context21.next) {
|
|
2103
2059
|
case 0:
|
|
2104
2060
|
console.log('manualSyncOrderAsync called');
|
|
2105
2061
|
this.logInfo('manualSyncOrderAsync called', {
|
|
2106
2062
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
2107
|
-
currentOrderId: (_this$store$
|
|
2108
|
-
orderUuid: (_this$store$
|
|
2109
|
-
totalAmount: (_this$store$
|
|
2063
|
+
currentOrderId: (_this$store$currentOr14 = this.store.currentOrder) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.order_id,
|
|
2064
|
+
orderUuid: (_this$store$currentOr15 = this.store.currentOrder) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.uuid,
|
|
2065
|
+
totalAmount: (_this$store$currentOr16 = this.store.currentOrder) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.total_amount,
|
|
2110
2066
|
isOrderSynced: this.store.isOrderSynced,
|
|
2111
2067
|
isVirtualOrderId: this.store.currentOrder ? isVirtualOrderId(this.store.currentOrder.order_id) : false
|
|
2112
2068
|
});
|
|
@@ -2166,7 +2122,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2166
2122
|
this.logError('[Checkout] 严重警告:返回的订单ID与存储的订单ID不一致!');
|
|
2167
2123
|
}
|
|
2168
2124
|
newRes = _objectSpread(_objectSpread({}, syncResult), {}, {
|
|
2169
|
-
is_deposit: ((_this$store$
|
|
2125
|
+
is_deposit: ((_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.is_deposit) || 0
|
|
2170
2126
|
});
|
|
2171
2127
|
_context21.next = 30;
|
|
2172
2128
|
return this.updateStateAmountToRemaining(false);
|
|
@@ -2180,7 +2136,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2180
2136
|
return _context21.abrupt("return", {
|
|
2181
2137
|
success: false,
|
|
2182
2138
|
message: "\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(errorMessage),
|
|
2183
|
-
orderUuid: (_this$store$
|
|
2139
|
+
orderUuid: (_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.uuid
|
|
2184
2140
|
});
|
|
2185
2141
|
case 38:
|
|
2186
2142
|
case "end":
|
|
@@ -2257,15 +2213,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2257
2213
|
key: "cancelCurrentOrderAsync",
|
|
2258
2214
|
value: (function () {
|
|
2259
2215
|
var _cancelCurrentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(cancelReason) {
|
|
2260
|
-
var _this$store$
|
|
2216
|
+
var _this$store$currentOr19, _this$store$currentOr20, currentOrderUuid, currentOrderId, isOrderSynced, errorMessage;
|
|
2261
2217
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2262
2218
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2263
2219
|
case 0:
|
|
2264
2220
|
_context22.prev = 0;
|
|
2265
2221
|
this.logInfo('开始取消当前本地订单:', {
|
|
2266
2222
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
2267
|
-
orderUuid: (_this$store$
|
|
2268
|
-
orderId: (_this$store$
|
|
2223
|
+
orderUuid: (_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.uuid,
|
|
2224
|
+
orderId: (_this$store$currentOr20 = this.store.currentOrder) === null || _this$store$currentOr20 === void 0 ? void 0 : _this$store$currentOr20.order_id,
|
|
2269
2225
|
isOrderSynced: this.store.isOrderSynced,
|
|
2270
2226
|
cancelReason: cancelReason
|
|
2271
2227
|
});
|
|
@@ -2376,7 +2332,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2376
2332
|
key: "saveForLaterPaymentAsync",
|
|
2377
2333
|
value: (function () {
|
|
2378
2334
|
var _saveForLaterPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
2379
|
-
var orderUuid, currentOrderId, allPaymentItems, syncResult, _this$store$
|
|
2335
|
+
var orderUuid, currentOrderId, allPaymentItems, syncResult, _this$store$currentOr21, errorMessage;
|
|
2380
2336
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2381
2337
|
while (1) switch (_context23.prev = _context23.next) {
|
|
2382
2338
|
case 0:
|
|
@@ -2430,7 +2386,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2430
2386
|
return _context23.abrupt("return", {
|
|
2431
2387
|
success: false,
|
|
2432
2388
|
message: "\u8BA2\u5355\u4FDD\u5B58\u5931\u8D25: ".concat(errorMessage),
|
|
2433
|
-
orderUuid: (_this$store$
|
|
2389
|
+
orderUuid: (_this$store$currentOr21 = this.store.currentOrder) === null || _this$store$currentOr21 === void 0 ? void 0 : _this$store$currentOr21.uuid
|
|
2434
2390
|
});
|
|
2435
2391
|
case 21:
|
|
2436
2392
|
case "end":
|
|
@@ -2453,7 +2409,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2453
2409
|
key: "updateOrderNoteAsync",
|
|
2454
2410
|
value: (function () {
|
|
2455
2411
|
var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(note) {
|
|
2456
|
-
var _this$store$
|
|
2412
|
+
var _this$store$currentOr22, _this$store$currentOr23, oldNote, orderInPayment;
|
|
2457
2413
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2458
2414
|
while (1) switch (_context24.prev = _context24.next) {
|
|
2459
2415
|
case 0:
|
|
@@ -2465,7 +2421,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2465
2421
|
throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有本地订单数据,无法更新备注');
|
|
2466
2422
|
case 3:
|
|
2467
2423
|
console.log('[Checkout] 更新订单备注:', {
|
|
2468
|
-
orderUuid: (_this$store$
|
|
2424
|
+
orderUuid: (_this$store$currentOr22 = this.store.currentOrder) === null || _this$store$currentOr22 === void 0 ? void 0 : _this$store$currentOr22.uuid,
|
|
2469
2425
|
oldNote: this.store.localOrderData.shop_note,
|
|
2470
2426
|
newNote: note
|
|
2471
2427
|
});
|
|
@@ -2498,7 +2454,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2498
2454
|
case 17:
|
|
2499
2455
|
_context24.next = 19;
|
|
2500
2456
|
return this.core.effects.emit("".concat(this.name, ":onOrderNoteChanged"), {
|
|
2501
|
-
orderUuid: (_this$store$
|
|
2457
|
+
orderUuid: (_this$store$currentOr23 = this.store.currentOrder) === null || _this$store$currentOr23 === void 0 ? void 0 : _this$store$currentOr23.uuid,
|
|
2502
2458
|
oldNote: oldNote,
|
|
2503
2459
|
newNote: note,
|
|
2504
2460
|
timestamp: Date.now()
|
|
@@ -2570,7 +2526,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2570
2526
|
key: "handlePaymentSuccess",
|
|
2571
2527
|
value: (function () {
|
|
2572
2528
|
var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(data) {
|
|
2573
|
-
var _this$store$
|
|
2529
|
+
var _this$store$currentOr24;
|
|
2574
2530
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2575
2531
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2576
2532
|
case 0:
|
|
@@ -2581,7 +2537,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2581
2537
|
return this.core.effects.emit("".concat(this.name, ":onPaymentSuccess"), {
|
|
2582
2538
|
orderUuid: data.orderUuid,
|
|
2583
2539
|
paymentMethodCode: '',
|
|
2584
|
-
amount: ((_this$store$
|
|
2540
|
+
amount: ((_this$store$currentOr24 = this.store.currentOrder) === null || _this$store$currentOr24 === void 0 ? void 0 : _this$store$currentOr24.total_amount) || '0',
|
|
2585
2541
|
timestamp: data.timestamp
|
|
2586
2542
|
});
|
|
2587
2543
|
case 4:
|
|
@@ -2606,7 +2562,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2606
2562
|
key: "handlePaymentError",
|
|
2607
2563
|
value: (function () {
|
|
2608
2564
|
var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data) {
|
|
2609
|
-
var _this$store$
|
|
2565
|
+
var _this$store$currentOr25;
|
|
2610
2566
|
var error;
|
|
2611
2567
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2612
2568
|
while (1) switch (_context27.prev = _context27.next) {
|
|
@@ -2619,7 +2575,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2619
2575
|
return this.core.effects.emit("".concat(this.name, ":onPaymentFailed"), {
|
|
2620
2576
|
orderUuid: data.orderUuid,
|
|
2621
2577
|
paymentMethodCode: '',
|
|
2622
|
-
amount: ((_this$store$
|
|
2578
|
+
amount: ((_this$store$currentOr25 = this.store.currentOrder) === null || _this$store$currentOr25 === void 0 ? void 0 : _this$store$currentOr25.total_amount) || '0',
|
|
2623
2579
|
timestamp: data.timestamp
|
|
2624
2580
|
});
|
|
2625
2581
|
case 5:
|
|
@@ -3742,10 +3698,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3742
3698
|
value: (function () {
|
|
3743
3699
|
var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3744
3700
|
var _this6 = this,
|
|
3745
|
-
_this$store$currentOr24,
|
|
3746
|
-
_this$store$currentOr25,
|
|
3747
|
-
_this$store$currentCu2,
|
|
3748
3701
|
_this$store$currentOr26,
|
|
3702
|
+
_this$store$currentOr27,
|
|
3703
|
+
_this$store$currentCu2,
|
|
3704
|
+
_this$store$currentOr28,
|
|
3749
3705
|
_this$store$localOrde,
|
|
3750
3706
|
_this$store$localOrde2,
|
|
3751
3707
|
_checkoutResponse3,
|
|
@@ -3827,7 +3783,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3827
3783
|
})
|
|
3828
3784
|
});
|
|
3829
3785
|
}); // 确定最终的定金金额:优先使用手动设置的值,否则从支付项中计算
|
|
3830
|
-
manualDepositAmount = ((_this$store$
|
|
3786
|
+
manualDepositAmount = ((_this$store$currentOr26 = this.store.currentOrder) === null || _this$store$currentOr26 === void 0 ? void 0 : _this$store$currentOr26.deposit_amount) || '0.00'; // 优先级逻辑:手动设置的定金金额 > 从支付项计算的金额
|
|
3831
3787
|
manualDepositValue = new Decimal(manualDepositAmount);
|
|
3832
3788
|
if (manualDepositValue.gt(0)) {
|
|
3833
3789
|
// 如果手动设置了定金金额且大于0,使用手动设置的值
|
|
@@ -3887,7 +3843,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3887
3843
|
}),
|
|
3888
3844
|
manualDepositAmount: manualDepositAmount,
|
|
3889
3845
|
finalDepositAmount: finalDepositAmount,
|
|
3890
|
-
isDeposit: ((_this$store$
|
|
3846
|
+
isDeposit: ((_this$store$currentOr27 = this.store.currentOrder) === null || _this$store$currentOr27 === void 0 ? void 0 : _this$store$currentOr27.is_deposit) || 0
|
|
3891
3847
|
});
|
|
3892
3848
|
|
|
3893
3849
|
// 构造订单参数,直接使用 localOrderData 中已处理好的数据
|
|
@@ -3909,7 +3865,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3909
3865
|
currency_code: this.otherParams.currency_code,
|
|
3910
3866
|
currency_symbol: this.otherParams.currency_symbol,
|
|
3911
3867
|
currency_format: this.otherParams.currency_format,
|
|
3912
|
-
is_deposit: ((_this$store$
|
|
3868
|
+
is_deposit: ((_this$store$currentOr28 = this.store.currentOrder) !== null && _this$store$currentOr28 !== void 0 && _this$store$currentOr28.is_deposit || Number(finalDepositAmount) > 0 ? 1 : 0) || 0,
|
|
3913
3869
|
deposit_amount: finalDepositAmount,
|
|
3914
3870
|
// 使用最终确定的定金金额(手动设置优先)
|
|
3915
3871
|
product_tax_fee: this.store.localOrderData.tax_fee,
|
|
@@ -18,8 +18,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
18
18
|
private initializePlugins;
|
|
19
19
|
private registerDependentModules;
|
|
20
20
|
private registerEventListeners;
|
|
21
|
-
getCurrentBookingTime(): string | null;
|
|
22
|
-
private filterDiscountListByBookingTime;
|
|
23
21
|
setCustomer(customer: Customer): Promise<void>;
|
|
24
22
|
setHolders(holders: {
|
|
25
23
|
form_record_id: number;
|