@pisell/pisellos 2.2.10 → 2.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Cart/utils/cartProduct.js +26 -41
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Discount/index.d.ts +0 -2
- package/dist/modules/Discount/index.js +36 -69
- package/dist/modules/Discount/types.d.ts +0 -16
- package/dist/modules/Order/index.js +1 -4
- package/dist/modules/Order/utils.d.ts +0 -1
- package/dist/modules/Order/utils.js +0 -9
- package/dist/modules/Payment/index.js +2 -2
- package/dist/modules/Payment/types.d.ts +0 -1
- package/dist/modules/Payment/walletpass.js +1 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +9 -8
- package/dist/modules/Rules/index.d.ts +0 -7
- package/dist/modules/Rules/index.js +196 -1065
- package/dist/modules/Rules/types.d.ts +1 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +8 -30
- package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
- package/dist/solution/BookingByStep/utils/products.js +0 -10
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +49 -93
- package/dist/solution/ShopDiscount/index.d.ts +0 -2
- package/dist/solution/ShopDiscount/index.js +19 -80
- package/dist/solution/ShopDiscount/types.d.ts +1 -4
- package/dist/solution/ShopDiscount/utils.d.ts +0 -55
- package/dist/solution/ShopDiscount/utils.js +3 -432
- package/lib/modules/Cart/utils/cartProduct.js +22 -35
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Discount/index.d.ts +0 -2
- package/lib/modules/Discount/index.js +4 -19
- package/lib/modules/Discount/types.d.ts +0 -16
- package/lib/modules/Order/index.js +0 -2
- package/lib/modules/Order/utils.d.ts +0 -1
- package/lib/modules/Order/utils.js +0 -11
- package/lib/modules/Payment/index.js +1 -1
- package/lib/modules/Payment/types.d.ts +0 -1
- package/lib/modules/Payment/walletpass.js +1 -10
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +7 -0
- package/lib/modules/Rules/index.d.ts +0 -7
- package/lib/modules/Rules/index.js +182 -824
- package/lib/modules/Rules/types.d.ts +1 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +2 -19
- package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
- package/lib/solution/BookingByStep/utils/products.js +2 -8
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +19 -68
- package/lib/solution/ShopDiscount/index.d.ts +0 -2
- package/lib/solution/ShopDiscount/index.js +9 -55
- package/lib/solution/ShopDiscount/types.d.ts +1 -4
- package/lib/solution/ShopDiscount/utils.d.ts +0 -55
- package/lib/solution/ShopDiscount/utils.js +3 -266
- package/package.json +2 -2
|
@@ -174,24 +174,6 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
|
174
174
|
discounts = params.discounts;
|
|
175
175
|
// const num = params.num || 1;
|
|
176
176
|
var price = Number(product.price);
|
|
177
|
-
|
|
178
|
-
// 如果商品有折扣,则计算折扣
|
|
179
|
-
if (discounts !== null && discounts !== void 0 && discounts.length) {
|
|
180
|
-
discounts.forEach(function (currentValue) {
|
|
181
|
-
var _currentValue$discoun;
|
|
182
|
-
// 不是商品券则代表折扣卡,计算打折后的价格
|
|
183
|
-
// 一个商品折扣卡只能存在于一张
|
|
184
|
-
// if (currentValue.type !== 'good_pass') {
|
|
185
|
-
price = getDiscountAmount({
|
|
186
|
-
tag: currentValue.type,
|
|
187
|
-
par_value: currentValue.discount.percent,
|
|
188
|
-
metadata: {
|
|
189
|
-
discount_card_type: currentValue === null || currentValue === void 0 || (_currentValue$discoun = currentValue.discount) === null || _currentValue$discoun === void 0 ? void 0 : _currentValue$discoun.discount_card_type
|
|
190
|
-
}
|
|
191
|
-
}, price, price);
|
|
192
|
-
// }
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
177
|
if (bundle !== null && bundle !== void 0 && bundle.length) {
|
|
196
178
|
price = bundle.reduce(function (accumulator, currentValue) {
|
|
197
179
|
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
@@ -204,7 +186,25 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
|
204
186
|
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
205
187
|
}, price);
|
|
206
188
|
}
|
|
207
|
-
|
|
189
|
+
|
|
190
|
+
// 如果商品有折扣,则计算折扣
|
|
191
|
+
if (discounts !== null && discounts !== void 0 && discounts.length) {
|
|
192
|
+
discounts.forEach(function (currentValue) {
|
|
193
|
+
// 不是商品券则代表折扣卡,计算打折后的价格
|
|
194
|
+
// 一个商品折扣卡只能存在于一张
|
|
195
|
+
if (currentValue.type !== 'good_pass') {
|
|
196
|
+
var _currentValue$discoun;
|
|
197
|
+
price = getDiscountAmount({
|
|
198
|
+
tag: currentValue.type,
|
|
199
|
+
par_value: currentValue.discount.percent,
|
|
200
|
+
metadata: {
|
|
201
|
+
discount_card_type: currentValue === null || currentValue === void 0 || (_currentValue$discoun = currentValue.discount) === null || _currentValue$discoun === void 0 ? void 0 : _currentValue$discoun.discount_card_type
|
|
202
|
+
}
|
|
203
|
+
}, price, price);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return price;
|
|
208
208
|
};
|
|
209
209
|
|
|
210
210
|
/**
|
|
@@ -284,39 +284,24 @@ export var formatBundle = function formatBundle(bundle) {
|
|
|
284
284
|
price: item === null || item === void 0 ? void 0 : item.price,
|
|
285
285
|
total: item === null || item === void 0 ? void 0 : item.price,
|
|
286
286
|
price_type: item === null || item === void 0 ? void 0 : item.price_type,
|
|
287
|
-
original_price: item === null || item === void 0 ? void 0 : item.original_price,
|
|
288
|
-
original_total: item === null || item === void 0 ? void 0 : item.original_total,
|
|
289
|
-
price_type_ext: item === null || item === void 0 ? void 0 : item.price_type_ext,
|
|
290
287
|
bundle_sum_price: item === null || item === void 0 ? void 0 : item.bundle_sum_price,
|
|
291
288
|
bundle_sum_type: item === null || item === void 0 ? void 0 : item.bundle_sum_type,
|
|
292
|
-
options: formatOptions(item === null || item === void 0 ? void 0 : item.option)
|
|
293
|
-
_bundle_product_id: item._bundle_product_id,
|
|
294
|
-
discount_list: item.discount_list,
|
|
295
|
-
originBundleItem: item.originBundleItem || item
|
|
289
|
+
options: formatOptions(item === null || item === void 0 ? void 0 : item.option)
|
|
296
290
|
};
|
|
297
291
|
});
|
|
298
292
|
};
|
|
299
293
|
export var formatBundleToOrigin = function formatBundleToOrigin(bundle) {
|
|
300
294
|
if (!(bundle !== null && bundle !== void 0 && bundle.length)) return [];
|
|
301
295
|
return bundle.map(function (d) {
|
|
302
|
-
var getBundleValueByKey = function getBundleValueByKey(key) {
|
|
303
|
-
var _d$originBundleItem;
|
|
304
|
-
return (d === null || d === void 0 ? void 0 : d[key]) || (d === null || d === void 0 || (_d$originBundleItem = d.originBundleItem) === null || _d$originBundleItem === void 0 ? void 0 : _d$originBundleItem[key]);
|
|
305
|
-
};
|
|
306
296
|
return {
|
|
307
|
-
bundle_group_id:
|
|
297
|
+
bundle_group_id: d.group_id,
|
|
308
298
|
bundle_id: d.id,
|
|
309
|
-
bundle_product_id:
|
|
310
|
-
bundle_variant_id:
|
|
299
|
+
bundle_product_id: (d === null || d === void 0 ? void 0 : d._bundle_product_id) || (d === null || d === void 0 ? void 0 : d.product_id),
|
|
300
|
+
bundle_variant_id: d.bundle_variant_id,
|
|
311
301
|
num: d.num,
|
|
312
|
-
extension_id:
|
|
313
|
-
extension_type:
|
|
314
|
-
option: formatOptionsToOrigin(
|
|
315
|
-
discount_list: d.discount_list,
|
|
316
|
-
"bundle_selling_price": d === null || d === void 0 ? void 0 : d.price,
|
|
317
|
-
metadata: {
|
|
318
|
-
custom_product_bundle_map_id: d._id
|
|
319
|
-
}
|
|
302
|
+
extension_id: d.extension_id,
|
|
303
|
+
extension_type: d.extension_type,
|
|
304
|
+
option: formatOptionsToOrigin(d.option)
|
|
320
305
|
};
|
|
321
306
|
});
|
|
322
307
|
};
|
|
@@ -154,7 +154,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
154
154
|
skip: skip,
|
|
155
155
|
num: num,
|
|
156
156
|
sort_by: SORT_BY,
|
|
157
|
-
with: ['latestWalletDetail.wallet'
|
|
157
|
+
with: ['latestWalletDetail.wallet'],
|
|
158
158
|
search_wallet_flag: 1,
|
|
159
159
|
search_wallet_pass_flag: 1
|
|
160
160
|
}, search && {
|
|
@@ -14,8 +14,6 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
14
14
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
15
15
|
setDiscountList(discountList: Discount[]): Promise<void>;
|
|
16
16
|
getDiscountList(): Discount[];
|
|
17
|
-
setOriginalDiscountList(originalDiscountList: Discount[]): Promise<void>;
|
|
18
|
-
getOriginalDiscountList(): Discount[];
|
|
19
17
|
loadPrepareConfig(params: {
|
|
20
18
|
action?: 'create';
|
|
21
19
|
with_good_pass: 0 | 1;
|
|
@@ -46,7 +46,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
46
46
|
key: "initialize",
|
|
47
47
|
value: function () {
|
|
48
48
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
49
|
-
var _options$initialState, _options$
|
|
49
|
+
var _options$initialState, _options$otherParams, _options$otherParams2;
|
|
50
50
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
51
51
|
while (1) switch (_context.prev = _context.next) {
|
|
52
52
|
case 0:
|
|
@@ -57,11 +57,6 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
57
57
|
} else {
|
|
58
58
|
this.store.discountList = [];
|
|
59
59
|
}
|
|
60
|
-
if (Array.isArray(options === null || options === void 0 || (_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.originalDiscountList)) {
|
|
61
|
-
this.store.originalDiscountList = options === null || options === void 0 ? void 0 : options.initialState.originalDiscountList;
|
|
62
|
-
} else {
|
|
63
|
-
this.store.originalDiscountList = [];
|
|
64
|
-
}
|
|
65
60
|
if (options !== null && options !== void 0 && (_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
|
|
66
61
|
this.openCache = options.otherParams.openCache;
|
|
67
62
|
this.cacheId = options.otherParams.cacheId;
|
|
@@ -74,17 +69,17 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
74
69
|
this.request = core.getPlugin('request');
|
|
75
70
|
this.window = core.getPlugin('window');
|
|
76
71
|
if (this.request) {
|
|
77
|
-
_context.next =
|
|
72
|
+
_context.next = 9;
|
|
78
73
|
break;
|
|
79
74
|
}
|
|
80
75
|
throw new Error('discount模块需要 request 插件支持');
|
|
81
|
-
case
|
|
76
|
+
case 9:
|
|
82
77
|
if (this.window) {
|
|
83
|
-
_context.next =
|
|
78
|
+
_context.next = 11;
|
|
84
79
|
break;
|
|
85
80
|
}
|
|
86
81
|
throw new Error('discount模块需要 window 插件支持');
|
|
87
|
-
case
|
|
82
|
+
case 11:
|
|
88
83
|
case "end":
|
|
89
84
|
return _context.stop();
|
|
90
85
|
}
|
|
@@ -121,54 +116,28 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
121
116
|
value: function getDiscountList() {
|
|
122
117
|
return this.store.discountList;
|
|
123
118
|
}
|
|
124
|
-
|
|
125
|
-
// 设置原始优惠券列表
|
|
126
|
-
}, {
|
|
127
|
-
key: "setOriginalDiscountList",
|
|
128
|
-
value: function () {
|
|
129
|
-
var _setOriginalDiscountList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(originalDiscountList) {
|
|
130
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
131
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
132
|
-
case 0:
|
|
133
|
-
this.store.originalDiscountList = originalDiscountList;
|
|
134
|
-
case 1:
|
|
135
|
-
case "end":
|
|
136
|
-
return _context3.stop();
|
|
137
|
-
}
|
|
138
|
-
}, _callee3, this);
|
|
139
|
-
}));
|
|
140
|
-
function setOriginalDiscountList(_x4) {
|
|
141
|
-
return _setOriginalDiscountList.apply(this, arguments);
|
|
142
|
-
}
|
|
143
|
-
return setOriginalDiscountList;
|
|
144
|
-
}() // 获取原始优惠券列表
|
|
145
|
-
}, {
|
|
146
|
-
key: "getOriginalDiscountList",
|
|
147
|
-
value: function getOriginalDiscountList() {
|
|
148
|
-
return this.store.originalDiscountList || [];
|
|
149
|
-
}
|
|
150
119
|
}, {
|
|
151
120
|
key: "loadPrepareConfig",
|
|
152
121
|
value: function () {
|
|
153
|
-
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
122
|
+
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
154
123
|
var _prepareConfig$data, _prepareConfig$data2;
|
|
155
124
|
var prepareConfig, goodPassList;
|
|
156
|
-
return _regeneratorRuntime().wrap(function
|
|
157
|
-
while (1) switch (
|
|
125
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
126
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
158
127
|
case 0:
|
|
159
|
-
|
|
128
|
+
_context3.next = 2;
|
|
160
129
|
return this.request.post("/order/prepare/config", params);
|
|
161
130
|
case 2:
|
|
162
|
-
prepareConfig =
|
|
131
|
+
prepareConfig = _context3.sent;
|
|
163
132
|
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);
|
|
164
|
-
return
|
|
133
|
+
return _context3.abrupt("return", goodPassList);
|
|
165
134
|
case 5:
|
|
166
135
|
case "end":
|
|
167
|
-
return
|
|
136
|
+
return _context3.stop();
|
|
168
137
|
}
|
|
169
|
-
},
|
|
138
|
+
}, _callee3, this);
|
|
170
139
|
}));
|
|
171
|
-
function loadPrepareConfig(
|
|
140
|
+
function loadPrepareConfig(_x4) {
|
|
172
141
|
return _loadPrepareConfig.apply(this, arguments);
|
|
173
142
|
}
|
|
174
143
|
return loadPrepareConfig;
|
|
@@ -176,12 +145,12 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
176
145
|
}, {
|
|
177
146
|
key: "batchSearch",
|
|
178
147
|
value: function () {
|
|
179
|
-
var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
148
|
+
var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(code, customerId) {
|
|
180
149
|
var result, resultDiscountList;
|
|
181
|
-
return _regeneratorRuntime().wrap(function
|
|
182
|
-
while (1) switch (
|
|
150
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
151
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
183
152
|
case 0:
|
|
184
|
-
|
|
153
|
+
_context4.next = 2;
|
|
185
154
|
return this.request.get("/machinecode/batch-search", {
|
|
186
155
|
code: code,
|
|
187
156
|
translate_flag: 1,
|
|
@@ -193,16 +162,16 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
193
162
|
order_behavior_count_customer_id: customerId || 1
|
|
194
163
|
});
|
|
195
164
|
case 2:
|
|
196
|
-
result =
|
|
165
|
+
result = _context4.sent;
|
|
197
166
|
resultDiscountList = this.filterEnabledDiscountList((result === null || result === void 0 ? void 0 : result.data) || []) || [];
|
|
198
|
-
return
|
|
167
|
+
return _context4.abrupt("return", resultDiscountList);
|
|
199
168
|
case 5:
|
|
200
169
|
case "end":
|
|
201
|
-
return
|
|
170
|
+
return _context4.stop();
|
|
202
171
|
}
|
|
203
|
-
},
|
|
172
|
+
}, _callee4, this);
|
|
204
173
|
}));
|
|
205
|
-
function batchSearch(
|
|
174
|
+
function batchSearch(_x5, _x6) {
|
|
206
175
|
return _batchSearch.apply(this, arguments);
|
|
207
176
|
}
|
|
208
177
|
return batchSearch;
|
|
@@ -299,8 +268,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
299
268
|
}
|
|
300
269
|
if (discount.appliedProductDetails) {
|
|
301
270
|
return discount.appliedProductDetails.reduce(function (total, product) {
|
|
302
|
-
var
|
|
303
|
-
var price = new Decimal((product === null || product === void 0 || (_product$discount = product.discount) === null || _product$discount === void 0 ? void 0 : _product$discount.fixed_amount) || 0).mul((product === null || product === void 0 ? void 0 : product._num) || 1);
|
|
271
|
+
var price = new Decimal((product === null || product === void 0 ? void 0 : product.amount) || 0).mul((product === null || product === void 0 ? void 0 : product.num) || 1);
|
|
304
272
|
return new Decimal(total).plus(price).toNumber();
|
|
305
273
|
}, 0);
|
|
306
274
|
}
|
|
@@ -308,21 +276,21 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
308
276
|
}, {
|
|
309
277
|
key: "destroy",
|
|
310
278
|
value: function () {
|
|
311
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
312
|
-
return _regeneratorRuntime().wrap(function
|
|
313
|
-
while (1) switch (
|
|
279
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
280
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
281
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
314
282
|
case 0:
|
|
315
283
|
this.store.discountList = [];
|
|
316
284
|
this.core.effects.offByModuleDestroy(this.name);
|
|
317
|
-
|
|
285
|
+
_context5.next = 4;
|
|
318
286
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
319
287
|
case 4:
|
|
320
288
|
console.log('[Discount] 已销毁');
|
|
321
289
|
case 5:
|
|
322
290
|
case "end":
|
|
323
|
-
return
|
|
291
|
+
return _context5.stop();
|
|
324
292
|
}
|
|
325
|
-
},
|
|
293
|
+
}, _callee5, this);
|
|
326
294
|
}));
|
|
327
295
|
function destroy() {
|
|
328
296
|
return _destroy.apply(this, arguments);
|
|
@@ -332,18 +300,17 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
332
300
|
}, {
|
|
333
301
|
key: "clear",
|
|
334
302
|
value: function () {
|
|
335
|
-
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
336
|
-
return _regeneratorRuntime().wrap(function
|
|
337
|
-
while (1) switch (
|
|
303
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
304
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
305
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
338
306
|
case 0:
|
|
339
307
|
this.store.discountList = [];
|
|
340
|
-
this.store.originalDiscountList = [];
|
|
341
308
|
console.log('[Discount] clear');
|
|
342
|
-
case
|
|
309
|
+
case 2:
|
|
343
310
|
case "end":
|
|
344
|
-
return
|
|
311
|
+
return _context6.stop();
|
|
345
312
|
}
|
|
346
|
-
},
|
|
313
|
+
}, _callee6, this);
|
|
347
314
|
}));
|
|
348
315
|
function clear() {
|
|
349
316
|
return _clear.apply(this, arguments);
|
|
@@ -15,16 +15,11 @@ interface Formattitle {
|
|
|
15
15
|
'zh-CN'?: any;
|
|
16
16
|
'zh-HK'?: any;
|
|
17
17
|
}
|
|
18
|
-
interface PackageSubItemUsageRules {
|
|
19
|
-
type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
|
|
20
|
-
rules: ("original_price" | "markup_price")[];
|
|
21
|
-
}
|
|
22
18
|
interface Limitedrelationproductdata {
|
|
23
19
|
id: number;
|
|
24
20
|
type: 'product_all' | 'products' | 'product_collection';
|
|
25
21
|
product_ids: number[];
|
|
26
22
|
product_collection_id: number[];
|
|
27
|
-
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
28
23
|
}
|
|
29
24
|
interface ApplicableProductDetails {
|
|
30
25
|
amount: string;
|
|
@@ -34,14 +29,12 @@ interface ApplicableProductDetails {
|
|
|
34
29
|
original_amount: string;
|
|
35
30
|
num: number;
|
|
36
31
|
discount?: {
|
|
37
|
-
fixed_amount?: number;
|
|
38
32
|
product_id?: number;
|
|
39
33
|
original_amount?: string;
|
|
40
34
|
percent?: string;
|
|
41
35
|
resource_id?: number;
|
|
42
36
|
title?: string;
|
|
43
37
|
};
|
|
44
|
-
_num: number;
|
|
45
38
|
}
|
|
46
39
|
interface UsageCreditsValue {
|
|
47
40
|
total_credits: number;
|
|
@@ -79,8 +72,6 @@ export interface Discount {
|
|
|
79
72
|
format_title: Formattitle;
|
|
80
73
|
metadata?: {
|
|
81
74
|
discount_card_type?: 'fixed_amount' | 'percent';
|
|
82
|
-
custom_product_bundle_map_id?: string;
|
|
83
|
-
validity_type?: "custom_schedule_validity" | "fixed_validity";
|
|
84
75
|
};
|
|
85
76
|
product: Product;
|
|
86
77
|
type: "product" | 'good_pass';
|
|
@@ -107,16 +98,9 @@ export interface Discount {
|
|
|
107
98
|
week_order_behavior_count?: number;
|
|
108
99
|
month_order_behavior_count?: number;
|
|
109
100
|
customer_order_behavior_count?: number;
|
|
110
|
-
custom_schedule_snapshot?: {
|
|
111
|
-
data: any[];
|
|
112
|
-
};
|
|
113
|
-
num?: number;
|
|
114
|
-
start_date?: string;
|
|
115
|
-
start_time?: string;
|
|
116
101
|
}
|
|
117
102
|
export interface DiscountState {
|
|
118
103
|
discountList: Discount[];
|
|
119
|
-
originalDiscountList?: Discount[];
|
|
120
104
|
}
|
|
121
105
|
export interface DiscountModuleAPI {
|
|
122
106
|
setDiscountList: (discountList: Discount[]) => Promise<void>;
|
|
@@ -24,7 +24,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
25
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
26
|
import { BaseModule } from "../BaseModule";
|
|
27
|
-
import { generateDuration,
|
|
27
|
+
import { generateDuration, mergeRelationForms } from "./utils";
|
|
28
28
|
import { isNormalProduct } from "../Product/utils";
|
|
29
29
|
import dayjs from 'dayjs';
|
|
30
30
|
export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
@@ -145,9 +145,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
145
145
|
item._origin.duration = duration;
|
|
146
146
|
item._origin.sub_type = durationType;
|
|
147
147
|
}
|
|
148
|
-
var discountList = getAllDiscountList(item);
|
|
149
|
-
item._origin.product.discount_list = discountList;
|
|
150
|
-
|
|
151
148
|
// 购物车是否为普通商品
|
|
152
149
|
if (isNormalProduct(item._origin)) {
|
|
153
150
|
var _order$relation_forms;
|
|
@@ -51,13 +51,4 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
|
|
|
51
51
|
}, {})).filter(function (item) {
|
|
52
52
|
return item.form_record_ids.length > 0;
|
|
53
53
|
}); // 过滤掉没有有效记录的表单
|
|
54
|
-
};
|
|
55
|
-
export var getAllDiscountList = function getAllDiscountList(cartItem) {
|
|
56
|
-
var _cartItem$_origin, _cartItem$_origin2;
|
|
57
|
-
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin = cartItem._origin) === null || _cartItem$_origin === void 0 || (_cartItem$_origin = _cartItem$_origin.product) === null || _cartItem$_origin === void 0 ? void 0 : _cartItem$_origin.discount_list) || [];
|
|
58
|
-
((cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.product_bundle) || []).forEach(function (item) {
|
|
59
|
-
discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray(item.discount_list || []));
|
|
60
|
-
item.discount_list = undefined;
|
|
61
|
-
});
|
|
62
|
-
return discountList;
|
|
63
54
|
};
|
|
@@ -21,7 +21,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
23
|
import { BaseModule } from "../BaseModule";
|
|
24
|
-
import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
|
|
24
|
+
import { PaymentStatus, PaymentHooks, PaymentMethodType, RoundingRule } from "./types";
|
|
25
25
|
import { getUniqueId } from "../Cart/utils";
|
|
26
26
|
import { CashPaymentImpl } from "./cash";
|
|
27
27
|
import { EftposPaymentImpl } from "./eftpos";
|
|
@@ -1200,7 +1200,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1200
1200
|
this.logInfo('更新订单支付项完成', {
|
|
1201
1201
|
orderUuid: orderUuid
|
|
1202
1202
|
});
|
|
1203
|
-
this.core.effects.emit(
|
|
1203
|
+
this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
|
|
1204
1204
|
orderUuid: orderUuid,
|
|
1205
1205
|
payment: newPaymentItem
|
|
1206
1206
|
});
|
|
@@ -64,14 +64,12 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
64
64
|
amountInfo = businessData.amountInfo,
|
|
65
65
|
products = businessData.products,
|
|
66
66
|
order_wait_pay_amount = businessData.order_wait_pay_amount,
|
|
67
|
-
payment_order_id = businessData.payment_order_id
|
|
68
|
-
is_price_include_tax = businessData.is_price_include_tax;
|
|
67
|
+
payment_order_id = businessData.payment_order_id;
|
|
69
68
|
|
|
70
69
|
// 转换金额为数字类型
|
|
71
70
|
var totalAmount = Number(amountInfo.totalAmount);
|
|
72
71
|
var subTotal = Number(amountInfo.subTotal);
|
|
73
72
|
var walletParams = {
|
|
74
|
-
is_price_include_tax: is_price_include_tax,
|
|
75
73
|
sale_channel: 'pos',
|
|
76
74
|
customer_id: customer_id || 0,
|
|
77
75
|
// 提供默认值,确保类型为 number
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -140,16 +140,17 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
140
140
|
productsData = _context3.sent;
|
|
141
141
|
sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
|
|
142
142
|
return Number(b.sort) - Number(a.sort);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
});
|
|
144
|
+
if (sortedList.length) {
|
|
145
|
+
sortedList.forEach(function (n) {
|
|
146
|
+
if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
|
|
147
|
+
n.is_eject = 1;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
150
151
|
this.addProduct(sortedList);
|
|
151
152
|
return _context3.abrupt("return", sortedList);
|
|
152
|
-
case
|
|
153
|
+
case 11:
|
|
153
154
|
case "end":
|
|
154
155
|
return _context3.stop();
|
|
155
156
|
}
|
|
@@ -37,13 +37,6 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
37
37
|
selectedList?: SetDiscountSelectedParams[];
|
|
38
38
|
scan?: boolean;
|
|
39
39
|
}): DiscountResult;
|
|
40
|
-
/**
|
|
41
|
-
* 检查优惠是否符合 PackageSubItemUsageRules 配置
|
|
42
|
-
* @param discount 优惠券
|
|
43
|
-
* @param flatItem 扁平化后的商品项(可能是主商品或bundle子商品)
|
|
44
|
-
* @returns 是否可用
|
|
45
|
-
*/
|
|
46
|
-
private checkPackageSubItemUsageRules;
|
|
47
40
|
destroy(): Promise<void>;
|
|
48
41
|
clear(): Promise<void>;
|
|
49
42
|
}
|