index.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. import React, { Component } from "react";
  2. import TabelContent from "../../../common/tabelContent";
  3. import {
  4. Form,
  5. Button,
  6. message,
  7. Modal,
  8. Spin,
  9. Input,
  10. DatePicker,
  11. Radio,
  12. Popconfirm,
  13. } from "antd";
  14. import LegalRecd from "./legalRecd";
  15. import DunningRecord from "../../order/pressMoney/dunningRecord";
  16. import ImgList from "../../../common/imgList";
  17. import OrderDesc from "../../financialManage/orderDetail/orderDesc";
  18. import $ from "jquery/src/ajax";
  19. const { TextArea } = Input;
  20. const RadioGroup = Radio.Group;
  21. class Collectioningn extends Component {
  22. constructor(props) {
  23. super(props);
  24. this.state = {
  25. columns: [
  26. {
  27. title: "序号",
  28. dataIndex: "key",
  29. key: "key",
  30. width: 45,
  31. },
  32. {
  33. title: "合同编号",
  34. dataIndex: "contractNo",
  35. key: "contractNo",
  36. width: 70,
  37. },
  38. {
  39. title: "客户名称",
  40. dataIndex: "buyerName",
  41. key: "buyerName",
  42. width: 150,
  43. },
  44. {
  45. title: "订单负责人",
  46. dataIndex: "salesmanName",
  47. key: "salesmanName",
  48. width: 120,
  49. },
  50. {
  51. title: "订单部门",
  52. dataIndex: "depName",
  53. key: "depName",
  54. width: 120,
  55. },
  56. {
  57. title: "签单金额(万元)",
  58. dataIndex: "totalAmount",
  59. key: "totalAmount",
  60. width: 80,
  61. },
  62. {
  63. title: "已收款(万元)",
  64. dataIndex: "settlementAmount",
  65. key: "settlementAmount",
  66. width: 80,
  67. },
  68. {
  69. title: "欠款(万元)",
  70. dataIndex: "orderArrears",
  71. key: "orderArrears",
  72. width: 80,
  73. },
  74. {
  75. title: "法务类型",
  76. dataIndex: "type",
  77. key: "type",
  78. width: 125,
  79. },
  80. {
  81. title: "法务时间",
  82. dataIndex: "operationDate",
  83. key: "operationDate",
  84. width: 125,
  85. },
  86. {
  87. title: "操作",
  88. dataIndex: "id",
  89. key: "id",
  90. width: 290,
  91. render: (text, record, index) => {
  92. let _this = this;
  93. return (
  94. <div style={{ display: "flex", alignItems: "center" }}>
  95. {/* <Button
  96. disabled={record.daysRemaining === 0}
  97. type="primary"
  98. style={{ marginRight: "10px" }}
  99. onClick={(e) => {
  100. // alert(123)
  101. console.log(e);
  102. }}
  103. >
  104. 查看催款凭证
  105. </Button> */}
  106. <Button
  107. type="primary"
  108. style={{ marginRight: "10px" }}
  109. onClick={(e) => {
  110. e.stopPropagation();
  111. this.setState({
  112. visible: true,
  113. dataInfor: record,
  114. });
  115. }}
  116. >
  117. 催款记录
  118. </Button>
  119. <Button
  120. type="primary"
  121. style={{ marginRight: "10px",display:this.state.adminHid }}
  122. onClick={(e) => {
  123. e.stopPropagation();
  124. this.setState({
  125. visibleLegal: true,
  126. dataInfor: record,
  127. });
  128. }}
  129. >
  130. 新增法务
  131. </Button>
  132. {/* 法务记录 */}
  133. <Button
  134. type="primary"
  135. style={{ marginRight: "10px" }}
  136. onClick={(e) => {
  137. e.stopPropagation();
  138. this.setState({
  139. visibleRecd: true,
  140. dataInfor: record,
  141. });
  142. }}
  143. >
  144. 法务记录
  145. </Button>
  146. </div>
  147. );
  148. },
  149. },
  150. ],
  151. searchList: [
  152. {
  153. type: "text",
  154. dataKey: "userName",
  155. placeholder: "请输入客户名称",
  156. },
  157. {
  158. type: "text",
  159. dataKey: "contractNo",
  160. placeholder: "请输入合同编号",
  161. },
  162. {
  163. type: "autoComplete",
  164. dataKey: "aid",
  165. api: "/api/admin/customer/listAdminByName",
  166. search: "adminName",
  167. placeholder: "请输入营销人名称",
  168. },
  169. {
  170. type: "newDepartmentSelect",
  171. dataKey: "deps",
  172. placeholder: "请选择订单部门",
  173. },
  174. {
  175. type: "times",
  176. title: "法务时间",
  177. dataKey: ["startTime", "endTime"],
  178. },
  179. ],
  180. RowData: {},
  181. loading: false,
  182. visibleModel: false,
  183. visible: false,
  184. visibleLegal: false,
  185. loading: false,
  186. LegalKeys: 0,
  187. visibleRecd: false,
  188. showDesc:false,
  189. RowData:{},
  190. adminHid:"inline-block"
  191. };
  192. this.tableRowClick = this.tableRowClick.bind(this);
  193. this.modelBack = this.modelBack.bind(this);
  194. this.onFresh = this.onFresh.bind(this);
  195. this.addLegal = this.addLegal.bind(this);
  196. this.tabelContentRef = null;
  197. }
  198. componentDidMount() {
  199. if(!adminData.isLegal) {
  200. this.setState({
  201. adminHid:"none"
  202. })
  203. // console.log(adminData.isLegal);
  204. }
  205. }
  206. tableRowClick(record, index) {
  207. this.setState({
  208. showDesc: true,
  209. RowData: record,
  210. });
  211. // console.log(record);
  212. }
  213. closeDesc(e, s) {
  214. this.state.showDesc = e;
  215. if (s) {
  216. this.loadData(this.state.page);
  217. }
  218. }
  219. modelBack() {
  220. this.setState({
  221. visibleLegal: true,
  222. });
  223. }
  224. onCancel() {
  225. // console.log(1);
  226. }
  227. onFresh() {
  228. this.setState({
  229. visibleRecd: false,
  230. });
  231. this.tabelContentRef && this.tabelContentRef.onRefresh();
  232. }
  233. addLegal() {
  234. let theorgCodeUrl = [];
  235. if (!this.state.fileList) {
  236. message.warning("请上传凭证");
  237. return;
  238. } else {
  239. let picArr = [];
  240. this.state.fileList.map(function (item) {
  241. if (item.response && item.response.data && item.response.data.length) {
  242. picArr.push({ name: item.name, url: item.response.data });
  243. }
  244. });
  245. theorgCodeUrl = JSON.stringify(picArr);
  246. // console.log(theorgCodeUrl);
  247. }
  248. if (!this.state.date) {
  249. message.warning("请选择时间");
  250. return;
  251. }
  252. this.setState({
  253. addDunOrderLoading: true,
  254. loading: true,
  255. });
  256. $.ajax({
  257. method: "post",
  258. dataType: "json",
  259. crossDomain: false,
  260. url: globalConfig.context + "/api/admin/lagalAffairs/addLagalAffairsLog",
  261. data: {
  262. orderNo: this.state.dataInfor.orderNo,
  263. type: this.state.type,
  264. status: this.state.status ? this.state.status : 0,
  265. date: this.state.date,
  266. remarks: this.state.remarks,
  267. attachmentUrl: theorgCodeUrl.length ? theorgCodeUrl : "",
  268. },
  269. success: function (data) {
  270. if (data.error.length) {
  271. this.setState({
  272. loading: false,
  273. });
  274. message.warning(data.error[0].message);
  275. } else {
  276. this.setState({
  277. loading: false,
  278. visibleLegal: false,
  279. LegalKeys: this.state.LegalKeys + 11,
  280. fileList: undefined,
  281. });
  282. // this.props.visible = false
  283. message.success("添加成功");
  284. this.tabelContentRef && this.tabelContentRef.onRefresh();
  285. // console.log(this.tabelContentRef);
  286. }
  287. }.bind(this),
  288. }).done(
  289. function () {
  290. this.setState({
  291. addDunOrderLoading: false,
  292. });
  293. }.bind(this)
  294. );
  295. }
  296. // 法务催收中
  297. render() {
  298. const { visibleModel, loading, RowData } = this.state;
  299. const FormItem = Form.Item;
  300. const formItemLayout = {
  301. labelCol: { span: 10 },
  302. wrapperCol: { span: 12 },
  303. };
  304. return (
  305. <div className="user-content signatureStatistics">
  306. <div className="content-title">
  307. <span>法务催收中</span>
  308. </div>
  309. <TabelContent
  310. ref={(ref) => (this.tabelContentRef = ref)}
  311. scroll={{ x: 0, y: 1000 }}
  312. searchList={this.state.searchList}
  313. columns={this.state.columns}
  314. tabelApi={"/api/admin/lagalAffairs/orderList"}
  315. exportApi={"/api/admin/lagalAffairs/orderList/Exprot"}
  316. query={{ type: 1 }}
  317. //修改type类型
  318. exportExecProcessing={(data) => {
  319. data.type = 1;
  320. return data;
  321. }}
  322. dataProcessing={(data) => {
  323. let theArr = [];
  324. for (let i = 0; i < data.data.list.length; i++) {
  325. let thisdata = data.data.list[i];
  326. thisdata.key = i + 1;
  327. if (thisdata.type == 0) {
  328. thisdata.type = "法务催收中";
  329. } else if (thisdata.type == 1) {
  330. thisdata.type = "延期法务";
  331. } else if (thisdata.type == 2) {
  332. thisdata.type = "已完成法务";
  333. }
  334. theArr.push(thisdata);
  335. }
  336. return theArr;
  337. }}
  338. onRowClick={this.tableRowClick}
  339. />
  340. {this.state.visibleRecd && (
  341. <LegalRecd
  342. hid={this.state.adminHid}
  343. searchList={this.state.searchList}
  344. dataInfor={this.state.dataInfor}
  345. onFresh={this.onFresh}
  346. visibleRecd={this.state.visibleRecd}
  347. modelBack={this.modelBack}
  348. onCancel={() => {
  349. this.setState({
  350. visibleRecd: false,
  351. dataInfor: {},
  352. });
  353. }}
  354. />
  355. )}
  356. <div>
  357. <Modal
  358. maskClosable={false}
  359. visible={this.state.visibleLegal}
  360. key={this.state.LegalKeys + 11}
  361. onCancel={() => {
  362. this.setState({
  363. visibleLegal: false,
  364. LegalKeys: this.state.LegalKeys + 11,
  365. });
  366. }}
  367. width="1200px"
  368. title="新增法务数据"
  369. footer=""
  370. className="admin-desc-content"
  371. >
  372. <Form
  373. onSubmit={this.handleSubmit}
  374. ref={this.formRef}
  375. style={{ marginRight: "120px" }}
  376. >
  377. <Form.Item
  378. {...formItemLayout}
  379. label="法务类型"
  380. name="type"
  381. hasFeedback
  382. >
  383. <RadioGroup
  384. onChange={(e) => {
  385. this.setState({
  386. type: e.target.value,
  387. });
  388. }}
  389. >
  390. <Radio value="0">法务催收中</Radio>
  391. <Radio value="1">延期法务</Radio>
  392. <Radio value="2">法务已完成</Radio>
  393. </RadioGroup>
  394. </Form.Item>
  395. {this.state.type == 2 ? (
  396. <Form.Item
  397. {...formItemLayout}
  398. label="完成状态"
  399. name="status"
  400. hasFeedback
  401. >
  402. <RadioGroup
  403. onChange={(e) => {
  404. this.setState({
  405. status: e.target.value,
  406. });
  407. }}
  408. >
  409. <Radio value="1">已回款</Radio>
  410. <Radio value="2">以诉讼</Radio>
  411. <Radio value="3">以坏账处理</Radio>
  412. </RadioGroup>
  413. </Form.Item>
  414. ) : (
  415. ""
  416. )}
  417. <Form.Item
  418. name="date"
  419. {...formItemLayout}
  420. label="时间"
  421. hasFeedback
  422. >
  423. <DatePicker
  424. onChange={(date, dateString) => {
  425. this.setState({
  426. date: dateString,
  427. });
  428. }}
  429. />
  430. </Form.Item>
  431. <Form.Item
  432. name="remarks"
  433. {...formItemLayout}
  434. label="法务情况"
  435. hasFeedback
  436. >
  437. <TextArea
  438. rows={4}
  439. onChange={(e) => {
  440. this.setState({
  441. remarks: e.target.value,
  442. });
  443. }}
  444. />
  445. </Form.Item>
  446. <Form.Item
  447. name="fileList"
  448. {...formItemLayout}
  449. label="附件"
  450. hasFeedback
  451. >
  452. <ImgList
  453. accept="application/pdf,image/png,application/msword"
  454. domId="nowProjectStatus"
  455. uploadConfig={{
  456. action:
  457. globalConfig.context +
  458. "/api/admin/newOrder/uploadDunLogFile",
  459. data: { sign: "dun_log_attachment" },
  460. multiple: true,
  461. listType: "text",
  462. }}
  463. onChange={(info) => {
  464. let fileList = info.fileList;
  465. this.setState({ fileList });
  466. }}
  467. fileList={this.state.fileList}
  468. />
  469. </Form.Item>
  470. </Form>
  471. <div style={{ display: "flex", justifyContent: "center" }}>
  472. <Button type="primary" loading={this.state.loading}>
  473. <Popconfirm
  474. title="您确定此订单提交法务数据?"
  475. onConfirm={this.addLegal}
  476. onCancel={() => {
  477. this.setState({
  478. loading: false,
  479. });
  480. }}
  481. okText="确定"
  482. cancelText="取消"
  483. loading={this.state.loading}
  484. >
  485. <a href="#">提交</a>
  486. </Popconfirm>
  487. </Button>
  488. <Button
  489. type="dashed"
  490. style={{ marginLeft: "15px" }}
  491. onClick={() => {
  492. this.setState({
  493. visibleLegal: false,
  494. LegalKeys: this.state.LegalKeys + 11,
  495. });
  496. }}
  497. >
  498. 取消
  499. </Button>
  500. </div>
  501. </Modal>
  502. </div>
  503. {this.state.visible ? (
  504. <DunningRecord
  505. hid={"none"}
  506. dataInfor={this.state.dataInfor}
  507. visible={this.state.visible}
  508. onCancel={() => {
  509. this.setState({
  510. visible: false,
  511. dataInfor: {},
  512. });
  513. }}
  514. />
  515. ) : (
  516. ""
  517. )}
  518. <OrderDesc
  519. data={this.state.RowData}
  520. showDesc={this.state.showDesc}
  521. closeDesc={this.closeDesc.bind(this)}
  522. />
  523. </div>
  524. );
  525. }
  526. }
  527. export default Collectioningn;