index.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. import React, { Component } from "react";
  2. import TabelContent from "../../../common/tabelContent";
  3. import LegalRecd from "../collectioning/legalRecd";
  4. import DunningRecord from "../../order/pressMoney/dunningRecord";
  5. import { Form, Button, message, Modal, Icon, Input } from "antd";
  6. import $ from "jquery/src/ajax";
  7. import dayjs from "dayjs";
  8. const { TextArea } = Input;
  9. const formItemLayout = {
  10. labelCol: {
  11. xs: { span: 24 },
  12. sm: { span: 6 },
  13. },
  14. wrapperCol: {
  15. xs: { span: 24 },
  16. sm: { span: 14 },
  17. },
  18. };
  19. class DelayLegalAffairs extends Component {
  20. constructor(props) {
  21. super(props);
  22. this.state = {
  23. columns: [
  24. {
  25. title: "序号",
  26. dataIndex: "key",
  27. key: "key",
  28. width: 45,
  29. },
  30. {
  31. title: "合同编号",
  32. dataIndex: "contractNo",
  33. key: "contractNo",
  34. width: 70,
  35. },
  36. {
  37. title: "客户名称",
  38. dataIndex: "buyerName",
  39. key: "buyerName",
  40. width: 150,
  41. },
  42. {
  43. title: "订单负责人",
  44. dataIndex: "salesmanName",
  45. key: "salesmanName",
  46. width: 120,
  47. },
  48. {
  49. title: "订单部门",
  50. dataIndex: "depName",
  51. key: "depName",
  52. width: 120,
  53. },
  54. {
  55. title: "签单金额(万元)",
  56. dataIndex: "totalAmount",
  57. key: "totalAmount",
  58. width: 80,
  59. },
  60. {
  61. title: "已收款(万元)",
  62. dataIndex: "settlementAmount",
  63. key: "settlementAmount",
  64. width: 80,
  65. },
  66. {
  67. title: "欠款(万元)",
  68. dataIndex: "orderArrears",
  69. key: "orderArrears",
  70. width: 80,
  71. },
  72. {
  73. title: "法务类型",
  74. dataIndex: "type",
  75. key: "type",
  76. width: 80,
  77. },
  78. {
  79. title: "法务时间",
  80. dataIndex: "operationDate",
  81. key: "operationDate",
  82. width: 125,
  83. },
  84. {
  85. title: "操作",
  86. dataIndex: "id",
  87. key: "id",
  88. width: 290,
  89. render: (text, record, index) => {
  90. let _this = this;
  91. return (
  92. <div style={{ display: "flex", alignItems: "center" }}>
  93. {/* <Button
  94. disabled={record.daysRemaining === 0}
  95. type="primary"
  96. style={{ marginRight: "10px" }}
  97. onClick={(e) => {
  98. // alert(123)
  99. console.log(e);
  100. }}
  101. >
  102. 查看催款凭证
  103. </Button> */}
  104. <Button
  105. type="primary"
  106. style={{ marginRight: "10px", display: this.state.adminHid }}
  107. onClick={(e) => {
  108. e.stopPropagation();
  109. // console.log();
  110. this.setState({
  111. visibleTransfer: true,
  112. orderNoTransfer: record.orderNo,
  113. });
  114. }}
  115. >
  116. 重启催款
  117. </Button>
  118. <Button
  119. type="primary"
  120. style={{ marginRight: "10px" }}
  121. onClick={(e) => {
  122. e.stopPropagation();
  123. console.log(record);
  124. this.setState({
  125. visible: 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. console.log(record);
  139. this.setState({
  140. visibleRecd: true,
  141. dataInfor: record,
  142. });
  143. }}
  144. >
  145. 法务记录
  146. </Button>
  147. </div>
  148. );
  149. },
  150. },
  151. ],
  152. searchList: [
  153. {
  154. type: "text",
  155. dataKey: "userName",
  156. placeholder: "请输入客户名称",
  157. },
  158. {
  159. type: "text",
  160. dataKey: "contractNo",
  161. placeholder: "请输入合同编号",
  162. },
  163. {
  164. type: "autoComplete",
  165. dataKey: "aid",
  166. api: "/api/admin/customer/listAdminByName",
  167. search: "adminName",
  168. placeholder: "请输入营销人名称",
  169. },
  170. {
  171. type: "newDepartmentSelect",
  172. dataKey: "deps",
  173. placeholder: "请选择订单部门",
  174. },
  175. {
  176. type: "times",
  177. title: "法务时间",
  178. dataKey: ["startTime", "endTime"],
  179. },
  180. ],
  181. visible: false,
  182. visibleLegal: false,
  183. visibleRecd: false,
  184. orderNoTransfer: "",
  185. visibleTransfer: false,
  186. transferKey: 0,
  187. adminHid: "inline-block",
  188. };
  189. this.modelBack = this.modelBack.bind(this);
  190. this.transfer = this.transfer.bind(this);
  191. this.onFresh = this.onFresh.bind(this);
  192. }
  193. componentDidMount() {
  194. if (!adminData.isLegal) {
  195. this.setState({
  196. adminHid: "none",
  197. });
  198. }
  199. }
  200. transfer(orderNo) {
  201. this.setState({
  202. transferLoading: true,
  203. });
  204. if (this.state.remarks == "") {
  205. message.warning("请填写原因");
  206. }
  207. $.ajax({
  208. method: "post",
  209. dataType: "json",
  210. crossDomain: false,
  211. url: globalConfig.context + "/api/admin/lagalAffairs/addLagalAffairsLog",
  212. data: {
  213. orderNo,
  214. type: 0,
  215. remarks: this.state.remarks,
  216. status: 0,
  217. date: dayjs().format("YYYY-MM-DD"),
  218. },
  219. success: function (data) {
  220. if (data.error.length) {
  221. message.warning(data.error[0].message);
  222. } else {
  223. message.success("重启成功");
  224. this.setState({
  225. visibleTransfer: false,
  226. transferKey: this.state.transferKey + 13,
  227. });
  228. this.tabelContentRef && this.tabelContentRef.onRefresh();
  229. }
  230. }.bind(this),
  231. }).done(
  232. function () {
  233. this.setState({
  234. transferLoading: false,
  235. });
  236. }.bind(this)
  237. );
  238. }
  239. modelBack() {
  240. this.setState({
  241. visibleLegal: true,
  242. });
  243. }
  244. onFresh() {
  245. this.setState({
  246. visibleRecd: false,
  247. });
  248. this.tabelContentRef && this.tabelContentRef.onRefresh();
  249. }
  250. render() {
  251. return (
  252. <div className="user-content signatureStatistics">
  253. <div className="content-title">
  254. <span>延期法务</span>
  255. </div>
  256. <TabelContent
  257. ref={(ref) => (this.tabelContentRef = ref)}
  258. scroll={{ x: 0, y: 1000 }}
  259. searchList={this.state.searchList}
  260. columns={this.state.columns}
  261. tabelApi={"/api/admin/lagalAffairs/orderList"}
  262. exportApi={"/api/admin/lagalAffairs/orderList/Exprot"}
  263. query={{ type: 2 }}
  264. //修改type类型
  265. exportExecProcessing={(data) => {
  266. data.type = 2;
  267. return data;
  268. }}
  269. dataProcessing={(data) => {
  270. let theArr = [];
  271. for (let i = 0; i < data.data.list.length; i++) {
  272. let thisdata = data.data.list[i];
  273. thisdata.key = i + 1;
  274. let status;
  275. if (thisdata.status == 0) {
  276. status = "否";
  277. } else if (thisdata.status == 1) {
  278. status = "已回款";
  279. } else if (thisdata.status == 2) {
  280. status = "已诉讼";
  281. } else if (thisdata.status == 3) {
  282. status = "已坏账处理";
  283. }
  284. if (thisdata.type == 0) {
  285. thisdata.type = "法务催收中";
  286. } else if (thisdata.type == 1) {
  287. thisdata.type = "延期法务";
  288. } else if (thisdata.type == 2) {
  289. thisdata.type = `已完成法务/${status}`;
  290. }
  291. theArr.push(thisdata);
  292. }
  293. return theArr;
  294. }}
  295. onRowClick={this.tableRowClick}
  296. />
  297. <Modal
  298. visible={this.state.visibleTransfer}
  299. key={this.state.transferKey + 13}
  300. onCancel={() => {
  301. this.setState({
  302. visibleTransfer: false,
  303. transferKey: this.state.transferKey + 13,
  304. });
  305. }}
  306. width="550px"
  307. style={{ color: "red" }}
  308. footer=""
  309. className="admin-desc-content"
  310. >
  311. <div>
  312. {" "}
  313. <Icon
  314. type="exclamation-circle-o"
  315. style={{ color: "red", fontSize: "16px" }}
  316. />
  317. <span
  318. style={{
  319. color: "red",
  320. fontSize: "16px",
  321. display: "inline-block",
  322. marginLeft: "10px",
  323. }}
  324. >
  325. 是否重启催款?
  326. </span>
  327. </div>
  328. <div style={{ margin: "30px 0" }}>
  329. <Form onSubmit={this.handleSubmit} ref={this.formRef}>
  330. <Form.Item
  331. {...formItemLayout}
  332. label="请填写重启原因"
  333. name="type"
  334. hasFeedback
  335. >
  336. <TextArea
  337. rows={4}
  338. onChange={(e) => {
  339. this.setState({
  340. remarks: e.target.value,
  341. });
  342. }}
  343. />
  344. </Form.Item>
  345. </Form>
  346. </div>
  347. <div style={{ display: "flex", justifyContent: "right" }}>
  348. <Button
  349. type="primary"
  350. loading={this.state.loading}
  351. onClick={() => this.transfer(this.state.orderNoTransfer)}
  352. >
  353. 提交
  354. </Button>
  355. <Button
  356. type="dashed"
  357. style={{ marginLeft: "15px" }}
  358. onClick={() => {
  359. this.setState({
  360. visibleTransfer: false,
  361. transferKey: this.state.transferKey + 13,
  362. });
  363. }}
  364. >
  365. 取消
  366. </Button>
  367. </div>
  368. </Modal>
  369. {this.state.visibleRecd && (
  370. <LegalRecd
  371. onFresh={this.onFresh}
  372. hid={this.state.adminHid}
  373. searchList={this.state.searchList}
  374. dataInfor={this.state.dataInfor}
  375. visibleRecd={this.state.visibleRecd}
  376. modelBack={this.modelBack}
  377. onCancel={() => {
  378. this.setState({
  379. visibleRecd: false,
  380. dataInfor: {},
  381. });
  382. }}
  383. />
  384. )}
  385. {this.state.visible ? (
  386. <DunningRecord
  387. hid={"none"}
  388. dataInfor={this.state.dataInfor}
  389. visible={this.state.visible}
  390. onCancel={() => {
  391. this.setState({
  392. visible: false,
  393. dataInfor: {},
  394. });
  395. }}
  396. />
  397. ) : (
  398. ""
  399. )}
  400. </div>
  401. );
  402. }
  403. }
  404. export default DelayLegalAffairs;