Roxas 4 years ago
parent
commit
9b51cf1cb9

+ 2
- 0
.storybook/config.js View File

5
 import { withConsole } from '@storybook/addon-console';
5
 import { withConsole } from '@storybook/addon-console';
6
 import bilingoTheme from './bilingoTheme';
6
 import bilingoTheme from './bilingoTheme';
7
 
7
 
8
+import 'antd/dist/antd.less';
9
+ 
8
 addParameters({
10
 addParameters({
9
   info: { inline: true },
11
   info: { inline: true },
10
   viewport: {
12
   viewport: {

+ 1
- 1
.storybook/webpack.config.js View File

49
       {
49
       {
50
         loader: require.resolve('babel-loader'),
50
         loader: require.resolve('babel-loader'),
51
         options: {
51
         options: {
52
-          presets: [['react-app', { flow: false, typescript: true }]]
52
+          presets: [['react-app', { flow: false, typescript: true }]],
53
         }
53
         }
54
       },
54
       },
55
       // Optional
55
       // Optional

+ 1
- 1
eslib/ConsumeListView/index.js View File

2
 import React, { Component } from 'react';
2
 import React, { Component } from 'react';
3
 import { c as classnames } from '../index-7951fb2f.js';
3
 import { c as classnames } from '../index-7951fb2f.js';
4
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
4
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
5
-import { a as addImageProcess } from '../utils-82346768.js';
5
+import { a as addImageProcess } from '../utils-f64eef69.js';
6
 
6
 
7
 const img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAABvklEQVQ4T62UTygEcRTHv29MIsqfk6OL5CYH5aKd9WfjwqxEnBzExYWTCEWJJGove5H8OTA1uwdCrOWAi83ZwUXJiSj5u+Z5s0msmd2SX81h+r33ee/7fW+G8E+H/srhqEcFCjphve1RzcaVK4j3mmoB5YxqQzdOxTji1wE2QZglb2jAEcT7/g4wr0rQugS1OYJ26nOg5nYDr4ZrR7yrl0FBAKBlqjEX3eRLwSXAmidvOJbSI47oF9LVKaCOkNc4/w7kSPOoFBqDwjpp4XA60LUkF8nzbsuERQt4ejtGdsYwiAYTYIV6STOD6UB3EpqXJC0u7zKxz0Mk3Zrj7lOLerJg5T9K+2lWhALiYx8xS9NbDZnUuPXy0wN/hYw3lnbPiNfE7HaSfTAloRqKWkya8WAnMrdmIBqfBqM/BehJAo+gKHMibdMGzUhqKUiZAHGVXJYLwPdpshPnRDRM4fl5+7uKL/0c1WXdOSie5Dh3wZcyoR7SQttO9z+M5MOWEsStFQmsTAoOwVK7qM64d5P6ayKJj9EqHBa5Q4kx2/ujqR1Exnsq493HH2muFN98oNtJ0g7s3Ul5/vwbSab+G+gDqFybE11pYkYAAAAASUVORK5CYII=';
7
 const img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAABvklEQVQ4T62UTygEcRTHv29MIsqfk6OL5CYH5aKd9WfjwqxEnBzExYWTCEWJJGove5H8OTA1uwdCrOWAi83ZwUXJiSj5u+Z5s0msmd2SX81h+r33ee/7fW+G8E+H/srhqEcFCjphve1RzcaVK4j3mmoB5YxqQzdOxTji1wE2QZglb2jAEcT7/g4wr0rQugS1OYJ26nOg5nYDr4ZrR7yrl0FBAKBlqjEX3eRLwSXAmidvOJbSI47oF9LVKaCOkNc4/w7kSPOoFBqDwjpp4XA60LUkF8nzbsuERQt4ejtGdsYwiAYTYIV6STOD6UB3EpqXJC0u7zKxz0Mk3Zrj7lOLerJg5T9K+2lWhALiYx8xS9NbDZnUuPXy0wN/hYw3lnbPiNfE7HaSfTAloRqKWkya8WAnMrdmIBqfBqM/BehJAo+gKHMibdMGzUhqKUiZAHGVXJYLwPdpshPnRDRM4fl5+7uKL/0c1WXdOSie5Dh3wZcyoR7SQttO9z+M5MOWEsStFQmsTAoOwVK7qM64d5P6ayKJj9EqHBa5Q4kx2/ujqR1Exnsq493HH2muFN98oNtJ0g7s3Ul5/vwbSab+G+gDqFybE11pYkYAAAAASUVORK5CYII=';
8
 
8
 

+ 1
- 1
eslib/PayPlatformOptions/index.js
File diff suppressed because it is too large
View File


+ 1
- 2
eslib/Payment/index.js View File

2
 import 'react';
2
 import 'react';
3
 import '../index-7951fb2f.js';
3
 import '../index-7951fb2f.js';
4
 import '../style-inject.es-1f59c1d0.js';
4
 import '../style-inject.es-1f59c1d0.js';
5
-import '../utils-82346768.js';
5
+import '../utils-f64eef69.js';
6
 export { default as ConsumeListView } from '../ConsumeListView/index.js';
6
 export { default as ConsumeListView } from '../ConsumeListView/index.js';
7
 export { default as PayPlatformOptions } from '../PayPlatformOptions/index.js';
7
 export { default as PayPlatformOptions } from '../PayPlatformOptions/index.js';
8
 import 'antd';
8
 import 'antd';
9
-import 'antd/lib/button/style';
10
 export { default as PriceOptions } from '../PriceOptions/index.js';
9
 export { default as PriceOptions } from '../PriceOptions/index.js';
11
 export { default as WaitPayInfoView } from '../WaitPayInfoView/index.js';
10
 export { default as WaitPayInfoView } from '../WaitPayInfoView/index.js';
12
 //# sourceMappingURL=index.js.map
11
 //# sourceMappingURL=index.js.map

+ 1
- 1
eslib/Payment/index.js.map View File

1
-{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}

+ 29
- 7
eslib/PriceOptions/index.js View File

2
 import React, { useState } from 'react';
2
 import React, { useState } from 'react';
3
 import { c as classnames } from '../index-7951fb2f.js';
3
 import { c as classnames } from '../index-7951fb2f.js';
4
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
4
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
5
-import { f as formatMoney } from '../utils-82346768.js';
6
 import { Input } from 'antd';
5
 import { Input } from 'antd';
7
-import 'antd/lib/button/style';
8
 
6
 
9
 var css = ".PriceOptions_options__J-ZSS {\n  padding: 20px 50px;\n  border-bottom: 1px dashed #00000017;\n}\n.PriceOptions_options__J-ZSS p {\n  font-size: 14px;\n  font-weight: 400;\n  color: #616a79;\n  margin-bottom: 20px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a {\n  padding-right: 0;\n  margin-bottom: -12px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n  background: rgba(243, 243, 243, 0.14);\n  border-radius: 4px;\n  border: 1px solid #cfcfcf;\n  font-size: 14px;\n  font-weight: 600;\n  color: #616a79;\n  display: inline-block;\n  text-align: center;\n  vertical-align: top;\n  height: 30px;\n  width: 70px;\n  line-height: 30px;\n  cursor: pointer;\n  margin: 6px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2.PriceOptions_active__3WyAU {\n  background: rgba(255, 50, 102, 0.1);\n  border-radius: 4px;\n  border: 1px solid #ff3266;\n  color: #616a79;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n  display: inline-block;\n  min-width: 70px;\n  width: auto;\n  margin: 6px;\n  text-align: center;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a button {\n  border-top-left-radius: 0;\n  border-bottom-left-radius: 0;\n  height: 30px;\n  width: 50px;\n  vertical-align: top;\n  padding: 0 5px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_rate__QgHQ3 {\n  margin-left: 10px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_rate__QgHQ3 i {\n  margin-right: 5px;\n  color: #1790FF;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl {\n  padding: 0 0 12px 0;\n  border-bottom: none;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl p {\n  margin-bottom: 8px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a {\n  text-align: center;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n  border-radius: 6px;\n  height: 32px;\n  width: 72px;\n  margin: 0 0 12px 19px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2:first-child {\n  margin: 0 0 12px 0px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n  display: block;\n  width: 254px;\n  border-radius: 6px;\n  height: 32px;\n}\n@media (max-width: 768px) {\n  .PriceOptions_options__J-ZSS {\n    padding: 20px 20px;\n  }\n  .PriceOptions_options__J-ZSS p {\n    font-size: 14px;\n    font-weight: 400;\n    color: #616a79;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a {\n    padding-right: 0;\n    display: flex;\n    flex-direction: column;\n    justify-content: center;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceBtn__Xz4m_ {\n    display: flex;\n    justify-content: space-between;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n    display: inline-block;\n    background-color: #fff;\n    width: 74px;\n    height: 36px;\n    line-height: 36px;\n    border-radius: 6px;\n    border: 1px solid #cfcfcf;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2.PriceOptions_active__3WyAU {\n    background-color: #fff;\n    color: #FF3266FF;\n    border-radius: 4px;\n    border: 1px solid #ff3266;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n    border-radius: 6px;\n    height: 36px;\n    width: auto;\n  }\n}\n";
7
 var css = ".PriceOptions_options__J-ZSS {\n  padding: 20px 50px;\n  border-bottom: 1px dashed #00000017;\n}\n.PriceOptions_options__J-ZSS p {\n  font-size: 14px;\n  font-weight: 400;\n  color: #616a79;\n  margin-bottom: 20px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a {\n  padding-right: 0;\n  margin-bottom: -12px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n  background: rgba(243, 243, 243, 0.14);\n  border-radius: 4px;\n  border: 1px solid #cfcfcf;\n  font-size: 14px;\n  font-weight: 600;\n  color: #616a79;\n  display: inline-block;\n  text-align: center;\n  vertical-align: top;\n  height: 30px;\n  width: 70px;\n  line-height: 30px;\n  cursor: pointer;\n  margin: 6px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2.PriceOptions_active__3WyAU {\n  background: rgba(255, 50, 102, 0.1);\n  border-radius: 4px;\n  border: 1px solid #ff3266;\n  color: #616a79;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n  display: inline-block;\n  min-width: 70px;\n  width: auto;\n  margin: 6px;\n  text-align: center;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a button {\n  border-top-left-radius: 0;\n  border-bottom-left-radius: 0;\n  height: 30px;\n  width: 50px;\n  vertical-align: top;\n  padding: 0 5px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_rate__QgHQ3 {\n  margin-left: 10px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_rate__QgHQ3 i {\n  margin-right: 5px;\n  color: #1790FF;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl {\n  padding: 0 0 12px 0;\n  border-bottom: none;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl p {\n  margin-bottom: 8px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a {\n  text-align: center;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n  border-radius: 6px;\n  height: 32px;\n  width: 72px;\n  margin: 0 0 12px 19px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2:first-child {\n  margin: 0 0 12px 0px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n  display: block;\n  width: 254px;\n  border-radius: 6px;\n  height: 32px;\n}\n@media (max-width: 768px) {\n  .PriceOptions_options__J-ZSS {\n    padding: 20px 20px;\n  }\n  .PriceOptions_options__J-ZSS p {\n    font-size: 14px;\n    font-weight: 400;\n    color: #616a79;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a {\n    padding-right: 0;\n    display: flex;\n    flex-direction: column;\n    justify-content: center;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceBtn__Xz4m_ {\n    display: flex;\n    justify-content: space-between;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n    display: inline-block;\n    background-color: #fff;\n    width: 74px;\n    height: 36px;\n    line-height: 36px;\n    border-radius: 6px;\n    border: 1px solid #cfcfcf;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2.PriceOptions_active__3WyAU {\n    background-color: #fff;\n    color: #FF3266FF;\n    border-radius: 4px;\n    border: 1px solid #ff3266;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n    border-radius: 6px;\n    height: 36px;\n    width: auto;\n  }\n}\n";
10
 var styles = {"options":"PriceOptions_options__J-ZSS","infoItem":"PriceOptions_infoItem__3IL3a","priceItem":"PriceOptions_priceItem__rJ9o2","active":"PriceOptions_active__3WyAU","priceInput":"PriceOptions_priceInput__1MrVy","rate":"PriceOptions_rate__QgHQ3","small":"PriceOptions_small__2-wzl","priceBtn":"PriceOptions_priceBtn__Xz4m_"};
8
 var styles = {"options":"PriceOptions_options__J-ZSS","infoItem":"PriceOptions_infoItem__3IL3a","priceItem":"PriceOptions_priceItem__rJ9o2","active":"PriceOptions_active__3WyAU","priceInput":"PriceOptions_priceInput__1MrVy","rate":"PriceOptions_rate__QgHQ3","small":"PriceOptions_small__2-wzl","priceBtn":"PriceOptions_priceBtn__Xz4m_"};
20
       withTitle = _ref$withTitle === void 0 ? true : _ref$withTitle,
18
       withTitle = _ref$withTitle === void 0 ? true : _ref$withTitle,
21
       _ref$titleText = _ref.titleText,
19
       _ref$titleText = _ref.titleText,
22
       titleText = _ref$titleText === void 0 ? "Price" : _ref$titleText,
20
       titleText = _ref$titleText === void 0 ? "Price" : _ref$titleText,
21
+      _ref$inputPlaceholder = _ref.inputPlaceholderText,
22
+      inputPlaceholderText = _ref$inputPlaceholder === void 0 ? "Others" : _ref$inputPlaceholder,
23
+      _ref$priceOptions = _ref.priceOptions,
24
+      priceOptions = _ref$priceOptions === void 0 ? [100, 600, 800] : _ref$priceOptions,
25
+      _ref$priceRender = _ref.priceRender,
26
+      priceRender = _ref$priceRender === void 0 ? function (i) {
27
+    return i / 100;
28
+  } : _ref$priceRender,
29
+      _ref$inputPriceRender = _ref.inputPriceRender,
30
+      inputPriceRender = _ref$inputPriceRender === void 0 ? function (i) {
31
+    return i ? i / 100 : "";
32
+  } : _ref$inputPriceRender,
23
       inputRef = _ref.inputRef;
33
       inputRef = _ref.inputRef;
24
-  var defaultOptions = [100, 600, 800]; // 控制是否为其他金额输入情况
34
+  var defaultOptions = priceOptions; // 控制是否为其他金额输入情况
25
 
35
 
26
   var _useState = useState(false),
36
   var _useState = useState(false),
27
       _useState2 = _slicedToArray(_useState, 2),
37
       _useState2 = _slicedToArray(_useState, 2),
30
 
40
 
31
   return React.createElement("div", {
41
   return React.createElement("div", {
32
     className: classnames(styles.options)
42
     className: classnames(styles.options)
33
-  }, withTitle ? React.createElement("p", null, titleText) : null, React.createElement("div", {
43
+  }, withTitle ? titleText || null : null, React.createElement("div", {
34
     className: styles.infoItem
44
     className: styles.infoItem
35
   }, React.createElement("span", {
45
   }, React.createElement("span", {
36
     className: styles.priceBtn
46
     className: styles.priceBtn
44
         onPriceChange(item);
54
         onPriceChange(item);
45
         setInputStatus(false);
55
         setInputStatus(false);
46
       }
56
       }
47
-    }, formatMoney(item / 100, 0), "\xA5");
57
+    }, priceRender(item));
48
   })), React.createElement(Input, {
58
   })), React.createElement(Input, {
49
     ref: inputRef,
59
     ref: inputRef,
50
     onMouseEnter: function onMouseEnter() {
60
     onMouseEnter: function onMouseEnter() {
55
     },
65
     },
56
     suffix: "\xA5",
66
     suffix: "\xA5",
57
     className: styles.priceInput,
67
     className: styles.priceInput,
58
-    value: inputStatus ? price / 100 || "" : "",
59
-    placeholder: "Others",
68
+    value: inputStatus ? inputPriceRender(price) : "",
69
+    placeholder: inputPlaceholderText,
60
     onChange: function onChange(e) {
70
     onChange: function onChange(e) {
61
       var n = +e.target.value;
71
       var n = +e.target.value;
62
 
72
 
72
       setInputStatus(true);
82
       setInputStatus(true);
73
     },
83
     },
74
     onFocus: function onFocus(e) {
84
     onFocus: function onFocus(e) {
85
+      e.target.placeholder = "";
86
+      setInputStatus(true);
87
+
75
       if (focusScroll) {
88
       if (focusScroll) {
76
         e.target.scrollIntoView();
89
         e.target.scrollIntoView();
77
       }
90
       }
91
+    },
92
+    onBlur: function onBlur(e) {
93
+      e.target.placeholder = inputPlaceholderText;
94
+
95
+      if (price) {
96
+        setInputStatus(true);
97
+      } else {
98
+        setInputStatus(false);
99
+      }
78
     }
100
     }
79
   })));
101
   })));
