component-shipinlv 0.1.11 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,9 @@ interface Props {
4
4
  vipId: number;
5
5
  productCount: number;
6
6
  productKind: 'vip' | 'vip-card';
7
+ showPrice?: number;
7
8
  disabled?: boolean;
9
+ onBuySuccess?: () => void;
8
10
  children: React.ReactNode;
9
11
  }
10
12
  declare const Buy: React.FC<Props>;
package/dist/Buy/index.js CHANGED
@@ -5,6 +5,7 @@ import Tool from "../lib/Tool";
5
5
  import styles from "./index.css";
6
6
  import VipQr from "./qr";
7
7
  import Platform from "../lib/platform";
8
+ import BuyTrialMember from "./trial-member";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  var Buy = function Buy(_ref) {
10
11
  var _ref$env = _ref.env,
@@ -17,10 +18,13 @@ var Buy = function Buy(_ref) {
17
18
  productCount = _ref$productCount === void 0 ? 1 : _ref$productCount,
18
19
  _ref$disabled = _ref.disabled,
19
20
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21
+ showPrice = _ref.showPrice,
22
+ _ref$onBuySuccess = _ref.onBuySuccess,
23
+ onBuySuccess = _ref$onBuySuccess === void 0 ? function () {} : _ref$onBuySuccess,
20
24
  children = _ref.children;
21
25
  var onBuy = /*#__PURE__*/function () {
22
26
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
23
- var userInfo;
27
+ var userInfo, _ref3, dialog;
24
28
  return _regeneratorRuntime().wrap(function _callee$(_context) {
25
29
  while (1) switch (_context.prev = _context.next) {
26
30
  case 0:
@@ -39,8 +43,28 @@ var Buy = function Buy(_ref) {
39
43
  console.log("not login");
40
44
  return _context.abrupt("return", Tool.onLogin());
41
45
  case 6:
46
+ if (!(showPrice === 0)) {
47
+ _context.next = 9;
48
+ break;
49
+ }
50
+ // 直接开通
51
+ dialog = Tool.drawer({
52
+ title: '开通',
53
+ content: /*#__PURE__*/_jsx(BuyTrialMember, {
54
+ env: env,
55
+ vipId: vipId,
56
+ onBack: function onBack() {
57
+ onBuySuccess();
58
+ dialog.destroy();
59
+ }
60
+ }),
61
+ zIndex: 1200,
62
+ width: Math.min(520, ((_ref3 = global || window) === null || _ref3 === void 0 ? void 0 : _ref3.innerWidth) * 0.95)
63
+ });
64
+ return _context.abrupt("return");
65
+ case 9:
42
66
  onOpenVipQr();
43
- case 7:
67
+ case 10:
44
68
  case "end":
45
69
  return _context.stop();
46
70
  }
@@ -51,7 +75,7 @@ var Buy = function Buy(_ref) {
51
75
  };
52
76
  }();
53
77
  var onOpenVipQr = function onOpenVipQr() {
54
- var _ref3;
78
+ var _ref4;
55
79
  var userId = Tool.getLocalUserInfo().id;
56
80
  if (Platform.isWechat || Platform.isH5) {
57
81
  Tool.h5Pay({
@@ -72,11 +96,13 @@ var Buy = function Buy(_ref) {
72
96
  vipId: vipId,
73
97
  productCount: productCount,
74
98
  onHandlePaySuccess: function onHandlePaySuccess() {
99
+ onBuySuccess();
75
100
  dialog.destroy();
76
101
  Tool.toast('^_^,谢谢购买,祝您发财');
77
102
  }
78
103
  }),
79
- width: Math.min(520, ((_ref3 = global || window) === null || _ref3 === void 0 ? void 0 : _ref3.innerWidth) * 0.95)
104
+ zIndex: 1200,
105
+ width: Math.min(520, ((_ref4 = global || window) === null || _ref4 === void 0 ? void 0 : _ref4.innerWidth) * 0.95)
80
106
  });
81
107
  // 广播,点击了 购买;
82
108
  Tool.event.run('vip-buy-click');
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ TrialMember: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
4
+ };
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import styled from 'styled-components';
4
+ export default {
5
+ TrialMember: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :global{\n //.ktv-ai-vip-compare{\n // .vip-compare-price{\n // small{\n // color: #888;\n // vertical-align: middle;\n // }\n // }\n // .listMore{\n // position: absolute;\n // right: 10px;\n // top: 9px;\n // }\n //\n // .vipCompareListMoreContent{\n // width: 500px;\n // .ratioAlt{\n // padding: 6px 0;\n // font-size: 13px;\n // color: #777;\n // .vip-compare-alt{\n //\n // }\n // }\n // }\n //\n //}\n }\n "])))
6
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ env?: Global.Env;
4
+ vipId: number;
5
+ onBack?: () => void;
6
+ }
7
+ declare const BuyTrialMember: React.FC<Props>;
8
+ export default BuyTrialMember;
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import styles from "./trial-member.css";
3
+ import { useRequest } from "@umijs/hooks";
4
+ import * as UserVipController from "../service/api/UserVipController";
5
+ import { Button, Result } from "antd";
6
+ import PageContentWarp from "../UI/PageContentWarp";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ var BuyTrialMember = function BuyTrialMember(_ref) {
9
+ var _ref$env = _ref.env,
10
+ env = _ref$env === void 0 ? 'prod' : _ref$env,
11
+ _ref$vipId = _ref.vipId,
12
+ vipId = _ref$vipId === void 0 ? 0 : _ref$vipId,
13
+ _ref$onBack = _ref.onBack,
14
+ onBack = _ref$onBack === void 0 ? function () {} : _ref$onBack;
15
+ var _useRequest = useRequest(function () {
16
+ return UserVipController.trial({
17
+ vipId: vipId
18
+ }, {
19
+ env: env
20
+ });
21
+ }, {
22
+ onSuccess: function onSuccess(result) {}
23
+ }),
24
+ loading = _useRequest.loading,
25
+ run = _useRequest.run,
26
+ error = _useRequest.error;
27
+ return /*#__PURE__*/_jsx(styles.TrialMember, {
28
+ children: /*#__PURE__*/_jsx(PageContentWarp, {
29
+ loading: loading,
30
+ error: error,
31
+ onReload: run,
32
+ children: /*#__PURE__*/_jsx(Result, {
33
+ status: "success",
34
+ title: "\u5DF2\u5F00\u901A",
35
+ subTitle: "\u5FEB\u53BB\u8BD5\u7528\u5427",
36
+ extra: [/*#__PURE__*/_jsx(Button, {
37
+ type: "primary",
38
+ onClick: onBack,
39
+ children: "\u8FD4\u56DE"
40
+ }, "back")]
41
+ })
42
+ })
43
+ });
44
+ };
45
+ export default BuyTrialMember;
@@ -1,3 +1,4 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import { Drawer, ConfigProvider } from 'antd';
3
4
  import React, { useState, useEffect } from 'react';
@@ -52,18 +53,19 @@ var DialogDrawer = function DialogDrawer(props) {
52
53
  }
53
54
  },
54
55
  children: /*#__PURE__*/_jsx(styles.DrawerDialog, {
55
- children: /*#__PURE__*/_jsx(Drawer, {
56
- className: "ktv-ai-drawerDialog ".concat(state.bgTheme, " "),
56
+ children: /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
57
+ className: "ktv-ai-drawerDialog ".concat(state.bgTheme, " ")
58
+ }, state), {}, {
57
59
  title: state.title,
58
60
  placement: state.placement,
59
61
  closable: state.closable,
60
62
  onClose: function onClose() {
61
63
  return _onClose();
62
64
  },
63
- visible: visible,
65
+ open: visible,
64
66
  width: state.width,
65
67
  children: props.content
66
- })
68
+ }))
67
69
  })
68
70
  });
