{"version":3,"file":"index.js","sources":["../../src/components/Payment/Common/PriceOptions/index.tsx"],"sourcesContent":["import React, { useState } from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { formatMoney } from \"../../Utils/utils\";\r\n\r\nimport styles from \"./PriceOptions.less\";\r\n\r\nconst FormattedMessage = ({ id }: any) => id;\r\n\r\ninterface Props {\r\n price: number;\r\n onPriceChange: (v: number) => void;\r\n size: \"small\" | \"normal\" | \"large\";\r\n focusScroll: boolean;\r\n withTitle: boolean;\r\n inputRef: React.RefObject;\r\n}\r\n\r\nconst PriceOptions = ({\r\n price,\r\n onPriceChange,\r\n size = \"normal\",\r\n focusScroll = true,\r\n withTitle = true,\r\n inputRef\r\n}: Props) => {\r\n const defaultOptions = [100, 600, 800];\r\n // 控制是否为其他金额输入情况\r\n const [inputStatus, setInputStatus] = useState(false);\r\n\r\n return (\r\n \r\n {withTitle ? (\r\n

\r\n \r\n

\r\n ) : null}\r\n
\r\n \r\n {defaultOptions.map(item => (\r\n {\r\n onPriceChange(item);\r\n setInputStatus(false);\r\n }}\r\n >\r\n \r\n \r\n ))}\r\n \r\n {/* {\r\n if (inputStatus && inputRef && inputRef.current) {\r\n inputRef.current.focus();\r\n inputRef.current.select();\r\n }\r\n }}\r\n suffix=\"¥\"\r\n className={styles.priceInput}\r\n value={inputStatus ? price / 100 || \"\" : \"\"}\r\n placeholder=\"Others\"\r\n onChange={e => {\r\n const n = +e.target.value;\r\n if (Number.isNaN(n)) {\r\n return;\r\n }\r\n // 测试暂时改成1分\r\n onPriceChange(n * 100);\r\n }}\r\n onClick={e => {\r\n onPriceChange(0);\r\n setInputStatus(true);\r\n }}\r\n onFocus={e => {\r\n if (focusScroll) {\r\n e.target.scrollIntoView();\r\n }\r\n }}\r\n /> */}\r\n
\r\n \r\n );\r\n};\r\n\r\nexport default PriceOptions;\r\n"],"names":["FormattedMessage","id","PriceOptions","price","onPriceChange","size","focusScroll","withTitle","inputRef","defaultOptions","useState","inputStatus","setInputStatus","React","classnames","styles","options","infoItem","marginBottom","priceBtn","map","item","priceItem","active","formatMoney"],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB;MAAGC,EAAH,QAAGA,EAAH;SAAiBA,EAAjB;CAAzB;;AAWA,IAAMC,YAAY,GAAG,SAAfA,YAAe,QAOR;MANXC,KAMW,SANXA,KAMW;MALXC,aAKW,SALXA,aAKW;yBAJXC,IAIW;MAJXA,0BACAC,WAGW;MAHXA,wBACAC,SAEW;MAFXA,SAEW,gCAFC,IAED;MADXC,QACW,SADXA,QACW;MACLC,cAAc,GAAG,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,CAAvB,CADW;;kBAG2BC,cAAQ,CAAC,KAAD,CAHnC;;MAGJC,WAHI;MAGSC,cAHT;;SAMTC;IACE,SAAS,EAAEC,gBAAU,CAACC,MAAM,CAACC,OAAR;KAEpBT,SAAS,GACRM,wCACEA,6BAAC,gBAAD;IAAkB,EAAE,EAAC;IADvB,CADQ,GAIN,IAPN,EAQEA;IAAK,SAAS,EAAEE,MAAM,CAACE,QAAvB;IAAiC,KAAK,EAAE;MAAEC,YAAY,EAAE;;KACtDL;IAAM,SAAS,EAAEE,MAAM,CAACI;KACrBV,cAAc,CAACW,GAAf,CAAmB,UAAAC,IAAI;;;WACtBR;MACE,SAAS,EAAEC,gBAAU,kEAClBC,MAAM,CAACO,SADW,EACC,IADD,iDAElBP,MAAM,CAACQ,MAFW,EAEFpB,KAAK,KAAKkB,IAAV,IAAkB,CAACV,WAFjB,gBADvB;MAKE,GAAG,EAAEU,IALP;MAME,OAAO,EAAE,mBAAM;QACbjB,aAAa,CAACiB,IAAD,CAAb;QACAT,cAAc,CAAC,KAAD,CAAd;;OAGFC,6BAAC,gBAAD;MAAkB,EAAE,YAAKW,iBAAW,CAACH,IAAI,GAAC,GAAN,EAAW,CAAX,CAAhB;MAXtB,CADsB;GAAvB,CADH,CADF,CARF,CADF;CAZF;;;;"}