80
 };
102
 };

+ 1
- 1
eslib/PriceOptions/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 2
eslib/index.js View File

3
 import './index-7951fb2f.js';
3
 import './index-7951fb2f.js';
4
 import './style-inject.es-1f59c1d0.js';
4
 import './style-inject.es-1f59c1d0.js';
5
 import './test-81795c27.js';
5
 import './test-81795c27.js';
6
-import './utils-82346768.js';
6
+import './utils-f64eef69.js';
7
 export { default as ConsumeListView } from './ConsumeListView/index.js';
7
 export { default as ConsumeListView } from './ConsumeListView/index.js';
8
 export { default as PayPlatformOptions } from './PayPlatformOptions/index.js';
8
 export { default as PayPlatformOptions } from './PayPlatformOptions/index.js';
9
 import 'antd';
9
 import 'antd';
10
-import 'antd/lib/button/style';
11
 export { default as PriceOptions } from './PriceOptions/index.js';
10
 export { default as PriceOptions } from './PriceOptions/index.js';
12
 export { default as WaitPayInfoView } from './WaitPayInfoView/index.js';
11
 export { default as WaitPayInfoView } from './WaitPayInfoView/index.js';
13
 
12
 

+ 1
- 1
eslib/index.js.map
File diff suppressed because it is too large
View File


