order.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. import React, { Component } from "react";
  2. import TabelContent from "../../../common/tabelContent";
  3. import {
  4. Button,
  5. Form,
  6. Input,
  7. message,
  8. Spin,
  9. Select,
  10. Tabs,
  11. Table,
  12. } from "antd";
  13. import $ from "jquery/src/ajax";
  14. import moment from "moment";
  15. import { provinceSelect, getProvince } from "../../../NewDicProvinceList";
  16. import { ChooseList } from "../../../manageCenter/order/orderNew/chooseList";
  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. };
  188. }
  189. changeList(arr) {
  190. const newArr = [];
  191. this.state.columns.forEach((item) => {
  192. arr.forEach((val) => {
  193. if (val === item.title) {
  194. newArr.push(item);
  195. }
  196. });
  197. });
  198. this.setState({
  199. changeList: newArr,
  200. });
  201. }
  202. // 重置
  203. resetAll() {
  204. this.setState(
  205. {
  206. searchValues: JSON.parse(JSON.stringify({})),
  207. selectedRowKeys: [],
  208. },
  209. () => {
  210. this.loadData();
  211. }
  212. );
  213. }
  214. // 列表接口
  215. loadData(pageNo) {
  216. const { searchValues, pagination } = this.state;
  217. this.setState({
  218. loading: true,
  219. });
  220. let prs = this.props.data;
  221. prs.pageNo = pageNo || 1;
  222. prs.pageSize = pagination.pageSize;
  223. let datas = Object.assign(searchValues, prs);
  224. $.ajax({
  225. method: "get",
  226. dataType: "json",
  227. crossDomain: false,
  228. url: globalConfig.context + "/api/admin/newOrder/statistics/orderList",
  229. data: datas,
  230. success: function (data) {
  231. ShowModal(this);
  232. this.setState({
  233. loading: false,
  234. });
  235. if (data.error && data.error.length === 0) {
  236. if (data.data.list) {
  237. pagination.current = data.data.pageNo;
  238. pagination.total = data.data.totalCount;
  239. if (data.data && data.data.list && !data.data.list.length) {
  240. pagination.current = 0;
  241. pagination.total = 0;
  242. }
  243. this.setState({
  244. dataSource: data.data.list,
  245. pagination: this.state.pagination,
  246. pageNo: data.data.pageNo,
  247. });
  248. } else {
  249. this.setState({
  250. dataSource: data.data,
  251. pagination: false,
  252. });
  253. }
  254. } else {
  255. message.warning(data.error[0].message);
  256. }
  257. }.bind(this),
  258. }).always(
  259. function () {
  260. this.setState({
  261. loading: false,
  262. });
  263. }.bind(this)
  264. );
  265. }
  266. componentWillMount() {
  267. this.loadData();
  268. }
  269. render() {
  270. const { searchValues, onelist, twolist, threelist, columns, changeList } = this.state;
  271. return (
  272. <div className="user-content signatureStatistics">
  273. <Tabs defaultActiveKey="1">
  274. <TabPane tab="搜索" key="1">
  275. <div style={{ paddingTop: 10 }}>
  276. <Form layout="inline">
  277. <FormItem>
  278. <Input
  279. placeholder="请输入订单编号"
  280. value={searchValues["orderNo"]}
  281. onChange={(e) => {
  282. searchValues["orderNo"] = e.target.value
  283. this.setState({
  284. searchValues: searchValues,
  285. });
  286. }}
  287. />
  288. </FormItem>
  289. <FormItem>
  290. <Input
  291. placeholder="请输入客户姓名"
  292. value={searchValues["name"]}
  293. onChange={(e) => {
  294. searchValues["name"] = e.target.value
  295. this.setState({
  296. searchValues: searchValues,
  297. });
  298. }}
  299. />
  300. </FormItem>
  301. <FormItem>
  302. <Input
  303. placeholder="请输入合同编号"
  304. value={searchValues["contractNo"]}
  305. onChange={(e) => {
  306. searchValues["contractNo"] = e.target.value
  307. this.setState({
  308. searchValues: searchValues,
  309. });
  310. }}
  311. />
  312. </FormItem>
  313. <FormItem>
  314. <Select
  315. placeholder={"请选择结算状态"}
  316. style={{ width: 150 }}
  317. value={searchValues["liquidationStatus"]
  318. ? searchValues["liquidationStatus"]
  319. : undefined}
  320. onChange={(e) => {
  321. searchValues["liquidationStatus"] = e
  322. this.setState({
  323. searchValues: searchValues,
  324. });
  325. }}
  326. >
  327. {onelist.map((it, ins) => (
  328. <Option key={it.value}>{it.label}</Option>
  329. ))}
  330. </Select>
  331. </FormItem>
  332. <FormItem>
  333. <Select
  334. placeholder={"请选择特批状态"}
  335. style={{ width: 150 }}
  336. value={searchValues["approval"]
  337. ? searchValues["approval"]
  338. : undefined}
  339. onChange={(e) => {
  340. searchValues["approval"] = e
  341. this.setState({
  342. searchValues: searchValues,
  343. });
  344. }}
  345. >
  346. {twolist.map((it, ins) => (
  347. <Option key={it.value}>{it.label}</Option>
  348. ))}
  349. </Select>
  350. </FormItem>
  351. <FormItem>
  352. <Select
  353. placeholder={"请选择签单金额"}
  354. style={{ width: 150 }}
  355. value={searchValues["amountStatus"]
  356. ? searchValues["amountStatus"]
  357. : undefined}
  358. onChange={(e) => {
  359. searchValues["amountStatus"] = e
  360. this.setState({
  361. searchValues: searchValues,
  362. });
  363. }}
  364. >
  365. {threelist.map((it, ins) => (
  366. <Option key={it.value}>{it.label}</Option>
  367. ))}
  368. </Select>
  369. </FormItem>
  370. <Button
  371. type="primary"
  372. onClick={() => { this.loadData() }}
  373. style={{ marginRight: "10px" }}
  374. >
  375. 搜索
  376. </Button>
  377. <Button
  378. onClick={() => { this.resetAll() }}
  379. style={{ marginRight: "10px" }}
  380. >
  381. 重置
  382. </Button>
  383. </Form>
  384. </div>
  385. </TabPane>
  386. <TabPane tab="更改表格显示数据" key="2">
  387. <div style={{ marginLeft: 10 }}>
  388. <ChooseList
  389. columns={columns}
  390. changeFn={this.changeList.bind(this)}
  391. changeList={changeList}
  392. top={55}
  393. margin={11}
  394. />
  395. </div>
  396. </TabPane>
  397. </Tabs>
  398. <div className="patent-table">
  399. <Spin spinning={this.state.loading}>
  400. <Table
  401. bordered
  402. size="middle"
  403. columns={changeList ? changeList : columns}
  404. dataSource={this.state.dataSource}
  405. pagination={this.state.pagination}
  406. />
  407. </Spin>
  408. </div>
  409. </div>
  410. );
  411. }
  412. }
  413. export default OrderList;