order.jsx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. import React, { Component } from "react";
  2. import {
  3. Button,
  4. Form,
  5. Input,
  6. message,
  7. Spin,
  8. Select,
  9. Tabs,
  10. Table,
  11. Modal,
  12. } from "antd";
  13. import $ from "jquery/src/ajax";
  14. import { ChooseList } from "../../../manageCenter/order/orderNew/chooseList";
  15. import OrderDetail from "../orderNew/changeComponent/orderDetail";
  16. import OrderRiZi from "@/orderRiZi.jsx";
  17. import {
  18. getProcessStatus,
  19. getLiquidationStatus,
  20. getNewOrderStatus,
  21. ShowModal,
  22. } from "@/tools.js";
  23. const { TabPane } = Tabs;
  24. const FormItem = Form.Item;
  25. const Option = Select.Option;
  26. class OrderList extends Component {
  27. constructor(props) {
  28. super(props);
  29. this.state = {
  30. onelist: [
  31. {
  32. value: "0",
  33. label: "首付待付请",
  34. },
  35. {
  36. value: "1",
  37. label: "尾款待付清",
  38. },
  39. {
  40. value: "2",
  41. label: "已付请",
  42. },
  43. ],
  44. twolist: [
  45. {
  46. value: "0",
  47. label: "非特批",
  48. },
  49. {
  50. value: "1",
  51. label: "特批",
  52. },
  53. ],
  54. threelist: [
  55. {
  56. value: "0",
  57. label: "10万元以下",
  58. },
  59. {
  60. value: "1",
  61. label: "10万~20万",
  62. },
  63. {
  64. value: "2",
  65. label: "20万~30万",
  66. },
  67. {
  68. value: "3",
  69. label: "30万~40万",
  70. },
  71. {
  72. value: "4",
  73. label: "40万以上",
  74. },
  75. ],
  76. columns: [
  77. {
  78. title: "合同编号",
  79. dataIndex: "contractNo",
  80. key: "contractNo",
  81. },
  82. {
  83. title: "订单编号",
  84. dataIndex: "orderNo",
  85. key: "orderNo",
  86. },
  87. {
  88. title: "客户名称",
  89. dataIndex: "userName",
  90. key: "userName",
  91. },
  92. {
  93. title: "订单部门",
  94. dataIndex: "depName",
  95. key: "depName",
  96. },
  97. {
  98. title: "下单时间",
  99. dataIndex: "createDate",
  100. key: "createDate",
  101. },
  102. {
  103. title: "合同签订时间",
  104. dataIndex: "signDate",
  105. key: "signDate",
  106. },
  107. {
  108. title: "流程状态",
  109. dataIndex: "processStatus",
  110. key: "processStatus",
  111. render: (text, record) =>
  112. <span >
  113. {getProcessStatus(text)}
  114. </span>
  115. },
  116. {
  117. title: "签单金额(万元)",
  118. dataIndex: "totalAmount",
  119. key: "totalAmount",
  120. render: (text, record) =>
  121. <span >
  122. {text}
  123. </span>
  124. },
  125. {
  126. title: "开单金额(万元)",
  127. dataIndex: "invoiceAmount",
  128. key: "invoiceAmount",
  129. render: (text, record) =>
  130. <span >
  131. {text}
  132. </span>
  133. },
  134. {
  135. title: "已收款(万元)",
  136. dataIndex: "settlementAmount",
  137. key: "settlementAmount",
  138. render: (text, record) =>
  139. <span >
  140. {text}
  141. </span>
  142. },
  143. {
  144. title: "结算状态",
  145. dataIndex: "liquidationStatus",
  146. key: "liquidationStatus",
  147. render: (text, record) =>
  148. <span >
  149. {getLiquidationStatus(text)}
  150. </span>
  151. },
  152. {
  153. title: "是否特批",
  154. dataIndex: "approval",
  155. key: "approval",
  156. render: (text, record) =>
  157. <span >
  158. {["非特批", "特批", "特批通过"][text]}
  159. </span>
  160. },
  161. {
  162. title: "订单状态",
  163. dataIndex: "orderStatus",
  164. key: "orderStatus",
  165. render: (text, record) =>
  166. <span >
  167. {getNewOrderStatus(text)}
  168. </span>
  169. },
  170. ],
  171. pagination: {
  172. defaultCurrent: 1,
  173. defaultPageSize: 10,
  174. showQuickJumper: true,
  175. pageSize: 10,
  176. onChange: function (page) {
  177. this.loadData(page);
  178. }.bind(this),
  179. showTotal: function (total) {
  180. return "共" + total + "条数据";
  181. },
  182. },
  183. loading: false,
  184. changeList: undefined,
  185. searchValues: {},
  186. dataSource: [],
  187. details: false,
  188. orderData: {},
  189. };
  190. }
  191. changeList(arr) {
  192. const newArr = [];
  193. this.state.columns.forEach((item) => {
  194. arr.forEach((val) => {
  195. if (val === item.title) {
  196. newArr.push(item);
  197. }
  198. });
  199. });
  200. this.setState({
  201. changeList: newArr,
  202. });
  203. }
  204. // 重置
  205. resetAll() {
  206. this.setState(
  207. {
  208. searchValues: JSON.parse(JSON.stringify({})),
  209. selectedRowKeys: [],
  210. },
  211. () => {
  212. this.loadData();
  213. }
  214. );
  215. }
  216. // 列表接口
  217. loadData(pageNo) {
  218. const { searchValues, pagination } = this.state;
  219. this.setState({
  220. loading: true,
  221. });
  222. let prs = this.props.data;
  223. prs.pageNo = pageNo || 1;
  224. prs.pageSize = pagination.pageSize;
  225. let datas = Object.assign(searchValues, prs);
  226. $.ajax({
  227. method: "get",
  228. dataType: "json",
  229. crossDomain: false,
  230. url: globalConfig.context + "/api/admin/newOrder/statistics/orderList",
  231. data: datas,
  232. success: function (data) {
  233. ShowModal(this);
  234. this.setState({
  235. loading: false,
  236. });
  237. if (data.error && data.error.length === 0) {
  238. if (data.data.list) {
  239. pagination.current = data.data.pageNo;
  240. pagination.total = data.data.totalCount;
  241. if (data.data && data.data.list && !data.data.list.length) {
  242. pagination.current = 0;
  243. pagination.total = 0;
  244. }
  245. this.setState({
  246. dataSource: data.data.list,
  247. pagination: this.state.pagination,
  248. pageNo: data.data.pageNo,
  249. });
  250. } else {
  251. this.setState({
  252. dataSource: data.data,
  253. pagination: false,
  254. });
  255. }
  256. } else {
  257. message.warning(data.error[0].message);
  258. }
  259. }.bind(this),
  260. }).always(
  261. function () {
  262. this.setState({
  263. loading: false,
  264. });
  265. }.bind(this)
  266. );
  267. }
  268. //订单详情
  269. xiangqing(orderNos) {
  270. this.setState({
  271. loading: true
  272. })
  273. $.ajax({
  274. method: "get",
  275. dataType: "json",
  276. crossDomain: false,
  277. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  278. data: {
  279. orderNo: orderNos
  280. },
  281. success: function (data) {
  282. this.setState({
  283. loading: false
  284. })
  285. if (data.error.length || data.data.list == "") {
  286. if (data.error && data.error.length) {
  287. message.warning(data.error[0].message);
  288. }
  289. } else {
  290. let thisdata = data.data;
  291. this.setState(
  292. {
  293. orderUid: thisdata.uid,
  294. userName: thisdata.userName,
  295. primaryOrderNo: thisdata.primaryOrder,
  296. additionalOrder: thisdata.additionalOrder,
  297. contractNo: thisdata.contractNo,
  298. // arrears: thisdata.arrears,
  299. orderData: thisdata,
  300. isAddition: thisdata.additionalOrder ? true : false,
  301. },
  302. () => {
  303. if (this.state.orderData.deleteSign !== 3) {
  304. this.jiedianNew(this.state.orderNo);
  305. }
  306. }
  307. );
  308. }
  309. }.bind(this)
  310. }).always(
  311. function () {
  312. this.setState({
  313. loading: false,
  314. });
  315. }.bind(this)
  316. );
  317. }
  318. createTabs(orderNos) {
  319. $.ajax({
  320. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  321. method: "get",
  322. data: {
  323. orderNo: orderNos
  324. },
  325. success: (data) => {
  326. if (data.error && data.error.length) {
  327. message.warning(data.error[0].message)
  328. } else {
  329. this.setState({
  330. tabList: data.data
  331. })
  332. }
  333. }
  334. });
  335. }
  336. //整行点击
  337. tableRowClick(record) {
  338. this.setState(
  339. {
  340. details: true,
  341. orderNo: record.orderNo
  342. },
  343. () => {
  344. this.xiangqing(record.orderNo)
  345. this.createTabs(record.orderNo)
  346. }
  347. );
  348. }
  349. jiedianNew(orderNos) {
  350. $.ajax({
  351. method: "get",
  352. dataType: "json",
  353. crossDomain: false,
  354. url:
  355. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  356. data: {
  357. orderNo: orderNos
  358. },
  359. success: function (data) {
  360. if (data.error && data.error.length) {
  361. message.warning(data.error[0].message);
  362. } else {
  363. let theArr = [];
  364. let thisData = [];
  365. let arr = data.data || [];
  366. let totalCui = 0;
  367. for (let i = 0; i < arr.length; i++) {
  368. thisData = arr[i];
  369. totalCui += +thisData.money;
  370. theArr.push({
  371. key: i,
  372. dunSubject: thisData.dunSubject
  373. ? thisData.dunSubject.toString()
  374. : "", //催款科目
  375. id: thisData.id, //节点Id
  376. money: thisData.money, //催款金额
  377. commodityName: thisData.commodityName,
  378. projectType: thisData.projectType,
  379. dunTypeName: thisData.dunTypeName,
  380. status: thisData.status,
  381. waitDay: thisData.waitDay,
  382. effectiveCount: thisData.effectiveCount,
  383. startDate: thisData.startDate,
  384. dunType: thisData.dunType,
  385. appropriationRatio: thisData.appropriationRatio,
  386. customizeName: thisData.customizeName,
  387. customizeTimes: thisData.customizeTimes,
  388. tid: thisData.tid,
  389. });
  390. }
  391. if (!totalCui) {
  392. totalCui = 0;
  393. }
  394. totalCui = (Math.round(totalCui * 1000000) / 1000000).toFixed(6);
  395. this.setState({
  396. contactListNew: theArr,
  397. totalCui
  398. });
  399. }
  400. }.bind(this)
  401. }).always(
  402. function () {
  403. this.setState({
  404. loading: false
  405. });
  406. }.bind(this)
  407. );
  408. }
  409. closeDesc(e, s) {
  410. this.state.details = e;
  411. if (s) {
  412. this.loadData(this.state.pageNo);
  413. }
  414. }
  415. //查看订单日志
  416. getOrderLog() {
  417. this.setState({
  418. rizhivisible: true,
  419. });
  420. this.rizhi();
  421. }
  422. closeOrderLog() {
  423. this.setState({
  424. rizhivisible: false
  425. });
  426. }
  427. rizhi() {
  428. $.ajax({
  429. method: "get",
  430. dataType: "json",
  431. crossDomain: false,
  432. url: "/api/admin/newOrder/selectOrderLog",
  433. data: {
  434. orderNo: this.state.orderNo,
  435. },
  436. success: function (data) {
  437. let theArr = [];
  438. let thisData = data.data;
  439. if (!thisData.length) {
  440. if (data.error && data.error.length) {
  441. message.warning(data.error[0].message);
  442. }
  443. thisData = {};
  444. } else {
  445. for (let i = 0; i < data.data.length; i++) {
  446. let thisdata = data.data[i];
  447. theArr.push({
  448. processName: thisdata.processName,
  449. adminName: thisdata.adminName,
  450. createDate: thisdata.createDate,
  451. remarks: thisdata.remarks
  452. });
  453. }
  454. }
  455. this.setState({
  456. dataSourcerizhi: theArr
  457. });
  458. }.bind(this)
  459. });
  460. }
  461. //项目列表
  462. xiangmu(orderNos) {
  463. $.ajax({
  464. method: "get",
  465. dataType: "json",
  466. crossDomain: false,
  467. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  468. data: {
  469. orderNo: orderNos
  470. },
  471. success: function (data) {
  472. let theArr = [];
  473. if (data.error.length || data.data.list == "") {
  474. if (data.error && data.error.length) {
  475. message.warning(data.error[0].message);
  476. }
  477. } else {
  478. for (let i = 0; i < data.data.length; i++) {
  479. let thisdata = data.data[i];
  480. thisdata.key = i;
  481. thisdata.sort = thisdata.cSort;
  482. theArr.push(thisdata);
  483. }
  484. }
  485. this.setState({
  486. dataSourceX: theArr
  487. });
  488. }.bind(this)
  489. });
  490. }
  491. componentWillMount() {
  492. this.loadData();
  493. }
  494. render() {
  495. const { searchValues, onelist, twolist, threelist, columns, changeList, details } = this.state;
  496. return (
  497. <div className="user-content signatureStatistics">
  498. <Tabs defaultActiveKey="1">
  499. <TabPane tab="搜索" key="1">
  500. <div style={{ paddingTop: 10 }}>
  501. <Form layout="inline">
  502. <FormItem>
  503. <Input
  504. placeholder="请输入订单编号"
  505. value={searchValues["orderNo"]}
  506. onChange={(e) => {
  507. searchValues["orderNo"] = e.target.value
  508. this.setState({
  509. searchValues: searchValues,
  510. });
  511. }}
  512. />
  513. </FormItem>
  514. <FormItem>
  515. <Input
  516. placeholder="请输入客户姓名"
  517. value={searchValues["name"]}
  518. onChange={(e) => {
  519. searchValues["name"] = e.target.value
  520. this.setState({
  521. searchValues: searchValues,
  522. });
  523. }}
  524. />
  525. </FormItem>
  526. <FormItem>
  527. <Input
  528. placeholder="请输入合同编号"
  529. value={searchValues["contractNo"]}
  530. onChange={(e) => {
  531. searchValues["contractNo"] = e.target.value
  532. this.setState({
  533. searchValues: searchValues,
  534. });
  535. }}
  536. />
  537. </FormItem>
  538. <FormItem>
  539. <Select
  540. placeholder={"请选择结算状态"}
  541. style={{ width: 150 }}
  542. value={searchValues["liquidationStatus"]
  543. ? searchValues["liquidationStatus"]
  544. : undefined}
  545. onChange={(e) => {
  546. searchValues["liquidationStatus"] = e
  547. this.setState({
  548. searchValues: searchValues,
  549. });
  550. }}
  551. >
  552. {onelist.map((it, ins) => (
  553. <Option key={it.value}>{it.label}</Option>
  554. ))}
  555. </Select>
  556. </FormItem>
  557. <FormItem>
  558. <Select
  559. placeholder={"请选择特批状态"}
  560. style={{ width: 150 }}
  561. value={searchValues["approval"]
  562. ? searchValues["approval"]
  563. : undefined}
  564. onChange={(e) => {
  565. searchValues["approval"] = e
  566. this.setState({
  567. searchValues: searchValues,
  568. });
  569. }}
  570. >
  571. {twolist.map((it, ins) => (
  572. <Option key={it.value}>{it.label}</Option>
  573. ))}
  574. </Select>
  575. </FormItem>
  576. <FormItem>
  577. <Select
  578. placeholder={"请选择签单金额"}
  579. style={{ width: 150 }}
  580. value={searchValues["amountStatus"]
  581. ? searchValues["amountStatus"]
  582. : undefined}
  583. onChange={(e) => {
  584. searchValues["amountStatus"] = e
  585. this.setState({
  586. searchValues: searchValues,
  587. });
  588. }}
  589. >
  590. {threelist.map((it, ins) => (
  591. <Option key={it.value}>{it.label}</Option>
  592. ))}
  593. </Select>
  594. </FormItem>
  595. <Button
  596. type="primary"
  597. onClick={() => { this.loadData() }}
  598. style={{ marginRight: "10px" }}
  599. >
  600. 搜索
  601. </Button>
  602. <Button
  603. onClick={() => { this.resetAll() }}
  604. style={{ marginRight: "10px" }}
  605. >
  606. 重置
  607. </Button>
  608. </Form>
  609. </div>
  610. </TabPane>
  611. <TabPane tab="更改表格显示数据" key="2">
  612. <div style={{ marginLeft: 10 }}>
  613. <ChooseList
  614. columns={columns}
  615. changeFn={this.changeList.bind(this)}
  616. changeList={changeList}
  617. top={55}
  618. margin={11}
  619. />
  620. </div>
  621. </TabPane>
  622. </Tabs>
  623. <div className="patent-table">
  624. <Spin spinning={this.state.loading}>
  625. <Table
  626. bordered
  627. size="middle"
  628. columns={changeList ? changeList : columns}
  629. dataSource={this.state.dataSource}
  630. pagination={this.state.pagination}
  631. onRowClick={this.tableRowClick.bind(this)}
  632. />
  633. </Spin>
  634. </div>
  635. {
  636. details &&
  637. <Modal
  638. footer={null}
  639. width="900px"
  640. title="订单详情"
  641. visible={details}
  642. onCancel={() => {
  643. this.setState({
  644. details: false
  645. })
  646. }}
  647. >
  648. <Spin spinning={this.state.loading}>
  649. <OrderDetail
  650. domId='dindanxiangqing'
  651. orderUid={this.state.orderUid}
  652. orderData={this.state.orderData}
  653. getOrderLog={this.getOrderLog.bind(this)}
  654. totalCui={parseFloat(this.state.totalCui)}
  655. dataSourceX={this.state.dataSourceX}
  656. contactList={this.state.contactList}
  657. contactListNew={this.state.contactListNew}
  658. orderNo={this.state.orderNo}
  659. />
  660. </Spin>
  661. </Modal>
  662. }
  663. <OrderRiZi
  664. dataSourcerizhi={this.state.dataSourcerizhi}
  665. closeOrderLog={this.closeOrderLog.bind(this)}
  666. visible={this.state.rizhivisible}
  667. loading={this.state.loading}
  668. />
  669. </div>
  670. );
  671. }
  672. }
  673. export default OrderList;