eslib/utils-82346768.js → eslib/utils-f64eef69.js View File

28
 
28
 
29
   return url + IMAGE_PROCESS;
29
   return url + IMAGE_PROCESS;
30
 }
30
 }
31
-function formatMoney(input) {
32
-  var fuzz = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
33
-
34
-  if (isNaN(+input)) {
35
-    return input;
36
-  }
37
-
38
-  return (+input).toFixed(fuzz);
39
-}
40
 function exportStyleSizeClass(styles, size) {
31
 function exportStyleSizeClass(styles, size) {
41
   return _defineProperty({}, styles[size], true);
32
   return _defineProperty({}, styles[size], true);
42
 }
33
 }
43
 
34
 
44
-export { addImageProcess as a, exportStyleSizeClass as e, formatMoney as f };
45
-//# sourceMappingURL=utils-82346768.js.map
35
+export { addImageProcess as a, exportStyleSizeClass as e };
36
+//# sourceMappingURL=utils-f64eef69.js.map

lib/utils-ed518bfc.js.map → eslib/utils-f64eef69.js.map View File

1
-{"version":3,"file":"utils-82346768.js","sources":["../src/components/Payment/Utils/utils.ts"],"sourcesContent":["\r\nexport const IMAGE_PROCESS = '?x-oss-process=image/resize,h_350';\r\nexport const IMAGE_PROCESS_SMALL = '?x-oss-process=image/resize,h_100';\r\nexport const IMAGE_PROCESS_LARGE = '?x-oss-process=image/resize,h_500';\r\n\r\ntype AddImageProcessOptions = {\r\n  small?: boolean;\r\n  large?: boolean;\r\n  custom?: boolean;\r\n  width?: string;\r\n  height?: string;\r\n}\r\n\r\nexport function addImageProcess(url: string, options: AddImageProcessOptions = { width: '36px', height: '36px' }) {\r\n  // 防止重复添加导致的url不正确\r\n  if (url && url.indexOf('x-oss-process') > -1) {\r\n    return url;\r\n  }\r\n  if (options.small) {\r\n    return url + IMAGE_PROCESS_SMALL;\r\n  }\r\n  if (options.large) {\r\n    return url + IMAGE_PROCESS_LARGE;\r\n  }\r\n  if (options.custom) {\r\n    return `${url}?x-oss-process=image/resize,limit_0,m_fill,w_${options.width},h_${options.height}`;\r\n  }\r\n  return url + IMAGE_PROCESS;\r\n}\r\n\r\nexport function formatMoney(input: any, fuzz = 2) {\r\n  if (isNaN(+input)) {\r\n    return input;\r\n  }\r\n  return (+input).toFixed(fuzz);\r\n}\r\n\r\ntype classSize = 'small'|'normal'|'large';\r\n\r\nexport function exportStyleSizeClass(styles: any, size: classSize) {\r\n  return {\r\n    [styles[size]]: true,\r\n  }\r\n}"],"names":["IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","addImageProcess","url","options","width","height","indexOf","small","large","custom","formatMoney","input","fuzz","isNaN","toFixed","exportStyleSizeClass","styles","size"],"mappings":";;;;AACO,IAAMA,aAAa,GAAG,mCAAtB;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AAUP,AAAO,SAASC,eAAT,CAAyBC,GAAzB,EAA2G;MAArEC,OAAqE,uEAAnC;IAAEC,KAAK,EAAE,MAAT;IAAiBC,MAAM,EAAE;GAAU;;;MAE5GH,GAAG,IAAIA,GAAG,CAACI,OAAJ,CAAY,eAAZ,IAA+B,CAAC,CAA3C,EAA8C;WACrCJ,GAAP;;;MAEEC,OAAO,CAACI,KAAZ,EAAmB;WACVL,GAAG,GAAGH,mBAAb;;;MAEEI,OAAO,CAACK,KAAZ,EAAmB;WACVN,GAAG,GAAGF,mBAAb;;;MAEEG,OAAO,CAACM,MAAZ,EAAoB;qBACRP,GAAV,0DAA6DC,OAAO,CAACC,KAArE,gBAAgFD,OAAO,CAACE,MAAxF;;;SAEKH,GAAG,GAAGJ,aAAb;;AAGF,AAAO,SAASY,WAAT,CAAqBC,KAArB,EAA2C;MAAVC,IAAU,uEAAH,CAAG;;MAC5CC,KAAK,CAAC,CAACF,KAAF,CAAT,EAAmB;WACVA,KAAP;;;SAEK,CAAC,CAACA,KAAF,EAASG,OAAT,CAAiBF,IAAjB,CAAP;;AAKF,AAAO,SAASG,oBAAT,CAA8BC,MAA9B,EAA2CC,IAA3C,EAA4D;8CAE9DD,MAAM,CAACC,IAAD,CADT,EACkB,IADlB;;;;;;;"}
1
+{"version":3,"file":"utils-f64eef69.js","sources":["../src/components/Payment/Utils/utils.ts"],"sourcesContent":["\r\nexport const IMAGE_PROCESS = '?x-oss-process=image/resize,h_350';\r\nexport const IMAGE_PROCESS_SMALL = '?x-oss-process=image/resize,h_100';\r\nexport const IMAGE_PROCESS_LARGE = '?x-oss-process=image/resize,h_500';\r\n\r\ntype AddImageProcessOptions = {\r\n  small?: boolean;\r\n  large?: boolean;\r\n  custom?: boolean;\r\n  width?: string;\r\n  height?: string;\r\n}\r\n\r\nexport function addImageProcess(url: string, options: AddImageProcessOptions = { width: '36px', height: '36px' }) {\r\n  // 防止重复添加导致的url不正确\r\n  if (url && url.indexOf('x-oss-process') > -1) {\r\n    return url;\r\n  }\r\n  if (options.small) {\r\n    return url + IMAGE_PROCESS_SMALL;\r\n  }\r\n  if (options.large) {\r\n    return url + IMAGE_PROCESS_LARGE;\r\n  }\r\n  if (options.custom) {\r\n    return `${url}?x-oss-process=image/resize,limit_0,m_fill,w_${options.width},h_${options.height}`;\r\n  }\r\n  return url + IMAGE_PROCESS;\r\n}\r\n\r\nexport function formatMoney(input: any, fuzz = 2) {\r\n  if (isNaN(+input)) {\r\n    return input;\r\n  }\r\n  return (+input).toFixed(fuzz);\r\n}\r\n\r\ntype classSize = 'small'|'normal'|'large';\r\n\r\nexport function exportStyleSizeClass(styles: any, size: classSize) {\r\n  return {\r\n    [styles[size]]: true,\r\n  }\r\n}"],"names":["IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","addImageProcess","url","options","width","height","indexOf","small","large","custom","exportStyleSizeClass","styles","size"],"mappings":";;AACO,IAAMA,aAAa,GAAG,mCAAtB;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AAUP,AAAO,SAASC,eAAT,CAAyBC,GAAzB,EAA2G;MAArEC,OAAqE,uEAAnC;IAAEC,KAAK,EAAE,MAAT;IAAiBC,MAAM,EAAE;GAAU;;;MAE5GH,GAAG,IAAIA,GAAG,CAACI,OAAJ,CAAY,eAAZ,IAA+B,CAAC,CAA3C,EAA8C;WACrCJ,GAAP;;;MAEEC,OAAO,CAACI,KAAZ,EAAmB;WACVL,GAAG,GAAGH,mBAAb;;;MAEEI,OAAO,CAACK,KAAZ,EAAmB;WACVN,GAAG,GAAGF,mBAAb;;;MAEEG,OAAO,CAACM,MAAZ,EAAoB;qBACRP,GAAV,0DAA6DC,OAAO,CAACC,KAArE,gBAAgFD,OAAO,CAACE,MAAxF;;;SAEKH,GAAG,GAAGJ,aAAb;;AAGF,AASO,SAASY,oBAAT,CAA8BC,MAA9B,EAA2CC,IAA3C,EAA4D;6BAE9DD,MAAM,CAACC,IAAD,CADT,EACkB,IADlB;;;;;"}

