Sin descripción

index.js 6.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  4. var _commonjsHelpers = require('../_commonjsHelpers-4ed3570f.js');
  5. var React = require('react');
  6. var React__default = _interopDefault(React);
  7. var index = require('../index-c2424ad4.js');
  8. var styleInject_es = require('../style-inject.es-dcee06b6.js');
  9. var utils = require('../utils-ed518bfc.js');
  10. var css = ".PriceOptions_options__2AGBn {\n padding: 20px 50px;\n border-bottom: 1px dashed #00000017;\n}\n.PriceOptions_options__2AGBn p {\n font-size: 14px;\n font-weight: 400;\n color: #616a79;\n margin-bottom: 20px;\n}\n.PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN {\n padding-right: 0;\n}\n.PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_priceItem__2PLhM {\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__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_priceItem__2PLhM.PriceOptions_active__rlHby {\n background: rgba(255, 50, 102, 0.1);\n border-radius: 4px;\n border: 1px solid #ff3266;\n color: #616a79;\n}\n.PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_priceInput__1UYLy {\n display: inline-block;\n min-width: 70px;\n width: auto;\n margin: 6px;\n text-align: center;\n}\n.PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN 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__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_rate__3hVeo {\n margin-left: 10px;\n}\n.PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_rate__3hVeo i {\n margin-right: 5px;\n color: #1790FF;\n}\n.PriceOptions_options__2AGBn.PriceOptions_small__2Vys4 {\n padding: 0 0 12px 0;\n border-bottom: none;\n}\n.PriceOptions_options__2AGBn.PriceOptions_small__2Vys4 p {\n margin-bottom: 8px;\n}\n.PriceOptions_options__2AGBn.PriceOptions_small__2Vys4 .PriceOptions_infoItem__1dYFN {\n text-align: center;\n}\n.PriceOptions_options__2AGBn.PriceOptions_small__2Vys4 .PriceOptions_infoItem__1dYFN .PriceOptions_priceItem__2PLhM {\n border-radius: 6px;\n height: 32px;\n width: 72px;\n margin: 0 0 12px 19px;\n}\n.PriceOptions_options__2AGBn.PriceOptions_small__2Vys4 .PriceOptions_infoItem__1dYFN .PriceOptions_priceItem__2PLhM:first-child {\n margin: 0 0 12px 0px;\n}\n.PriceOptions_options__2AGBn.PriceOptions_small__2Vys4 .PriceOptions_infoItem__1dYFN .PriceOptions_priceInput__1UYLy {\n display: block;\n width: 254px;\n border-radius: 6px;\n height: 32px;\n}\n@media (max-width: 768px) {\n .PriceOptions_options__2AGBn {\n padding: 20px 20px;\n }\n .PriceOptions_options__2AGBn p {\n font-size: 14px;\n font-weight: 400;\n color: #616a79;\n }\n .PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN {\n padding-right: 0;\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n .PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_priceBtn__YfsBe {\n display: flex;\n justify-content: space-between;\n }\n .PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_priceItem__2PLhM {\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__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_priceItem__2PLhM.PriceOptions_active__rlHby {\n background-color: #fff;\n color: #FF3266FF;\n border-radius: 4px;\n border: 1px solid #ff3266;\n }\n .PriceOptions_options__2AGBn .PriceOptions_infoItem__1dYFN .PriceOptions_priceInput__1UYLy {\n border-radius: 6px;\n height: 36px;\n width: auto;\n }\n}\n";
  11. var styles = {"options":"PriceOptions_options__2AGBn","infoItem":"PriceOptions_infoItem__1dYFN","priceItem":"PriceOptions_priceItem__2PLhM","active":"PriceOptions_active__rlHby","priceInput":"PriceOptions_priceInput__1UYLy","rate":"PriceOptions_rate__3hVeo","small":"PriceOptions_small__2Vys4","priceBtn":"PriceOptions_priceBtn__YfsBe"};
  12. styleInject_es.styleInject(css);
  13. var FormattedMessage = function FormattedMessage(_ref) {
  14. var id = _ref.id;
  15. return id;
  16. };
  17. var PriceOptions = function PriceOptions(_ref2) {
  18. var price = _ref2.price,
  19. onPriceChange = _ref2.onPriceChange,
  20. _ref2$size = _ref2.size,
  21. _ref2$focusScroll = _ref2.focusScroll,
  22. _ref2$withTitle = _ref2.withTitle,
  23. withTitle = _ref2$withTitle === void 0 ? true : _ref2$withTitle,
  24. inputRef = _ref2.inputRef;
  25. var defaultOptions = [100, 600, 800]; // 控制是否为其他金额输入情况
  26. var _useState = React.useState(false),
  27. _useState2 = _commonjsHelpers._slicedToArray(_useState, 2),
  28. inputStatus = _useState2[0],
  29. setInputStatus = _useState2[1];
  30. return React__default.createElement("div", {
  31. className: index.classnames(styles.options)
  32. }, withTitle ? React__default.createElement("p", null, React__default.createElement(FormattedMessage, {
  33. id: "pay.price.select.text"
  34. })) : null, React__default.createElement("div", {
  35. className: styles.infoItem,
  36. style: {
  37. marginBottom: "-12px"
  38. }
  39. }, React__default.createElement("span", {
  40. className: styles.priceBtn
  41. }, defaultOptions.map(function (item) {
  42. var _classnames;
  43. return React__default.createElement("span", {
  44. className: index.classnames((_classnames = {}, _commonjsHelpers._defineProperty(_classnames, styles.priceItem, true), _commonjsHelpers._defineProperty(_classnames, styles.active, price === item && !inputStatus), _classnames)),
  45. key: item,
  46. onClick: function onClick() {
  47. onPriceChange(item);
  48. setInputStatus(false);
  49. }
  50. }, React__default.createElement(FormattedMessage, {
  51. id: "".concat(utils.formatMoney(item / 100, 0), "\xA5")
  52. }));
  53. }))));
  54. };
  55. exports.default = PriceOptions;
  56. //# sourceMappingURL=index.js.map