component-sanzhizhou 1.0.5 → 1.0.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.
@@ -1,5 +1,5 @@
1
1
  // 业务服务器 api
2
- export var currentEnv = 'local';
2
+ export var currentEnv = 'prod';
3
3
  var ApiUrls = {
4
4
  local: {
5
5
  api: 'http://localhost:51818/',
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import './qr.less';
3
+ interface Props {
4
+ selectPayChannel: Pay.ChannelListChildrenList;
5
+ vipId: number;
6
+ payChannel: Pay.PayChannel;
7
+ moneyAmount: number;
8
+ size?: number;
9
+ }
10
+ declare const UserVipOrderPayQr: React.FC<Props>;
11
+ export default UserVipOrderPayQr;
@@ -0,0 +1,118 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useState } from 'react';
3
+ import { Button, Divider, QRCode, Spin } from 'antd';
4
+ import "./qr.less";
5
+ import { useRequest } from "@umijs/hooks";
6
+ import * as PayController from "../service/api/PayController";
7
+ import { CheckCircleOutlined, ReloadOutlined } from "@ant-design/icons";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
11
+ var selectPayChannel = _ref.selectPayChannel,
12
+ moneyAmount = _ref.moneyAmount,
13
+ vipId = _ref.vipId,
14
+ _ref$size = _ref.size,
15
+ size = _ref$size === void 0 ? 260 : _ref$size;
16
+ var _useState = useState('loading'),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ qrStatus = _useState2[0],
19
+ setQrStatus = _useState2[1];
20
+ var _useState3 = useState(''),
21
+ _useState4 = _slicedToArray(_useState3, 2),
22
+ qrUrl = _useState4[0],
23
+ setQrUrl = _useState4[1];
24
+ var _useRequest = useRequest(function () {
25
+ return PayController.getPaymentQr({
26
+ payChannel: selectPayChannel.name,
27
+ vipId: vipId,
28
+ moneyAmount: moneyAmount
29
+ });
30
+ }, {
31
+ onSuccess: function onSuccess(result) {
32
+ setQrUrl(result.qrUrl);
33
+ setQrStatus('active');
34
+ },
35
+ onError: function onError(e) {
36
+ setQrStatus('expired');
37
+ }
38
+ }),
39
+ run = _useRequest.run,
40
+ loading = _useRequest.loading;
41
+ var getPaymentQr = function getPaymentQr() {
42
+ setQrStatus('loading');
43
+ run();
44
+ };
45
+ return /*#__PURE__*/_jsxs("div", {
46
+ className: "ssz-payQr",
47
+ children: [/*#__PURE__*/_jsxs(Divider, {
48
+ orientation: "center",
49
+ className: "ssz-altBox",
50
+ children: ["\u626B\u7801\u652F\u4ED8", /*#__PURE__*/_jsxs("span", {
51
+ className: "ssz-qr-moneyAmountBox",
52
+ children: [/*#__PURE__*/_jsx("small", {
53
+ children: "\xA5"
54
+ }), /*#__PURE__*/_jsx("span", {
55
+ className: "ssz-qr-moneyAmount",
56
+ children: moneyAmount
57
+ }), /*#__PURE__*/_jsx("small", {
58
+ children: "\u5143"
59
+ })]
60
+ })]
61
+ }), /*#__PURE__*/_jsxs("div", {
62
+ className: "ssz-qrImage",
63
+ style: {
64
+ width: size
65
+ },
66
+ children: [/*#__PURE__*/_jsxs("div", {
67
+ className: "ssz-name",
68
+ style: {
69
+ color: selectPayChannel.color
70
+ },
71
+ children: [selectPayChannel.icon, " ", selectPayChannel.label]
72
+ }), /*#__PURE__*/_jsx("div", {
73
+ className: "ssz-qrImageWarp",
74
+ children: /*#__PURE__*/_jsx(QRCode, {
75
+ type: "svg",
76
+ color: selectPayChannel.color,
77
+ bgColor: "#FFF",
78
+ size: size,
79
+ value: qrUrl || '内容为空',
80
+ status: qrStatus,
81
+ errorLevel: "M",
82
+ statusRender: function statusRender(info) {
83
+ if (info.status === 'loading') {
84
+ return /*#__PURE__*/_jsx(Spin, {
85
+ size: "large"
86
+ });
87
+ }
88
+ if (info.status === 'scanned') {
89
+ return /*#__PURE__*/_jsxs("div", {
90
+ children: [/*#__PURE__*/_jsx(CheckCircleOutlined, {}), " \u5DF2\u626B\u7801"]
91
+ });
92
+ }
93
+ if (info.status === 'expired') {
94
+ return /*#__PURE__*/_jsxs("div", {
95
+ children: ["\u4E8C\u7EF4\u7801\u5DF2\u7ECF\u8FC7\u671F", /*#__PURE__*/_jsx("div", {
96
+ style: {
97
+ paddingTop: 18
98
+ },
99
+ children: /*#__PURE__*/_jsx(Button, {
100
+ type: "link",
101
+ icon: /*#__PURE__*/_jsx(ReloadOutlined, {}),
102
+ onClick: getPaymentQr,
103
+ children: "\u5237\u65B0"
104
+ })
105
+ })]
106
+ });
107
+ }
108
+ return '';
109
+ }
110
+ })
111
+ }), /*#__PURE__*/_jsx("div", {
112
+ className: "ssz-alt",
113
+ children: "\u8BF7\u626B\u7801\u652F\u4ED8"
114
+ })]
115
+ })]
116
+ });
117
+ };
118
+ export default UserVipOrderPayQr;
@@ -0,0 +1,49 @@
1
+ .ssz-payQr{
2
+ .ssz-altBox{
3
+ font-size: large;
4
+ .ssz-qr-moneyAmountBox{
5
+ padding: 0 0 0 12px;
6
+ font-weight: 300;
7
+
8
+ small{
9
+ opacity: 0.7;
10
+ }
11
+ .ssz-qr-moneyAmount{
12
+ padding: 0 3px;
13
+ color: #C00;
14
+ font-size: x-large;
15
+ font-weight: 700;
16
+ font-family: Arial, Helvetica, sans-serif;
17
+ }
18
+ }
19
+
20
+ }
21
+ .ssz-qrImage{
22
+ margin: 0 auto 60px;
23
+ //width: 220px;
24
+ //height: 220px;
25
+ .name{
26
+ font-size: 20px;
27
+ font-weight: 300;
28
+ padding: 0 0 16px;
29
+ text-align: center;
30
+ }
31
+ .ssz-qrImageWarp{
32
+ background-color: #EEE;
33
+
34
+ }
35
+ .ssz-alt{
36
+ text-align: center;
37
+ color: #AAA;
38
+ padding: 6px 0;
39
+ font-weight: 300;
40
+ }
41
+
42
+ }
43
+ .ssz-name{
44
+ text-align: center;
45
+ padding: 5px 0 12px 0;
46
+ }
47
+
48
+
49
+ }
package/dist/pay/qr.d.ts CHANGED
@@ -6,6 +6,7 @@ interface Props {
6
6
  payChannel: Pay.PayChannel;
7
7
  moneyAmount: number;
8
8
  size?: number;
9
+ env?: Global.Env;
9
10
  }
