index.tsx 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. import { UpCircleOutlined, DownCircleOutlined } from '@ant-design/icons'
  2. import { Radio, Col, DatePicker, Input, Row, Space, Checkbox, Divider } from 'antd'
  3. import { CheckboxValueType } from 'antd/lib/checkbox/Group'
  4. import { RadioChangeEvent } from 'antd/lib/radio'
  5. import moment from 'moment'
  6. import React, { useEffect, useReducer, useState } from 'react'
  7. import style from './index.less'
  8. /**粉丝选项 */
  9. type State = {
  10. fansFilterOsType?: any[],//操作系统
  11. fansFilterMember?: '' | boolean,//是否是会员
  12. fansFilterSubscribeTimeType?: '' | 1 | 2 | 3,//关注时间
  13. fansFilterSubscribeTimeBegin?: string | '',//关注起始时间
  14. fansFilterSubscribeTimeEnd?: string | '',//关注截至时间
  15. rechargeType?: '' | number,//充值情况选项
  16. fansFilterRechargeCountMin?: string | '',//充值次数(最少)
  17. fansFilterRechargeCountMax?: string | '',//充值次数(最多)
  18. dayType?: '' | number,//天数选项
  19. fansFilterRechargeTimeMin?: string | '',//上次充值时间(最少 n天内)
  20. fansFilterRechargeTimeMax?: string | '',//上次充值时间(最大 n天内)
  21. fansFilterRechargeMin?: string | '',//最低充值金额
  22. fansFilterRechargeMax?: string | '',//最大充值金额
  23. countType?: '' | number,//书币选项
  24. fansFilterCoinCountMin?: string | '',//最低书币余额
  25. fansFilterCoinCountMax?: string | '',//最高书币余额
  26. timeType?: '' | number,//时间选项
  27. fansFilterActiveTimeMin?: string | '',//上次活跃距今时间(最低)
  28. fansFilterActiveTimeMax?: string | '',//上次活跃距今时间(最高)
  29. fansFilterSex?: any[],//粉丝性别
  30. }
  31. type Action = {
  32. type: 'setData' | 'initData',
  33. params: State
  34. }
  35. function reducer(state: State, action: Action) {
  36. let { type, params } = action
  37. let newState = JSON.parse(JSON.stringify(state))
  38. switch (type) {
  39. case 'setData':
  40. Object.keys(params as State).forEach((key: string) => {
  41. newState[key] = (params as State)[key]
  42. })
  43. return newState
  44. case 'initData':
  45. let data: any = initialState
  46. if (params) {
  47. data = { ...data, ...params }
  48. }
  49. return data
  50. default:
  51. return state
  52. }
  53. }
  54. const initialState = {
  55. fansFilterOsType: [],//操作系统
  56. fansFilterMember: '',//是否是会员
  57. fansFilterSex: [],//粉丝性别
  58. fansFilterSubscribeTimeType: '',//关注时间
  59. fansFilterSubscribeTimeBegin: '',//关注起始时间
  60. fansFilterSubscribeTimeEnd: '',//关注截至时间
  61. fansFilterRechargeCountMin: '',//充值次数(最少)
  62. fansFilterRechargeCountMax: '',//充值次数(最多)
  63. fansFilterRechargeTimeMin: '',//上次充值时间(最少 n天内)
  64. fansFilterRechargeTimeMax: '',//上次充值时间(最大 n天内)
  65. fansFilterRechargeMin: '',//最低充值金额
  66. fansFilterRechargeMax: '',//最大充值金额
  67. fansFilterCoinCountMin: '',//最低书币余额
  68. fansFilterCoinCountMax: '',//最高书币余额
  69. fansFilterActiveTimeMin: '',//上次活跃距今时间(最低)
  70. fansFilterActiveTimeMax: '',//上次活跃距今时间(最高)
  71. rechargeType: '',//充值情况选项
  72. dayType: '',//天数选项
  73. countType: '',//书币选项
  74. timeType: ''//时间选项
  75. }
  76. type Props = {
  77. callback: (value: State) => void;//回调函数获取数据
  78. defaultValue?: any;//回填数据
  79. openConfig?: {
  80. /**活跃时间*/
  81. activeTime: boolean
  82. }
  83. }
  84. function FansSelect(props: Props) {
  85. const [open, setOpen] = useState<any>({ a: 1, b: 1, c: 1, d: 1 })
  86. const [state, dispatch] = useReducer(reducer, initialState)
  87. const { callback, defaultValue = initialState,openConfig} = props
  88. let [activeTime,setActiveTime] =useState(openConfig?.activeTime !== undefined ? openConfig?.activeTime : true)
  89. const {
  90. fansFilterMember, fansFilterSubscribeTimeType, fansFilterSubscribeTimeBegin,
  91. fansFilterSubscribeTimeEnd, fansFilterRechargeCountMin, fansFilterRechargeCountMax,
  92. fansFilterRechargeTimeMin, fansFilterRechargeTimeMax, fansFilterRechargeMin, fansFilterRechargeMax,
  93. fansFilterCoinCountMin, fansFilterCoinCountMax, fansFilterActiveTimeMin, fansFilterActiveTimeMax,
  94. rechargeType, dayType, countType, timeType, fansFilterSex, fansFilterOsType
  95. } = state
  96. //数据回填
  97. useEffect(() => {
  98. if (defaultValue && JSON.stringify(defaultValue) !== '{}') {
  99. let {
  100. fansFilterMember, fansFilterSubscribeTimeType, fansFilterSubscribeTimeBegin,
  101. fansFilterSubscribeTimeEnd, fansFilterRechargeCountMin, fansFilterRechargeCountMax,
  102. fansFilterRechargeTimeMin, fansFilterRechargeTimeMax, fansFilterRechargeMin, fansFilterRechargeMax,
  103. fansFilterCoinCountMin, fansFilterCoinCountMax, fansFilterActiveTimeMin, fansFilterActiveTimeMax, fansFilterSex, fansFilterOsType
  104. } = defaultValue
  105. dispatch({
  106. type: 'initData', params: {
  107. fansFilterMember, fansFilterSubscribeTimeType, fansFilterSubscribeTimeBegin,
  108. fansFilterSubscribeTimeEnd, fansFilterRechargeCountMin, fansFilterRechargeCountMax,
  109. fansFilterRechargeTimeMin, fansFilterRechargeTimeMax, fansFilterRechargeMin, fansFilterRechargeMax,
  110. fansFilterCoinCountMin, fansFilterCoinCountMax, fansFilterActiveTimeMin, fansFilterActiveTimeMax, fansFilterSex, fansFilterOsType,
  111. rechargeType: fansFilterRechargeCountMin === null && fansFilterRechargeCountMax === null ? '' :
  112. fansFilterRechargeCountMin == 0 && fansFilterRechargeCountMax == 0 ? 0 :
  113. fansFilterRechargeCountMin == 1 && fansFilterRechargeCountMax == null ? -1 :
  114. fansFilterRechargeCountMin == 1 && fansFilterRechargeCountMax == 1 ? 1 :
  115. fansFilterRechargeCountMin == 2 && fansFilterRechargeCountMax == 2 ? 2 :
  116. fansFilterRechargeCountMin == 3 && fansFilterRechargeCountMax == 3 ? 3 :
  117. fansFilterRechargeCountMin == 4 && fansFilterRechargeCountMax == 4 ? 4 :
  118. fansFilterRechargeCountMin == 5 && fansFilterRechargeCountMax == 5 ? 5 :
  119. fansFilterRechargeCountMin == 6 && fansFilterRechargeCountMax == 6 ? 6 :
  120. fansFilterRechargeCountMin == 7 && fansFilterRechargeCountMax == 7 ? 7 :
  121. fansFilterRechargeCountMin == 8 && fansFilterRechargeCountMax == 8 ? 8 :
  122. fansFilterRechargeCountMin == 10 && fansFilterRechargeCountMax == 10 ? 10 :
  123. fansFilterRechargeCountMin > 10 && fansFilterRechargeCountMax > 10 ? 11 : -2,
  124. dayType: fansFilterRechargeTimeMin === null && fansFilterRechargeTimeMax === null ? '' :
  125. fansFilterRechargeTimeMin == 0 && fansFilterRechargeTimeMax == 15 ? 15 :
  126. fansFilterRechargeTimeMin == 0 && fansFilterRechargeTimeMax == 30 ? 30 :
  127. fansFilterRechargeTimeMin == 30 && fansFilterRechargeTimeMax == 0 ? 31 :
  128. fansFilterRechargeTimeMin == 0 && fansFilterRechargeTimeMax == 45 ? 45 :
  129. fansFilterRechargeTimeMin == 0 && fansFilterRechargeTimeMax == 60 ? 60 : 61,
  130. timeType: fansFilterActiveTimeMin == null && fansFilterActiveTimeMax == null ? '' :
  131. fansFilterActiveTimeMin == 0 && fansFilterActiveTimeMax == 1 ? 1 :
  132. fansFilterActiveTimeMin == 1 && fansFilterActiveTimeMax == 3 ? 2 :
  133. fansFilterActiveTimeMin == 3 && fansFilterActiveTimeMax == 12 ? 3 :
  134. fansFilterActiveTimeMin == 12 && fansFilterActiveTimeMax == 24 ? 4 : 5
  135. }
  136. })
  137. }
  138. }, [defaultValue])
  139. useEffect(() => {
  140. let { rechargeType, dayType, countType, timeType, ...obj } = state
  141. callback(obj)
  142. }, [state])
  143. console.log('rechargeType--->', rechargeType);
  144. return <Row gutter={[10, 20]}>
  145. {/* <Col span={24}>
  146. <Space>
  147. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}>性别:</label>
  148. <Checkbox.Group
  149. onChange={(checkedValue: CheckboxValueType[]) => {
  150. dispatch({ type: 'setData', params: { fansFilterSex: checkedValue } })
  151. }}
  152. value={fansFilterSex}
  153. >
  154. <Checkbox value={''}>不限</Checkbox>
  155. <Checkbox value={1}>男</Checkbox>
  156. <Checkbox value={2}>女</Checkbox>
  157. <Checkbox value={0}>未知</Checkbox>
  158. </Checkbox.Group>
  159. </Space>
  160. </Col> */}
  161. <Col span={24}>
  162. <Space>
  163. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}>操作系统:</label>
  164. <Checkbox.Group
  165. onChange={(checkedValue: CheckboxValueType[]) => {
  166. dispatch({ type: 'setData', params: { fansFilterOsType: checkedValue } })
  167. }}
  168. value={fansFilterOsType}
  169. >
  170. <Checkbox value={0}>未知</Checkbox>
  171. <Checkbox value={1}>安卓</Checkbox>
  172. <Checkbox value={2}>IOS</Checkbox>
  173. </Checkbox.Group>
  174. </Space>
  175. </Col>
  176. <Divider style={{ margin: 0 }} />
  177. {/* <Col span={24}>
  178. <Space>
  179. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}>是否VIP:</label>
  180. <div>
  181. <Radio.Group onChange={(e: RadioChangeEvent) => { dispatch({ type: 'setData', params: { fansFilterMember: e.target.value } }) }} value={fansFilterMember}>
  182. <Radio value={''}>不限</Radio>
  183. <Radio value={true}>是</Radio>
  184. <Radio value={false}>否</Radio>
  185. </Radio.Group>
  186. </div>
  187. </Space>
  188. </Col>
  189. <Divider style={{padding:0}}/> */}
  190. <Col span={24}>
  191. <Space>
  192. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}>关注时间:</label>
  193. <div>
  194. <Radio.Group
  195. onChange={(e: RadioChangeEvent) => {
  196. dispatch({
  197. type: 'setData',
  198. params: {
  199. fansFilterSubscribeTimeType: e.target.value,
  200. fansFilterSubscribeTimeBegin: '',
  201. fansFilterSubscribeTimeEnd: '',
  202. }
  203. })
  204. }}
  205. value={fansFilterSubscribeTimeType === null ? '' : fansFilterSubscribeTimeType}
  206. >
  207. <Radio value={''}>不限</Radio>
  208. <Radio value={0}>具体时间</Radio>
  209. <Radio value={1}>常用日期</Radio>
  210. <Radio value={2}>动态日期</Radio>
  211. </Radio.Group>
  212. </div>
  213. </Space>
  214. {
  215. fansFilterSubscribeTimeType === 0 && <div style={{ paddingLeft: 100, marginTop: 8 }}>
  216. <DatePicker.RangePicker
  217. showTime={{ format: 'HH:mm:ss' }}
  218. format="YYYY-MM-DD HH:mm:ss"
  219. onChange={(values: any, formatString: [string, string]) => {
  220. dispatch({
  221. type: 'setData', params: {
  222. fansFilterSubscribeTimeBegin: formatString[0],
  223. fansFilterSubscribeTimeEnd: formatString[1],
  224. }
  225. })
  226. }}
  227. value={fansFilterSubscribeTimeBegin ? [moment(fansFilterSubscribeTimeBegin), moment(fansFilterSubscribeTimeEnd)] : undefined}
  228. />
  229. </div>
  230. }
  231. {
  232. fansFilterSubscribeTimeType === 1 && <div style={{ paddingLeft: 100, marginTop: 8 }}>
  233. <Input.Group compact>
  234. <Input
  235. style={{ width: 100, textAlign: 'center', borderRightWidth: 0 }}
  236. placeholder="起始(小时)"
  237. value={fansFilterSubscribeTimeBegin}
  238. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  239. let v = event.target.value
  240. dispatch({ type: 'setData', params: { fansFilterSubscribeTimeBegin: v } })
  241. }}
  242. />
  243. <Input
  244. style={{
  245. width: 30,
  246. borderLeft: 0,
  247. borderRight: 0,
  248. pointerEvents: 'none',
  249. backgroundColor: '#fff'
  250. }}
  251. placeholder="~"
  252. disabled
  253. />
  254. <Input
  255. className="site-input-right"
  256. style={{
  257. width: 100,
  258. textAlign: 'center',
  259. borderLeftWidth: 0
  260. }}
  261. value={fansFilterSubscribeTimeEnd}
  262. placeholder="结束(小时)"
  263. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  264. let v = event.target.value
  265. dispatch({ type: 'setData', params: { fansFilterSubscribeTimeEnd: v } })
  266. }}
  267. />
  268. </Input.Group>
  269. <Radio.Group
  270. onChange={(e: RadioChangeEvent) => {
  271. let arr = ['', ['0', '1'], ['0', '24'], ['0', '48'], ['48', '']]
  272. dispatch({
  273. type: 'setData',
  274. params: {
  275. fansFilterSubscribeTimeBegin: arr[e.target.value][0],
  276. fansFilterSubscribeTimeEnd: arr[e.target.value][1],
  277. }
  278. })
  279. }} value={
  280. fansFilterSubscribeTimeBegin === "48" && fansFilterSubscribeTimeEnd === '' ?
  281. 4 : fansFilterSubscribeTimeBegin === "0" && fansFilterSubscribeTimeEnd === '48' ?
  282. 3 : fansFilterSubscribeTimeBegin === "0" && fansFilterSubscribeTimeEnd === '24' ?
  283. 2 :
  284. fansFilterSubscribeTimeBegin === "0" && fansFilterSubscribeTimeEnd === '1' ?
  285. 1 : ''}>
  286. <Radio value={1}>1小时内</Radio>
  287. <Radio value={2}>24小时内</Radio>
  288. <Radio value={3}>48小时内</Radio>
  289. <Radio value={4}>48小时外</Radio>
  290. </Radio.Group>
  291. </div>
  292. }
  293. {
  294. fansFilterSubscribeTimeType === 2 && <div style={{ paddingLeft: 100, marginTop: 8 }}>
  295. <Input.Group compact>
  296. <Input
  297. style={{ width: 100, textAlign: 'center', borderRightWidth: 0 }}
  298. placeholder="第n天"
  299. value={fansFilterSubscribeTimeBegin}
  300. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  301. let v = event.target.value
  302. dispatch({ type: 'setData', params: { fansFilterSubscribeTimeBegin: v } })
  303. }}
  304. />
  305. <Input
  306. style={{
  307. width: 30,
  308. borderLeft: 0,
  309. borderRight: 0,
  310. pointerEvents: 'none',
  311. backgroundColor: '#fff'
  312. }}
  313. placeholder="~"
  314. disabled
  315. />
  316. <Input
  317. className="site-input-right"
  318. style={{
  319. width: 100,
  320. textAlign: 'center',
  321. borderLeftWidth: 0
  322. }}
  323. placeholder="第n天"
  324. value={fansFilterSubscribeTimeEnd}
  325. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  326. let v = event.target.value
  327. dispatch({ type: 'setData', params: { fansFilterSubscribeTimeEnd: v } })
  328. }}
  329. />
  330. </Input.Group>
  331. </div>
  332. }
  333. </Col>
  334. <Divider style={{ margin: 0 }} />
  335. <Col span={24}>
  336. <Space className={style.s_label}>
  337. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}> 充值情况:</label>
  338. <div>
  339. <div style={{ marginBottom: 5 }}>
  340. <Input.Group compact>
  341. <Input
  342. style={{ width: 100, textAlign: 'center', borderRightWidth: 0 }}
  343. placeholder="最小次数"
  344. value={fansFilterRechargeCountMin}
  345. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  346. let v = event.target.value
  347. dispatch({ type: 'setData', params: { fansFilterRechargeCountMin: v } })
  348. }}
  349. />
  350. <Input
  351. style={{
  352. width: 30,
  353. borderLeft: 0,
  354. borderRight: 0,
  355. pointerEvents: 'none',
  356. backgroundColor: '#fff'
  357. }}
  358. placeholder="~"
  359. disabled
  360. />
  361. <Input
  362. className="site-input-right"
  363. style={{
  364. width: 100,
  365. textAlign: 'center',
  366. borderLeftWidth: 0
  367. }}
  368. value={fansFilterRechargeCountMax}
  369. placeholder="最大次数"
  370. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  371. let v = event.target.value
  372. dispatch({ type: 'setData', params: { fansFilterRechargeCountMax: v } })
  373. }}
  374. />
  375. </Input.Group>
  376. </div>
  377. <Radio.Group
  378. style={{ width: '100%' }}
  379. onChange={(e: RadioChangeEvent) => {
  380. dispatch({
  381. type: 'setData', params: {
  382. rechargeType: e.target.value,
  383. fansFilterRechargeCountMin: e.target.value === '' ? '' : e.target.value === 11 ? 10 : e.target.value === -1 ? 1 : e.target.value,
  384. fansFilterRechargeCountMax: e.target.value === 11 ? '' : e.target.value === -1 ? '' : e.target.value
  385. }
  386. })
  387. }}
  388. value={rechargeType}
  389. >
  390. <Radio value={''}>不限</Radio>
  391. <Radio value={0}>未充值</Radio>
  392. <Radio value={-1}>已充值</Radio>
  393. {
  394. !!open.a && <>
  395. <Radio value={1}>充值1次</Radio>
  396. <Radio value={2}>充值2次</Radio>
  397. <Radio value={3}>充值3次</Radio>
  398. <Radio value={5}>充值5次</Radio>
  399. <Radio value={8}>充值8次</Radio>
  400. <Radio value={10}>充值10次</Radio>
  401. <Radio value={11}>充值10次以上</Radio>
  402. </>
  403. }
  404. </Radio.Group >
  405. <span className={style.open_span} onClick={() => setOpen({ ...open, a: !open.a })}>{!!open.a ? <UpCircleOutlined style={{ color: '#1890ff' }} /> : <DownCircleOutlined style={{ color: '#1890ff' }} />}</span>
  406. </div>
  407. </Space>
  408. </Col>
  409. <Divider style={{ margin: 0 }} />
  410. <Col span={24}>
  411. <Space className={style.s_label}>
  412. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}>上次充值距今:</label>
  413. <div>
  414. <div style={{ marginBottom: 5 }}>
  415. <Input.Group compact>
  416. <Input
  417. style={{ width: 100, textAlign: 'center', borderRightWidth: 0 }}
  418. placeholder="最小天数"
  419. value={fansFilterRechargeTimeMin}
  420. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  421. let v = event.target.value
  422. dispatch({ type: 'setData', params: { fansFilterRechargeTimeMin: v } })
  423. }}
  424. />
  425. <Input
  426. style={{
  427. width: 30,
  428. borderLeft: 0,
  429. borderRight: 0,
  430. pointerEvents: 'none',
  431. backgroundColor: '#fff'
  432. }}
  433. placeholder="~"
  434. disabled
  435. />
  436. <Input
  437. className="site-input-right"
  438. style={{
  439. width: 100,
  440. textAlign: 'center',
  441. borderLeftWidth: 0
  442. }}
  443. value={fansFilterRechargeTimeMax}
  444. placeholder="最大天数"
  445. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  446. let v = event.target.value
  447. dispatch({ type: 'setData', params: { fansFilterRechargeTimeMax: v } })
  448. }}
  449. />
  450. </Input.Group>
  451. </div>
  452. <Radio.Group
  453. style={{ width: '100%' }}
  454. onChange={(e: RadioChangeEvent) => {
  455. dispatch({
  456. type: 'setData',
  457. params: {
  458. dayType: e.target.value,
  459. fansFilterRechargeTimeMin: e.target.value === '' ? '' : e.target.value === 31 ? '30' : e.target.value === 61 ? '60' : '0',
  460. fansFilterRechargeTimeMax: e.target.value === 31 ? '' : e.target.value === 61 ? '' : e.target.value
  461. }
  462. })
  463. }}
  464. value={dayType}
  465. >
  466. <Radio value="">不限</Radio>
  467. <Radio value={15}>15天之内</Radio>
  468. <Radio value={30}>30天之内</Radio>
  469. {
  470. !!open.b && <>
  471. <Radio value={31}>30天以上</Radio>
  472. <Radio value={45}>45天之内</Radio>
  473. <Radio value={60}>60天之内</Radio>
  474. <Radio value={61}>60天以上</Radio>
  475. </>
  476. }
  477. </Radio.Group>
  478. <span className={style.open_span} onClick={() => setOpen({ ...open, b: !open.b })}>{!!open['b'] ? <UpCircleOutlined style={{ color: '#1890ff' }} /> : <DownCircleOutlined style={{ color: '#1890ff' }} />}</span>
  479. </div>
  480. </Space>
  481. </Col>
  482. <Divider style={{ margin: 0 }} />
  483. <Col span={24}>
  484. <Space>
  485. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}>累计充值金额:</label>
  486. <Input.Group compact>
  487. <Input
  488. style={{ width: 100, textAlign: 'center', borderRightWidth: 0 }}
  489. placeholder="最小金额"
  490. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  491. let v = event.target.value
  492. dispatch({ type: 'setData', params: { fansFilterRechargeMin: v } })
  493. }}
  494. value={fansFilterRechargeMin}
  495. />
  496. <Input
  497. style={{
  498. width: 30,
  499. borderLeft: 0,
  500. borderRight: 0,
  501. pointerEvents: 'none',
  502. backgroundColor: '#fff'
  503. }}
  504. placeholder="~"
  505. disabled
  506. />
  507. <Input
  508. className="site-input-right"
  509. style={{
  510. width: 100,
  511. textAlign: 'center',
  512. borderLeftWidth: 0
  513. }}
  514. placeholder="最大金额"
  515. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  516. let v = event.target.value
  517. dispatch({ type: 'setData', params: { fansFilterRechargeMax: v } })
  518. }}
  519. value={fansFilterRechargeMax}
  520. />
  521. </Input.Group>
  522. </Space>
  523. </Col>
  524. <Divider style={{ margin: 0 }} />
  525. {/* <Col span={24}>
  526. <Space className={style.s_label}>
  527. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}>书币余额:</label>
  528. <div>
  529. <div style={{ marginBottom: 5 }}>
  530. <Input.Group compact>
  531. <Input
  532. style={{ width: 100, textAlign: 'center', borderRightWidth: 0 }}
  533. placeholder="最小书币"
  534. value={fansFilterCoinCountMin}
  535. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  536. let v = event.target.value
  537. dispatch({ type: 'setData', params: { fansFilterCoinCountMin: v } })
  538. }}
  539. />
  540. <Input
  541. style={{
  542. width: 30,
  543. borderLeft: 0,
  544. borderRight: 0,
  545. pointerEvents: 'none',
  546. backgroundColor: '#fff'
  547. }}
  548. placeholder="~"
  549. disabled
  550. />
  551. <Input
  552. className="site-input-right"
  553. style={{
  554. width: 100,
  555. textAlign: 'center',
  556. borderLeftWidth: 0
  557. }}
  558. placeholder="最大书币"
  559. value={fansFilterCoinCountMax}
  560. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  561. let v = event.target.value
  562. dispatch({ type: 'setData', params: { fansFilterCoinCountMax: v } })
  563. }}
  564. />
  565. </Input.Group>
  566. </div>
  567. <Radio.Group
  568. style={{ width: '100%' }}
  569. onChange={(e: RadioChangeEvent) => {
  570. let arr = [['', ''], ['0', '500'], ['501', '1000'], ['1001', '3000'], ['3001', '10000'], ['10000', '']]
  571. dispatch({
  572. type: 'setData',
  573. params: {
  574. countType: e.target.value,
  575. fansFilterCoinCountMin: e.target.value === '' ? arr[0][0] : arr[e.target.value][0],
  576. fansFilterCoinCountMax: e.target.value === '' ? arr[0][1] : arr[e.target.value][1],
  577. }
  578. })
  579. }}
  580. value={countType}>
  581. <Radio value="">不限</Radio>
  582. <Radio value={1}>低于500</Radio>
  583. <Radio value={2}>501-1000</Radio>
  584. {
  585. !!open.c && <>
  586. <Radio value={3}>1001-3000</Radio>
  587. <Radio value={4}>3001-10000</Radio>
  588. <Radio value={5}>10000以上</Radio>
  589. </>
  590. }
  591. </Radio.Group>
  592. <span className={style.open_span} onClick={() => setOpen({ ...open, c: !open.c })}>{!!open['c'] ? <UpCircleOutlined style={{ color: '#1890ff' }} /> : <DownCircleOutlined style={{ color: '#1890ff' }} />}</span>
  593. </div>
  594. </Space>
  595. </Col>
  596. <Divider style={{padding:0}}/> */}
  597. {activeTime && <Col span={24}>
  598. <Space className={style.s_label}>
  599. <label style={{ width: 100, display: 'inline-block', textAlign: 'right' }}>活跃时间:</label>
  600. <div>
  601. <div style={{ marginBottom: 5 }}>
  602. <Input.Group compact>
  603. <Input
  604. style={{ width: 100, textAlign: 'center', borderRightWidth: 0 }}
  605. placeholder="最小时间"
  606. value={fansFilterActiveTimeMin}
  607. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  608. let v = event.target.value
  609. dispatch({ type: 'setData', params: { fansFilterActiveTimeMin: v } })
  610. }}
  611. />
  612. <Input
  613. style={{
  614. width: 30,
  615. borderLeft: 0,
  616. borderRight: 0,
  617. pointerEvents: 'none',
  618. backgroundColor: '#fff'
  619. }}
  620. placeholder="~"
  621. disabled
  622. />
  623. <Input
  624. className="site-input-right"
  625. style={{
  626. width: 100,
  627. textAlign: 'center',
  628. borderLeftWidth: 0
  629. }}
  630. placeholder="最大时间"
  631. value={fansFilterActiveTimeMax}
  632. onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
  633. let v = event.target.value
  634. dispatch({ type: 'setData', params: { fansFilterActiveTimeMax: v } })
  635. }}
  636. />
  637. </Input.Group>
  638. </div>
  639. <Radio.Group
  640. style={{ width: '100%' }}
  641. onChange={(e: RadioChangeEvent) => {
  642. let arr = [['', ''], ['0', '1'], ['1', '3'], ['3', '12'], ['12', '24'], ['24', '48']]
  643. dispatch({
  644. type: 'setData',
  645. params: {
  646. timeType: e.target.value,
  647. fansFilterActiveTimeMin: e.target.value === '' ? arr[0][0] : arr[e.target.value][0],
  648. fansFilterActiveTimeMax: e.target.value === '' ? arr[0][1] : arr[e.target.value][1],
  649. }
  650. })
  651. }}
  652. value={timeType}
  653. >
  654. <Radio value="">不限</Radio>
  655. <Radio value={1}>1小时</Radio>
  656. <Radio value={2}>1-3小时</Radio>
  657. {
  658. !!open.d && <>
  659. <Radio value={3}>3-12小时</Radio>
  660. <Radio value={4}>12-24小时</Radio>
  661. <Radio value={5}>24-48小时</Radio>
  662. </>
  663. }
  664. </Radio.Group>
  665. <span className={style.open_span} onClick={() => setOpen({ ...open, d: !open.d })}>{!!open['d'] ? <UpCircleOutlined style={{ color: '#1890ff' }} /> : <DownCircleOutlined style={{ color: '#1890ff' }} />}</span>
  666. </div>
  667. </Space>
  668. </Col>}
  669. </Row >
  670. }
  671. export default React.memo(FansSelect, (a, b) => {
  672. if (JSON.stringify(a) === JSON.stringify(b)) {
  673. return true
  674. }
  675. return false
  676. })