@pisell/private-materials 3.2.21 → 3.2.23
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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +13 -13
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +8 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/appointmentBooking/assets/guests.svg +1 -0
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +83 -104
- package/es/components/appointmentBooking/components/Cart/Item/Total.js +1 -0
- package/es/components/appointmentBooking/components/Cart/Item/index.js +36 -17
- package/es/components/appointmentBooking/components/Cart/Item/index.less +7 -4
- package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Content/index.js +11 -11
- package/es/components/appointmentBooking/components/Date/index.js +49 -32
- package/es/components/appointmentBooking/components/Date/index.less +5 -0
- package/es/components/appointmentBooking/components/Guest/index.js +8 -21
- package/es/components/appointmentBooking/components/Header/index.js +44 -7
- package/es/components/appointmentBooking/components/Resource/index.d.ts +1 -1
- package/es/components/appointmentBooking/components/Resource/index.js +28 -20
- package/es/components/appointmentBooking/components/Resource/index.less +5 -0
- package/es/components/appointmentBooking/components/Services/index.js +20 -9
- package/es/components/appointmentBooking/components/TimeSlicing/index.js +47 -32
- package/es/components/appointmentBooking/components/TimeSlicing/index.less +4 -0
- package/es/components/appointmentBooking/components/Voucher/index.d.ts +4 -0
- package/es/components/appointmentBooking/components/Voucher/index.js +238 -0
- package/es/components/appointmentBooking/components/Voucher/index.less +26 -0
- package/es/components/appointmentBooking/context.d.ts +2 -0
- package/es/components/appointmentBooking/context.js +7 -1
- package/es/components/appointmentBooking/hooks.d.ts +46 -9
- package/es/components/appointmentBooking/hooks.js +162 -121
- package/es/components/appointmentBooking/index.js +12 -7
- package/es/components/appointmentBooking/locales.d.ts +57 -0
- package/es/components/appointmentBooking/locales.js +60 -3
- package/es/components/appointmentBooking/utils.d.ts +19 -0
- package/es/components/appointmentBooking/utils.js +71 -2
- package/es/components/booking/addons/index.js +1 -0
- package/es/components/booking/components/TabProduct/index.d.ts +1 -0
- package/es/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
- package/es/components/booking/components/footer/index.js +5 -1
- package/es/components/booking/components/footer/utils.js +18 -2
- package/es/components/booking/components/voucher/index.d.ts +3 -0
- package/es/components/booking/components/voucher/index.js +238 -0
- package/es/components/booking/components/voucher/index.less +88 -0
- package/es/components/booking/components/voucher/pisellGoodPassCard/index.d.ts +47 -0
- package/es/components/booking/components/voucher/pisellGoodPassCard/index.js +115 -0
- package/es/components/booking/components/voucher/pisellGoodPassCard/index.less +52 -0
- package/es/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
- package/es/components/booking/hooks/useIsBooking4Shop.js +10 -0
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
- package/es/components/booking/info/date/index.d.ts +1 -0
- package/es/components/booking/info/dateRange/index.d.ts +1 -0
- package/es/components/booking/info/notes/index.d.ts +1 -0
- package/es/components/booking/info/service/actions/index.d.ts +1 -0
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
- package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
- package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
- package/es/components/booking/info/service2/Lists.d.ts +1 -0
- package/es/components/booking/info/utils.js +1 -1
- package/es/components/booking/info2/service/actions/index.d.ts +1 -0
- package/es/components/booking/info2/service/editService/index.js +9 -0
- package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
- package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
- package/es/components/booking/locales.d.ts +18 -0
- package/es/components/booking/locales.js +21 -3
- package/es/components/booking/materiels/duration/index.d.ts +1 -0
- package/es/components/booking/materiels/holder/index.d.ts +1 -0
- package/es/components/booking/materiels/startTime/index.d.ts +1 -0
- package/es/components/booking/payments/index.js +1 -0
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftposPay/hooks.d.ts +2 -2
- package/es/components/eftposPay/store/index.d.ts +6 -6
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Information/index.d.ts +3 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Cart/Product.js +3 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useClearCart.js +4 -3
- package/es/components/shoppingCart/index.d.ts +1 -0
- package/es/components/shoppingCart/type.d.ts +1 -0
- package/es/components/wallet/Detail/index.js +20 -14
- package/es/components/wallet/Voucher/index.js +1 -0
- package/es/components/wallet/index.js +15 -1
- package/es/components/wallet/locales.d.ts +3 -0
- package/es/components/wallet/locales.js +3 -0
- package/es/components/wallet/model.d.ts +1 -1
- package/es/components/wallet/utils/formatUtils.js +1 -1
- package/es/components/walletList/index.js +5 -1
- package/lib/components/appointmentBooking/assets/guests.svg +1 -0
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +37 -27
- package/lib/components/appointmentBooking/components/Cart/Item/Total.js +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +24 -11
- package/lib/components/appointmentBooking/components/Cart/Item/index.less +7 -4
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Content/index.js +3 -5
- package/lib/components/appointmentBooking/components/Date/index.js +53 -47
- package/lib/components/appointmentBooking/components/Date/index.less +5 -0
- package/lib/components/appointmentBooking/components/Guest/index.js +6 -5
- package/lib/components/appointmentBooking/components/Header/index.js +25 -3
- package/lib/components/appointmentBooking/components/Resource/index.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Resource/index.js +16 -17
- package/lib/components/appointmentBooking/components/Resource/index.less +5 -0
- package/lib/components/appointmentBooking/components/Services/index.js +21 -2
- package/lib/components/appointmentBooking/components/TimeSlicing/index.js +23 -21
- package/lib/components/appointmentBooking/components/TimeSlicing/index.less +4 -0
- package/lib/components/appointmentBooking/components/Voucher/index.d.ts +4 -0
- package/lib/components/appointmentBooking/components/Voucher/index.js +221 -0
- package/lib/components/appointmentBooking/components/Voucher/index.less +26 -0
- package/lib/components/appointmentBooking/context.d.ts +2 -0
- package/lib/components/appointmentBooking/context.js +4 -1
- package/lib/components/appointmentBooking/hooks.d.ts +46 -9
- package/lib/components/appointmentBooking/hooks.js +36 -43
- package/lib/components/appointmentBooking/index.js +11 -7
- package/lib/components/appointmentBooking/locales.d.ts +57 -0
- package/lib/components/appointmentBooking/locales.js +60 -3
- package/lib/components/appointmentBooking/utils.d.ts +19 -0
- package/lib/components/appointmentBooking/utils.js +42 -2
- package/lib/components/booking/addons/index.js +1 -1
- package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
- package/lib/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
- package/lib/components/booking/components/footer/index.js +2 -1
- package/lib/components/booking/components/footer/utils.js +4 -1
- package/lib/components/booking/components/voucher/index.d.ts +3 -0
- package/lib/components/booking/components/voucher/index.js +222 -0
- package/lib/components/booking/components/voucher/index.less +88 -0
- package/lib/components/booking/components/voucher/pisellGoodPassCard/index.d.ts +47 -0
- package/lib/components/booking/components/voucher/pisellGoodPassCard/index.js +109 -0
- package/lib/components/booking/components/voucher/pisellGoodPassCard/index.less +52 -0
- package/lib/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
- package/lib/components/booking/hooks/useIsBooking4Shop.js +51 -0
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
- package/lib/components/booking/info/date/index.d.ts +1 -0
- package/lib/components/booking/info/dateRange/index.d.ts +1 -0
- package/lib/components/booking/info/notes/index.d.ts +1 -0
- package/lib/components/booking/info/service/actions/index.d.ts +1 -0
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
- package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
- package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
- package/lib/components/booking/info/service2/Lists.d.ts +1 -0
- package/lib/components/booking/info/utils.js +1 -1
- package/lib/components/booking/info2/service/actions/index.d.ts +1 -0
- package/lib/components/booking/info2/service/editService/index.js +8 -0
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
- package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
- package/lib/components/booking/locales.d.ts +18 -0
- package/lib/components/booking/locales.js +21 -3
- package/lib/components/booking/materiels/duration/index.d.ts +1 -0
- package/lib/components/booking/materiels/holder/index.d.ts +1 -0
- package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftposPay/hooks.d.ts +2 -2
- package/lib/components/eftposPay/store/index.d.ts +6 -6
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Information/index.d.ts +3 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Cart/Product.js +1 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useClearCart.js +3 -2
- package/lib/components/shoppingCart/index.d.ts +1 -0
- package/lib/components/shoppingCart/type.d.ts +1 -0
- package/lib/components/wallet/Detail/index.js +6 -1
- package/lib/components/wallet/Voucher/index.js +1 -0
- package/lib/components/wallet/index.js +15 -1
- package/lib/components/wallet/locales.d.ts +3 -0
- package/lib/components/wallet/locales.js +3 -0
- package/lib/components/wallet/model.d.ts +1 -1
- package/lib/components/wallet/utils/formatUtils.js +1 -1
- package/lib/components/walletList/index.js +6 -2
- package/package.json +3 -3
|
@@ -56,3 +56,22 @@ export declare const formatCarts: (data: any[], resources: any[]) => any[];
|
|
|
56
56
|
* @Date: 2025-04-14 11:16
|
|
57
57
|
*/
|
|
58
58
|
export declare const sortResources: (resources: any[], resourceSort: any[]) => any[] | undefined;
|
|
59
|
+
export declare const getMeAccount: (val: any[]) => any;
|
|
60
|
+
export declare const formatCustomer: (val: any) => {
|
|
61
|
+
id: any;
|
|
62
|
+
username: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const formatCurrentUser: () => {
|
|
65
|
+
id: any;
|
|
66
|
+
username: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @title: 检查是否有空的账户
|
|
70
|
+
* @description:
|
|
71
|
+
* @param {any} carts
|
|
72
|
+
* @param {any} accounts
|
|
73
|
+
* @return {*}
|
|
74
|
+
* @Author: WangHan
|
|
75
|
+
* @Date: 2025-04-15 17:05
|
|
76
|
+
*/
|
|
77
|
+
export declare const isEmptyGuest: (carts: any[], accounts: any[]) => boolean;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
9
|
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); }
|
|
7
10
|
import dayjs from 'dayjs';
|
|
11
|
+
import { getUniqueId } from "@pisell/utils";
|
|
8
12
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
9
13
|
|
|
10
14
|
/**
|
|
@@ -134,7 +138,6 @@ export var formatCarts = function formatCarts(data, resources) {
|
|
|
134
138
|
var utils = context.appHelper.utils || {};
|
|
135
139
|
var locale = (utils === null || utils === void 0 || (_utils$storage2 = utils.storage) === null || _utils$storage2 === void 0 ? void 0 : _utils$storage2.get('umi_locale')) || 'en-US';
|
|
136
140
|
var symbol = (utils === null || utils === void 0 ? void 0 : utils.getSymbolic()) || '$';
|
|
137
|
-
console.log(resources, data, 'wh987utils');
|
|
138
141
|
return data === null || data === void 0 ? void 0 : data.map(function (d) {
|
|
139
142
|
var _currentResource$reso, _currentResources;
|
|
140
143
|
var currentResource = resources.find(function (r) {
|
|
@@ -152,7 +155,9 @@ export var formatCarts = function formatCarts(data, resources) {
|
|
|
152
155
|
duration_type: d.duration.type,
|
|
153
156
|
locale: locale,
|
|
154
157
|
symbol: symbol,
|
|
155
|
-
resources: currentResources
|
|
158
|
+
resources: currentResources,
|
|
159
|
+
is_hide_like: true,
|
|
160
|
+
holder_title: ''
|
|
156
161
|
});
|
|
157
162
|
});
|
|
158
163
|
};
|
|
@@ -194,4 +199,68 @@ export var sortResources = function sortResources(resources, resourceSort) {
|
|
|
194
199
|
} catch (error) {
|
|
195
200
|
console.log(error, 'wh2222');
|
|
196
201
|
}
|
|
202
|
+
};
|
|
203
|
+
export var getMeAccount = function getMeAccount(val) {
|
|
204
|
+
return val === null || val === void 0 ? void 0 : val.find(function (d) {
|
|
205
|
+
return !(d !== null && d !== void 0 && d.isGuest);
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
export var formatCustomer = function formatCustomer(val) {
|
|
209
|
+
var currentUserName = "".concat((val === null || val === void 0 ? void 0 : val.first_name) || '').concat(val !== null && val !== void 0 && val.last_name ? " ".concat(val === null || val === void 0 ? void 0 : val.last_name) : '');
|
|
210
|
+
currentUserName = currentUserName || (val === null || val === void 0 ? void 0 : val.nickname) || 'Me';
|
|
211
|
+
return {
|
|
212
|
+
id: (val === null || val === void 0 ? void 0 : val.id) || getUniqueId(),
|
|
213
|
+
username: currentUserName
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
export var formatCurrentUser = function formatCurrentUser() {
|
|
217
|
+
var _utils$getStore$getSt, _userInfo;
|
|
218
|
+
var context = useEngineContext();
|
|
219
|
+
var utils = context.appHelper.utils || {};
|
|
220
|
+
var userInfo = (_utils$getStore$getSt = utils.getStore().getState()) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.global) === null || _utils$getStore$getSt === void 0 ? void 0 : _utils$getStore$getSt.userInfo;
|
|
221
|
+
var localUserInfo = JSON.parse(utils.storage.get('customer') || '{}');
|
|
222
|
+
userInfo = (_userInfo = userInfo) !== null && _userInfo !== void 0 && _userInfo.id ? userInfo : localUserInfo;
|
|
223
|
+
var customer = formatCustomer(userInfo);
|
|
224
|
+
return customer;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @title: 检查是否有空的账户
|
|
229
|
+
* @description:
|
|
230
|
+
* @param {any} carts
|
|
231
|
+
* @param {any} accounts
|
|
232
|
+
* @return {*}
|
|
233
|
+
* @Author: WangHan
|
|
234
|
+
* @Date: 2025-04-15 17:05
|
|
235
|
+
*/
|
|
236
|
+
export var isEmptyGuest = function isEmptyGuest(carts, accounts) {
|
|
237
|
+
// 遍历账户列表
|
|
238
|
+
var _iterator = _createForOfIteratorHelper(accounts),
|
|
239
|
+
_step;
|
|
240
|
+
try {
|
|
241
|
+
var _loop = function _loop() {
|
|
242
|
+
var item = _step.value;
|
|
243
|
+
// 检查商品数据是否有匹配的holder_id
|
|
244
|
+
var hasMatch = carts.some(function (firstItem) {
|
|
245
|
+
return firstItem.holder_id === item.id;
|
|
246
|
+
});
|
|
247
|
+
// 如果没有找到匹配的,直接返回true
|
|
248
|
+
if (!hasMatch) {
|
|
249
|
+
return {
|
|
250
|
+
v: true
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
_ret;
|
|
255
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
256
|
+
_ret = _loop();
|
|
257
|
+
if (_ret) return _ret.v;
|
|
258
|
+
}
|
|
259
|
+
// 所有元素都找到了匹配,返回false
|
|
260
|
+
} catch (err) {
|
|
261
|
+
_iterator.e(err);
|
|
262
|
+
} finally {
|
|
263
|
+
_iterator.f();
|
|
264
|
+
}
|
|
265
|
+
return false;
|
|
197
266
|
};
|
|
@@ -34,6 +34,7 @@ import { getSumTotal, is_price_include_tax } from "./amount";
|
|
|
34
34
|
import "./index.less";
|
|
35
35
|
import { createEventBooking, editEventBooking } from "./serve";
|
|
36
36
|
import { formatValues } from "./utils";
|
|
37
|
+
import VoucherCard from "../voucher";
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* @title: 底部
|
|
@@ -1167,7 +1168,10 @@ var Footer = function Footer(props) {
|
|
|
1167
1168
|
round: true,
|
|
1168
1169
|
loading: showFooter,
|
|
1169
1170
|
active: true
|
|
1170
|
-
}, /*#__PURE__*/React.createElement(
|
|
1171
|
+
}, /*#__PURE__*/React.createElement(VoucherCard, {
|
|
1172
|
+
state: state,
|
|
1173
|
+
dispatch: dispatch
|
|
1174
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
1171
1175
|
className: "pisell-lowcode__booking-footer-total"
|
|
1172
1176
|
}, /*#__PURE__*/React.createElement("span", {
|
|
1173
1177
|
className: "pisell-lowcode__booking-footer-left"
|
|
@@ -223,6 +223,20 @@ var formatMetaData = function formatMetaData(item) {
|
|
|
223
223
|
return metadata;
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
+
// const formatDiscountList = (list: any[]) => {
|
|
227
|
+
// return list.map(item => {
|
|
228
|
+
// return {
|
|
229
|
+
// amount: item.amount,
|
|
230
|
+
// product_id: item.product_id || item.discount?.product_id,
|
|
231
|
+
// resource_id: item.resource_id || item.discount?.resource_id,
|
|
232
|
+
// title: item.title || item.discount?.title,
|
|
233
|
+
// original_amount: item.original_amount || item.discount?.original_amount,
|
|
234
|
+
// id: item.id,
|
|
235
|
+
// type: item.type,
|
|
236
|
+
// }
|
|
237
|
+
// })
|
|
238
|
+
// }
|
|
239
|
+
|
|
226
240
|
/**
|
|
227
241
|
* @title: 格式化商品数据
|
|
228
242
|
* @description:
|
|
@@ -236,6 +250,7 @@ var formatProducts = function formatProducts(item) {
|
|
|
236
250
|
var total = Number(item._extend.total);
|
|
237
251
|
var origin_total = Number(item._extend.origin_total);
|
|
238
252
|
var discount_amount = origin_total - total;
|
|
253
|
+
var discount_list = (item === null || item === void 0 ? void 0 : item.discount_list) || [];
|
|
239
254
|
|
|
240
255
|
// 加价时type使用change_price
|
|
241
256
|
var discount_type = discount_amount < 0 ? 'change_price' : 'discount';
|
|
@@ -243,7 +258,7 @@ var formatProducts = function formatProducts(item) {
|
|
|
243
258
|
"num": item._extend.quantity,
|
|
244
259
|
"price": formatProductPrice(item),
|
|
245
260
|
"product_id": (item === null || item === void 0 ? void 0 : item.product_id) || item.id,
|
|
246
|
-
"discount_amount": discount_amount,
|
|
261
|
+
"discount_amount": discount_list.length > 0 ? 0 : discount_amount,
|
|
247
262
|
"product_discount_reason": item._extend.discount_reason || '',
|
|
248
263
|
"is_charge_tax": item.is_charge_tax,
|
|
249
264
|
"note": (item === null || item === void 0 ? void 0 : item.note) || '',
|
|
@@ -255,6 +270,7 @@ var formatProducts = function formatProducts(item) {
|
|
|
255
270
|
"bundle_edit": item._extend.bundle_edit,
|
|
256
271
|
"product_option_item": formatProductOption((_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 || (_item$_extend10 = _item$_extend10.other) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.option),
|
|
257
272
|
"product_variant_id": ((_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 || (_item$_extend11 = _item$_extend11.other) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.product_variant_id) || 0,
|
|
273
|
+
"discount_list": discount_list,
|
|
258
274
|
metadata: formatMetaData(item)
|
|
259
275
|
};
|
|
260
276
|
};
|
|
@@ -513,7 +529,7 @@ export var formatValues = function formatValues(state) {
|
|
|
513
529
|
// 客户
|
|
514
530
|
var customer = formatCustomer(state);
|
|
515
531
|
values = _objectSpread(_objectSpread({}, values), customer);
|
|
516
|
-
|
|
532
|
+
debugger;
|
|
517
533
|
// 主体
|
|
518
534
|
values.holder = formatHolder(state, values);
|
|
519
535
|
if (isDay) {
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
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); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
17
|
+
import ChevronDown from '@pisell/icon/es/ChevronDown';
|
|
18
|
+
import classNames from 'classnames';
|
|
19
|
+
import { Button } from 'antd';
|
|
20
|
+
import { locales } from '@pisell/utils';
|
|
21
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
22
|
+
import { PisellInput, PisellTooltip, PisellGoodPassCard, PisellToast } from '@pisell/materials';
|
|
23
|
+
import { QuestionCircleOutlined } from '@ant-design/icons';
|
|
24
|
+
import { useIsBooking4Shop } from "../../hooks/useIsBooking4Shop";
|
|
25
|
+
import "./index.less";
|
|
26
|
+
var ShopDiscountHooks = {
|
|
27
|
+
onInited: 'shopDiscount:onInited',
|
|
28
|
+
onDestroy: 'shopDiscount:onDestroy',
|
|
29
|
+
onLoadDiscountList: 'shopDiscount:onLoadDiscountList',
|
|
30
|
+
onCustomerChange: 'shopDiscount:onCustomerChange',
|
|
31
|
+
onDiscountListChange: 'shopDiscount:onDiscountListChange',
|
|
32
|
+
onRulesListChange: 'shopDiscount:onRulesListChange',
|
|
33
|
+
onLoadPrepareCalcResult: 'shopDiscount:onLoadPrepareCalcResult'
|
|
34
|
+
};
|
|
35
|
+
var VoucherCard = function VoucherCard(props) {
|
|
36
|
+
var _context$appHelper, _state$client$value;
|
|
37
|
+
var context = useEngineContext();
|
|
38
|
+
var _useState = useState(true),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
showDetail = _useState2[0],
|
|
41
|
+
setShowDetail = _useState2[1];
|
|
42
|
+
var state = props.state,
|
|
43
|
+
dispatch = props.dispatch;
|
|
44
|
+
var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
|
|
45
|
+
pisellos = _context$appHelper$ut.pisellos;
|
|
46
|
+
var _useState3 = useState(''),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
code = _useState4[0],
|
|
49
|
+
setCode = _useState4[1];
|
|
50
|
+
var _useState5 = useState([]),
|
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
+
discountList = _useState6[0],
|
|
53
|
+
setDisCountList = _useState6[1];
|
|
54
|
+
var productRef = useRef(state.service.value);
|
|
55
|
+
var isBooking4Shop = useIsBooking4Shop(state);
|
|
56
|
+
var shopDiscount = pisellos.getModule('shopDiscount');
|
|
57
|
+
var availableData = useMemo(function () {
|
|
58
|
+
if (!isBooking4Shop) return [];
|
|
59
|
+
var shopDiscount = pisellos.getModule('shopDiscount');
|
|
60
|
+
return discountList.filter(function (item) {
|
|
61
|
+
return !!item.isAvailable;
|
|
62
|
+
}).map(function (discount) {
|
|
63
|
+
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
64
|
+
savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice(discount)
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}, [discountList, isBooking4Shop]);
|
|
68
|
+
|
|
69
|
+
// 设置client
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
if (isBooking4Shop) {
|
|
72
|
+
shopDiscount.setCustomer(state.client.value);
|
|
73
|
+
}
|
|
74
|
+
}, [(_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id, isBooking4Shop]);
|
|
75
|
+
|
|
76
|
+
// 设置productList
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
if (isBooking4Shop) {
|
|
79
|
+
shopDiscount.setProductList(state.service.value);
|
|
80
|
+
}
|
|
81
|
+
}, [state.service.value, isBooking4Shop]);
|
|
82
|
+
|
|
83
|
+
// 更新productList
|
|
84
|
+
useEffect(function () {
|
|
85
|
+
if (productRef.current === state.service.value) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (isBooking4Shop) {
|
|
89
|
+
var val = shopDiscount.calcDiscount(state.service.value);
|
|
90
|
+
console.log('input: ', state.service.value);
|
|
91
|
+
console.log('output: ', val);
|
|
92
|
+
productRef.current = val.productList;
|
|
93
|
+
dispatch({
|
|
94
|
+
type: 'setService',
|
|
95
|
+
payload: {
|
|
96
|
+
value: val.productList
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, [state.service.value, isBooking4Shop]);
|
|
101
|
+
|
|
102
|
+
// 监听customer变化
|
|
103
|
+
useEffect(function () {
|
|
104
|
+
if (!isBooking4Shop) return;
|
|
105
|
+
pisellos.effects.on(ShopDiscountHooks.onCustomerChange, function (customer) {
|
|
106
|
+
console.log(customer, 'customerChange');
|
|
107
|
+
// 更新客户
|
|
108
|
+
dispatch({
|
|
109
|
+
type: 'setClient',
|
|
110
|
+
payload: {
|
|
111
|
+
value: customer
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
pisellos.effects.on(ShopDiscountHooks.onLoadPrepareCalcResult, function (result) {
|
|
116
|
+
dispatch({
|
|
117
|
+
type: 'setService',
|
|
118
|
+
payload: {
|
|
119
|
+
value: result.productList
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
pisellos.effects.on(ShopDiscountHooks.onDiscountListChange, function (discount) {
|
|
124
|
+
console.log(discount, 'discountChange');
|
|
125
|
+
setDisCountList(discount);
|
|
126
|
+
});
|
|
127
|
+
return function () {
|
|
128
|
+
shopDiscount.clear();
|
|
129
|
+
pisellos.effects.off(ShopDiscountHooks.onCustomerChange);
|
|
130
|
+
pisellos.effects.off(ShopDiscountHooks.onLoadPrepareCalcResult);
|
|
131
|
+
pisellos.effects.off(ShopDiscountHooks.onDiscountListChange);
|
|
132
|
+
};
|
|
133
|
+
}, [state.bookingId, isBooking4Shop]);
|
|
134
|
+
|
|
135
|
+
// apply code
|
|
136
|
+
var onScanCode = /*#__PURE__*/function () {
|
|
137
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
138
|
+
var val;
|
|
139
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
140
|
+
while (1) switch (_context.prev = _context.next) {
|
|
141
|
+
case 0:
|
|
142
|
+
_context.next = 2;
|
|
143
|
+
return shopDiscount.scanCode(code);
|
|
144
|
+
case 2:
|
|
145
|
+
val = _context.sent;
|
|
146
|
+
console.log(val);
|
|
147
|
+
if (val !== null && val !== void 0 && val.isAvailable) {
|
|
148
|
+
dispatch({
|
|
149
|
+
type: 'setService',
|
|
150
|
+
payload: {
|
|
151
|
+
value: val.productList
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
} else {
|
|
155
|
+
PisellToast({
|
|
156
|
+
content: locales.getText('pisell2.text.goodpass.code-invalid')
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
case 5:
|
|
160
|
+
case "end":
|
|
161
|
+
return _context.stop();
|
|
162
|
+
}
|
|
163
|
+
}, _callee);
|
|
164
|
+
}));
|
|
165
|
+
return function onScanCode() {
|
|
166
|
+
return _ref.apply(this, arguments);
|
|
167
|
+
};
|
|
168
|
+
}();
|
|
169
|
+
if (!isBooking4Shop) return null;
|
|
170
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: "pisell-lowcode__booking-footer-voucher-container"
|
|
172
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: "voucher-title"
|
|
174
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
175
|
+
className: "voucher-title-left"
|
|
176
|
+
}, locales.getText('pisell2.text.goodpass')), /*#__PURE__*/React.createElement("span", {
|
|
177
|
+
className: "voucher-title-right",
|
|
178
|
+
onClick: function onClick() {
|
|
179
|
+
console.log('showDetail: ', showDetail);
|
|
180
|
+
setShowDetail(!showDetail);
|
|
181
|
+
}
|
|
182
|
+
}, locales.getText('pisell2.text.details'), ' ', /*#__PURE__*/React.createElement(ChevronDown, {
|
|
183
|
+
className: classNames('voucher-right-icon', {
|
|
184
|
+
show: showDetail
|
|
185
|
+
})
|
|
186
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
className: classNames('voucher-detail', {
|
|
188
|
+
show: showDetail
|
|
189
|
+
})
|
|
190
|
+
}, (availableData === null || availableData === void 0 ? void 0 : availableData.length) > 0 ? /*#__PURE__*/React.createElement(PisellGoodPassCard, {
|
|
191
|
+
style: {
|
|
192
|
+
width: '100%'
|
|
193
|
+
},
|
|
194
|
+
dataSource: availableData,
|
|
195
|
+
onChange: function onChange(val) {
|
|
196
|
+
var shopDiscount = pisellos.getModule('shopDiscount');
|
|
197
|
+
var detail = shopDiscount.setDiscountSelected({
|
|
198
|
+
discountId: val.id,
|
|
199
|
+
isSelected: val.isSelected
|
|
200
|
+
});
|
|
201
|
+
console.log('setDiscountSelected:', detail);
|
|
202
|
+
dispatch({
|
|
203
|
+
type: 'setService',
|
|
204
|
+
payload: {
|
|
205
|
+
value: detail.productList
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
210
|
+
className: "voucher-code-input-wrapper"
|
|
211
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
212
|
+
className: "voucher-code-input"
|
|
213
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
214
|
+
style: {
|
|
215
|
+
whiteSpace: 'nowrap'
|
|
216
|
+
}
|
|
217
|
+
}, locales.getText('pisell2.text.goodpass.code'), ":"), /*#__PURE__*/React.createElement(PisellInput, {
|
|
218
|
+
value: code,
|
|
219
|
+
onChange: function onChange(e) {
|
|
220
|
+
var _e$target;
|
|
221
|
+
setCode((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
|
|
222
|
+
},
|
|
223
|
+
size: "small",
|
|
224
|
+
placeholder: locales.getText('pisell2.text.goodpass.enter-code'),
|
|
225
|
+
suffix: /*#__PURE__*/React.createElement(PisellTooltip, {
|
|
226
|
+
title: ""
|
|
227
|
+
}, /*#__PURE__*/React.createElement(QuestionCircleOutlined, {
|
|
228
|
+
style: {
|
|
229
|
+
color: 'rgba(0,0,0,.45)'
|
|
230
|
+
}
|
|
231
|
+
}))
|
|
232
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
233
|
+
size: "small",
|
|
234
|
+
onClick: onScanCode,
|
|
235
|
+
disabled: !code
|
|
236
|
+
}, locales.getText('pisell2.text.apply')))));
|
|
237
|
+
};
|
|
238
|
+
export default VoucherCard;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.pisell-lowcode__booking-footer-voucher-container {
|
|
2
|
+
margin-bottom: 8px;
|
|
3
|
+
.voucher-title {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
margin-bottom: 10px;
|
|
8
|
+
|
|
9
|
+
.voucher-title-left {
|
|
10
|
+
color: var(--base-black, #000);
|
|
11
|
+
font-size: 18px;
|
|
12
|
+
font-style: normal;
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
line-height: 28px;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.voucher-title-right {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
gap: 4px;
|
|
24
|
+
color: #7f56d9;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
font-size: 18px;
|
|
27
|
+
font-style: normal;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.voucher-right-icon {
|
|
32
|
+
font-size: 20px;
|
|
33
|
+
width: 24px;
|
|
34
|
+
height: 24px;
|
|
35
|
+
color: #7f56d9;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
|
|
40
|
+
&.show {
|
|
41
|
+
transform: rotate(180deg);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.voucher-detail {
|
|
47
|
+
width: 100%;
|
|
48
|
+
transition: 0.2s;
|
|
49
|
+
max-height: 0;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
|
|
54
|
+
&.show {
|
|
55
|
+
max-height: unset;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.voucher-code-input-wrapper {
|
|
60
|
+
margin-top: 6px;
|
|
61
|
+
display: flex;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 42px;
|
|
64
|
+
padding: 8px;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: 8px;
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
border-radius: 8px;
|
|
70
|
+
border: 1px solid var(--Gray-300, #d0d5dd);
|
|
71
|
+
background: #fff;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.voucher-code-input {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
> div {
|
|
78
|
+
color: var(--Gray-500, #667085);
|
|
79
|
+
text-align: center;
|
|
80
|
+
font-family: Inter;
|
|
81
|
+
font-size: 16px;
|
|
82
|
+
font-style: normal;
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
line-height: 20px;
|
|
85
|
+
margin-right: 8px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
interface ApplicableProductDetails {
|
|
4
|
+
amount: string;
|
|
5
|
+
type: string;
|
|
6
|
+
resource_id: number;
|
|
7
|
+
title: string;
|
|
8
|
+
original_amount: string;
|
|
9
|
+
}
|
|
10
|
+
interface Discount {
|
|
11
|
+
id: number;
|
|
12
|
+
product_name: string;
|
|
13
|
+
encoded: string;
|
|
14
|
+
code: string;
|
|
15
|
+
tag: string;
|
|
16
|
+
expire_time?: string;
|
|
17
|
+
product_id: number;
|
|
18
|
+
relation_type: string;
|
|
19
|
+
par_value: string;
|
|
20
|
+
used_par_value: string;
|
|
21
|
+
limit_status: string;
|
|
22
|
+
limited_relation_product_data: any;
|
|
23
|
+
balance: string;
|
|
24
|
+
format_title: any;
|
|
25
|
+
product: any;
|
|
26
|
+
savedAmount: number;
|
|
27
|
+
isDisabled: boolean;
|
|
28
|
+
isSelected?: boolean;
|
|
29
|
+
isAvailable?: boolean;
|
|
30
|
+
isUsed?: boolean;
|
|
31
|
+
applicableProductIds?: number[];
|
|
32
|
+
applicableProductDetails: ApplicableProductDetails[];
|
|
33
|
+
appliedProductDetails: any[];
|
|
34
|
+
}
|
|
35
|
+
export interface PisellGoodPassCardProps {
|
|
36
|
+
/**数据源 */
|
|
37
|
+
dataSource: Array<Discount>;
|
|
38
|
+
/**事件 */
|
|
39
|
+
onChange?: (current: {
|
|
40
|
+
id: string | number;
|
|
41
|
+
isSelected: boolean;
|
|
42
|
+
}) => void;
|
|
43
|
+
/**样式 */
|
|
44
|
+
style: React.CSSProperties;
|
|
45
|
+
}
|
|
46
|
+
declare const index: (props: PisellGoodPassCardProps) => JSX.Element;
|
|
47
|
+
export default index;
|