10
11
  declare const UserVipOrderPayQr: React.FC<Props>;
11
12
  export default UserVipOrderPayQr;
package/dist/pay/qr.js CHANGED
@@ -3,33 +3,44 @@ import React, { useState } from 'react';
3
3
  import { Button, Divider, QRCode, Spin } from 'antd';
4
4
  import "./qr.less";
5
5
  import { useRequest } from "@umijs/hooks";
6
- import * as PayController from "../service/api/PayController";
6
+ import * as RechargeController from "../service/api/RechargeController";
7
7
  import { CheckCircleOutlined, ReloadOutlined } from "@ant-design/icons";
8
+ import { getEnv } from "../lib/getApiUrl";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var QrDict = {
12
+ local: 'https://pay.sanzhizhou.com/pay/wepay-qr',
13
+ // 'http://localhost:8001/pay/wepay-qr',
14
+ pre: 'http://localhost:8001/pay/wepay-qr',
15
+ prod: 'https://pay.sanzhizhou.com/pay/wepay-qr'
16
+ };
10
17
  var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
11
18
  var selectPayChannel = _ref.selectPayChannel,
12
19
  moneyAmount = _ref.moneyAmount,
13
20
  vipId = _ref.vipId,
14
21
  _ref$size = _ref.size,
15
- size = _ref$size === void 0 ? 260 : _ref$size;
16
- var _useState = useState('loading'),
22
+ size = _ref$size === void 0 ? 260 : _ref$size,
23
+ env = _ref.env;
24
+ var _useState = useState(''),
17
25
  _useState2 = _slicedToArray(_useState, 2),
18
- qrStatus = _useState2[0],
19
- setQrStatus = _useState2[1];
20
- var _useState3 = useState(''),
26
+ qrUrl = _useState2[0],
27
+ setQrUrl = _useState2[1];
28
+ var _useState3 = useState('loading'),
21
29
  _useState4 = _slicedToArray(_useState3, 2),
