component-shipinlv 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Buy/qr.js +54 -30
- package/package.json +1 -1
package/dist/Buy/qr.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
3
|
import React, { useEffect, useState } from 'react';
|
@@ -32,7 +31,7 @@ var VipQr = function VipQr(_ref) {
|
|
32
31
|
var _useState = useState(Tool.getLocalUserInfo()),
|
33
32
|
_useState2 = _slicedToArray(_useState, 1),
|
34
33
|
userInfo = _useState2[0];
|
35
|
-
var _useState3 = useState(
|
34
|
+
var _useState3 = useState(payMethod === null || payMethod === void 0 ? void 0 : payMethod[0]),
|
36
35
|
_useState4 = _slicedToArray(_useState3, 2),
|
37
36
|
payChannel = _useState4[0],
|
38
37
|
setPayChannel = _useState4[1];
|
@@ -106,6 +105,9 @@ var VipQr = function VipQr(_ref) {
|
|
106
105
|
if (payOrderInfo[result.payChannel]) {
|
107
106
|
payOrderInfo[result.payChannel].qrUrl = result.codeUrl || result.mWebUrl;
|
108
107
|
setPayOrderInfo(_objectSpread({}, payOrderInfo));
|
108
|
+
console.log('payOrderInfo:', payOrderInfo);
|
109
|
+
setItemsTabs(getItemsTabs(payOrderInfo));
|
110
|
+
|
109
111
|
// 五秒后自动弹出;
|
110
112
|
setTimeout(function () {
|
111
113
|
setPayResult(true);
|
@@ -141,22 +143,19 @@ var VipQr = function VipQr(_ref) {
|
|
141
143
|
loading = _useRequest2.loading,
|
142
144
|
run = _useRequest2.run,
|
143
145
|
error = _useRequest2.error;
|
144
|
-
var
|
145
|
-
|
146
|
-
|
147
|
-
setItemsTabs = _useState14[1];
|
148
|
-
var PayMethodList = {
|
149
|
-
wepay: [{
|
146
|
+
var getPayMethodList = function getPayMethodList() {
|
147
|
+
var payInfo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : payOrderInfo;
|
148
|
+
var payMethodList = [{
|
150
149
|
key: 'wepay',
|
151
150
|
label: '微信支付',
|
152
151
|
icon: /*#__PURE__*/_jsx(WechatOutlined, {
|
153
152
|
className: "tabIcon"
|
154
153
|
}),
|
155
154
|
disabled: loadingPay,
|
156
|
-
children:
|
155
|
+
children: payInfo.wepay.message ? /*#__PURE__*/_jsx(Result, {
|
157
156
|
status: "error",
|
158
157
|
title: "\u4E0B\u5355\u53D1\u751F\u4E00\u4E9B\u95EE\u9898",
|
159
|
-
subTitle:
|
158
|
+
subTitle: payInfo.wepay.message,
|
160
159
|
children: /*#__PURE__*/_jsx(Button, {
|
161
160
|
type: "primary",
|
162
161
|
children: "\u91CD\u8BD5"
|
@@ -164,8 +163,8 @@ var VipQr = function VipQr(_ref) {
|
|
164
163
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
165
164
|
children: [/*#__PURE__*/_jsx("div", {
|
166
165
|
className: "qrImage",
|
167
|
-
children:
|
168
|
-
value:
|
166
|
+
children: payInfo.wepay.qrUrl ? /*#__PURE__*/_jsx(QRCode, {
|
167
|
+
value: payInfo.wepay.qrUrl,
|
169
168
|
fgColor: "#0bc160",
|
170
169
|
size: 180
|
171
170
|
}) : /*#__PURE__*/_jsx(LoadingOutlined, {
|
@@ -189,18 +188,17 @@ var VipQr = function VipQr(_ref) {
|
|
189
188
|
})
|
190
189
|
})]
|
191
190
|
})
|
192
|
-
}
|
193
|
-
alipay: [{
|
191
|
+
}, {
|
194
192
|
key: 'alipay',
|
195
193
|
label: '支付宝',
|
196
194
|
disabled: loadingPay,
|
197
195
|
icon: /*#__PURE__*/_jsx(AlipayCircleOutlined, {
|
198
196
|
className: "tabIcon"
|
199
197
|
}),
|
200
|
-
children:
|
198
|
+
children: payInfo.alipay.message ? /*#__PURE__*/_jsx(Result, {
|
201
199
|
status: "error",
|
202
200
|
title: "\u4E0B\u5355\u53D1\u751F\u4E00\u4E9B\u95EE\u9898",
|
203
|
-
subTitle:
|
201
|
+
subTitle: payInfo.alipay.message,
|
204
202
|
children: /*#__PURE__*/_jsx(Button, {
|
205
203
|
type: "primary",
|
206
204
|
children: "\u91CD\u8BD5"
|
@@ -208,8 +206,8 @@ var VipQr = function VipQr(_ref) {
|
|
208
206
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
209
207
|
children: [/*#__PURE__*/_jsx("div", {
|
210
208
|
className: "qrImage",
|
211
|
-
children:
|
212
|
-
value:
|
209
|
+
children: payInfo.alipay.qrUrl ? /*#__PURE__*/_jsx(QRCode, {
|
210
|
+
value: payInfo.alipay.qrUrl,
|
213
211
|
fgColor: "#1677ff",
|
214
212
|
size: 180
|
215
213
|
}) : /*#__PURE__*/_jsx(LoadingOutlined, {
|
@@ -233,25 +231,51 @@ var VipQr = function VipQr(_ref) {
|
|
233
231
|
})
|
234
232
|
})]
|
235
233
|
})
|
236
|
-
}]
|
234
|
+
}];
|
235
|
+
return payMethodList;
|
237
236
|
};
|
238
|
-
var
|
237
|
+
var getItemsTabs = function getItemsTabs() {
|
238
|
+
var payInfo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : payOrderInfo;
|
239
|
+
var itemsTabs = [];
|
240
|
+
var payMethodList = getPayMethodList(payInfo);
|
239
241
|
payMethod === null || payMethod === void 0 || payMethod.forEach(function (payMethod) {
|
240
|
-
var
|
241
|
-
if (!
|
242
|
+
var index = -1;
|
243
|
+
if (!payMethodList) {
|
242
244
|
return;
|
243
245
|
}
|
244
|
-
|
245
|
-
|
246
|
+
payMethodList === null || payMethodList === void 0 || payMethodList.some(function (item, i) {
|
247
|
+
if (item.key === payMethod) {
|
248
|
+
index = i;
|
249
|
+
}
|
250
|
+
});
|
251
|
+
if (index < 0) {
|
252
|
+
return;
|
253
|
+
}
|
254
|
+
if (payMethodList) {
|
255
|
+
itemsTabs.push(payMethodList[index]);
|
246
256
|
}
|
247
257
|
});
|
248
|
-
|
249
|
-
|
250
|
-
|
258
|
+
return itemsTabs;
|
259
|
+
};
|
260
|
+
var _useState13 = useState(getItemsTabs()),
|
261
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
262
|
+
itemsTabs = _useState14[0],
|
263
|
+
setItemsTabs = _useState14[1];
|
264
|
+
var onInit = function onInit() {
|
265
|
+
// payMethod?.forEach( payMethod => {
|
266
|
+
// const itemData = PayMethodList[ payMethod ];
|
267
|
+
// if( ! itemData){
|
268
|
+
// return;
|
269
|
+
// }
|
270
|
+
// if( itemsTabs ){
|
271
|
+
// itemsTabs.push( itemData[0] );
|
272
|
+
// }
|
273
|
+
// });
|
274
|
+
// if( itemsTabs ){
|
275
|
+
// setItemsTabs([...itemsTabs]);
|
276
|
+
// }
|
251
277
|
};
|
252
|
-
useEffect(function () {
|
253
|
-
onInit();
|
254
|
-
}, []);
|
278
|
+
useEffect(function () {}, []);
|
255
279
|
return /*#__PURE__*/_jsx(PageContentWarp, {
|
256
280
|
loading: loading,
|
257
281
|
error: error
|