+ 1
- 1
lib/ConsumeListView/index.js View File

9
 var React__default = _interopDefault(React);
9
 var React__default = _interopDefault(React);
10
 var index = require('../index-c2424ad4.js');
10
 var index = require('../index-c2424ad4.js');
11
 var styleInject_es = require('../style-inject.es-dcee06b6.js');
11
 var styleInject_es = require('../style-inject.es-dcee06b6.js');
12
-var utils = require('../utils-ed518bfc.js');
12
+var utils = require('../utils-4bc17ae2.js');
13
 
13
 
14
 const img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAABvklEQVQ4T62UTygEcRTHv29MIsqfk6OL5CYH5aKd9WfjwqxEnBzExYWTCEWJJGove5H8OTA1uwdCrOWAi83ZwUXJiSj5u+Z5s0msmd2SX81h+r33ee/7fW+G8E+H/srhqEcFCjphve1RzcaVK4j3mmoB5YxqQzdOxTji1wE2QZglb2jAEcT7/g4wr0rQugS1OYJ26nOg5nYDr4ZrR7yrl0FBAKBlqjEX3eRLwSXAmidvOJbSI47oF9LVKaCOkNc4/w7kSPOoFBqDwjpp4XA60LUkF8nzbsuERQt4ejtGdsYwiAYTYIV6STOD6UB3EpqXJC0u7zKxz0Mk3Zrj7lOLerJg5T9K+2lWhALiYx8xS9NbDZnUuPXy0wN/hYw3lnbPiNfE7HaSfTAloRqKWkya8WAnMrdmIBqfBqM/BehJAo+gKHMibdMGzUhqKUiZAHGVXJYLwPdpshPnRDRM4fl5+7uKL/0c1WXdOSie5Dh3wZcyoR7SQttO9z+M5MOWEsStFQmsTAoOwVK7qM64d5P6ayKJj9EqHBa5Q4kx2/ujqR1Exnsq493HH2muFN98oNtJ0g7s3Ul5/vwbSab+G+gDqFybE11pYkYAAAAASUVORK5CYII=';
14
 const img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAABvklEQVQ4T62UTygEcRTHv29MIsqfk6OL5CYH5aKd9WfjwqxEnBzExYWTCEWJJGove5H8OTA1uwdCrOWAi83ZwUXJiSj5u+Z5s0msmd2SX81h+r33ee/7fW+G8E+H/srhqEcFCjphve1RzcaVK4j3mmoB5YxqQzdOxTji1wE2QZglb2jAEcT7/g4wr0rQugS1OYJ26nOg5nYDr4ZrR7yrl0FBAKBlqjEX3eRLwSXAmidvOJbSI47oF9LVKaCOkNc4/w7kSPOoFBqDwjpp4XA60LUkF8nzbsuERQt4ejtGdsYwiAYTYIV6STOD6UB3EpqXJC0u7zKxz0Mk3Zrj7lOLerJg5T9K+2lWhALiYx8xS9NbDZnUuPXy0wN/hYw3lnbPiNfE7HaSfTAloRqKWkya8WAnMrdmIBqfBqM/BehJAo+gKHMibdMGzUhqKUiZAHGVXJYLwPdpshPnRDRM4fl5+7uKL/0c1WXdOSie5Dh3wZcyoR7SQttO9z+M5MOWEsStFQmsTAoOwVK7qM64d5P6ayKJj9EqHBa5Q4kx2/ujqR1Exnsq493HH2muFN98oNtJ0g7s3Ul5/vwbSab+G+gDqFybE11pYkYAAAAASUVORK5CYII=';
15
 
15
 

+ 1
- 1
lib/PayPlatformOptions/index.js
File diff suppressed because it is too large
View File


