Ingen beskrivning

index.js.map 3.8KB

1
  1. {"version":3,"file":"index.js","sources":["../../src/components/Payment/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\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 titleText: string;\r\n inputRef: React.RefObject<any>;\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 titleText = \"Price\",\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 <div\r\n className={classnames(styles.options)}\r\n >\r\n {withTitle ? (\r\n <p>\r\n {titleText}\r\n </p>\r\n ) : null}\r\n <div className={styles.infoItem}>\r\n <span className={styles.priceBtn}>\r\n {defaultOptions.map(item => (\r\n <span\r\n className={classnames({\r\n [styles.priceItem]: true,\r\n [styles.active]: price === item && !inputStatus\r\n })}\r\n key={item}\r\n onClick={() => {\r\n onPriceChange(item);\r\n setInputStatus(false);\r\n }}\r\n >\r\n {formatMoney(item/100, 0)}¥\r\n </span>\r\n ))}\r\n </span>\r\n {/* <Input\r\n ref={inputRef}\r\n onMouseEnter={() => {\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 </div>\r\n </div>\r\n );\r\n};\r\n\r\nexport default PriceOptions;\r\n"],"names":["PriceOptions","price","onPriceChange","size","focusScroll","withTitle","titleText","inputRef","defaultOptions","useState","inputStatus","setInputStatus","classnames","styles","options","infoItem","priceBtn","map","item","priceItem","active","formatMoney"],"mappings":";;;;;;;;;;AAgBA,IAAMA,YAAY,GAAG,SAAfA,YAAe,OAQR;MAPXC,KAOW,QAPXA,KAOW;MANXC,aAMW,QANXA,aAMW;uBALXC,IAKW;MALXA,wBACAC,WAIW;MAJXA,sBACAC,SAGW;MAHXA,SAGW,+BAHC,IAGD;4BAFXC,SAEW;MAFXA,SAEW,+BAFC,OAED;MADXC,QACW,QADXA,QACW;MACLC,cAAc,GAAG,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,CAAvB,CADW;;kBAG2BC,QAAQ,CAAC,KAAD,CAHnC;;MAGJC,WAHI;MAGSC,cAHT;;SAMT;IACE,SAAS,EAAEC,UAAU,CAACC,MAAM,CAACC,OAAR;KAEpBT,SAAS,GACR,+BACGC,SADH,CADQ,GAIN,IAPN,EAQE;IAAK,SAAS,EAAEO,MAAM,CAACE;KACrB;IAAM,SAAS,EAAEF,MAAM,CAACG;KACrBR,cAAc,CAACS,GAAf,CAAmB,UAAAC,IAAI;;;WACtB;MACE,SAAS,EAAEN,UAAU,iDAClBC,MAAM,CAACM,SADW,EACC,IADD,gCAElBN,MAAM,CAACO,MAFW,EAEFnB,KAAK,KAAKiB,IAAV,IAAkB,CAACR,WAFjB,gBADvB;MAKE,GAAG,EAAEQ,IALP;MAME,OAAO,EAAE,mBAAM;QACbhB,aAAa,CAACgB,IAAD,CAAb;QACAP,cAAc,CAAC,KAAD,CAAd;;OAGDU,WAAW,CAACH,IAAI,GAAC,GAAN,EAAW,CAAX,CAXd,SADsB;GAAvB,CADH,CADF,CARF,CADF;CAbF;;;;"}