huiKuan.jsx 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import moment from "moment";
  4. import "./public.less";
  5. import {
  6. Form,
  7. Button,
  8. Input,
  9. Select,
  10. Spin,
  11. Table,
  12. message,
  13. Modal,
  14. Upload,
  15. DatePicker,
  16. Icon,
  17. Tabs,
  18. Popconfirm,
  19. Tag,
  20. Tooltip,
  21. } from "antd";
  22. import {
  23. getProvinceA,
  24. getInvoiceStatus,
  25. getprovince,
  26. getStatus,
  27. getPeople,
  28. splitUrl,
  29. moneyVerify
  30. } from "@/tools";
  31. import { ChooseList } from "../../../../component/manageCenter/order/orderNew/chooseList";
  32. import "./huiKuan.less"
  33. import LogPopup from "../../../common/logPopup";
  34. import Cascaders from "../../../common/cascaders";
  35. const { RangePicker } = DatePicker;
  36. const FormItem = Form.Item;
  37. const { TextArea } = Input;
  38. const { TabPane } = Tabs;
  39. const formItemLayout = {
  40. labelCol: { span: 5 },
  41. wrapperCol: { span: 19 }
  42. };
  43. const HuiKuan = React.createClass({
  44. loadData(pageNo, pageSize) {
  45. this.state.data = [];
  46. this.setState({
  47. loading: true
  48. });
  49. $.ajax({
  50. method: "get",
  51. dataType: "json",
  52. crossDomain: false,
  53. url: globalConfig.context + "/api/admin/receivables/listReceivables",
  54. data: {
  55. pageNo: pageNo || 1,
  56. pageSize: pageSize || this.state.pagination.pageSize,
  57. // 0 正常 1 待合并库
  58. mergeStatus: this.state.mergeStatus,
  59. // 订单状态 判断是否重复
  60. status: this.state.statusSearch,
  61. // 订单编号
  62. orderNo: this.state.orderNoSearch,
  63. // 合同编号
  64. contractNo: this.state.nameSearch,
  65. // 付款方
  66. corporateName: this.state.payFrom,
  67. // 营销员名字
  68. adminName: this.state.adminName,
  69. // 客户名称
  70. nickname: this.state.nickname,
  71. // 订单所属部门id
  72. orderDeps: this.state.orderDeps,
  73. // 管理员部门id
  74. adminDeps: this.state.adminDeps
  75. },
  76. success: function (data) {
  77. let theArr = [];
  78. if (!data.data || !data.data.pagination.list) {
  79. if (data.error && data.error.length) {
  80. message.warning(data.error[0].message);
  81. }
  82. } else {
  83. for (let i = 0; i < data.data.pagination.list.length; i++) {
  84. let thisdata = data.data.pagination.list[i];
  85. theArr.push({
  86. key: thisdata.id,
  87. status: {
  88. first: thisdata.status,
  89. second: thisdata.inptStatus
  90. },
  91. orderNo: thisdata.orderNo,
  92. contractNo: thisdata.contractNo,
  93. corporateName: thisdata.corporateName,
  94. nickname: thisdata.nickname,
  95. totalAmount: thisdata.totalAmount,
  96. depName: thisdata.depName,
  97. amount: thisdata.amount,
  98. receivablesTimes: thisdata.receivablesTimes,
  99. createTimes: thisdata.createTimes,
  100. remarks: thisdata.remarks,
  101. financialPayNo: thisdata.financialPayNo,
  102. settlementAmount: thisdata.settlementAmount
  103. });
  104. }
  105. }
  106. this.state.pagination.current = data.data.pagination.pageNo;
  107. this.state.pagination.total = data.data.pagination.totalCount;
  108. if (
  109. data.data &&
  110. data.data.pagination.list &&
  111. !data.data.pagination.list.length
  112. ) {
  113. this.state.pagination.current = 0;
  114. this.state.pagination.total = 0;
  115. }
  116. this.setState({
  117. totalPage: data.data.pagination.totalPage,
  118. dataSource: theArr,
  119. pagination: this.state.pagination,
  120. totalHui: data.data.count ? data.data.count.totalAmount : 0,
  121. hui: data.data.count ? data.data.count.amount : 0
  122. });
  123. // console.log(this.state.dataSource);
  124. }.bind(this)
  125. }).always(
  126. function () {
  127. this.setState({
  128. loading: false
  129. });
  130. }.bind(this)
  131. );
  132. },
  133. departmentList() {
  134. this.setState({
  135. loading: true
  136. });
  137. $.ajax({
  138. method: "get",
  139. dataType: "json",
  140. crossDomain: false,
  141. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  142. data: {},
  143. success: function (data) {
  144. let thedata = data.data;
  145. let theArr = [];
  146. if (!thedata) {
  147. if (data.error && data.error.length) {
  148. message.warning(data.error[0].message);
  149. }
  150. } else {
  151. thedata.map(function (item, index) {
  152. theArr.push({
  153. key: index,
  154. name: item.name,
  155. id: item.id
  156. });
  157. });
  158. }
  159. this.setState({
  160. departmentArr: theArr
  161. });
  162. }.bind(this)
  163. }).always(
  164. function () {
  165. this.setState({
  166. loading: false
  167. });
  168. }.bind(this)
  169. );
  170. },
  171. getInitialState() {
  172. return {
  173. matching: "",
  174. matchList: [],
  175. mergeStatus: 0,
  176. mergeModal: false,
  177. visible: false,
  178. selectedRowKeys: [], // Check here to configure the default column
  179. loading: false,
  180. searchMore: true,
  181. assignVisible: false,
  182. releaseDate: [],
  183. totalPage: 0,
  184. boHuivisible: false,
  185. selectedRows: [],
  186. // 弹出层数据
  187. modalData: {},
  188. // userName: "",
  189. contractNo: "",
  190. reason: "",
  191. foo: 0,
  192. // 子组件改变的表格title数组
  193. changeList: undefined,
  194. pagination: {
  195. defaultCurrent: 1,
  196. defaultPageSize: 10,
  197. showQuickJumper: true,
  198. pageSize: 10,
  199. onChange: function (page) {
  200. this.loadData(page);
  201. }.bind(this),
  202. showTotal: function (total) {
  203. return "共" + total + "条数据";
  204. }
  205. },
  206. paginationModal: {
  207. pageSize: 100,
  208. showTotal: function (total) {
  209. return "共" + total + "条数据";
  210. }
  211. },
  212. columns: [
  213. {
  214. title: "合同编号",
  215. dataIndex: "contractNo",
  216. key: "contractNo",
  217. // fixed: "left"
  218. className: "title-table"
  219. },
  220. {
  221. title: "订单编号",
  222. dataIndex: "orderNo",
  223. key: "orderNo",
  224. className: "title-table"
  225. },
  226. {
  227. title: "流水编号",
  228. dataIndex: "financialPayNo",
  229. key: "financialPayNo",
  230. className: "title-table"
  231. },
  232. {
  233. title: "客户名称",
  234. dataIndex: "nickname",
  235. key: "nickname",
  236. className: "title-table",
  237. width: 150,
  238. render: (text) => {
  239. return (
  240. <Tooltip title={text}>
  241. <div
  242. // style={{
  243. // maxWidth: '150px',
  244. // overflow: 'hidden',
  245. // textOverflow: "ellipsis",
  246. // whiteSpace: 'nowrap',
  247. // }}
  248. >{text}</div>
  249. </Tooltip>
  250. )
  251. },
  252. },
  253. {
  254. title: "付款方",
  255. dataIndex: "corporateName",
  256. key: "corporateName",
  257. className: "title-table"
  258. },
  259. {
  260. title: "合同额(万元)",
  261. dataIndex: "totalAmount",
  262. key: "totalAmount",
  263. className: "title-table"
  264. },
  265. {
  266. title: "已收款(万元)",
  267. dataIndex: "settlementAmount",
  268. key: "settlementAmount",
  269. className: "title-table"
  270. },
  271. {
  272. title: "本次回款(万元)",
  273. dataIndex: "amount",
  274. key: "amount",
  275. className: "title-table"
  276. },
  277. {
  278. title: "回款时间",
  279. dataIndex: "receivablesTimes",
  280. key: "receivablesTimes",
  281. className: "title-table"
  282. },
  283. {
  284. title: "状态",
  285. dataIndex: "status",
  286. key: "status",
  287. className: "title-table",
  288. render: status => {
  289. let str = "";
  290. let color = "";
  291. let str2 = "";
  292. let color2 = "";
  293. if (status.first == 0) {
  294. color = "#87d068";
  295. str = "正常"
  296. if (status.second == 1) {
  297. str = "内容缺失"
  298. color = "#000";
  299. } else if (status.second == 2) {
  300. str = "订单异常"
  301. color = "#000";
  302. } else if (status.second == 3) {
  303. str = "名称不一致"
  304. color = "#000";
  305. }
  306. } else if (status.first == 1) {
  307. str = "重复";
  308. color = "#f50";
  309. if (status.second == 1) {
  310. str2 = "内容缺失";
  311. color2 = "#000";
  312. } else if (status.second == 2) {
  313. str2 = "订单异常";
  314. color2 = "#000";
  315. } else if (status.second == 3) {
  316. str2 = "名称不一致";
  317. color2 = "#000";
  318. }
  319. } else {
  320. color = "#000";
  321. if (status.first == 2) {
  322. str = "订单异常";
  323. } else if (status.first == 3) {
  324. str = "金额异常";
  325. } else if (status.first == 4) {
  326. str = "名称异常";
  327. } else if (status.first == 5) {
  328. str = "已收款";
  329. } else if (status.first == 6) {
  330. str = "变更锁定";
  331. }
  332. }
  333. return (
  334. <div>
  335. <Tag color={color}>{str}</Tag>
  336. <Tag color={color2} style={{ display: status.first == 1 && status.second != 0 ? "inline-blcok" : "none" }}>{str2}</Tag>
  337. </div>
  338. );
  339. }
  340. },
  341. {
  342. title: "批量导入时间",
  343. dataIndex: "createTimes",
  344. key: "createTimes",
  345. className: "title-table"
  346. },
  347. {
  348. title: "备注",
  349. dataIndex: "remarks",
  350. key: "remarks",
  351. className: "title-table"
  352. }
  353. ],
  354. columnsDate: [
  355. {
  356. title: "编号",
  357. dataIndex: "id",
  358. key: "id"
  359. },
  360. {
  361. title: "订单编号",
  362. dataIndex: "orderno",
  363. key: "orderno"
  364. },
  365. {
  366. title: "开票金额(万元)",
  367. dataIndex: "amount",
  368. key: "amount"
  369. },
  370. {
  371. title: "申请时间",
  372. dataIndex: "createTime",
  373. key: "createTime"
  374. },
  375. {
  376. title: "开票状态",
  377. dataIndex: "status",
  378. key: "status",
  379. render: (text, record) => {
  380. return <div>{getInvoiceStatus(text, record)} <LogPopup id={record.id} /></div>;
  381. },
  382. }
  383. ],
  384. dataSource: [],
  385. upLoadFlag: false,
  386. upLoad: {
  387. name: "file",
  388. action: globalConfig.context + "/api/admin/receivables/import",
  389. headers: {
  390. authorization: "authorization-text"
  391. },
  392. onChange: info => {
  393. if (info.file.status == "done") {
  394. if (info.file.response.data == 1) {
  395. message.success("导入成功!");
  396. this.loadData();
  397. } else {
  398. message.warning(info.file.response.error[0].message);
  399. }
  400. }
  401. }
  402. }
  403. };
  404. },
  405. search() {
  406. this.setState({
  407. selectedRowKeys: []
  408. })
  409. this.loadData();
  410. },
  411. componentWillMount() {
  412. this.loadData();
  413. this.departmentList();
  414. // $("#rcDialogTitle0").on("click", function() {
  415. // alert(123);
  416. // console.log(123);
  417. // });
  418. },
  419. reset() {
  420. this.state.nameSearch = "";
  421. this.state.releaseDate = [];
  422. this.state.orderNoSearch = "";
  423. this.state.adminName = "";
  424. this.state.departmenttList = [];
  425. this.state.nickname = "";
  426. this.state.payFrom = "";
  427. this.state.statusSearch = [];
  428. this.state.adminDeps = undefined;
  429. this.state.orderDeps = undefined;
  430. this.state.statusSearch = [];
  431. this.Cascaders1.empty();
  432. this.Cascaders2.empty();
  433. this.loadData();
  434. },
  435. changeList(arr) {
  436. const newArr = [];
  437. this.state.columns.forEach(item => {
  438. arr.forEach(val => {
  439. if (val === item.title) {
  440. newArr.push(item);
  441. }
  442. });
  443. });
  444. this.setState({
  445. changeList: newArr
  446. });
  447. },
  448. onSelectChange(selectedRowKeys) {
  449. // console.log("selectedRowKeys changed: ", selectedRowKeys);
  450. this.setState({ selectedRowKeys });
  451. },
  452. showModal() {
  453. this.setState({
  454. visible: true,
  455. choose: true
  456. });
  457. this.state.dataSource.forEach((item) => {
  458. if (item.key == this.state.selectedRowKeys[0]) {
  459. this.setState({
  460. modalData: JSON.parse(JSON.stringify(item))
  461. })
  462. // console.log(this.state.modalData);
  463. }
  464. })
  465. },
  466. tableRowClick(record) {
  467. this.setState({
  468. visible: true,
  469. choose: true
  470. });
  471. this.setState({
  472. modalData: JSON.parse(JSON.stringify(record))
  473. });
  474. },
  475. handleOk() {
  476. if (moneyVerify(this.state.modalData.amount)) return
  477. this.setState({ loading: true });
  478. if (!this.state.choose) {
  479. $.ajax({
  480. method: "POST",
  481. dataType: "json",
  482. crossDomain: false,
  483. url: globalConfig.context + "/api/admin/receivables/addReceivables",
  484. data: {
  485. orderNo: this.state.modalData.orderNo,
  486. amount: this.state.modalData.amount,
  487. receivablesTimes: this.state.modalData.receivablesTimes,
  488. // totalAmount: this.state.modalData.totalAmount,
  489. // contractNo: this.state.modalData.contractNo,
  490. // nickname: this.state.modalData.nickname,
  491. remarks: this.state.modalData.remarks,
  492. corporateName: this.state.modalData.corporateName,
  493. financialPayNo: this.state.modalData.financialPayNo
  494. },
  495. success: function (data) {
  496. if (data.error && data.error.length) {
  497. message.warning(data.error[0].message);
  498. } else {
  499. // console.log("成功", data);
  500. message.success("添加成功!")
  501. this.loadData();
  502. this.state.selectedRowKeys = [];
  503. this.setState({
  504. selectedRowKeys: this.state.selectedRowKeys
  505. });
  506. this.setState({ loading: false, visible: false });
  507. }
  508. }.bind(this)
  509. }).always(
  510. function () {
  511. this.setState({
  512. loading: false
  513. });
  514. }.bind(this)
  515. );
  516. } else {
  517. $.ajax({
  518. method: "POST",
  519. dataType: "json",
  520. crossDomain: false,
  521. url: globalConfig.context + "/api/admin/receivables/updateReceivables",
  522. data: {
  523. orderNo: this.state.modalData.orderNo,
  524. amount: this.state.modalData.amount,
  525. receivablesTimes: this.state.modalData.receivablesTimes,
  526. // totalAmount: this.state.modalData.totalAmount,
  527. // contractNo: this.state.modalData.contractNo,
  528. // nickname: this.state.modalData.nickname,
  529. corporateName: this.state.modalData.corporateName,
  530. financialPayNo: this.state.modalData.financialPayNo,
  531. remarks: this.state.modalData.remarks,
  532. id: this.state.modalData.key
  533. },
  534. success: function (data) {
  535. if (data.error && data.error.length) {
  536. message.warning(data.error[0].message);
  537. } else {
  538. // console.log("成功",data);
  539. message.success("修改成功!")
  540. this.loadData()
  541. this.state.selectedRowKeys = [];
  542. this.setState({
  543. selectedRowKeys: this.state.selectedRowKeys
  544. });
  545. this.setState({ loading: false, visible: false });
  546. }
  547. }.bind(this)
  548. }).always(
  549. function () {
  550. this.setState({
  551. loading: false
  552. });
  553. }.bind(this)
  554. );
  555. }
  556. // this.setState({ loading: false, visible: false });
  557. },
  558. handleCancel() {
  559. // this.loadData()
  560. this.setState({ visible: false });
  561. },
  562. callback(key) {
  563. // console.log(key);
  564. },
  565. delChecked() {
  566. // console.log("被删除列表",this.state.selectedRowKeys);
  567. let ids = this.state.selectedRowKeys.join(",")
  568. $.ajax({
  569. method: "POST",
  570. dataType: "json",
  571. crossDomain: false,
  572. url: globalConfig.context + "/api/admin/receivables/deleteReceivables",
  573. data: {
  574. ids,
  575. type: 0
  576. },
  577. success: function (data) {
  578. if (data.error && data.error.length) {
  579. message.warning(data.error[0].message);
  580. }
  581. message.success("删除成功!")
  582. }.bind(this)
  583. }).always(
  584. function () {
  585. this.loadData()
  586. this.state.selectedRowKeys = [];
  587. this.setState({
  588. selectedRowKeys: this.state.selectedRowKeys
  589. });
  590. }.bind(this)
  591. );
  592. // this.loadData()
  593. },
  594. delAllChecked() {
  595. // console.log("删除全部");
  596. $.ajax({
  597. method: "POST",
  598. dataType: "json",
  599. crossDomain: false,
  600. url: globalConfig.context + "/api/admin/receivables/deleteReceivables",
  601. data: {
  602. type: 1
  603. },
  604. success: function (data) {
  605. if (data.error && data.error.length) {
  606. message.warning(data.error[0].message);
  607. }
  608. message.success("删除全部成功!")
  609. }.bind(this)
  610. }).always(
  611. function () {
  612. this.loadData();
  613. this.state.selectedRowKeys = [];
  614. this.setState({
  615. selectedRowKeys: this.state.selectedRowKeys
  616. });
  617. }.bind(this)
  618. );
  619. // this.loadData()
  620. // console.log("aaa", $(".ant-modal-content"));
  621. },
  622. mergeAll() {
  623. // console.log("合并全部");
  624. this.setState({
  625. confirmLoading: true
  626. })
  627. $.ajax({
  628. method: "POST",
  629. dataType: "json",
  630. crossDomain: false,
  631. url: globalConfig.context + "/api/admin/receivables/batchImport",
  632. data: {
  633. mergeStatus: this.state.mergeStatus,
  634. },
  635. success: function (data) {
  636. if (data.error && data.error.length) {
  637. message.warning(data.error[0].message);
  638. } else {
  639. message.success("合并成功!请在收款列表中,查看已收款情况。");
  640. this.setState({
  641. mergeModal: false
  642. });
  643. }
  644. }.bind(this)
  645. }).always(
  646. function () {
  647. this.loadData();
  648. this.state.pagination.pageSize = 10
  649. this.state.selectedRowKeys = []
  650. this.setState({
  651. selectedRowKeys: this.state.selectedRowKeys,
  652. pagination: this.state.pagination,
  653. mergeModal: false,
  654. confirmLoading: false,
  655. })
  656. // window.location.reload();
  657. }.bind(this)
  658. );
  659. // message.success("合并成功!请在收款列表中,查看已收款情况。");
  660. },
  661. addModal() {
  662. this.state.modalData = {}
  663. this.setState({
  664. modalData: this.state.modalData,
  665. visible: true,
  666. choose: false
  667. })
  668. },
  669. download() {
  670. window.location.href =
  671. globalConfig.context +
  672. "/api/admin/receivables/downloadTemplate?" +
  673. "sign=receivbles_template";
  674. },
  675. // daoHui() {
  676. // window.location.href =
  677. // globalConfig.context +
  678. // "/api/admin/receivables/exportReceivables"
  679. // },
  680. // 添加至待合并库
  681. waitingMerge() {
  682. this.setState({
  683. confirmLoading: true
  684. })
  685. let ids = this.state.selectedRowKeys.join(",")
  686. $.ajax({
  687. method: "POST",
  688. dataType: "json",
  689. crossDomain: false,
  690. url: globalConfig.context + "/api/admin/receivables/waitingMerge",
  691. data: {
  692. ids,
  693. },
  694. success: function (data) {
  695. if (data.error && data.error.length) {
  696. message.warning(data.error[0].message);
  697. } else {
  698. message.success("添加成功!");
  699. this.setState({
  700. mergeModal: false
  701. });
  702. }
  703. }.bind(this)
  704. }).always(
  705. function () {
  706. this.loadData();
  707. this.state.selectedRowKeys = []
  708. this.setState({
  709. selectedRowKeys: this.state.selectedRowKeys,
  710. confirmLoading: false,
  711. })
  712. }.bind(this)
  713. );
  714. },
  715. // 匹配客户
  716. matchingUser(user) {
  717. this.setState({
  718. loading: true
  719. });
  720. $.ajax({
  721. method: "get",
  722. dataType: "json",
  723. crossDomain: false,
  724. url: globalConfig.context + "/api/admin/receivables/matchingUser",
  725. data: {
  726. value: user
  727. },
  728. success: function (data) {
  729. if (data.error && data.error.length) {
  730. message.warning(data.error[0].message);
  731. } else {
  732. this.setState({
  733. matching: "orderno",
  734. matchList: data.data,
  735. })
  736. }
  737. }.bind(this)
  738. }).always(
  739. function () {
  740. this.setState({
  741. loading: false
  742. });
  743. }.bind(this)
  744. );
  745. },
  746. // 匹配订单
  747. matchingOrderNo(orderno) {
  748. this.setState({
  749. loading: true
  750. });
  751. $.ajax({
  752. method: "get",
  753. dataType: "json",
  754. crossDomain: false,
  755. url: globalConfig.context + "/api/admin/receivables/matchingOrderNo",
  756. data: {
  757. value: orderno
  758. },
  759. success: function (data) {
  760. if (data.error && data.error.length) {
  761. message.warning(data.error[0].message);
  762. } else {
  763. this.setState({
  764. matching: "name",
  765. matchList: data.data,
  766. })
  767. }
  768. }.bind(this)
  769. }).always(
  770. function () {
  771. this.setState({
  772. loading: false
  773. });
  774. }.bind(this)
  775. );
  776. },
  777. selCancel() {
  778. this.setState({
  779. matching: "",
  780. })
  781. },
  782. render() {
  783. var departmentArr = this.state.departmentArr || [];
  784. const { loading, selectedRowKeys, visible } = this.state;
  785. const rowSelection = {
  786. selectedRowKeys,
  787. onChange: this.onSelectChange,
  788. hideDefaultSelections: true
  789. };
  790. const radioStyle = {
  791. display: "flex",
  792. flexDirection: "row",
  793. alignItems: "center",
  794. justifyContent: "space-between",
  795. padding: "5px",
  796. height: '30px',
  797. lineHeight: '30px',
  798. fontSize: "14px",
  799. borderBottom: "1px solid #e9e9e9",
  800. };
  801. var departmentArr = this.state.departmentArr || [];
  802. return (
  803. <div className="user-content" style={{ position: "relative" }}>
  804. <div className="content-title" style={{ marginBottom: 10 }}>
  805. <span style={{ fontWeight: 900, fontSize: 16 }}>
  806. 批量回款
  807. </span>
  808. </div>
  809. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  810. <TabPane tab="搜索" key="1">
  811. <div className="user-search" style={{ marginLeft: 10 }}>
  812. <Input
  813. placeholder="订单编号"
  814. value={this.state.orderNoSearch}
  815. onChange={e => {
  816. this.setState({ orderNoSearch: e.target.value });
  817. }}
  818. />
  819. <Input
  820. placeholder="合同编号"
  821. value={this.state.nameSearch}
  822. onChange={e => {
  823. this.setState({ nameSearch: e.target.value });
  824. }}
  825. />
  826. <Input
  827. placeholder="客户名称"
  828. value={this.state.nickname}
  829. onChange={e => {
  830. this.setState({ nickname: e.target.value });
  831. }}
  832. />
  833. <Select
  834. placeholder="状态"
  835. style={{ width: 150, marginRight: 10 }}
  836. value={this.state.statusSearch}
  837. onChange={e => {
  838. this.setState({ statusSearch: e });
  839. // console.log("状态", e);
  840. }}
  841. >
  842. <Select.Option key={0}>正常</Select.Option>
  843. <Select.Option key={1}>重复</Select.Option>
  844. <Select.Option key={2}>异常</Select.Option>
  845. </Select>
  846. <Input
  847. placeholder="订单负责人"
  848. value={this.state.adminName}
  849. onChange={e => {
  850. this.setState({ adminName: e.target.value });
  851. }}
  852. />
  853. <Cascaders
  854. ref={node => this.Cascaders1 = node}
  855. placeholder="订单所属部门"
  856. id="id"
  857. name="name"
  858. children="list"
  859. height={28}
  860. onSel={(e) => {
  861. this.setState({
  862. orderDeps: JSON.stringify(e),
  863. })
  864. }}
  865. />
  866. {/* <Select
  867. placeholder="订单所属部门"
  868. style={{ width: 150, marginRight: 10 }}
  869. value={this.state.orderBranch}
  870. onChange={e => {
  871. this.setState({ orderBranch: e });
  872. }}
  873. >
  874. {departmentArr.map(function (item) {
  875. return (
  876. <Select.Option key={item.id}>{item.name}</Select.Option>
  877. );
  878. })}
  879. </Select> */}
  880. <Cascaders
  881. ref={node => this.Cascaders2 = node}
  882. placeholder="负责人所属部门"
  883. id="id"
  884. name="name"
  885. children="list"
  886. height={28}
  887. onSel={(e) => {
  888. this.setState({
  889. adminDeps: JSON.stringify(e),
  890. })
  891. }}
  892. />
  893. {/* <Select
  894. placeholder="负责人所属部门"
  895. style={{ width: 150, marginRight: 10 }}
  896. value={this.state.principalList}
  897. onChange={e => {
  898. this.setState({ principalList: e });
  899. }}
  900. >
  901. {departmentArr.map(function (item) {
  902. return (
  903. <Select.Option key={item.id}>{item.name}</Select.Option>
  904. );
  905. })}
  906. </Select> */}
  907. <Input
  908. placeholder="付款方"
  909. value={this.state.payFrom}
  910. onChange={e => {
  911. this.setState({ payFrom: e.target.value });
  912. }}
  913. />
  914. <Button
  915. type="primary"
  916. onClick={this.search}
  917. style={{ marginLeft: 10 }}
  918. >
  919. 搜索
  920. </Button>
  921. <Button onClick={this.reset}>重置</Button>
  922. </div>
  923. </TabPane>
  924. <TabPane tab="更改表格显示数据" key="2">
  925. <div style={{ marginLeft: 10 }}>
  926. <ChooseList
  927. columns={this.state.columns}
  928. changeFn={this.changeList}
  929. changeList={this.state.changeList}
  930. top={55}
  931. margin={11}
  932. display={"inline-block"}
  933. style={{ marginBottom: 17 }}
  934. />
  935. </div>
  936. </TabPane>
  937. <TabPane tab="操作" key="3">
  938. <div
  939. class={123}
  940. style={{
  941. position: "relative",
  942. top: 10,
  943. left: 10,
  944. // zIndex: 99,
  945. // left: 400,
  946. // transform: "translateX(-50%)",
  947. display: "inline-block",
  948. width: 122,
  949. height: 28,
  950. overflow: "hidden"
  951. }}
  952. >
  953. <Upload {...this.state.upLoad}>
  954. <Button
  955. type="primary"
  956. disabled={this.state.mergeStatus == 1 || this.state.dataSource.length != 0 || this.props.look}
  957. >
  958. <Icon type="upload" />
  959. 导入回款列表
  960. </Button>
  961. </Upload>
  962. </div>
  963. <Button
  964. type="primary"
  965. style={{ marginBottom: 11, marginLeft: 25 }}
  966. onClick={this.download}
  967. >
  968. 下载回款列表模板
  969. </Button>
  970. {/* <Button
  971. type="primary"
  972. style={{ marginBottom: 20, marginLeft: 15 }}
  973. onClick={this.daoHui}
  974. >
  975. 导出回款列表
  976. </Button> */}
  977. <Button
  978. type="primary"
  979. style={{ marginBottom: 11, marginLeft: 15 }}
  980. disabled={this.state.selectedRowKeys.length == 1 ? false : true}
  981. onClick={this.showModal}
  982. >
  983. 修改单条数据
  984. </Button>
  985. <Button
  986. type="primary"
  987. style={{ marginBottom: 11, marginLeft: 15 }}
  988. disabled={this.state.mergeStatus == 1}
  989. onClick={this.addModal}
  990. >
  991. 添加单条数据
  992. </Button>
  993. <Popconfirm
  994. placement="top"
  995. title={"您确定要删除选中项的回款信息吗?删除后,不可以恢复!"}
  996. onConfirm={this.delChecked}
  997. okText="确定"
  998. cancelText="取消"
  999. >
  1000. <Button
  1001. primary
  1002. type="danger"
  1003. style={{ marginBottom: 11, marginLeft: 15 }}
  1004. disabled={this.state.selectedRowKeys.length > 0 ? false : true}
  1005. >
  1006. 删除选中项
  1007. </Button>
  1008. </Popconfirm>
  1009. <Popconfirm
  1010. placement="top"
  1011. title={"您确定要删除全部的回款信息吗?删除后,不可以恢复!"}
  1012. onConfirm={this.delAllChecked}
  1013. okText="确定"
  1014. cancelText="取消"
  1015. >
  1016. <Button
  1017. type="danger"
  1018. style={{ marginBottom: 11, marginLeft: 15 }}
  1019. disabled={this.state.dataSource.length == 0}
  1020. >
  1021. 删除全部
  1022. </Button>
  1023. </Popconfirm>
  1024. <Button
  1025. type="danger"
  1026. style={{ marginBottom: 11, marginLeft: 15 }}
  1027. disabled={this.state.dataSource.length == 0 || this.props.look}
  1028. onClick={e => {
  1029. this.loadData(1, 100);
  1030. this.setState({
  1031. mergeModal: true
  1032. });
  1033. }}
  1034. >
  1035. 确认合并回款
  1036. </Button>
  1037. <Button
  1038. type="danger"
  1039. style={{ marginBottom: 11, marginLeft: 15 }}
  1040. disabled={this.state.dataSource.length == 0}
  1041. onClick={e => {
  1042. this.setState({
  1043. selectedRowKeys: []
  1044. });
  1045. }}
  1046. >
  1047. 重置选项
  1048. </Button>
  1049. <Button
  1050. type="primary"
  1051. style={{ marginBottom: 11, marginLeft: 15 }}
  1052. disabled={(this.state.mergeStatus == 1) || (this.state.selectedRowKeys.length > 0 ? false : true)}
  1053. onClick={this.waitingMerge}
  1054. >
  1055. 添加至待合并库
  1056. </Button>
  1057. <Button
  1058. type="primary"
  1059. style={{ marginBottom: 11, marginLeft: 15 }}
  1060. onClick={() => {
  1061. this.setState({
  1062. mergeStatus: this.state.mergeStatus == 0 ? 1 : 0
  1063. }, () => {
  1064. this.loadData()
  1065. })
  1066. }}
  1067. >
  1068. {this.state.mergeStatus == 0 ? "切换至待合并库列表" : "切换至正常库列表"}
  1069. </Button>
  1070. </TabPane>
  1071. </Tabs>
  1072. <div
  1073. style={{ marginBottom: 10, fontSize: 16 }}
  1074. >{this.state.mergeStatus == 0 ? "正常库列表" : "待合并列表"}</div>
  1075. <div className="patent-table" style={{ position: "relative" }}>
  1076. <Spin spinning={this.state.loading}>
  1077. <Table
  1078. columns={
  1079. this.state.changeList == undefined
  1080. ? this.state.columns
  1081. : this.state.changeList
  1082. }
  1083. scroll={{ x: "max-content" }}
  1084. dataSource={this.state.dataSource}
  1085. pagination={this.state.pagination}
  1086. rowSelection={rowSelection}
  1087. onRowDoubleClick={this.tableRowClick.bind(this)}
  1088. bordered
  1089. size="small"
  1090. />
  1091. </Spin>
  1092. <p
  1093. style={{ display: "inline-block", fontSize: "14px", color: "red" }}
  1094. >
  1095. {
  1096. <span style={{ marginRight: 10 }}>
  1097. {`回款金额总计(万元):${this.state.hui ? this.state.hui : "0"}`}
  1098. </span>
  1099. }
  1100. {
  1101. <span>
  1102. {`合同额总计(万元):${this.state.totalHui ? this.state.totalHui : "0"}`}
  1103. </span>
  1104. }
  1105. </p>
  1106. </div>
  1107. <Modal
  1108. width={500}
  1109. visible={visible}
  1110. title="收款记录"
  1111. onOk={this.handleOk}
  1112. onCancel={this.handleCancel}
  1113. footer={[
  1114. <Button key="back" onClick={this.handleCancel}>
  1115. 取消
  1116. </Button>,
  1117. <Button
  1118. key="submit"
  1119. type="primary"
  1120. loading={loading}
  1121. disabled={this.props.look}
  1122. onClick={this.handleOk}
  1123. >
  1124. 保存
  1125. </Button>
  1126. ]}
  1127. >
  1128. <p
  1129. style={{
  1130. marginBottom: 10,
  1131. display: this.state.choose ? "block" : "none"
  1132. }}
  1133. >
  1134. <FormItem
  1135. // className="half-item"
  1136. {...formItemLayout}
  1137. label="合同编号"
  1138. >
  1139. <Input
  1140. style={{ width: 180 }}
  1141. disabled={this.state.choose}
  1142. value={this.state.modalData.contractNo}
  1143. onChange={e => {
  1144. let val = e.target.value;
  1145. this.state.modalData.contractNo = val;
  1146. this.setState({ modalData: this.state.modalData });
  1147. }}
  1148. />
  1149. </FormItem>
  1150. </p>
  1151. <p style={{ marginBottom: 10 }}>
  1152. <FormItem
  1153. // className="half-item"
  1154. {...formItemLayout}
  1155. label="订单编号"
  1156. >
  1157. <Input
  1158. style={{ width: 180 }}
  1159. value={this.state.modalData.orderNo}
  1160. onChange={e => {
  1161. let val = e.target.value;
  1162. this.state.modalData.orderNo = val;
  1163. this.setState({ modalData: this.state.modalData });
  1164. }}
  1165. />
  1166. {
  1167. this.state.modalData.corporateName != undefined &&
  1168. <Button
  1169. type="primary"
  1170. style={{ marginLeft: 15 }}
  1171. onClick={() => { this.matchingUser(this.state.modalData.corporateName) }}
  1172. >
  1173. 智能匹配
  1174. </Button>
  1175. }
  1176. </FormItem>
  1177. </p>
  1178. <p style={{ marginBottom: 10 }}>
  1179. <FormItem
  1180. // className="half-item"
  1181. {...formItemLayout}
  1182. label="流水编号"
  1183. >
  1184. <Input
  1185. style={{ width: 180 }}
  1186. value={this.state.modalData.financialPayNo}
  1187. onChange={e => {
  1188. let val = e.target.value;
  1189. this.state.modalData.financialPayNo = val;
  1190. this.setState({ modalData: this.state.modalData });
  1191. }}
  1192. />
  1193. </FormItem>
  1194. </p>
  1195. <p style={{ marginBottom: 10 }}>
  1196. <FormItem
  1197. // className="half-item"
  1198. {...formItemLayout}
  1199. label="付款方"
  1200. >
  1201. <Input
  1202. style={{ width: 180 }}
  1203. value={this.state.modalData.corporateName}
  1204. onChange={e => {
  1205. let val = e.target.value;
  1206. this.state.modalData.corporateName = val;
  1207. this.setState({ modalData: this.state.modalData });
  1208. }}
  1209. />
  1210. {
  1211. this.state.modalData.orderNo != undefined &&
  1212. <Button
  1213. type="primary"
  1214. style={{ marginLeft: 15 }}
  1215. onClick={() => { this.matchingOrderNo(this.state.modalData.orderNo) }}
  1216. >
  1217. 智能匹配
  1218. </Button>
  1219. }
  1220. </FormItem>
  1221. </p>
  1222. <p
  1223. style={{
  1224. marginBottom: 10,
  1225. display: this.state.choose ? "block" : "none"
  1226. }}
  1227. >
  1228. <FormItem
  1229. // className="half-item"
  1230. {...formItemLayout}
  1231. label="客户名称"
  1232. >
  1233. <Input
  1234. style={{ width: 180 }}
  1235. disabled={this.state.choose}
  1236. value={this.state.modalData.nickname}
  1237. onChange={e => {
  1238. let val = e.target.value;
  1239. this.state.modalData.nickname = val;
  1240. this.setState({ modalData: this.state.modalData });
  1241. }}
  1242. />
  1243. </FormItem>
  1244. </p>
  1245. <p
  1246. style={{
  1247. marginBottom: 10,
  1248. display: this.state.choose ? "block" : "none"
  1249. }}
  1250. >
  1251. <FormItem
  1252. // className="half-item"
  1253. {...formItemLayout}
  1254. label="合同额(万元)"
  1255. >
  1256. <Input
  1257. style={{
  1258. width: 180,
  1259. display: this.state.choose ? "inline-block" : "none"
  1260. }}
  1261. disabled={this.state.choose}
  1262. value={this.state.modalData.totalAmount}
  1263. onChange={e => {
  1264. let val = e.target.value;
  1265. this.state.modalData.totalAmount = val;
  1266. this.setState({ modalData: this.state.modalData });
  1267. }}
  1268. />
  1269. </FormItem>
  1270. </p>
  1271. <p style={{ marginBottom: 10 }}>
  1272. <FormItem
  1273. // className="half-item"
  1274. {...formItemLayout}
  1275. label="本次回款(万元)"
  1276. >
  1277. <Input
  1278. style={{ width: 180 }}
  1279. value={this.state.modalData.amount}
  1280. onChange={e => {
  1281. let val = e.target.value;
  1282. this.state.modalData.amount = val;
  1283. this.setState({ modalData: this.state.modalData });
  1284. }}
  1285. />
  1286. </FormItem>
  1287. </p>
  1288. <p style={{ marginBottom: 10 }}>
  1289. <FormItem
  1290. // className="half-item"
  1291. {...formItemLayout}
  1292. label="回款时间"
  1293. >
  1294. <DatePicker
  1295. style={{ width: 180 }}
  1296. showTime
  1297. placeholder="选择回款时间"
  1298. value={
  1299. this.state.modalData.receivablesTimes
  1300. ? moment(this.state.modalData.receivablesTimes, "YYYY-MM-DD")
  1301. : ""
  1302. }
  1303. onChange={(v, e) => {
  1304. this.state.modalData.receivablesTimes = e;
  1305. this.setState({ modalData: this.state.modalData });
  1306. }}
  1307. onOk={() => { }}
  1308. />
  1309. </FormItem>
  1310. </p>
  1311. <p
  1312. style={{
  1313. marginBottom: 10,
  1314. display: this.state.choose ? "block" : "none"
  1315. }}
  1316. >
  1317. <FormItem
  1318. // className="half-item"
  1319. {...formItemLayout}
  1320. label="批量导入时间"
  1321. >
  1322. <Input
  1323. style={{ width: 180 }}
  1324. value={this.state.modalData.createTimes}
  1325. disabled
  1326. onChange={e => {
  1327. let val = e.target.value;
  1328. this.state.modalData.createTimes = val;
  1329. this.setState({ modalData: this.state.modalData });
  1330. }}
  1331. />
  1332. </FormItem>
  1333. </p>
  1334. <p style={{ marginBottom: 10 }}>
  1335. <FormItem
  1336. // className="half-item"
  1337. {...formItemLayout}
  1338. label="备注"
  1339. >
  1340. <TextArea
  1341. // style={{ width: 180, maxWidth: 180 }}
  1342. value={this.state.modalData.remarks}
  1343. onChange={e => {
  1344. this.state.modalData.remarks = e.target.value;
  1345. this.setState({ modalData: this.state.modalData });
  1346. }}
  1347. placeholder="请输入备注信息"
  1348. autosize={{ minRows: 3, maxRows: 5 }}
  1349. />
  1350. </FormItem>
  1351. </p>
  1352. </Modal>
  1353. <Modal
  1354. title="确认合并列表"
  1355. visible={this.state.mergeModal}
  1356. width={1300}
  1357. onOk={this.mergeAll}
  1358. confirmLoading={this.state.confirmLoading}
  1359. onCancel={() => {
  1360. this.setState({
  1361. mergeModal: false
  1362. });
  1363. }}
  1364. >
  1365. <div className="patent-table" style={{ position: "relative" }}>
  1366. <Spin spinning={this.state.loading}>
  1367. <Table
  1368. columns={this.state.columns}
  1369. scroll={{ x: "max-content" }}
  1370. dataSource={this.state.dataSource}
  1371. bordered
  1372. size="small"
  1373. pagination={this.state.paginationModal}
  1374. />
  1375. </Spin>
  1376. <p
  1377. style={{
  1378. display: "inline-block",
  1379. fontSize: "14px",
  1380. color: "red"
  1381. }}
  1382. >
  1383. {
  1384. <span style={{ marginRight: 10 }}>
  1385. {`回款金额总计(万元):${this.state.hui ? this.state.hui : "0"}`}
  1386. </span>
  1387. }
  1388. {
  1389. <span>
  1390. {`合同额总计(万元):${this.state.totalHui ? this.state.totalHui : "0"}`}
  1391. </span>
  1392. }
  1393. </p>
  1394. </div>
  1395. </Modal>
  1396. {
  1397. this.state.matching != "" &&
  1398. <Modal
  1399. title="请选择"
  1400. width={400}
  1401. visible={this.state.matching != ""}
  1402. onCancel={this.selCancel}
  1403. footer=""
  1404. >
  1405. <div>
  1406. {
  1407. this.state.matchList.map(item =>
  1408. <div
  1409. style={radioStyle}
  1410. key={this.state.matching == "name" ? item.uid : item.orderNo}
  1411. >
  1412. {this.state.matching == "name" ? item.userName : item.orderNo}
  1413. <Button
  1414. type="primary"
  1415. size="small"
  1416. onClick={() => {
  1417. this.state.modalData.corporateName = item.userName;
  1418. this.state.modalData.nickname = item.userName;
  1419. this.state.modalData.orderNo = item.orderNo;
  1420. this.setState({
  1421. matching: "",
  1422. modalData: this.state.modalData,
  1423. })
  1424. }}
  1425. >确定</Button>
  1426. </div>
  1427. )
  1428. }
  1429. </div>
  1430. </Modal>
  1431. }
  1432. </div>
  1433. );
  1434. }
  1435. });
  1436. export default HuiKuan;