+ 1
- 2
lib/Payment/index.js View File

6
 require('react');
6
 require('react');
7
 require('../index-c2424ad4.js');
7
 require('../index-c2424ad4.js');
8
 require('../style-inject.es-dcee06b6.js');
8
 require('../style-inject.es-dcee06b6.js');
9
-require('../utils-ed518bfc.js');
9
+require('../utils-4bc17ae2.js');
10
 var ConsumeListView = require('../ConsumeListView/index.js');
10
 var ConsumeListView = require('../ConsumeListView/index.js');
11
 var PayPlatformOptions = require('../PayPlatformOptions/index.js');
11
 var PayPlatformOptions = require('../PayPlatformOptions/index.js');
12
 require('antd');
12
 require('antd');
13
-require('antd/lib/button/style');
14
 var PriceOptions = require('../PriceOptions/index.js');
13
 var PriceOptions = require('../PriceOptions/index.js');
15
 var WaitPayInfoView = require('../WaitPayInfoView/index.js');
14
 var WaitPayInfoView = require('../WaitPayInfoView/index.js');
16
 
15
 

+ 1
- 1
lib/Payment/index.js.map View File

1
-{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}

+ 29
- 7
lib/PriceOptions/index.js View File

9
 var React__default = _interopDefault(React);
9
 var React__default = _interopDefault(React);
10
 var index = require('../index-c2424ad4.js');
10
 var index = require('../index-c2424ad4.js');
11
 var styleInject_es = require('../style-inject.es-dcee06b6.js');
11
 var styleInject_es = require('../style-inject.es-dcee06b6.js');
12
-var utils = require('../utils-ed518bfc.js');
13
 var antd = require('antd');
12
 var antd = require('antd');
14
-require('antd/lib/button/style');
15
 
13
 
16
 var css = ".PriceOptions_options__J-ZSS {\n  padding: 20px 50px;\n  border-bottom: 1px dashed #00000017;\n}\n.PriceOptions_options__J-ZSS p {\n  font-size: 14px;\n  font-weight: 400;\n  color: #616a79;\n  margin-bottom: 20px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a {\n  padding-right: 0;\n  margin-bottom: -12px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n  background: rgba(243, 243, 243, 0.14);\n  border-radius: 4px;\n  border: 1px solid #cfcfcf;\n  font-size: 14px;\n  font-weight: 600;\n  color: #616a79;\n  display: inline-block;\n  text-align: center;\n  vertical-align: top;\n  height: 30px;\n  width: 70px;\n  line-height: 30px;\n  cursor: pointer;\n  margin: 6px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2.PriceOptions_active__3WyAU {\n  background: rgba(255, 50, 102, 0.1);\n  border-radius: 4px;\n  border: 1px solid #ff3266;\n  color: #616a79;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n  display: inline-block;\n  min-width: 70px;\n  width: auto;\n  margin: 6px;\n  text-align: center;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a button {\n  border-top-left-radius: 0;\n  border-bottom-left-radius: 0;\n  height: 30px;\n  width: 50px;\n  vertical-align: top;\n  padding: 0 5px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_rate__QgHQ3 {\n  margin-left: 10px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_rate__QgHQ3 i {\n  margin-right: 5px;\n  color: #1790FF;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl {\n  padding: 0 0 12px 0;\n  border-bottom: none;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl p {\n  margin-bottom: 8px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a {\n  text-align: center;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n  border-radius: 6px;\n  height: 32px;\n  width: 72px;\n  margin: 0 0 12px 19px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2:first-child {\n  margin: 0 0 12px 0px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n  display: block;\n  width: 254px;\n  border-radius: 6px;\n  height: 32px;\n}\n@media (max-width: 768px) {\n  .PriceOptions_options__J-ZSS {\n    padding: 20px 20px;\n  }\n  .PriceOptions_options__J-ZSS p {\n    font-size: 14px;\n    font-weight: 400;\n    color: #616a79;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a {\n    padding-right: 0;\n    display: flex;\n    flex-direction: column;\n    justify-content: center;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceBtn__Xz4m_ {\n    display: flex;\n    justify-content: space-between;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n    display: inline-block;\n    background-color: #fff;\n    width: 74px;\n    height: 36px;\n    line-height: 36px;\n    border-radius: 6px;\n    border: 1px solid #cfcfcf;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2.PriceOptions_active__3WyAU {\n    background-color: #fff;\n    color: #FF3266FF;\n    border-radius: 4px;\n    border: 1px solid #ff3266;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n    border-radius: 6px;\n    height: 36px;\n    width: auto;\n  }\n}\n";
14
 var css = ".PriceOptions_options__J-ZSS {\n  padding: 20px 50px;\n  border-bottom: 1px dashed #00000017;\n}\n.PriceOptions_options__J-ZSS p {\n  font-size: 14px;\n  font-weight: 400;\n  color: #616a79;\n  margin-bottom: 20px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a {\n  padding-right: 0;\n  margin-bottom: -12px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n  background: rgba(243, 243, 243, 0.14);\n  border-radius: 4px;\n  border: 1px solid #cfcfcf;\n  font-size: 14px;\n  font-weight: 600;\n  color: #616a79;\n  display: inline-block;\n  text-align: center;\n  vertical-align: top;\n  height: 30px;\n  width: 70px;\n  line-height: 30px;\n  cursor: pointer;\n  margin: 6px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2.PriceOptions_active__3WyAU {\n  background: rgba(255, 50, 102, 0.1);\n  border-radius: 4px;\n  border: 1px solid #ff3266;\n  color: #616a79;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n  display: inline-block;\n  min-width: 70px;\n  width: auto;\n  margin: 6px;\n  text-align: center;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a button {\n  border-top-left-radius: 0;\n  border-bottom-left-radius: 0;\n  height: 30px;\n  width: 50px;\n  vertical-align: top;\n  padding: 0 5px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_rate__QgHQ3 {\n  margin-left: 10px;\n}\n.PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_rate__QgHQ3 i {\n  margin-right: 5px;\n  color: #1790FF;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl {\n  padding: 0 0 12px 0;\n  border-bottom: none;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl p {\n  margin-bottom: 8px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a {\n  text-align: center;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n  border-radius: 6px;\n  height: 32px;\n  width: 72px;\n  margin: 0 0 12px 19px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2:first-child {\n  margin: 0 0 12px 0px;\n}\n.PriceOptions_options__J-ZSS.PriceOptions_small__2-wzl .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n  display: block;\n  width: 254px;\n  border-radius: 6px;\n  height: 32px;\n}\n@media (max-width: 768px) {\n  .PriceOptions_options__J-ZSS {\n    padding: 20px 20px;\n  }\n  .PriceOptions_options__J-ZSS p {\n    font-size: 14px;\n    font-weight: 400;\n    color: #616a79;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a {\n    padding-right: 0;\n    display: flex;\n    flex-direction: column;\n    justify-content: center;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceBtn__Xz4m_ {\n    display: flex;\n    justify-content: space-between;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2 {\n    display: inline-block;\n    background-color: #fff;\n    width: 74px;\n    height: 36px;\n    line-height: 36px;\n    border-radius: 6px;\n    border: 1px solid #cfcfcf;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceItem__rJ9o2.PriceOptions_active__3WyAU {\n    background-color: #fff;\n    color: #FF3266FF;\n    border-radius: 4px;\n    border: 1px solid #ff3266;\n  }\n  .PriceOptions_options__J-ZSS .PriceOptions_infoItem__3IL3a .PriceOptions_priceInput__1MrVy {\n    border-radius: 6px;\n    height: 36px;\n    width: auto;\n  }\n}\n";
