@pisell/pisellos 3.0.38 → 3.0.39
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/types.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +3 -2
- package/dist/modules/Summary/utils.js +2 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -1
- package/dist/solution/BookingByStep/index.js +6 -6
- package/lib/modules/Cart/types.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +2 -2
- package/lib/modules/Summary/utils.js +2 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -1
- package/lib/solution/BookingByStep/index.js +6 -6
- package/package.json +1 -1
|
@@ -69,8 +69,10 @@ export interface CartItem {
|
|
|
69
69
|
name?: string;
|
|
70
70
|
/** 商品价格 */
|
|
71
71
|
price?: number | string;
|
|
72
|
-
/**
|
|
72
|
+
/** 单个商品包括商品本身价格+套餐价格+规格等价格得出来的 */
|
|
73
73
|
total?: number | string;
|
|
74
|
+
/** 基于 total 乘以 商品数量的价格 */
|
|
75
|
+
summaryTotal?: number | string;
|
|
74
76
|
/** 商品原价总价,排除原始价格为0的场景 */
|
|
75
77
|
origin_total?: number | string;
|
|
76
78
|
/** 商品数量 */
|
|
@@ -61,6 +61,7 @@ export var formatProductToCartItem = function formatProductToCartItem(params) {
|
|
|
61
61
|
options: options,
|
|
62
62
|
num: num
|
|
63
63
|
});
|
|
64
|
+
cartItem.summaryTotal = cartItem.total * (num || 1);
|
|
64
65
|
cartItem.origin_total = getProductOriginTotalPrice({
|
|
65
66
|
product: product,
|
|
66
67
|
bundle: bundle,
|
|
@@ -161,7 +162,7 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
|
161
162
|
var product = params.product,
|
|
162
163
|
bundle = params.bundle,
|
|
163
164
|
options = params.options;
|
|
164
|
-
|
|
165
|
+
// const num = params.num || 1;
|
|
165
166
|
var price = Number(product.price);
|
|
166
167
|
if (bundle !== null && bundle !== void 0 && bundle.length) {
|
|
167
168
|
price = bundle.reduce(function (accumulator, currentValue) {
|
|
@@ -175,7 +176,7 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
|
175
176
|
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
176
177
|
}, price);
|
|
177
178
|
}
|
|
178
|
-
return price
|
|
179
|
+
return price;
|
|
179
180
|
};
|
|
180
181
|
|
|
181
182
|
/**
|
|
@@ -28,7 +28,7 @@ export var calculateSubtotal = function calculateSubtotal(items) {
|
|
|
28
28
|
return '0.00';
|
|
29
29
|
}
|
|
30
30
|
var subtotal = items.reduce(function (sum, item) {
|
|
31
|
-
var cartItemTotalPrice = new Decimal(item.
|
|
31
|
+
var cartItemTotalPrice = new Decimal(item.summaryTotal || 0);
|
|
32
32
|
return sum.plus(cartItemTotalPrice);
|
|
33
33
|
}, new Decimal(0));
|
|
34
34
|
return subtotal.toFixed(2);
|
|
@@ -50,7 +50,7 @@ export var calculateTaxFee = function calculateTaxFee(shopInfo, items) {
|
|
|
50
50
|
is_price_include_tax = _ref.is_price_include_tax,
|
|
51
51
|
tax_rate = _ref.tax_rate;
|
|
52
52
|
var totalTaxFee = items.reduce(function (sum, item) {
|
|
53
|
-
var cartItemTotalPrice = new Decimal(item.
|
|
53
|
+
var cartItemTotalPrice = new Decimal(item.summaryTotal || 0);
|
|
54
54
|
var taxRate = new Decimal(tax_rate || 0).div(100);
|
|
55
55
|
var productTaxRate = cartItemTotalPrice.times(taxRate).times((item === null || item === void 0 ? void 0 : item.is_charge_tax) || 0).div(taxRate.times(is_price_include_tax || 0).plus(1));
|
|
56
56
|
return sum.plus(productTaxRate);
|
|
@@ -42,10 +42,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
42
42
|
* 更新step
|
|
43
43
|
*/
|
|
44
44
|
updateStep(key: string, step: IStep): void;
|
|
45
|
-
loadProducts({ category_ids, product_ids, collection, }: {
|
|
45
|
+
loadProducts({ category_ids, product_ids, collection, schedule_date, }: {
|
|
46
46
|
category_ids?: number[];
|
|
47
47
|
product_ids?: number[];
|
|
48
48
|
collection?: number | string[];
|
|
49
|
+
schedule_date?: string;
|
|
49
50
|
}): Promise<any>;
|
|
50
51
|
loadProductByScheduleDate({ date, product_ids, category_ids, }: {
|
|
51
52
|
date: string;
|
|
@@ -209,11 +209,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
209
209
|
key: "loadProducts",
|
|
210
210
|
value: function () {
|
|
211
211
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
212
|
-
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, userPlugin, customer_id, _userPlugin$get, productsData;
|
|
212
|
+
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, userPlugin, customer_id, _userPlugin$get, productsData;
|
|
213
213
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
214
214
|
while (1) switch (_context2.prev = _context2.next) {
|
|
215
215
|
case 0:
|
|
216
|
-
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection;
|
|
216
|
+
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date;
|
|
217
217
|
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
218
218
|
// if (!schedule_ids?.length) {
|
|
219
219
|
// const schedule_ids_data = this.store.schedule
|
|
@@ -247,9 +247,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
247
247
|
category_ids: category_ids,
|
|
248
248
|
ids: product_ids,
|
|
249
249
|
collection: collection,
|
|
250
|
-
front_end_cache_id: this.cacheId
|
|
250
|
+
front_end_cache_id: this.cacheId,
|
|
251
251
|
// client_schedule_ids: schedule_ids,
|
|
252
|
-
|
|
252
|
+
schedule_date: schedule_date
|
|
253
253
|
}, {
|
|
254
254
|
useCache: true
|
|
255
255
|
});
|
|
@@ -318,8 +318,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
318
318
|
return this.loadProducts({
|
|
319
319
|
// schedule_ids: scheduleIds,
|
|
320
320
|
product_ids: allProductIds,
|
|
321
|
-
category_ids: category_ids
|
|
322
|
-
|
|
321
|
+
category_ids: category_ids,
|
|
322
|
+
schedule_date: date
|
|
323
323
|
});
|
|
324
324
|
case 9:
|
|
325
325
|
return _context3.abrupt("return", _context3.sent);
|
|
@@ -69,8 +69,10 @@ export interface CartItem {
|
|
|
69
69
|
name?: string;
|
|
70
70
|
/** 商品价格 */
|
|
71
71
|
price?: number | string;
|
|
72
|
-
/**
|
|
72
|
+
/** 单个商品包括商品本身价格+套餐价格+规格等价格得出来的 */
|
|
73
73
|
total?: number | string;
|
|
74
|
+
/** 基于 total 乘以 商品数量的价格 */
|
|
75
|
+
summaryTotal?: number | string;
|
|
74
76
|
/** 商品原价总价,排除原始价格为0的场景 */
|
|
75
77
|
origin_total?: number | string;
|
|
76
78
|
/** 商品数量 */
|
|
@@ -74,6 +74,7 @@ var formatProductToCartItem = (params) => {
|
|
|
74
74
|
cartItem.price = product == null ? void 0 : product.price;
|
|
75
75
|
cartItem.num = num;
|
|
76
76
|
cartItem.total = getProductTotalPrice({ product, bundle, options, num });
|
|
77
|
+
cartItem.summaryTotal = cartItem.total * (num || 1);
|
|
77
78
|
cartItem.origin_total = getProductOriginTotalPrice({
|
|
78
79
|
product,
|
|
79
80
|
bundle,
|
|
@@ -163,7 +164,6 @@ var formatProductToCartItemOrigin = (params) => {
|
|
|
163
164
|
};
|
|
164
165
|
var getProductTotalPrice = (params) => {
|
|
165
166
|
const { product, bundle, options } = params;
|
|
166
|
-
const num = params.num || 1;
|
|
167
167
|
let price = Number(product.price);
|
|
168
168
|
if (bundle == null ? void 0 : bundle.length) {
|
|
169
169
|
price = bundle.reduce((accumulator, currentValue) => {
|
|
@@ -175,7 +175,7 @@ var getProductTotalPrice = (params) => {
|
|
|
175
175
|
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
176
176
|
}, price);
|
|
177
177
|
}
|
|
178
|
-
return price
|
|
178
|
+
return price;
|
|
179
179
|
};
|
|
180
180
|
var getProductOriginTotalPrice = (params) => {
|
|
181
181
|
const { product, bundle, options } = params;
|
|
@@ -55,7 +55,7 @@ var calculateSubtotal = (items) => {
|
|
|
55
55
|
return "0.00";
|
|
56
56
|
}
|
|
57
57
|
const subtotal = items.reduce((sum, item) => {
|
|
58
|
-
const cartItemTotalPrice = new import_decimal.default(item.
|
|
58
|
+
const cartItemTotalPrice = new import_decimal.default(item.summaryTotal || 0);
|
|
59
59
|
return sum.plus(cartItemTotalPrice);
|
|
60
60
|
}, new import_decimal.default(0));
|
|
61
61
|
return subtotal.toFixed(2);
|
|
@@ -66,7 +66,7 @@ var calculateTaxFee = (shopInfo, items) => {
|
|
|
66
66
|
}
|
|
67
67
|
const { is_price_include_tax, tax_rate } = shopInfo || {};
|
|
68
68
|
const totalTaxFee = items.reduce((sum, item) => {
|
|
69
|
-
const cartItemTotalPrice = new import_decimal.default(item.
|
|
69
|
+
const cartItemTotalPrice = new import_decimal.default(item.summaryTotal || 0);
|
|
70
70
|
const taxRate = new import_decimal.default(tax_rate || 0).div(100);
|
|
71
71
|
const productTaxRate = cartItemTotalPrice.times(taxRate).times((item == null ? void 0 : item.is_charge_tax) || 0).div(taxRate.times(is_price_include_tax || 0).plus(1));
|
|
72
72
|
return sum.plus(productTaxRate);
|
|
@@ -42,10 +42,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
42
42
|
* 更新step
|
|
43
43
|
*/
|
|
44
44
|
updateStep(key: string, step: IStep): void;
|
|
45
|
-
loadProducts({ category_ids, product_ids, collection, }: {
|
|
45
|
+
loadProducts({ category_ids, product_ids, collection, schedule_date, }: {
|
|
46
46
|
category_ids?: number[];
|
|
47
47
|
product_ids?: number[];
|
|
48
48
|
collection?: number | string[];
|
|
49
|
+
schedule_date?: string;
|
|
49
50
|
}): Promise<any>;
|
|
50
51
|
loadProductByScheduleDate({ date, product_ids, category_ids, }: {
|
|
51
52
|
date: string;
|
|
@@ -163,9 +163,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
163
163
|
async loadProducts({
|
|
164
164
|
category_ids = [],
|
|
165
165
|
product_ids = [],
|
|
166
|
-
collection = []
|
|
166
|
+
collection = [],
|
|
167
167
|
// schedule_ids = [],
|
|
168
|
-
|
|
168
|
+
schedule_date
|
|
169
169
|
}) {
|
|
170
170
|
var _a;
|
|
171
171
|
let userPlugin = this.core.getPlugin("user");
|
|
@@ -196,9 +196,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
196
196
|
category_ids,
|
|
197
197
|
ids: product_ids,
|
|
198
198
|
collection,
|
|
199
|
-
front_end_cache_id: this.cacheId
|
|
199
|
+
front_end_cache_id: this.cacheId,
|
|
200
200
|
// client_schedule_ids: schedule_ids,
|
|
201
|
-
|
|
201
|
+
schedule_date
|
|
202
202
|
},
|
|
203
203
|
{ useCache: true }
|
|
204
204
|
);
|
|
@@ -227,8 +227,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
227
227
|
return await this.loadProducts({
|
|
228
228
|
// schedule_ids: scheduleIds,
|
|
229
229
|
product_ids: allProductIds,
|
|
230
|
-
category_ids
|
|
231
|
-
|
|
230
|
+
category_ids,
|
|
231
|
+
schedule_date: date
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
234
|
async updateQuotationPriceAndCart(date) {
|