order.jsx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  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. //
  319. createTabs(orderNos) {
  320. $.ajax({
  321. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  322. method: "get",
  323. data: {
  324. orderNo: orderNos
  325. },
  326. success: (data) => {
  327. if (data.error && data.error.length) {
  328. message.warning(data.error[0].message)
  329. } else {
  330. this.setState({
  331. tabList: data.data
  332. })
  333. }
  334. }
  335. });
  336. }
  337. // 整行点击
  338. tableRowClick(record) {
  339. this.setState(
  340. {
  341. details: true,
  342. orderNo: record.orderNo
  343. },
  344. () => {
  345. this.xiangqing(record.orderNo)
  346. this.createTabs(record.orderNo)
  347. }
  348. );
  349. }
  350. //
  351. jiedianNew(orderNos) {
  352. $.ajax({
  353. method: "get",
  354. dataType: "json",
  355. crossDomain: false,
  356. url:
  357. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  358. data: {
  359. orderNo: orderNos
  360. },
  361. success: function (data) {
  362. if (data.error && data.error.length) {
  363. message.warning(data.error[0].message);
  364. } else {
  365. let theArr = [];
  366. let thisData = [];
  367. let arr = data.data || [];
  368. let totalCui = 0;
  369. for (let i = 0; i < arr.length; i++) {
  370. thisData = arr[i];
  371. totalCui += +thisData.money;
  372. theArr.push({
  373. key: i,
  374. dunSubject: thisData.dunSubject
  375. ? thisData.dunSubject.toString()
  376. : "", //催款科目
  377. id: thisData.id, //节点Id
  378. money: thisData.money, //催款金额
  379. commodityName: thisData.commodityName,
  380. projectType: thisData.projectType,
  381. dunTypeName: thisData.dunTypeName,
  382. status: thisData.status,
  383. waitDay: thisData.waitDay,
  384. effectiveCount: thisData.effectiveCount,
  385. startDate: thisData.startDate,
  386. dunType: thisData.dunType,
  387. appropriationRatio: thisData.appropriationRatio,
  388. customizeName: thisData.customizeName,
  389. customizeTimes: thisData.customizeTimes,
  390. tid: thisData.tid,
  391. });
  392. }
  393. if (!totalCui) {
  394. totalCui = 0;
  395. }
  396. totalCui = (Math.round(totalCui * 1000000) / 1000000).toFixed(6);
  397. this.setState({
  398. contactListNew: theArr,
  399. totalCui
  400. });
  401. }
  402. }.bind(this)
  403. }).always(
  404. function () {
  405. this.setState({
  406. loading: false
  407. });
  408. }.bind(this)
  409. );
  410. }
  411. //
  412. closeDesc() {
  413. this.setState({
  414. details: false
  415. })
  416. this.loadData(this.state.pageNo);
  417. }
  418. //查看订单日志
  419. getOrderLog() {
  420. this.setState({
  421. rizhivisible: true,
  422. });
  423. this.rizhi();
  424. }
  425. //
  426. closeOrderLog() {
  427. this.setState({
  428. rizhivisible: false
  429. });
  430. }
  431. // 日志
  432. rizhi() {
  433. $.ajax({
  434. method: "get",
  435. dataType: "json",
  436. crossDomain: false,
  437. url: "/api/admin/newOrder/selectOrderLog",
  438. data: {
  439. orderNo: this.state.orderNo,
  440. },
  441. success: function (data) {
  442. let theArr = [];
  443. let thisData = data.data;
  444. if (!thisData.length) {
  445. if (data.error && data.error.length) {
  446. message.warning(data.error[0].message);
  447. }
  448. thisData = {};
  449. } else {
  450. for (let i = 0; i < data.data.length; i++) {
  451. let thisdata = data.data[i];
  452. theArr.push({
  453. processName: thisdata.processName,
  454. adminName: thisdata.adminName,
  455. createDate: thisdata.createDate,
  456. remarks: thisdata.remarks
  457. });
  458. }
  459. }
  460. this.setState({
  461. dataSourcerizhi: theArr
  462. });
  463. }.bind(this)
  464. });
  465. }
  466. // 项目列表
  467. xiangmu(orderNos) {
  468. $.ajax({
  469. method: "get",
  470. dataType: "json",
  471. crossDomain: false,
  472. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  473. data: {
  474. orderNo: orderNos
  475. },
  476. success: function (data) {
  477. let theArr = [];
  478. if (data.error.length || data.data.list == "") {
  479. if (data.error && data.error.length) {
  480. message.warning(data.error[0].message);
  481. }
  482. } else {
  483. for (let i = 0; i < data.data.length; i++) {
  484. let thisdata = data.data[i];
  485. thisdata.key = i;
  486. thisdata.sort = thisdata.cSort;
  487. theArr.push(thisdata);
  488. }
  489. }
  490. this.setState({
  491. dataSourceX: theArr
  492. });
  493. }.bind(this)
  494. });
  495. }
  496. componentWillMount() {
  497. this.loadData();
  498. }
  499. render() {
  500. const { searchValues, onelist, twolist, threelist, columns, changeList, details } = this.state;
  501. return (
  502. <div className="user-content signatureStatistics">
  503. <Tabs defaultActiveKey="1">
  504. <TabPane tab="搜索" key="1">
  505. <div style={{ paddingTop: 10 }}>
  506. <Form layout="inline">
  507. <FormItem>
  508. <Input
  509. placeholder="请输入订单编号"
  510. value={searchValues["orderNo"]}
  511. onChange={(e) => {
  512. searchValues["orderNo"] = e.target.value
  513. this.setState({
  514. searchValues: searchValues,
  515. });
  516. }}
  517. />
  518. </FormItem>
  519. <FormItem>
  520. <Input
  521. placeholder="请输入客户姓名"
  522. value={searchValues["name"]}
  523. onChange={(e) => {
  524. searchValues["name"] = e.target.value
  525. this.setState({
  526. searchValues: searchValues,
  527. });
  528. }}
  529. />
  530. </FormItem>
  531. <FormItem>
  532. <Input
  533. placeholder="请输入合同编号"
  534. value={searchValues["contractNo"]}
  535. onChange={(e) => {
  536. searchValues["contractNo"] = e.target.value
  537. this.setState({
  538. searchValues: searchValues,
  539. });
  540. }}
  541. />
  542. </FormItem>
  543. <FormItem>
  544. <Select
  545. placeholder={"请选择结算状态"}
  546. style={{ width: 150 }}
  547. value={searchValues["liquidationStatus"]
  548. ? searchValues["liquidationStatus"]
  549. : undefined}
  550. onChange={(e) => {
  551. searchValues["liquidationStatus"] = e
  552. this.setState({
  553. searchValues: searchValues,
  554. });
  555. }}
  556. >
  557. {onelist.map((it, ins) => (
  558. <Option key={it.value}>{it.label}</Option>
  559. ))}
  560. </Select>
  561. </FormItem>
  562. <FormItem>
  563. <Select
  564. placeholder={"请选择特批状态"}
  565. style={{ width: 150 }}
  566. value={searchValues["approval"]
  567. ? searchValues["approval"]
  568. : undefined}
  569. onChange={(e) => {
  570. searchValues["approval"] = e
  571. this.setState({
  572. searchValues: searchValues,
  573. });
  574. }}
  575. >
  576. {twolist.map((it, ins) => (
  577. <Option key={it.value}>{it.label}</Option>
  578. ))}
  579. </Select>
  580. </FormItem>
  581. <FormItem>
  582. <Select
  583. placeholder={"请选择签单金额"}
  584. style={{ width: 150 }}
  585. value={searchValues["amountStatus"]
  586. ? searchValues["amountStatus"]
  587. : undefined}
  588. onChange={(e) => {
  589. searchValues["amountStatus"] = e
  590. this.setState({
  591. searchValues: searchValues,
  592. });
  593. }}
  594. >
  595. {threelist.map((it, ins) => (
  596. <Option key={it.value}>{it.label}</Option>
  597. ))}
  598. </Select>
  599. </FormItem>
  600. <Button
  601. type="primary"
  602. onClick={() => { this.loadData() }}
  603. style={{ marginRight: "10px" }}
  604. >
  605. 搜索
  606. </Button>
  607. <Button
  608. onClick={() => { this.resetAll() }}
  609. style={{ marginRight: "10px" }}
  610. >
  611. 重置
  612. </Button>
  613. </Form>
  614. </div>
  615. </TabPane>
  616. <TabPane tab="更改表格显示数据" key="2">
  617. <div style={{ marginLeft: 10 }}>
  618. <ChooseList
  619. columns={columns}
  620. changeFn={this.changeList.bind(this)}
  621. changeList={changeList}
  622. top={55}
  623. margin={11}
  624. />
  625. </div>
  626. </TabPane>
  627. </Tabs>
  628. <div className="patent-table">
  629. <Spin spinning={this.state.loading}>
  630. <Table
  631. bordered
  632. size="middle"
  633. columns={changeList ? changeList : columns}
  634. dataSource={this.state.dataSource}
  635. pagination={this.state.pagination}
  636. onRowClick={this.tableRowClick.bind(this)}
  637. />
  638. </Spin>
  639. </div>
  640. {
  641. details &&
  642. <Modal
  643. footer={null}
  644. width="900px"
  645. title="订单详情"
  646. visible={details}
  647. onCancel={this.closeDesc.bind(this)}
  648. >
  649. <Spin spinning={this.state.loading}>
  650. <OrderDetail
  651. domId='dindanxiangqing'
  652. orderUid={this.state.orderUid}
  653. orderData={this.state.orderData}
  654. getOrderLog={this.getOrderLog.bind(this)}
  655. totalCui={parseFloat(this.state.totalCui)}
  656. dataSourceX={this.state.dataSourceX}
  657. contactList={this.state.contactList}
  658. contactListNew={this.state.contactListNew}
  659. orderNo={this.state.orderNo}
  660. />
  661. </Spin>
  662. </Modal>
  663. }
  664. <OrderRiZi
  665. dataSourcerizhi={this.state.dataSourcerizhi}
  666. closeOrderLog={this.closeOrderLog.bind(this)}
  667. visible={this.state.rizhivisible}
  668. loading={this.state.loading}
  669. />
  670. </div>
  671. );
  672. }
  673. }
  674. export default OrderList;