@pisell/private-materials 6.4.50 → 6.4.52
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 +2 -2
- package/build/lowcode/preview.js +145 -153
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/es/components/appointmentBooking/components/Services/index.js +36 -18
- package/es/components/appointmentBooking/hooks.js +6 -0
- package/es/components/booking/components/footer/index.js +12 -1
- package/es/components/booking/editBookingModal/index.js +8 -2
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/locales.d.ts +6 -0
- package/es/components/booking/locales.js +12 -0
- package/es/components/checkout/PaymentModal.js +70 -62
- package/es/components/checkout/components/AmountSummary/index.js +4 -4
- package/es/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
- package/es/components/checkout/components/CashPaymentModule/index.js +14 -10
- package/es/components/eftposPay/linkly/hooks/normal.js +3 -3
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +60 -17
- package/es/components/eftposPay/payo/config.js +10 -10
- package/es/components/eftposPay/serve.js +1 -1
- package/es/components/index.d.ts +3 -1
- package/es/components/index.js +3 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -3
- package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +112 -24
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.js +78 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +9 -0
- package/es/components/pay/toC/utils.js +1 -1
- package/es/components/pinModal/hooks.d.ts +7 -0
- package/es/components/pinModal/hooks.js +65 -0
- package/es/components/pinModal/index.d.ts +4 -0
- package/es/components/pinModal/index.js +98 -0
- package/es/components/pinModal/index.less +44 -0
- package/es/components/pinModal/locales.d.ts +27 -0
- package/es/components/pinModal/locales.js +26 -0
- package/es/components/pinModal/serve.d.ts +6 -0
- package/es/components/pinModal/serve.js +11 -0
- package/es/components/pinModal/types.d.ts +0 -0
- package/es/components/pinModal/types.js +0 -0
- package/es/components/pinVerifyModal/hooks.d.ts +7 -0
- package/es/components/pinVerifyModal/hooks.js +80 -0
- package/es/components/pinVerifyModal/index.d.ts +5 -0
- package/es/components/pinVerifyModal/index.js +218 -0
- package/es/components/pinVerifyModal/index.less +92 -0
- package/es/components/pinVerifyModal/locales.d.ts +24 -0
- package/es/components/pinVerifyModal/locales.js +23 -0
- package/es/components/pinVerifyModal/types.d.ts +33 -0
- package/es/components/pinVerifyModal/types.js +1 -0
- package/es/components/ticketBooking/components/ticketBooking/index.js +56 -10
- package/es/components/ticketBooking/components/timeBar/index.js +2 -1
- package/es/components/walletList/index.js +20 -2
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/lib/components/appointmentBooking/components/Services/index.js +13 -3
- package/lib/components/appointmentBooking/hooks.js +6 -0
- package/lib/components/booking/components/footer/index.js +15 -2
- package/lib/components/booking/editBookingModal/index.js +6 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/locales.d.ts +6 -0
- package/lib/components/booking/locales.js +6 -0
- package/lib/components/checkout/PaymentModal.js +5 -4
- package/lib/components/checkout/components/AmountSummary/index.js +4 -4
- package/lib/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
- package/lib/components/checkout/components/CashPaymentModule/index.js +6 -3
- package/lib/components/eftposPay/linkly/hooks/normal.js +3 -3
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +59 -15
- package/lib/components/eftposPay/payo/config.js +9 -9
- package/lib/components/eftposPay/serve.js +1 -1
- package/lib/components/index.d.ts +3 -1
- package/lib/components/index.js +6 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +84 -36
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.js +18 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +7 -2
- package/lib/components/pay/toC/utils.js +1 -1
- package/lib/components/pinModal/hooks.d.ts +7 -0
- package/lib/components/pinModal/hooks.js +85 -0
- package/lib/components/pinModal/index.d.ts +4 -0
- package/lib/components/pinModal/index.js +88 -0
- package/lib/components/pinModal/index.less +44 -0
- package/lib/components/pinModal/locales.d.ts +27 -0
- package/lib/components/pinModal/locales.js +50 -0
- package/lib/components/pinModal/serve.d.ts +6 -0
- package/lib/components/pinModal/serve.js +37 -0
- package/lib/components/pinModal/types.d.ts +0 -0
- package/lib/components/pinModal/types.js +0 -0
- package/lib/components/pinVerifyModal/hooks.d.ts +7 -0
- package/lib/components/pinVerifyModal/hooks.js +93 -0
- package/lib/components/pinVerifyModal/index.d.ts +5 -0
- package/lib/components/pinVerifyModal/index.js +230 -0
- package/lib/components/pinVerifyModal/index.less +92 -0
- package/lib/components/pinVerifyModal/locales.d.ts +24 -0
- package/lib/components/pinVerifyModal/locales.js +47 -0
- package/lib/components/pinVerifyModal/types.d.ts +33 -0
- package/lib/components/pinVerifyModal/types.js +17 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.js +52 -5
- package/lib/components/ticketBooking/components/timeBar/index.js +2 -1
- package/lib/components/walletList/index.js +19 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lowcode/pin-modal/meta.ts +37 -0
- package/lowcode/pin-verify-modal/meta.ts +80 -0
- package/package.json +4 -4
@@ -99,7 +99,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
99
99
|
},
|
100
100
|
callback: function () {
|
101
101
|
var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
102
|
-
var product, session, startDate, endDate, _data$origin, resources, activeStatus, index, stepList, hasResourceStep, description;
|
102
|
+
var product, res, session, startDate, endDate, _res, _data$origin, resources, activeStatus, _res2, index, stepList, hasResourceStep, description;
|
103
103
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
104
104
|
while (1) switch (_context.prev = _context.next) {
|
105
105
|
case 0:
|
@@ -117,7 +117,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
117
117
|
|
118
118
|
// 零售模版,直接加入购物车
|
119
119
|
if (!isRetailTemplate) {
|
120
|
-
_context.next =
|
120
|
+
_context.next = 12;
|
121
121
|
break;
|
122
122
|
}
|
123
123
|
if (!(data !== null && data !== void 0 && data.isCancel)) {
|
@@ -126,51 +126,69 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
126
126
|
}
|
127
127
|
return _context.abrupt("return");
|
128
128
|
case 8:
|
129
|
-
appointmentBooking.storeProduct(product);
|
129
|
+
res = appointmentBooking.storeProduct(product);
|
130
|
+
if (!(!res.success && res.errorCode === 'not_enough_stock')) {
|
131
|
+
_context.next = 11;
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unuse.stock')));
|
135
|
+
case 11:
|
130
136
|
return _context.abrupt("return");
|
131
|
-
case
|
137
|
+
case 12:
|
132
138
|
session = data === null || data === void 0 ? void 0 : data.session;
|
133
139
|
if (!session) {
|
134
|
-
_context.next =
|
140
|
+
_context.next = 24;
|
135
141
|
break;
|
136
142
|
}
|
137
143
|
startDate = dayjs(session === null || session === void 0 ? void 0 : session.start_at).format('YYYY-MM-DD');
|
138
144
|
endDate = dayjs(session === null || session === void 0 ? void 0 : session.end_at).format('YYYY-MM-DD');
|
139
|
-
appointmentBooking.addProductToCart({
|
145
|
+
_res = appointmentBooking.addProductToCart({
|
140
146
|
product: _objectSpread({}, product),
|
141
147
|
date: {
|
142
148
|
startTime: "".concat(startDate, " ").concat(session === null || session === void 0 ? void 0 : session.start_time),
|
143
149
|
endTime: "".concat(endDate, " ").concat(session === null || session === void 0 ? void 0 : session.end_time)
|
144
150
|
}
|
145
151
|
});
|
146
|
-
|
152
|
+
if (!(!_res.success && _res.errorCode === 'not_enough_stock')) {
|
153
|
+
_context.next = 19;
|
154
|
+
break;
|
155
|
+
}
|
156
|
+
return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unuse.stock')));
|
157
|
+
case 19:
|
158
|
+
appointmentBooking.closeProductDetail();
|
159
|
+
_context.next = 22;
|
147
160
|
return appointmentBooking.getAvailableDate({
|
148
161
|
startDate: startDate,
|
149
162
|
endDate: endDate
|
150
163
|
});
|
151
|
-
case
|
152
|
-
_context.next =
|
164
|
+
case 22:
|
165
|
+
_context.next = 34;
|
153
166
|
break;
|
154
|
-
case
|
167
|
+
case 24:
|
155
168
|
resources = (data === null || data === void 0 || (_data$origin = data.origin) === null || _data$origin === void 0 || (_data$origin = _data$origin.product_resource) === null || _data$origin === void 0 ? void 0 : _data$origin.resources) || [];
|
156
169
|
activeStatus = resources.find(function (item) {
|
157
170
|
return item.status === 1;
|
158
171
|
});
|
159
172
|
if (!(!activeStatus && !appointmentBooking.isTargetNormalProduct(data === null || data === void 0 ? void 0 : data.origin))) {
|
160
|
-
_context.next =
|
173
|
+
_context.next = 28;
|
161
174
|
break;
|
162
175
|
}
|
163
176
|
return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.no.available.service')));
|
164
|
-
case
|
165
|
-
appointmentBooking.storeProduct(product);
|
166
|
-
|
177
|
+
case 28:
|
178
|
+
_res2 = appointmentBooking.storeProduct(product);
|
179
|
+
if (!(!_res2.success && _res2.errorCode === 'not_enough_stock')) {
|
180
|
+
_context.next = 31;
|
181
|
+
break;
|
182
|
+
}
|
183
|
+
return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unuse.stock')));
|
184
|
+
case 31:
|
167
185
|
if (!(type === 'duration')) {
|
168
|
-
_context.next =
|
186
|
+
_context.next = 34;
|
169
187
|
break;
|
170
188
|
}
|
171
|
-
_context.next =
|
189
|
+
_context.next = 34;
|
172
190
|
return appointmentBooking.getAvailableDate();
|
173
|
-
case
|
191
|
+
case 34:
|
174
192
|
appointmentBooking.closeProductDetail();
|
175
193
|
|
176
194
|
// 先选择日期流程
|
@@ -199,7 +217,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
199
217
|
removeStep('select-time');
|
200
218
|
}
|
201
219
|
}
|
202
|
-
case
|
220
|
+
case 36:
|
203
221
|
case "end":
|
204
222
|
return _context.stop();
|
205
223
|
}
|
@@ -206,6 +206,12 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
206
206
|
if (!result) {
|
207
207
|
return Toast(locales.getText('pisell2.appointment.unuse.date'));
|
208
208
|
}
|
209
|
+
var capacityResult = appointmentBooking.checkMaxDurationCapacity();
|
210
|
+
if (!capacityResult.success) {
|
211
|
+
var getMessage = locales.getText('pisell2.appointment.unuse.capacity');
|
212
|
+
var message = typeof getMessage === 'function' ? getMessage(capacityResult.minAvailableCount) : getMessage;
|
213
|
+
return Toast(message);
|
214
|
+
}
|
209
215
|
}
|
210
216
|
if (!isRetailTemplate && currentKey !== null && currentKey !== void 0 && currentKey.startsWith('select-resource')) {
|
211
217
|
var _currentSelectedResou;
|
@@ -845,7 +845,7 @@ var Footer = function Footer(props) {
|
|
845
845
|
*/
|
846
846
|
var handleSave = /*#__PURE__*/function () {
|
847
847
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref6) {
|
848
|
-
var type, _ref6$messageShow, messageShow, _ref6$noSubmit, noSubmit, isHasDayProducts, _setLoading, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, callbackData, values, checkout, subtotal_info, res, isNeedDeposit, api;
|
848
|
+
var type, _ref6$messageShow, messageShow, _ref6$noSubmit, noSubmit, isHasDayProducts, _setLoading, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, _store$getState, _window7, callbackData, values, checkout, subtotal_info, res, isNeedDeposit, api;
|
849
849
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
850
850
|
while (1) switch (_context6.prev = _context6.next) {
|
851
851
|
case 0:
|
@@ -953,6 +953,17 @@ var Footer = function Footer(props) {
|
|
953
953
|
}, {
|
954
954
|
key: '日期',
|
955
955
|
value: dayjs().format('YYYY-MM-DD HH:mm')
|
956
|
+
}, {
|
957
|
+
key: '店铺id',
|
958
|
+
value: store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 || (_store$getState = _store$getState.call(store)) === null || _store$getState === void 0 || (_store$getState = _store$getState.global) === null || _store$getState === void 0 || (_store$getState = _store$getState.globalConfig) === null || _store$getState === void 0 ? void 0 : _store$getState.id
|
959
|
+
}, {
|
960
|
+
key: 'shopApi',
|
961
|
+
value: JSON.stringify((_window7 = window) === null || _window7 === void 0 ? void 0 : _window7.shopApi, function (key, value) {
|
962
|
+
if (typeof value === 'function') {
|
963
|
+
return 'function';
|
964
|
+
}
|
965
|
+
return value;
|
966
|
+
})
|
956
967
|
}]
|
957
968
|
});
|
958
969
|
|
@@ -71,7 +71,7 @@ var EditBookingModal = function EditBookingModal(props, ref) {
|
|
71
71
|
var getInitData = /*#__PURE__*/function () {
|
72
72
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
73
73
|
var _data$fromResource, _data$toResource;
|
74
|
-
var mockProps, _data, _initResourceVal, fromResourceFormId, toResourceFormId, _form_id, _data$toResource2, _formatResources, list, maps, currentForm, relation_id, _currentForm$renderLi, _currentForm$renderLi2, _currentForm$renderLi3, _currentForm$renderLi4, _targetResource, _cloned, _idx, _sameResource;
|
74
|
+
var mockProps, _data, _initResourceVal, fromResourceFormId, toResourceFormId, _form_id, _data$toResource2, _formatResources, list, maps, currentForm, relation_id, _currentForm$renderLi, _currentForm$renderLi2, _currentForm$renderLi3, _currentForm$renderLi4, _targetResource, _cloned, _idx, _sameResource, _targetIdx;
|
75
75
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
76
76
|
while (1) switch (_context.prev = _context.next) {
|
77
77
|
case 0:
|
@@ -129,7 +129,13 @@ var EditBookingModal = function EditBookingModal(props, ref) {
|
|
129
129
|
_cloned[_idx] = _targetResource; // 替换现有对象
|
130
130
|
}
|
131
131
|
} else {
|
132
|
-
|
132
|
+
// 未发现原资源位置(短时间内通过其它渠道修改过资源)
|
133
|
+
_targetIdx = _cloned.findIndex(function (rs) {
|
134
|
+
return rs.relation_id == (_targetResource === null || _targetResource === void 0 ? void 0 : _targetResource.relation_id);
|
135
|
+
}); // 判断是否已经包含了目标资源,不包含则加入进来
|
136
|
+
if (_targetIdx === -1) {
|
137
|
+
_cloned.push(_targetResource); // 添加新对象
|
138
|
+
}
|
133
139
|
}
|
134
140
|
_initResourceVal = _objectSpread(_objectSpread({}, _initResourceVal), {}, _defineProperty({}, _form_id, _cloned));
|
135
141
|
} else {
|
@@ -156,6 +156,8 @@ declare const _default: {
|
|
156
156
|
'pisell2.text.deposit-delete-message': string;
|
157
157
|
'pisell2.text.deposit-paid': string;
|
158
158
|
"pisell2.text.stock": string;
|
159
|
+
'pisell2.appointment.unuse.stock': string;
|
160
|
+
'pisell2.appointment.unuse.capacity': (count: number) => string;
|
159
161
|
'pisell2.text.payment-link': string;
|
160
162
|
'pisell2.text.send-mail': string;
|
161
163
|
'pisell2.text.copy-to-clipboard': string;
|
@@ -458,6 +460,8 @@ declare const _default: {
|
|
458
460
|
'pisell2.text.deposit-delete-message': string;
|
459
461
|
'pisell2.text.deposit-paid': string;
|
460
462
|
"pisell2.text.stock": string;
|
463
|
+
'pisell2.appointment.unuse.stock': string;
|
464
|
+
'pisell2.appointment.unuse.capacity': (count: number) => string;
|
461
465
|
'pisell2.text.payment-link': string;
|
462
466
|
'pisell2.text.send-mail': string;
|
463
467
|
'pisell2.text.copy-to-clipboard': string;
|
@@ -760,6 +764,8 @@ declare const _default: {
|
|
760
764
|
'pisell2.text.deposit-delete-message': string;
|
761
765
|
'pisell2.text.deposit-paid': string;
|
762
766
|
"pisell2.text.stock": string;
|
767
|
+
'pisell2.appointment.unuse.stock': string;
|
768
|
+
'pisell2.appointment.unuse.capacity': (count: number) => string;
|
763
769
|
'pisell2.text.payment-link': string;
|
764
770
|
'pisell2.text.send-mail': string;
|
765
771
|
'pisell2.text.copy-to-clipboard': string;
|
@@ -174,6 +174,10 @@ export default {
|
|
174
174
|
'pisell2.text.deposit-delete-message': "It cannot be restored after deletion. Please confirm the operation.",
|
175
175
|
'pisell2.text.deposit-paid': "Deposit paid",
|
176
176
|
"pisell2.text.stock": "Stock",
|
177
|
+
'pisell2.appointment.unuse.stock': "Not enough stock",
|
178
|
+
'pisell2.appointment.unuse.capacity': function pisell2AppointmentUnuseCapacity(count) {
|
179
|
+
return "Only ".concat(count, " spots available. Please reduce quantity.");
|
180
|
+
},
|
177
181
|
'pisell2.text.payment-link': "Payment link",
|
178
182
|
'pisell2.text.send-mail': "Send email",
|
179
183
|
'pisell2.text.copy-to-clipboard': "Copy to clipboard",
|
@@ -531,6 +535,10 @@ export default {
|
|
531
535
|
'pisell2.text.deposit-delete-message': "删除后不可恢复,请确认操作",
|
532
536
|
'pisell2.text.deposit-paid': "已付定金",
|
533
537
|
"pisell2.text.stock": "库存",
|
538
|
+
'pisell2.appointment.unuse.stock': "库存不足",
|
539
|
+
'pisell2.appointment.unuse.capacity': function pisell2AppointmentUnuseCapacity(count) {
|
540
|
+
return "\u4EC5\u53EF\u9884\u7EA6 ".concat(count, " \u4E2A\uFF0C\u8BF7\u51CF\u5C11\u6570\u91CF");
|
541
|
+
},
|
534
542
|
'pisell2.text.payment-link': "付款链接",
|
535
543
|
'pisell2.text.send-mail': "发送邮件",
|
536
544
|
'pisell2.text.copy-to-clipboard': "复制到剪切板",
|
@@ -888,6 +896,10 @@ export default {
|
|
888
896
|
'pisell2.text.deposit-delete-message': "刪除後不可恢復,請確認操作",
|
889
897
|
'pisell2.text.deposit-paid': "已付定金",
|
890
898
|
"pisell2.text.stock": "庫存",
|
899
|
+
'pisell2.appointment.unuse.stock': "庫存不足",
|
900
|
+
'pisell2.appointment.unuse.capacity': function pisell2AppointmentUnuseCapacity(count) {
|
901
|
+
return "\u50C5\u53EF\u9810\u7D04 ".concat(count, " \u500B\uFF0C\u8ACB\u6E1B\u5C11\u6578\u91CF");
|
902
|
+
},
|
891
903
|
'pisell2.text.payment-link': "付款鏈接",
|
892
904
|
'pisell2.text.send-mail': "發送郵件",
|
893
905
|
'pisell2.text.copy-to-clipboard': "複製到剪切板",
|
@@ -112,39 +112,44 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
112
112
|
_useState4 = _slicedToArray(_useState3, 2),
|
113
113
|
balanceDueAmount = _useState4[0],
|
114
114
|
setBalanceDueAmount = _useState4[1];
|
115
|
-
|
115
|
+
// 剩余待付金额-跟定金无关的一个订单总体待付金额,上面这个 balanceDueAmount 是会收到订单影响的,下面这个不会
|
116
|
+
var _useState5 = useState(''),
|
116
117
|
_useState6 = _slicedToArray(_useState5, 2),
|
117
|
-
|
118
|
-
|
119
|
-
var paymentMethodsRef = useRef(null);
|
118
|
+
balanceDueTotalAmount = _useState6[0],
|
119
|
+
setBalanceDueTotalAmount = _useState6[1];
|
120
120
|
var _useState7 = useState([]),
|
121
121
|
_useState8 = _slicedToArray(_useState7, 2),
|
122
|
-
|
123
|
-
|
124
|
-
var
|
122
|
+
recommendAmounts = _useState8[0],
|
123
|
+
setRecommendAmounts = _useState8[1];
|
124
|
+
var paymentMethodsRef = useRef(null);
|
125
|
+
var _useState9 = useState([]),
|
125
126
|
_useState10 = _slicedToArray(_useState9, 2),
|
126
|
-
|
127
|
-
|
128
|
-
var _useState11 = useState(
|
127
|
+
paymentMethods = _useState10[0],
|
128
|
+
setPaymentMethods = _useState10[1];
|
129
|
+
var _useState11 = useState(false),
|
129
130
|
_useState12 = _slicedToArray(_useState11, 2),
|
130
|
-
|
131
|
-
|
131
|
+
showCashPayment = _useState12[0],
|
132
|
+
setShowCashPayment = _useState12[1];
|
133
|
+
var _useState13 = useState(locales.getText('cards.and.digitals') || 'Cards & Digitals'),
|
134
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
135
|
+
paymentOptionsTitle = _useState14[0],
|
136
|
+
setPaymentOptionsTitle = _useState14[1];
|
132
137
|
var clientChangedRef = useRef(false);
|
133
138
|
var walletPassRef = useRef(null);
|
134
139
|
// 已保存的支付项数据
|
135
|
-
var
|
136
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
137
|
-
paymentItems = _useState14[0],
|
138
|
-
setPaymentItems = _useState14[1];
|
139
|
-
// 钱包卡券数据
|
140
|
-
var _useState15 = useState({}),
|
140
|
+
var _useState15 = useState([]),
|
141
141
|
_useState16 = _slicedToArray(_useState15, 2),
|
142
|
-
|
143
|
-
|
144
|
-
|
142
|
+
paymentItems = _useState16[0],
|
143
|
+
setPaymentItems = _useState16[1];
|
144
|
+
// 钱包卡券数据
|
145
|
+
var _useState17 = useState({}),
|
145
146
|
_useState18 = _slicedToArray(_useState17, 2),
|
146
|
-
|
147
|
-
|
147
|
+
walletPassData = _useState18[0],
|
148
|
+
setWalletPassData = _useState18[1];
|
149
|
+
var _useState19 = useState(false),
|
150
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
151
|
+
syncingLock = _useState20[0],
|
152
|
+
setSyncingLock = _useState20[1];
|
148
153
|
var isOrderFree = useMemo(function () {
|
149
154
|
if (!customAmount) return false;
|
150
155
|
var amount = parseFloat(customAmount);
|
@@ -152,14 +157,14 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
152
157
|
}, [customAmount]);
|
153
158
|
|
154
159
|
// 新增状态:订单备注和手动折扣
|
155
|
-
var _useState19 = useState(false),
|
156
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
157
|
-
paymentLinkModalOpen = _useState20[0],
|
158
|
-
setPaymentLinkModalOpen = _useState20[1];
|
159
160
|
var _useState21 = useState(false),
|
160
161
|
_useState22 = _slicedToArray(_useState21, 2),
|
161
|
-
|
162
|
-
|
162
|
+
paymentLinkModalOpen = _useState22[0],
|
163
|
+
setPaymentLinkModalOpen = _useState22[1];
|
164
|
+
var _useState23 = useState(false),
|
165
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
166
|
+
showPriceAdjustModal = _useState24[0],
|
167
|
+
setShowPriceAdjustModal = _useState24[1];
|
163
168
|
var logger = usePaymentLogger();
|
164
169
|
var currency = getData('shop_currency_code') || 'USD';
|
165
170
|
|
@@ -415,6 +420,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
415
420
|
var _cartData$order_info;
|
416
421
|
setCustomAmount(currentAmount);
|
417
422
|
setBalanceDueAmount(currentAmount);
|
423
|
+
setBalanceDueTotalAmount(orderInfo.totalAmount || '0');
|
418
424
|
// 设置订单备注默认值 - 优先从 checkoutModule 获取,如果没有则从购物车数据获取
|
419
425
|
var currentNote = checkoutModule.getOrderNote();
|
420
426
|
if (currentNote) {
|
@@ -517,6 +523,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
517
523
|
}());
|
518
524
|
var amountChangedUnsubscribe = core.effects.on(CheckoutHooks.OnBalanceDueAmountChanged, function (data) {
|
519
525
|
setBalanceDueAmount(data.newAmount);
|
526
|
+
setBalanceDueTotalAmount(data.totalAmount || '0');
|
520
527
|
});
|
521
528
|
var orderSubmitStartUnsubscribe = core.effects.on(CheckoutHooks.OnOrderSubmitStart, function () {
|
522
529
|
var _Toast$loading;
|
@@ -581,9 +588,9 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
581
588
|
var itemAmount = new Decimal(item.amount || 0);
|
582
589
|
var itemServiceCharge = chargeAmount.add(chargePercentage.mul(itemAmount));
|
583
590
|
// 如果支付项的 rounding_amount 是正数,需要减掉rounding_amount
|
584
|
-
if (Number(item.rounding_amount) > 0) {
|
585
|
-
|
586
|
-
}
|
591
|
+
// if (Number(item.rounding_amount) > 0) {
|
592
|
+
// itemServiceCharge = itemServiceCharge.sub(new Decimal(item.rounding_amount));
|
593
|
+
// }
|
587
594
|
console.log(itemServiceCharge);
|
588
595
|
return acc.add(itemServiceCharge);
|
589
596
|
}, new Decimal(0));
|
@@ -1290,7 +1297,8 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1290
1297
|
amountButtons: recommendAmounts,
|
1291
1298
|
customAmount: customAmount,
|
1292
1299
|
roundingFunction: roundingFunction,
|
1293
|
-
balanceDueAmount: balanceDueAmount
|
1300
|
+
balanceDueAmount: balanceDueAmount,
|
1301
|
+
balanceDueTotalAmount: balanceDueTotalAmount
|
1294
1302
|
})), moduleConfig.showPaymentOptions && /*#__PURE__*/React.createElement("div", {
|
1295
1303
|
className: showCashPayment ? '' : 'payment-options-module-container',
|
1296
1304
|
style: showCashPayment ? {
|
@@ -1372,30 +1380,30 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1372
1380
|
getData = _ref19.getData,
|
1373
1381
|
interaction = _ref19.interaction,
|
1374
1382
|
isWebPos = _ref19.isWebPos;
|
1375
|
-
var
|
1376
|
-
_useState24 = _slicedToArray(_useState23, 2),
|
1377
|
-
orderInfo = _useState24[0],
|
1378
|
-
setOrderInfo = _useState24[1];
|
1379
|
-
var _useState25 = useState(0),
|
1383
|
+
var _useState25 = useState(null),
|
1380
1384
|
_useState26 = _slicedToArray(_useState25, 2),
|
1381
|
-
|
1382
|
-
|
1383
|
-
var _useState27 = useState(
|
1385
|
+
orderInfo = _useState26[0],
|
1386
|
+
setOrderInfo = _useState26[1];
|
1387
|
+
var _useState27 = useState(0),
|
1384
1388
|
_useState28 = _slicedToArray(_useState27, 2),
|
1385
|
-
|
1386
|
-
|
1387
|
-
var _useState29 = useState(
|
1389
|
+
totalAmount = _useState28[0],
|
1390
|
+
setTotalAmount = _useState28[1];
|
1391
|
+
var _useState29 = useState(true),
|
1388
1392
|
_useState30 = _slicedToArray(_useState29, 2),
|
1389
|
-
|
1390
|
-
|
1391
|
-
var _useState31 = useState(
|
1393
|
+
actualShowCashPayment = _useState30[0],
|
1394
|
+
setActualShowCashPayment = _useState30[1];
|
1395
|
+
var _useState31 = useState(0),
|
1392
1396
|
_useState32 = _slicedToArray(_useState31, 2),
|
1393
|
-
|
1394
|
-
|
1395
|
-
var _useState33 = useState(
|
1397
|
+
windowHeight = _useState32[0],
|
1398
|
+
setWindowHeight = _useState32[1];
|
1399
|
+
var _useState33 = useState(false),
|
1396
1400
|
_useState34 = _slicedToArray(_useState33, 2),
|
1397
|
-
|
1398
|
-
|
1401
|
+
showRetryModal = _useState34[0],
|
1402
|
+
setShowRetryModal = _useState34[1];
|
1403
|
+
var _useState35 = useState(editOrderId || 0),
|
1404
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
1405
|
+
currentEditOrderId = _useState36[0],
|
1406
|
+
_setCurrentEditOrderId = _useState36[1];
|
1399
1407
|
var Toast = useToast();
|
1400
1408
|
|
1401
1409
|
// 重试处理函数(逻辑由用户自己实现)
|
@@ -1528,18 +1536,18 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1528
1536
|
}, []);
|
1529
1537
|
|
1530
1538
|
// 订单备注相关状态
|
1531
|
-
var
|
1532
|
-
_useState36 = _slicedToArray(_useState35, 2),
|
1533
|
-
noteModalOpen = _useState36[0],
|
1534
|
-
setNoteModalOpen = _useState36[1];
|
1535
|
-
var _useState37 = useState(''),
|
1539
|
+
var _useState37 = useState(false),
|
1536
1540
|
_useState38 = _slicedToArray(_useState37, 2),
|
1537
|
-
|
1538
|
-
|
1539
|
-
var _useState39 = useState('
|
1541
|
+
noteModalOpen = _useState38[0],
|
1542
|
+
setNoteModalOpen = _useState38[1];
|
1543
|
+
var _useState39 = useState(''),
|
1540
1544
|
_useState40 = _slicedToArray(_useState39, 2),
|
1541
|
-
|
1542
|
-
|
1545
|
+
orderNote = _useState40[0],
|
1546
|
+
setOrderNote = _useState40[1];
|
1547
|
+
var _useState41 = useState('payment-content'),
|
1548
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
1549
|
+
noteModalSource = _useState42[0],
|
1550
|
+
setNoteModalSource = _useState42[1];
|
1543
1551
|
|
1544
1552
|
// 订单备注相关处理函数
|
1545
1553
|
var handleNoteConfirm = /*#__PURE__*/function () {
|
@@ -503,8 +503,8 @@ function AmountSummary(_ref2) {
|
|
503
503
|
var syncedVoucherAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
504
504
|
// 如果当前是普通支付,则减去order_payment_type不为 deposit的支付项
|
505
505
|
// 如果当前是定金支付,则减去order_payment_type为 deposit的支付项
|
506
|
-
if (item.
|
507
|
-
return acc.plus(item.amount).plus(item.rounding_amount);
|
506
|
+
if (item.isSynced && (paymentType === 'regular' && item.order_payment_type !== 'deposit' || paymentType === 'deposit' && item.order_payment_type === 'deposit')) {
|
507
|
+
return acc.plus(item.amount).plus(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0);
|
508
508
|
}
|
509
509
|
return acc;
|
510
510
|
}, new Decimal(0)).toNumber();
|
@@ -615,7 +615,7 @@ function AmountSummary(_ref2) {
|
|
615
615
|
if (paymentType === 'regular') {
|
616
616
|
var depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
617
617
|
if (item.order_payment_type === 'deposit') {
|
618
|
-
return acc.plus(item.amount).plus(
|
618
|
+
return acc.plus(item.amount).plus(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0);
|
619
619
|
}
|
620
620
|
return acc;
|
621
621
|
}, new Decimal(0)).toNumber();
|
@@ -627,7 +627,7 @@ function AmountSummary(_ref2) {
|
|
627
627
|
// 如果是定金支付,且定金已付款金额大于等于订单总金额,则不可以再切换到普通支付
|
628
628
|
var _depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
629
629
|
if (item.order_payment_type === 'deposit') {
|
630
|
-
return acc.plus(item.amount);
|
630
|
+
return acc.plus(item.amount).plus(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0);
|
631
631
|
}
|
632
632
|
return acc;
|
633
633
|
}, new Decimal(0)).toNumber();
|
@@ -13,10 +13,12 @@ export interface CashPaymentModuleProps {
|
|
13
13
|
roundingDifference: number;
|
14
14
|
}>;
|
15
15
|
balanceDueAmount?: string;
|
16
|
+
balanceDueTotalAmount?: string;
|
16
17
|
syncingLock?: boolean;
|
17
18
|
}
|
18
19
|
export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, // 按钮列表,默认5个推荐金额
|
19
20
|
disabled, // 禁用状态
|
20
|
-
roundingFunction, balanceDueAmount, //
|
21
|
+
roundingFunction, balanceDueAmount, // 当前阶段剩余支付金额(定金或普通支付)
|
22
|
+
balanceDueTotalAmount, // 完整订单剩余待付金额
|
21
23
|
syncingLock, }: CashPaymentModuleProps): JSX.Element;
|
22
24
|
export default CashPaymentModule;
|
@@ -29,6 +29,8 @@ export function CashPaymentModule(_ref) {
|
|
29
29
|
roundingFunction = _ref.roundingFunction,
|
30
30
|
_ref$balanceDueAmount = _ref.balanceDueAmount,
|
31
31
|
balanceDueAmount = _ref$balanceDueAmount === void 0 ? '0' : _ref$balanceDueAmount,
|
32
|
+
_ref$balanceDueTotalA = _ref.balanceDueTotalAmount,
|
33
|
+
balanceDueTotalAmount = _ref$balanceDueTotalA === void 0 ? '0' : _ref$balanceDueTotalA,
|
32
34
|
_ref$syncingLock = _ref.syncingLock,
|
33
35
|
syncingLock = _ref$syncingLock === void 0 ? false : _ref$syncingLock;
|
34
36
|
var _useState = useState(customAmount || ''),
|
@@ -56,7 +58,7 @@ export function CashPaymentModule(_ref) {
|
|
56
58
|
};
|
57
59
|
useEffect(function () {
|
58
60
|
handleKeyboardConfirm(customAmount || '');
|
59
|
-
}, [customAmount, balanceDueAmount]);
|
61
|
+
}, [customAmount, balanceDueAmount, orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.isDeposit]);
|
60
62
|
|
61
63
|
// 检查是否应该禁用按钮:原本disabled为true 或者 订单金额为0
|
62
64
|
var isAmountButtonsDisabled = disabled || Number(customAmount || 0) === 0;
|
@@ -119,33 +121,35 @@ export function CashPaymentModule(_ref) {
|
|
119
121
|
break;
|
120
122
|
}
|
121
123
|
setAmount('');
|
122
|
-
_context.next =
|
124
|
+
_context.next = 33;
|
123
125
|
break;
|
124
126
|
case 13:
|
125
127
|
// 移除可能的货币符号和多余空格
|
126
128
|
cleanValue = finalValue.replace(/[$\s]/g, '');
|
127
129
|
numValue = parseFloat(cleanValue); // 检查当前金额是否等于剩余支付金额
|
128
|
-
|
130
|
+
debugger;
|
131
|
+
// 需要确认当前是否是定金模式,如果是定金模式则 balanceDue 应该为完整订单剩余待付金额
|
132
|
+
balanceDue = parseFloat(orderInfo !== null && orderInfo !== void 0 && orderInfo.isDeposit ? balanceDueTotalAmount || '0' : balanceDueAmount);
|
129
133
|
shouldApplyRounding = Math.abs(numValue - balanceDue) < 0.01; // 使用小数精度比较
|
130
134
|
finalAmount = numValue;
|
131
135
|
roundingDiff = 0;
|
132
136
|
if (!(shouldApplyRounding && roundingFunction)) {
|
133
|
-
_context.next =
|
137
|
+
_context.next = 30;
|
134
138
|
break;
|
135
139
|
}
|
136
|
-
_context.next =
|
140
|
+
_context.next = 23;
|
137
141
|
return roundingFunction(numValue);
|
138
|
-
case
|
142
|
+
case 23:
|
139
143
|
_result = _context.sent;
|
140
144
|
_ref3 = _result || {}, _ref3$roundedAmount = _ref3.roundedAmount, roundedAmount = _ref3$roundedAmount === void 0 ? numValue : _ref3$roundedAmount, _ref3$roundingDiffere = _ref3.roundingDifference, roundingDifference = _ref3$roundingDiffere === void 0 ? 0 : _ref3$roundingDiffere;
|
141
145
|
finalAmount = roundedAmount;
|
142
146
|
roundingDiff = roundingDifference;
|
143
147
|
console.log('应用抹零:', numValue, '->', roundedAmount, '差额:', roundingDifference);
|
144
|
-
_context.next =
|
148
|
+
_context.next = 31;
|
145
149
|
break;
|
146
|
-
case 29:
|
147
|
-
console.log('不应用抹零,用户输入金额:', numValue, '剩余支付金额:', balanceDue);
|
148
150
|
case 30:
|
151
|
+
console.log('不应用抹零,用户输入金额:', numValue, '剩余支付金额:', balanceDue);
|
152
|
+
case 31:
|
149
153
|
setRoundingAmount(roundingDiff);
|
150
154
|
if (isNaN(numValue)) {
|
151
155
|
setAmount('');
|
@@ -153,7 +157,7 @@ export function CashPaymentModule(_ref) {
|
|
153
157
|
setAmount(finalAmount.toString());
|
154
158
|
console.log('设置金额为:', finalAmount);
|
155
159
|
}
|
156
|
-
case
|
160
|
+
case 33:
|
157
161
|
case "end":
|
158
162
|
return _context.stop();
|
159
163
|
}
|
@@ -74,7 +74,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
|
|
74
74
|
var status = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.status;
|
75
75
|
|
76
76
|
// 继续查询交易状态
|
77
|
-
if (status
|
77
|
+
if (status == 0) {
|
78
78
|
var _res$data2;
|
79
79
|
// 交易流水号
|
80
80
|
numRef.current = res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.session_id;
|
@@ -89,7 +89,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
|
|
89
89
|
setTimeout(function () {
|
90
90
|
var _resultQueryRef$curre;
|
91
91
|
(_resultQueryRef$curre = resultQueryRef.current) === null || _resultQueryRef$curre === void 0 || _resultQueryRef$curre.call(resultQueryRef);
|
92
|
-
});
|
92
|
+
}, 300);
|
93
93
|
return;
|
94
94
|
}
|
95
95
|
|
@@ -99,7 +99,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
|
|
99
99
|
}));
|
100
100
|
|
101
101
|
// 交易成功
|
102
|
-
if (status
|
102
|
+
if (status == 1) {
|
103
103
|
var _handleLinklySuccessR;
|
104
104
|
(_handleLinklySuccessR = handleLinklySuccessRef.current) === null || _handleLinklySuccessR === void 0 || _handleLinklySuccessR.call(handleLinklySuccessRef, res);
|
105
105
|
return;
|