order.jsx 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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. Tooltip,
  13. } from "antd";
  14. import $ from "jquery/src/ajax";
  15. import { ChooseList } from "../../../manageCenter/order/orderNew/chooseList";
  16. // import OrderDetail from "../orderNew/changeComponent/orderDetail";
  17. import OrderDesc from "../../financialManage/orderDetail/orderDesc";
  18. import OrderRiZi from "@/orderRiZi.jsx";
  19. import { salesList } from "@/dataDic.js";
  20. import {
  21. getProcessStatus,
  22. getLiquidationStatus,
  23. getNewOrderStatus,
  24. ShowModal,
  25. } from "@/tools.js";
  26. const { TabPane } = Tabs;
  27. const FormItem = Form.Item;
  28. const Option = Select.Option;
  29. class OrderList extends Component {
  30. constructor(props) {
  31. super(props);
  32. this.state = {
  33. onelist: [
  34. {
  35. value: "0",
  36. label: "首付待付请",
  37. },
  38. {
  39. value: "1",
  40. label: "尾款待付清",
  41. },
  42. {
  43. value: "2",
  44. label: "已付请",
  45. },
  46. ],
  47. twolist: [
  48. {
  49. value: "0",
  50. label: "非特批",
  51. },
  52. {
  53. value: "1",
  54. label: "特批",
  55. },
  56. ],
  57. threelist: [
  58. {
  59. value: "0",
  60. label: "10万元以下",
  61. },
  62. {
  63. value: "1",
  64. label: "10万~20万",
  65. },
  66. {
  67. value: "2",
  68. label: "20万~30万",
  69. },
  70. {
  71. value: "3",
  72. label: "30万~40万",
  73. },
  74. {
  75. value: "4",
  76. label: "40万以上",
  77. },
  78. ],
  79. columns: [
  80. {
  81. title: "销售类型",
  82. dataIndex: "salesType",
  83. key: "salesType",
  84. render: (text, record) => {
  85. return (
  86. <Tooltip
  87. title={salesList[text] + ((text == 3 || text == 4 || text == 5) ? (!record.other ? "" : "," + record.other) : "")}
  88. >
  89. <span>
  90. {salesList[text]}
  91. </span>
  92. </Tooltip>
  93. );
  94. },
  95. },
  96. {
  97. title: "合同编号",
  98. dataIndex: "contractNo",
  99. key: "contractNo",
  100. },
  101. {
  102. title: "订单编号",
  103. dataIndex: "orderNo",
  104. key: "orderNo",
  105. },
  106. {
  107. title: "客户名称",
  108. dataIndex: "userName",
  109. key: "userName",
  110. },
  111. {
  112. title: "订单部门",
  113. dataIndex: "depName",
  114. key: "depName",
  115. },
  116. {
  117. title: "营销员",
  118. dataIndex: "salesmanName",
  119. key: "salesmanName",
  120. },
  121. {
  122. title: "下单时间",
  123. dataIndex: "createDate",
  124. key: "createDate",
  125. },
  126. {
  127. title: "合同签订时间",
  128. dataIndex: "signDate",
  129. key: "signDate",
  130. },
  131. {
  132. title: "流程状态",
  133. dataIndex: "processStatus",
  134. key: "processStatus",
  135. render: (text, record) => {
  136. return getProcessStatus(text, record.examineName, record.approval);
  137. },
  138. },
  139. {
  140. title: "签单金额(万元)",
  141. dataIndex: "totalAmount",
  142. key: "totalAmount",
  143. render: (text, record) =>
  144. <span >
  145. {text}
  146. </span>
  147. },
  148. {
  149. title: "开单金额(万元)",
  150. dataIndex: "invoiceAmount",
  151. key: "invoiceAmount",
  152. render: (text, record) =>
  153. <span >
  154. {text}
  155. </span>
  156. },
  157. {
  158. title: "已收款(万元)",
  159. dataIndex: "settlementAmount",
  160. key: "settlementAmount",
  161. render: (text, record) =>
  162. <span >
  163. {text}
  164. </span>
  165. },
  166. {
  167. title: "结算状态",
  168. dataIndex: "liquidationStatus",
  169. key: "liquidationStatus",
  170. render: (text, record) =>
  171. <span >
  172. {getLiquidationStatus(text)}
  173. </span>
  174. },
  175. {
  176. title: "是否特批",
  177. dataIndex: "approval",
  178. key: "approval",
  179. render: (text, record) =>
  180. <span >
  181. {["非特批", "特批", "特批通过"][text]}
  182. </span>
  183. },
  184. {
  185. title: "订单状态",
  186. dataIndex: "orderStatus",
  187. key: "orderStatus",
  188. render: (text, record) =>
  189. <span >
  190. {getNewOrderStatus(text)}
  191. </span>
  192. },
  193. ],
  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. loading: false,
  207. changeList: undefined,
  208. searchValues: {},
  209. dataSource: [],
  210. details: false,
  211. orderData: {},
  212. };
  213. }
  214. changeList(arr) {
  215. const newArr = [];
  216. this.state.columns.forEach((item) => {
  217. arr.forEach((val) => {
  218. if (val === item.title) {
  219. newArr.push(item);
  220. }
  221. });
  222. });
  223. this.setState({
  224. changeList: newArr,
  225. });
  226. }
  227. // 重置
  228. resetAll() {
  229. this.setState(
  230. {
  231. searchValues: JSON.parse(JSON.stringify({})),
  232. selectedRowKeys: [],
  233. },
  234. () => {
  235. this.loadData();
  236. }
  237. );
  238. }
  239. // 列表接口
  240. loadData(pageNo) {
  241. const { searchValues, pagination } = this.state;
  242. this.setState({
  243. loading: true,
  244. });
  245. let prs = this.props.data;
  246. prs.pageNo = pageNo || 1;
  247. prs.pageSize = pagination.pageSize;
  248. let datas = Object.assign(searchValues, prs);
  249. $.ajax({
  250. method: "get",
  251. dataType: "json",
  252. crossDomain: false,
  253. url: globalConfig.context + "/api/admin/newOrder/statistics/orderList",
  254. data: datas,
  255. success: function (data) {
  256. ShowModal(this);
  257. this.setState({
  258. loading: false,
  259. });
  260. if (data.error && data.error.length === 0) {
  261. if (data.data.list) {
  262. pagination.current = data.data.pageNo;
  263. pagination.total = data.data.totalCount;
  264. if (data.data && data.data.list && !data.data.list.length) {
  265. pagination.current = 0;
  266. pagination.total = 0;
  267. }
  268. this.setState({
  269. dataSource: data.data.list,
  270. pagination: this.state.pagination,
  271. pageNo: data.data.pageNo,
  272. });
  273. } else {
  274. this.setState({
  275. dataSource: data.data,
  276. pagination: false,
  277. });
  278. }
  279. } else {
  280. message.warning(data.error[0].message);
  281. }
  282. }.bind(this),
  283. }).always(
  284. function () {
  285. this.setState({
  286. loading: false,
  287. });
  288. }.bind(this)
  289. );
  290. }
  291. // 整行点击
  292. tableRowClick(record) {
  293. this.state.orderData = record;
  294. this.setState({
  295. details: true,
  296. });
  297. }
  298. // 详情弹窗
  299. closeDesc() {
  300. this.setState({
  301. details: false
  302. })
  303. this.loadData(this.state.pageNo);
  304. }
  305. componentWillMount() {
  306. this.loadData();
  307. }
  308. render() {
  309. const { searchValues, onelist, twolist, threelist, columns, changeList, details } = this.state;
  310. return (
  311. <div className="user-content signatureStatistics">
  312. <Tabs defaultActiveKey="1">
  313. <TabPane tab="搜索" key="1">
  314. <div style={{ paddingTop: 10 }}>
  315. <Form layout="inline">
  316. <FormItem>
  317. <Input
  318. placeholder="请输入订单编号"
  319. value={searchValues["orderNo"]}
  320. onChange={(e) => {
  321. searchValues["orderNo"] = e.target.value
  322. this.setState({
  323. searchValues: searchValues,
  324. });
  325. }}
  326. />
  327. </FormItem>
  328. <FormItem>
  329. <Input
  330. placeholder="请输入客户姓名"
  331. value={searchValues["name"]}
  332. onChange={(e) => {
  333. searchValues["name"] = e.target.value
  334. this.setState({
  335. searchValues: searchValues,
  336. });
  337. }}
  338. />
  339. </FormItem>
  340. <FormItem>
  341. <Input
  342. placeholder="请输入合同编号"
  343. value={searchValues["contractNo"]}
  344. onChange={(e) => {
  345. searchValues["contractNo"] = e.target.value
  346. this.setState({
  347. searchValues: searchValues,
  348. });
  349. }}
  350. />
  351. </FormItem>
  352. <FormItem>
  353. <Select
  354. placeholder={"请选择结算状态"}
  355. style={{ width: 150 }}
  356. value={searchValues["liquidationStatus"]
  357. ? searchValues["liquidationStatus"]
  358. : undefined}
  359. onChange={(e) => {
  360. searchValues["liquidationStatus"] = e
  361. this.setState({
  362. searchValues: searchValues,
  363. });
  364. }}
  365. >
  366. {onelist.map((it, ins) => (
  367. <Option key={it.value}>{it.label}</Option>
  368. ))}
  369. </Select>
  370. </FormItem>
  371. <FormItem>
  372. <Select
  373. placeholder={"请选择特批状态"}
  374. style={{ width: 150 }}
  375. value={searchValues["approval"]
  376. ? searchValues["approval"]
  377. : undefined}
  378. onChange={(e) => {
  379. searchValues["approval"] = e
  380. this.setState({
  381. searchValues: searchValues,
  382. });
  383. }}
  384. >
  385. {twolist.map((it, ins) => (
  386. <Option key={it.value}>{it.label}</Option>
  387. ))}
  388. </Select>
  389. </FormItem>
  390. <FormItem>
  391. <Select
  392. placeholder={"请选择签单金额"}
  393. style={{ width: 150 }}
  394. value={searchValues["amountStatus"]
  395. ? searchValues["amountStatus"]
  396. : undefined}
  397. onChange={(e) => {
  398. searchValues["amountStatus"] = e
  399. this.setState({
  400. searchValues: searchValues,
  401. });
  402. }}
  403. >
  404. {threelist.map((it, ins) => (
  405. <Option key={it.value}>{it.label}</Option>
  406. ))}
  407. </Select>
  408. </FormItem>
  409. <Button
  410. type="primary"
  411. onClick={() => { this.loadData() }}
  412. style={{ marginRight: "10px" }}
  413. >
  414. 搜索
  415. </Button>
  416. <Button
  417. onClick={() => { this.resetAll() }}
  418. style={{ marginRight: "10px" }}
  419. >
  420. 重置
  421. </Button>
  422. </Form>
  423. </div>
  424. </TabPane>
  425. <TabPane tab="更改表格显示数据" key="2">
  426. <div style={{ marginLeft: 10 }}>
  427. <ChooseList
  428. columns={columns}
  429. changeFn={this.changeList.bind(this)}
  430. changeList={changeList}
  431. top={55}
  432. margin={11}
  433. />
  434. </div>
  435. </TabPane>
  436. </Tabs>
  437. <div className="patent-table">
  438. <Spin spinning={this.state.loading}>
  439. <Table
  440. bordered
  441. size="middle"
  442. columns={changeList ? changeList : columns}
  443. dataSource={this.state.dataSource}
  444. pagination={this.state.pagination}
  445. onRowClick={this.tableRowClick.bind(this)}
  446. />
  447. </Spin>
  448. </div>
  449. {/* 订单详情 */}
  450. <OrderDesc
  451. data={this.state.orderData}
  452. showDesc={details}
  453. closeDesc={this.closeDesc.bind(this)}
  454. />
  455. </div>
  456. );
  457. }
  458. }
  459. export default OrderList;