centerS.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. import React from 'react';
  2. import { Radio, Select, Input, Form } from 'antd';
  3. // import { $Axios } from '../../common/publish';
  4. import select_data from '../../common/ssq';
  5. import '../center-s/centerS.scss'
  6. export default class centerS extends React.Component {
  7. constructor(props) {
  8. super(props)
  9. this.state = {
  10. selectData: select_data,
  11. Params: this.props.arr,
  12. cityOs: true,
  13. citylist: [],
  14. registerRole: '', //1为自然人2为企业
  15. registerRoleTxt: '', //是否为个体工商户
  16. regisClick: '',
  17. offlist: select_data.offlist,
  18. validation_list: [],
  19. form_width: 200,
  20. contactName : JSON.parse(localStorage.getItem('oData')).contactName
  21. }
  22. }
  23. componentDidMount() {
  24. this.props.onRef(this)
  25. let selectData = this.state.selectData;
  26. let registerRole = selectData.contract.find((item, index) => {
  27. return item.value == JSON.parse(localStorage.getItem('oData')).registerRole;
  28. });
  29. this.setState({
  30. registerRole: registerRole.type,
  31. registerRoleTxt: registerRole.txt,
  32. regisClick: registerRole.type == 1 ? 'PRIVATE' : 'PUBLIC'
  33. })
  34. this.initData();
  35. }
  36. toParent = (data) => {
  37. this.props.parent.getParams_s(this, data)
  38. }
  39. initData() {
  40. if (this.props.arr) { //初始化判断数据回填
  41. if (this.state.Params.provinceCode !== undefined && this.state.Params.provinceCode !== '') { // 判断回填数据内是否有省编码
  42. let Province = this.state.Params.provinceCode; //获取省编码
  43. let data = this.state.selectData.Area; //拿到省数据组
  44. let cityList = data.find((item, index) => { return Province == item.provinceCode }); //抽取省编码内下的城市列表数据
  45. this.setState({ //重新设置数据
  46. cityOs: false,
  47. citylist: cityList.mallCityList,
  48. })
  49. } else {
  50. }
  51. }
  52. }
  53. InputSdata(e) {
  54. let Params = {
  55. bankCode: this.state.Params.bankCode,//开户行
  56. bankBranchName: document.getElementById("bankBranchName").value,//支行名称
  57. accountName: document.getElementById("accountName").value,//开户名称
  58. bankCardNo: document.getElementById("bankCardNo").value,//开户账号
  59. cityCode: this.state.Params.cityCode == undefined ? '' : this.state.Params.cityCode,//市编码
  60. provinceCode: this.state.Params.provinceCode == undefined ? '' : this.state.Params.provinceCode,//省编码
  61. accountType: this.state.Params.accountType == undefined ? 'PUBLIC' : this.state.Params.accountType, //结算银行卡属性 PUBLIC 对公 PRIVATE 对私
  62. liquidationType: 'WITHDRAW',//清算方式 WITHDRAW 提现 SETTLE 结算
  63. // withdrawRateType: this.state.Params.withdrawRateType == undefined ? 'SINGLE' : this.state.Params.withdrawRateType,//提现费率类型
  64. withdrawRateType: '',//提现费率类型
  65. // withdrawRate: document.getElementById("withdrawRate").value,//提现费率
  66. withdrawRate: '',//提现费率
  67. }
  68. localStorage.setItem('sData', JSON.stringify(Params))
  69. return Params
  70. }
  71. childMethod() { //暴露给父组件的方法,集合当前页面拿到的参数存入缓存
  72. let data = this.InputSdata();
  73. this.toParent(data)
  74. }
  75. handleChange(value) {
  76. // console.log(`Selected: ${value}`);
  77. }
  78. selectChange_1(value) { //开户行选择
  79. this.state.Params.bankCode = value;
  80. }
  81. selectChange_2(value) { //省编码选择
  82. this.state.Params.provinceCode = value;
  83. let citylist = this.state.selectData.Area.find((item, index) => { return value == item.provinceCode });
  84. this.setState({
  85. cityOs: false,
  86. citylist: citylist.mallCityList,
  87. });
  88. }
  89. selectChange_3(value) { //市编码选择
  90. this.state.Params.cityCode = value;
  91. }
  92. onChangeRadio(e) {
  93. let accountType = e.target.value;
  94. this.state.Params.accountType = accountType;
  95. this.setState({
  96. regisClick: accountType
  97. })
  98. }
  99. onChangeRadio_s(e) {
  100. let withdrawRateType = e;
  101. this.state.Params.withdrawRateType = withdrawRateType;
  102. }
  103. listTypes(e) {
  104. let data = this.state.offlist;
  105. let type = data.find((item, index) => { return item.value == e });
  106. if (type !== undefined) {
  107. type = true
  108. } else {
  109. type = false
  110. }
  111. return type
  112. }
  113. verification(e) { //暴露给父组件的方法,验证当前页面必填项
  114. this.setState({
  115. validation_list: e,
  116. })
  117. }
  118. render() {
  119. const { selectData, cityOs, citylist, Params, contactName, registerRole, regisClick, validation_list, form_width } = this.state;
  120. const { Option } = Select;
  121. const { TextArea } = Input;
  122. const layout = {
  123. labelCol: { span: 4 },
  124. };
  125. const onFinish = (values) => {
  126. // console.log('xxx: ', values);
  127. };
  128. return (
  129. <div className='center_up'>
  130. <div className='center_left'>
  131. <Form
  132. {...layout}
  133. onFinish={onFinish}
  134. initialValues={{ //数据回填
  135. accountName : contactName
  136. }}
  137. >
  138. <div className='c-l'>
  139. <Form.Item
  140. label="开户行"
  141. name="bankCode"
  142. labelCol={{ style: { width: 150 } }}
  143. rules={[{ required: this.listTypes('bankCode') == true ? true : false, message: '' }]}
  144. validateStatus={validation_list.find((item, index) => { return item == 'bankCode' }) !== undefined ? 'error' : null}
  145. help={validation_list.find((item, index) => { return item == 'bankCode' }) !== undefined ? '此项为必填项!' : null}
  146. >
  147. <Select size='default' placeholder="请选择开户行" defaultValue={Params.bankCode} onChange={this.selectChange_1.bind(this)} style={{ width: 200 }}>
  148. {selectData.contractS.map((item, index) => (
  149. <Option key={index} value={item.value}>{item.txt}</Option>
  150. ))}
  151. </Select>
  152. </Form.Item>
  153. </div>
  154. <div className='c-l'>
  155. <Form.Item
  156. label="支行名称"
  157. name="bankBranchName"
  158. labelCol={{ style: { width: 150 } }}
  159. rules={[{ required: this.listTypes('bankBranchName') == true ? true : false, message: '' }]}
  160. validateStatus={validation_list.find((item, index) => { return item == 'bankBranchName' }) !== undefined ? 'error' : null}
  161. help={validation_list.find((item, index) => { return item == 'bankBranchName' }) !== undefined ? '此项为必填项!' : null}
  162. >
  163. <Input id='bankBranchName' style={{ width: form_width }} defaultValue={Params.bankBranchName} placeholder="请输入支行名称" />
  164. </Form.Item>
  165. </div>
  166. <div className='c-l'>
  167. <Form.Item
  168. label="开户名称"
  169. name="accountName"
  170. labelCol={{ style: { width: 150 } }}
  171. rules={[{ required: this.listTypes('accountName') == true ? true : false, message: '' }]}
  172. validateStatus={validation_list.find((item, index) => { return item == 'accountName' }) !== undefined ? 'error' : null}
  173. help={validation_list.find((item, index) => { return item == 'accountName' }) !== undefined ? '此项为必填项!' : null}
  174. >
  175. <Input id='accountName' style={{ width: form_width }} placeholder="请输入开户名称" disabled />
  176. </Form.Item>
  177. </div>
  178. <div className='c-l'>
  179. <Form.Item
  180. label="开户账号"
  181. name="bankCardNo"
  182. labelCol={{ style: { width: 150 } }}
  183. rules={[{ required: this.listTypes('bankCardNo') == true ? true : false, message: '' }]}
  184. validateStatus={validation_list.find((item, index) => { return item == 'bankCardNo' }) !== undefined ? 'error' : null}
  185. help={validation_list.find((item, index) => { return item == 'bankCardNo' }) !== undefined ? '此项为必填项!' : null}
  186. >
  187. <Input id='bankCardNo' style={{ width: form_width }} defaultValue={Params.bankCardNo} placeholder="请输入开户账号" />
  188. </Form.Item>
  189. </div>
  190. <div className='c-l'>
  191. <Form.Item
  192. label="省编码"
  193. name="provinceCode"
  194. labelCol={{ style: { width: 150 } }}
  195. rules={[{ required: this.listTypes('provinceCode') == true ? true : false, message: '' }]}
  196. validateStatus={validation_list.find((item, index) => { return item == 'provinceCode' }) !== undefined ? 'error' : null}
  197. help={validation_list.find((item, index) => { return item == 'provinceCode' }) !== undefined ? '此项为必填项!' : null}
  198. >
  199. <Select size='default' placeholder="请选择省编码" defaultValue={Params.provinceCode} onChange={this.selectChange_2.bind(this)} style={{ width: 200 }}>
  200. {selectData.Area.map((item, index) => (
  201. <Option key={index} value={item.provinceCode}>{item.provinceName}-{item.provinceCode}</Option>
  202. ))}
  203. </Select>
  204. </Form.Item>
  205. </div>
  206. <div className='c-l'>
  207. <Form.Item
  208. label="市编码"
  209. name="cityCode"
  210. labelCol={{ style: { width: 150 } }}
  211. rules={[{ required: this.listTypes('cityCode') == true ? true : false, message: '' }]}
  212. validateStatus={validation_list.find((item, index) => { return item == 'cityCode' }) !== undefined ? 'error' : null}
  213. help={validation_list.find((item, index) => { return item == 'cityCode' }) !== undefined ? '此项为必填项!' : null}
  214. >
  215. <Select size='default' placeholder="请选择市编码" defaultValue={Params.cityCode} onChange={this.selectChange_3.bind(this)} style={{ width: 200 }} disabled={cityOs}>
  216. {citylist.map((item, index) => (
  217. <Option key={index} value={item.cityCode}>{item.cityName}-{item.cityCode}</Option>
  218. ))}
  219. </Select>
  220. </Form.Item>
  221. </div>
  222. <div className='c-l'>
  223. <Form.Item
  224. label="结算银行卡属性"
  225. name="accountType"
  226. labelCol={{ style: { width: 150 } }}
  227. rules={[{ required: this.listTypes('accountType') == true ? true : false, message: '' }]}
  228. validateStatus={validation_list.find((item, index) => { return item == 'accountType' }) !== undefined ? 'error' : null}
  229. help={validation_list.find((item, index) => { return item == 'accountType' }) !== undefined ? '此项为必填项!' : null}
  230. >
  231. <Radio.Group name="radiogroup" defaultValue={Params.accountType == undefined ? registerRole == 2 ? 'PUBLIC' : 'PRIVATE' : Params.accountType} onChange={this.onChangeRadio.bind(this)}>
  232. <Radio value='PUBLIC'>对公</Radio>
  233. <Radio value='PRIVATE'>对私</Radio>
  234. </Radio.Group>
  235. </Form.Item>
  236. </div>
  237. <div className='c-l'>
  238. <Form.Item
  239. label="清算方式"
  240. name="accountType"
  241. labelCol={{ style: { width: 150 } }}
  242. rules={[{ required: this.listTypes('accountType') == true ? true : false, message: '' }]}
  243. validateStatus={validation_list.find((item, index) => { return item == 'accountType' }) !== undefined ? 'error' : null}
  244. help={validation_list.find((item, index) => { return item == 'accountType' }) !== undefined ? '此项为必填项!' : null}
  245. >
  246. <Radio.Group name="radiogroup" defaultValue='WITHDRAW'>
  247. <Radio value='WITHDRAW'>提现</Radio>
  248. </Radio.Group>
  249. </Form.Item>
  250. </div>
  251. {/* <div className='c-l'>
  252. <Form.Item
  253. label="提现费率类型"
  254. name="withdrawRateType"
  255. labelCol={{ style: { width: 150 } }}
  256. rules={[{ required: this.listTypes('withdrawRateType') == true ? true : false, message: '' }]}
  257. validateStatus={validation_list.find((item, index) => { return item == 'withdrawRateType' }) !== undefined ? 'error' : null}
  258. help={validation_list.find((item, index) => { return item == 'withdrawRateType' }) !== undefined ? '此项为必填项!' : null}
  259. >
  260. <Select size='default' placeholder="请选择提现费率类型" defaultValue={Params.withdrawRateType == undefined ? 'SINGLE' : Params.withdrawRateType} style={{ width: 200 }} onChange={this.onChangeRadio_s.bind(this)}>
  261. <Option key='SINGLE' value='SINGLE'>单笔</Option>
  262. <Option key='RATE' value='RATE'>百分比</Option>
  263. </Select>
  264. </Form.Item>
  265. </div>
  266. <div className='c-l'>
  267. <Form.Item
  268. label="提现费率"
  269. name="withdrawRate"
  270. labelCol={{ style: { width: 150 } }}
  271. rules={[{ required: this.listTypes('withdrawRate') == true ? true : false, message: '' }]}
  272. validateStatus={validation_list.find((item, index) => { return item == 'withdrawRate' }) !== undefined ? 'error' : null}
  273. help={validation_list.find((item, index) => { return item == 'withdrawRate' }) !== undefined ? '此项为必填项!' : null}
  274. >
  275. <Input id='withdrawRate' style={{ width : form_width}} defaultValue={Params.withdrawRate} placeholder="请输入提现费率" />
  276. </Form.Item>
  277. </div> */}
  278. </Form>
  279. </div>
  280. <div className='center_right'> </div>
  281. </div>
  282. )
  283. }
  284. }