@pisell/pisellos 2.1.170 → 2.1.172
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/index.d.ts +1 -1
- package/dist/index.js +1 -3
- package/dist/model/strategy/adapter/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +61 -8
- package/dist/model/strategy/adapter/walletPass/locales.js +12 -3
- package/dist/model/strategy/engine.d.ts +18 -5
- package/dist/model/strategy/engine.js +145 -45
- package/dist/model/strategy/type.d.ts +17 -0
- package/dist/model/strategy/type.js +4 -0
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +56 -25
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Discount/index.d.ts +4 -13
- package/dist/modules/Discount/index.js +12 -124
- package/dist/modules/Discount/types.d.ts +18 -13
- package/dist/modules/Order/index.d.ts +1 -67
- package/dist/modules/Order/index.js +30 -918
- package/dist/modules/Order/types.d.ts +12 -176
- package/dist/modules/Order/types.js +0 -2
- package/dist/modules/Order/utils.d.ts +0 -118
- package/dist/modules/Order/utils.js +2 -586
- package/dist/modules/Payment/index.d.ts +2 -1
- package/dist/modules/Payment/index.js +10 -7
- package/dist/modules/Payment/utils.js +3 -0
- package/dist/modules/Payment/walletpass.d.ts +23 -0
- package/dist/modules/Payment/walletpass.js +191 -95
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +2 -4
- package/dist/modules/ProductList/index.js +12 -24
- package/dist/modules/Rules/index.d.ts +9 -5
- package/dist/modules/Rules/index.js +669 -173
- package/dist/modules/Rules/types.d.ts +2 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +18 -16
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/types.d.ts +2 -0
- package/dist/modules/Summary/utils.d.ts +9 -3
- package/dist/modules/Summary/utils.js +57 -67
- package/dist/modules/index.d.ts +0 -4
- package/dist/modules/index.js +1 -5
- package/dist/plugins/window.d.ts +2 -0
- package/dist/solution/BookingByStep/index.d.ts +3 -2
- package/dist/solution/BookingByStep/index.js +43 -46
- package/dist/solution/BookingByStep/types.d.ts +1 -3
- package/dist/solution/BookingByStep/types.js +1 -5
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/Checkout/index.js +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -3
- package/dist/solution/ShopDiscount/index.js +60 -62
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.js +2 -1
- package/dist/solution/ShopDiscount/utils.js +26 -12
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -4
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +34 -3
- package/lib/model/strategy/adapter/walletPass/locales.js +12 -3
- package/lib/model/strategy/engine.d.ts +18 -5
- package/lib/model/strategy/engine.js +85 -21
- package/lib/model/strategy/type.d.ts +17 -0
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +39 -12
- package/lib/modules/Cart/utils/changePrice.js +9 -13
- package/lib/modules/Discount/index.d.ts +4 -13
- package/lib/modules/Discount/index.js +5 -76
- package/lib/modules/Discount/types.d.ts +18 -13
- package/lib/modules/Order/index.d.ts +1 -67
- package/lib/modules/Order/index.js +1 -525
- package/lib/modules/Order/types.d.ts +12 -176
- package/lib/modules/Order/utils.d.ts +0 -118
- package/lib/modules/Order/utils.js +2 -483
- package/lib/modules/Payment/index.d.ts +2 -1
- package/lib/modules/Payment/index.js +1 -0
- package/lib/modules/Payment/utils.js +3 -0
- package/lib/modules/Payment/walletpass.d.ts +23 -0
- package/lib/modules/Payment/walletpass.js +94 -17
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +2 -4
- package/lib/modules/ProductList/index.js +39 -46
- package/lib/modules/Rules/index.d.ts +9 -5
- package/lib/modules/Rules/index.js +776 -292
- package/lib/modules/Rules/types.d.ts +2 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +11 -13
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/types.d.ts +2 -0
- package/lib/modules/Summary/utils.d.ts +9 -3
- package/lib/modules/Summary/utils.js +34 -45
- package/lib/modules/index.d.ts +0 -4
- package/lib/modules/index.js +1 -9
- package/lib/plugins/window.d.ts +2 -0
- package/lib/solution/BookingByStep/index.d.ts +3 -2
- package/lib/solution/BookingByStep/index.js +4 -6
- package/lib/solution/BookingByStep/types.d.ts +1 -3
- package/lib/solution/BookingByStep/types.js +0 -10
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/Checkout/index.js +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -3
- package/lib/solution/ShopDiscount/index.js +27 -22
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.js +10 -6
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/package.json +2 -2
- package/dist/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -867
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -149
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/dist/modules/OpenData/index.d.ts +0 -24
- package/dist/modules/OpenData/index.js +0 -173
- package/dist/modules/OpenData/types.d.ts +0 -73
- package/dist/modules/OpenData/types.js +0 -1
- package/dist/modules/OpenData/utils.d.ts +0 -2
- package/dist/modules/OpenData/utils.js +0 -75
- package/dist/modules/Quotation/index.d.ts +0 -48
- package/dist/modules/Quotation/index.js +0 -248
- package/dist/modules/Quotation/types.d.ts +0 -42
- package/dist/modules/Quotation/types.js +0 -1
- package/dist/modules/SalesSummary/index.d.ts +0 -63
- package/dist/modules/SalesSummary/index.js +0 -174
- package/dist/modules/SalesSummary/types.d.ts +0 -60
- package/dist/modules/SalesSummary/types.js +0 -1
- package/dist/modules/SalesSummary/utils.d.ts +0 -30
- package/dist/modules/SalesSummary/utils.js +0 -480
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -23
- package/dist/modules/ScanOrderLogger/index.js +0 -174
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +0 -221
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/providers/grafana.js +0 -50
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
- package/dist/modules/ScanOrderLogger/types.js +0 -1
- package/dist/solution/ScanOrder/index.d.ts +0 -158
- package/dist/solution/ScanOrder/index.js +0 -3474
- package/dist/solution/ScanOrder/types.d.ts +0 -306
- package/dist/solution/ScanOrder/types.js +0 -35
- package/dist/solution/ScanOrder/utils.d.ts +0 -172
- package/dist/solution/ScanOrder/utils.js +0 -796
- package/dist/solution/VenueBooking/index.d.ts +0 -252
- package/dist/solution/VenueBooking/index.js +0 -3769
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -343
- package/dist/solution/VenueBooking/types.d.ts +0 -156
- package/dist/solution/VenueBooking/types.js +0 -22
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
- package/dist/solution/VenueBooking/utils/dateSummary.js +0 -91
- package/dist/solution/VenueBooking/utils/resource.d.ts +0 -14
- package/dist/solution/VenueBooking/utils/resource.js +0 -131
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -32
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -233
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -71
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -302
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -34
- package/dist/solution/VenueBooking/utils/timeSlot.js +0 -458
- package/dist/solution/VenueBooking/utils.d.ts +0 -1
- package/dist/solution/VenueBooking/utils.js +0 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -666
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -149
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
- package/lib/modules/OpenData/index.d.ts +0 -24
- package/lib/modules/OpenData/index.js +0 -119
- package/lib/modules/OpenData/types.d.ts +0 -73
- package/lib/modules/OpenData/types.js +0 -17
- package/lib/modules/OpenData/utils.d.ts +0 -2
- package/lib/modules/OpenData/utils.js +0 -111
- package/lib/modules/Quotation/index.d.ts +0 -48
- package/lib/modules/Quotation/index.js +0 -152
- package/lib/modules/Quotation/types.d.ts +0 -42
- package/lib/modules/Quotation/types.js +0 -17
- package/lib/modules/SalesSummary/index.d.ts +0 -63
- package/lib/modules/SalesSummary/index.js +0 -105
- package/lib/modules/SalesSummary/types.d.ts +0 -60
- package/lib/modules/SalesSummary/types.js +0 -17
- package/lib/modules/SalesSummary/utils.d.ts +0 -30
- package/lib/modules/SalesSummary/utils.js +0 -420
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -23
- package/lib/modules/ScanOrderLogger/index.js +0 -147
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/providers/feishu.js +0 -157
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/providers/grafana.js +0 -52
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
- package/lib/modules/ScanOrderLogger/types.js +0 -17
- package/lib/solution/ScanOrder/index.d.ts +0 -158
- package/lib/solution/ScanOrder/index.js +0 -2135
- package/lib/solution/ScanOrder/types.d.ts +0 -306
- package/lib/solution/ScanOrder/types.js +0 -36
- package/lib/solution/ScanOrder/utils.d.ts +0 -172
- package/lib/solution/ScanOrder/utils.js +0 -658
- package/lib/solution/VenueBooking/index.d.ts +0 -252
- package/lib/solution/VenueBooking/index.js +0 -2204
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -343
- package/lib/solution/VenueBooking/types.d.ts +0 -156
- package/lib/solution/VenueBooking/types.js +0 -45
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
- package/lib/solution/VenueBooking/utils/dateSummary.js +0 -105
- package/lib/solution/VenueBooking/utils/resource.d.ts +0 -14
- package/lib/solution/VenueBooking/utils/resource.js +0 -92
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -32
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -236
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -71
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -225
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -34
- package/lib/solution/VenueBooking/utils/timeSlot.js +0 -343
- package/lib/solution/VenueBooking/utils.d.ts +0 -1
- package/lib/solution/VenueBooking/utils.js +0 -69
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
3
|
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."); }
|
|
6
4
|
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); }
|
|
@@ -163,10 +161,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
163
161
|
case 2:
|
|
164
162
|
prepareConfig = _context4.sent;
|
|
165
163
|
goodPassList = this.filterEnabledDiscountList([].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []))) || []; // this.setDiscountList(goodPassList);
|
|
166
|
-
return _context4.abrupt("return",
|
|
167
|
-
discountList: goodPassList,
|
|
168
|
-
availableWalletIds: this.extractAvailableWalletIds(prepareConfig === null || prepareConfig === void 0 ? void 0 : prepareConfig.data)
|
|
169
|
-
});
|
|
164
|
+
return _context4.abrupt("return", goodPassList);
|
|
170
165
|
case 5:
|
|
171
166
|
case "end":
|
|
172
167
|
return _context4.stop();
|
|
@@ -178,53 +173,31 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
178
173
|
}
|
|
179
174
|
return loadPrepareConfig;
|
|
180
175
|
}()
|
|
181
|
-
}, {
|
|
182
|
-
key: "extractAvailableWalletIds",
|
|
183
|
-
value: function extractAvailableWalletIds(data) {
|
|
184
|
-
var availableWalletList = Array.isArray(data === null || data === void 0 ? void 0 : data.avaiable_wallet_list) ? data.avaiable_wallet_list : Array.isArray(data === null || data === void 0 ? void 0 : data.available_wallet_list) ? data.available_wallet_list : [];
|
|
185
|
-
var availableWalletPassList = Array.isArray(data === null || data === void 0 ? void 0 : data.available_wallet_pass_list) ? data.available_wallet_pass_list : [];
|
|
186
|
-
var walletIds = availableWalletList.map(function (item) {
|
|
187
|
-
return Number(item === null || item === void 0 ? void 0 : item.wallet_id);
|
|
188
|
-
}).filter(function (id) {
|
|
189
|
-
return Number.isFinite(id) && id > 0;
|
|
190
|
-
});
|
|
191
|
-
var walletPassProductIds = availableWalletPassList.map(function (item) {
|
|
192
|
-
return Number(item === null || item === void 0 ? void 0 : item.product_id);
|
|
193
|
-
}).filter(function (id) {
|
|
194
|
-
return Number.isFinite(id) && id > 0;
|
|
195
|
-
});
|
|
196
|
-
return Array.from(new Set([].concat(_toConsumableArray(walletIds), _toConsumableArray(walletPassProductIds))));
|
|
197
|
-
}
|
|
198
176
|
}, {
|
|
199
177
|
key: "batchSearch",
|
|
200
178
|
value: function () {
|
|
201
|
-
var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code,
|
|
202
|
-
var
|
|
179
|
+
var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
|
|
180
|
+
var result, resultDiscountList;
|
|
203
181
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
204
182
|
while (1) switch (_context5.prev = _context5.next) {
|
|
205
183
|
case 0:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({
|
|
184
|
+
_context5.next = 2;
|
|
185
|
+
return this.request.get("/machinecode/batch-search", {
|
|
209
186
|
code: code,
|
|
210
187
|
translate_flag: 1,
|
|
211
188
|
tags: ['good_pass', 'product_discount_card'],
|
|
212
|
-
|
|
189
|
+
available: 1,
|
|
213
190
|
relation_product: 1,
|
|
214
191
|
with: ['extensionData', 'customScheduleSnapshot', 'holder.detail'],
|
|
215
192
|
order_behavior_count: 1,
|
|
216
|
-
order_behavior_count_customer_id: customerId || 1
|
|
217
|
-
}, orderId ? {
|
|
218
|
-
order_behavior_count_order_id: orderId
|
|
219
|
-
} : {}), {}, {
|
|
220
|
-
unified_status_info_flag: 1,
|
|
193
|
+
order_behavior_count_customer_id: customerId || 1,
|
|
221
194
|
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
222
|
-
})
|
|
223
|
-
case
|
|
195
|
+
});
|
|
196
|
+
case 2:
|
|
224
197
|
result = _context5.sent;
|
|
225
|
-
|
|
226
|
-
return _context5.abrupt("return",
|
|
227
|
-
case
|
|
198
|
+
resultDiscountList = this.filterEnabledDiscountList((result === null || result === void 0 ? void 0 : result.data) || []) || [];
|
|
199
|
+
return _context5.abrupt("return", resultDiscountList);
|
|
200
|
+
case 5:
|
|
228
201
|
case "end":
|
|
229
202
|
return _context5.stop();
|
|
230
203
|
}
|
|
@@ -332,91 +305,6 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
332
305
|
return true;
|
|
333
306
|
}
|
|
334
307
|
|
|
335
|
-
// 过滤启用且可用的优惠券,并返回校验失败原因
|
|
336
|
-
}, {
|
|
337
|
-
key: "filterEnabledDiscountListWithReason",
|
|
338
|
-
value: function filterEnabledDiscountListWithReason(discountList) {
|
|
339
|
-
var _this3 = this;
|
|
340
|
-
var lists = discountList.filter(function (discount) {
|
|
341
|
-
return discount.limit_status === 'enable';
|
|
342
|
-
}).filter(function (discount) {
|
|
343
|
-
var remaining = new Decimal((discount === null || discount === void 0 ? void 0 : discount.par_value) || 0).minus(new Decimal((discount === null || discount === void 0 ? void 0 : discount.used_par_value) || 0)).greaterThan(0);
|
|
344
|
-
return remaining;
|
|
345
|
-
}).map(function (discount) {
|
|
346
|
-
var limitFailKey = _this3.checkUsageCreditsLimitWithFailKey(discount);
|
|
347
|
-
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
348
|
-
usageLimitFailKey: limitFailKey
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
// 可用的列表
|
|
353
|
-
var availableLists = lists.filter(function (item) {
|
|
354
|
-
return !item.usageLimitFailKey && item.unified_available_status !== 0;
|
|
355
|
-
});
|
|
356
|
-
// 不可用数据
|
|
357
|
-
var currentFailDiscount = lists.find(function (item) {
|
|
358
|
-
return item.usageLimitFailKey;
|
|
359
|
-
});
|
|
360
|
-
return {
|
|
361
|
-
discountList: availableLists,
|
|
362
|
-
unavailableReasonKey: currentFailDiscount === null || currentFailDiscount === void 0 ? void 0 : currentFailDiscount.usageLimitFailKey
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// 检查使用次数限制,并返回校验失败原因
|
|
367
|
-
}, {
|
|
368
|
-
key: "checkUsageCreditsLimitWithFailKey",
|
|
369
|
-
value: function checkUsageCreditsLimitWithFailKey(discount) {
|
|
370
|
-
if (!discount.extension_data || discount.extension_data.length === 0) {
|
|
371
|
-
return null;
|
|
372
|
-
}
|
|
373
|
-
var usageCreditsData = discount.extension_data.find(function (data) {
|
|
374
|
-
return data.field_key === 'usage_credits';
|
|
375
|
-
});
|
|
376
|
-
if (!usageCreditsData) {
|
|
377
|
-
return null;
|
|
378
|
-
}
|
|
379
|
-
var value = usageCreditsData.value;
|
|
380
|
-
|
|
381
|
-
// 总次数限制
|
|
382
|
-
if (value.total_credits && value.total_credits > 0) {
|
|
383
|
-
if ((discount.total_order_behavior_count || 0) >= value.total_credits) {
|
|
384
|
-
return 'total_credits';
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// 单用户限制
|
|
389
|
-
if (value.per_user_limit && value.per_user_limit > 0) {
|
|
390
|
-
if ((discount.customer_order_behavior_count || 0) >= value.per_user_limit) {
|
|
391
|
-
return 'per_user_limit';
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// 单日限制
|
|
396
|
-
if (value.max_per_day && value.max_per_day > 0) {
|
|
397
|
-
if ((discount.today_order_behavior_count || 0) >= value.max_per_day) {
|
|
398
|
-
return 'max_per_day';
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// 单周限制
|
|
403
|
-
if (value.max_per_week && value.max_per_week > 0) {
|
|
404
|
-
if ((discount.week_order_behavior_count || 0) >= value.max_per_week) {
|
|
405
|
-
return 'max_per_week';
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
// 单月限制
|
|
410
|
-
if (value.max_per_month && value.max_per_month > 0) {
|
|
411
|
-
if ((discount.month_order_behavior_count || 0) >= value.max_per_month) {
|
|
412
|
-
return 'max_per_month';
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// 全部通过
|
|
417
|
-
return null;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
308
|
// 根据productIds去重
|
|
421
309
|
}, {
|
|
422
310
|
key: "uniqueByProductId",
|
|
@@ -33,8 +33,8 @@ interface Limitedrelationproductdata {
|
|
|
33
33
|
product_ids: number[];
|
|
34
34
|
product_collection_id: number[];
|
|
35
35
|
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
filter: 0 | 1;
|
|
37
|
+
exclude_product_ids: number[];
|
|
38
38
|
}
|
|
39
39
|
interface ApplicableProductDetails {
|
|
40
40
|
amount: string;
|
|
@@ -63,15 +63,6 @@ interface UsageCreditsValue {
|
|
|
63
63
|
max_per_week: number;
|
|
64
64
|
max_per_month: number;
|
|
65
65
|
}
|
|
66
|
-
export type DiscountFilterRejectKey = 'total_credits' | 'per_user_limit' | 'max_per_day' | 'max_per_week' | 'max_per_month';
|
|
67
|
-
export interface DiscountWithReason {
|
|
68
|
-
discountList: Discount[];
|
|
69
|
-
unavailableReasonKey: DiscountFilterRejectKey | null;
|
|
70
|
-
}
|
|
71
|
-
export interface DiscountPrepareConfigResult {
|
|
72
|
-
discountList: Discount[];
|
|
73
|
-
availableWalletIds: number[];
|
|
74
|
-
}
|
|
75
66
|
interface ExtensionData {
|
|
76
67
|
id: number;
|
|
77
68
|
shop_id: number;
|
|
@@ -100,6 +91,7 @@ export interface Discount {
|
|
|
100
91
|
balance: string;
|
|
101
92
|
format_title: Formattitle;
|
|
102
93
|
metadata?: {
|
|
94
|
+
num?: number;
|
|
103
95
|
discount_card_type?: 'fixed_amount' | 'percent';
|
|
104
96
|
custom_product_bundle_map_id?: string;
|
|
105
97
|
validity_type?: "custom_schedule_validity" | "fixed_validity";
|
|
@@ -124,6 +116,21 @@ export interface Discount {
|
|
|
124
116
|
isSelected?: boolean;
|
|
125
117
|
isAvailable?: boolean;
|
|
126
118
|
isUsed?: boolean;
|
|
119
|
+
config?: {
|
|
120
|
+
isAvailable?: boolean;
|
|
121
|
+
/** 最大抵扣金额 */
|
|
122
|
+
maxDeductionAmount?: number;
|
|
123
|
+
/** 每单最多使用张数 */
|
|
124
|
+
maxUsagePerOrder?: number;
|
|
125
|
+
/** 是否抵扣税费与附加费 */
|
|
126
|
+
deductTaxAndFee?: boolean;
|
|
127
|
+
/** 适用粒度(多商品共用) */
|
|
128
|
+
allowCrossProduct?: boolean;
|
|
129
|
+
/** 可用商品数量上限 */
|
|
130
|
+
applicableProductLimit?: number;
|
|
131
|
+
/** 是否抵扣单规格价格 (Option Price) */
|
|
132
|
+
deductOptionPrice?: boolean;
|
|
133
|
+
};
|
|
127
134
|
applicableProductIds?: number[];
|
|
128
135
|
applicableProductDetails: ApplicableProductDetails[];
|
|
129
136
|
appliedProductDetails: ApplicableProductDetails[];
|
|
@@ -142,8 +149,6 @@ export interface Discount {
|
|
|
142
149
|
start_date?: string;
|
|
143
150
|
start_time?: string;
|
|
144
151
|
discount_rule_uncheck_flag?: boolean;
|
|
145
|
-
usageLimitFailKey?: string | null;
|
|
146
|
-
unified_available_status?: number | undefined | null;
|
|
147
152
|
}
|
|
148
153
|
export interface DiscountState {
|
|
149
154
|
discountList: Discount[];
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams,
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
|
-
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
|
|
7
|
-
import type { Discount } from '../Discount/types';
|
|
8
|
-
import { UnavailableReason } from '../Rules/types';
|
|
9
5
|
export declare class OrderModule extends BaseModule implements Module, OrderModuleAPI {
|
|
10
6
|
protected defaultName: string;
|
|
11
7
|
protected defaultVersion: string;
|
|
12
8
|
private store;
|
|
13
9
|
private request;
|
|
14
10
|
private logger;
|
|
15
|
-
private window;
|
|
16
|
-
private cacheId;
|
|
17
|
-
private salesSummaryModuleName;
|
|
18
|
-
private rulesHooksOverride?;
|
|
19
|
-
/**
|
|
20
|
-
* Populate `savedAmount` on each discount based on product-level discount details.
|
|
21
|
-
* Only selected discounts get a non-zero value.
|
|
22
|
-
*/
|
|
23
|
-
static populateSavedAmounts(productList: Array<Record<string, any>>, discountList: Array<Record<string, any>>): void;
|
|
24
11
|
constructor(name?: string, version?: string);
|
|
25
12
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
26
13
|
/**
|
|
@@ -35,54 +22,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
35
22
|
* 记录错误日志
|
|
36
23
|
*/
|
|
37
24
|
private logError;
|
|
38
|
-
private registerDiscountModules;
|
|
39
|
-
private createDefaultRulesHooks;
|
|
40
|
-
loadDiscountConfig(params: {
|
|
41
|
-
customerId: number;
|
|
42
|
-
action?: 'create';
|
|
43
|
-
}): Promise<void>;
|
|
44
|
-
getDiscountList(): Discount[];
|
|
45
|
-
getAvailableWalletIds(): number[];
|
|
46
|
-
scanCode(code: string, customerId?: number): Promise<{
|
|
47
|
-
isAvailable: boolean;
|
|
48
|
-
discountList: Discount[];
|
|
49
|
-
type: 'server' | 'clientCalc';
|
|
50
|
-
unavailableReason?: UnavailableReason;
|
|
51
|
-
unavailableReasonKey?: string | null;
|
|
52
|
-
}>;
|
|
53
|
-
applyDiscount(): void;
|
|
54
|
-
initTempOrder(params: {
|
|
55
|
-
cacheId?: string;
|
|
56
|
-
salesSummaryModuleName?: string;
|
|
57
|
-
}): void;
|
|
58
|
-
private getTempOrderStorageKey;
|
|
59
|
-
private restoreTempOrderFromStorage;
|
|
60
|
-
persistTempOrder(): void;
|
|
61
|
-
private createDefaultTempOrderInstance;
|
|
62
|
-
ensureTempOrder(): ScanOrderTempOrder;
|
|
63
|
-
restoreOrder(): ScanOrderTempOrder;
|
|
64
|
-
getTempOrder(): ScanOrderTempOrder | null;
|
|
65
|
-
addNewOrder(): Promise<ScanOrderTempOrder>;
|
|
66
|
-
getOrderProducts(): ScanOrderOrderProduct[];
|
|
67
|
-
private getSalesSummary;
|
|
68
|
-
recalculateSummary(options?: {
|
|
69
|
-
createIfMissing?: boolean;
|
|
70
|
-
}): Promise<ScanOrderSummary | null>;
|
|
71
|
-
getScanOrderSummary(): Promise<ScanOrderSummary>;
|
|
72
|
-
updateTempOrderNote(note: string): string;
|
|
73
|
-
updateTempOrderBuzzer(buzzer: string): string;
|
|
74
|
-
updateTempOrderContactsInfo(contactsInfo: any[]): any[];
|
|
75
|
-
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
76
|
-
updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
|
|
77
|
-
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
78
|
-
submitTempOrder<T = any>(params?: {
|
|
79
|
-
cacheId?: string;
|
|
80
|
-
platform?: string;
|
|
81
|
-
businessCode?: string;
|
|
82
|
-
channel?: string;
|
|
83
|
-
type?: string;
|
|
84
|
-
enhancePayload?: SubmitPayloadEnhancer;
|
|
85
|
-
}): Promise<T>;
|
|
86
25
|
createOrder(params: CommitOrderParams['query']): {
|
|
87
26
|
type: "virtual" | "appointment_booking";
|
|
88
27
|
platform: string;
|
|
@@ -112,9 +51,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
112
51
|
* @returns 后端返回的订单数据(包含订单ID等)
|
|
113
52
|
*/
|
|
114
53
|
createOrderByCheckout(params: CheckoutOrderParams): Promise<any>;
|
|
115
|
-
submitScanOrder<T = any>(params: SubmitScanOrderParams): Promise<T>;
|
|
116
|
-
scanOrderMore<T = any>(params: ScanOrderMoreParams): Promise<T>;
|
|
117
|
-
getOrderInfoByRemote(order_id: number): Promise<any>;
|
|
118
|
-
getLastOrderInfo(): Record<string, any> | undefined;
|
|
119
54
|
}
|
|
120
|
-
export type { UpdateProductInOrderParams } from './types';
|