@pisell/private-materials 6.1.5 → 6.1.7
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/ticketBooking/components/addServiceVariant/addService.js +178 -156
- package/es/components/ticketBooking/components/menuBar/index.js +4 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +147 -126
- package/lib/components/ticketBooking/components/menuBar/index.js +29 -13
- package/package.json +4 -4
@@ -261,16 +261,193 @@ var AddSerivce = function AddSerivce(props) {
|
|
261
261
|
}();
|
262
262
|
var handleSelectProduct = useMemoizedFn(function (item) {
|
263
263
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
|
264
|
+
console.log('点击了加入购物车');
|
264
265
|
var isSession = isSessionProduct(item);
|
265
266
|
// 是否有单规格 组合规格 套餐, 或者session商品 如果没有不需要打开弹窗
|
266
267
|
var isEject = getIsEject(item, type);
|
267
268
|
var isOnlySession = getIsOnlySession(item);
|
268
269
|
var lock = false;
|
270
|
+
// 对于不需要打开弹窗的商品, 直接模拟数据, 不走弹窗
|
271
|
+
var cacheValues = null;
|
269
272
|
if (isEject) {
|
270
273
|
setCurrentProduct(item);
|
271
274
|
} else {
|
272
275
|
setCurrentProduct(null);
|
276
|
+
cacheValues = {
|
277
|
+
bundle: [],
|
278
|
+
key: item.id,
|
279
|
+
option: [],
|
280
|
+
product_id: item.id,
|
281
|
+
product_variant_id: 0,
|
282
|
+
quantity: 1,
|
283
|
+
rowKey: item.id,
|
284
|
+
session: null,
|
285
|
+
unique: '08974625397'
|
286
|
+
};
|
273
287
|
}
|
288
|
+
var callback = /*#__PURE__*/function () {
|
289
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, extension_type, detail) {
|
290
|
+
var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _Toast$success, _addService, _list, quantity, _context$appHelper$ut3, _context$appHelper$ut4, val, sendData;
|
291
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
292
|
+
while (1) switch (_context3.prev = _context3.next) {
|
293
|
+
case 0:
|
294
|
+
console.timeEnd('打开弹窗');
|
295
|
+
console.log('点击了加入购物车 ---弹窗', e);
|
296
|
+
setCurrentProduct(null);
|
297
|
+
// 防止选择商品弹窗多次触发callback
|
298
|
+
if (!lock) {
|
299
|
+
_context3.next = 5;
|
300
|
+
break;
|
301
|
+
}
|
302
|
+
return _context3.abrupt("return");
|
303
|
+
case 5:
|
304
|
+
lock = true;
|
305
|
+
|
306
|
+
// 2秒后解除
|
307
|
+
setTimeout(function () {
|
308
|
+
lock = false;
|
309
|
+
}, 2000);
|
310
|
+
if (isBooking4) {
|
311
|
+
_context3.next = 13;
|
312
|
+
break;
|
313
|
+
}
|
314
|
+
_context3.next = 10;
|
315
|
+
return createBookingData({
|
316
|
+
product: _objectSpread(_objectSpread({}, detail || item), {}, {
|
317
|
+
_params: e
|
318
|
+
})
|
319
|
+
});
|
320
|
+
case 10:
|
321
|
+
data = _context3.sent;
|
322
|
+
// 创建预约
|
323
|
+
createBooking({
|
324
|
+
booking: data
|
325
|
+
});
|
326
|
+
return _context3.abrupt("return");
|
327
|
+
case 13:
|
328
|
+
// info2 addService 逻辑
|
329
|
+
_detail = detail || item;
|
330
|
+
other = JSON.parse(JSON.stringify(e));
|
331
|
+
other.session = e.session;
|
332
|
+
cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
|
333
|
+
product_id: item.id,
|
334
|
+
_id: getUniqueId(),
|
335
|
+
_key: e.key,
|
336
|
+
_extend: {
|
337
|
+
start_date: state.date.value,
|
338
|
+
quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
|
339
|
+
price: _detail.price,
|
340
|
+
product_name: item.title,
|
341
|
+
other: other
|
342
|
+
},
|
343
|
+
new: 1
|
344
|
+
});
|
345
|
+
_total = getProductTotalPrice(cacheItem); // 用于折扣 可修改
|
346
|
+
cacheItem._extend.total = _total;
|
347
|
+
// 用于储存原价
|
348
|
+
cacheItem._extend.origin_total = _total;
|
349
|
+
_isEdit = !!state.service.cacheItem;
|
350
|
+
if (_isEdit) {
|
351
|
+
cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
|
352
|
+
cacheItem.new = 0;
|
353
|
+
}
|
354
|
+
// 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
|
355
|
+
if (renderMode === 'current') {
|
356
|
+
// cacheItem._extend.resource = 0;
|
357
|
+
cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
|
358
|
+
}
|
359
|
+
cacheItem = getProductExtend({
|
360
|
+
cacheItem: cacheItem,
|
361
|
+
state: state,
|
362
|
+
isDisabledTime: true
|
363
|
+
});
|
364
|
+
if (state.renderType === 'eventBooking') {
|
365
|
+
cacheItem.autoClose = false;
|
366
|
+
}
|
367
|
+
if (cacheItem.autoClose) {
|
368
|
+
cacheItem.autoClose = false;
|
369
|
+
cacheItem._serviceKey = genServiceKey(cacheItem);
|
370
|
+
_addService = addService(_toConsumableArray(state.service.value), cacheItem, state), _list = _addService.list, quantity = _addService.quantity;
|
371
|
+
Toast === null || Toast === void 0 || (_Toast$success = Toast.success) === null || _Toast$success === void 0 || _Toast$success.call(Toast, /*#__PURE__*/React.createElement("div", {
|
372
|
+
className: "add-toast-wrap"
|
373
|
+
}, /*#__PURE__*/React.createElement("div", {
|
374
|
+
className: "add-toast-title"
|
375
|
+
}, cacheItem.title), /*#__PURE__*/React.createElement("div", {
|
376
|
+
className: "add-toast-quantity"
|
377
|
+
}, locales.getText('pisell2.ticket-booking.in-cart')(quantity || 1))));
|
378
|
+
addServiceScroll(e.rowKey, cacheItem);
|
379
|
+
try {
|
380
|
+
if (((_context$appHelper$ut3 = context.appHelper.utils.store) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut3.getState) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.call(_context$appHelper$ut3)) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.global) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.globalConfig) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.id) === 2155) {
|
381
|
+
val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
|
382
|
+
return {
|
383
|
+
product_id: s === null || s === void 0 ? void 0 : s.product_id,
|
384
|
+
detailId: s === null || s === void 0 ? void 0 : s.id,
|
385
|
+
detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
|
386
|
+
product_name: s === null || s === void 0 ? void 0 : s.title,
|
387
|
+
price: s === null || s === void 0 ? void 0 : s.price,
|
388
|
+
_id: s === null || s === void 0 ? void 0 : s._id,
|
389
|
+
_key: s === null || s === void 0 ? void 0 : s._key,
|
390
|
+
_serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
|
391
|
+
};
|
392
|
+
});
|
393
|
+
sendData = {
|
394
|
+
product_id: item === null || item === void 0 ? void 0 : item.id,
|
395
|
+
detailId: _detail === null || _detail === void 0 ? void 0 : _detail.id,
|
396
|
+
detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
|
397
|
+
product_name: item === null || item === void 0 ? void 0 : item.title,
|
398
|
+
price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
|
399
|
+
serviceVal: val
|
400
|
+
};
|
401
|
+
sendWarningLog({
|
402
|
+
title: 'addService',
|
403
|
+
content: [{
|
404
|
+
key: '添加数据',
|
405
|
+
value: JSON.stringify(sendData)
|
406
|
+
}, {
|
407
|
+
key: '日期',
|
408
|
+
value: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
409
|
+
}]
|
410
|
+
});
|
411
|
+
}
|
412
|
+
} catch (error) {}
|
413
|
+
dispatch({
|
414
|
+
type: 'setService',
|
415
|
+
payload: {
|
416
|
+
addModal: false,
|
417
|
+
value: _list,
|
418
|
+
edit: true,
|
419
|
+
changeService: false
|
420
|
+
}
|
421
|
+
});
|
422
|
+
} else {
|
423
|
+
openBookingEditModal();
|
424
|
+
dispatch({
|
425
|
+
type: 'setService',
|
426
|
+
payload: {
|
427
|
+
editModal: true,
|
428
|
+
cacheItem: cacheItem,
|
429
|
+
addModal: !cacheItem.autoClose,
|
430
|
+
changeService: false
|
431
|
+
}
|
432
|
+
});
|
433
|
+
onEdit === null || onEdit === void 0 || onEdit(cacheItem);
|
434
|
+
}
|
435
|
+
case 26:
|
436
|
+
case "end":
|
437
|
+
return _context3.stop();
|
438
|
+
}
|
439
|
+
}, _callee3);
|
440
|
+
}));
|
441
|
+
return function callback(_x3, _x4, _x5) {
|
442
|
+
return _ref3.apply(this, arguments);
|
443
|
+
};
|
444
|
+
}();
|
445
|
+
// 如果不需要打开弹窗, 直接添加数据
|
446
|
+
if (cacheValues) {
|
447
|
+
callback(cacheValues, '', item);
|
448
|
+
return;
|
449
|
+
}
|
450
|
+
console.time('打开弹窗');
|
274
451
|
state.action({
|
275
452
|
type: 'pisell1.handleOpenProductModal',
|
276
453
|
data: {
|
@@ -291,162 +468,7 @@ var AddSerivce = function AddSerivce(props) {
|
|
291
468
|
onCancel: function onCancel() {
|
292
469
|
setCurrentProduct(null);
|
293
470
|
},
|
294
|
-
callback:
|
295
|
-
var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, extension_type, detail) {
|
296
|
-
var data, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _Toast$success, _addService, _list, quantity, _context$appHelper$ut3, _context$appHelper$ut4, val, sendData;
|
297
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
298
|
-
while (1) switch (_context3.prev = _context3.next) {
|
299
|
-
case 0:
|
300
|
-
setCurrentProduct(null);
|
301
|
-
// 防止选择商品弹窗多次触发callback
|
302
|
-
if (!lock) {
|
303
|
-
_context3.next = 3;
|
304
|
-
break;
|
305
|
-
}
|
306
|
-
return _context3.abrupt("return");
|
307
|
-
case 3:
|
308
|
-
lock = true;
|
309
|
-
|
310
|
-
// 2秒后解除
|
311
|
-
setTimeout(function () {
|
312
|
-
lock = false;
|
313
|
-
}, 2000);
|
314
|
-
if (isBooking4) {
|
315
|
-
_context3.next = 11;
|
316
|
-
break;
|
317
|
-
}
|
318
|
-
_context3.next = 8;
|
319
|
-
return createBookingData({
|
320
|
-
product: _objectSpread(_objectSpread({}, detail || item), {}, {
|
321
|
-
_params: e
|
322
|
-
})
|
323
|
-
});
|
324
|
-
case 8:
|
325
|
-
data = _context3.sent;
|
326
|
-
// 创建预约
|
327
|
-
createBooking({
|
328
|
-
booking: data
|
329
|
-
});
|
330
|
-
return _context3.abrupt("return");
|
331
|
-
case 11:
|
332
|
-
// info2 addService 逻辑
|
333
|
-
_detail = detail || item;
|
334
|
-
other = JSON.parse(JSON.stringify(e));
|
335
|
-
other.session = e.session;
|
336
|
-
cacheItem = _objectSpread(_objectSpread({}, _detail), {}, {
|
337
|
-
product_id: item.id,
|
338
|
-
_id: getUniqueId(),
|
339
|
-
_key: e.key,
|
340
|
-
_extend: {
|
341
|
-
start_date: state.date.value,
|
342
|
-
quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
|
343
|
-
price: _detail.price,
|
344
|
-
product_name: item.title,
|
345
|
-
other: other
|
346
|
-
},
|
347
|
-
new: 1
|
348
|
-
});
|
349
|
-
_total = getProductTotalPrice(cacheItem); // 用于折扣 可修改
|
350
|
-
cacheItem._extend.total = _total;
|
351
|
-
// 用于储存原价
|
352
|
-
cacheItem._extend.origin_total = _total;
|
353
|
-
_isEdit = !!state.service.cacheItem;
|
354
|
-
if (_isEdit) {
|
355
|
-
cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
|
356
|
-
cacheItem.new = 0;
|
357
|
-
}
|
358
|
-
// 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
|
359
|
-
if (renderMode === 'current') {
|
360
|
-
// cacheItem._extend.resource = 0;
|
361
|
-
cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
|
362
|
-
}
|
363
|
-
cacheItem = getProductExtend({
|
364
|
-
cacheItem: cacheItem,
|
365
|
-
state: state,
|
366
|
-
isDisabledTime: true
|
367
|
-
});
|
368
|
-
if (state.renderType === 'eventBooking') {
|
369
|
-
cacheItem.autoClose = false;
|
370
|
-
}
|
371
|
-
if (cacheItem.autoClose) {
|
372
|
-
cacheItem.autoClose = false;
|
373
|
-
cacheItem._serviceKey = genServiceKey(cacheItem);
|
374
|
-
_addService = addService(_toConsumableArray(state.service.value), cacheItem, state), _list = _addService.list, quantity = _addService.quantity;
|
375
|
-
Toast === null || Toast === void 0 || (_Toast$success = Toast.success) === null || _Toast$success === void 0 || _Toast$success.call(Toast, /*#__PURE__*/React.createElement("div", {
|
376
|
-
className: "add-toast-wrap"
|
377
|
-
}, /*#__PURE__*/React.createElement("div", {
|
378
|
-
className: "add-toast-title"
|
379
|
-
}, cacheItem.title), /*#__PURE__*/React.createElement("div", {
|
380
|
-
className: "add-toast-quantity"
|
381
|
-
}, locales.getText('pisell2.ticket-booking.in-cart')(quantity || 1))));
|
382
|
-
addServiceScroll(e.rowKey, cacheItem);
|
383
|
-
try {
|
384
|
-
if (((_context$appHelper$ut3 = context.appHelper.utils.store) === null || _context$appHelper$ut3 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut3.getState) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.call(_context$appHelper$ut3)) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.global) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.globalConfig) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.id) === 2155) {
|
385
|
-
val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
|
386
|
-
return {
|
387
|
-
product_id: s === null || s === void 0 ? void 0 : s.product_id,
|
388
|
-
detailId: s === null || s === void 0 ? void 0 : s.id,
|
389
|
-
detailProductId: s === null || s === void 0 ? void 0 : s.product_id,
|
390
|
-
product_name: s === null || s === void 0 ? void 0 : s.title,
|
391
|
-
price: s === null || s === void 0 ? void 0 : s.price,
|
392
|
-
_id: s === null || s === void 0 ? void 0 : s._id,
|
393
|
-
_key: s === null || s === void 0 ? void 0 : s._key,
|
394
|
-
_serviceKey: s === null || s === void 0 ? void 0 : s._serviceKey
|
395
|
-
};
|
396
|
-
});
|
397
|
-
sendData = {
|
398
|
-
product_id: item === null || item === void 0 ? void 0 : item.id,
|
399
|
-
detailId: _detail === null || _detail === void 0 ? void 0 : _detail.id,
|
400
|
-
detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
|
401
|
-
product_name: item === null || item === void 0 ? void 0 : item.title,
|
402
|
-
price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
|
403
|
-
serviceVal: val
|
404
|
-
};
|
405
|
-
sendWarningLog({
|
406
|
-
title: 'addService',
|
407
|
-
content: [{
|
408
|
-
key: '添加数据',
|
409
|
-
value: JSON.stringify(sendData)
|
410
|
-
}, {
|
411
|
-
key: '日期',
|
412
|
-
value: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
413
|
-
}]
|
414
|
-
});
|
415
|
-
}
|
416
|
-
} catch (error) {}
|
417
|
-
dispatch({
|
418
|
-
type: 'setService',
|
419
|
-
payload: {
|
420
|
-
addModal: false,
|
421
|
-
value: _list,
|
422
|
-
edit: true,
|
423
|
-
changeService: false
|
424
|
-
}
|
425
|
-
});
|
426
|
-
} else {
|
427
|
-
openBookingEditModal();
|
428
|
-
dispatch({
|
429
|
-
type: 'setService',
|
430
|
-
payload: {
|
431
|
-
editModal: true,
|
432
|
-
cacheItem: cacheItem,
|
433
|
-
addModal: !cacheItem.autoClose,
|
434
|
-
changeService: false
|
435
|
-
}
|
436
|
-
});
|
437
|
-
onEdit === null || onEdit === void 0 || onEdit(cacheItem);
|
438
|
-
}
|
439
|
-
case 24:
|
440
|
-
case "end":
|
441
|
-
return _context3.stop();
|
442
|
-
}
|
443
|
-
}, _callee3);
|
444
|
-
}));
|
445
|
-
function callback(_x3, _x4, _x5) {
|
446
|
-
return _callback.apply(this, arguments);
|
447
|
-
}
|
448
|
-
return callback;
|
449
|
-
}()
|
471
|
+
callback: callback
|
450
472
|
});
|
451
473
|
});
|
452
474
|
var renderList = useMemo(function () {
|
@@ -16,7 +16,10 @@ var index = function index() {
|
|
16
16
|
return /*#__PURE__*/React.createElement("div", {
|
17
17
|
className: "pisell-ticket-booking-menu-bar"
|
18
18
|
}, /*#__PURE__*/React.createElement("div", {
|
19
|
-
className: "logo-wrapper"
|
19
|
+
className: "logo-wrapper",
|
20
|
+
onClick: function onClick() {
|
21
|
+
window.location.href = '/login';
|
22
|
+
}
|
20
23
|
}, /*#__PURE__*/React.createElement("svg", {
|
21
24
|
xmlns: "http://www.w3.org/2000/svg",
|
22
25
|
width: "44",
|
@@ -205,15 +205,161 @@ var AddSerivce = (props) => {
|
|
205
205
|
};
|
206
206
|
const handleSelectProduct = (0, import_ahooks.useMemoizedFn)(
|
207
207
|
(item, type = "select") => {
|
208
|
+
console.log("点击了加入购物车");
|
208
209
|
const isSession = (0, import_utils2.isSessionProduct)(item);
|
209
210
|
const isEject = (0, import_utils2.getIsEject)(item, type);
|
210
211
|
const isOnlySession = (0, import_utils2.getIsOnlySession)(item);
|
211
212
|
let lock = false;
|
213
|
+
let cacheValues = null;
|
212
214
|
if (isEject) {
|
213
215
|
setCurrentProduct(item);
|
214
216
|
} else {
|
215
217
|
setCurrentProduct(null);
|
218
|
+
cacheValues = {
|
219
|
+
bundle: [],
|
220
|
+
key: item.id,
|
221
|
+
option: [],
|
222
|
+
product_id: item.id,
|
223
|
+
product_variant_id: 0,
|
224
|
+
quantity: 1,
|
225
|
+
rowKey: item.id,
|
226
|
+
session: null,
|
227
|
+
unique: "08974625397"
|
228
|
+
};
|
216
229
|
}
|
230
|
+
const callback = async (e, extension_type, detail) => {
|
231
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
232
|
+
console.timeEnd("打开弹窗");
|
233
|
+
console.log("点击了加入购物车 ---弹窗", e);
|
234
|
+
setCurrentProduct(null);
|
235
|
+
if (lock) {
|
236
|
+
return;
|
237
|
+
}
|
238
|
+
lock = true;
|
239
|
+
setTimeout(() => {
|
240
|
+
lock = false;
|
241
|
+
}, 2e3);
|
242
|
+
if (!isBooking4) {
|
243
|
+
const data = await createBookingData({
|
244
|
+
product: { ...detail || item, _params: e }
|
245
|
+
});
|
246
|
+
createBooking({ booking: data });
|
247
|
+
return;
|
248
|
+
}
|
249
|
+
const _detail = detail || item;
|
250
|
+
const other = JSON.parse(JSON.stringify(e));
|
251
|
+
other.session = e.session;
|
252
|
+
let cacheItem = {
|
253
|
+
..._detail,
|
254
|
+
product_id: item.id,
|
255
|
+
_id: (0, import_utils.getUniqueId)(),
|
256
|
+
_key: e.key,
|
257
|
+
_extend: {
|
258
|
+
start_date: state.date.value,
|
259
|
+
quantity: (e == null ? void 0 : e.quantity) || 1,
|
260
|
+
price: _detail.price,
|
261
|
+
product_name: item.title,
|
262
|
+
other
|
263
|
+
},
|
264
|
+
new: 1
|
265
|
+
};
|
266
|
+
let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
|
267
|
+
cacheItem._extend.total = _total;
|
268
|
+
cacheItem._extend.origin_total = _total;
|
269
|
+
const _isEdit = !!state.service.cacheItem;
|
270
|
+
if (_isEdit) {
|
271
|
+
cacheItem._id = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._id;
|
272
|
+
cacheItem.new = 0;
|
273
|
+
}
|
274
|
+
if (renderMode === "current") {
|
275
|
+
cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
|
276
|
+
}
|
277
|
+
cacheItem = (0, import_utils3.getProductExtend)({
|
278
|
+
cacheItem,
|
279
|
+
state,
|
280
|
+
isDisabledTime: true
|
281
|
+
});
|
282
|
+
if (state.renderType === "eventBooking") {
|
283
|
+
cacheItem.autoClose = false;
|
284
|
+
}
|
285
|
+
if (cacheItem.autoClose) {
|
286
|
+
cacheItem.autoClose = false;
|
287
|
+
cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
|
288
|
+
let { list: _list, quantity } = (0, import_utils6.addService)(
|
289
|
+
[...state.service.value],
|
290
|
+
cacheItem,
|
291
|
+
state
|
292
|
+
);
|
293
|
+
(_b2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _b2.call(
|
294
|
+
Toast,
|
295
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, cacheItem.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(
|
296
|
+
quantity || 1
|
297
|
+
)))
|
298
|
+
);
|
299
|
+
(0, import_utils6.addServiceScroll)(e.rowKey, cacheItem);
|
300
|
+
try {
|
301
|
+
if (((_g2 = (_f2 = (_e2 = (_d2 = (_c2 = context.appHelper.utils.store) == null ? void 0 : _c2.getState) == null ? void 0 : _d2.call(_c2)) == null ? void 0 : _e2.global) == null ? void 0 : _f2.globalConfig) == null ? void 0 : _g2.id) === 2155) {
|
302
|
+
const val = _list == null ? void 0 : _list.map((s) => {
|
303
|
+
return {
|
304
|
+
product_id: s == null ? void 0 : s.product_id,
|
305
|
+
detailId: s == null ? void 0 : s.id,
|
306
|
+
detailProductId: s == null ? void 0 : s.product_id,
|
307
|
+
product_name: s == null ? void 0 : s.title,
|
308
|
+
price: s == null ? void 0 : s.price,
|
309
|
+
_id: s == null ? void 0 : s._id,
|
310
|
+
_key: s == null ? void 0 : s._key,
|
311
|
+
_serviceKey: s == null ? void 0 : s._serviceKey
|
312
|
+
};
|
313
|
+
});
|
314
|
+
const sendData = {
|
315
|
+
product_id: item == null ? void 0 : item.id,
|
316
|
+
detailId: _detail == null ? void 0 : _detail.id,
|
317
|
+
detailProductId: _detail == null ? void 0 : _detail.product_id,
|
318
|
+
product_name: item == null ? void 0 : item.title,
|
319
|
+
price: _detail == null ? void 0 : _detail.price,
|
320
|
+
serviceVal: val
|
321
|
+
};
|
322
|
+
(0, import_utils.sendWarningLog)({
|
323
|
+
title: "addService",
|
324
|
+
content: [
|
325
|
+
{ key: "添加数据", value: JSON.stringify(sendData) },
|
326
|
+
{
|
327
|
+
key: "日期",
|
328
|
+
value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
|
329
|
+
}
|
330
|
+
]
|
331
|
+
});
|
332
|
+
}
|
333
|
+
} catch (error) {
|
334
|
+
}
|
335
|
+
dispatch({
|
336
|
+
type: "setService",
|
337
|
+
payload: {
|
338
|
+
addModal: false,
|
339
|
+
value: _list,
|
340
|
+
edit: true,
|
341
|
+
changeService: false
|
342
|
+
}
|
343
|
+
});
|
344
|
+
} else {
|
345
|
+
openBookingEditModal();
|
346
|
+
dispatch({
|
347
|
+
type: "setService",
|
348
|
+
payload: {
|
349
|
+
editModal: true,
|
350
|
+
cacheItem,
|
351
|
+
addModal: !cacheItem.autoClose,
|
352
|
+
changeService: false
|
353
|
+
}
|
354
|
+
});
|
355
|
+
onEdit == null ? void 0 : onEdit(cacheItem);
|
356
|
+
}
|
357
|
+
};
|
358
|
+
if (cacheValues) {
|
359
|
+
callback(cacheValues, "", item);
|
360
|
+
return;
|
361
|
+
}
|
362
|
+
console.time("打开弹窗");
|
217
363
|
state.action({
|
218
364
|
type: "pisell1.handleOpenProductModal",
|
219
365
|
data: {
|
@@ -234,132 +380,7 @@ var AddSerivce = (props) => {
|
|
234
380
|
onCancel: () => {
|
235
381
|
setCurrentProduct(null);
|
236
382
|
},
|
237
|
-
callback
|
238
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
239
|
-
setCurrentProduct(null);
|
240
|
-
if (lock) {
|
241
|
-
return;
|
242
|
-
}
|
243
|
-
lock = true;
|
244
|
-
setTimeout(() => {
|
245
|
-
lock = false;
|
246
|
-
}, 2e3);
|
247
|
-
if (!isBooking4) {
|
248
|
-
const data = await createBookingData({
|
249
|
-
product: { ...detail || item, _params: e }
|
250
|
-
});
|
251
|
-
createBooking({ booking: data });
|
252
|
-
return;
|
253
|
-
}
|
254
|
-
const _detail = detail || item;
|
255
|
-
const other = JSON.parse(JSON.stringify(e));
|
256
|
-
other.session = e.session;
|
257
|
-
let cacheItem = {
|
258
|
-
..._detail,
|
259
|
-
product_id: item.id,
|
260
|
-
_id: (0, import_utils.getUniqueId)(),
|
261
|
-
_key: e.key,
|
262
|
-
_extend: {
|
263
|
-
start_date: state.date.value,
|
264
|
-
quantity: (e == null ? void 0 : e.quantity) || 1,
|
265
|
-
price: _detail.price,
|
266
|
-
product_name: item.title,
|
267
|
-
other
|
268
|
-
},
|
269
|
-
new: 1
|
270
|
-
};
|
271
|
-
let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
|
272
|
-
cacheItem._extend.total = _total;
|
273
|
-
cacheItem._extend.origin_total = _total;
|
274
|
-
const _isEdit = !!state.service.cacheItem;
|
275
|
-
if (_isEdit) {
|
276
|
-
cacheItem._id = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._id;
|
277
|
-
cacheItem.new = 0;
|
278
|
-
}
|
279
|
-
if (renderMode === "current") {
|
280
|
-
cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
|
281
|
-
}
|
282
|
-
cacheItem = (0, import_utils3.getProductExtend)({
|
283
|
-
cacheItem,
|
284
|
-
state,
|
285
|
-
isDisabledTime: true
|
286
|
-
});
|
287
|
-
if (state.renderType === "eventBooking") {
|
288
|
-
cacheItem.autoClose = false;
|
289
|
-
}
|
290
|
-
if (cacheItem.autoClose) {
|
291
|
-
cacheItem.autoClose = false;
|
292
|
-
cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
|
293
|
-
let { list: _list, quantity } = (0, import_utils6.addService)(
|
294
|
-
[...state.service.value],
|
295
|
-
cacheItem,
|
296
|
-
state
|
297
|
-
);
|
298
|
-
(_b2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _b2.call(
|
299
|
-
Toast,
|
300
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, cacheItem.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(
|
301
|
-
quantity || 1
|
302
|
-
)))
|
303
|
-
);
|
304
|
-
(0, import_utils6.addServiceScroll)(e.rowKey, cacheItem);
|
305
|
-
try {
|
306
|
-
if (((_g2 = (_f2 = (_e2 = (_d2 = (_c2 = context.appHelper.utils.store) == null ? void 0 : _c2.getState) == null ? void 0 : _d2.call(_c2)) == null ? void 0 : _e2.global) == null ? void 0 : _f2.globalConfig) == null ? void 0 : _g2.id) === 2155) {
|
307
|
-
const val = _list == null ? void 0 : _list.map((s) => {
|
308
|
-
return {
|
309
|
-
product_id: s == null ? void 0 : s.product_id,
|
310
|
-
detailId: s == null ? void 0 : s.id,
|
311
|
-
detailProductId: s == null ? void 0 : s.product_id,
|
312
|
-
product_name: s == null ? void 0 : s.title,
|
313
|
-
price: s == null ? void 0 : s.price,
|
314
|
-
_id: s == null ? void 0 : s._id,
|
315
|
-
_key: s == null ? void 0 : s._key,
|
316
|
-
_serviceKey: s == null ? void 0 : s._serviceKey
|
317
|
-
};
|
318
|
-
});
|
319
|
-
const sendData = {
|
320
|
-
product_id: item == null ? void 0 : item.id,
|
321
|
-
detailId: _detail == null ? void 0 : _detail.id,
|
322
|
-
detailProductId: _detail == null ? void 0 : _detail.product_id,
|
323
|
-
product_name: item == null ? void 0 : item.title,
|
324
|
-
price: _detail == null ? void 0 : _detail.price,
|
325
|
-
serviceVal: val
|
326
|
-
};
|
327
|
-
(0, import_utils.sendWarningLog)({
|
328
|
-
title: "addService",
|
329
|
-
content: [
|
330
|
-
{ key: "添加数据", value: JSON.stringify(sendData) },
|
331
|
-
{
|
332
|
-
key: "日期",
|
333
|
-
value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
|
334
|
-
}
|
335
|
-
]
|
336
|
-
});
|
337
|
-
}
|
338
|
-
} catch (error) {
|
339
|
-
}
|
340
|
-
dispatch({
|
341
|
-
type: "setService",
|
342
|
-
payload: {
|
343
|
-
addModal: false,
|
344
|
-
value: _list,
|
345
|
-
edit: true,
|
346
|
-
changeService: false
|
347
|
-
}
|
348
|
-
});
|
349
|
-
} else {
|
350
|
-
openBookingEditModal();
|
351
|
-
dispatch({
|
352
|
-
type: "setService",
|
353
|
-
payload: {
|
354
|
-
editModal: true,
|
355
|
-
cacheItem,
|
356
|
-
addModal: !cacheItem.autoClose,
|
357
|
-
changeService: false
|
358
|
-
}
|
359
|
-
});
|
360
|
-
onEdit == null ? void 0 : onEdit(cacheItem);
|
361
|
-
}
|
362
|
-
}
|
383
|
+
callback
|
363
384
|
});
|
364
385
|
}
|
365
386
|
);
|