@pisell/pisellos 2.2.277 → 2.2.278
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/Payment/walletpass.js +27 -6
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/modules/Payment/walletpass.js +15 -1
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/package.json +1 -1
|
@@ -5,15 +5,15 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
5
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
6
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
11
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
12
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
14
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
16
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -104,6 +104,26 @@ function mergeWalletAssets() {
|
|
|
104
104
|
});
|
|
105
105
|
return merged;
|
|
106
106
|
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 聚合接口不保证 recalculate_list 顺序;派生抵扣额依赖选择顺序,
|
|
110
|
+
* 因此已选资产必须先恢复为 selectedIds 的顺序再进入策略计算。
|
|
111
|
+
*/
|
|
112
|
+
function orderWalletAssetsByIds(assets, orderedIds) {
|
|
113
|
+
var assetByKey = new Map(assets.map(function (asset) {
|
|
114
|
+
return [getWalletAssetKey(asset), asset];
|
|
115
|
+
}));
|
|
116
|
+
var orderedKeys = new Set(orderedIds.map(function (id) {
|
|
117
|
+
return String(id);
|
|
118
|
+
}));
|
|
119
|
+
return [].concat(_toConsumableArray(orderedIds.map(function (id) {
|
|
120
|
+
return assetByKey.get(String(id));
|
|
121
|
+
}).filter(function (asset) {
|
|
122
|
+
return asset !== undefined;
|
|
123
|
+
})), _toConsumableArray(assets.filter(function (asset) {
|
|
124
|
+
return !orderedKeys.has(getWalletAssetKey(asset));
|
|
125
|
+
})));
|
|
126
|
+
}
|
|
107
127
|
function createInitialWalletAssetsState() {
|
|
108
128
|
return {
|
|
109
129
|
status: 'idle',
|
|
@@ -668,7 +688,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
668
688
|
value: (function () {
|
|
669
689
|
var _aggregateRecalculateWalletAssetsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessData, selectedIds) {
|
|
670
690
|
var _this$paymentModule$w7, _this$paymentModule$w8;
|
|
671
|
-
var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
|
|
691
|
+
var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, orderedRecalculateList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
|
|
672
692
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
673
693
|
while (1) switch (_context4.prev = _context4.next) {
|
|
674
694
|
case 0:
|
|
@@ -704,7 +724,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
704
724
|
case 11:
|
|
705
725
|
recalculateList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.recalculate_list) ? responseData.recalculate_list : [];
|
|
706
726
|
customerWalletPassList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.customer_wallet_pass_list) ? responseData.customer_wallet_pass_list : [];
|
|
707
|
-
|
|
727
|
+
orderedRecalculateList = orderWalletAssetsByIds(recalculateList, selectedIds);
|
|
728
|
+
allList = mergeWalletAssets(orderedRecalculateList, customerWalletPassList);
|
|
708
729
|
walletPassEvaluator = (_this$paymentModule$w7 = this.paymentModule.window) === null || _this$paymentModule$w7 === void 0 || (_this$paymentModule$w8 = _this$paymentModule$w7.getWalletPassEvaluator) === null || _this$paymentModule$w8 === void 0 ? void 0 : _this$paymentModule$w8.call(_this$paymentModule$w7);
|
|
709
730
|
evaluated = walletPassEvaluator !== null && walletPassEvaluator !== void 0 && walletPassEvaluator.getRecommendedVouchers ? walletPassEvaluator.getRecommendedVouchers({
|
|
710
731
|
orderTotalAmount: walletParams.order_wait_pay_amount,
|
|
@@ -748,7 +769,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
748
769
|
products: walletParams.products || [],
|
|
749
770
|
authoritativeSelectedIds: authoritativeSelectedIds
|
|
750
771
|
});
|
|
751
|
-
case
|
|
772
|
+
case 25:
|
|
752
773
|
case "end":
|
|
753
774
|
return _context4.stop();
|
|
754
775
|
}
|
|
@@ -619,7 +619,8 @@ function formatBundlePrice(bundle, currencySymbol) {
|
|
|
619
619
|
var _ref33, _ref34, _bundle$bundle_sellin;
|
|
620
620
|
var value = (_ref33 = (_ref34 = (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.bundle_sum_price) !== null && _ref34 !== void 0 ? _ref34 : bundle.price) !== null && _ref33 !== void 0 ? _ref33 : 0;
|
|
621
621
|
var amount = new Decimal(toMoneyNumber(value));
|
|
622
|
-
|
|
622
|
+
// 套餐价格协议:只有 markdown 是减价;加价与商品原价都保持正数。
|
|
623
|
+
var isNegative = bundle.price_type === 'markdown';
|
|
623
624
|
if (isNegative) return "-".concat(currencySymbol).concat(amount.abs().toFixed(2));
|
|
624
625
|
return formatMoney(amount, currencySymbol);
|
|
625
626
|
}
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
326
326
|
* 获取当前的客户搜索条件
|
|
327
327
|
* @returns 当前搜索条件
|
|
328
328
|
*/
|
|
329
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
329
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
330
330
|
/**
|
|
331
331
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
332
332
|
* @returns 客户状态
|
|
@@ -445,19 +445,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
445
445
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
446
446
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
447
447
|
*/
|
|
448
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
449
|
-
action: "reloadCatalog";
|
|
450
|
-
} | {
|
|
451
|
-
action: "add";
|
|
452
|
-
cacheItem: any;
|
|
453
|
-
} | {
|
|
454
|
-
action: "requiresDetail";
|
|
455
|
-
payload: AddProductRequiresDetailPayload;
|
|
456
|
-
} | {
|
|
457
|
-
action: "requiresBookingEdit";
|
|
458
|
-
cacheItem: any;
|
|
459
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
460
|
-
};
|
|
448
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
461
449
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
462
450
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
463
451
|
/**
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
+
var promotion_exports = {};
|
|
31
|
+
__export(promotion_exports, {
|
|
32
|
+
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
+
ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
|
|
34
|
+
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
|
+
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
37
|
+
default: () => import_adapter2.default
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(promotion_exports);
|
|
40
|
+
var import_evaluator = require("./evaluator");
|
|
41
|
+
var import_adapter = require("./adapter");
|
|
42
|
+
var import_adapter2 = __toESM(require("./adapter"));
|
|
43
|
+
var import_examples = require("./examples");
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
+
ITEM_REWARD_STRATEGY,
|
|
48
|
+
PromotionAdapter,
|
|
49
|
+
PromotionEvaluator,
|
|
50
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
51
|
+
});
|
|
@@ -109,6 +109,16 @@ function mergeWalletAssets(...groups) {
|
|
|
109
109
|
});
|
|
110
110
|
return merged;
|
|
111
111
|
}
|
|
112
|
+
function orderWalletAssetsByIds(assets, orderedIds) {
|
|
113
|
+
const assetByKey = new Map(
|
|
114
|
+
assets.map((asset) => [getWalletAssetKey(asset), asset])
|
|
115
|
+
);
|
|
116
|
+
const orderedKeys = new Set(orderedIds.map((id) => String(id)));
|
|
117
|
+
return [
|
|
118
|
+
...orderedIds.map((id) => assetByKey.get(String(id))).filter((asset) => asset !== void 0),
|
|
119
|
+
...assets.filter((asset) => !orderedKeys.has(getWalletAssetKey(asset)))
|
|
120
|
+
];
|
|
121
|
+
}
|
|
112
122
|
function createInitialWalletAssetsState() {
|
|
113
123
|
return {
|
|
114
124
|
status: "idle",
|
|
@@ -605,8 +615,12 @@ var WalletPassPaymentImpl = class {
|
|
|
605
615
|
const customerWalletPassList = Array.isArray(
|
|
606
616
|
responseData == null ? void 0 : responseData.customer_wallet_pass_list
|
|
607
617
|
) ? responseData.customer_wallet_pass_list : [];
|
|
608
|
-
const
|
|
618
|
+
const orderedRecalculateList = orderWalletAssetsByIds(
|
|
609
619
|
recalculateList,
|
|
620
|
+
selectedIds
|
|
621
|
+
);
|
|
622
|
+
const allList = mergeWalletAssets(
|
|
623
|
+
orderedRecalculateList,
|
|
610
624
|
customerWalletPassList
|
|
611
625
|
);
|
|
612
626
|
const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
@@ -562,7 +562,7 @@ function buildOptionTitleSuffix(options) {
|
|
|
562
562
|
function formatBundlePrice(bundle, currencySymbol) {
|
|
563
563
|
const value = bundle.bundle_selling_price ?? bundle.bundle_sum_price ?? bundle.price ?? 0;
|
|
564
564
|
const amount = new import_decimal.default(toMoneyNumber(value));
|
|
565
|
-
const isNegative = bundle.price_type === "markdown"
|
|
565
|
+
const isNegative = bundle.price_type === "markdown";
|
|
566
566
|
if (isNegative)
|
|
567
567
|
return `-${currencySymbol}${amount.abs().toFixed(2)}`;
|
|
568
568
|
return formatMoney(amount, currencySymbol);
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
326
326
|
* 获取当前的客户搜索条件
|
|
327
327
|
* @returns 当前搜索条件
|
|
328
328
|
*/
|
|
329
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
329
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
330
330
|
/**
|
|
331
331
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
332
332
|
* @returns 客户状态
|
|
@@ -445,19 +445,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
445
445
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
446
446
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
447
447
|
*/
|
|
448
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
449
|
-
action: "reloadCatalog";
|
|
450
|
-
} | {
|
|
451
|
-
action: "add";
|
|
452
|
-
cacheItem: any;
|
|
453
|
-
} | {
|
|
454
|
-
action: "requiresDetail";
|
|
455
|
-
payload: AddProductRequiresDetailPayload;
|
|
456
|
-
} | {
|
|
457
|
-
action: "requiresBookingEdit";
|
|
458
|
-
cacheItem: any;
|
|
459
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
460
|
-
};
|
|
448
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
461
449
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
462
450
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
463
451
|
/**
|