component-sanzhizhou 1.0.18 → 1.0.19

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/dist/Buy/qr.js CHANGED
@@ -86,7 +86,8 @@ var VipQr = function VipQr(_ref) {
86
86
  userId: Tool.getLocalUserInfo().id,
87
87
  payType: 'NATIVE',
88
88
  //Platform.isH5 ? 'MWEB' : 'NATIVE',
89
- payChannel: channel
89
+ payChannel: channel,
90
+ userToken: Tool.getLocalUserInfo().sid
90
91
  }, {
91
92
  env: env
92
93
  });
package/dist/pay/qr.js CHANGED
@@ -4,10 +4,9 @@ import { Button, Divider, QRCode, Spin } from 'antd';
4
4
  import "./qr.less";
5
5
  import { useRequest } from "@umijs/hooks";
6
6
  import { CheckCircleOutlined, ReloadOutlined } from "@ant-design/icons";
7
- import Tool from "../lib/Tool";
8
- import CallMiniUrl from "../lib/call-mini-url";
9
7
  import formatMessage from "../lib/formatMessage";
10
8
  import * as WechatMinAppController from "../service/api/WechatMinAppController";
9
+ import * as TradeController from "../service/api/TradeController";
11
10
  import { getApiEnv } from "../lib/getApiUrl";
12
11
  import getLocalUserInfo from "../lib/getLocalUserInfo";
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -39,27 +38,33 @@ var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
39
38
  _useState4 = _slicedToArray(_useState3, 2),
40
39
  qrStatus = _useState4[0],
41
40
  setQrStatus = _useState4[1];
42
- var makeQrUrl = function makeQrUrl() {
43
- var query = {
44
- // fromSid: Tool.getLocalUserInfo().sid,
45
- // fromChannel: 'web',
46
- fromChannel: selectPayChannel.name,
47
- productKind: productKind ? productKind : vipId == 0 ? 'recharge' : '',
48
- productCount: productCount,
49
- productId: vipId,
50
- userToken: Tool.getLocalUserInfo().sid,
51
- productName: productName,
52
- payMoney: moneyAmount
53
- };
54
- var qrUrl = CallMiniUrl(appId, '', query);
55
- console.log('makeQrUrl bind:', query, qrUrl);
56
- setQrUrl(qrUrl);
57
- setQrStatus('active');
58
- };
41
+
42
+ // const makeQrUrl = () => {
43
+ // const query = {
44
+ // // fromSid: Tool.getLocalUserInfo().sid,
45
+ // // fromChannel: 'web',
46
+ // fromChannel: selectPayChannel.name ,
47
+ // productKind: productKind ? productKind : ( vipId == 0 ? 'recharge' : '' ),
48
+ // productCount,
49
+ // productId: vipId,
50
+ // userToken: Tool.getLocalUserInfo().sid,
51
+ // productName,
52
+ // payMoney: moneyAmount,
53
+ // };
54
+ // const qrUrl = CallMiniUrl(
55
+ // appId,
56
+ // '',
57
+ // query,
58
+ // );
59
+ // console.log('makeQrUrl bind:', query, qrUrl );
60
+ // setQrUrl( qrUrl );
61
+ // setQrStatus('active');
62
+ // }
63
+
59
64
  var _useRequest = useRequest(function () {
60
65
  return WechatMinAppController.getUrlLink({
61
66
  pagePath: 'pages/recharge/index',
62
- pathQuery: "moneyAmount=".concat(moneyAmount, "&userToken=").concat(getLocalUserInfo().sid || '', "&productKind=recharge"),
67
+ pathQuery: "moneyAmount=".concat(moneyAmount, "&userToken=").concat(getLocalUserInfo().sid || '', "&productKind=").concat(productKind),
63
68
  envVersion: getApiEnv() === 'local' ? "develop" : 'release'
64
69
  }, {
65
70
  env: env
@@ -76,6 +81,29 @@ var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
76
81
  }),
77
82
  runWechatMinApp = _useRequest.run,
78
83
  loadingWechatMinApp = _useRequest.loading;
84
+ var _useRequest2 = useRequest(function () {
85
+ return TradeController.commonCreate({
86
+ productKind: productKind,
87
+ productTypeId: 0,
88
+ productCount: moneyAmount,
89
+ userId: 0,
90
+ payChannel: 'alipay',
91
+ userToken: getLocalUserInfo().sid || ''
92
+ }, {
93
+ env: env
94
+ });
95
+ }, {
96
+ manual: true,
97
+ onSuccess: function onSuccess(result) {
98
+ setQrUrl(result.qrUrl || '');
99
+ setQrStatus('active');
100
+ },
101
+ onError: function onError(e) {
102
+ setQrStatus('expired');
103
+ }
104
+ }),
105
+ runAlipay = _useRequest2.run,
106
+ loadingAlipay = _useRequest2.loading;
79
107
  var onInit = function onInit() {
80
108
  // const qrUrlBase = QrDict[ getEnv() ] || QrDict.prod;
81
109
  // const data = JSON.stringify({
@@ -94,11 +122,11 @@ var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
94
122
  if (selectPayChannel.name === 'wepay') {
95
123
  runWechatMinApp();
96
124
  } else if (selectPayChannel.name === 'alipay') {
97
- makeQrUrl();
125
+ runAlipay();
98
126
  }
99
127
  };
100
128
  var getPaymentQr = function getPaymentQr() {
101
- runWechatMinApp();
129
+ onInit();
102
130
  };
103
131
  useEffect(function () {
104
132
  onInit();
@@ -70,10 +70,13 @@ var PayRecharge = function PayRecharge(_ref) {
70
70
  onHandSuccess = _ref.onHandSuccess,
71
71
  env = _ref.env;
72
72
  var _useState = useState(((_PayChannelList$filte = PayChannelList.filter(function (items) {
73
- return items.childrenList.map(function (item) {
73
+ var itemList = items.childrenList.filter(function (item) {
74
74
  return item.name === defaultPayChannel;
75
75
  });
76
- })) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte[0]) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte.childrenList) === null || _PayChannelList$filte === void 0 ? void 0 : _PayChannelList$filte[0]) || PayChannelList[0].childrenList[0]),
76
+ return itemList.length > 0;
77
+ })) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte[0]) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte.childrenList.filter(function (item) {
78
+ return item.name === defaultPayChannel;
79
+ })) === null || _PayChannelList$filte === void 0 ? void 0 : _PayChannelList$filte[0]) || PayChannelList[0].childrenList[0]),
77
80
  _useState2 = _slicedToArray(_useState, 2),
