component-sanzhizhou 1.0.18 → 1.0.23

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.
@@ -4,6 +4,7 @@ interface Props {
4
4
  vipId: number;
5
5
  productCount: number;
6
6
  productKind: 'vip' | 'vip-card';
7
+ couponCode: string;
7
8
  showPrice?: number;
8
9
  disabled?: boolean;
9
10
  payMethod?: Global.PayMethod;
package/dist/Buy/index.js CHANGED
@@ -17,6 +17,7 @@ var Buy = function Buy(_ref) {
17
17
  _ref$productCount = _ref.productCount,
18
18
  productCount = _ref$productCount === void 0 ? 1 : _ref$productCount,
19
19
  payMethod = _ref.payMethod,
20
+ couponCode = _ref.couponCode,
20
21
  _ref$disabled = _ref.disabled,
21
22
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
22
23
  showPrice = _ref.showPrice,
@@ -99,6 +100,7 @@ var Buy = function Buy(_ref) {
99
100
  vipId: vipId,
100
101
  productCount: productCount,
101
102
  payMethod: payMethod,
103
+ couponCode: couponCode,
102
104
  onHandlePaySuccess: function onHandlePaySuccess() {
103
105
  onBuySuccess();
104
106
  dialog.destroy();
package/dist/Buy/qr.d.ts CHANGED
@@ -4,6 +4,7 @@ interface Props {
4
4
  productKind: string;
5
5
  vipId: number;
6
6
  productCount: number;
7
+ couponCode: string;
7
8
  payMethod?: Global.PayMethod;
8
9
  onHandlePaySuccess: () => void;
9
10
  }
package/dist/Buy/qr.js CHANGED
@@ -23,6 +23,7 @@ var VipQr = function VipQr(_ref) {
23
23
  productCount = _ref$productCount === void 0 ? 1 : _ref$productCount,
24
24
  _ref$vipId = _ref.vipId,
25
25
  vipId = _ref$vipId === void 0 ? 0 : _ref$vipId,
26
+ couponCode = _ref.couponCode,
26
27
  _ref$payMethod = _ref.payMethod,
27
28
  payMethod = _ref$payMethod === void 0 ? ['wepay', 'alipay'] : _ref$payMethod,
28
29
  _ref$onHandlePaySucce = _ref.onHandlePaySuccess,
@@ -80,13 +81,15 @@ var VipQr = function VipQr(_ref) {
80
81
  var _useRequest = useRequest(function () {
81
82
  var channel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : payChannel;
82
83
  return TradeController.create({
84
+ couponCode: couponCode,
83
85
  productKind: productKind,
84
86
  productTypeId: vipId,
85
87
  productCount: productCount,
86
88
  userId: Tool.getLocalUserInfo().id,
87
89
  payType: 'NATIVE',
88
90
  //Platform.isH5 ? 'MWEB' : 'NATIVE',
89
- payChannel: channel
91
+ payChannel: channel,
92
+ userToken: Tool.getLocalUserInfo().sid
90
93
  }, {
91
94
  env: env
92
95
  });
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  interface Props {
3
- value?: number;
3
+ value?: number | string;
4
4
  pre?: React.ReactNode;
5
5
  end?: React.ReactNode;
6
6
  precision?: number;
@@ -2,6 +2,7 @@ import styles from "./index.css";
2
2
  import React from "react";
3
3
  import moneySimple from "../../lib/moneySimple";
4
4
  import { Tooltip } from "antd";
5
+ import formatMessage from "../../lib/formatMessage";
5
6
  import { Fragment as _Fragment } from "react/jsx-runtime";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -11,7 +12,7 @@ var Money = function Money(_ref) {
11
12
  children: "\xA5"
12
13
  }) : _ref$pre,
13
14
  _ref$end = _ref.end,
14
- end = _ref$end === void 0 ? '元' : _ref$end,
15
+ end = _ref$end === void 0 ? formatMessage('元') : _ref$end,
15
16
  value = _ref.value,
16
17
  _ref$precision = _ref.precision,
17
18
  precision = _ref$precision === void 0 ? 2 : _ref$precision,
@@ -28,13 +29,17 @@ var Money = function Money(_ref) {
28
29
  className: className,
29
30
  children: [/*#__PURE__*/_jsx("span", {
30
31
  className: "yen",
31
- children: pre
32
+ children: /*#__PURE__*/_jsx("small", {
33
+ children: pre
34
+ })
32
35
  }), /*#__PURE__*/_jsx("span", {
33
36
  className: "value ".concat(value === 0 ? 'zero' : '', " "),
34
- children: typeof value === 'number' ? disabledMoneySimple ? parseFloat(value.toFixed(precision)) : moneySimple(value, false, precision) : ''
37
+ children: typeof value === 'number' ? disabledMoneySimple ? parseFloat(value.toFixed(precision)) : moneySimple(value, false, precision) : value
35
38
  }), /*#__PURE__*/_jsx("span", {
36
39
  className: "yen",
37
- children: end
40
+ children: /*#__PURE__*/_jsx("small", {
41
+ children: end
42
+ })
38
43
  })]
39
44
  })
40
45
  });
@@ -372,6 +372,7 @@ var VipList = function VipList(_ref) {
372
372
  productKind: "vip",
373
373
  vipId: (item === null || item === void 0 ? void 0 : item.id) || 0,
374
374
  productCount: 1,
375
+ couponCode: "",
375
376
  payMethod: payMethod,
376
377
  showPrice: item === null || item === void 0 ? void 0 : item.price,
377
378
  onBuySuccess: onBuySuccess,
package/dist/index.d.ts CHANGED
@@ -14,3 +14,6 @@ export { default as fileListContent } from './base/fileListContent';
14
14
  export { default as fileList } from './base/fileList';
15
15
  export { default as Ad } from './Ad';
16
16
  export { default as PayRecharge } from './pay/recharge';
17
+ export { default as PayVip } from './pay/vip';
18
+ export { default as PayQr } from './pay/qr';
19
+ export { default as PayChannel } from './pay/pay-channel';
package/dist/index.js CHANGED
@@ -1,5 +1,3 @@
1
- // import soundInfo from "component-sanzhizhou/base/soundInfo";
2
- // import fileList from "component-sanzhizhou/base/fileList";
3
1
  import "./global.less";
4
2
  export { default as Buy } from "./Buy";
5
3
  export { default as Login } from "./Login";
@@ -15,4 +13,7 @@ export { default as openInFolder } from "./base/openInFolder";
15
13
  export { default as fileListContent } from "./base/fileListContent";
16
14
  export { default as fileList } from "./base/fileList";
17
15
  export { default as Ad } from "./Ad";
18
- export { default as PayRecharge } from "./pay/recharge";
16
+ export { default as PayRecharge } from "./pay/recharge";
17
+ export { default as PayVip } from "./pay/vip";
18
+ export { default as PayQr } from "./pay/qr";
19
+ export { default as PayChannel } from "./pay/pay-channel";
@@ -162,7 +162,7 @@ declare const Tool: {
162
162
  getTitleByPath(path: string): string;
163
163
  getDirByPath(path: string): string;
164
164
  h5Pay(query: Pay.H5PayQuery): void;
165
- notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
165
+ notification(type: "info" | "error" | "warning" | "success", message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
166
166
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
167
167
  notificationError(message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
168
168
  notificationWarning(message: string, description?: import("react").ReactNode, options?: import("./notification").NotificationOption): void;
@@ -33,5 +33,7 @@
33
33
  "重试": "重试",
34
34
  "充值就送": "充值就送",
35
35
  "送": "送",
36
- "选择": "选择"
36
+ "选择": "选择",
37
+ "名称": "名称",
38
+ "优惠券": "优惠券"
37
39
  }
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ interface Props {
3
+ defaultPayChannel: Pay.PayChannel;
4
+ allowPayChannelList: Pay.PayChannel[];
5
+ onSelect: (payChannelInfo: Pay.ChannelListChildrenList) => void;
6
+ }
7
+ declare const PayChannel: React.FC<Props>;
8
+ export default PayChannel;
@@ -0,0 +1,43 @@
1
+ import PayChannelList from "./payChannelList";
2
+ import { Radio, Tag } from "antd";
3
+ import formatMessage from "../lib/formatMessage";
4
+ import React from "react";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ var PayChannel = function PayChannel(_ref) {
8
+ var defaultPayChannel = _ref.defaultPayChannel,
9
+ _ref$allowPayChannelL = _ref.allowPayChannelList,
10
+ allowPayChannelList = _ref$allowPayChannelL === void 0 ? [] : _ref$allowPayChannelL,
11
+ onSelect = _ref.onSelect;
12
+ return /*#__PURE__*/_jsx(Radio.Group, {
13
+ defaultValue: defaultPayChannel,
14
+ onChange: function onChange(e) {
15
+ var _e$target$id, _e$target$id$split;
16
+ var idInfo = ((_e$target$id = e.target.id) === null || _e$target$id === void 0 || (_e$target$id$split = _e$target$id.split) === null || _e$target$id$split === void 0 ? void 0 : _e$target$id$split.call(_e$target$id, '-')) || [];
17
+ var index = parseInt(idInfo[1]) || 0;
18
+ var i = parseInt(idInfo[2]) || 0;
19
+ onSelect(PayChannelList[index].childrenList[i]);
20
+ },
21
+ children: PayChannelList.map(function (items, index) {
22
+ return items.disabled ? null : /*#__PURE__*/_jsxs("div", {
23
+ className: "ssz-groupItems",
24
+ children: [/*#__PURE__*/_jsx("div", {
25
+ className: "ssz-groupTitle",
26
+ children: items.groupTitle
27
+ }), items.childrenList.map(function (item, i) {
28
+ return item.disabled || !(allowPayChannelList !== null && allowPayChannelList !== void 0 && allowPayChannelList.includes(item.name)) ? null : /*#__PURE__*/_jsx(Radio, {
29
+ disabled: item.disabled,
30
+ value: item.name,
31
+ id: "payChannel-".concat(index, "-").concat(i),
32
+ children: /*#__PURE__*/_jsxs(Tag, {
33
+ color: item.color,
34
+ className: "ssz-color-tag",
35
+ children: [item.icon, " ", formatMessage(item.label)]
36
+ })
37
+ }, "".concat(i, "-").concat(item.name));
38
+ })]
39
+ }, "".concat(index, "-").concat(items.groupTitle));
40
+ })
41
+ });
42
+ };
43
+ export default PayChannel;
@@ -0,0 +1,2 @@
1
+ declare const PayChannelList: Pay.ChannelList[];
2
+ export default PayChannelList;
@@ -0,0 +1,30 @@
1
+ import { AlipayCircleOutlined, WechatOutlined } from "@ant-design/icons";
2
+ import React from "react";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ var PayChannelList = [{
5
+ groupTitle: '',
6
+ childrenList: [{
7
+ name: 'wepay',
8
+ label: '微信支付',
9
+ icon: /*#__PURE__*/_jsx(WechatOutlined, {}),
10
+ color: '#2bae68',
11
+ disabled: false
12
+ }, {
13
+ name: 'alipay',
14
+ label: '支付宝',
15
+ icon: /*#__PURE__*/_jsx(AlipayCircleOutlined, {}),
16
+ color: '#1c6cf4',
17
+ disabled: false
18
+ }]
19
+ }, {
20
+ groupTitle: '国际支付',
21
+ disabled: true,
22
+ childrenList: [{
23
+ name: 'paypal',
24
+ label: 'Paypal',
25
+ icon: /*#__PURE__*/_jsx(WechatOutlined, {}),
26
+ color: '#F60',
27
+ disabled: true
28
+ }]
29
+ }];
30
+ export default PayChannelList;
package/dist/pay/qr.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  import React from 'react';
2
2
  import './qr.less';
3
3
  interface Props {
4
- appId: string;
5
4
  productKind: Pay.ProductKind;
6
- selectPayChannel: Pay.ChannelListChildrenList;
7
5
  vipId: number;
6
+ couponCode: string;
8
7
  payChannel: Pay.PayChannel;
9
8
  productCount: number;
10
- productName: string;
11
9
  moneyAmount: number;
12
10
  size?: number;
13
11
  env?: Global.Env;
package/dist/pay/qr.js CHANGED
@@ -1,15 +1,16 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import React, { useEffect, useState } from 'react';
3
4
  import { Button, Divider, QRCode, Spin } from 'antd';
4
5
  import "./qr.less";
5
6
  import { useRequest } from "@umijs/hooks";
6
7
  import { CheckCircleOutlined, ReloadOutlined } from "@ant-design/icons";
7
- import Tool from "../lib/Tool";
8
- import CallMiniUrl from "../lib/call-mini-url";
9
8
  import formatMessage from "../lib/formatMessage";
10
9
  import * as WechatMinAppController from "../service/api/WechatMinAppController";
10
+ import * as TradeController from "../service/api/TradeController";
11
11
  import { getApiEnv } from "../lib/getApiUrl";
12
12
  import getLocalUserInfo from "../lib/getLocalUserInfo";
13
+ import PayChannelList from "./payChannelList";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
16
  // type QrDict = Record<Global.Env, string>;
@@ -21,12 +22,11 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
21
22
  // };
22
23
 
23
24
  var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
24
- var appId = _ref.appId,
25
- selectPayChannel = _ref.selectPayChannel,
25
+ var payChannel = _ref.payChannel,
26
26
  moneyAmount = _ref.moneyAmount,
27
27
  productCount = _ref.productCount,
28
28
  vipId = _ref.vipId,
29
- productName = _ref.productName,
29
+ couponCode = _ref.couponCode,
30
30
  _ref$size = _ref.size,
31
31
  size = _ref$size === void 0 ? 260 : _ref$size,
32
32
  productKind = _ref.productKind,
@@ -39,36 +39,42 @@ var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
39
39
  _useState4 = _slicedToArray(_useState3, 2),
40
40
  qrStatus = _useState4[0],
41
41
  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
- };
42
+ var _useState5 = useState({
43
+ needPayMoney: 0
44
+ }),
45
+ _useState6 = _slicedToArray(_useState5, 2),
46
+ payMoneyInfo = _useState6[0],
47
+ setPayMoneyInfo = _useState6[1];
48
+ var selectPayChannel = function (_PayChannelList$filte) {
49
+ var selectItem = ((_PayChannelList$filte = PayChannelList.filter(function (items) {
50
+ return items.childrenList.filter(function (item) {
51
+ return item.name === payChannel;
52
+ });
53
+ })[0]) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte.childrenList) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte.filter(function (item) {
54
+ return item.name === payChannel;
55
+ })) === null || _PayChannelList$filte === void 0 ? void 0 : _PayChannelList$filte[0]) || {};
56
+ return selectItem;
57
+ }();
59
58
  var _useRequest = useRequest(function () {
60
- return WechatMinAppController.getUrlLink({
61
- pagePath: 'pages/recharge/index',
62
- pathQuery: "moneyAmount=".concat(moneyAmount, "&userToken=").concat(getLocalUserInfo().sid || '', "&productKind=recharge"),
59
+ var postQuery = {
60
+ pagePath: "pages/recharge/index",
61
+ pathQuery: "moneyAmount=".concat(moneyAmount, "&productCount=").concat(productCount, "&userToken=").concat(getLocalUserInfo().sid || '', "&productKind=").concat(productKind, "&productTypeId=").concat(vipId, "&payChannel=").concat(payChannel),
62
+ couponCode: couponCode,
63
63
  envVersion: getApiEnv() === 'local' ? "develop" : 'release'
64
- }, {
64
+ };
65
+ console.log('WechatMinApp.GetUrlLinkQuery postQuery:', postQuery);
66
+ return WechatMinAppController.getUrlLink(postQuery, {
65
67
  env: env
66
68
  });
67
69
  }, {
68
70
  manual: true,
69
71
  onSuccess: function onSuccess(result) {
72
+ var _result$payMoneyInfo$, _result$payMoneyInfo;
70
73
  setQrUrl(result.url);
71
74
  setQrStatus('active');
75
+ setPayMoneyInfo(_objectSpread(_objectSpread({}, result.payMoneyInfo), {}, {
76
+ needPayMoney: (_result$payMoneyInfo$ = result === null || result === void 0 || (_result$payMoneyInfo = result.payMoneyInfo) === null || _result$payMoneyInfo === void 0 ? void 0 : _result$payMoneyInfo.needPayMoney) !== null && _result$payMoneyInfo$ !== void 0 ? _result$payMoneyInfo$ : moneyAmount
77
+ }));
72
78
  },
73
79
  onError: function onError(e) {
74
80
  setQrStatus('expired');
@@ -76,29 +82,43 @@ var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
76
82
  }),
77
83
  runWechatMinApp = _useRequest.run,
78
84
  loadingWechatMinApp = _useRequest.loading;
85
+ var _useRequest2 = useRequest(function () {
86
+ return TradeController.commonCreate({
87
+ productKind: productKind,
88
+ productTypeId: vipId,
89
+ productCount: moneyAmount,
90
+ userId: 0,
91
+ payChannel: 'alipay',
92
+ couponCode: couponCode,
93
+ userToken: getLocalUserInfo().sid || ''
94
+ }, {
95
+ env: env
96
+ });
97
+ }, {
98
+ manual: true,
99
+ onSuccess: function onSuccess(result) {
100
+ var _result$payMoneyInfo$2, _result$payMoneyInfo2;
101
+ setQrUrl(result.qrUrl || '');
102
+ setQrStatus('active');
103
+ setPayMoneyInfo(_objectSpread(_objectSpread({}, result.payMoneyInfo), {}, {
104
+ needPayMoney: (_result$payMoneyInfo$2 = result === null || result === void 0 || (_result$payMoneyInfo2 = result.payMoneyInfo) === null || _result$payMoneyInfo2 === void 0 ? void 0 : _result$payMoneyInfo2.needPayMoney) !== null && _result$payMoneyInfo$2 !== void 0 ? _result$payMoneyInfo$2 : moneyAmount
105
+ }));
106
+ },
107
+ onError: function onError(e) {
108
+ setQrStatus('expired');
109
+ }
110
+ }),
111
+ runTrade = _useRequest2.run,
112
+ loadingTrade = _useRequest2.loading;
79
113
  var onInit = function onInit() {
80
- // const qrUrlBase = QrDict[ getEnv() ] || QrDict.prod;
81
- // const data = JSON.stringify({
82
- // productKind: productKind ? productKind : ( vipId == 0 ? 'recharge' : '' ),
83
- // productCount,
84
- // productId: vipId,
85
- // userToken: Tool.getLocalUserInfo().sid,
86
- // wechatAppId: '',
87
- // productName,
88
- // payMoney: moneyAmount,
89
- // });
90
- // const qrUrl = qrUrlBase + ( qrUrlBase.indexOf('?') === -1 ? '?' : '&' ) + `data=`+ encodeURIComponent( data ) ;
91
- // console.log('recharge qr:', qrUrl );
92
- // setQrUrl( qrUrl );
93
- // setQrStatus('active');
94
- if (selectPayChannel.name === 'wepay') {
114
+ if (payChannel === 'wepay') {
95
115
  runWechatMinApp();
96
- } else if (selectPayChannel.name === 'alipay') {
97
- makeQrUrl();
116
+ } else if (payChannel === 'alipay') {
117
+ runTrade();
98
118
  }
99
119
  };
100
120
  var getPaymentQr = function getPaymentQr() {
101
- runWechatMinApp();
121
+ onInit();
102
122
  };
103
123
  useEffect(function () {
104
124
  onInit();
@@ -112,9 +132,9 @@ var UserVipOrderPayQr = function UserVipOrderPayQr(_ref) {
112
132
  className: "ssz-qr-moneyAmountBox",
113
133
  children: [/*#__PURE__*/_jsx("small", {
114
134
  children: "\xA5"
115
- }), /*#__PURE__*/_jsx("span", {
135
+ }), loadingTrade || loadingWechatMinApp ? '...' : /*#__PURE__*/_jsx("span", {
116
136
  className: "ssz-qr-moneyAmount",
117
- children: moneyAmount
137
+ children: payMoneyInfo.needPayMoney
118
138
  }), /*#__PURE__*/_jsx("small", {
119
139
  children: formatMessage('元')
120
140
  })]
@@ -6,42 +6,17 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
6
  import React, { useState } from 'react';
7
7
  import { Button, Divider, Form, InputNumber, Radio, Tag } from 'antd';
8
8
  import styles from "./recharge.css";
9
- import { WechatOutlined, AlipayCircleOutlined, CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
9
+ import { CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
10
10
  import PayQr from "./qr";
11
11
  import notification from "../lib/notification";
12
12
  import sleep from "../lib/sleep";
13
13
  import formatMessage from "../lib/formatMessage";
14
14
  import RechargeRule from "./recharge-rule";
15
15
  import PayRechargeMoneyAmountAlt from "./recharge-moneyAmount-alt";
16
+ import PayChannelList from "./payChannelList";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
19
  import { Fragment as _Fragment } from "react/jsx-runtime";
19
- var PayChannelList = [{
20
- groupTitle: '',
21
- childrenList: [{
22
- name: 'wepay',
23
- label: '微信支付',
24
- icon: /*#__PURE__*/_jsx(WechatOutlined, {}),
25
- color: '#2bae68',
26
- disabled: false
27
- }, {
28
- name: 'alipay',
29
- label: '支付宝',
30
- icon: /*#__PURE__*/_jsx(AlipayCircleOutlined, {}),
31
- color: '#1c6cf4',
32
- disabled: false
33
- }]
34
- }, {
35
- groupTitle: '国际支付',
36
- disabled: true,
37
- childrenList: [{
38
- name: 'paypal',
39
- label: 'Paypal',
40
- icon: /*#__PURE__*/_jsx(WechatOutlined, {}),
41
- color: '#F60',
42
- disabled: true
43
- }]
44
- }];
45
20
  var BaseDict = {
46
21
  productKind: {
47
22
  recharge: '充值',
@@ -70,10 +45,13 @@ var PayRecharge = function PayRecharge(_ref) {
70
45
  onHandSuccess = _ref.onHandSuccess,
71
46
  env = _ref.env;
72
47
  var _useState = useState(((_PayChannelList$filte = PayChannelList.filter(function (items) {
73
- return items.childrenList.map(function (item) {
48
+ var itemList = items.childrenList.filter(function (item) {
74
49
  return item.name === defaultPayChannel;
75
50
  });
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]),
51
+ return itemList.length > 0;
52
+ })) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte[0]) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte.childrenList.filter(function (item) {
53
+ return item.name === defaultPayChannel;
54
+ })) === null || _PayChannelList$filte === void 0 ? void 0 : _PayChannelList$filte[0]) || PayChannelList[0].childrenList[0]),
77
55
  _useState2 = _slicedToArray(_useState, 2),
78
56
  selectPayChannel = _useState2[0],
79
57
  setSelectPayChannel = _useState2[1];
@@ -190,8 +168,8 @@ var PayRecharge = function PayRecharge(_ref) {
190
168
  label: formatMessage('支付渠道'),
191
169
  children: /*#__PURE__*/_jsx(Radio.Group, {
192
170
  onChange: function onChange(e) {
193
- var _e$target$id;
194
- var idInfo = ((_e$target$id = e.target.id) === null || _e$target$id === void 0 ? void 0 : _e$target$id.split('-')) || [];
171
+ var _e$target$id, _e$target$id$split;
172
+ var idInfo = ((_e$target$id = e.target.id) === null || _e$target$id === void 0 || (_e$target$id$split = _e$target$id.split) === null || _e$target$id$split === void 0 ? void 0 : _e$target$id$split.call(_e$target$id, '-')) || [];
195
173
  var index = parseInt(idInfo[1]) || 0;
196
174
  var i = parseInt(idInfo[2]) || 0;
197
175
  setSelectPayChannel(PayChannelList[index].childrenList[i]);
@@ -226,17 +204,21 @@ var PayRecharge = function PayRecharge(_ref) {
226
204
  }
227
205
  })]
228
206
  }), step === 'qr-show' && /*#__PURE__*/_jsx(_Fragment, {
229
- children: /*#__PURE__*/_jsx(PayQr, {
230
- appId: appId,
207
+ children: /*#__PURE__*/_jsx(PayQr
208
+ // appId={ appId }
209
+ , {
231
210
  moneyAmount: formData.moneyAmount,
232
- productCount: formData.moneyAmount,
233
- productName: BaseDict.productKind[productKind],
211
+ productCount: formData.moneyAmount
212
+ // productName={ BaseDict.productKind[ productKind ] || '' }
213
+ ,
234
214
  vipId: 0,
235
- payChannel: formData.payChannel,
236
- selectPayChannel: selectPayChannel,
215
+ payChannel: formData.payChannel
216
+ // selectPayChannel={selectPayChannel}
217
+ ,
237
218
  size: size,
238
219
  env: env,
239
- productKind: productKind
220
+ productKind: productKind,
221
+ couponCode: ""
240
222
  })
241
223
  }), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs("div", {
242
224
  className: "ssz-submits",
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import './vip.less';
3
+ interface Props {
4
+ name: React.ReactNode;
5
+ priceColor?: string;
6
+ allowPayChannelList: Pay.PayChannel[];
7
+ defaultPayChannel: Pay.PayChannel;
8
+ singlePrice: number;
9
+ vipId: number;
10
+ productKind: Pay.ProductKind;
11
+ size?: number;
12
+ defaultProductCount?: number;
13
+ minProductCount?: number;
14
+ precision?: number;
15
+ maxProductCount?: number;
16
+ onHandSuccess: () => void;
17
+ env?: Global.Env;
18
+ }
19
+ declare const PayVip: React.FC<Props>;
20
+ export default PayVip;
@@ -0,0 +1,249 @@
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 _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
+ import React, { useState } from 'react';
6
+ import { Button, Divider, Form, Input, InputNumber, Radio, Space, Tag } from 'antd';
7
+ import "./vip.less";
8
+ import { CaretLeftOutlined, CaretRightOutlined, CloseOutlined, PauseOutlined } from '@ant-design/icons';
9
+ import PayQr from "./qr";
10
+ import notification from "../lib/notification";
11
+ import sleep from "../lib/sleep";
12
+ import formatMessage from "../lib/formatMessage";
13
+ import PayChannelList from "./payChannelList";
14
+ import math from "../lib/math";
15
+ import Money from "../UI/Money";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { Fragment as _Fragment } from "react/jsx-runtime";
19
+ var BaseDict = {
20
+ productKind: {
21
+ recharge: '充值',
22
+ vip: '会员卡'
23
+ }
24
+ };
25
+ var PayVip = function PayVip(_ref) {
26
+ var _PayChannelList$filte;
27
+ var name = _ref.name,
28
+ _ref$priceColor = _ref.priceColor,
29
+ priceColor = _ref$priceColor === void 0 ? '#F60' : _ref$priceColor,
30
+ allowPayChannelList = _ref.allowPayChannelList,
31
+ productKind = _ref.productKind,
32
+ singlePrice = _ref.singlePrice,
33
+ vipId = _ref.vipId,
34
+ defaultPayChannel = _ref.defaultPayChannel,
35
+ _ref$minProductCount = _ref.minProductCount,
36
+ minProductCount = _ref$minProductCount === void 0 ? 1 : _ref$minProductCount,
37
+ _ref$size = _ref.size,
38
+ size = _ref$size === void 0 ? 280 : _ref$size,
39
+ _ref$defaultProductCo = _ref.defaultProductCount,
40
+ defaultProductCount = _ref$defaultProductCo === void 0 ? 1 : _ref$defaultProductCo,
41
+ _ref$maxProductCount = _ref.maxProductCount,
42
+ maxProductCount = _ref$maxProductCount === void 0 ? 5000 : _ref$maxProductCount,
43
+ onHandSuccess = _ref.onHandSuccess,
44
+ env = _ref.env;
45
+ var _useState = useState(((_PayChannelList$filte = PayChannelList.filter(function (items) {
46
+ var itemList = items.childrenList.filter(function (item) {
47
+ return item.name === defaultPayChannel;
48
+ });
49
+ return itemList.length > 0;
50
+ })) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte[0]) === null || _PayChannelList$filte === void 0 || (_PayChannelList$filte = _PayChannelList$filte.childrenList.filter(function (item) {
51
+ return item.name === defaultPayChannel;
52
+ })) === null || _PayChannelList$filte === void 0 ? void 0 : _PayChannelList$filte[0]) || PayChannelList[0].childrenList[0]),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ selectPayChannel = _useState2[0],
55
+ setSelectPayChannel = _useState2[1];
56
+ var _useState3 = useState({
57
+ productCount: defaultProductCount,
58
+ payChannel: defaultPayChannel,
59
+ couponCode: ''
60
+ }),
61
+ _useState4 = _slicedToArray(_useState3, 2),
62
+ formData = _useState4[0],
63
+ setFormData = _useState4[1];
64
+ var _useState5 = useState('pay-channel'),
65
+ _useState6 = _slicedToArray(_useState5, 2),
66
+ step = _useState6[0],
67
+ setStep = _useState6[1];
68
+ var _Form$useForm = Form.useForm(),
69
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
70
+ form = _Form$useForm2[0];
71
+ var onChoosePayChannel = function onChoosePayChannel() {
72
+ setStep('pay-channel');
73
+ };
74
+ var onMakeQr = /*#__PURE__*/function () {
75
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(formData) {
76
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
77
+ while (1) switch (_context.prev = _context.next) {
78
+ case 0:
79
+ console.log('on formData : ', formData);
80
+ // 检查金额
81
+ if (formData.productCount) {
82
+ _context.next = 4;
83
+ break;
84
+ }
85
+ notification.notificationError(formatMessage('数量'), '请输入数量', {
86
+ duration: 6
87
+ });
88
+ return _context.abrupt("return");
89
+ case 4:
90
+ setFormData(_objectSpread({}, formData));
91
+ _context.next = 7;
92
+ return sleep(200);
93
+ case 7:
94
+ setStep('qr-show');
95
+ case 8:
96
+ case "end":
97
+ return _context.stop();
98
+ }
99
+ }, _callee);
100
+ }));
101
+ return function onMakeQr(_x) {
102
+ return _ref2.apply(this, arguments);
103
+ };
104
+ }();
105
+ var onIPayed = function onIPayed() {
106
+ onHandSuccess === null || onHandSuccess === void 0 || onHandSuccess();
107
+ };
108
+ var FormItemSpan = 6;
109
+ return /*#__PURE__*/_jsx("div", {
110
+ className: "ssz-payVipCard",
111
+ children: /*#__PURE__*/_jsxs(Form, {
112
+ form: form,
113
+ labelCol: {
114
+ span: FormItemSpan
115
+ },
116
+ initialValues: _objectSpread({}, formData),
117
+ onFinish: onMakeQr,
118
+ children: [step === 'pay-channel' && /*#__PURE__*/_jsxs(_Fragment, {
119
+ children: [/*#__PURE__*/_jsx(Form.Item, {
120
+ label: formatMessage('名称'),
121
+ children: /*#__PURE__*/_jsx("strong", {
122
+ children: name
123
+ })
124
+ }), /*#__PURE__*/_jsx(Form.Item, {
125
+ label: formatMessage('数量'),
126
+ name: "productCount",
127
+ children: /*#__PURE__*/_jsx(InputNumber, {
128
+ style: {
129
+ width: 160
130
+ },
131
+ addonAfter: "\u4E2A",
132
+ precision: 0,
133
+ step: 1,
134
+ min: minProductCount,
135
+ max: maxProductCount,
136
+ placeholder: formatMessage('请输入'),
137
+ onChange: function onChange(productCount) {
138
+ formData.productCount = parseInt("".concat(productCount)) || 0;
139
+ setFormData(_objectSpread({}, formData));
140
+ }
141
+ })
142
+ }), /*#__PURE__*/_jsx(Form.Item, {
143
+ label: formatMessage('价格'),
144
+ children: /*#__PURE__*/_jsx("div", {
145
+ className: "ssz-priceMoney-warp",
146
+ children: /*#__PURE__*/_jsxs(Space, {
147
+ children: [singlePrice, /*#__PURE__*/_jsx(CloseOutlined, {
148
+ className: "ssz-priceMoney-icon"
149
+ }), formData.productCount, /*#__PURE__*/_jsx(PauseOutlined, {
150
+ className: "ssz-priceMoney-icon ssz-priceMoney-icon-pause"
151
+ }), /*#__PURE__*/_jsx(Money, {
152
+ value: singlePrice * formData.productCount,
153
+ className: "ssz-priceMoney",
154
+ color: priceColor,
155
+ disabledMoneySimple: true,
156
+ end: formatMessage('元')
157
+ })]
158
+ })
159
+ })
160
+ }), /*#__PURE__*/_jsx(Form.Item, {
161
+ name: "payChannel",
162
+ label: formatMessage('支付渠道'),
163
+ children: /*#__PURE__*/_jsx(Radio.Group, {
164
+ onChange: function onChange(e) {
165
+ var _split, _ref3;
166
+ var idInfo = ((_split = (_ref3 = e.target.id || '').split) === null || _split === void 0 ? void 0 : _split.call(_ref3, '-')) || [];
167
+ var index = parseInt(idInfo[1]) || 0;
168
+ var i = parseInt(idInfo[2]) || 0;
169
+ setSelectPayChannel(PayChannelList[index].childrenList[i]);
170
+ },
171
+ children: PayChannelList.map(function (items, index) {
172
+ return items.disabled ? null : /*#__PURE__*/_jsxs("div", {
173
+ className: "ssz-groupItems",
174
+ children: [/*#__PURE__*/_jsx("div", {
175
+ className: "ssz-groupTitle",
176
+ children: items.groupTitle
177
+ }), items.childrenList.map(function (item, i) {
178
+ return item.disabled || !(allowPayChannelList !== null && allowPayChannelList !== void 0 && allowPayChannelList.includes(item.name)) ? null : /*#__PURE__*/_jsx(Radio, {
179
+ disabled: item.disabled,
180
+ value: item.name,
181
+ id: "payChannel-".concat(index, "-").concat(i),
182
+ children: /*#__PURE__*/_jsxs(Tag, {
183
+ color: item.color,
184
+ className: "ssz-color-tag",
185
+ children: [item.icon, " ", formatMessage(item.label)]
186
+ })
187
+ }, "".concat(i, "-").concat(item.name));
188
+ })]
189
+ }, "".concat(index, "-").concat(items.groupTitle));
190
+ })
191
+ })
192
+ }), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(Form.Item, {
193
+ label: formatMessage('优惠券'),
194
+ name: "couponCode",
195
+ children: /*#__PURE__*/_jsx(Input, {
196
+ className: "ssz-coupon-input",
197
+ placeholder: formatMessage('请输入'),
198
+ maxLength: 30
199
+ })
200
+ })]
201
+ }), step === 'qr-show' && /*#__PURE__*/_jsx(_Fragment, {
202
+ children: /*#__PURE__*/_jsx(PayQr
203
+ // appId={ appId }
204
+ , {
205
+ moneyAmount: math.multiply(formData.productCount, singlePrice),
206
+ productCount: formData.productCount
207
+ // productName={ BaseDict.productKind[ productKind ] }
208
+ ,
209
+ vipId: vipId,
210
+ payChannel: formData.payChannel
211
+ // selectPayChannel={selectPayChannel}
212
+ ,
213
+ couponCode: formData.couponCode,
214
+ size: size,
215
+ env: env,
216
+ productKind: productKind
217
+ })
218
+ }), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs("div", {
219
+ className: "ssz-submits",
220
+ children: [/*#__PURE__*/_jsx("div", {
221
+ children: ['qr-show'].includes(step) && /*#__PURE__*/_jsx(Button, {
222
+ type: "link",
223
+ icon: /*#__PURE__*/_jsx(CaretLeftOutlined, {})
224
+ // ghost
225
+ ,
226
+ onClick: function onClick() {
227
+ return onChoosePayChannel();
228
+ },
229
+ children: formatMessage('上一步')
230
+ })
231
+ }), /*#__PURE__*/_jsxs("div", {
232
+ children: [['pay-channel'].includes(step) && /*#__PURE__*/_jsxs(Button, {
233
+ type: "primary",
234
+ htmlType: "submit",
235
+ children: [formatMessage('下一步'), " ", /*#__PURE__*/_jsx(CaretRightOutlined, {})]
236
+ }), ['qr-show'].includes(step) && /*#__PURE__*/_jsx(Button, {
237
+ type: "primary",
238
+ ghost: true,
239
+ onClick: function onClick() {
240
+ return onIPayed();
241
+ },
242
+ children: formatMessage('已支付')
243
+ })]
244
+ })]
245
+ })]
246
+ })
247
+ });
248
+ };
249
+ export default PayVip;
@@ -0,0 +1,29 @@
1
+ .ssz-payVipCard{
2
+ .ssz-priceMoney{
3
+ font-size: 20px;
4
+ line-height: 20px;
5
+ }
6
+
7
+ .ssz-submits{
8
+ display: flex;
9
+ flex-direction: row;
10
+ justify-content: space-between;
11
+ padding: 0 0 18px;
12
+ }
13
+
14
+ .ssz-coupon-input{
15
+ max-width: 70%;
16
+ width: 280px;
17
+ }
18
+
19
+ .ssz-priceMoney-warp{
20
+ font-size: 16px;
21
+ .ssz-priceMoney-icon{
22
+ color: #CCC;
23
+ font-size: smaller;
24
+ }
25
+ .ssz-priceMoney-icon-pause{
26
+ transform: rotate(-90deg);
27
+ }
28
+ }
29
+ }
@@ -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
  }
@@ -1,5 +1 @@
1
- export declare function getUrlLink(body: {
2
- pagePath: string;
3
- pathQuery: string;
4
- envVersion: "release" | "trial" | "develop";
5
- }, options?: ServicesApi.RequestOptions): Promise<WechatMinApp.GetUrlLink>;
1
+ export declare function getUrlLink(body: WechatMinApp.GetUrlLinkQuery, options?: ServicesApi.RequestOptions): Promise<WechatMinApp.GetUrlLink>;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  declare namespace Pay {
3
3
  type PayChannel = Trade.PayChannel;
4
- type ProductKind = 'vip' | 'vip-card' | 'recharge';
4
+ type ProductKind = 'vip' | 'vip-card' | 'recharge' | 'added-service';
5
5
  interface ChannelList {
6
6
  groupTitle: string;
7
7
  disabled?: boolean;
@@ -21,4 +21,9 @@ declare namespace Pay {
21
21
  interface GetPaymentQr {
22
22
  qrUrl: string;
23
23
  }
24
+ interface VipFormData {
25
+ productCount: number;
26
+ payChannel: PayChannel;
27
+ couponCode: string;
28
+ }
24
29
  }
@@ -6,21 +6,26 @@ 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
+ couponCode: string;
12
+ userToken: string;
11
13
  [name: string]: any;
12
14
  }
15
+ interface PayMoneyInfo {
16
+ needPayMoney: number;
17
+ }
13
18
  interface CreateResult {
14
19
  codeUrl: string;
15
20
  mWebUrl: string;
16
21
  payChannel: PayChannel;
17
22
  }
18
- interface CommonCreateResult {
19
- "h5PayUrl": string;
20
- "orderIdKey": string;
21
- "tradeIdKey": string;
22
- "tradeNo": string;
23
- jsApiInfo: {
23
+ interface CommonCreate {
24
+ h5PayUrl?: string;
25
+ orderIdKey?: string;
26
+ tradeIdKey?: string;
27
+ tradeNo?: string;
28
+ jsApiInfo?: {
24
29
  appId: string;
25
30
  timeStamp: string;
26
31
  nonceStr: string;
@@ -28,5 +33,7 @@ declare namespace Trade {
28
33
  package: string;
29
34
  paySign: string;
30
35
  };
36
+ qrUrl?: string;
37
+ payMoneyInfo: PayMoneyInfo;
31
38
  }
32
39
  }
@@ -1,5 +1,12 @@
1
1
  declare namespace WechatMinApp {
2
2
  interface GetUrlLink {
3
3
  url: string;
4
+ payMoneyInfo: Trade.PayMoneyInfo;
5
+ }
6
+ interface GetUrlLinkQuery {
7
+ pagePath: string;
8
+ pathQuery: string;
9
+ couponCode: string;
10
+ envVersion: "release" | "trial" | "develop";
4
11
  }
5
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-sanzhizhou",
3
- "version": "1.0.18",
3
+ "version": "1.0.23",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
File without changes