17
 var styles = {"options":"PriceOptions_options__J-ZSS","infoItem":"PriceOptions_infoItem__3IL3a","priceItem":"PriceOptions_priceItem__rJ9o2","active":"PriceOptions_active__3WyAU","priceInput":"PriceOptions_priceInput__1MrVy","rate":"PriceOptions_rate__QgHQ3","small":"PriceOptions_small__2-wzl","priceBtn":"PriceOptions_priceBtn__Xz4m_"};
15
 var styles = {"options":"PriceOptions_options__J-ZSS","infoItem":"PriceOptions_infoItem__3IL3a","priceItem":"PriceOptions_priceItem__rJ9o2","active":"PriceOptions_active__3WyAU","priceInput":"PriceOptions_priceInput__1MrVy","rate":"PriceOptions_rate__QgHQ3","small":"PriceOptions_small__2-wzl","priceBtn":"PriceOptions_priceBtn__Xz4m_"};
27
       withTitle = _ref$withTitle === void 0 ? true : _ref$withTitle,
25
       withTitle = _ref$withTitle === void 0 ? true : _ref$withTitle,
28
       _ref$titleText = _ref.titleText,
26
       _ref$titleText = _ref.titleText,
29
       titleText = _ref$titleText === void 0 ? "Price" : _ref$titleText,
27
       titleText = _ref$titleText === void 0 ? "Price" : _ref$titleText,
28
+      _ref$inputPlaceholder = _ref.inputPlaceholderText,
29
+      inputPlaceholderText = _ref$inputPlaceholder === void 0 ? "Others" : _ref$inputPlaceholder,
30
+      _ref$priceOptions = _ref.priceOptions,
31
+      priceOptions = _ref$priceOptions === void 0 ? [100, 600, 800] : _ref$priceOptions,
32
+      _ref$priceRender = _ref.priceRender,
33
+      priceRender = _ref$priceRender === void 0 ? function (i) {
34
+    return i / 100;
35
+  } : _ref$priceRender,
36
+      _ref$inputPriceRender = _ref.inputPriceRender,
37
+      inputPriceRender = _ref$inputPriceRender === void 0 ? function (i) {
38
+    return i ? i / 100 : "";
39
+  } : _ref$inputPriceRender,
30
       inputRef = _ref.inputRef;
40
       inputRef = _ref.inputRef;
31
-  var defaultOptions = [100, 600, 800]; // 控制是否为其他金额输入情况
41
+  var defaultOptions = priceOptions; // 控制是否为其他金额输入情况
32
 
42
 
33
   var _useState = React.useState(false),
43
   var _useState = React.useState(false),
34
       _useState2 = _commonjsHelpers._slicedToArray(_useState, 2),
44
       _useState2 = _commonjsHelpers._slicedToArray(_useState, 2),
37
 
47
 
38
   return React__default.createElement("div", {
48
   return React__default.createElement("div", {
39
     className: index.classnames(styles.options)
49
     className: index.classnames(styles.options)
40
-  }, withTitle ? React__default.createElement("p", null, titleText) : null, React__default.createElement("div", {
50
+  }, withTitle ? titleText || null : null, React__default.createElement("div", {
41
     className: styles.infoItem
51
     className: styles.infoItem
42
   }, React__default.createElement("span", {
52
   }, React__default.createElement("span", {
43
     className: styles.priceBtn
53
     className: styles.priceBtn
51
         onPriceChange(item);
61
         onPriceChange(item);
52
         setInputStatus(false);
62
         setInputStatus(false);
53
       }
63
       }
54
-    }, utils.formatMoney(item / 100, 0), "\xA5");
64
+    }, priceRender(item));
55
   })), React__default.createElement(antd.Input, {
65
   })), React__default.createElement(antd.Input, {
56
     ref: inputRef,
66
     ref: inputRef,
57
     onMouseEnter: function onMouseEnter() {
67
     onMouseEnter: function onMouseEnter() {
62
     },
72
     },
63
     suffix: "\xA5",
73
     suffix: "\xA5",
64
     className: styles.priceInput,
74
     className: styles.priceInput,
65
-    value: inputStatus ? price / 100 || "" : "",
66
-    placeholder: "Others",
75
+    value: inputStatus ? inputPriceRender(price) : "",
76
+    placeholder: inputPlaceholderText,
67
     onChange: function onChange(e) {
77
     onChange: function onChange(e) {
68
       var n = +e.target.value;
78
       var n = +e.target.value;
69
 
79
 
79
       setInputStatus(true);
89
       setInputStatus(true);
80
     },
90
     },
81
     onFocus: function onFocus(e) {
91
     onFocus: function onFocus(e) {
92
+      e.target.placeholder = "";
93
+      setInputStatus(true);
94
+
82
       if (focusScroll) {
95
       if (focusScroll) {
83
         e.target.scrollIntoView();
96
         e.target.scrollIntoView();
84
       }
97
       }
98
+    },
99
+    onBlur: function onBlur(e) {
100
+      e.target.placeholder = inputPlaceholderText;
101
+
102
+      if (price) {
103
+        setInputStatus(true);
104
+      } else {
105
+        setInputStatus(false);
106
+      }
85
     }
107
     }
86
   })));
108
   })));
87
 };
109
 };

+ 1
- 1
lib/PriceOptions/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 2
lib/index.js View File

7
 require('./index-c2424ad4.js');
7
 require('./index-c2424ad4.js');
8
 require('./style-inject.es-dcee06b6.js');
8
 require('./style-inject.es-dcee06b6.js');
9
 require('./test-029f205d.js');
9
 require('./test-029f205d.js');
10
-require('./utils-ed518bfc.js');
10
+require('./utils-4bc17ae2.js');
11
 var ConsumeListView = require('./ConsumeListView/index.js');
11
 var ConsumeListView = require('./ConsumeListView/index.js');
12
 var PayPlatformOptions = require('./PayPlatformOptions/index.js');
12
 var PayPlatformOptions = require('./PayPlatformOptions/index.js');
13
 require('antd');
13
 require('antd');
14
-require('antd/lib/button/style');
15
 var PriceOptions = require('./PriceOptions/index.js');
14
 var PriceOptions = require('./PriceOptions/index.js');
16
 var WaitPayInfoView = require('./WaitPayInfoView/index.js');
15
 var WaitPayInfoView = require('./WaitPayInfoView/index.js');
17
 
16
 

+ 1
- 1
lib/index.js.map
File diff suppressed because it is too large
View File


lib/utils-ed518bfc.js → lib/utils-4bc17ae2.js View File

30
 
30
 
31
   return url + IMAGE_PROCESS;
31
   return url + IMAGE_PROCESS;
32
 }
32
 }
33
-function formatMoney(input) {
34
-  var fuzz = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
35
-
36
-  if (isNaN(+input)) {
37
-    return input;
38
-  }
39
-
40
-  return (+input).toFixed(fuzz);
41
-}
42
 function exportStyleSizeClass(styles, size) {
33
 function exportStyleSizeClass(styles, size) {
43
   return _commonjsHelpers._defineProperty({}, styles[size], true);
34
   return _commonjsHelpers._defineProperty({}, styles[size], true);
44
 }
35
 }
45
 
36
 
46
 exports.addImageProcess = addImageProcess;
37
 exports.addImageProcess = addImageProcess;
47
 exports.exportStyleSizeClass = exportStyleSizeClass;