78
81
  selectPayChannel = _useState2[0],
79
82
  setSelectPayChannel = _useState2[1];
@@ -1,7 +1,4 @@
1
1
  export declare function create(body: Trade.CommonCreateQuery, options?: {
2
2
  [key: string]: any;
3
3
  }): Promise<Trade.CreateResult>;
4
- export declare function versionList(body?: {
5
- dealerId: number;
6
- productType: string;
7
- }, options?: Global.RequestOptions): Promise<Product.VersionList[]>;
4
+ export declare function commonCreate(body: Trade.CommonCreateQuery, options?: Global.RequestOptions): Promise<Trade.CommonCreate>;
@@ -27,20 +27,20 @@ function _create() {
27
27
  }));
28
28
  return _create.apply(this, arguments);
29
29
  }
30
- export function versionList(_x3, _x4) {
31
- return _versionList.apply(this, arguments);
30
+ export function commonCreate(_x3, _x4) {
31
+ return _commonCreate.apply(this, arguments);
32
32
  }
33
- function _versionList() {
34
- _versionList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body, options) {
33
+ function _commonCreate() {
34
+ _commonCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body, options) {
35
35
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
36
36
  while (1) switch (_context2.prev = _context2.next) {
37
37
  case 0:
38
- return _context2.abrupt("return", request("clientVersion/list", _objectSpread({
39
- method: 'GET',
38
+ return _context2.abrupt("return", request("trade/commonCreate", _objectSpread({
39
+ method: 'POST',
40
40
  headers: {
41
41
  'Content-Type': 'application/json'
42
42
  },
43
- params: _objectSpread({}, body)
43
+ data: _objectSpread({}, body)
44
44
  }, options || {})));
45
45
  case 1:
46
46
  case "end":
@@ -48,5 +48,5 @@ function _versionList() {
48
48
  }
49
49
  }, _callee2);
50
50
  }));
51
- return _versionList.apply(this, arguments);
51
+ return _commonCreate.apply(this, arguments);
52
52
  }
@@ -6,8 +6,9 @@ declare namespace Trade {
6
6
  productTypeId: number;
7
7
  productCount: number;
8
8
  userId: number;
9
- payType: PayType;
9
+ payType?: PayType;
10
10
  payChannel: PayChannel;
11
+ userToken: string;
11
12
  [name: string]: any;
12
13
  }
13
14
  interface CreateResult {
@@ -15,12 +16,12 @@ declare namespace Trade {
15
16
  mWebUrl: string;
16
17
  payChannel: PayChannel;
17
18
  }
18
- interface CommonCreateResult {
19
- "h5PayUrl": string;
20
- "orderIdKey": string;
21
- "tradeIdKey": string;
22
- "tradeNo": string;
23
- jsApiInfo: {
19
+ interface CommonCreate {
20
+ h5PayUrl?: string;
21
+ orderIdKey?: string;
22
+ tradeIdKey?: string;
23
+ tradeNo?: string;
24
+ jsApiInfo?: {
24
25
  appId: string;
25
26
  timeStamp: string;
26
27
  nonceStr: string;
@@ -28,5 +29,6 @@ declare namespace Trade {
28
29
  package: string;
29
30
  paySign: string;
30
31
  };
32
+ qrUrl?: string;
31
33
  }
32
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-sanzhizhou",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
File without changes