Roxas 4 vuotta sitten
vanhempi
commit
9b51cf1cb9

+ 2
- 0
.storybook/config.js Näytä tiedosto

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

+ 1
- 1
.storybook/webpack.config.js Näytä tiedosto

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

+ 1
- 1
eslib/ConsumeListView/index.js Näytä tiedosto

@@ -2,7 +2,7 @@ import { a as _inherits, b as _createClass, _ as _defineProperty, d as _classCal
2 2
 import React, { Component } from 'react';
3 3
 import { c as classnames } from '../index-7951fb2f.js';
4 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 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
Näytä tiedosto


+ 1
- 2
eslib/Payment/index.js Näytä tiedosto

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

+ 1
- 1
eslib/Payment/index.js.map Näytä tiedosto

@@ -1 +1 @@
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 Näytä tiedosto

@@ -2,9 +2,7 @@ import { i as _slicedToArray, _ as _defineProperty } from '../_commonjsHelpers-a
2 2
 import React, { useState } from 'react';
3 3
 import { c as classnames } from '../index-7951fb2f.js';
4 4
 import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
5
-import { f as formatMoney } from '../utils-82346768.js';
6 5
 import { Input } from 'antd';
7
-import 'antd/lib/button/style';
8 6
 
9 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 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,8 +18,20 @@ var PriceOptions = function PriceOptions(_ref) {
20 18
       withTitle = _ref$withTitle === void 0 ? true : _ref$withTitle,
21 19
       _ref$titleText = _ref.titleText,
22 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 33
       inputRef = _ref.inputRef;
24
-  var defaultOptions = [100, 600, 800]; // 控制是否为其他金额输入情况
34
+  var defaultOptions = priceOptions; // 控制是否为其他金额输入情况
25 35
 
26 36
   var _useState = useState(false),
27 37
       _useState2 = _slicedToArray(_useState, 2),
@@ -30,7 +40,7 @@ var PriceOptions = function PriceOptions(_ref) {
30 40
 
31 41
   return React.createElement("div", {
32 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 44
     className: styles.infoItem
35 45
   }, React.createElement("span", {
36 46
     className: styles.priceBtn
@@ -44,7 +54,7 @@ var PriceOptions = function PriceOptions(_ref) {
44 54
         onPriceChange(item);
45 55
         setInputStatus(false);
46 56
       }
47
-    }, formatMoney(item / 100, 0), "\xA5");
57
+    }, priceRender(item));
48 58
   })), React.createElement(Input, {
49 59
     ref: inputRef,
50 60
     onMouseEnter: function onMouseEnter() {
@@ -55,8 +65,8 @@ var PriceOptions = function PriceOptions(_ref) {
55 65
     },
56 66
     suffix: "\xA5",
57 67
     className: styles.priceInput,
58
-    value: inputStatus ? price / 100 || "" : "",
59
-    placeholder: "Others",
68
+    value: inputStatus ? inputPriceRender(price) : "",
69
+    placeholder: inputPlaceholderText,
60 70
     onChange: function onChange(e) {
61 71
       var n = +e.target.value;
62 72
 
@@ -72,9 +82,21 @@ var PriceOptions = function PriceOptions(_ref) {
72 82
       setInputStatus(true);
73 83
     },
74 84
     onFocus: function onFocus(e) {
85
+      e.target.placeholder = "";
86
+      setInputStatus(true);
87
+
75 88
       if (focusScroll) {
76 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
Näytä tiedosto


+ 1
- 2
eslib/index.js Näytä tiedosto

@@ -3,11 +3,10 @@ import 'react';
3 3
 import './index-7951fb2f.js';
4 4
 import './style-inject.es-1f59c1d0.js';
5 5
 import './test-81795c27.js';
6
-import './utils-82346768.js';
6
+import './utils-f64eef69.js';
7 7
 export { default as ConsumeListView } from './ConsumeListView/index.js';
8 8
 export { default as PayPlatformOptions } from './PayPlatformOptions/index.js';
9 9
 import 'antd';
10
-import 'antd/lib/button/style';
11 10
 export { default as PriceOptions } from './PriceOptions/index.js';
12 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
Näytä tiedosto


eslib/utils-82346768.js → eslib/utils-f64eef69.js Näytä tiedosto

@@ -28,18 +28,9 @@ function addImageProcess(url) {
28 28
 
29 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 31
 function exportStyleSizeClass(styles, size) {
41 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 Näytä tiedosto

@@ -1 +1 @@
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 Näytä tiedosto

@@ -9,7 +9,7 @@ var React = require('react');
9 9
 var React__default = _interopDefault(React);
10 10
 var index = require('../index-c2424ad4.js');
11 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 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
Näytä tiedosto


+ 1
- 2
lib/Payment/index.js Näytä tiedosto

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

+ 1
- 1
lib/Payment/index.js.map Näytä tiedosto

@@ -1 +1 @@
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 Näytä tiedosto

@@ -9,9 +9,7 @@ var React = require('react');
9 9
 var React__default = _interopDefault(React);
10 10
 var index = require('../index-c2424ad4.js');
11 11
 var styleInject_es = require('../style-inject.es-dcee06b6.js');
12
-var utils = require('../utils-ed518bfc.js');
13 12
 var antd = require('antd');
14
-require('antd/lib/button/style');
15 13
 
16 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 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,8 +25,20 @@ var PriceOptions = function PriceOptions(_ref) {
27 25
       withTitle = _ref$withTitle === void 0 ? true : _ref$withTitle,
28 26
       _ref$titleText = _ref.titleText,
29 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 40
       inputRef = _ref.inputRef;
31
-  var defaultOptions = [100, 600, 800]; // 控制是否为其他金额输入情况
41
+  var defaultOptions = priceOptions; // 控制是否为其他金额输入情况
32 42
 
33 43
   var _useState = React.useState(false),
34 44
       _useState2 = _commonjsHelpers._slicedToArray(_useState, 2),
@@ -37,7 +47,7 @@ var PriceOptions = function PriceOptions(_ref) {
37 47
 
38 48
   return React__default.createElement("div", {
39 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 51
     className: styles.infoItem
42 52
   }, React__default.createElement("span", {
43 53
     className: styles.priceBtn
@@ -51,7 +61,7 @@ var PriceOptions = function PriceOptions(_ref) {
51 61
         onPriceChange(item);
52 62
         setInputStatus(false);
53 63
       }
54
-    }, utils.formatMoney(item / 100, 0), "\xA5");
64
+    }, priceRender(item));
55 65
   })), React__default.createElement(antd.Input, {
56 66
     ref: inputRef,
57 67
     onMouseEnter: function onMouseEnter() {
@@ -62,8 +72,8 @@ var PriceOptions = function PriceOptions(_ref) {
62 72
     },
63 73
     suffix: "\xA5",
64 74
     className: styles.priceInput,
65
-    value: inputStatus ? price / 100 || "" : "",
66
-    placeholder: "Others",
75
+    value: inputStatus ? inputPriceRender(price) : "",
76
+    placeholder: inputPlaceholderText,
67 77
     onChange: function onChange(e) {
68 78
       var n = +e.target.value;
69 79
 
@@ -79,9 +89,21 @@ var PriceOptions = function PriceOptions(_ref) {
79 89
       setInputStatus(true);
80 90
     },
81 91
     onFocus: function onFocus(e) {
92
+      e.target.placeholder = "";
93
+      setInputStatus(true);
94
+
82 95
       if (focusScroll) {
83 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
Näytä tiedosto


+ 1
- 2
lib/index.js Näytä tiedosto

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

+ 1
- 1
lib/index.js.map
File diff suppressed because it is too large
Näytä tiedosto


lib/utils-ed518bfc.js → lib/utils-4bc17ae2.js Näytä tiedosto

@@ -30,20 +30,10 @@ function addImageProcess(url) {
30 30
 
31 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 33
 function exportStyleSizeClass(styles, size) {
43 34
   return _commonjsHelpers._defineProperty({}, styles[size], true);
44 35
 }
45 36
 
46 37
 exports.addImageProcess = addImageProcess;
47 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 Näytä tiedosto

@@ -1 +1 @@
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 Näytä tiedosto

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

+ 1
- 1
stats.html
File diff suppressed because it is too large
Näytä tiedosto


+ 12
- 2
stories/Payment.stories.tsx Näytä tiedosto

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