order.jsx 18 KB

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