38
 exports.exportStyleSizeClass = exportStyleSizeClass;
48
-exports.formatMoney = formatMoney;
49
-//# sourceMappingURL=utils-ed518bfc.js.map
39
+//# sourceMappingURL=utils-4bc17ae2.js.map

eslib/utils-82346768.js.map → lib/utils-4bc17ae2.js.map View File

1
-{"version":3,"file":"utils-82346768.js","sources":["../src/components/Payment/Utils/utils.ts"],"sourcesContent":["\r\nexport const IMAGE_PROCESS = '?x-oss-process=image/resize,h_350';\r\nexport const IMAGE_PROCESS_SMALL = '?x-oss-process=image/resize,h_100';\r\nexport const IMAGE_PROCESS_LARGE = '?x-oss-process=image/resize,h_500';\r\n\r\ntype AddImageProcessOptions = {\r\n  small?: boolean;\r\n  large?: boolean;\r\n  custom?: boolean;\r\n  width?: string;\r\n  height?: string;\r\n}\r\n\r\nexport function addImageProcess(url: string, options: AddImageProcessOptions = { width: '36px', height: '36px' }) {\r\n  // 防止重复添加导致的url不正确\r\n  if (url && url.indexOf('x-oss-process') > -1) {\r\n    return url;\r\n  }\r\n  if (options.small) {\r\n    return url + IMAGE_PROCESS_SMALL;\r\n  }\r\n  if (options.large) {\r\n    return url + IMAGE_PROCESS_LARGE;\r\n  }\r\n  if (options.custom) {\r\n    return `${url}?x-oss-process=image/resize,limit_0,m_fill,w_${options.width},h_${options.height}`;\r\n  }\r\n  return url + IMAGE_PROCESS;\r\n}\r\n\r\nexport function formatMoney(input: any, fuzz = 2) {\r\n  if (isNaN(+input)) {\r\n    return input;\r\n  }\r\n  return (+input).toFixed(fuzz);\r\n}\r\n\r\ntype classSize = 'small'|'normal'|'large';\r\n\r\nexport function exportStyleSizeClass(styles: any, size: classSize) {\r\n  return {\r\n    [styles[size]]: true,\r\n  }\r\n}"],"names":["IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","addImageProcess","url","options","width","height","indexOf","small","large","custom","formatMoney","input","fuzz","isNaN","toFixed","exportStyleSizeClass","styles","size"],"mappings":";;AACO,IAAMA,aAAa,GAAG,mCAAtB;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AAUP,AAAO,SAASC,eAAT,CAAyBC,GAAzB,EAA2G;MAArEC,OAAqE,uEAAnC;IAAEC,KAAK,EAAE,MAAT;IAAiBC,MAAM,EAAE;GAAU;;;MAE5GH,GAAG,IAAIA,GAAG,CAACI,OAAJ,CAAY,eAAZ,IAA+B,CAAC,CAA3C,EAA8C;WACrCJ,GAAP;;;MAEEC,OAAO,CAACI,KAAZ,EAAmB;WACVL,GAAG,GAAGH,mBAAb;;;MAEEI,OAAO,CAACK,KAAZ,EAAmB;WACVN,GAAG,GAAGF,mBAAb;;;MAEEG,OAAO,CAACM,MAAZ,EAAoB;qBACRP,GAAV,0DAA6DC,OAAO,CAACC,KAArE,gBAAgFD,OAAO,CAACE,MAAxF;;;SAEKH,GAAG,GAAGJ,aAAb;;AAGF,AAAO,SAASY,WAAT,CAAqBC,KAArB,EAA2C;MAAVC,IAAU,uEAAH,CAAG;;MAC5CC,KAAK,CAAC,CAACF,KAAF,CAAT,EAAmB;WACVA,KAAP;;;SAEK,CAAC,CAACA,KAAF,EAASG,OAAT,CAAiBF,IAAjB,CAAP;;AAKF,AAAO,SAASG,oBAAT,CAA8BC,MAA9B,EAA2CC,IAA3C,EAA4D;6BAE9DD,MAAM,CAACC,IAAD,CADT,EACkB,IADlB;;;;;"}
1
+{"version":3,"file":"utils-f64eef69.js","sources":["../src/components/Payment/Utils/utils.ts"],"sourcesContent":["\r\nexport const IMAGE_PROCESS = '?x-oss-process=image/resize,h_350';\r\nexport const IMAGE_PROCESS_SMALL = '?x-oss-process=image/resize,h_100';\r\nexport const IMAGE_PROCESS_LARGE = '?x-oss-process=image/resize,h_500';\r\n\r\ntype AddImageProcessOptions = {\r\n  small?: boolean;\r\n  large?: boolean;\r\n  custom?: boolean;\r\n  width?: string;\r\n  height?: string;\r\n}\r\n\r\nexport function addImageProcess(url: string, options: AddImageProcessOptions = { width: '36px', height: '36px' }) {\r\n  // 防止重复添加导致的url不正确\r\n  if (url && url.indexOf('x-oss-process') > -1) {\r\n    return url;\r\n  }\r\n  if (options.small) {\r\n    return url + IMAGE_PROCESS_SMALL;\r\n  }\r\n  if (options.large) {\r\n    return url + IMAGE_PROCESS_LARGE;\r\n  }\r\n  if (options.custom) {\r\n    return `${url}?x-oss-process=image/resize,limit_0,m_fill,w_${options.width},h_${options.height}`;\r\n  }\r\n  return url + IMAGE_PROCESS;\r\n}\r\n\r\nexport function formatMoney(input: any, fuzz = 2) {\r\n  if (isNaN(+input)) {\r\n    return input;\r\n  }\r\n  return (+input).toFixed(fuzz);\r\n}\r\n\r\ntype classSize = 'small'|'normal'|'large';\r\n\r\nexport function exportStyleSizeClass(styles: any, size: classSize) {\r\n  return {\r\n    [styles[size]]: true,\r\n  }\r\n}"],"names":["IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","addImageProcess","url","options","width","height","indexOf","small","large","custom","exportStyleSizeClass","styles","size"],"mappings":";;;;AACO,IAAMA,aAAa,GAAG,mCAAtB;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AAUP,AAAO,SAASC,eAAT,CAAyBC,GAAzB,EAA2G;MAArEC,OAAqE,uEAAnC;IAAEC,KAAK,EAAE,MAAT;IAAiBC,MAAM,EAAE;GAAU;;;MAE5GH,GAAG,IAAIA,GAAG,CAACI,OAAJ,CAAY,eAAZ,IAA+B,CAAC,CAA3C,EAA8C;WACrCJ,GAAP;;;MAEEC,OAAO,CAACI,KAAZ,EAAmB;WACVL,GAAG,GAAGH,mBAAb;;;MAEEI,OAAO,CAACK,KAAZ,EAAmB;WACVN,GAAG,GAAGF,mBAAb;;;MAEEG,OAAO,CAACM,MAAZ,EAAoB;qBACRP,GAAV,0DAA6DC,OAAO,CAACC,KAArE,gBAAgFD,OAAO,CAACE,MAAxF;;;SAEKH,GAAG,GAAGJ,aAAb;;AAGF,AASO,SAASY,oBAAT,CAA8BC,MAA9B,EAA2CC,IAA3C,EAA4D;8CAE9DD,MAAM,CAACC,IAAD,CADT,EACkB,IADlB;;;;;;"}

+ 18
- 15
src/components/Payment/PriceOptions/index.tsx View File

1
 import React, { useState } from "react";
