@pisell/private-materials 6.3.139 → 6.3.140
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 +5 -5
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +6 -6
- package/es/components/scanOrder/components/Cart/index.js +127 -56
- package/es/components/scanOrder/components/Cart/index.less +11 -5
- package/es/components/scanOrder/components/Check/index.js +85 -80
- package/es/components/scanOrder/components/Content/index.js +345 -162
- package/es/components/scanOrder/components/Menu/index.d.ts +11 -0
- package/es/components/scanOrder/components/Menu/index.js +140 -169
- package/es/components/scanOrder/components/Voucher/index.d.ts +8 -0
- package/es/components/scanOrder/components/Voucher/index.js +250 -0
- package/es/components/scanOrder/context.js +38 -13
- package/es/components/scanOrder/hooks.js +4 -1
- package/es/components/scanOrder/locales.d.ts +65 -0
- package/es/components/scanOrder/locales.js +65 -0
- package/es/components/scanOrder/types.d.ts +10 -0
- package/es/components/scanOrder/utils/toShoppingCartProducts.d.ts +1 -0
- package/es/components/scanOrder/utils/toShoppingCartProducts.js +137 -9
- package/es/components/scanOrder/utils/transformProductDetail.js +21 -4
- package/es/components/venueBooking/components/Addons/index.js +42 -33
- package/es/components/venueBooking/components/Cart/index.js +26 -14
- package/lib/components/scanOrder/components/Cart/index.js +79 -24
- package/lib/components/scanOrder/components/Cart/index.less +11 -5
- package/lib/components/scanOrder/components/Check/index.js +28 -23
- package/lib/components/scanOrder/components/Content/index.js +132 -42
- package/lib/components/scanOrder/components/Menu/index.d.ts +11 -0
- package/lib/components/scanOrder/components/Menu/index.js +23 -36
- package/lib/components/scanOrder/components/Voucher/index.d.ts +8 -0
- package/lib/components/scanOrder/components/Voucher/index.js +162 -0
- package/lib/components/scanOrder/context.js +21 -10
- package/lib/components/scanOrder/hooks.js +4 -1
- package/lib/components/scanOrder/locales.d.ts +65 -0
- package/lib/components/scanOrder/locales.js +65 -0
- package/lib/components/scanOrder/types.d.ts +10 -0
- package/lib/components/scanOrder/utils/toShoppingCartProducts.d.ts +1 -0
- package/lib/components/scanOrder/utils/toShoppingCartProducts.js +88 -6
- package/lib/components/scanOrder/utils/transformProductDetail.js +10 -3
- package/lib/components/venueBooking/components/Addons/index.js +15 -8
- package/lib/components/venueBooking/components/Cart/index.js +8 -2
- package/package.json +1 -1
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface MenuProps {
|
|
3
3
|
onCheckout: () => void;
|
|
4
|
+
/**
|
|
5
|
+
* 商品列表(由上层 ReadyState 持有,配合 onEnsureProductList 做幂等拉取与持久化:
|
|
6
|
+
* 切 step 回到 product 时 Menu 会 remount,但 productList 在 ReadyState 不会丢)
|
|
7
|
+
*/
|
|
8
|
+
productList: any[];
|
|
9
|
+
/**
|
|
10
|
+
* 幂等触发商品列表拉取。Menu mount 时调用:
|
|
11
|
+
* - 首次:真发请求
|
|
12
|
+
* - 后续(如从 check 返回 product):命中缓存,直接短路,不重复发请求
|
|
13
|
+
*/
|
|
14
|
+
onEnsureProductList: () => Promise<void>;
|
|
4
15
|
}
|
|
5
16
|
export default function Menu(props: MenuProps): JSX.Element;
|
|
6
17
|
export {};
|
|
@@ -13,17 +13,18 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
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
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
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
16
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
17
17
|
import ProductSelect from "../../../../plus/productSelect";
|
|
18
18
|
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
19
19
|
import { useScanOrderContext } from "../../context";
|
|
20
20
|
import { isMobile, locales } from '@pisell/utils';
|
|
21
|
-
import { Modal } from 'antd';
|
|
22
21
|
import { PisellScrollView } from '@pisell/materials';
|
|
23
22
|
import { transformProductDetailToOrderProduct } from "../../utils/transformProductDetail";
|
|
24
23
|
export default function Menu(props) {
|
|
25
24
|
var _scrollRef$current;
|
|
26
|
-
var onCheckout = props.onCheckout
|
|
25
|
+
var onCheckout = props.onCheckout,
|
|
26
|
+
productList = props.productList,
|
|
27
|
+
onEnsureProductList = props.onEnsureProductList;
|
|
27
28
|
var context = useEngineContext();
|
|
28
29
|
var _ref = context.appHelper || {},
|
|
29
30
|
utils = _ref.utils;
|
|
@@ -36,201 +37,163 @@ export default function Menu(props) {
|
|
|
36
37
|
dineInConfig = _useState2[0],
|
|
37
38
|
setDineInConfig = _useState2[1];
|
|
38
39
|
// 去读 pisellos 内的配置
|
|
39
|
-
var getConfig = /*#__PURE__*/function () {
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}));
|
|
59
|
-
return function getConfig() {
|
|
60
|
-
return _ref2.apply(this, arguments);
|
|
61
|
-
};
|
|
62
|
-
}();
|
|
63
|
-
getConfig();
|
|
64
|
-
var _useState3 = useState([]),
|
|
65
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
66
|
-
productList = _useState4[0],
|
|
67
|
-
setProductList = _useState4[1];
|
|
40
|
+
var getConfig = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
41
|
+
var _otherParams$dineInCo;
|
|
42
|
+
var otherParams, dineInConfig;
|
|
43
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
44
|
+
while (1) switch (_context.prev = _context.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
_context.next = 2;
|
|
47
|
+
return runModuleAction('getOtherParams');
|
|
48
|
+
case 2:
|
|
49
|
+
otherParams = _context.sent;
|
|
50
|
+
console.log('otherParams >>>>> ', otherParams);
|
|
51
|
+
dineInConfig = (_otherParams$dineInCo = otherParams === null || otherParams === void 0 ? void 0 : otherParams.dineInConfig) !== null && _otherParams$dineInCo !== void 0 ? _otherParams$dineInCo : {};
|
|
52
|
+
setDineInConfig(dineInConfig);
|
|
53
|
+
case 6:
|
|
54
|
+
case "end":
|
|
55
|
+
return _context.stop();
|
|
56
|
+
}
|
|
57
|
+
}, _callee);
|
|
58
|
+
})), [runModuleAction]);
|
|
68
59
|
useEffect(function () {
|
|
69
|
-
|
|
70
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
71
|
-
var res;
|
|
72
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
73
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
74
|
-
case 0:
|
|
75
|
-
_context2.next = 2;
|
|
76
|
-
return runModuleAction('getProductList');
|
|
77
|
-
case 2:
|
|
78
|
-
res = _context2.sent;
|
|
79
|
-
console.log('getProductList >>>>> ', res);
|
|
80
|
-
if (Array.isArray(res)) {
|
|
81
|
-
setProductList(res);
|
|
82
|
-
} else {
|
|
83
|
-
Modal.confirm({
|
|
84
|
-
title: res.message,
|
|
85
|
-
okText: String(locales.getText('pisell2.event.confirm') || 'OK'),
|
|
86
|
-
cancelButtonProps: {
|
|
87
|
-
style: {
|
|
88
|
-
display: 'none'
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
maskClosable: false,
|
|
92
|
-
onOk: function onOk() {
|
|
93
|
-
location.replace('/');
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
case 5:
|
|
98
|
-
case "end":
|
|
99
|
-
return _context2.stop();
|
|
100
|
-
}
|
|
101
|
-
}, _callee2);
|
|
102
|
-
}));
|
|
103
|
-
return function fetchProductList() {
|
|
104
|
-
return _ref3.apply(this, arguments);
|
|
105
|
-
};
|
|
106
|
-
}();
|
|
107
|
-
fetchProductList();
|
|
60
|
+
getConfig();
|
|
108
61
|
}, []);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
void onEnsureProductList();
|
|
64
|
+
}, [onEnsureProductList]);
|
|
109
65
|
var scrollRef = useRef(null);
|
|
110
66
|
var isMobileView = isMobile();
|
|
111
67
|
var height = window.innerHeight - 100;
|
|
112
68
|
var addOrderProduct = /*#__PURE__*/function () {
|
|
113
|
-
var
|
|
69
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
114
70
|
var orderProduct, sourceData;
|
|
115
|
-
return _regeneratorRuntime().wrap(function
|
|
116
|
-
while (1) switch (
|
|
71
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
72
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
117
73
|
case 0:
|
|
118
74
|
orderProduct = params.orderProduct, sourceData = params.sourceData;
|
|
119
|
-
|
|
120
|
-
|
|
75
|
+
_context2.prev = 1;
|
|
76
|
+
_context2.next = 4;
|
|
121
77
|
return runModuleAction('addProductToOrder', orderProduct);
|
|
122
78
|
case 4:
|
|
123
|
-
|
|
79
|
+
_context2.next = 6;
|
|
124
80
|
return refreshViewModel();
|
|
125
81
|
case 6:
|
|
126
|
-
|
|
82
|
+
_context2.next = 11;
|
|
127
83
|
break;
|
|
128
84
|
case 8:
|
|
129
|
-
|
|
130
|
-
|
|
85
|
+
_context2.prev = 8;
|
|
86
|
+
_context2.t0 = _context2["catch"](1);
|
|
131
87
|
console.error('[scanOrder] addProductToOrder failed', {
|
|
132
|
-
error:
|
|
88
|
+
error: _context2.t0,
|
|
133
89
|
sourceData: sourceData,
|
|
134
90
|
mappedData: orderProduct
|
|
135
91
|
});
|
|
136
92
|
case 11:
|
|
137
93
|
case "end":
|
|
138
|
-
return
|
|
94
|
+
return _context2.stop();
|
|
139
95
|
}
|
|
140
|
-
},
|
|
96
|
+
}, _callee2, null, [[1, 8]]);
|
|
141
97
|
}));
|
|
142
98
|
return function addOrderProduct(_x) {
|
|
143
|
-
return
|
|
99
|
+
return _ref3.apply(this, arguments);
|
|
144
100
|
};
|
|
145
101
|
}();
|
|
146
102
|
var removeOrderProduct = /*#__PURE__*/function () {
|
|
147
|
-
var
|
|
148
|
-
var product_id, product_variant_id, sourceData;
|
|
149
|
-
return _regeneratorRuntime().wrap(function
|
|
150
|
-
while (1) switch (
|
|
103
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
104
|
+
var product_id, product_variant_id, identity_key, sourceData;
|
|
105
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
106
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
151
107
|
case 0:
|
|
152
|
-
product_id = params.product_id, product_variant_id = params.product_variant_id, sourceData = params.sourceData;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return runModuleAction('removeProductFromOrder', {
|
|
108
|
+
product_id = params.product_id, product_variant_id = params.product_variant_id, identity_key = params.identity_key, sourceData = params.sourceData;
|
|
109
|
+
_context3.prev = 1;
|
|
110
|
+
_context3.next = 4;
|
|
111
|
+
return runModuleAction('removeProductFromOrder', _objectSpread({
|
|
156
112
|
product_id: product_id,
|
|
157
113
|
product_variant_id: product_variant_id
|
|
158
|
-
}
|
|
114
|
+
}, identity_key ? {
|
|
115
|
+
identity_key: identity_key
|
|
116
|
+
} : {}));
|
|
159
117
|
case 4:
|
|
160
|
-
|
|
118
|
+
_context3.next = 6;
|
|
161
119
|
return refreshViewModel();
|
|
162
120
|
case 6:
|
|
163
|
-
|
|
121
|
+
_context3.next = 11;
|
|
164
122
|
break;
|
|
165
123
|
case 8:
|
|
166
|
-
|
|
167
|
-
|
|
124
|
+
_context3.prev = 8;
|
|
125
|
+
_context3.t0 = _context3["catch"](1);
|
|
168
126
|
console.error('[scanOrder] removeProductFromOrder failed', {
|
|
169
|
-
error:
|
|
127
|
+
error: _context3.t0,
|
|
170
128
|
sourceData: sourceData,
|
|
171
129
|
product_id: product_id,
|
|
172
|
-
product_variant_id: product_variant_id
|
|
130
|
+
product_variant_id: product_variant_id,
|
|
131
|
+
identity_key: identity_key
|
|
173
132
|
});
|
|
174
133
|
case 11:
|
|
175
134
|
case "end":
|
|
176
|
-
return
|
|
135
|
+
return _context3.stop();
|
|
177
136
|
}
|
|
178
|
-
},
|
|
137
|
+
}, _callee3, null, [[1, 8]]);
|
|
179
138
|
}));
|
|
180
139
|
return function removeOrderProduct(_x2) {
|
|
181
|
-
return
|
|
140
|
+
return _ref4.apply(this, arguments);
|
|
182
141
|
};
|
|
183
142
|
}();
|
|
184
143
|
var updateOrderProduct = /*#__PURE__*/function () {
|
|
185
|
-
var
|
|
186
|
-
var product_id, product_variant_id, updates, sourceData;
|
|
187
|
-
return _regeneratorRuntime().wrap(function
|
|
188
|
-
while (1) switch (
|
|
144
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
145
|
+
var product_id, product_variant_id, identity_key, updates, sourceData;
|
|
146
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
147
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
189
148
|
case 0:
|
|
190
|
-
product_id = params.product_id, product_variant_id = params.product_variant_id, updates = params.updates, sourceData = params.sourceData;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return runModuleAction('updateProductInOrder', {
|
|
149
|
+
product_id = params.product_id, product_variant_id = params.product_variant_id, identity_key = params.identity_key, updates = params.updates, sourceData = params.sourceData;
|
|
150
|
+
_context4.prev = 1;
|
|
151
|
+
_context4.next = 4;
|
|
152
|
+
return runModuleAction('updateProductInOrder', _objectSpread(_objectSpread({
|
|
194
153
|
product_id: product_id,
|
|
195
|
-
product_variant_id: product_variant_id
|
|
154
|
+
product_variant_id: product_variant_id
|
|
155
|
+
}, identity_key ? {
|
|
156
|
+
identity_key: identity_key
|
|
157
|
+
} : {}), {}, {
|
|
196
158
|
updates: updates
|
|
197
|
-
});
|
|
159
|
+
}));
|
|
198
160
|
case 4:
|
|
199
|
-
|
|
161
|
+
_context4.next = 6;
|
|
200
162
|
return refreshViewModel();
|
|
201
163
|
case 6:
|
|
202
|
-
|
|
164
|
+
_context4.next = 11;
|
|
203
165
|
break;
|
|
204
166
|
case 8:
|
|
205
|
-
|
|
206
|
-
|
|
167
|
+
_context4.prev = 8;
|
|
168
|
+
_context4.t0 = _context4["catch"](1);
|
|
207
169
|
console.error('[scanOrder] updateProductInOrder failed', {
|
|
208
|
-
error:
|
|
170
|
+
error: _context4.t0,
|
|
209
171
|
sourceData: sourceData,
|
|
210
172
|
product_id: product_id,
|
|
211
173
|
product_variant_id: product_variant_id,
|
|
174
|
+
identity_key: identity_key,
|
|
212
175
|
updates: updates
|
|
213
176
|
});
|
|
214
177
|
case 11:
|
|
215
178
|
case "end":
|
|
216
|
-
return
|
|
179
|
+
return _context4.stop();
|
|
217
180
|
}
|
|
218
|
-
},
|
|
181
|
+
}, _callee4, null, [[1, 8]]);
|
|
219
182
|
}));
|
|
220
183
|
return function updateOrderProduct(_x3) {
|
|
221
|
-
return
|
|
184
|
+
return _ref5.apply(this, arguments);
|
|
222
185
|
};
|
|
223
186
|
}();
|
|
224
187
|
var handleSelectProduct = /*#__PURE__*/function () {
|
|
225
|
-
var
|
|
226
|
-
var sourceItem, _item$option, _item$bundle, _item$price, _item$product_id,
|
|
227
|
-
return _regeneratorRuntime().wrap(function
|
|
228
|
-
while (1) switch (
|
|
188
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(item, clickType, meta) {
|
|
189
|
+
var sourceItem, _item$option, _item$bundle, _item$price, _item$product_id, _ref7, _meta$quantity, _orderProduct$product, _orderProduct$product4, quantityData, orderProduct, nextQuantity, productVariantId, normalizedQuantity, cartItems, existedCartItem, existedIdentityKey, _orderProduct$product3;
|
|
190
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
191
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
229
192
|
case 0:
|
|
230
193
|
console.log(item, clickType, meta);
|
|
231
194
|
sourceItem = (meta === null || meta === void 0 ? void 0 : meta.product) || item;
|
|
232
195
|
if (!((meta === null || meta === void 0 ? void 0 : meta.intent) === 'quantity')) {
|
|
233
|
-
|
|
196
|
+
_context6.next = 29;
|
|
234
197
|
break;
|
|
235
198
|
}
|
|
236
199
|
quantityData = _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -246,71 +209,75 @@ export default function Menu(props) {
|
|
|
246
209
|
sourceItem: sourceItem
|
|
247
210
|
});
|
|
248
211
|
if (orderProduct) {
|
|
249
|
-
|
|
212
|
+
_context6.next = 8;
|
|
250
213
|
break;
|
|
251
214
|
}
|
|
252
215
|
console.warn('[scanOrder] quantity add missing product_id', quantityData);
|
|
253
|
-
return
|
|
216
|
+
return _context6.abrupt("return");
|
|
254
217
|
case 8:
|
|
255
|
-
nextQuantity = Number((
|
|
218
|
+
nextQuantity = Number((_ref7 = (_meta$quantity = meta === null || meta === void 0 ? void 0 : meta.quantity) !== null && _meta$quantity !== void 0 ? _meta$quantity : quantityData === null || quantityData === void 0 ? void 0 : quantityData.quantity) !== null && _ref7 !== void 0 ? _ref7 : 0);
|
|
256
219
|
productVariantId = Number((_orderProduct$product = orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.product_variant_id) !== null && _orderProduct$product !== void 0 ? _orderProduct$product : 0);
|
|
257
220
|
if (!Number.isNaN(productVariantId)) {
|
|
258
|
-
|
|
221
|
+
_context6.next = 13;
|
|
259
222
|
break;
|
|
260
223
|
}
|
|
261
224
|
console.warn('[scanOrder] quantity action missing product_variant_id', {
|
|
262
225
|
quantityData: quantityData,
|
|
263
226
|
orderProduct: orderProduct
|
|
264
227
|
});
|
|
265
|
-
return
|
|
228
|
+
return _context6.abrupt("return");
|
|
266
229
|
case 13:
|
|
267
230
|
normalizedQuantity = Number.isNaN(nextQuantity) ? 0 : Math.max(0, Math.floor(nextQuantity));
|
|
231
|
+
cartItems = Array.isArray(viewModel === null || viewModel === void 0 ? void 0 : viewModel.cartItems) ? viewModel.cartItems : []; // 不透明 identity 契约:同 SKU 多行场景下,必须直接从已存在的 cartItem 上取 identity_key,
|
|
232
|
+
// 否则 update / remove 容易误命中其它选项相同的行。
|
|
233
|
+
existedCartItem = cartItems.find(function (cartItem) {
|
|
234
|
+
var _cartItem$product_id, _orderProduct$product2, _cartItem$product_var;
|
|
235
|
+
return String((_cartItem$product_id = cartItem === null || cartItem === void 0 ? void 0 : cartItem.product_id) !== null && _cartItem$product_id !== void 0 ? _cartItem$product_id : null) === String((_orderProduct$product2 = orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.product_id) !== null && _orderProduct$product2 !== void 0 ? _orderProduct$product2 : null) && Number((_cartItem$product_var = cartItem === null || cartItem === void 0 ? void 0 : cartItem.product_variant_id) !== null && _cartItem$product_var !== void 0 ? _cartItem$product_var : 0) === productVariantId;
|
|
236
|
+
});
|
|
237
|
+
existedIdentityKey = typeof (existedCartItem === null || existedCartItem === void 0 ? void 0 : existedCartItem.identity_key) === 'string' && existedCartItem.identity_key.length > 0 ? existedCartItem.identity_key : undefined;
|
|
268
238
|
if (!(normalizedQuantity <= 0)) {
|
|
269
|
-
|
|
239
|
+
_context6.next = 21;
|
|
270
240
|
break;
|
|
271
241
|
}
|
|
272
|
-
|
|
242
|
+
_context6.next = 20;
|
|
273
243
|
return removeOrderProduct({
|
|
274
|
-
product_id: (_orderProduct$
|
|
244
|
+
product_id: (_orderProduct$product3 = orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.product_id) !== null && _orderProduct$product3 !== void 0 ? _orderProduct$product3 : null,
|
|
275
245
|
product_variant_id: productVariantId,
|
|
246
|
+
identity_key: existedIdentityKey,
|
|
276
247
|
sourceData: quantityData
|
|
277
248
|
});
|
|
278
|
-
case
|
|
279
|
-
return
|
|
280
|
-
case
|
|
281
|
-
cartItems = Array.isArray(viewModel === null || viewModel === void 0 ? void 0 : viewModel.cartItems) ? viewModel.cartItems : [];
|
|
282
|
-
existedCartItem = cartItems.find(function (cartItem) {
|
|
283
|
-
var _cartItem$product_id, _orderProduct$product3, _cartItem$product_var;
|
|
284
|
-
return String((_cartItem$product_id = cartItem === null || cartItem === void 0 ? void 0 : cartItem.product_id) !== null && _cartItem$product_id !== void 0 ? _cartItem$product_id : null) === String((_orderProduct$product3 = orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.product_id) !== null && _orderProduct$product3 !== void 0 ? _orderProduct$product3 : null) && Number((_cartItem$product_var = cartItem === null || cartItem === void 0 ? void 0 : cartItem.product_variant_id) !== null && _cartItem$product_var !== void 0 ? _cartItem$product_var : 0) === productVariantId;
|
|
285
|
-
});
|
|
249
|
+
case 20:
|
|
250
|
+
return _context6.abrupt("return");
|
|
251
|
+
case 21:
|
|
286
252
|
if (existedCartItem) {
|
|
287
|
-
|
|
253
|
+
_context6.next = 25;
|
|
288
254
|
break;
|
|
289
255
|
}
|
|
290
|
-
|
|
256
|
+
_context6.next = 24;
|
|
291
257
|
return addOrderProduct({
|
|
292
258
|
orderProduct: _objectSpread(_objectSpread({}, orderProduct), {}, {
|
|
293
259
|
num: normalizedQuantity
|
|
294
260
|
}),
|
|
295
261
|
sourceData: quantityData
|
|
296
262
|
});
|
|
297
|
-
case 23:
|
|
298
|
-
return _context7.abrupt("return");
|
|
299
263
|
case 24:
|
|
300
|
-
|
|
264
|
+
return _context6.abrupt("return");
|
|
265
|
+
case 25:
|
|
266
|
+
_context6.next = 27;
|
|
301
267
|
return updateOrderProduct({
|
|
302
268
|
product_id: (_orderProduct$product4 = orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct.product_id) !== null && _orderProduct$product4 !== void 0 ? _orderProduct$product4 : null,
|
|
303
269
|
product_variant_id: productVariantId,
|
|
270
|
+
identity_key: existedIdentityKey,
|
|
304
271
|
updates: {
|
|
305
272
|
num: normalizedQuantity,
|
|
306
273
|
_origin: orderProduct === null || orderProduct === void 0 ? void 0 : orderProduct._origin
|
|
307
274
|
},
|
|
308
275
|
sourceData: quantityData
|
|
309
276
|
});
|
|
310
|
-
case
|
|
311
|
-
|
|
277
|
+
case 27:
|
|
278
|
+
_context6.next = 30;
|
|
312
279
|
break;
|
|
313
|
-
case
|
|
280
|
+
case 29:
|
|
314
281
|
utils === null || utils === void 0 || utils.action({
|
|
315
282
|
type: 'pisell1.productDetail',
|
|
316
283
|
data: {
|
|
@@ -320,21 +287,21 @@ export default function Menu(props) {
|
|
|
320
287
|
setting: {
|
|
321
288
|
can_input: true,
|
|
322
289
|
item_max_length: 1,
|
|
323
|
-
is_detail_open:
|
|
290
|
+
is_detail_open: false
|
|
324
291
|
}
|
|
325
292
|
},
|
|
326
293
|
callback: function () {
|
|
327
|
-
var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
294
|
+
var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
|
|
328
295
|
var _item$product_id2;
|
|
329
296
|
var orderProduct;
|
|
330
|
-
return _regeneratorRuntime().wrap(function
|
|
331
|
-
while (1) switch (
|
|
297
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
298
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
332
299
|
case 0:
|
|
333
300
|
if (!(data !== null && data !== void 0 && data.isCancel)) {
|
|
334
|
-
|
|
301
|
+
_context5.next = 2;
|
|
335
302
|
break;
|
|
336
303
|
}
|
|
337
|
-
return
|
|
304
|
+
return _context5.abrupt("return");
|
|
338
305
|
case 2:
|
|
339
306
|
orderProduct = transformProductDetailToOrderProduct({
|
|
340
307
|
payload: data,
|
|
@@ -342,22 +309,22 @@ export default function Menu(props) {
|
|
|
342
309
|
sourceItem: sourceItem
|
|
343
310
|
});
|
|
344
311
|
if (orderProduct) {
|
|
345
|
-
|
|
312
|
+
_context5.next = 6;
|
|
346
313
|
break;
|
|
347
314
|
}
|
|
348
315
|
console.warn('[scanOrder] productDetail callback missing product_id', data);
|
|
349
|
-
return
|
|
316
|
+
return _context5.abrupt("return");
|
|
350
317
|
case 6:
|
|
351
|
-
|
|
318
|
+
_context5.next = 8;
|
|
352
319
|
return addOrderProduct({
|
|
353
320
|
orderProduct: orderProduct,
|
|
354
321
|
sourceData: data
|
|
355
322
|
});
|
|
356
323
|
case 8:
|
|
357
324
|
case "end":
|
|
358
|
-
return
|
|
325
|
+
return _context5.stop();
|
|
359
326
|
}
|
|
360
|
-
},
|
|
327
|
+
}, _callee5);
|
|
361
328
|
}));
|
|
362
329
|
function callback(_x7) {
|
|
363
330
|
return _callback.apply(this, arguments);
|
|
@@ -365,14 +332,14 @@ export default function Menu(props) {
|
|
|
365
332
|
return callback;
|
|
366
333
|
}()
|
|
367
334
|
});
|
|
368
|
-
case
|
|
335
|
+
case 30:
|
|
369
336
|
case "end":
|
|
370
|
-
return
|
|
337
|
+
return _context6.stop();
|
|
371
338
|
}
|
|
372
|
-
},
|
|
339
|
+
}, _callee6);
|
|
373
340
|
}));
|
|
374
341
|
return function handleSelectProduct(_x4, _x5, _x6) {
|
|
375
|
-
return
|
|
342
|
+
return _ref6.apply(this, arguments);
|
|
376
343
|
};
|
|
377
344
|
}();
|
|
378
345
|
var productSelectNode = /*#__PURE__*/React.createElement(ProductSelect, {
|
|
@@ -407,11 +374,15 @@ export default function Menu(props) {
|
|
|
407
374
|
},
|
|
408
375
|
cartElementId: "#scan-order-v2-cart-btn"
|
|
409
376
|
});
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
377
|
+
|
|
378
|
+
// if (isMobileView) {
|
|
379
|
+
// return (
|
|
380
|
+
// <div className="pisell-scan-menu pisell-scan-menu-mobile" ref={scrollRef}>
|
|
381
|
+
// {productSelectNode}
|
|
382
|
+
// </div>
|
|
383
|
+
// );
|
|
384
|
+
// }
|
|
385
|
+
|
|
415
386
|
return /*#__PURE__*/React.createElement("div", {
|
|
416
387
|
className: "pisell-scan-menu"
|
|
417
388
|
}, /*#__PURE__*/React.createElement(PisellScrollView, {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import '../../../booking/components/voucher/index.less';
|
|
3
|
+
import '../../../appointmentBooking/components/Voucher/index.less';
|
|
4
|
+
/**
|
|
5
|
+
* VoucherCard -- 优惠券/Promotion 区块
|
|
6
|
+
* 嵌入购物车底部,提供券列表展示、勾选、扫码兑码、未登录引导等能力
|
|
7
|
+
*/
|
|
8
|
+
export default function VoucherCard(): JSX.Element;
|