@pisell/private-materials 6.6.38 → 6.6.40
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/booking/addons/model.d.ts +10 -1
- package/es/components/booking/components/footer/amount.js +3 -4
- package/es/components/booking/components/footer/utils.js +5 -12
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/forms/model.d.ts +10 -1
- package/es/components/booking/info/model.d.ts +10 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info/service2/Group/utils.js +1 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/editService/index.js +47 -10
- package/es/components/booking/info2/service/editService/utils.d.ts +7 -1
- package/es/components/booking/info2/service/editService/utils.js +26 -12
- package/es/components/booking/model.d.ts +9 -1
- package/es/components/booking/notes/model.d.ts +10 -1
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/booking/payments/model.d.ts +10 -1
- package/es/components/booking/utils.d.ts +1 -0
- package/es/components/booking/utils.js +36 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +2 -2
- package/es/components/eftposPay/store/index.d.ts +5 -5
- package/es/components/pay/toC/model.d.ts +9 -1
- package/es/components/schedules/model.d.ts +9 -1
- package/es/components/ticketBooking/utils/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
- package/lib/components/booking/addons/model.d.ts +10 -1
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +6 -13
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/forms/model.d.ts +10 -1
- package/lib/components/booking/info/model.d.ts +10 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info/service2/Group/utils.js +1 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/editService/index.js +40 -15
- package/lib/components/booking/info2/service/editService/utils.d.ts +7 -1
- package/lib/components/booking/info2/service/editService/utils.js +16 -13
- package/lib/components/booking/model.d.ts +9 -1
- package/lib/components/booking/notes/model.d.ts +10 -1
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/booking/payments/model.d.ts +10 -1
- package/lib/components/booking/utils.d.ts +1 -0
- package/lib/components/booking/utils.js +29 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +2 -2
- package/lib/components/eftposPay/store/index.d.ts +5 -5
- package/lib/components/pay/toC/model.d.ts +9 -1
- package/lib/components/schedules/model.d.ts +9 -1
- package/lib/components/ticketBooking/utils/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -519,8 +519,7 @@ var processItemsTax = function processItemsTax(items, state, options) {
|
|
|
519
519
|
}
|
|
520
520
|
return {
|
|
521
521
|
originTax: expectedOriginTax,
|
|
522
|
-
tax: expectedTax
|
|
523
|
-
taxDecimal: preciseTax
|
|
522
|
+
tax: expectedTax
|
|
524
523
|
};
|
|
525
524
|
};
|
|
526
525
|
|
|
@@ -652,7 +651,7 @@ var getTax = function getTax(state, options) {
|
|
|
652
651
|
computed: computed
|
|
653
652
|
});
|
|
654
653
|
totalOriginTax = totalOriginTax.plus(serviceResult.originTax);
|
|
655
|
-
totalTax = totalTax.plus(serviceResult.
|
|
654
|
+
totalTax = totalTax.plus(serviceResult.tax);
|
|
656
655
|
}
|
|
657
656
|
|
|
658
657
|
// 处理附加商品
|
|
@@ -663,7 +662,7 @@ var getTax = function getTax(state, options) {
|
|
|
663
662
|
computed: computed
|
|
664
663
|
});
|
|
665
664
|
totalOriginTax = totalOriginTax.plus(addonsResult.originTax);
|
|
666
|
-
totalTax = totalTax.plus(addonsResult.
|
|
665
|
+
totalTax = totalTax.plus(addonsResult.tax);
|
|
667
666
|
}
|
|
668
667
|
}
|
|
669
668
|
return {
|
|
@@ -107,7 +107,6 @@ export var formatProductBundle = function formatProductBundle(bundle) {
|
|
|
107
107
|
}
|
|
108
108
|
} catch (error) {}
|
|
109
109
|
return bundle.map(function (d) {
|
|
110
|
-
var _d$metadata;
|
|
111
110
|
var option = formatProductOption(d.option);
|
|
112
111
|
var option_price = option.reduce(function (temp, item) {
|
|
113
112
|
return temp + Number(item.num) * item.custom_add_price;
|
|
@@ -135,7 +134,7 @@ export var formatProductBundle = function formatProductBundle(bundle) {
|
|
|
135
134
|
"bundle_selling_price": Math.abs(d === null || d === void 0 ? void 0 : d.price),
|
|
136
135
|
// "bundle_sum_price": d?.original_price || d?.original_total,
|
|
137
136
|
"metadata": {
|
|
138
|
-
custom_product_bundle_map_id:
|
|
137
|
+
custom_product_bundle_map_id: d._id,
|
|
139
138
|
// 子商品单数量附加费
|
|
140
139
|
"surcharge_fee": d.surcharge_fee,
|
|
141
140
|
// 可选,附加费均摊舍入金额
|
|
@@ -440,9 +439,9 @@ var formatProductMetadata = function formatProductMetadata(item) {
|
|
|
440
439
|
|
|
441
440
|
// 获取商品价格 包含组合规格
|
|
442
441
|
export var getSourceProductPrice = function getSourceProductPrice(item) {
|
|
443
|
-
var _item$_extend29, _item$_extend30, _item$variant2;
|
|
442
|
+
var _item$_extend29, _item$price2, _item$_extend30, _item$variant2;
|
|
444
443
|
var other = (_item$_extend29 = item._extend) === null || _item$_extend29 === void 0 ? void 0 : _item$_extend29.other;
|
|
445
|
-
var price = Number((_item$_extend30 = item._extend) === null || _item$_extend30 === void 0 ? void 0 : _item$_extend30.price);
|
|
444
|
+
var price = Number((_item$price2 = item === null || item === void 0 ? void 0 : item.price) !== null && _item$price2 !== void 0 ? _item$price2 : (_item$_extend30 = item._extend) === null || _item$_extend30 === void 0 ? void 0 : _item$_extend30.price);
|
|
446
445
|
|
|
447
446
|
// 组合规格: 根据当前选择的组合规格id 和商品的组合规格列表 获取当前商品的价格
|
|
448
447
|
if ((other === null || other === void 0 ? void 0 : other.product_variant_id) > 0 && (item === null || item === void 0 || (_item$variant2 = item.variant) === null || _item$variant2 === void 0 ? void 0 : _item$variant2.length) > 0) {
|
|
@@ -483,7 +482,7 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
|
|
|
483
482
|
* @Author: WangHan
|
|
484
483
|
* @Date: 2024-12-07 14:21
|
|
485
484
|
*/
|
|
486
|
-
var formatProducts = function formatProducts(item, quantity
|
|
485
|
+
var formatProducts = function formatProducts(item, quantity) {
|
|
487
486
|
var _item$_extend34, _getMainProductSellin, _item$_extend35, _item$_extend36, _item$_extend37, _item$_extend38;
|
|
488
487
|
var total = Number(item._extend.total);
|
|
489
488
|
var origin_total = Number(item._extend.origin_total);
|
|
@@ -498,9 +497,6 @@ var formatProducts = function formatProducts(item, quantity, options) {
|
|
|
498
497
|
d.metadata = _objectSpread(_objectSpread({}, d.metadata), {}, {
|
|
499
498
|
unique_identification_number: "".concat(item._extend.unique_identification_number, "_").concat(d.discount.resource_id)
|
|
500
499
|
});
|
|
501
|
-
if (options !== null && options !== void 0 && options.isServiceEdit && options !== null && options !== void 0 && options.isMultiDay) {
|
|
502
|
-
delete d.id;
|
|
503
|
-
}
|
|
504
500
|
});
|
|
505
501
|
|
|
506
502
|
// 非手动折扣
|
|
@@ -723,10 +719,7 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
723
719
|
item._extend.unique_identification_number = unique_identification_number;
|
|
724
720
|
}
|
|
725
721
|
var booking = _objectSpread(_objectSpread({
|
|
726
|
-
product: formatProducts(item,
|
|
727
|
-
isServiceEdit: data.service.edit,
|
|
728
|
-
isMultiDay: isMultiDay
|
|
729
|
-
}),
|
|
722
|
+
product: formatProducts(item),
|
|
730
723
|
relation_products: formatRelationDetails(item._extend.relation_details),
|
|
731
724
|
id: item.booking_id || 0,
|
|
732
725
|
relation_id: item._extend.relation_id || 0,
|
|
@@ -128,7 +128,7 @@ var VoucherCard = function VoucherCard(props) {
|
|
|
128
128
|
var val = (_ref = state.service.value || []) === null || _ref === void 0 ? void 0 : _ref.map(function (value) {
|
|
129
129
|
var _value$_extend, _value$_extend2, _value$_extend3;
|
|
130
130
|
return {
|
|
131
|
-
|
|
131
|
+
booking_id: value.booking_id,
|
|
132
132
|
id: value.id,
|
|
133
133
|
price: value.price,
|
|
134
134
|
total: value === null || value === void 0 || (_value$_extend = value._extend) === null || _value$_extend === void 0 ? void 0 : _value$_extend.total,
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from '../model';
|
|
1
3
|
export declare const walkInData: {
|
|
2
4
|
id: number;
|
|
3
5
|
nickname: string;
|
|
4
6
|
};
|
|
5
|
-
export declare const Provider: any, Context:
|
|
7
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
8
|
+
state: FormState;
|
|
9
|
+
} & {
|
|
10
|
+
dispatch: (params: {
|
|
11
|
+
type: string;
|
|
12
|
+
payload: any;
|
|
13
|
+
}) => void;
|
|
14
|
+
}>;
|
|
@@ -91,7 +91,7 @@ export var createBookingItemsByGroup = function createBookingItemsByGroup(item,
|
|
|
91
91
|
// 编辑时组商品需要清空booking_id 否则会重复
|
|
92
92
|
booking_id: isBatchEdit ? 0 : item.booking_id,
|
|
93
93
|
_id: "".concat(item._id, "-").concat(i + 1),
|
|
94
|
-
price: price,
|
|
94
|
+
// price: price,
|
|
95
95
|
_extend: _objectSpread(_objectSpread({}, _extend), {}, {
|
|
96
96
|
order_detail_id: isBatchEdit ? 0 : item.order_detail_id,
|
|
97
97
|
groupId: groupId,
|
|
@@ -216,4 +216,4 @@ export declare const updateAppointmentServicePrice: (state: any, { start_date, e
|
|
|
216
216
|
* @Author: WangHan
|
|
217
217
|
* @Date: 2024-12-24 11:32
|
|
218
218
|
*/
|
|
219
|
-
export declare const updateServicePrice: (state: any) => Promise<any
|
|
219
|
+
export declare const updateServicePrice: (state: any) => never[] | Promise<any>;
|
|
@@ -38,10 +38,10 @@ import { ConfigProvider, Iconfont } from '@pisell/materials';
|
|
|
38
38
|
import { addService, genHolderKey, genServiceKey, getIsShowNumber } from "../../../../ticketBooking/utils";
|
|
39
39
|
import { disabledDate as _disabledDate, isNormalProductByDurationSchedule } from "../../../info/service2/utils";
|
|
40
40
|
import { editSessionProduct } from "../../../info/utils";
|
|
41
|
-
import { deleteCacheParams, getDays, getProductTotalPrice, getServiceTimes, isSessionProduct, isWalkIn } from "../../../utils";
|
|
41
|
+
import { deleteCacheParams, getDays, getProductOriginTotalPrice, getProductTotalPrice, getServiceTimes, isSessionProduct, isWalkIn } from "../../../utils";
|
|
42
42
|
import { getErrorList, getIsNoSpecAndPackage } from "../../utilsByBooking";
|
|
43
43
|
import { formatResources, getDurationProps, getFlexibleOption, getMultiDay, getTimeObj, setDefaultCapacitys } from "../addService/utils";
|
|
44
|
-
import { getProductAllDiscountList,
|
|
44
|
+
import { getProductAllDiscountList, mergeBundleWithOriginalPrice, setProductPrice } from "./utils";
|
|
45
45
|
import NoteModal from "../../../../../plus/noteModal";
|
|
46
46
|
import { DiscountKeyboard } from "../../../../../pro/priceKeyboard";
|
|
47
47
|
import EditTabs from "../../../info/service/editService/EditTabs";
|
|
@@ -50,6 +50,7 @@ import dayjs from "dayjs";
|
|
|
50
50
|
import { createBookingItemsByGroup, getGroupTotalPrice } from "../../../info/service2/Group/utils";
|
|
51
51
|
import { useShopDiscountModule } from "../../../../ticketBooking/hooks/pisellos/useShopDiscountModule";
|
|
52
52
|
import DiscountChangeModal from "./DiscountChangeModal";
|
|
53
|
+
import Decimal from "decimal.js";
|
|
53
54
|
var submitLock = false;
|
|
54
55
|
var Info = function Info(_, ref) {
|
|
55
56
|
var _state$service4, _state$bookingConfig2, _state$bookingConfig3, _state$service$cacheI5, _state$service$cacheI7, _state$service6, _window$BaseMaterials, _state$service8, _state$service$cacheI12, _state$bookingConfig5, _state$service$cacheI13, _state$service$cacheI14, _state$service9, _state$service$resour2, _state$service$cacheI16, _state$service$cacheI17, _state$client2;
|
|
@@ -346,6 +347,30 @@ var Info = function Info(_, ref) {
|
|
|
346
347
|
_extend.startDate = startDate;
|
|
347
348
|
_extend.endDate = endDate;
|
|
348
349
|
}
|
|
350
|
+
if (isChangeTotal.current) {
|
|
351
|
+
var _extend$other, _extend$other2;
|
|
352
|
+
// 计算折扣比例
|
|
353
|
+
var discountRatio = new Decimal(values.total).div(_item._extend.origin_total);
|
|
354
|
+
|
|
355
|
+
// 处理子商品
|
|
356
|
+
var _bundles = (_extend === null || _extend === void 0 || (_extend$other = _extend.other) === null || _extend$other === void 0 ? void 0 : _extend$other.bundle) || [];
|
|
357
|
+
var childProductsTotal = new Decimal(0);
|
|
358
|
+
if (_bundles.length > 0) {
|
|
359
|
+
_bundles.forEach(function (bundle) {
|
|
360
|
+
// 计算子商品折扣后的单价(保留两位小数)
|
|
361
|
+
var discountedPrice = new Decimal(bundle.original_price).mul(discountRatio).toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
362
|
+
bundle.bundle_selling_price = discountedPrice.toNumber();
|
|
363
|
+
|
|
364
|
+
// 累计子商品折扣后总价
|
|
365
|
+
childProductsTotal = childProductsTotal.add(discountedPrice.mul(bundle.quantity));
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// 计算主商品折扣后的单价
|
|
370
|
+
var mainProductTotal = new Decimal(values.total).sub(childProductsTotal);
|
|
371
|
+
var mainProductQuantity = ((_extend$other2 = _extend.other) === null || _extend$other2 === void 0 ? void 0 : _extend$other2.quantity) || _extend.quantity || 1;
|
|
372
|
+
_extend.main_product_selling_price = mainProductTotal.div(mainProductQuantity).toNumber();
|
|
373
|
+
}
|
|
349
374
|
if (_extend.bundle_edit !== undefined) {
|
|
350
375
|
_extend.bundle_edit = 1;
|
|
351
376
|
}
|
|
@@ -655,18 +680,22 @@ var Info = function Info(_, ref) {
|
|
|
655
680
|
},
|
|
656
681
|
isOS: isSession,
|
|
657
682
|
customer_id: (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id,
|
|
658
|
-
value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), {}, {
|
|
659
|
-
bundle: mergeBundles(item._extend.other)
|
|
660
|
-
}, sessionValue), {}, {
|
|
683
|
+
value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), sessionValue), {}, {
|
|
661
684
|
quantity: values.quantity || item._extend.quantity
|
|
662
685
|
})
|
|
663
686
|
},
|
|
664
687
|
callback: function callback(e, extension_type, detail) {
|
|
665
|
-
var _cacheItem$_extend, _cacheItem$_extend2;
|
|
688
|
+
var _cacheItem$metadata, _cacheItem$_extend, _cacheItem$_extend2;
|
|
666
689
|
// 标记已执行过编辑操作
|
|
667
690
|
isEditedRef.current = true;
|
|
668
691
|
var _detail = detail || item;
|
|
669
692
|
var other = JSON.parse(JSON.stringify(e));
|
|
693
|
+
|
|
694
|
+
// 手动折扣时 合并 bundle price,优先使用编辑前的价格
|
|
695
|
+
if (item.discount_amount) {
|
|
696
|
+
var _item$_extend10;
|
|
697
|
+
other = mergeBundleWithOriginalPrice(other, ((_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.other) || {});
|
|
698
|
+
}
|
|
670
699
|
other.session = e.session;
|
|
671
700
|
|
|
672
701
|
// 重新生成商品
|
|
@@ -682,6 +711,12 @@ var Info = function Info(_, ref) {
|
|
|
682
711
|
new: 0
|
|
683
712
|
});
|
|
684
713
|
|
|
714
|
+
// 手动折扣编辑时保留原有折扣
|
|
715
|
+
if (cacheItem.discount_amount && cacheItem !== null && cacheItem !== void 0 && (_cacheItem$metadata = cacheItem.metadata) !== null && _cacheItem$metadata !== void 0 && _cacheItem$metadata.main_product_selling_price) {
|
|
716
|
+
var _cacheItem$metadata2;
|
|
717
|
+
cacheItem._extend.price = cacheItem === null || cacheItem === void 0 || (_cacheItem$metadata2 = cacheItem.metadata) === null || _cacheItem$metadata2 === void 0 ? void 0 : _cacheItem$metadata2.main_product_selling_price;
|
|
718
|
+
}
|
|
719
|
+
|
|
685
720
|
// 获取商品总价
|
|
686
721
|
var _total = getProductTotalPrice(cacheItem);
|
|
687
722
|
|
|
@@ -702,11 +737,15 @@ var Info = function Info(_, ref) {
|
|
|
702
737
|
});
|
|
703
738
|
}, 200);
|
|
704
739
|
}
|
|
740
|
+
var origin_total = _total;
|
|
741
|
+
if (item.discount_amount) {
|
|
742
|
+
origin_total = getProductOriginTotalPrice(cacheItem);
|
|
743
|
+
}
|
|
705
744
|
|
|
706
745
|
// 用于储存原价
|
|
707
|
-
cacheItem._extend.origin_total =
|
|
746
|
+
cacheItem._extend.origin_total = origin_total;
|
|
708
747
|
(((_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.items) || []).forEach(function (item) {
|
|
709
|
-
return item._extend.origin_total =
|
|
748
|
+
return item._extend.origin_total = origin_total;
|
|
710
749
|
});
|
|
711
750
|
|
|
712
751
|
// 覆盖商品
|
|
@@ -1177,8 +1216,6 @@ var Info = function Info(_, ref) {
|
|
|
1177
1216
|
var _cacheItem$_extend$ot, _cacheItem$_extend$ot2;
|
|
1178
1217
|
delete cacheItem.discount_list;
|
|
1179
1218
|
(_cacheItem$_extend$ot = cacheItem._extend.other) === null || _cacheItem$_extend$ot === void 0 || (_cacheItem$_extend$ot = _cacheItem$_extend$ot.bundle) === null || _cacheItem$_extend$ot === void 0 || (_cacheItem$_extend$ot2 = _cacheItem$_extend$ot.forEach) === null || _cacheItem$_extend$ot2 === void 0 || _cacheItem$_extend$ot2.call(_cacheItem$_extend$ot, function (bundle) {
|
|
1180
|
-
var _bundle$metadata;
|
|
1181
|
-
bundle === null || bundle === void 0 || (_bundle$metadata = bundle.metadata) === null || _bundle$metadata === void 0 || delete _bundle$metadata.custom_product_bundle_map_id;
|
|
1182
1219
|
bundle === null || bundle === void 0 || delete bundle.discount_list;
|
|
1183
1220
|
bundle === null || bundle === void 0 || delete bundle.booking_id;
|
|
1184
1221
|
bundle === null || bundle === void 0 || delete bundle.bundle_selling_price;
|
|
@@ -32,4 +32,10 @@ export declare const setProductPrice: (cacheItem: any, { newTotal, origin_total
|
|
|
32
32
|
* @returns 折扣列表
|
|
33
33
|
*/
|
|
34
34
|
export declare const getProductAllDiscountList: (cacheItem: any) => any;
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
|
|
37
|
+
* @param other - callback 返回的新数据
|
|
38
|
+
* @param originalOther - 编辑前的原始数据 (item._extend.other)
|
|
39
|
+
* @returns 合并后的 other
|
|
40
|
+
*/
|
|
41
|
+
export declare const mergeBundleWithOriginalPrice: (other: any, originalOther: any) => any;
|
|
@@ -83,6 +83,9 @@ export var setProductPrice = function setProductPrice(cacheItem, _ref2) {
|
|
|
83
83
|
})) {
|
|
84
84
|
return cacheItem;
|
|
85
85
|
}
|
|
86
|
+
if (cacheItem.discount_amount) {
|
|
87
|
+
return cacheItem;
|
|
88
|
+
}
|
|
86
89
|
|
|
87
90
|
// 计算折扣比例
|
|
88
91
|
var discountRatio = new Decimal(newTotal).div(new Decimal(origin_total));
|
|
@@ -146,19 +149,30 @@ export var getProductAllDiscountList = function getProductAllDiscountList(cacheI
|
|
|
146
149
|
(_discountList = discountList).push.apply(_discountList, _toConsumableArray(bundleDiscountList));
|
|
147
150
|
return discountList;
|
|
148
151
|
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
|
|
155
|
+
* @param other - callback 返回的新数据
|
|
156
|
+
* @param originalOther - 编辑前的原始数据 (item._extend.other)
|
|
157
|
+
* @returns 合并后的 other
|
|
158
|
+
*/
|
|
159
|
+
export var mergeBundleWithOriginalPrice = function mergeBundleWithOriginalPrice(other, originalOther) {
|
|
160
|
+
var _other$bundle, _originalOther$bundle;
|
|
161
|
+
if (!(other !== null && other !== void 0 && (_other$bundle = other.bundle) !== null && _other$bundle !== void 0 && _other$bundle.length) || !(originalOther !== null && originalOther !== void 0 && (_originalOther$bundle = originalOther.bundle) !== null && _originalOther$bundle !== void 0 && _originalOther$bundle.length)) return other;
|
|
162
|
+
other.bundle = other.bundle.map(function (bundle) {
|
|
163
|
+
var matched = originalOther.bundle.find(function (orig) {
|
|
164
|
+
return orig.id === bundle.id && orig.product_id === bundle.product_id;
|
|
155
165
|
});
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
166
|
+
if (matched && matched.price !== undefined) {
|
|
167
|
+
var _matched$original_tot, _matched$original_pri, _matched$custom_price;
|
|
168
|
+
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
169
|
+
price: matched.price,
|
|
170
|
+
original_total: (_matched$original_tot = matched === null || matched === void 0 ? void 0 : matched.original_total) !== null && _matched$original_tot !== void 0 ? _matched$original_tot : bundle.original_total,
|
|
171
|
+
original_price: (_matched$original_pri = matched === null || matched === void 0 ? void 0 : matched.original_price) !== null && _matched$original_pri !== void 0 ? _matched$original_pri : bundle.original_price,
|
|
172
|
+
custom_price: (_matched$custom_price = matched === null || matched === void 0 ? void 0 : matched.custom_price) !== null && _matched$custom_price !== void 0 ? _matched$custom_price : bundle.custom_price
|
|
173
|
+
});
|
|
161
174
|
}
|
|
175
|
+
return bundle;
|
|
162
176
|
});
|
|
163
|
-
return
|
|
177
|
+
return other;
|
|
164
178
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface FormState {
|
|
2
3
|
amountSymbol: string;
|
|
3
4
|
apis: {
|
|
@@ -109,4 +110,11 @@ export declare const walkInData: {
|
|
|
109
110
|
id: number;
|
|
110
111
|
nickname: string;
|
|
111
112
|
};
|
|
112
|
-
export declare const Provider: any, Context:
|
|
113
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
114
|
+
state: FormState;
|
|
115
|
+
} & {
|
|
116
|
+
dispatch: (params: {
|
|
117
|
+
type: string;
|
|
118
|
+
payload: any;
|
|
119
|
+
}) => void;
|
|
120
|
+
}>;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -189,7 +189,7 @@ var Payments = Provider(function (props) {
|
|
|
189
189
|
className: "payment-list-item-surcharge"
|
|
190
190
|
}, "(", locales.getText("pisell2.text.surcharge"), " ", formatAmount(item.service_fee, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"), ")") : null, /*#__PURE__*/React.createElement("div", {
|
|
191
191
|
className: "payment-list-item-date"
|
|
192
|
-
}, dayjs(item.payment_time
|
|
192
|
+
}, dayjs(item.payment_time).format("HH:mm YYYY/MM/DD"), /*#__PURE__*/React.createElement("span", {
|
|
193
193
|
className: "payment-list-item-platform-type"
|
|
194
194
|
}, item.platform && locales.getText("pisell2.text.platform.type")(item.platform))))))));
|
|
195
195
|
}
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -163,6 +163,7 @@ export declare const getIsOnlySession: (item: any) => boolean;
|
|
|
163
163
|
export declare const getServerItemExtend: (state: any, cacheItem: any, timeObj: any) => any;
|
|
164
164
|
export declare const getMainPrice: (item: any, price?: number) => number;
|
|
165
165
|
export declare const getProductTotalPrice: (item: any) => number;
|
|
166
|
+
export declare const getProductOriginTotalPrice: (item: any) => number;
|
|
166
167
|
/**
|
|
167
168
|
* @title: 判断 duration
|
|
168
169
|
* @description: 用于处理不同格式的duration
|
|
@@ -820,6 +820,42 @@ export var getProductTotalPrice = function getProductTotalPrice(item) {
|
|
|
820
820
|
}
|
|
821
821
|
return price.toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
822
822
|
};
|
|
823
|
+
export var getProductOriginTotalPrice = function getProductOriginTotalPrice(item) {
|
|
824
|
+
var _ref2, _ref3, _item$metadata$source, _item$metadata, _item$_extend3, _item$_extend4, _item$_extend5;
|
|
825
|
+
var price = new Decimal((_ref2 = (_ref3 = (_item$metadata$source = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.source_product_price) !== null && _item$metadata$source !== void 0 ? _item$metadata$source : item === null || item === void 0 ? void 0 : item.price) !== null && _ref3 !== void 0 ? _ref3 : item === null || item === void 0 || (_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.price) !== null && _ref2 !== void 0 ? _ref2 : 0);
|
|
826
|
+
var other = (_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 ? void 0 : _item$_extend4.other;
|
|
827
|
+
// 如果有 priceOverride,则强制使用 priceOverride,不受规则约束
|
|
828
|
+
if ((_item$_extend5 = item._extend) !== null && _item$_extend5 !== void 0 && _item$_extend5.priceOverride) {
|
|
829
|
+
var _item$_extend6;
|
|
830
|
+
price = new Decimal(((_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.priceOverride) || 0);
|
|
831
|
+
return price.toNumber();
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// 多规格
|
|
835
|
+
if (other !== null && other !== void 0 && other.product_variant_id) {
|
|
836
|
+
price = new Decimal((other === null || other === void 0 ? void 0 : other.price) || 0);
|
|
837
|
+
}
|
|
838
|
+
if (other !== null && other !== void 0 && other.bundle) {
|
|
839
|
+
// bundle
|
|
840
|
+
price = other === null || other === void 0 ? void 0 : other.bundle.reduce(function (accumulator, currentValue) {
|
|
841
|
+
var _ref4, _ref5, _ref6, _currentValue$source_;
|
|
842
|
+
var currentPrice = new Decimal((_ref4 = (_ref5 = (_ref6 = (_currentValue$source_ = currentValue === null || currentValue === void 0 ? void 0 : currentValue.source_product_price) !== null && _currentValue$source_ !== void 0 ? _currentValue$source_ : currentValue === null || currentValue === void 0 ? void 0 : currentValue.original_price) !== null && _ref6 !== void 0 ? _ref6 : currentValue === null || currentValue === void 0 ? void 0 : currentValue.product_price) !== null && _ref5 !== void 0 ? _ref5 : currentValue.price) !== null && _ref4 !== void 0 ? _ref4 : 0);
|
|
843
|
+
var currentNum = new Decimal(currentValue.num || 0);
|
|
844
|
+
return accumulator.add(currentPrice.mul(currentNum));
|
|
845
|
+
}, price);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
// 单规格
|
|
849
|
+
if (other !== null && other !== void 0 && other.option) {
|
|
850
|
+
price = other === null || other === void 0 ? void 0 : other.option.reduce(function (accumulator, currentValue) {
|
|
851
|
+
var currentPrice = new Decimal(currentValue.price || 0);
|
|
852
|
+
var currentNum = new Decimal(currentValue.num || 0);
|
|
853
|
+
return accumulator.add(currentPrice.mul(currentNum));
|
|
854
|
+
}, price);
|
|
855
|
+
}
|
|
856
|
+
return price.toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
857
|
+
};
|
|
858
|
+
|
|
823
859
|
/**
|
|
824
860
|
* @title: 判断 duration
|
|
825
861
|
* @description: 用于处理不同格式的duration
|
|
@@ -9,7 +9,7 @@ import { PosProps } from './const';
|
|
|
9
9
|
*/
|
|
10
10
|
declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
|
|
11
11
|
className?: string | undefined;
|
|
12
|
-
onChange?: ((status: "
|
|
12
|
+
onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
|
|
13
13
|
[keys: string]: unknown;
|
|
14
14
|
} | undefined, other?: any) => void) | undefined;
|
|
15
15
|
onClose: () => void;
|
|
@@ -11,7 +11,7 @@ import './device.less';
|
|
|
11
11
|
declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, containerStyle, }: {
|
|
12
12
|
api: PayProps['api'];
|
|
13
13
|
className?: string | undefined;
|
|
14
|
-
onChange?: ((status: "
|
|
14
|
+
onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
|
|
15
15
|
[keys: string]: unknown;
|
|
16
16
|
} | undefined, other?: any) => void) | undefined;
|
|
17
17
|
onClose: () => void;
|
|
@@ -15,11 +15,11 @@ export declare const useStoreRef: <T extends {
|
|
|
15
15
|
readonly numRef: React.MutableRefObject<string | number | undefined>;
|
|
16
16
|
readonly orderIdRef: React.MutableRefObject<string | number>;
|
|
17
17
|
readonly modeRef: React.MutableRefObject<ModeEnum>;
|
|
18
|
-
readonly statusRef: React.MutableRefObject<"
|
|
18
|
+
readonly statusRef: React.MutableRefObject<"loading" | "success" | "warn" | "init" | "fail" | "pedding" | "resove" | "reject" | "question">;
|
|
19
19
|
readonly netRef: React.MutableRefObject<boolean | undefined>;
|
|
20
20
|
readonly symbolRef: React.MutableRefObject<string>;
|
|
21
21
|
readonly amountRef: React.MutableRefObject<string | number>;
|
|
22
|
-
readonly eftposRef: React.MutableRefObject<"
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
24
|
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
25
25
|
};
|
|
@@ -178,7 +178,7 @@ export declare const updateCustom: (payload: {
|
|
|
178
178
|
export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
|
|
179
179
|
type: EActionTypes;
|
|
180
180
|
payload: {
|
|
181
|
-
status: "
|
|
181
|
+
status: "loading" | "success" | "warn" | "fail" | "question";
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
184
|
/**
|
|
@@ -299,10 +299,10 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
299
299
|
name?: string | undefined;
|
|
300
300
|
symbol?: string | undefined;
|
|
301
301
|
amount?: string | number | undefined;
|
|
302
|
-
mode?: "
|
|
302
|
+
mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
|
|
303
303
|
order_id?: string | number | undefined;
|
|
304
|
-
eftpos?: "
|
|
305
|
-
action?: "
|
|
304
|
+
eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu" | undefined;
|
|
305
|
+
action?: "pay" | "amount" | "deviceList" | undefined;
|
|
306
306
|
key?: number | undefined;
|
|
307
307
|
step?: number | undefined;
|
|
308
308
|
title?: string | undefined;
|
|
@@ -312,7 +312,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
312
312
|
net?: boolean | undefined;
|
|
313
313
|
component?: string | undefined;
|
|
314
314
|
form?: string | undefined;
|
|
315
|
-
status?: "
|
|
315
|
+
status?: "loading" | "success" | "warn" | "init" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
|
|
316
316
|
warn?: string | undefined;
|
|
317
317
|
steps?: {
|
|
318
318
|
/** 用于重置当前步骤 */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface FormState {
|
|
2
3
|
platform: 'pc' | 'h5' | '' | undefined;
|
|
3
4
|
order: any;
|
|
@@ -29,4 +30,11 @@ export interface PayGroup {
|
|
|
29
30
|
_order: any;
|
|
30
31
|
front_order_uuid?: string;
|
|
31
32
|
}
|
|
32
|
-
export declare const Provider: any, Context:
|
|
33
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
34
|
+
state: FormState;
|
|
35
|
+
} & {
|
|
36
|
+
dispatch: (params: {
|
|
37
|
+
type: string;
|
|
38
|
+
payload: any;
|
|
39
|
+
}) => void;
|
|
40
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
2
3
|
import dayjs from "dayjs";
|
|
3
4
|
export interface FormState {
|
|
@@ -68,4 +69,11 @@ export interface FormState {
|
|
|
68
69
|
};
|
|
69
70
|
setGlobalState: Function | null;
|
|
70
71
|
}
|
|
71
|
-
export declare const Provider: any, Context:
|
|
72
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
73
|
+
state: FormState;
|
|
74
|
+
} & {
|
|
75
|
+
dispatch: (params: {
|
|
76
|
+
type: string;
|
|
77
|
+
payload: any;
|
|
78
|
+
}) => void;
|
|
79
|
+
}>;
|
|
@@ -47,7 +47,7 @@ declare type ScanData = {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export declare const formatScanCustomer: (data: ScanData) => {
|
|
50
|
-
searchType: "
|
|
50
|
+
searchType: "product" | "customer" | "wallet" | "walletPass" | "local_product";
|
|
51
51
|
data: any;
|
|
52
52
|
scanCode: string;
|
|
53
53
|
} | null;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Capacity: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
6
6
|
export default Capacity;
|
|
@@ -3,5 +3,5 @@ import { SkuStatusOverlayConfig } from '../../type';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const CardMask: ({ props }: {
|
|
5
5
|
props: SkuStatusOverlayConfig;
|
|
6
|
-
}) => string | number | true |
|
|
6
|
+
}) => string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
7
7
|
export default CardMask;
|
|
@@ -3,5 +3,5 @@ import { ProductCardConfig } from '../../type';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const Countdown: ({ props }: {
|
|
5
5
|
props: ProductCardConfig;
|
|
6
|
-
}) => string | number | true |
|
|
6
|
+
}) => string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
7
7
|
export default Countdown;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Duration: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
6
6
|
export default Duration;
|
|
@@ -3,5 +3,5 @@ import { ProductCardConfig } from '../../type';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const MemberPrice: ({ props }: {
|
|
5
5
|
props: ProductCardConfig;
|
|
6
|
-
}) => string | number | true |
|
|
6
|
+
}) => string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
7
7
|
export default MemberPrice;
|