component-shipinlv 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/AuthClient/qr/index.js +2 -1
- package/dist/Buy/index.d.ts +1 -1
- package/dist/Buy/qr.css.js +1 -1
- package/dist/Buy/qr.js +166 -52
- package/dist/VipCompare/index.js +4 -1
- package/dist/lib/isInClient.d.ts +2 -0
- package/dist/lib/isInClient.js +4 -0
- package/dist/typings/Trade.d.ts +3 -0
- package/package.json +1 -1
@@ -18,6 +18,7 @@ var reTryMaxCount = 120;
|
|
18
18
|
var reTryTimeLoop = 1000; // ms
|
19
19
|
var FromWhere = 'web';
|
20
20
|
import QRCode from 'qrcode.react';
|
21
|
+
import isInClient from "../../lib/isInClient";
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
22
23
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
23
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -143,7 +144,7 @@ var LoginQr = function LoginQr(_ref) {
|
|
143
144
|
env: getApiEnv()
|
144
145
|
});
|
145
146
|
}, {
|
146
|
-
manual: defaultLoginType !== 'wechat',
|
147
|
+
manual: !isInClient() || defaultLoginType !== 'wechat',
|
147
148
|
onSuccess: function onSuccess(result) {
|
148
149
|
setWeQrUrl(result.url);
|
149
150
|
onRunCheck();
|
package/dist/Buy/index.d.ts
CHANGED
package/dist/Buy/qr.css.js
CHANGED
@@ -2,5 +2,5 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
|
|
2
2
|
var _templateObject;
|
3
3
|
import styled from 'styled-components';
|
4
4
|
export default {
|
5
|
-
BuyQr: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
5
|
+
BuyQr: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n text-align: center;\n display: flex;\n flex-direction: column;\n height: 100%;\n .qrImage{\n width: 200px;\n height: 200px;\n margin: 30px auto 0;\n img{\n display: block;\n width: 100%;\n max-width: 100%;\n }\n }\n .loadingIcon{\n font-size: 68px;\n color: #BBB;\n }\n .price{\n font-size: 16px;\n strong{\n font-size: 20px;\n color: #F60;\n }\n .multiply{\n display: inline-block;\n margin: 0 10px;\n color: #AAA;\n }\n .productCount{\n font-size: 20px;\n }\n .equal{\n transform: rotate(90deg);\n display: inline-block;\n margin: 0 10px;\n color: #AAA;\n }\n .moneyAll{\n color: #F60;\n font-size: 32px;\n }\n }\n .alt{\n color: #999;\n font-size: 13px;\n .wechatIcon{\n color: #0bc160;\n }\n .alipayIcon{\n color: #1677ff;\n }\n }\n .altInH5{\n padding: 8px 0 0;\n color: #C00;\n font-size: 15px;\n .toFriend{\n font-size: 13px;\n color: #888;\n padding: 0;\n margin: 0;\n }\n }\n .tabIcon{\n font-size: 18px;\n }\n .qrAlt{\n padding: 0 0 12px;\n }\n .payResult{\n .ant-result{\n padding: 0 30px 30px;\n }\n .ant-result-icon{\n display: none;\n }\n }\n .payChannel{\n padding: 30px 20px 20px;\n .payChannelTabs{\n position: relative;\n .ant-tabs-content-holder{\n border: 1px solid #E8E8E8;\n margin: -17px 0 0;\n }\n }\n }\n "])))
|
6
6
|
};
|
package/dist/Buy/qr.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
3
|
import React, { useState } from 'react';
|
3
|
-
import { Result, Button, Space, Divider } from 'antd';
|
4
|
-
import { CloseOutlined, PauseOutlined, WechatOutlined } from '@ant-design/icons';
|
4
|
+
import { Result, Button, Space, Divider, Tabs } from 'antd';
|
5
|
+
import { AlipayCircleOutlined, CloseOutlined, LoadingOutlined, PauseOutlined, WechatOutlined } from '@ant-design/icons';
|
5
6
|
import { useRequest } from '@umijs/hooks';
|
6
7
|
import * as TradeController from "../service/api/TradeController";
|
7
8
|
import * as VipController from "../service/api/VipController";
|
@@ -10,8 +11,9 @@ import Tool from "../lib/Tool";
|
|
10
11
|
import PageContentWarp from "../UI/PageContentWarp";
|
11
12
|
import styles from "./qr.css";
|
12
13
|
import Platform from "../lib/platform";
|
13
|
-
import
|
14
|
+
import isInClient from "../lib/isInClient";
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
15
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
16
18
|
var VipQr = function VipQr(_ref) {
|
17
19
|
var _ref$env = _ref.env,
|
@@ -27,22 +29,36 @@ var VipQr = function VipQr(_ref) {
|
|
27
29
|
var _useState = useState(Tool.getLocalUserInfo()),
|
28
30
|
_useState2 = _slicedToArray(_useState, 1),
|
29
31
|
userInfo = _useState2[0];
|
30
|
-
var _useState3 = useState(
|
32
|
+
var _useState3 = useState('wepay'),
|
31
33
|
_useState4 = _slicedToArray(_useState3, 2),
|
32
|
-
|
33
|
-
|
34
|
-
var _useState5 = useState(
|
34
|
+
payChannel = _useState4[0],
|
35
|
+
setPayChannel = _useState4[1];
|
36
|
+
var _useState5 = useState(false),
|
37
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
38
|
+
payResult = _useState6[0],
|
39
|
+
setPayResult = _useState6[1];
|
40
|
+
var _useState7 = useState({
|
35
41
|
codeUrl: '',
|
36
|
-
mWebUrl: ''
|
42
|
+
mWebUrl: '',
|
43
|
+
payChannel: payChannel
|
37
44
|
}),
|
38
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
39
|
-
orderPayInfo = _useState6[0],
|
40
|
-
setOrderPayInfo = _useState6[1];
|
41
|
-
var _useState7 = useState(''),
|
42
45
|
_useState8 = _slicedToArray(_useState7, 2),
|
43
|
-
|
44
|
-
|
46
|
+
orderPayInfo = _useState8[0],
|
47
|
+
setOrderPayInfo = _useState8[1];
|
45
48
|
var _useState9 = useState({
|
49
|
+
wepay: {
|
50
|
+
message: '',
|
51
|
+
qrUrl: ''
|
52
|
+
},
|
53
|
+
alipay: {
|
54
|
+
message: '',
|
55
|
+
qrUrl: ''
|
56
|
+
}
|
57
|
+
}),
|
58
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
59
|
+
payOrderInfo = _useState10[0],
|
60
|
+
setPayOrderInfo = _useState10[1];
|
61
|
+
var _useState11 = useState({
|
46
62
|
id: 0,
|
47
63
|
marketPrice: 0,
|
48
64
|
month: 0,
|
@@ -55,18 +71,21 @@ var VipQr = function VipQr(_ref) {
|
|
55
71
|
alt: '',
|
56
72
|
recommend: 0
|
57
73
|
}),
|
58
|
-
|
59
|
-
detailData =
|
60
|
-
setDetailData =
|
74
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
75
|
+
detailData = _useState12[0],
|
76
|
+
setDetailData = _useState12[1];
|
61
77
|
// 允许帮别人支付,只认码; 不认支付的小程序
|
62
78
|
|
63
79
|
var _useRequest = useRequest(function () {
|
80
|
+
var channel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : payChannel;
|
64
81
|
return TradeController.create({
|
65
82
|
productKind: productKind,
|
66
83
|
productTypeId: vipId,
|
67
84
|
productCount: productCount,
|
68
85
|
userId: Tool.getLocalUserInfo().id,
|
69
|
-
payType: 'NATIVE'
|
86
|
+
payType: 'NATIVE',
|
87
|
+
//Platform.isH5 ? 'MWEB' : 'NATIVE',
|
88
|
+
payChannel: channel
|
70
89
|
}, {
|
71
90
|
env: env
|
72
91
|
});
|
@@ -80,12 +99,23 @@ var VipQr = function VipQr(_ref) {
|
|
80
99
|
} else {}
|
81
100
|
} else {}
|
82
101
|
setOrderPayInfo(result);
|
83
|
-
//
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
102
|
+
// setPayOrderInfo( Tool.makeQrUrl( result.codeUrl || result.mWebUrl, '#0bc160') );
|
103
|
+
if (payOrderInfo[result.payChannel]) {
|
104
|
+
payOrderInfo[result.payChannel].qrUrl = result.codeUrl || result.mWebUrl;
|
105
|
+
setPayOrderInfo(_objectSpread({}, payOrderInfo));
|
106
|
+
// 五秒后自动弹出;
|
107
|
+
setTimeout(function () {
|
108
|
+
setPayResult(true);
|
109
|
+
}, 20e3);
|
110
|
+
} else {
|
111
|
+
Tool.toast('支付类型有问题');
|
112
|
+
}
|
113
|
+
},
|
114
|
+
onError: function onError(e) {
|
115
|
+
if (payOrderInfo[payChannel]) {
|
116
|
+
payOrderInfo[payChannel].message = "\u521B\u5EFA\u8BA2\u5355\u5931\u8D25\uFF1A".concat(e.message || '');
|
117
|
+
setPayOrderInfo(_objectSpread({}, payOrderInfo));
|
118
|
+
}
|
89
119
|
}
|
90
120
|
}),
|
91
121
|
loadingPay = _useRequest.loading,
|
@@ -98,25 +128,112 @@ var VipQr = function VipQr(_ref) {
|
|
98
128
|
env: env
|
99
129
|
});
|
100
130
|
}, {
|
131
|
+
manual: !isInClient(),
|
101
132
|
onSuccess: function onSuccess(result) {
|
102
|
-
runPay();
|
103
133
|
console.log('re 1', result);
|
104
134
|
setDetailData(result);
|
135
|
+
runPay();
|
105
136
|
}
|
106
137
|
}),
|
107
138
|
loading = _useRequest2.loading,
|
108
139
|
run = _useRequest2.run,
|
109
140
|
error = _useRequest2.error;
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
141
|
+
var itemsTabs = [{
|
142
|
+
key: 'wepay',
|
143
|
+
label: '微信支付',
|
144
|
+
icon: /*#__PURE__*/_jsx(WechatOutlined, {
|
145
|
+
className: "tabIcon"
|
146
|
+
}),
|
147
|
+
disabled: loadingPay,
|
148
|
+
children: payOrderInfo.wepay.message ? /*#__PURE__*/_jsx(Result, {
|
149
|
+
status: "error",
|
150
|
+
title: "\u4E0B\u5355\u53D1\u751F\u4E00\u4E9B\u95EE\u9898",
|
151
|
+
subTitle: payOrderInfo.wepay.message,
|
152
|
+
children: /*#__PURE__*/_jsx(Button, {
|
153
|
+
type: "primary",
|
154
|
+
children: "\u91CD\u8BD5"
|
155
|
+
})
|
156
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
157
|
+
children: [/*#__PURE__*/_jsx("div", {
|
158
|
+
className: "qrImage",
|
159
|
+
children: payOrderInfo.wepay.qrUrl ? /*#__PURE__*/_jsx(QRCode, {
|
160
|
+
value: payOrderInfo.wepay.qrUrl,
|
161
|
+
fgColor: "#0bc160",
|
162
|
+
size: 180
|
163
|
+
}) : /*#__PURE__*/_jsx(LoadingOutlined, {
|
164
|
+
className: "loadingIcon"
|
165
|
+
})
|
166
|
+
}), /*#__PURE__*/_jsx("div", {
|
167
|
+
className: "qrAlt",
|
168
|
+
children: Platform.isH5 ? /*#__PURE__*/_jsxs("div", {
|
169
|
+
className: "altInH5",
|
170
|
+
children: ["\u957F\u6309\u4E8C\u7EF4\u7801\uFF0C\u53EF\u8BC6\u522B\u4E8C\u7EF4\u7801\u652F\u4ED8", /*#__PURE__*/_jsx("p", {
|
171
|
+
className: "toFriend",
|
172
|
+
children: "\u6216\u8005\u4FDD\u5B58\u56FE\u7247\u8BA9\u670B\u53CB\u626B\u7801\u4EE3\u4ED8"
|
173
|
+
})]
|
174
|
+
}) : /*#__PURE__*/_jsxs("div", {
|
175
|
+
className: "alt",
|
176
|
+
children: ["\u8BF7\u7528 ", /*#__PURE__*/_jsx(WechatOutlined, {
|
177
|
+
className: "wechatIcon"
|
178
|
+
}), " \u5FAE\u4FE1 \u626B\u7801\u652F\u4ED8 ", /*#__PURE__*/_jsx(Divider, {
|
179
|
+
type: "vertical"
|
180
|
+
}), " \u4E5F\u53EF\u4EE5\u8BA9\u670B\u53CB\u626B\u7801\u4EE3\u4ED8"]
|
181
|
+
})
|
182
|
+
})]
|
183
|
+
})
|
184
|
+
}, {
|
185
|
+
key: 'alipay',
|
186
|
+
label: '支付宝',
|
187
|
+
disabled: loadingPay,
|
188
|
+
icon: /*#__PURE__*/_jsx(AlipayCircleOutlined, {
|
189
|
+
className: "tabIcon"
|
190
|
+
}),
|
191
|
+
children: payOrderInfo.alipay.message ? /*#__PURE__*/_jsx(Result, {
|
192
|
+
status: "error",
|
193
|
+
title: "\u4E0B\u5355\u53D1\u751F\u4E00\u4E9B\u95EE\u9898",
|
194
|
+
subTitle: payOrderInfo.alipay.message,
|
195
|
+
children: /*#__PURE__*/_jsx(Button, {
|
196
|
+
type: "primary",
|
197
|
+
children: "\u91CD\u8BD5"
|
198
|
+
})
|
199
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
200
|
+
children: [/*#__PURE__*/_jsx("div", {
|
201
|
+
className: "qrImage",
|
202
|
+
children: payOrderInfo.alipay.qrUrl ? /*#__PURE__*/_jsx(QRCode, {
|
203
|
+
value: payOrderInfo.alipay.qrUrl,
|
204
|
+
fgColor: "#1677ff",
|
205
|
+
size: 180
|
206
|
+
}) : /*#__PURE__*/_jsx(LoadingOutlined, {
|
207
|
+
className: "loadingIcon"
|
208
|
+
})
|
209
|
+
}), /*#__PURE__*/_jsx("div", {
|
210
|
+
className: "qrAlt",
|
211
|
+
children: Platform.isH5 ? /*#__PURE__*/_jsxs("div", {
|
212
|
+
className: "altInH5",
|
213
|
+
children: ["\u957F\u6309\u4E8C\u7EF4\u7801\uFF0C\u53EF\u8BC6\u522B\u4E8C\u7EF4\u7801\u652F\u4ED8", /*#__PURE__*/_jsx("p", {
|
214
|
+
className: "toFriend",
|
215
|
+
children: "\u6216\u8005\u4FDD\u5B58\u56FE\u7247\u8BA9\u670B\u53CB\u626B\u7801\u4EE3\u4ED8"
|
216
|
+
})]
|
217
|
+
}) : /*#__PURE__*/_jsxs("div", {
|
218
|
+
className: "alt",
|
219
|
+
children: ["\u8BF7\u7528 ", /*#__PURE__*/_jsx(AlipayCircleOutlined, {
|
220
|
+
className: "alipayIcon"
|
221
|
+
}), " \u652F\u4ED8\u5B9D \u626B\u7801\u652F\u4ED8 ", /*#__PURE__*/_jsx(Divider, {
|
222
|
+
type: "vertical"
|
223
|
+
}), " \u4E5F\u53EF\u4EE5\u8BA9\u670B\u53CB\u626B\u7801\u4EE3\u4ED8"]
|
224
|
+
})
|
225
|
+
})]
|
226
|
+
})
|
227
|
+
}];
|
228
|
+
return /*#__PURE__*/_jsx(PageContentWarp, {
|
229
|
+
loading: loading,
|
230
|
+
error: error
|
231
|
+
// title="购买会员"
|
232
|
+
,
|
233
|
+
onReload: function onReload() {
|
234
|
+
return run();
|
235
|
+
},
|
236
|
+
children: /*#__PURE__*/_jsxs(styles.BuyQr, {
|
120
237
|
children: [/*#__PURE__*/_jsxs("h2", {
|
121
238
|
children: ["\u8D2D\u4E70\u4F1A\u5458\uFF1A", detailData.productName || detailData.productType]
|
122
239
|
}), /*#__PURE__*/_jsxs("div", {
|
@@ -144,24 +261,21 @@ var VipQr = function VipQr(_ref) {
|
|
144
261
|
})]
|
145
262
|
})]
|
146
263
|
}), /*#__PURE__*/_jsx("div", {
|
147
|
-
className: "
|
148
|
-
children:
|
149
|
-
|
150
|
-
|
264
|
+
className: "payChannel",
|
265
|
+
children: /*#__PURE__*/_jsx(Tabs, {
|
266
|
+
activeKey: payChannel,
|
267
|
+
items: itemsTabs,
|
268
|
+
type: "card",
|
269
|
+
className: "payChannelTabs",
|
270
|
+
onChange: function onChange(keyName) {
|
271
|
+
// @ts-ignore
|
272
|
+
var channel = keyName;
|
273
|
+
setPayChannel(channel);
|
274
|
+
if (!payOrderInfo[channel]) {
|
275
|
+
runPay(channel);
|
276
|
+
}
|
277
|
+
}
|
151
278
|
})
|
152
|
-
}), Platform.isH5 ? /*#__PURE__*/_jsxs("div", {
|
153
|
-
className: "altInH5",
|
154
|
-
children: ["\u957F\u6309\u4E8C\u7EF4\u7801\uFF0C\u53EF\u8BC6\u522B\u4E8C\u7EF4\u7801\u652F\u4ED8", /*#__PURE__*/_jsx("p", {
|
155
|
-
className: "toFriend",
|
156
|
-
children: "\u6216\u8005\u4FDD\u5B58\u56FE\u7247\u8BA9\u670B\u53CB\u626B\u7801\u4EE3\u4ED8"
|
157
|
-
})]
|
158
|
-
}) : /*#__PURE__*/_jsxs("div", {
|
159
|
-
className: "alt",
|
160
|
-
children: ["\u8BF7\u7528 ", /*#__PURE__*/_jsx(WechatOutlined, {
|
161
|
-
className: "wechatIcon"
|
162
|
-
}), " \u5FAE\u4FE1 \u626B\u7801\u652F\u4ED8 ", /*#__PURE__*/_jsx(Divider, {
|
163
|
-
type: "vertical"
|
164
|
-
}), " \u4E5F\u53EF\u4EE5\u8BA9\u670B\u53CB\u626B\u7801\u4EE3\u4ED8"]
|
165
279
|
}), payResult && /*#__PURE__*/_jsxs("div", {
|
166
280
|
className: "payResult",
|
167
281
|
children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(Result, {
|
package/dist/VipCompare/index.js
CHANGED
@@ -14,6 +14,7 @@ import VipCommend from "./commend";
|
|
14
14
|
import * as UserController from "../service/api/UserController";
|
15
15
|
import * as ProductController from "../service/api/ProductController";
|
16
16
|
import Buy from "../Buy";
|
17
|
+
import isInClient from "../lib/isInClient";
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
19
20
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -44,6 +45,7 @@ var VipCompare = function VipCompare(_ref) {
|
|
44
45
|
env: env
|
45
46
|
});
|
46
47
|
}, {
|
48
|
+
manual: !isInClient(),
|
47
49
|
onSuccess: function onSuccess(result) {
|
48
50
|
setProductDetail(result);
|
49
51
|
}
|
@@ -163,6 +165,7 @@ var VipCompare = function VipCompare(_ref) {
|
|
163
165
|
env: env
|
164
166
|
});
|
165
167
|
}, {
|
168
|
+
manual: !isInClient(),
|
166
169
|
onSuccess: function onSuccess(result) {
|
167
170
|
setListData(result);
|
168
171
|
}
|
@@ -179,7 +182,7 @@ var VipCompare = function VipCompare(_ref) {
|
|
179
182
|
_objectDestructuringEmpty(useRequest(function () {
|
180
183
|
return UserController.userVipInfo();
|
181
184
|
}, {
|
182
|
-
manual: !Tool.getLocalUserInfo().isLogin,
|
185
|
+
manual: !isInClient() || !Tool.getLocalUserInfo().isLogin,
|
183
186
|
onSuccess: function onSuccess(result) {
|
184
187
|
var dataDict = {};
|
185
188
|
result === null || result === void 0 || result.forEach(function (items) {
|
package/dist/typings/Trade.d.ts
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
declare namespace Trade {
|
2
2
|
type PayType = 'NATIVE' | 'MWEB';
|
3
|
+
type PayChannel = 'wepay' | 'alipay';
|
3
4
|
interface CommonCreateQuery {
|
4
5
|
productKind: Global.ProductKind;
|
5
6
|
productTypeId: number;
|
6
7
|
productCount: number;
|
7
8
|
userId: number;
|
8
9
|
payType: PayType;
|
10
|
+
payChannel: PayChannel;
|
9
11
|
[name: string]: any;
|
10
12
|
}
|
11
13
|
interface CreateResult {
|
12
14
|
codeUrl: string;
|
13
15
|
mWebUrl: string;
|
16
|
+
payChannel: PayChannel;
|
14
17
|
}
|
15
18
|
interface CommonCreateResult {
|
16
19
|
"h5PayUrl": string;
|