69
71
  };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ money: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
4
+ };
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import styled from 'styled-components';
4
+ export default {
5
+ money: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n .yen{\n font-size: smaller;\n opacity: 0.8;\n font-weight: 300;\n }\n .value{\n font-weight: bold;\n padding-left: 2px;\n padding-right: 1px;\n &.zero{\n font-weight: 300;\n }\n }\n "])))
6
+ };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ interface Props {
3
+ value?: number;
4
+ pre?: React.ReactNode;
5
+ end?: React.ReactNode;
6
+ precision?: number;
7
+ color?: string;
8
+ disabledMoneySimple?: boolean;
9
+ }
10
+ declare const Money: React.FC<Props>;
11
+ export default Money;
@@ -0,0 +1,36 @@
1
+ import styles from "./index.css";
2
+ import React from "react";
3
+ import moneySimple from "../../lib/moneySimple";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ var Money = function Money(_ref) {
8
+ var _ref$pre = _ref.pre,
9
+ pre = _ref$pre === void 0 ? /*#__PURE__*/_jsx(_Fragment, {
10
+ children: "\xA5"
11
+ }) : _ref$pre,
12
+ _ref$end = _ref.end,
13
+ end = _ref$end === void 0 ? '元' : _ref$end,
14
+ value = _ref.value,
15
+ _ref$precision = _ref.precision,
16
+ precision = _ref$precision === void 0 ? 2 : _ref$precision,
17
+ color = _ref.color,
18
+ _ref$disabledMoneySim = _ref.disabledMoneySimple,
19
+ disabledMoneySimple = _ref$disabledMoneySim === void 0 ? false : _ref$disabledMoneySim;
20
+ return /*#__PURE__*/_jsxs(styles.money, {
21
+ style: {
22
+ color: color
23
+ },
24
+ children: [/*#__PURE__*/_jsx("span", {
25
+ className: "yen",
26
+ children: pre
27
+ }), /*#__PURE__*/_jsx("span", {
28
+ className: "value ".concat(value === 0 ? 'zero' : '', " "),
29
+ children: typeof value === 'number' ? disabledMoneySimple ? value.toFixed(precision) : moneySimple(value, false, precision) : ''
30
+ }), /*#__PURE__*/_jsx("span", {
31
+ className: "yen",
32
+ children: end
33
+ })]
34
+ });
35
+ };
36
+ export default Money;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ pricingCompare: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
4
+ };
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import styled from 'styled-components';
4
+ export default {
5
+ pricingCompare: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n th{\n font-size: 20px;\n padding: 20px 0 !important;\n font-weight: 400 !important;\n text-align: center !important;\n }\n\n .vipTitle{\n }\n\n .classifyKind{\n font-size: 18px;\n }\n\n .onBuy{\n //padding: 16px 0;\n text-align: center;\n }\n\n .title{\n font-size: 16px;\n }\n .subtitle{\n margin: 1px 0 0;\n font-size: 12px;\n color: #999;\n font-weight: 300;\n }\n .value{\n text-align: center;\n font-size: 16px;\n .allow{\n color: #00b70d;\n font-size: 18px;\n }\n .notAllow{\n color: #C00;\n font-size: 18px;\n }\n small{\n color: #999;\n padding-left: 2px;\n }\n }\n "])))
6
+ };
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ interface Props {
3
+ productType: string;
4
+ disabledPrice?: boolean;
5
+ disabledBuy?: boolean;
6
+ applyDemoWechatUrl?: string;
7
+ applyDemoTitle?: string;
8
+ tableOffsetHeader?: number;
9
+ env?: Global.Env;
10
+ tableScrollY?: number | string;
11
+ onBuySuccess?: () => void;
12
+ }
13
+ declare const VipList: React.FC<Props>;
14
+ export default VipList;
@@ -0,0 +1,389 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import * as VipPowerController from "../service/api/VipPowerController";
4
+ import { useRequest } from "@umijs/hooks";
5
+ import { getApiEnv } from "../lib/getApiUrl";
6
+ import React, { useState } from "react";
7
+ import styles from "./index.css";
8
+ import { Buy } from "./..";
9
+ import { Button, ConfigProvider, Table } from "antd";
10
+ import { CheckCircleFilled, CloseCircleFilled, ShoppingCartOutlined, XFilled } from "@ant-design/icons";
11
+ import Tool from "../lib/Tool";
12
+ import PageContentWarp from "../UI/PageContentWarp";
13
+ import Money from "../UI/Money";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { Fragment as _Fragment } from "react/jsx-runtime";
16
+ import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ var ApplyColorDict = {
18
+ 1: {
19
+ color: '#34b9fe'
20
+ },
21
+ 100: {
22
+ color: '#3688FF'
23
+ },
24
+ 200: {
25
+ color: '#5B53FF'
26
+ },
27
+ 300: {
28
+ color: '#724822'
29
+ },
30
+ 1000: {
31
+ color: ''
32
+ }
33
+ };
34
+ var VipList = function VipList(_ref) {
35
+ var productType = _ref.productType,
36
+ _ref$disabledPrice = _ref.disabledPrice,
37
+ disabledPrice = _ref$disabledPrice === void 0 ? false : _ref$disabledPrice,
38
+ _ref$disabledBuy = _ref.disabledBuy,
39
+ disabledBuy = _ref$disabledBuy === void 0 ? false : _ref$disabledBuy,
40
+ _ref$applyDemoWechatU = _ref.applyDemoWechatUrl,
41
+ applyDemoWechatUrl = _ref$applyDemoWechatU === void 0 ? '' : _ref$applyDemoWechatU,
42
+ _ref$applyDemoTitle = _ref.applyDemoTitle,
43
+ applyDemoTitle = _ref$applyDemoTitle === void 0 ? '预约演示' : _ref$applyDemoTitle,
44
+ _ref$tableScrollY = _ref.tableScrollY,
45
+ tableScrollY = _ref$tableScrollY === void 0 ? '65vh' : _ref$tableScrollY,
46
+ env = _ref.env,
47
+ _ref$tableOffsetHeade = _ref.tableOffsetHeader,
48
+ tableOffsetHeader = _ref$tableOffsetHeade === void 0 ? 56 : _ref$tableOffsetHeade,
49
+ _ref$onBuySuccess = _ref.onBuySuccess,
50
+ onBuySuccess = _ref$onBuySuccess === void 0 ? function () {} : _ref$onBuySuccess;
51
+ var _useState = useState(Tool.getLocalUserInfo()),
52
+ _useState2 = _slicedToArray(_useState, 1),
53
+ userInfo = _useState2[0];
54
+ var _useState3 = useState([]),
55
+ _useState4 = _slicedToArray(_useState3, 2),
56
+ buyList = _useState4[0],
57
+ setBuyList = _useState4[1];
58
+ var _useState5 = useState([]),
59
+ _useState6 = _slicedToArray(_useState5, 2),
60
+ listData = _useState6[0],
61
+ setListData = _useState6[1];
62
+ var _useState7 = useState([{
63
+ title: '功能',
64
+ dataIndex: 'title',
65
+ key: 'title',
66
+ onCell: function onCell(record, index) {
67
+ return {
68
+ colSpan: index > 0 && record.onlyShowTitle ? 5 : 1
69
+ };
70
+ },
71
+ render: function render(title, record) {
72
+ return title === ':buy' ? '' : /*#__PURE__*/_jsxs(_Fragment, {
73
+ children: [/*#__PURE__*/_jsx("div", {
74
+ className: "title",
75
+ children: title
76
+ }), /*#__PURE__*/_jsx("div", {
77
+ className: "subtitle",
78
+ children: record === null || record === void 0 ? void 0 : record.subtitle
79
+ })]
80
+ });
81
+ }
82
+ }]),
83
+ _useState8 = _slicedToArray(_useState7, 2),
84
+ columns = _useState8[0],
85
+ setColumns = _useState8[1];
86
+ var _useRequest = useRequest(function () {
87
+ return VipPowerController.list({
88
+ productType: productType,
89
+ dealerId: Tool.getLocalSiteInfo().dealerId || 0
90
+ }, {
91
+ env: env
92
+ });
93
+ }, {
94
+ onSuccess: function onSuccess(result) {
95
+ var list = [];
96
+ var listLen = result.vipList.length;
97
+ var buyList = [];
98
+ result.vipList.forEach(function (item) {
99
+ buyList.push({
100
+ id: item.id,
101
+ price: item.price
102
+ });
103
+ var dataIndex = "vipLevel".concat(item.vipLevel);
104
+ var colorPrimary = ApplyColorDict[item.vipLevel].color || '#722ED1';
105
+ list.push({
106
+ title: /*#__PURE__*/_jsxs("div", {
107
+ children: [/*#__PURE__*/_jsx("div", {
108
+ className: "vipTitle",
109
+ style: {
110
+ color: colorPrimary
111
+ },
112
+ children: item.title
113
+ }), applyDemoWechatUrl && item.price > 0 && /*#__PURE__*/_jsx(ConfigProvider, {
114
+ theme: {
115
+ components: {
116
+ Button: {
117
+ colorPrimary: colorPrimary
118
+ }
119
+ }
120
+ },
121
+ children: /*#__PURE__*/_jsx(Button, {
122
+ size: "middle",
123
+ type: "primary",
124
+ onClick: onApplyDemo,
125
+ children: applyDemoTitle
126
+ })
127
+ })]
128
+ }),
129
+ dataIndex: dataIndex,
130
+ key: dataIndex,
131
+ width: "".concat(70 / listLen, "%"),
132
+ onCell: sharedOnCell,
133
+ render: function render(value, record) {
134
+ return /*#__PURE__*/_jsx("div", {
135
+ className: "value",
136
+ children: ['true', 'false'].includes(value) ? /*#__PURE__*/_jsxs(_Fragment, {
137
+ children: [value === 'true' && /*#__PURE__*/_jsx(CheckCircleFilled, {
138
+ className: "allow"
139
+ }), value === 'false' && /*#__PURE__*/_jsx(CloseCircleFilled, {
140
+ className: "notAllow"
141
+ })]
142
+ }) : value
143
+ });
144
+ }
145
+ });
146
+ });
147
+ setBuyList([].concat(buyList));
148
+ columns.push.apply(columns, list);
149
+ setColumns(_toConsumableArray(columns));
150
+
151
+ // 先做字典
152
+ var listDict = {};
153
+ result.list.forEach(function (items) {
154
+ if (!listDict[items.name]) {
155
+ listDict[items.name] = {
156
+ name: items.name,
157
+ classifySubtitle: items.classifyInfo.subtitle,
158
+ classifyTitle: items.classifyInfo.title,
159
+ classifyIndex: items.classifyInfo.index,
160
+ classifyKind: items.classifyInfo.kind,
161
+ list: []
162
+ };
163
+ }
164
+ listDict[items.name].list.push(items);
165
+ });
166
+ var listDataValues = Object.values(listDict);
167
+ listDataValues.sort(function (a, b) {
168
+ return b.classifyIndex - a.classifyIndex;
169
+ });
170
+
171
+ // 购买
172
+ if (!disabledPrice) {
173
+ listDataValues.push({
174
+ name: ':price',
175
+ classifyTitle: '价格',
176
+ classifySubtitle: '',
177
+ classifyIndex: -1,
178
+ classifyKind: '购买',
179
+ list: result.vipList.map(function (item) {
180
+ return {
181
+ id: item.id,
182
+ dealerId: 0,
183
+ vipLevel: item.vipLevel,
184
+ name: ':price',
185
+ value: "".concat(item.price),
186
+ classifyInfo: {
187
+ title: '购买',
188
+ subtitle: '',
189
+ index: -1,
190
+ kind: '购买'
191
+ }
192
+ };
193
+ })
194
+ });
195
+ }
196
+
197
+ // if( ! disabledBuy ){
198
+ // listDataValues.push({
199
+ // name: ':buy',
200
+ // classifyTitle: ':buy',
201
+ // classifySubtitle: '',
202
+ // classifyIndex: -1,
203
+ // classifyKind: '购买',
204
+ // list: [],
205
+ // });
206
+ // }
207
+
208
+ var listData = [];
209
+ listDataValues.forEach(function (items, index) {
210
+ var onlyShowTitle = false;
211
+ var preRecord = listData[listData.length - 1];
212
+ if (preRecord && items.classifyKind && preRecord.classifyKind !== items.classifyKind) {
213
+ onlyShowTitle = true;
214
+ }
215
+ if (onlyShowTitle) {
216
+ listData.push({
217
+ title: /*#__PURE__*/_jsxs("strong", {
218
+ className: "classifyKind",
219
+ children: [/*#__PURE__*/_jsx(XFilled, {}), " ", items.classifyKind]
220
+ }),
221
+ subtitle: '',
222
+ classifyKind: items.classifyKind,
223
+ onlyShowTitle: true
224
+ });
225
+ }
226
+ var itemData = {
227
+ title: items.classifyTitle,
228
+ subtitle: items.classifySubtitle,
229
+ onlyShowTitle: false,
230
+ classifyKind: items.classifyKind
231
+ };
232
+ items.list.forEach(function (item) {
233
+ var value = item.value;
234
+ switch (item.name) {
235
+ case 'mixed-cut-video-count':
236
+ value = /*#__PURE__*/_jsx(Money, {
237
+ value: parseInt(item.value),
238
+ pre: "",
239
+ precision: 0,
240
+ end: "\u6761"
241
+ });
242
+ break;
243
+ case 'media-space-size':
244
+ value = /*#__PURE__*/_jsx(Money, {
245
+ value: parseInt(item.value),
246
+ pre: "",
247
+ precision: 0,
248
+ end: "GB"
249
+ });
250
+ break;
251
+ case 'gpt3.5':
252
+ value = /*#__PURE__*/_jsx(Money, {
253
+ value: parseInt(item.value),
254
+ pre: "",
255
+ precision: 0,
256
+ end: "\u6BCF\u65E5"
257
+ });
258
+ break;
259
+ case 'gpt4.0':
260
+ value = /*#__PURE__*/_jsx(Money, {
261
+ value: parseInt(item.value),
262
+ pre: "",
263
+ precision: 0,
264
+ end: ""
265
+ });
266
+ break;
267
+ }
268
+ console.log('result.items.name :', items.name);
269
+
270
+ // 价格
271
+ if (items.name === ':price') {
272
+ console.log('result.vipList:', result.vipList);
273
+ var price = getPrice(result.vipList, item.id);
274
+ value = /*#__PURE__*/_jsx(Money, {
275
+ value: price,
276
+ precision: 0
277
+ });
278
+ }
279
+ itemData["vipLevel".concat(item.vipLevel)] = value;
280
+ });
281
+ listData.push(itemData);
282
+ });
283
+ setListData([].concat(listData));
284
+ }
285
+ }),
286
+ loading = _useRequest.loading,
287
+ run = _useRequest.run,
288
+ error = _useRequest.error,
289
+ data = _useRequest.data;
290
+ var onApplyDemo = function onApplyDemo() {
291
+ if (!applyDemoWechatUrl) {
292
+ return;
293
+ }
294
+ Tool.pageDialog({
295
+ title: applyDemoTitle,
296
+ content: /*#__PURE__*/_jsxs("div", {
297
+ children: [Tool.makeQr(applyDemoWechatUrl, '#29ae67', 220), /*#__PURE__*/_jsx("p", {
298
+ style: {
299
+ textAlign: 'center',
300
+ color: '#999'
301
+ },
302
+ children: "\u5FAE\u4FE1\u626B\u4E00\u626B\uFF0C\u52A0\u597D\u53CB"
303
+ })]
304
+ }),
305
+ width: 320,
306
+ zIndex: 9999
307
+ });
308
+ };
309
+ var getPrice = function getPrice(vipList, id) {
310
+ var _vipList$filter;
311
+ return ((_vipList$filter = vipList.filter(function (item) {
312
+ return item.id === id;
313
+ })) === null || _vipList$filter === void 0 ? void 0 : _vipList$filter[0].price) || 0;
314
+ };
315
+ var sharedOnCell = function sharedOnCell(record, index) {
316
+ return {
317
+ colSpan: record.onlyShowTitle ? 0 : 1
318
+ };
319
+ };
320
+ return /*#__PURE__*/_jsx(PageContentWarp, {
321
+ loading: loading,
322
+ error: error,
323
+ onReload: run,
324
+ children: /*#__PURE__*/_jsx(styles.pricingCompare, {
325
+ children: /*#__PURE__*/_jsx(Table, {
326
+ bordered: true,
327
+ scroll: {
328
+ y: tableScrollY // '60vh',
329
+ },
330
+
331
+ rowKey: function rowKey(record, index) {
332
+ return "".concat(index, "-").concat(record.id);
333
+ },
334
+ columns: columns,
335
+ dataSource: listData,
336
+ pagination: false
337
+ // sticky={{offsetHeader: tableOffsetHeader }}
338
+ ,
339
+ summary: function summary() {
340
+ return disabledBuy ? undefined : /*#__PURE__*/_jsx(Table.Summary, {
341
+ fixed: true,
342
+ children: /*#__PURE__*/_jsxs(Table.Summary.Row, {
343
+ children: [/*#__PURE__*/_jsx(Table.Summary.Cell, {
344
+ index: 0,
345
+ children: " "
346
+ }), buyList.map(function (item, i) {
347
+ var _userInfo$userVip;
348
+ // 从不是会员;
349
+ var userVip = !!((_userInfo$userVip = userInfo.userVip) !== null && _userInfo$userVip !== void 0 && _userInfo$userVip[productType]);
350
+ var colorPrimary = (item === null || item === void 0 ? void 0 : item.price) > 0 ? '#722ED1' : 'green';
351
+ return /*#__PURE__*/_jsx(Table.Summary.Cell, {
352
+ index: i,
353
+ children: /*#__PURE__*/_jsx("div", {
354
+ className: "onBuy",
355
+ children: /*#__PURE__*/_jsx(ConfigProvider, {
356
+ theme: {
357
+ components: {
358
+ Button: {
359
+ colorPrimary: colorPrimary
360
+ }
361
+ }
362
+ },
363
+ children: /*#__PURE__*/_jsx(Buy, {
364
+ env: getApiEnv(),
365
+ disabled: userVip,
366
+ productKind: "vip",
367
+ vipId: (item === null || item === void 0 ? void 0 : item.id) || 0,
368
+ productCount: 1,
369
+ showPrice: item === null || item === void 0 ? void 0 : item.price,
370
+ onBuySuccess: onBuySuccess,
371
+ children: /*#__PURE__*/_jsx(Button, {
372
+ disabled: userVip && item.price === 0,
373
+ type: "primary",
374
+ icon: /*#__PURE__*/_jsx(ShoppingCartOutlined, {}),
375
+ children: (item === null || item === void 0 ? void 0 : item.price) > 0 ? '购买' : '免费开通'
376
+ })
377
+ })
378
+ })
379
+ })
380
+ });
381
+ })]
382
+ })
383
+ });
384
+ }
385
+ })
386
+ })
387
+ });
388
+ };
389
+ export default VipList;
@@ -0,0 +1,3 @@
1
+ .ant-modal-confirm-btns{
2
+ display: none !important;
3
+ }
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
+ import './global.less';
1
2
  export { default as VipCompare } from './VipCompare';
2
3
  export { default as Buy } from './Buy';
3
4
  export { default as Login } from './Login';
4
5
  export { default as AuthClient } from './AuthClient';
5
6
  export { default as Product } from './Product';
6
7
  export { default as JoinClient } from './join-client';
8
+ export { default as VipList } from './VipList';
7
9
  export { default as fileSelect } from './base/fileSelect';
8
10
  export { default as folderOpen } from './base/folderOpen';
9
11
  export { default as folderSelect } from './base/folderSelect';
package/dist/index.js CHANGED
@@ -1,9 +1,13 @@
1
+ // import soundInfo from "component-shipinlv/base/soundInfo";
2
+ // import fileList from "component-shipinlv/base/fileList";
3
+ import "./global.less";
1
4
  export { default as VipCompare } from "./VipCompare";
2
5
  export { default as Buy } from "./Buy";
3
6
  export { default as Login } from "./Login";
4
7
  export { default as AuthClient } from "./AuthClient";
5
8
  export { default as Product } from "./Product";
6
9
  export { default as JoinClient } from "./join-client";
10
+ export { default as VipList } from "./VipList";
7
11
  export { default as fileSelect } from "./base/fileSelect";
8
12
  export { default as folderOpen } from "./base/folderOpen";
9
13
  export { default as folderSelect } from "./base/folderSelect";
@@ -163,7 +163,7 @@ declare const Tool: {
163
163
  setTimeOffset(serverTime: number): void;
164
164
  getTime(): number;
165
165
  h5Pay(query: Pay.H5PayQuery): void;
166
- notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
166
+ notification(type: "error" | "success" | "info" | "warning", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
167
167
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
168
168
  notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
169
169
  notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
package/dist/lib/Tool.js CHANGED
@@ -1037,12 +1037,19 @@ var Tool = _objectSpread(_objectSpread({
1037
1037
  });
1038
1038
  },
1039
1039
  makeQr: function makeQr(url) {
1040
- var fgColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#1677ff';
1040
+ var fgColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#29ae67';
1041
1041
  var size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 600;
1042
- return /*#__PURE__*/_jsx(QRCode, {
1043
- value: url,
1044
- fgColor: fgColor,
1045
- size: size
1042
+ return /*#__PURE__*/_jsx("div", {
1043
+ style: {
1044
+ width: size,
1045
+ height: size,
1046
+ margin: '12px auto'
1047
+ },
1048
+ children: /*#__PURE__*/_jsx(QRCode, {
1049
+ value: url,
1050
+ fgColor: fgColor,
1051
+ size: size
1052
+ })
1046
1053
  });
1047
1054
  },
1048
1055
  onLogin: function onLogin() {
@@ -0,0 +1,2 @@
1
+ declare const moneySimple: (money?: number, isTip?: boolean, toFixed?: number) => string | import("react/jsx-runtime").JSX.Element;
2
+ export default moneySimple;
@@ -0,0 +1,27 @@
1
+ import { Tooltip } from "antd";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ var moneySimple = function moneySimple() {
4
+ var money = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
5
+ var isTip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6
+ var toFixed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
7
+ var out = '';
8
+ var unit = '';
9
+ if (money >= 100000) {
10
+ out = (money / 10000).toFixed(toFixed);
11
+ unit = '万';
12
+ } else if (money >= 10000) {
13
+ out = (money / 10000).toFixed(toFixed);
14
+ unit = '万';
15
+ } else {
16
+ out = money.toFixed(toFixed);
17
+ }
18
+ var outData = out.split('.');
19
+ if (isTip) {
20
+ return /*#__PURE__*/_jsx(Tooltip, {
21
+ title: money + '元',
22
+ children: out + unit
23
+ });
24
+ }
25
+ return out + ' ' + unit;
26
+ };
27
+ export default moneySimple;
@@ -0,0 +1,3 @@
1
+ export declare function trial(body: {
2
+ vipId: number;
3
+ }, options?: Global.RequestOptions): Promise<Vip.List>;
@@ -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 trial(_x, _x2) {
6
+ return _trial.apply(this, arguments);
7
+ }
8
+ function _trial() {
9
+ _trial = _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/userVip/trial", _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 _trial.apply(this, arguments);
27
+ }
@@ -0,0 +1,4 @@
1
+ export declare function list(body: {
2
+ productType: string;
3
+ dealerId: number;
4
+ }, options?: ServicesApi.RequestOptions): Promise<VipPower.ListResult>;
@@ -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 list(_x, _x2) {
6
+ return _list.apply(this, arguments);
7
+ }
8
+ function _list() {
9
+ _list = _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("vipPower/list", _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 _list.apply(this, arguments);
27
+ }
@@ -0,0 +1,8 @@
1
+ declare namespace VipList {
2
+ interface List {
3
+ id: number;
4
+ title: string;
5
+ price: number;
6
+ vipLevel: number;
7
+ }
8
+ }
File without changes
@@ -0,0 +1,49 @@
1
+ /// <reference types="react" />
2
+ declare namespace VipPower {
3
+ interface ListResult {
4
+ list: List[];
5
+ vipList: VipList.List[];
6
+ }
7
+ interface List {
8
+ id: number;
9
+ dealerId: number;
10
+ vipLevel: number;
11
+ name: string;
12
+ value: string;
13
+ classifyInfo: {
14
+ title: string;
15
+ subtitle: string;
16
+ index: number;
17
+ kind: string;
18
+ };
19
+ }
20
+ interface ListDict {
21
+ [name: string]: {
22
+ name: string;
23
+ classifyTitle: string;
24
+ classifySubtitle: string;
25
+ classifyIndex: number;
26
+ classifyKind: string;
27
+ list: List[];
28
+ };
29
+ }
30
+ interface TypeCompare {
31
+ title: React.ReactNode;
32
+ classifyKind: React.ReactNode;
33
+ subtitle: React.ReactNode;
34
+ onlyShowTitle: boolean;
35
+ vipLevel1?: TypeCompareVipLevel;
36
+ vipLevel12?: TypeCompareVipLevel;
37
+ vipLevel100?: TypeCompareVipLevel;
38
+ vipLevel200?: TypeCompareVipLevel;
39
+ vipLevel300?: TypeCompareVipLevel;
40
+ vipLevel400?: TypeCompareVipLevel;
41
+ vipLevel1000?: TypeCompareVipLevel;
42
+ [vipLevel: string]: TypeCompareVipLevel;
43
+ }
44
+ type TypeCompareVipLevel = boolean | React.ReactNode;
45
+ interface BuyList {
46
+ id: number;
47
+ price: number;
48
+ }
49
+ }
File without changes
package/dist/typings.d.ts CHANGED
@@ -9,10 +9,13 @@ declare namespace Global {
9
9
  data?: any;
10
10
  }
11
11
  interface Columns<T>{
12
- title: string;
12
+ title: React.ReactNode;
13
13
  dataIndex?: string;
14
14
  key: string;
15
15
  width?: string | number;
16
+ onCell?: ( record, rowIndex) => ({
17
+ colSpan: number;
18
+ });
16
19
  render?: ( filed?: any, record?: T , index?: number ) => React.ReactNode;
17
20
  }
18
21
  interface Pagination {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -51,7 +51,6 @@
51
51
  "@types/react": "^18.x",
52
52
  "@types/react-dom": "^18.2.1",
53
53
  "@umijs/lint": "^4.0.0",
54
- "antd": "^5.4.6",
55
54
  "css-loader": "^6.7.3",
56
55
  "dumi": "^2.2.16",
57
56
  "eslint": "^8.23.0",
@@ -67,7 +66,7 @@
67
66
  "stylelint": "^14.9.1"
68
67
  },
69
68
  "dependencies": {
70
- "@ant-design/icons": "^5.2.6",
69
+ "@ant-design/icons": "^5.x",
71
70
  "@babel/runtime": "^7.23.6",
72
71
  "@umijs/hooks": "^1.9.3",
73
72
  "jr-qrcode": "^1.1.4",