@pisell/pisellos 2.2.244 → 2.2.246
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/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/utils/cartProduct.js +24 -3
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +1 -1
- package/dist/modules/Discount/index.js +13 -6
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +37 -17
- package/dist/modules/Order/index.d.ts +277 -18
- package/dist/modules/Order/index.js +3581 -779
- package/dist/modules/Order/types.d.ts +286 -31
- package/dist/modules/Order/types.js +38 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils.d.ts +147 -5
- package/dist/modules/Order/utils.js +750 -104
- package/dist/modules/Payment/index.d.ts +10 -13
- package/dist/modules/Payment/index.js +467 -837
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +2 -1
- package/dist/modules/Payment/walletpass.js +41 -25
- package/dist/modules/ProductList/index.d.ts +16 -12
- package/dist/modules/ProductList/index.js +133 -59
- package/dist/modules/ProductList/types.d.ts +14 -0
- package/dist/modules/Quotation/index.d.ts +0 -1
- package/dist/modules/Quotation/index.js +25 -22
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +97 -70
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/SalesSummary/index.d.ts +8 -25
- package/dist/modules/SalesSummary/index.js +86 -35
- package/dist/modules/SalesSummary/types.d.ts +4 -1
- package/dist/modules/SalesSummary/utils.d.ts +2 -25
- package/dist/modules/SalesSummary/utils.js +794 -162
- package/dist/modules/Schedule/index.d.ts +7 -0
- package/dist/modules/Schedule/index.js +24 -2
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +16 -0
- package/dist/modules/SurchargeList/index.js +162 -0
- package/dist/modules/SurchargeList/types.d.ts +11 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +204 -1
- package/dist/server/index.js +3654 -922
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/order/index.d.ts +120 -3
- package/dist/server/modules/order/index.js +1762 -448
- package/dist/server/modules/order/types.d.ts +32 -3
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/modules/order/utils/filterBookings.js +26 -3
- package/dist/server/modules/order/utils/filterOrders.js +23 -8
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +34 -7
- package/dist/server/modules/products/index.js +631 -317
- package/dist/server/modules/resource/index.d.ts +2 -0
- package/dist/server/modules/resource/index.js +29 -3
- package/dist/server/modules/schedule/index.d.ts +4 -4
- package/dist/server/modules/schedule/index.js +111 -88
- package/dist/server/test.json +713 -0
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +840 -0
- package/dist/solution/BaseSales/index.d.ts +133 -10
- package/dist/solution/BaseSales/index.js +1950 -447
- package/dist/solution/BaseSales/types.d.ts +82 -6
- package/dist/solution/BaseSales/types.js +5 -4
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +62 -21
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +271 -11
- package/dist/solution/BookingTicket/index.js +1777 -242
- package/dist/solution/BookingTicket/types.d.ts +118 -1
- package/dist/solution/BookingTicket/types.js +41 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/dist/solution/BookingTicket/utils/cartView.js +94 -7
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +10 -9
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +241 -134
- package/dist/solution/ScanOrder/types.d.ts +9 -5
- package/dist/solution/ScanOrder/types.js +2 -3
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +84 -22
- package/dist/solution/VenueBooking/index.d.ts +5 -2
- package/dist/solution/VenueBooking/index.js +110 -59
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/dist/types/index.d.ts +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +368 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +154 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Cart/utils/cartProduct.js +20 -3
- package/lib/modules/Cart/utils/changePrice.js +12 -20
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +64 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +1 -1
- package/lib/modules/Discount/index.js +9 -1
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +19 -5
- package/lib/modules/Order/index.d.ts +277 -18
- package/lib/modules/Order/index.js +2317 -337
- package/lib/modules/Order/types.d.ts +286 -31
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils.d.ts +147 -5
- package/lib/modules/Order/utils.js +615 -46
- package/lib/modules/Payment/index.d.ts +10 -13
- package/lib/modules/Payment/index.js +18 -150
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +2 -1
- package/lib/modules/Payment/walletpass.js +16 -3
- package/lib/modules/ProductList/index.d.ts +16 -12
- package/lib/modules/ProductList/index.js +41 -4
- package/lib/modules/ProductList/types.d.ts +14 -0
- package/lib/modules/Quotation/index.d.ts +0 -1
- package/lib/modules/Quotation/index.js +19 -16
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +137 -120
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/SalesSummary/index.d.ts +8 -25
- package/lib/modules/SalesSummary/index.js +30 -4
- package/lib/modules/SalesSummary/types.d.ts +4 -1
- package/lib/modules/SalesSummary/utils.d.ts +2 -25
- package/lib/modules/SalesSummary/utils.js +645 -91
- package/lib/modules/Schedule/index.d.ts +7 -0
- package/lib/modules/Schedule/index.js +17 -1
- package/lib/modules/Summary/index.js +5 -4
- package/lib/modules/SurchargeList/index.d.ts +16 -0
- package/lib/modules/SurchargeList/index.js +89 -0
- package/lib/modules/SurchargeList/types.d.ts +11 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +204 -1
- package/lib/server/index.js +1891 -59
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/order/index.d.ts +120 -3
- package/lib/server/modules/order/index.js +887 -94
- package/lib/server/modules/order/types.d.ts +32 -3
- package/lib/server/modules/order/utils/filterBookings.js +24 -5
- package/lib/server/modules/order/utils/filterOrders.js +15 -6
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/modules/products/index.d.ts +34 -7
- package/lib/server/modules/products/index.js +189 -54
- package/lib/server/modules/resource/index.d.ts +2 -0
- package/lib/server/modules/resource/index.js +27 -3
- package/lib/server/modules/schedule/index.d.ts +4 -4
- package/lib/server/modules/schedule/index.js +47 -40
- package/lib/server/test.json +713 -0
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +800 -0
- package/lib/solution/BaseSales/index.d.ts +133 -10
- package/lib/solution/BaseSales/index.js +1111 -63
- package/lib/solution/BaseSales/types.d.ts +82 -6
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +54 -10
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +271 -11
- package/lib/solution/BookingTicket/index.js +922 -29
- package/lib/solution/BookingTicket/types.d.ts +118 -1
- package/lib/solution/BookingTicket/types.js +11 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
- package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/lib/solution/BookingTicket/utils/cartView.js +61 -6
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1 -2
- package/lib/solution/RegisterAndLogin/config.js +2 -10
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +153 -70
- package/lib/solution/ScanOrder/types.d.ts +9 -5
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +83 -17
- package/lib/solution/VenueBooking/index.d.ts +5 -2
- package/lib/solution/VenueBooking/index.js +54 -17
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/types/index.d.ts +10 -0
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -60,6 +60,30 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
60
|
return _this;
|
|
61
61
|
}
|
|
62
62
|
_createClass(CustomerModule, [{
|
|
63
|
+
key: "isSameSelectedCustomer",
|
|
64
|
+
value:
|
|
65
|
+
/**
|
|
66
|
+
* 判断两份选中客户的核心展示字段是否一致,用于避免重复 clone / emit。
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* this.isSameSelectedCustomer(currentCustomer, nextCustomer);
|
|
70
|
+
*/
|
|
71
|
+
function isSameSelectedCustomer(current, next) {
|
|
72
|
+
var _id, _id2;
|
|
73
|
+
var normalizedNext = !next ? DEFAULT_CUSTOMER : next;
|
|
74
|
+
var normalizedCurrent = current || null;
|
|
75
|
+
if (!normalizedCurrent) return false;
|
|
76
|
+
// Walk-In 是默认客户,展示文案 / 默认区号可能来自不同入口;同为 id=1 时视为同一客户。
|
|
77
|
+
if (String((_id = normalizedCurrent === null || normalizedCurrent === void 0 ? void 0 : normalizedCurrent.id) !== null && _id !== void 0 ? _id : '') === '1' && String((_id2 = normalizedNext === null || normalizedNext === void 0 ? void 0 : normalizedNext.id) !== null && _id2 !== void 0 ? _id2 : '') === '1') {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
var keys = ['id', 'name', 'phone', 'email', 'country_calling_code'];
|
|
81
|
+
return keys.every(function (key) {
|
|
82
|
+
var _key, _key2;
|
|
83
|
+
return String((_key = normalizedCurrent === null || normalizedCurrent === void 0 ? void 0 : normalizedCurrent[key]) !== null && _key !== void 0 ? _key : '') === String((_key2 = normalizedNext === null || normalizedNext === void 0 ? void 0 : normalizedNext[key]) !== null && _key2 !== void 0 ? _key2 : '');
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
63
87
|
key: "initialize",
|
|
64
88
|
value: function () {
|
|
65
89
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
@@ -95,7 +119,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
95
119
|
} else {
|
|
96
120
|
this.store.currentPage = 1;
|
|
97
121
|
}
|
|
98
|
-
if (typeof (options === null || options === void 0 || (_options$initialState5 = options.initialState) === null || _options$initialState5 === void 0 ? void 0 : _options$initialState5.pageSize) === 'number') {
|
|
122
|
+
if (typeof (options === null || options === void 0 || (_options$initialState5 = options.initialState) === null || _options$initialState5 === void 0 ? void 0 : _options$initialState5.pageSize) === 'number' && options.initialState.pageSize > 1) {
|
|
99
123
|
this.store.pageSize = options.initialState.pageSize;
|
|
100
124
|
} else {
|
|
101
125
|
this.store.pageSize = DEFAULT_PAGE_SIZE;
|
|
@@ -125,6 +149,22 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
125
149
|
}
|
|
126
150
|
return initialize;
|
|
127
151
|
}()
|
|
152
|
+
/**
|
|
153
|
+
* 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* customerModule.updateOtherParams({ isFranchisee: true, cacheId: 'cache-2' });
|
|
157
|
+
*/
|
|
158
|
+
}, {
|
|
159
|
+
key: "updateOtherParams",
|
|
160
|
+
value: function updateOtherParams(params) {
|
|
161
|
+
var _this$otherParams$ope;
|
|
162
|
+
this.otherParams = params || {};
|
|
163
|
+
this.openCache = (_this$otherParams$ope = this.otherParams.openCache) !== null && _this$otherParams$ope !== void 0 ? _this$otherParams$ope : false;
|
|
164
|
+
this.cacheId = this.otherParams.cacheId;
|
|
165
|
+
this.fatherModule = this.otherParams.fatherModule;
|
|
166
|
+
}
|
|
167
|
+
|
|
128
168
|
/**
|
|
129
169
|
* 获取客户列表数据(内部方法)
|
|
130
170
|
* @param params 查询参数
|
|
@@ -236,6 +276,52 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
236
276
|
}
|
|
237
277
|
return handleCustomerListError;
|
|
238
278
|
}()
|
|
279
|
+
/**
|
|
280
|
+
* 查询客户列表但不写入 customerList / pagination 状态。
|
|
281
|
+
*
|
|
282
|
+
* 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
|
|
283
|
+
*/
|
|
284
|
+
)
|
|
285
|
+
}, {
|
|
286
|
+
key: "queryCustomerList",
|
|
287
|
+
value: (function () {
|
|
288
|
+
var _queryCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
289
|
+
var params,
|
|
290
|
+
_yield$this$fetchCust,
|
|
291
|
+
customerList,
|
|
292
|
+
total,
|
|
293
|
+
page,
|
|
294
|
+
pageSize,
|
|
295
|
+
_args4 = arguments;
|
|
296
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
297
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
298
|
+
case 0:
|
|
299
|
+
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
300
|
+
_context4.next = 3;
|
|
301
|
+
return this.fetchCustomerListData(params);
|
|
302
|
+
case 3:
|
|
303
|
+
_yield$this$fetchCust = _context4.sent;
|
|
304
|
+
customerList = _yield$this$fetchCust.customerList;
|
|
305
|
+
total = _yield$this$fetchCust.total;
|
|
306
|
+
page = _yield$this$fetchCust.page;
|
|
307
|
+
pageSize = _yield$this$fetchCust.pageSize;
|
|
308
|
+
return _context4.abrupt("return", {
|
|
309
|
+
list: customerList,
|
|
310
|
+
total: total,
|
|
311
|
+
page: page,
|
|
312
|
+
pageSize: pageSize
|
|
313
|
+
});
|
|
314
|
+
case 9:
|
|
315
|
+
case "end":
|
|
316
|
+
return _context4.stop();
|
|
317
|
+
}
|
|
318
|
+
}, _callee4, this);
|
|
319
|
+
}));
|
|
320
|
+
function queryCustomerList() {
|
|
321
|
+
return _queryCustomerList.apply(this, arguments);
|
|
322
|
+
}
|
|
323
|
+
return queryCustomerList;
|
|
324
|
+
}()
|
|
239
325
|
/**
|
|
240
326
|
* 获取客户列表
|
|
241
327
|
* @param params 查询参数
|
|
@@ -245,9 +331,9 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
245
331
|
}, {
|
|
246
332
|
key: "getCustomerList",
|
|
247
333
|
value: (function () {
|
|
248
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
334
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
249
335
|
var params,
|
|
250
|
-
_yield$this$
|
|
336
|
+
_yield$this$fetchCust2,
|
|
251
337
|
customerList,
|
|
252
338
|
total,
|
|
253
339
|
page,
|
|
@@ -256,22 +342,22 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
256
342
|
num,
|
|
257
343
|
searchParams,
|
|
258
344
|
response,
|
|
259
|
-
|
|
260
|
-
return _regeneratorRuntime().wrap(function
|
|
261
|
-
while (1) switch (
|
|
345
|
+
_args5 = arguments;
|
|
346
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
347
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
262
348
|
case 0:
|
|
263
|
-
params =
|
|
264
|
-
|
|
349
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
350
|
+
_context5.prev = 1;
|
|
265
351
|
this.store.loading = true;
|
|
266
352
|
this.store.error = null;
|
|
267
|
-
|
|
353
|
+
_context5.next = 6;
|
|
268
354
|
return this.fetchCustomerListData(params);
|
|
269
355
|
case 6:
|
|
270
|
-
_yield$this$
|
|
271
|
-
customerList = _yield$this$
|
|
272
|
-
total = _yield$this$
|
|
273
|
-
page = _yield$this$
|
|
274
|
-
pageSize = _yield$this$
|
|
356
|
+
_yield$this$fetchCust2 = _context5.sent;
|
|
357
|
+
customerList = _yield$this$fetchCust2.customerList;
|
|
358
|
+
total = _yield$this$fetchCust2.total;
|
|
359
|
+
page = _yield$this$fetchCust2.page;
|
|
360
|
+
pageSize = _yield$this$fetchCust2.pageSize;
|
|
275
361
|
// 保存搜索条件(排除skip和num)
|
|
276
362
|
skip = params.skip, num = params.num, searchParams = _objectWithoutProperties(params, _excluded2);
|
|
277
363
|
this.store.searchParams = cloneDeep(searchParams);
|
|
@@ -286,9 +372,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
286
372
|
|
|
287
373
|
// 设置客户列表(替换模式)
|
|
288
374
|
this.store.customerList = cloneDeep(customerList);
|
|
289
|
-
|
|
290
|
-
return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
|
|
291
|
-
case 20:
|
|
375
|
+
|
|
292
376
|
// 触发分页变化事件
|
|
293
377
|
this.triggerPaginationChange({
|
|
294
378
|
page: page,
|
|
@@ -302,24 +386,27 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
302
386
|
page: page,
|
|
303
387
|
pageSize: pageSize
|
|
304
388
|
};
|
|
305
|
-
return
|
|
306
|
-
case
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return this.handleCustomerListError(
|
|
311
|
-
case
|
|
312
|
-
throw
|
|
313
|
-
case
|
|
314
|
-
|
|
389
|
+
return _context5.abrupt("return", response);
|
|
390
|
+
case 23:
|
|
391
|
+
_context5.prev = 23;
|
|
392
|
+
_context5.t0 = _context5["catch"](1);
|
|
393
|
+
_context5.next = 27;
|
|
394
|
+
return this.handleCustomerListError(_context5.t0, 'fetch customer list');
|
|
395
|
+
case 27:
|
|
396
|
+
throw _context5.t0;
|
|
397
|
+
case 28:
|
|
398
|
+
_context5.prev = 28;
|
|
315
399
|
this.store.loading = false;
|
|
316
400
|
this.storeChange();
|
|
317
|
-
|
|
401
|
+
_context5.next = 33;
|
|
402
|
+
return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
|
|
403
|
+
case 33:
|
|
404
|
+
return _context5.finish(28);
|
|
318
405
|
case 34:
|
|
319
406
|
case "end":
|
|
320
|
-
return
|
|
407
|
+
return _context5.stop();
|
|
321
408
|
}
|
|
322
|
-
},
|
|
409
|
+
}, _callee5, this, [[1, 23, 28, 34]]);
|
|
323
410
|
}));
|
|
324
411
|
function getCustomerList() {
|
|
325
412
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -349,6 +436,9 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
349
436
|
}, {
|
|
350
437
|
key: "setSelectedCustomer",
|
|
351
438
|
value: function setSelectedCustomer(customer) {
|
|
439
|
+
if (this.isSameSelectedCustomer(this.store.selectedCustomer, customer)) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
352
442
|
this.store.selectedCustomer = !customer ? DEFAULT_CUSTOMER : cloneDeep(customer);
|
|
353
443
|
this.core.effects.emit("".concat(this.name, ":onCustomerSelected"), this.store.selectedCustomer);
|
|
354
444
|
this.storeChange();
|
|
@@ -493,10 +583,10 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
493
583
|
}, {
|
|
494
584
|
key: "changeCustomerPage",
|
|
495
585
|
value: (function () {
|
|
496
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
586
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, pageSize) {
|
|
497
587
|
var targetPageSize, skip, num;
|
|
498
|
-
return _regeneratorRuntime().wrap(function
|
|
499
|
-
while (1) switch (
|
|
588
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
589
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
500
590
|
case 0:
|
|
501
591
|
targetPageSize = pageSize || this.store.pageSize; // 先更新分页状态
|
|
502
592
|
this.setPaginationInfo(page, targetPageSize);
|
|
@@ -504,18 +594,18 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
504
594
|
// skip直接使用page,num使用pageSize
|
|
505
595
|
skip = page;
|
|
506
596
|
num = targetPageSize; // 自动调用获取客户列表,使用存储的搜索条件
|
|
507
|
-
|
|
597
|
+
_context6.next = 6;
|
|
508
598
|
return this.getCustomerList(_objectSpread({
|
|
509
599
|
skip: skip,
|
|
510
600
|
num: num
|
|
511
601
|
}, this.store.searchParams));
|
|
512
602
|
case 6:
|
|
513
|
-
return
|
|
603
|
+
return _context6.abrupt("return", _context6.sent);
|
|
514
604
|
case 7:
|
|
515
605
|
case "end":
|
|
516
|
-
return
|
|
606
|
+
return _context6.stop();
|
|
517
607
|
}
|
|
518
|
-
},
|
|
608
|
+
}, _callee6, this);
|
|
519
609
|
}));
|
|
520
610
|
function changeCustomerPage(_x5, _x6) {
|
|
521
611
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -530,16 +620,16 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
530
620
|
}, {
|
|
531
621
|
key: "loadMoreCustomers",
|
|
532
622
|
value: (function () {
|
|
533
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
534
|
-
var nextPage, _yield$this$
|
|
535
|
-
return _regeneratorRuntime().wrap(function
|
|
536
|
-
while (1) switch (
|
|
623
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
624
|
+
var nextPage, loadMoreParams, _yield$this$fetchCust3, newCustomers, total, page, pageSize, updatedCustomerList, response;
|
|
625
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
626
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
537
627
|
case 0:
|
|
538
628
|
if (!(!this.store.hasMore || this.store.loadingMore)) {
|
|
539
|
-
|
|
629
|
+
_context7.next = 2;
|
|
540
630
|
break;
|
|
541
631
|
}
|
|
542
|
-
return
|
|
632
|
+
return _context7.abrupt("return", {
|
|
543
633
|
list: [],
|
|
544
634
|
total: this.store.total,
|
|
545
635
|
page: this.store.currentPage,
|
|
@@ -548,22 +638,21 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
548
638
|
case 2:
|
|
549
639
|
// 计算下一页
|
|
550
640
|
nextPage = this.store.currentPage + 1;
|
|
551
|
-
|
|
641
|
+
_context7.prev = 3;
|
|
552
642
|
this.store.loadingMore = true;
|
|
553
643
|
this.store.error = null;
|
|
554
|
-
|
|
555
|
-
// 使用公共方法获取数据,传入存储的搜索条件
|
|
556
|
-
_context6.next = 8;
|
|
557
|
-
return this.fetchCustomerListData(_objectSpread({
|
|
644
|
+
loadMoreParams = _objectSpread({
|
|
558
645
|
skip: nextPage,
|
|
559
646
|
num: this.store.pageSize
|
|
560
|
-
}, this.store.searchParams)
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
647
|
+
}, this.store.searchParams); // 使用公共方法获取数据,传入存储的搜索条件
|
|
648
|
+
_context7.next = 9;
|
|
649
|
+
return this.fetchCustomerListData(loadMoreParams);
|
|
650
|
+
case 9:
|
|
651
|
+
_yield$this$fetchCust3 = _context7.sent;
|
|
652
|
+
newCustomers = _yield$this$fetchCust3.customerList;
|
|
653
|
+
total = _yield$this$fetchCust3.total;
|
|
654
|
+
page = _yield$this$fetchCust3.page;
|
|
655
|
+
pageSize = _yield$this$fetchCust3.pageSize;
|
|
567
656
|
// 将新数据追加到现有列表(追加模式)
|
|
568
657
|
updatedCustomerList = [].concat(_toConsumableArray(this.store.customerList), _toConsumableArray(cloneDeep(newCustomers))); // 更新状态
|
|
569
658
|
this.store.customerList = updatedCustomerList;
|
|
@@ -572,17 +661,14 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
572
661
|
this.store.hasMore = page * pageSize < total;
|
|
573
662
|
|
|
574
663
|
// 触发滚动加载特定事件
|
|
575
|
-
|
|
664
|
+
_context7.next = 21;
|
|
576
665
|
return this.core.effects.emit("".concat(this.name, ":onScrollLoadMore"), {
|
|
577
666
|
newCustomers: newCustomers,
|
|
578
667
|
allCustomers: this.store.customerList,
|
|
579
668
|
currentPage: page,
|
|
580
669
|
hasMore: this.store.hasMore
|
|
581
670
|
});
|
|
582
|
-
case
|
|
583
|
-
_context6.next = 22;
|
|
584
|
-
return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
|
|
585
|
-
case 22:
|
|
671
|
+
case 21:
|
|
586
672
|
// 触发分页变化事件
|
|
587
673
|
this.triggerPaginationChange({
|
|
588
674
|
page: page,
|
|
@@ -597,24 +683,27 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
597
683
|
page: page,
|
|
598
684
|
pageSize: pageSize
|
|
599
685
|
};
|
|
600
|
-
return
|
|
601
|
-
case
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
return this.handleCustomerListError(
|
|
686
|
+
return _context7.abrupt("return", response);
|
|
687
|
+
case 26:
|
|
688
|
+
_context7.prev = 26;
|
|
689
|
+
_context7.t0 = _context7["catch"](3);
|
|
690
|
+
_context7.next = 30;
|
|
691
|
+
return this.handleCustomerListError(_context7.t0, 'load more customers');
|
|
692
|
+
case 30:
|
|
693
|
+
throw _context7.t0;
|
|
606
694
|
case 31:
|
|
607
|
-
|
|
608
|
-
case 32:
|
|
609
|
-
_context6.prev = 32;
|
|
695
|
+
_context7.prev = 31;
|
|
610
696
|
this.store.loadingMore = false;
|
|
611
697
|
this.storeChange();
|
|
612
|
-
|
|
698
|
+
_context7.next = 36;
|
|
699
|
+
return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
|
|
613
700
|
case 36:
|
|
701
|
+
return _context7.finish(31);
|
|
702
|
+
case 37:
|
|
614
703
|
case "end":
|
|
615
|
-
return
|
|
704
|
+
return _context7.stop();
|
|
616
705
|
}
|
|
617
|
-
},
|
|
706
|
+
}, _callee7, this, [[3, 26, 31, 37]]);
|
|
618
707
|
}));
|
|
619
708
|
function loadMoreCustomers() {
|
|
620
709
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -630,15 +719,15 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
630
719
|
}, {
|
|
631
720
|
key: "resetAndLoadCustomers",
|
|
632
721
|
value: (function () {
|
|
633
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
722
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
634
723
|
var params,
|
|
635
724
|
resetParams,
|
|
636
725
|
response,
|
|
637
|
-
|
|
638
|
-
return _regeneratorRuntime().wrap(function
|
|
639
|
-
while (1) switch (
|
|
726
|
+
_args8 = arguments;
|
|
727
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
728
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
640
729
|
case 0:
|
|
641
|
-
params =
|
|
730
|
+
params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
642
731
|
// 重置状态
|
|
643
732
|
this.store.customerList = [];
|
|
644
733
|
this.store.currentPage = 1;
|
|
@@ -650,23 +739,23 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
650
739
|
skip: 1,
|
|
651
740
|
num: params.num || this.store.pageSize
|
|
652
741
|
}); // 调用普通的获取列表方法
|
|
653
|
-
|
|
742
|
+
_context8.next = 8;
|
|
654
743
|
return this.getCustomerList(resetParams);
|
|
655
744
|
case 8:
|
|
656
|
-
response =
|
|
657
|
-
|
|
745
|
+
response = _context8.sent;
|
|
746
|
+
_context8.next = 11;
|
|
658
747
|
return this.core.effects.emit("".concat(this.name, ":onScrollLoadComplete"), {
|
|
659
748
|
customers: this.store.customerList,
|
|
660
749
|
total: this.store.total,
|
|
661
750
|
hasMore: this.store.hasMore
|
|
662
751
|
});
|
|
663
752
|
case 11:
|
|
664
|
-
return
|
|
753
|
+
return _context8.abrupt("return", response);
|
|
665
754
|
case 12:
|
|
666
755
|
case "end":
|
|
667
|
-
return
|
|
756
|
+
return _context8.stop();
|
|
668
757
|
}
|
|
669
|
-
},
|
|
758
|
+
}, _callee8, this);
|
|
670
759
|
}));
|
|
671
760
|
function resetAndLoadCustomers() {
|
|
672
761
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -110,6 +110,8 @@ export interface CustomerState {
|
|
|
110
110
|
export interface CustomerModuleAPI {
|
|
111
111
|
/** 获取客户列表 */
|
|
112
112
|
getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
|
+
/** 查询客户列表但不更新列表分页状态 */
|
|
114
|
+
queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
115
|
/** 设置客户列表 */
|
|
114
116
|
setCustomerList: (customers: ShopCustomer[], total?: number) => void;
|
|
115
117
|
/** 设置当前选择的客户 */
|
|
@@ -23,7 +23,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
23
23
|
customer_id: number;
|
|
24
24
|
with_wallet_pass_holder: 0 | 1;
|
|
25
25
|
request_timezone: string;
|
|
26
|
-
order_id?: number;
|
|
26
|
+
order_id?: number | string;
|
|
27
27
|
}): Promise<Discount[]>;
|
|
28
28
|
batchSearch(code: string, options?: {
|
|
29
29
|
customerId?: number;
|
|
@@ -13,6 +13,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
13
13
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
14
|
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); } }
|
|
15
15
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
17
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
16
18
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
17
19
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -154,17 +156,21 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
154
156
|
value: function () {
|
|
155
157
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
156
158
|
var _prepareConfig$data, _prepareConfig$data2;
|
|
157
|
-
var prepareConfig, goodPassList;
|
|
159
|
+
var prepareConfig, rawDiscountList, goodPassList;
|
|
158
160
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
159
161
|
while (1) switch (_context4.prev = _context4.next) {
|
|
160
162
|
case 0:
|
|
161
|
-
|
|
163
|
+
if (typeof params.order_id === 'string' && params.order_id.startsWith('LOCAL_')) {
|
|
164
|
+
params.order_id = undefined;
|
|
165
|
+
}
|
|
166
|
+
_context4.next = 3;
|
|
162
167
|
return this.request.post("/order/prepare/config", params);
|
|
163
|
-
case
|
|
168
|
+
case 3:
|
|
164
169
|
prepareConfig = _context4.sent;
|
|
165
|
-
|
|
170
|
+
rawDiscountList = [].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) || []));
|
|
171
|
+
goodPassList = this.filterEnabledDiscountList(rawDiscountList) || []; // this.setDiscountList(goodPassList);
|
|
166
172
|
return _context4.abrupt("return", goodPassList);
|
|
167
|
-
case
|
|
173
|
+
case 7:
|
|
168
174
|
case "end":
|
|
169
175
|
return _context4.stop();
|
|
170
176
|
}
|
|
@@ -411,7 +417,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
411
417
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
412
418
|
case 4:
|
|
413
419
|
console.log('[Discount] 已销毁');
|
|
414
|
-
|
|
420
|
+
_get(_getPrototypeOf(DiscountModule.prototype), "destroy", this).call(this);
|
|
421
|
+
case 6:
|
|
415
422
|
case "end":
|
|
416
423
|
return _context6.stop();
|
|
417
424
|
}
|
|
@@ -140,6 +140,7 @@ export interface Discount {
|
|
|
140
140
|
appliedProductDetails: ApplicableProductDetails[];
|
|
141
141
|
isDisabledForProductUsed?: boolean;
|
|
142
142
|
amount?: number;
|
|
143
|
+
customer_id?: number | string | null;
|
|
143
144
|
extension_data?: ExtensionData[];
|
|
144
145
|
total_order_behavior_count?: number;
|
|
145
146
|
today_order_behavior_count?: number;
|
|
@@ -9,6 +9,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
9
9
|
protected defaultVersion: string;
|
|
10
10
|
private request;
|
|
11
11
|
private window;
|
|
12
|
+
private appPlugin;
|
|
12
13
|
private store;
|
|
13
14
|
private cacheId;
|
|
14
15
|
private openCache;
|
|
@@ -16,6 +17,13 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
16
17
|
private otherParams;
|
|
17
18
|
constructor(name?: string, version?: string);
|
|
18
19
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
|
|
25
|
+
*/
|
|
26
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
19
27
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
20
28
|
getOpenData(): OpenDataConfig | null;
|
|
21
29
|
getLastFetchedAt(): number | null;
|
|
@@ -30,6 +30,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
30
30
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
31
31
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
32
32
|
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
|
|
33
34
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
34
35
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
35
36
|
_defineProperty(_assertThisInitialized(_this), "openCache", false);
|
|
@@ -60,20 +61,21 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
61
|
}
|
|
61
62
|
this.request = core.getPlugin('request');
|
|
62
63
|
this.window = core.getPlugin('window');
|
|
64
|
+
this.appPlugin = core.getPlugin('app');
|
|
63
65
|
if (this.request) {
|
|
64
|
-
_context.next =
|
|
66
|
+
_context.next = 12;
|
|
65
67
|
break;
|
|
66
68
|
}
|
|
67
69
|
throw new Error('OpenDataModule 需要 request 插件支持');
|
|
68
|
-
case
|
|
70
|
+
case 12:
|
|
69
71
|
if (this.window) {
|
|
70
|
-
_context.next =
|
|
72
|
+
_context.next = 14;
|
|
71
73
|
break;
|
|
72
74
|
}
|
|
73
75
|
throw new Error('OpenDataModule 需要 window 插件支持');
|
|
74
|
-
case 13:
|
|
75
|
-
console.log('[OpenDataModule] 初始化完成');
|
|
76
76
|
case 14:
|
|
77
|
+
console.log('[OpenDataModule] 初始化完成');
|
|
78
|
+
case 15:
|
|
77
79
|
case "end":
|
|
78
80
|
return _context.stop();
|
|
79
81
|
}
|
|
@@ -84,47 +86,65 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
84
86
|
}
|
|
85
87
|
return initialize;
|
|
86
88
|
}()
|
|
89
|
+
/**
|
|
90
|
+
* 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
|
|
94
|
+
*/
|
|
95
|
+
}, {
|
|
96
|
+
key: "updateOtherParams",
|
|
97
|
+
value: function updateOtherParams(params) {
|
|
98
|
+
var _this$otherParams$ope2;
|
|
99
|
+
this.otherParams = params || {};
|
|
100
|
+
this.openCache = (_this$otherParams$ope2 = this.otherParams.openCache) !== null && _this$otherParams$ope2 !== void 0 ? _this$otherParams$ope2 : false;
|
|
101
|
+
this.cacheId = this.otherParams.cacheId;
|
|
102
|
+
this.fatherModule = this.otherParams.fatherModule;
|
|
103
|
+
}
|
|
87
104
|
}, {
|
|
88
105
|
key: "fetchOpenData",
|
|
89
106
|
value: function () {
|
|
90
107
|
var _fetchOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
91
|
-
var _this$
|
|
92
|
-
var shopId, tenantId, headers, response, data;
|
|
108
|
+
var _this$appPlugin$getDa, _this$appPlugin;
|
|
109
|
+
var getData, shopId, tenantId, headers, response, data;
|
|
93
110
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
94
111
|
while (1) switch (_context2.prev = _context2.next) {
|
|
95
112
|
case 0:
|
|
96
|
-
|
|
113
|
+
getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
114
|
+
shopId = getData === null || getData === void 0 ? void 0 : getData('shop_id');
|
|
97
115
|
if (shopId) {
|
|
98
|
-
_context2.next =
|
|
116
|
+
_context2.next = 4;
|
|
99
117
|
break;
|
|
100
118
|
}
|
|
101
119
|
throw new Error('[OpenDataModule] 无法获取 shop_id');
|
|
102
|
-
case
|
|
103
|
-
tenantId =
|
|
120
|
+
case 4:
|
|
121
|
+
tenantId = getData === null || getData === void 0 ? void 0 : getData('tenant_id');
|
|
104
122
|
headers = {};
|
|
105
123
|
if (tenantId) headers['Tenant-Id'] = String(tenantId);
|
|
106
|
-
_context2.next =
|
|
124
|
+
_context2.next = 9;
|
|
107
125
|
return this.request.post("/open/my-pisell/".concat(shopId, "/setting"), {
|
|
108
126
|
scope: params.scope,
|
|
109
127
|
target: params.target,
|
|
110
128
|
section_code: params.section_code
|
|
111
129
|
}, {
|
|
112
130
|
pisell2: true,
|
|
131
|
+
isPisell2: true,
|
|
132
|
+
prefix: false,
|
|
113
133
|
headers: headers
|
|
114
134
|
});
|
|
115
|
-
case
|
|
135
|
+
case 9:
|
|
116
136
|
response = _context2.sent;
|
|
117
137
|
if (!((response === null || response === void 0 ? void 0 : response.status) === false)) {
|
|
118
|
-
_context2.next =
|
|
138
|
+
_context2.next = 12;
|
|
119
139
|
break;
|
|
120
140
|
}
|
|
121
141
|
throw new Error((response === null || response === void 0 ? void 0 : response.message) || '获取 OpenData 配置失败');
|
|
122
|
-
case
|
|
142
|
+
case 12:
|
|
123
143
|
data = (response === null || response === void 0 ? void 0 : response.data) || {};
|
|
124
144
|
this.store.data = data;
|
|
125
145
|
this.store.lastFetchedAt = Date.now();
|
|
126
146
|
return _context2.abrupt("return", data);
|
|
127
|
-
case
|
|
147
|
+
case 16:
|
|
128
148
|
case "end":
|
|
129
149
|
return _context2.stop();
|
|
130
150
|
}
|
|
@@ -150,7 +170,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
150
170
|
key: "checkAvailability",
|
|
151
171
|
value: function checkAvailability(scheduleModule) {
|
|
152
172
|
var _this$store$data;
|
|
153
|
-
var scheduleList = scheduleModule ? scheduleModule.getScheduleListByIds(((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['availability.operating_hours']) || []) : undefined;
|
|
173
|
+
var scheduleList = scheduleModule ? scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['availability.operating_hours']) || []) : undefined;
|
|
154
174
|
return computeAvailability({
|
|
155
175
|
config: this.store.data,
|
|
156
176
|
scheduleList: scheduleList
|