1
 import React, { useState } from "react";
2
 import classnames from "classnames";
2
 import classnames from "classnames";
3
-import { Input } from 'antd';
4
-import { formatMoney } from "../Utils/utils";
5
-import 'antd/lib/button/style';
3
+import { Input } from "antd";
6
 import styles from "./PriceOptions.less";
4
 import styles from "./PriceOptions.less";
7
 
5
 
8
 interface Props {
6
 interface Props {
13
   withTitle: boolean;
11
   withTitle: boolean;
14
   titleText?: string | JSX.Element[] | JSX.Element;
12
   titleText?: string | JSX.Element[] | JSX.Element;
15
   inputPlaceholderText?: string;
13
   inputPlaceholderText?: string;
14
+  priceOptions?: Array<any>;
15
+  priceRender?: Function;
16
+  inputPriceRender?: Function;
16
   inputRef: React.RefObject<any>;
17
   inputRef: React.RefObject<any>;
17
 }
18
 }
18
 
19
 
24
   withTitle = true,
25
   withTitle = true,
25
   titleText = "Price",
26
   titleText = "Price",
26
   inputPlaceholderText = "Others",
27
   inputPlaceholderText = "Others",
28
+  priceOptions = [100, 600, 800],
29
+  priceRender = (i: any) => i / 100,
30
+  inputPriceRender = (i: any) => (i ? i / 100 : ""),
27
   inputRef
31
   inputRef
28
 }: Props) => {
32
 }: Props) => {
29
-  const defaultOptions = [100, 600, 800];
33
+  const defaultOptions = priceOptions;
30
   // 控制是否为其他金额输入情况
34
   // 控制是否为其他金额输入情况
31
   const [inputStatus, setInputStatus] = useState(false);
35
   const [inputStatus, setInputStatus] = useState(false);
32
 
36
 
33
   return (
37
   return (
34
-    <div
35
-      className={classnames(styles.options)}
36
-    >
37
-      {withTitle ? (
38
-        <p>
39
-          {titleText}
40
-        </p>
41
-      ) : null}
38
+    <div className={classnames(styles.options)}>
39
+      {withTitle ? (titleText || null) : null}
42
       <div className={styles.infoItem}>
40
       <div className={styles.infoItem}>
43
         <span className={styles.priceBtn}>
41
         <span className={styles.priceBtn}>
44
           {defaultOptions.map(item => (
42
           {defaultOptions.map(item => (
53
                 setInputStatus(false);
51
                 setInputStatus(false);
54
               }}
52
               }}
55
             >
53
             >
56
-              {formatMoney(item/100, 0)}¥
54
+              {priceRender(item)}
57
             </span>
55
             </span>
58
           ))}
56
           ))}
59
         </span>
57
         </span>
67
           }}
65
           }}
68
           suffix="¥"
66
           suffix="¥"
69
           className={styles.priceInput}
67
           className={styles.priceInput}
70
-          value={inputStatus ? price / 100 || "" : ""}
68
+          value={inputStatus ? inputPriceRender(price) : ""}
71
           placeholder={inputPlaceholderText}
69
           placeholder={inputPlaceholderText}
72
           onChange={e => {
70
           onChange={e => {
73
             const n = +e.target.value;
71
             const n = +e.target.value;
82
             setInputStatus(true);
80
             setInputStatus(true);
83
           }}
81
           }}
84
           onFocus={e => {
82
           onFocus={e => {
85
-            e.target.placeholder = '';
83
+            e.target.placeholder = "";
86
             setInputStatus(true);
84
             setInputStatus(true);
87
             if (focusScroll) {
85
             if (focusScroll) {
88
               e.target.scrollIntoView();
86
               e.target.scrollIntoView();
90
           }}
88
           }}
91
           onBlur={e => {
89
           onBlur={e => {
92
             e.target.placeholder = inputPlaceholderText;
90
             e.target.placeholder = inputPlaceholderText;
91
+            if (price) {
92
+              setInputStatus(true);
93
+            } else {
94
+              setInputStatus(false);
95
+            }
93
           }}
96
           }}
94
         />
97
         />
95
       </div>
98
       </div>

+ 1
- 1
stats.html
File diff suppressed because it is too large
View File


+ 12
- 2
stories/Payment.stories.tsx View File

2
 import { storiesOf } from '@storybook/react';
2
 import { storiesOf } from '@storybook/react';
3
 import { action } from '@storybook/addon-actions';
3
 import { action } from '@storybook/addon-actions';
4
 import { withInfo } from "@storybook/addon-info";
4
 import { withInfo } from "@storybook/addon-info";
5
-import { withKnobs, number, boolean, select, text } from "@storybook/addon-knobs";
5
+import { withKnobs, number, boolean, select, text, array } from "@storybook/addon-knobs";
6
 import { addReadme } from 'storybook-readme';
6
 import { addReadme } from 'storybook-readme';
7
+import { Divider } from 'antd';
7
 
8
 
8
 import ConsumeListView from '@/components/Payment/ConsumeListView';
9
 import ConsumeListView from '@/components/Payment/ConsumeListView';
9
 import ConsumeListViewDoc from '@components/Payment/ConsumeListView/README.md';
10
 import ConsumeListViewDoc from '@components/Payment/ConsumeListView/README.md';
13
 import PriceOptionsDoc from '@components/Payment/PriceOptions/README.md';
14
 import PriceOptionsDoc from '@components/Payment/PriceOptions/README.md';
14
 import WaitPayInfoView from '@/components/Payment/WaitPayInfoView';
15
 import WaitPayInfoView from '@/components/Payment/WaitPayInfoView';
15
 import WaitPayInfoViewDoc from '@components/Payment/WaitPayInfoView/README.md';
16
 import WaitPayInfoViewDoc from '@components/Payment/WaitPayInfoView/README.md';
17
+import { formatMoney } from '@components/Payment/Utils/utils';
16
 
18
 
17
 import { consumeList} from './data/consumeList.json';
19
 import { consumeList} from './data/consumeList.json';
18
 
20
 
109
     const [price, setPrice] = React.useState(0);
111
     const [price, setPrice] = React.useState(0);
110
     const refInput = React.useRef(null);
112
     const refInput = React.useRef(null);
111
     return (
113
     return (
114
+      <>
112
       <PriceOptions
115
       <PriceOptions
113
         price={price}
116
         price={price}
114
         onPriceChange={(v) => setPrice(v)}
117
         onPriceChange={(v) => setPrice(v)}
115
         size={select("size", { Small: "small", Normal: "normal", Large: "large"}, "normal")}
118
         size={select("size", { Small: "small", Normal: "normal", Large: "large"}, "normal")}
116
         withTitle={boolean("withTitle", false)}
119
         withTitle={boolean("withTitle", false)}
117
         titleText={text("titleText", "")}
120
         titleText={text("titleText", "")}
118
-        inputPlaceholderText={text("inputPlaceholderText", "")}
121
+        inputPlaceholderText={text("inputPlaceholderText", "其他金额")}
119
         focusScroll={boolean("focusScroll", false)}
122
         focusScroll={boolean("focusScroll", false)}
123
+        priceOptions={array("priceOptions", ["100", "600", "800"])}
124
+        priceRender={(i: number) => `${formatMoney(i/100, 0)}¥`}
120
         inputRef={refInput}
125
         inputRef={refInput}
121
       />
126
       />
127
+      <Divider />
128
+      <div>
129
+        price: {price}
130
+      </div>
131
+      </>
122
     )
132
     )
123
   },
133
   },
124
   {
134
   {