22
- qrUrl = _useState4[0],
23
- setQrUrl = _useState4[1];
30
+ qrStatus = _useState4[0],
31
+ setQrStatus = _useState4[1];
24
32
  var _useRequest = useRequest(function () {
25
- return PayController.getPaymentQr({
33
+ return RechargeController.create({
26
34
  payChannel: selectPayChannel.name,
27
- vipId: vipId,
28
35
  moneyAmount: moneyAmount
36
+ }, {
37
+ env: env
29
38
  });
30
39
  }, {
31
40
  onSuccess: function onSuccess(result) {
32
- setQrUrl(result.qrUrl);
41
+ var qrUrlBase = QrDict[getEnv()] || QrDict.prod;
42
+ var qrUrl = qrUrlBase + (qrUrlBase.indexOf('?') !== -1 ? '?' : '&') + "tradeIdKey=".concat(result.tradeIdKey);
43
+ setQrUrl(qrUrl);
33
44
  setQrStatus('active');
34
45
  },
35
46
  onError: function onError(e) {
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface Props {
3
3
  nickName: React.ReactNode;
4
4
  onHandSuccess: () => void;
5
+ env?: Global.Env;
5
6
  }
6
7
  declare const PayRecharge: React.FC<Props>;
7
8
  export default PayRecharge;
@@ -6,7 +6,7 @@ import React, { useState } from 'react';
6
6
  import { Button, Divider, Form, InputNumber, Radio, Tag } from 'antd';
7
7
  import styles from "./recharge.css";
8
8
  import { WechatOutlined, AlipayCircleOutlined, CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
9
- import UserVipOrderPayQr from "./qr";
9
+ import PayQr from "./qr";
10
10
  import notification from "../lib/notification";
11
11
  import sleep from "../lib/sleep";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -40,7 +40,8 @@ var PayChannelList = [{
40
40
  }];
41
41
  var PayRecharge = function PayRecharge(_ref) {
42
42
  var nickName = _ref.nickName,
43
- onHandSuccess = _ref.onHandSuccess;
43
+ onHandSuccess = _ref.onHandSuccess,
44
+ env = _ref.env;
44
45
  var _useState = useState(PayChannelList[0].childrenList[0]),
45
46
  _useState2 = _slicedToArray(_useState, 2),
46
47
  selectPayChannel = _useState2[0],
@@ -169,12 +170,15 @@ var PayRecharge = function PayRecharge(_ref) {
169
170
  })
170
171
  })
171
172
  })]
172
- }), step === 'qr-show' && /*#__PURE__*/_jsx(UserVipOrderPayQr, {
173
- moneyAmount: formData.moneyAmount,
174
- vipId: 0,
175
- payChannel: formData.payChannel,
176
- selectPayChannel: selectPayChannel,
177
- size: 260
173
+ }), step === 'qr-show' && /*#__PURE__*/_jsx(_Fragment, {
174
+ children: formData.payChannel === 'wepay' && /*#__PURE__*/_jsx(PayQr, {
175
+ moneyAmount: formData.moneyAmount,
176
+ vipId: 0,
177
+ payChannel: formData.payChannel,
178
+ selectPayChannel: selectPayChannel,
179
+ size: 260,
180
+ env: env
181
+ })
178
182
  }), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs("div", {
179
183
  className: "ssz-submits",
180
184
  children: [/*#__PURE__*/_jsx("div", {
@@ -0,0 +1,3 @@
1
+ export declare function create(body: Recharge.CreateQuery, options?: {
2
+ [key: string]: any;
3
+ }): Promise<Recharge.CreateResult>;
@@ -0,0 +1,27 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import request from "../../lib/request";
5
+ export function create(_x, _x2) {
6
+ return _create.apply(this, arguments);
7
+ }
8
+ function _create() {
9
+ _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(body, options) {
10
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11
+ while (1) switch (_context.prev = _context.next) {
12
+ case 0:
13
+ return _context.abrupt("return", request("user/recharge/create", _objectSpread({
14
+ method: 'POST',
15
+ headers: {
16
+ 'Content-Type': 'application/json'
17
+ },
18
+ data: _objectSpread({}, body)
19
+ }, options || {})));
20
+ case 1:
21
+ case "end":
22
+ return _context.stop();
23
+ }
24
+ }, _callee);
25
+ }));
26
+ return _create.apply(this, arguments);
27
+ }
@@ -7,7 +7,7 @@ declare namespace Pay {
7
7
  childrenList: ChannelListChildrenList[];
8
8
  }
9
9
  interface ChannelListChildrenList {
10
- name: string;
10
+ name: Pay.PayChannel;
11
11
  label: React.ReactNode;
12
12
  icon: React.ReactNode;
13
13
  color: string;
@@ -0,0 +1,9 @@
1
+ declare namespace Recharge {
2
+ interface CreateQuery {
3
+ payChannel: Pay.PayChannel;
4
+ moneyAmount: number;
5
+ }
6
+ interface CreateResult {
7
+ tradeIdKey: string;
8
+ }
9
+ }
File without changes
@@ -1,6 +1,6 @@
1
1
  declare namespace Trade {
2
2
  type PayType = 'NATIVE' | 'MWEB';
3
- type PayChannel = 'wepay' | 'alipay';
3
+ type PayChannel = 'wepay' | 'alipay' | 'paypal';
4
4
  interface CommonCreateQuery {
5
5
  productKind: Global.ProductKind;
6
6
  productTypeId: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-sanzhizhou",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",