@pisell/private-materials 6.6.68 → 6.6.70
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/components/footer/amount.js +3 -4
- package/es/components/booking/components/footer/utils.js +3 -10
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/info2/service/editService/index.js +19 -47
- package/es/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/es/components/booking/info2/service/editService/utils.js +0 -16
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +5 -12
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/info2/service/editService/index.js +16 -37
- package/lib/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/lib/components/booking/info2/service/editService/utils.js +0 -16
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/package.json +3 -3
|
@@ -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 {
|
|
@@ -108,7 +108,6 @@ export var formatProductBundle = function formatProductBundle(bundle) {
|
|
|
108
108
|
}
|
|
109
109
|
} catch (error) {}
|
|
110
110
|
return bundle.map(function (d) {
|
|
111
|
-
var _d$metadata;
|
|
112
111
|
var option = formatProductOption(d.option);
|
|
113
112
|
var option_price = option.reduce(function (temp, item) {
|
|
114
113
|
return temp + Number(item.num) * item.custom_add_price;
|
|
@@ -136,7 +135,7 @@ export var formatProductBundle = function formatProductBundle(bundle) {
|
|
|
136
135
|
"bundle_selling_price": Math.abs(d === null || d === void 0 ? void 0 : d.price),
|
|
137
136
|
// "bundle_sum_price": d?.original_price || d?.original_total,
|
|
138
137
|
"metadata": {
|
|
139
|
-
custom_product_bundle_map_id:
|
|
138
|
+
custom_product_bundle_map_id: d._id,
|
|
140
139
|
// 子商品单数量附加费
|
|
141
140
|
"surcharge_fee": d.surcharge_fee,
|
|
142
141
|
// 可选,附加费均摊舍入金额
|
|
@@ -482,7 +481,7 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
|
|
|
482
481
|
* @Author: WangHan
|
|
483
482
|
* @Date: 2024-12-07 14:21
|
|
484
483
|
*/
|
|
485
|
-
var formatProducts = function formatProducts(item, quantity
|
|
484
|
+
var formatProducts = function formatProducts(item, quantity) {
|
|
486
485
|
var _item$_extend39, _getMainProductSellin, _item$_extend40, _item$_extend41, _item$_extend42, _item$_extend43;
|
|
487
486
|
var total = Number(item._extend.total);
|
|
488
487
|
var origin_total = Number(item._extend.origin_total);
|
|
@@ -497,9 +496,6 @@ var formatProducts = function formatProducts(item, quantity, options) {
|
|
|
497
496
|
d.metadata = _objectSpread(_objectSpread({}, d.metadata), {}, {
|
|
498
497
|
unique_identification_number: "".concat(item._extend.unique_identification_number, "_").concat(d.discount.resource_id)
|
|
499
498
|
});
|
|
500
|
-
if (options !== null && options !== void 0 && options.isServiceEdit && options !== null && options !== void 0 && options.isMultiDay) {
|
|
501
|
-
delete d.id;
|
|
502
|
-
}
|
|
503
499
|
});
|
|
504
500
|
|
|
505
501
|
// 非手动折扣
|
|
@@ -722,10 +718,7 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
722
718
|
item._extend.unique_identification_number = unique_identification_number;
|
|
723
719
|
}
|
|
724
720
|
var booking = _objectSpread(_objectSpread({
|
|
725
|
-
product: formatProducts(item,
|
|
726
|
-
isServiceEdit: data.service.edit,
|
|
727
|
-
isMultiDay: isMultiDay
|
|
728
|
-
}),
|
|
721
|
+
product: formatProducts(item),
|
|
729
722
|
relation_products: formatRelationDetails(item._extend.relation_details),
|
|
730
723
|
id: item.booking_id || 0,
|
|
731
724
|
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,
|
|
@@ -19,7 +19,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
19
19
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
21
|
import Delete_wght300_24px from '@pisell/icon/es/Delete_wght300_24px';
|
|
22
|
-
import { formatAmount, getUniqueId, locales
|
|
22
|
+
import { formatAmount, getUniqueId, locales } from '@pisell/utils';
|
|
23
23
|
import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
24
24
|
import Drawer from "../../../components/drawer";
|
|
25
25
|
import { Context } from "../../../info/model";
|
|
@@ -41,7 +41,7 @@ import { editSessionProduct } from "../../../info/utils";
|
|
|
41
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";
|
|
@@ -51,7 +51,6 @@ import { createBookingItemsByGroup, getGroupTotalPrice } from "../../../info/ser
|
|
|
51
51
|
import { useShopDiscountModule } from "../../../../ticketBooking/hooks/pisellos/useShopDiscountModule";
|
|
52
52
|
import DiscountChangeModal from "./DiscountChangeModal";
|
|
53
53
|
import Decimal from "decimal.js";
|
|
54
|
-
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
55
54
|
var submitLock = false;
|
|
56
55
|
var Info = function Info(_, ref) {
|
|
57
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;
|
|
@@ -72,7 +71,6 @@ var Info = function Info(_, ref) {
|
|
|
72
71
|
_useState2 = _slicedToArray(_useState, 2),
|
|
73
72
|
discountChangeModalOpen = _useState2[0],
|
|
74
73
|
setDiscountChangeModalOpen = _useState2[1];
|
|
75
|
-
var context = useEngineContext();
|
|
76
74
|
var _useContext = useContext(Context),
|
|
77
75
|
state = _useContext.state,
|
|
78
76
|
dispatch = _useContext.dispatch;
|
|
@@ -665,19 +663,13 @@ var Info = function Info(_, ref) {
|
|
|
665
663
|
var values = form.getFieldsValue();
|
|
666
664
|
var isSession = isSessionProduct(item);
|
|
667
665
|
var sessionValue = {};
|
|
668
|
-
var oldSession = {};
|
|
669
666
|
if (isSession) {
|
|
670
|
-
var _item$_extend7, _item$_extend8, _item$_extend9
|
|
667
|
+
var _item$_extend7, _item$_extend8, _item$_extend9;
|
|
671
668
|
sessionValue.startEndTime = {
|
|
672
669
|
startDate: item === null || item === void 0 || (_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.start_date,
|
|
673
670
|
endDate: item === null || item === void 0 || (_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.end_date,
|
|
674
671
|
duration: item === null || item === void 0 || (_item$_extend9 = item._extend) === null || _item$_extend9 === void 0 ? void 0 : _item$_extend9.duration
|
|
675
672
|
};
|
|
676
|
-
oldSession = {
|
|
677
|
-
start_date: dayjs(item === null || item === void 0 || (_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.start_date).format('YYYY-MM-DD'),
|
|
678
|
-
end_date: dayjs(item === null || item === void 0 || (_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.end_date).format('YYYY-MM-DD'),
|
|
679
|
-
duration: item === null || item === void 0 || (_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.duration
|
|
680
|
-
};
|
|
681
673
|
}
|
|
682
674
|
|
|
683
675
|
// 打开商品详情弹窗
|
|
@@ -695,9 +687,7 @@ var Info = function Info(_, ref) {
|
|
|
695
687
|
},
|
|
696
688
|
isOS: isSession,
|
|
697
689
|
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,
|
|
698
|
-
value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), {}, {
|
|
699
|
-
bundle: mergeBundles(item._extend.other)
|
|
700
|
-
}, sessionValue), {}, {
|
|
690
|
+
value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), sessionValue), {}, {
|
|
701
691
|
quantity: values.quantity || item._extend.quantity
|
|
702
692
|
})
|
|
703
693
|
},
|
|
@@ -710,8 +700,8 @@ var Info = function Info(_, ref) {
|
|
|
710
700
|
|
|
711
701
|
// 手动折扣时 合并 bundle price,优先使用编辑前的价格
|
|
712
702
|
if (item.discount_amount) {
|
|
713
|
-
var _item$
|
|
714
|
-
other = mergeBundleWithOriginalPrice(other, ((_item$
|
|
703
|
+
var _item$_extend10;
|
|
704
|
+
other = mergeBundleWithOriginalPrice(other, ((_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.other) || {});
|
|
715
705
|
}
|
|
716
706
|
other.session = e.session;
|
|
717
707
|
|
|
@@ -746,37 +736,6 @@ var Info = function Info(_, ref) {
|
|
|
746
736
|
});
|
|
747
737
|
} catch (err) {}
|
|
748
738
|
var sessionDetail = editSessionProduct(cacheItem, e.session);
|
|
749
|
-
try {
|
|
750
|
-
var _e$session, _e$session2, _e$session3, _e$session4, _e$session5, _context$appHelper, _context$appHelper$ge;
|
|
751
|
-
sendWarningLog({
|
|
752
|
-
title: '修改商品数据',
|
|
753
|
-
content: [{
|
|
754
|
-
key: 'productId',
|
|
755
|
-
value: item.id
|
|
756
|
-
}, {
|
|
757
|
-
key: "isSession",
|
|
758
|
-
value: isSession
|
|
759
|
-
}, {
|
|
760
|
-
key: 'oldSession',
|
|
761
|
-
value: JSON.stringify(oldSession)
|
|
762
|
-
}, {
|
|
763
|
-
key: 'sessionValue',
|
|
764
|
-
value: JSON.stringify({
|
|
765
|
-
startTime: (_e$session = e.session) === null || _e$session === void 0 ? void 0 : _e$session.start_time,
|
|
766
|
-
endTime: (_e$session2 = e.session) === null || _e$session2 === void 0 ? void 0 : _e$session2.end_time,
|
|
767
|
-
startDate: dayjs((_e$session3 = e.session) === null || _e$session3 === void 0 ? void 0 : _e$session3.start_at).format('YYYY-MM-DD'),
|
|
768
|
-
endDate: dayjs((_e$session4 = e.session) === null || _e$session4 === void 0 ? void 0 : _e$session4.end_at).format('YYYY-MM-DD'),
|
|
769
|
-
duration: (_e$session5 = e.session) === null || _e$session5 === void 0 ? void 0 : _e$session5.duration
|
|
770
|
-
})
|
|
771
|
-
}, {
|
|
772
|
-
key: '日期',
|
|
773
|
-
value: dayjs().format('YYYY-MM-DD HH:mm')
|
|
774
|
-
}, {
|
|
775
|
-
key: '店铺id',
|
|
776
|
-
value: (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.store) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getState) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.call(_context$appHelper)) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.global) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.globalConfig) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.id
|
|
777
|
-
}]
|
|
778
|
-
});
|
|
779
|
-
} catch (err) {}
|
|
780
739
|
if (sessionDetail) {
|
|
781
740
|
setTimeout(function () {
|
|
782
741
|
form.setFieldsValue({
|
|
@@ -787,7 +746,20 @@ var Info = function Info(_, ref) {
|
|
|
787
746
|
}
|
|
788
747
|
var origin_total = _total;
|
|
789
748
|
if (item.discount_amount) {
|
|
749
|
+
var _item$_extend11, _item$_extend12;
|
|
790
750
|
origin_total = getProductOriginTotalPrice(cacheItem);
|
|
751
|
+
var previousOriginTotal = Number((item === null || item === void 0 || (_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.origin_total) || 0);
|
|
752
|
+
var previousTotal = Number((item === null || item === void 0 || (_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.total) || 0);
|
|
753
|
+
var productAllDiscountList = getProductAllDiscountList(item);
|
|
754
|
+
var hasNonManualDiscount = productAllDiscountList.some(function (discountItem) {
|
|
755
|
+
return (discountItem === null || discountItem === void 0 ? void 0 : discountItem.type) !== 'product';
|
|
756
|
+
});
|
|
757
|
+
if (previousOriginTotal > 0 && Number.isFinite(previousOriginTotal) && Number.isFinite(previousTotal) && !hasNonManualDiscount) {
|
|
758
|
+
// 手动折扣编辑套餐时只延续旧折后比例,不改子商品单价,避免后续重复折扣。
|
|
759
|
+
var sellingRatio = new Decimal(previousTotal).div(previousOriginTotal);
|
|
760
|
+
_total = new Decimal(origin_total).mul(sellingRatio).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
761
|
+
cacheItem._extend.total = _total;
|
|
762
|
+
}
|
|
791
763
|
}
|
|
792
764
|
|
|
793
765
|
// 用于储存原价
|
|
@@ -32,7 +32,6 @@ export declare const setProductPrice: (cacheItem: any, { newTotal, origin_total
|
|
|
32
32
|
* @returns 折扣列表
|
|
33
33
|
*/
|
|
34
34
|
export declare const getProductAllDiscountList: (cacheItem: any) => any;
|
|
35
|
-
export declare const mergeBundles: (other: any) => any[];
|
|
36
35
|
/**
|
|
37
36
|
* 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
|
|
38
37
|
* @param other - callback 返回的新数据
|
|
@@ -149,22 +149,6 @@ export var getProductAllDiscountList = function getProductAllDiscountList(cacheI
|
|
|
149
149
|
(_discountList = discountList).push.apply(_discountList, _toConsumableArray(bundleDiscountList));
|
|
150
150
|
return discountList;
|
|
151
151
|
};
|
|
152
|
-
export var mergeBundles = function mergeBundles(other) {
|
|
153
|
-
var bundle = (other === null || other === void 0 ? void 0 : other.bundle) || [];
|
|
154
|
-
var newBundle = [];
|
|
155
|
-
bundle.forEach(function (item) {
|
|
156
|
-
var newItem = newBundle.find(function (newItem) {
|
|
157
|
-
return newItem.id === item.id;
|
|
158
|
-
});
|
|
159
|
-
if (newItem) {
|
|
160
|
-
newItem.num += item.num || 1;
|
|
161
|
-
newItem.quantity += item.quantity || 1;
|
|
162
|
-
} else {
|
|
163
|
-
newBundle.push(_objectSpread({}, item));
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
return newBundle;
|
|
167
|
-
};
|
|
168
152
|
|
|
169
153
|
/**
|
|
170
154
|
* 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
|
|
@@ -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
|
}
|
|
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
|
|
|
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<"stripe" | "tyro" | "
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "mx51" | "payo" | "windcave" | "linkly" | "huifu">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
24
|
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
25
25
|
};
|
|
@@ -299,8 +299,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
299
299
|
amount?: string | number | undefined;
|
|
300
300
|
mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
|
|
301
301
|
order_id?: string | number | undefined;
|
|
302
|
-
eftpos?: "stripe" | "tyro" | "
|
|
303
|
-
action?: "
|
|
302
|
+
eftpos?: "stripe" | "tyro" | "mx51" | "payo" | "windcave" | "linkly" | "huifu" | undefined;
|
|
303
|
+
action?: "pay" | "amount" | "deviceList" | undefined;
|
|
304
304
|
key?: number | undefined;
|
|
305
305
|
step?: number | undefined;
|
|
306
306
|
title?: string | undefined;
|
|
@@ -323,7 +323,7 @@ var processItemsTax = (items, state, options) => {
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
return { originTax: expectedOriginTax, tax: expectedTax
|
|
326
|
+
return { originTax: expectedOriginTax, tax: expectedTax };
|
|
327
327
|
};
|
|
328
328
|
var clearTaxFee = (state) => {
|
|
329
329
|
var _a, _b;
|
|
@@ -376,7 +376,7 @@ var getTax = (state, options) => {
|
|
|
376
376
|
computed
|
|
377
377
|
});
|
|
378
378
|
totalOriginTax = totalOriginTax.plus(serviceResult.originTax);
|
|
379
|
-
totalTax = totalTax.plus(serviceResult.
|
|
379
|
+
totalTax = totalTax.plus(serviceResult.tax);
|
|
380
380
|
}
|
|
381
381
|
if ((_c = state == null ? void 0 : state.addons) == null ? void 0 : _c.value) {
|
|
382
382
|
const addonsResult = processItemsTax(state.addons.value, state, {
|
|
@@ -385,7 +385,7 @@ var getTax = (state, options) => {
|
|
|
385
385
|
computed
|
|
386
386
|
});
|
|
387
387
|
totalOriginTax = totalOriginTax.plus(addonsResult.originTax);
|
|
388
|
-
totalTax = totalTax.plus(addonsResult.
|
|
388
|
+
totalTax = totalTax.plus(addonsResult.tax);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
return {
|
|
@@ -111,14 +111,13 @@ var formatProductBundle = (bundle) => {
|
|
|
111
111
|
} catch (error) {
|
|
112
112
|
}
|
|
113
113
|
return bundle.map((d) => {
|
|
114
|
-
var _a;
|
|
115
114
|
const option = formatProductOption(d.option);
|
|
116
115
|
const option_price = option.reduce((temp, item) => {
|
|
117
116
|
return temp + Number(item.num) * item.custom_add_price;
|
|
118
117
|
}, 0);
|
|
119
118
|
const product_discount_difference = ((d == null ? void 0 : d.discount_list) || []).reduce((pre, cur) => {
|
|
120
|
-
var
|
|
121
|
-
return pre + (((
|
|
119
|
+
var _a;
|
|
120
|
+
return pre + (((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0);
|
|
122
121
|
}, 0);
|
|
123
122
|
return {
|
|
124
123
|
"is_charge_tax": d.is_charge_tax,
|
|
@@ -139,7 +138,7 @@ var formatProductBundle = (bundle) => {
|
|
|
139
138
|
"bundle_selling_price": Math.abs(d == null ? void 0 : d.price),
|
|
140
139
|
// "bundle_sum_price": d?.original_price || d?.original_total,
|
|
141
140
|
"metadata": {
|
|
142
|
-
custom_product_bundle_map_id:
|
|
141
|
+
custom_product_bundle_map_id: d._id,
|
|
143
142
|
// 子商品单数量附加费
|
|
144
143
|
"surcharge_fee": d.surcharge_fee,
|
|
145
144
|
// 可选,附加费均摊舍入金额
|
|
@@ -374,7 +373,7 @@ var getMainProductSellingPrice = (item) => {
|
|
|
374
373
|
}
|
|
375
374
|
return new import_decimal.default((_f = item._extend) == null ? void 0 : _f.main_product_selling_price).add(optionPrice).toNumber();
|
|
376
375
|
};
|
|
377
|
-
var formatProducts = (item, quantity
|
|
376
|
+
var formatProducts = (item, quantity) => {
|
|
378
377
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
379
378
|
const total = Number(item._extend.total);
|
|
380
379
|
const origin_total = Number(item._extend.origin_total);
|
|
@@ -388,9 +387,6 @@ var formatProducts = (item, quantity, options) => {
|
|
|
388
387
|
...d.metadata,
|
|
389
388
|
unique_identification_number: `${item._extend.unique_identification_number}_${d.discount.resource_id}`
|
|
390
389
|
};
|
|
391
|
-
if ((options == null ? void 0 : options.isServiceEdit) && (options == null ? void 0 : options.isMultiDay)) {
|
|
392
|
-
delete d.id;
|
|
393
|
-
}
|
|
394
390
|
});
|
|
395
391
|
const notManualDiscount = discount_list.filter(
|
|
396
392
|
(item2) => item2.type !== "product"
|
|
@@ -531,10 +527,7 @@ var formatBookings = (data, values) => {
|
|
|
531
527
|
item._extend.unique_identification_number = unique_identification_number;
|
|
532
528
|
}
|
|
533
529
|
const booking = {
|
|
534
|
-
product: formatProducts(item,
|
|
535
|
-
isServiceEdit: data.service.edit,
|
|
536
|
-
isMultiDay
|
|
537
|
-
}),
|
|
530
|
+
product: formatProducts(item),
|
|
538
531
|
relation_products: formatRelationDetails(item._extend.relation_details),
|
|
539
532
|
id: item.booking_id || 0,
|
|
540
533
|
relation_id: item._extend.relation_id || 0,
|
|
@@ -111,7 +111,7 @@ var VoucherCard = (props) => {
|
|
|
111
111
|
const val = (_a2 = state.service.value || []) == null ? void 0 : _a2.map((value) => {
|
|
112
112
|
var _a3, _b2, _c2;
|
|
113
113
|
return {
|
|
114
|
-
|
|
114
|
+
booking_id: value.booking_id,
|
|
115
115
|
id: value.id,
|
|
116
116
|
price: value.price,
|
|
117
117
|
total: (_a3 = value == null ? void 0 : value._extend) == null ? void 0 : _a3.total,
|
|
@@ -64,7 +64,6 @@ var import_utils9 = require("../../../info/service2/Group/utils");
|
|
|
64
64
|
var import_useShopDiscountModule = require("../../../../ticketBooking/hooks/pisellos/useShopDiscountModule");
|
|
65
65
|
var import_DiscountChangeModal = __toESM(require("./DiscountChangeModal"));
|
|
66
66
|
var import_decimal = __toESM(require("decimal.js"));
|
|
67
|
-
var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
|
|
68
67
|
var submitLock = false;
|
|
69
68
|
var Info = (_, ref) => {
|
|
70
69
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K;
|
|
@@ -80,7 +79,6 @@ var Info = (_, ref) => {
|
|
|
80
79
|
const useEndDate = import_antd.Form.useWatch("end_date", form);
|
|
81
80
|
const shopDiscount = (0, import_useShopDiscountModule.useShopDiscountModule)();
|
|
82
81
|
const [discountChangeModalOpen, setDiscountChangeModalOpen] = (0, import_react.useState)(false);
|
|
83
|
-
const context = (0, import_useEngineContext.default)();
|
|
84
82
|
const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
|
|
85
83
|
const resourcesRef = (0, import_react.useRef)(null);
|
|
86
84
|
const isChangeTotal = (0, import_react.useRef)(false);
|
|
@@ -502,23 +500,17 @@ var Info = (_, ref) => {
|
|
|
502
500
|
return ((_d2 = (_c2 = (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._extend) == null ? void 0 : _c2.other) == null ? void 0 : _d2.bundle) || [];
|
|
503
501
|
}, [(_o = (_n = (_m = (_l = state.service) == null ? void 0 : _l.cacheItem) == null ? void 0 : _m._extend) == null ? void 0 : _n.other) == null ? void 0 : _o.bundle]);
|
|
504
502
|
const handleEdit = (0, import_ahooks.useMemoizedFn)((e) => {
|
|
505
|
-
var _a2, _b2, _c2, _d2, _e2
|
|
503
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
506
504
|
const item = state.service.cacheItem;
|
|
507
505
|
let values = form.getFieldsValue();
|
|
508
506
|
const isSession = (0, import_utils6.isSessionProduct)(item);
|
|
509
507
|
const sessionValue = {};
|
|
510
|
-
let oldSession = {};
|
|
511
508
|
if (isSession) {
|
|
512
509
|
sessionValue.startEndTime = {
|
|
513
510
|
startDate: (_a2 = item == null ? void 0 : item._extend) == null ? void 0 : _a2.start_date,
|
|
514
511
|
endDate: (_b2 = item == null ? void 0 : item._extend) == null ? void 0 : _b2.end_date,
|
|
515
512
|
duration: (_c2 = item == null ? void 0 : item._extend) == null ? void 0 : _c2.duration
|
|
516
513
|
};
|
|
517
|
-
oldSession = {
|
|
518
|
-
start_date: (0, import_dayjs.default)((_d2 = item == null ? void 0 : item._extend) == null ? void 0 : _d2.start_date).format("YYYY-MM-DD"),
|
|
519
|
-
end_date: (0, import_dayjs.default)((_e2 = item == null ? void 0 : item._extend) == null ? void 0 : _e2.end_date).format("YYYY-MM-DD"),
|
|
520
|
-
duration: (_f2 = item == null ? void 0 : item._extend) == null ? void 0 : _f2.duration
|
|
521
|
-
};
|
|
522
514
|
}
|
|
523
515
|
state.action({
|
|
524
516
|
type: "pisell1.handleOpenProductModal",
|
|
@@ -533,16 +525,15 @@ var Info = (_, ref) => {
|
|
|
533
525
|
number: (0, import_utils3.getIsShowNumber)(item, state)
|
|
534
526
|
},
|
|
535
527
|
isOS: isSession,
|
|
536
|
-
customer_id: (
|
|
528
|
+
customer_id: (_e2 = (_d2 = state.client) == null ? void 0 : _d2.value) == null ? void 0 : _e2.id,
|
|
537
529
|
value: {
|
|
538
530
|
...item._extend.other,
|
|
539
|
-
bundle: (0, import_utils8.mergeBundles)(item._extend.other),
|
|
540
531
|
...sessionValue,
|
|
541
532
|
quantity: values.quantity || item._extend.quantity
|
|
542
533
|
}
|
|
543
534
|
},
|
|
544
535
|
callback: (e2, extension_type, detail) => {
|
|
545
|
-
var _a3, _b3, _c3, _d3, _e3,
|
|
536
|
+
var _a3, _b3, _c3, _d3, _e3, _f2, _g2;
|
|
546
537
|
isEditedRef.current = true;
|
|
547
538
|
const _detail = detail || item;
|
|
548
539
|
let other = JSON.parse(JSON.stringify(e2));
|
|
@@ -579,29 +570,6 @@ var Info = (_, ref) => {
|
|
|
579
570
|
} catch (err) {
|
|
580
571
|
}
|
|
581
572
|
const sessionDetail = (0, import_utils5.editSessionProduct)(cacheItem, e2.session);
|
|
582
|
-
try {
|
|
583
|
-
(0, import_utils.sendWarningLog)({
|
|
584
|
-
title: "修改商品数据",
|
|
585
|
-
content: [
|
|
586
|
-
{ key: "productId", value: item.id },
|
|
587
|
-
{ key: "isSession", value: isSession },
|
|
588
|
-
{ key: "oldSession", value: JSON.stringify(oldSession) },
|
|
589
|
-
{ key: "sessionValue", value: JSON.stringify({
|
|
590
|
-
startTime: (_d3 = e2.session) == null ? void 0 : _d3.start_time,
|
|
591
|
-
endTime: (_e3 = e2.session) == null ? void 0 : _e3.end_time,
|
|
592
|
-
startDate: (0, import_dayjs.default)((_f3 = e2.session) == null ? void 0 : _f3.start_at).format("YYYY-MM-DD"),
|
|
593
|
-
endDate: (0, import_dayjs.default)((_g3 = e2.session) == null ? void 0 : _g3.end_at).format("YYYY-MM-DD"),
|
|
594
|
-
duration: (_h3 = e2.session) == null ? void 0 : _h3.duration
|
|
595
|
-
}) },
|
|
596
|
-
{ key: "日期", value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm") },
|
|
597
|
-
{
|
|
598
|
-
key: "店铺id",
|
|
599
|
-
value: (_o2 = (_n2 = (_m2 = (_l2 = (_k2 = (_j2 = (_i2 = context.appHelper) == null ? void 0 : _i2.utils) == null ? void 0 : _j2.store) == null ? void 0 : _k2.getState) == null ? void 0 : _l2.call(_k2)) == null ? void 0 : _m2.global) == null ? void 0 : _n2.globalConfig) == null ? void 0 : _o2.id
|
|
600
|
-
}
|
|
601
|
-
]
|
|
602
|
-
});
|
|
603
|
-
} catch (err) {
|
|
604
|
-
}
|
|
605
573
|
if (sessionDetail) {
|
|
606
574
|
setTimeout(() => {
|
|
607
575
|
form.setFieldsValue({
|
|
@@ -613,9 +581,20 @@ var Info = (_, ref) => {
|
|
|
613
581
|
let origin_total = _total;
|
|
614
582
|
if (item.discount_amount) {
|
|
615
583
|
origin_total = (0, import_utils6.getProductOriginTotalPrice)(cacheItem);
|
|
584
|
+
const previousOriginTotal = Number(((_d3 = item == null ? void 0 : item._extend) == null ? void 0 : _d3.origin_total) || 0);
|
|
585
|
+
const previousTotal = Number(((_e3 = item == null ? void 0 : item._extend) == null ? void 0 : _e3.total) || 0);
|
|
586
|
+
const productAllDiscountList = (0, import_utils8.getProductAllDiscountList)(item);
|
|
587
|
+
const hasNonManualDiscount = productAllDiscountList.some(
|
|
588
|
+
(discountItem) => (discountItem == null ? void 0 : discountItem.type) !== "product"
|
|
589
|
+
);
|
|
590
|
+
if (previousOriginTotal > 0 && Number.isFinite(previousOriginTotal) && Number.isFinite(previousTotal) && !hasNonManualDiscount) {
|
|
591
|
+
const sellingRatio = new import_decimal.default(previousTotal).div(previousOriginTotal);
|
|
592
|
+
_total = new import_decimal.default(origin_total).mul(sellingRatio).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber();
|
|
593
|
+
cacheItem._extend.total = _total;
|
|
594
|
+
}
|
|
616
595
|
}
|
|
617
596
|
cacheItem._extend.origin_total = origin_total;
|
|
618
|
-
(((
|
|
597
|
+
(((_f2 = cacheItem._extend) == null ? void 0 : _f2.items) || []).forEach((item2) => item2._extend.origin_total = origin_total);
|
|
619
598
|
dispatch({
|
|
620
599
|
type: "setService",
|
|
621
600
|
payload: {
|
|
@@ -624,7 +603,7 @@ var Info = (_, ref) => {
|
|
|
624
603
|
});
|
|
625
604
|
form.setFieldsValue({
|
|
626
605
|
total: _total,
|
|
627
|
-
capacity: (
|
|
606
|
+
capacity: (_g2 = cacheItem._extend) == null ? void 0 : _g2.capacity,
|
|
628
607
|
quantity: (e2 == null ? void 0 : e2.quantity) || (values == null ? void 0 : values.quantity) || 1
|
|
629
608
|
});
|
|
630
609
|
}
|
|
@@ -32,7 +32,6 @@ export declare const setProductPrice: (cacheItem: any, { newTotal, origin_total
|
|
|
32
32
|
* @returns 折扣列表
|
|
33
33
|
*/
|
|
34
34
|
export declare const getProductAllDiscountList: (cacheItem: any) => any;
|
|
35
|
-
export declare const mergeBundles: (other: any) => any[];
|
|
36
35
|
/**
|
|
37
36
|
* 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
|
|
38
37
|
* @param other - callback 返回的新数据
|
|
@@ -32,7 +32,6 @@ __export(utils_exports, {
|
|
|
32
32
|
getAutoAllocationStorage: () => getAutoAllocationStorage,
|
|
33
33
|
getProductAllDiscountList: () => getProductAllDiscountList,
|
|
34
34
|
mergeBundleWithOriginalPrice: () => mergeBundleWithOriginalPrice,
|
|
35
|
-
mergeBundles: () => mergeBundles,
|
|
36
35
|
setAutoAllocationStorage: () => setAutoAllocationStorage,
|
|
37
36
|
setProductPrice: () => setProductPrice
|
|
38
37
|
});
|
|
@@ -97,20 +96,6 @@ var getProductAllDiscountList = (cacheItem) => {
|
|
|
97
96
|
discountList.push(...bundleDiscountList);
|
|
98
97
|
return discountList;
|
|
99
98
|
};
|
|
100
|
-
var mergeBundles = (other) => {
|
|
101
|
-
const bundle = (other == null ? void 0 : other.bundle) || [];
|
|
102
|
-
const newBundle = [];
|
|
103
|
-
bundle.forEach((item) => {
|
|
104
|
-
const newItem = newBundle.find((newItem2) => newItem2.id === item.id);
|
|
105
|
-
if (newItem) {
|
|
106
|
-
newItem.num += item.num || 1;
|
|
107
|
-
newItem.quantity += item.quantity || 1;
|
|
108
|
-
} else {
|
|
109
|
-
newBundle.push({ ...item });
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
return newBundle;
|
|
113
|
-
};
|
|
114
99
|
var mergeBundleWithOriginalPrice = (other, originalOther) => {
|
|
115
100
|
var _a, _b;
|
|
116
101
|
if (!((_a = other == null ? void 0 : other.bundle) == null ? void 0 : _a.length) || !((_b = originalOther == null ? void 0 : originalOther.bundle) == null ? void 0 : _b.length)) return other;
|
|
@@ -130,7 +115,6 @@ var mergeBundleWithOriginalPrice = (other, originalOther) => {
|
|
|
130
115
|
getAutoAllocationStorage,
|
|
131
116
|
getProductAllDiscountList,
|
|
132
117
|
mergeBundleWithOriginalPrice,
|
|
133
|
-
mergeBundles,
|
|
134
118
|
setAutoAllocationStorage,
|
|
135
119
|
setProductPrice
|
|
136
120
|
});
|
|
@@ -134,7 +134,7 @@ var Payments = (0, import_model.Provider)((props) => {
|
|
|
134
134
|
item.service_fee,
|
|
135
135
|
2,
|
|
136
136
|
(state == null ? void 0 : state.amountSymbol) || "$"
|
|
137
|
-
), ")") : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "payment-list-item-date" }, (0, import_dayjs.default)(item.payment_time
|
|
137
|
+
), ")") : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "payment-list-item-date" }, (0, import_dayjs.default)(item.payment_time).format(
|
|
138
138
|
"HH:mm YYYY/MM/DD"
|
|
139
139
|
), /* @__PURE__ */ import_react.default.createElement("span", { className: "payment-list-item-platform-type" }, item.platform && import_utils.locales.getText("pisell2.text.platform.type")(
|
|
140
140
|
item.platform
|
|
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
|
|
|
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<"stripe" | "tyro" | "
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "mx51" | "payo" | "windcave" | "linkly" | "huifu">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
24
|
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
25
25
|
};
|
|
@@ -299,8 +299,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
299
299
|
amount?: string | number | undefined;
|
|
300
300
|
mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
|
|
301
301
|
order_id?: string | number | undefined;
|
|
302
|
-
eftpos?: "stripe" | "tyro" | "
|
|
303
|
-
action?: "
|
|
302
|
+
eftpos?: "stripe" | "tyro" | "mx51" | "payo" | "windcave" | "linkly" | "huifu" | undefined;
|
|
303
|
+
action?: "pay" | "amount" | "deviceList" | undefined;
|
|
304
304
|
key?: number | undefined;
|
|
305
305
|
step?: number | undefined;
|
|
306
306
|
title?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.70",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"@use-gesture/react": "^10.3.1",
|
|
64
64
|
"@pisell/utils": "3.0.2",
|
|
65
65
|
"@pisell/materials": "6.6.17",
|
|
66
|
-
"@pisell/
|
|
67
|
-
"@pisell/
|
|
66
|
+
"@pisell/date-picker": "3.0.7",
|
|
67
|
+
"@pisell/icon": "0.0.11"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": "^18.0.0",
|