giftActivityLinkDTO.tsx 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import { Checkbox, DatePicker, Form, Input, InputNumber, Select } from "antd";
  2. import React from "react";
  3. import { DISPLAYTYPE, RESOURCETTYPE } from "./const";
  4. /**
  5. * 模板直赠活动
  6. * @returns
  7. */
  8. const GiftActivityLinkDTO: React.FC<BOOKLINK.BookLinkChildProps> = ({ restField, name }) => {
  9. return <>
  10. <Form.Item
  11. {...restField}
  12. name={[name, 'giftActivityLinkDTO', 'activityName']}
  13. label={<strong>活动名称</strong>}
  14. rules={[{ required: true, message: '请输入活动名称!' }]}
  15. >
  16. <Input placeholder="请输入活动名称" style={{ width: '100%' }} allowClear />
  17. </Form.Item>
  18. <Form.Item
  19. {...restField}
  20. name={[name, 'giftActivityLinkDTO', 'resourceType']}
  21. label={<strong>赠送道具</strong>}
  22. rules={[{ required: true, message: '请选择赠送道具!' }]}
  23. >
  24. <Select
  25. showSearch
  26. placeholder="请选择赠送道具"
  27. filterOption={(input, option) =>
  28. ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
  29. }
  30. allowClear
  31. options={Object.keys(RESOURCETTYPE).map(key => ({ label: RESOURCETTYPE[key], value: key }))}
  32. />
  33. </Form.Item>
  34. <Form.Item
  35. {...restField}
  36. name={[name, 'giftActivityLinkDTO', 'freeAmount']}
  37. label={<strong>赠送书券量</strong>}
  38. rules={[{ required: true, message: '请输入赠送书券量!' }]}
  39. >
  40. <InputNumber placeholder="请输入" min={1} style={{ width: '100%' }} />
  41. </Form.Item>
  42. <Form.Item
  43. {...restField}
  44. name={[name, 'giftActivityLinkDTO', 'expire']}
  45. label={<strong>书券有效期</strong>}
  46. rules={[{ required: true, message: '请输入书券有效期1-7天!' }]}
  47. >
  48. <InputNumber placeholder="请输入书券有效期1-7天" suffix="天" precision={0} max={7} min={1} style={{ width: '100%' }} />
  49. </Form.Item>
  50. <Form.Item
  51. {...restField}
  52. name={[name, 'giftActivityLinkDTO', 'totalGift']}
  53. label={<strong>赠送名额</strong>}
  54. rules={[{ required: true, message: '请输入赠送名额!' }]}
  55. >
  56. <InputNumber placeholder="请输入" min={0} style={{ width: '100%' }} />
  57. </Form.Item>
  58. <Form.Item
  59. {...restField}
  60. name={[name, 'giftActivityLinkDTO', 'activityTime']}
  61. label={<strong>活动时间</strong>}
  62. rules={[{ required: true, message: '请选择活动时间!' }]}
  63. >
  64. <DatePicker.RangePicker />
  65. </Form.Item>
  66. <Form.Item
  67. {...restField}
  68. name={[name, 'giftActivityLinkDTO', 'display']}
  69. label={<strong>活动展示位</strong>}
  70. >
  71. <Checkbox.Group options={Object.keys(DISPLAYTYPE).filter(key => key === '1').map(key => ({ label: DISPLAYTYPE[key], value: key }))} />
  72. </Form.Item>
  73. </>
  74. }
  75. export default React.memo(GiftActivityLinkDTO);