detaillist.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. import React, { Component } from "react";
  2. import {
  3. AutoComplete,
  4. Button,
  5. DatePicker,
  6. Input,
  7. message,
  8. Modal,
  9. Select,
  10. Spin,
  11. Table,
  12. Tabs,
  13. Tag,
  14. Tooltip,
  15. } from "antd";
  16. import {
  17. ShowModal,
  18. getProcessStatus,
  19. getLiquidationStatus,
  20. getNewOrderStatus
  21. } from "@/tools";
  22. import { salesList, } from "@/dataDic"
  23. import { ChooseList } from "../../order/orderNew/chooseList";
  24. import OrderDesc from "../../financialManage/orderDetail/orderDesc";
  25. import $ from "jquery/src/ajax";
  26. import "./index.less";
  27. import moment from "moment";
  28. const { TabPane } = Tabs;
  29. const { RangePicker } = DatePicker;
  30. class DetailList extends Component {
  31. constructor(props) {
  32. super(props);
  33. this.state = {
  34. pageNo: 1,
  35. details: false,
  36. loading: false,
  37. changeList: undefined,
  38. columns: [
  39. {
  40. title: "销售类型",
  41. dataIndex: "salesType",
  42. key: "salesType",
  43. render: (text, record) => {
  44. return (
  45. <Tooltip
  46. title={salesList[text] + ((text == 3 || text == 4 || text == 5) ? (!record.other ? "" : "," + record.other) : "")}
  47. >
  48. <span>
  49. {salesList[text]}
  50. </span>
  51. </Tooltip>
  52. );
  53. },
  54. },
  55. {
  56. title: "合同编号",
  57. dataIndex: "contractNo",
  58. key: "contractNo",
  59. },
  60. {
  61. title: "订单编号",
  62. dataIndex: "orderNo",
  63. key: "orderNo",
  64. },
  65. {
  66. title: "客户名称",
  67. dataIndex: "userName",
  68. key: "userName",
  69. },
  70. {
  71. title: "订单部门",
  72. dataIndex: "depName",
  73. key: "depName",
  74. },
  75. {
  76. title: "营销员",
  77. dataIndex: "salesmanName",
  78. key: "salesmanName",
  79. },
  80. {
  81. title: "下单时间",
  82. dataIndex: "createDate",
  83. key: "createDate",
  84. },
  85. {
  86. title: "合同签订时间",
  87. dataIndex: "signDate",
  88. key: "signDate",
  89. },
  90. {
  91. title: "流程状态",
  92. dataIndex: "processStatus",
  93. key: "processStatus",
  94. render: (text, record) => {
  95. return getProcessStatus(text, record.examineName, record.approval);
  96. },
  97. },
  98. {
  99. title: "签单金额(万元)",
  100. dataIndex: "totalAmount",
  101. key: "totalAmount",
  102. render: (text, record) =>
  103. <span >
  104. {text}
  105. </span>
  106. },
  107. {
  108. title: "开单金额(万元)",
  109. dataIndex: "invoiceAmount",
  110. key: "invoiceAmount",
  111. render: (text, record) =>
  112. <span >
  113. {text}
  114. </span>
  115. },
  116. {
  117. title: "已收款(万元)",
  118. dataIndex: "settlementAmount",
  119. key: "settlementAmount",
  120. render: (text, record) =>
  121. <span >
  122. {text}
  123. </span>
  124. },
  125. {
  126. title: "结算状态",
  127. dataIndex: "liquidationStatus",
  128. key: "liquidationStatus",
  129. render: (text, record) =>
  130. <span >
  131. {getLiquidationStatus(text)}
  132. </span>
  133. },
  134. {
  135. title: "是否特批",
  136. dataIndex: "approval",
  137. key: "approval",
  138. render: (text, record) =>
  139. <span >
  140. {["非特批", "特批", "特批通过"][text]}
  141. </span>
  142. },
  143. {
  144. title: "订单状态",
  145. dataIndex: "orderStatus",
  146. key: "orderStatus",
  147. render: (text, record) =>
  148. <span >
  149. {getNewOrderStatus(text)}
  150. </span>
  151. },
  152. ],
  153. pagination: {
  154. defaultCurrent: 1,
  155. defaultPageSize: 10,
  156. showQuickJumper: true,
  157. pageSize: 10,
  158. onChange: function (page) {
  159. this.loadData(page);
  160. }.bind(this),
  161. showTotal: function (total) {
  162. return "共" + total + "条数据";
  163. },
  164. },
  165. dataSource: [],
  166. searchInfor: {}
  167. };
  168. this.loadData = this.loadData.bind(this);
  169. this.resetAll = this.resetAll.bind(this);
  170. this.changeList = this.changeList.bind(this);
  171. }
  172. changeList(arr) {
  173. const newArr = [];
  174. this.state.columns.forEach((item) => {
  175. arr.forEach((val) => {
  176. if (val === item.title) {
  177. newArr.push(item);
  178. }
  179. });
  180. });
  181. this.setState({
  182. changeList: newArr,
  183. });
  184. }
  185. loadData(pageNo) {
  186. const { searchInfor, pagination } = this.state;
  187. this.setState({
  188. loading: true,
  189. });
  190. let prs = this.props.data;
  191. prs.pageNo = pageNo || 1;
  192. prs.pageSize = pagination.pageSize;
  193. delete prs.nickname
  194. let datas = Object.assign(searchInfor, prs);
  195. $.ajax({
  196. method: "get",
  197. dataType: "json",
  198. crossDomain: false,
  199. url: globalConfig.context + "/api/admin/statistis/signStatistics/orderList",
  200. data: datas,
  201. success: function (data) {
  202. ShowModal(this);
  203. this.setState({
  204. loading: false,
  205. });
  206. if (data.error && data.error.length === 0) {
  207. if (data.data.list) {
  208. pagination.current = data.data.pageNo;
  209. pagination.total = data.data.totalCount;
  210. if (data.data && data.data.list && !data.data.list.length) {
  211. pagination.current = 0;
  212. pagination.total = 0;
  213. }
  214. this.setState({
  215. dataSource: data.data.list,
  216. pagination: this.state.pagination,
  217. pageNo: data.data.pageNo,
  218. });
  219. } else {
  220. this.setState({
  221. dataSource: data.data,
  222. pagination: false,
  223. });
  224. }
  225. } else {
  226. message.warning(data.error[0].message);
  227. }
  228. }.bind(this),
  229. }).always(
  230. function () {
  231. this.setState({
  232. loading: false,
  233. });
  234. }.bind(this)
  235. );
  236. }
  237. resetAll() {
  238. this.setState(
  239. {
  240. searchInfor: JSON.parse(JSON.stringify({})),
  241. selectedRowKeys: [],
  242. },
  243. () => {
  244. this.loadData();
  245. }
  246. );
  247. }
  248. // 整行点击
  249. tableRowClick(record) {
  250. this.state.orderData = record;
  251. this.setState({
  252. details: true,
  253. });
  254. }
  255. // 详情弹窗
  256. closeDesc() {
  257. this.setState({
  258. details: false
  259. })
  260. this.loadData(this.state.pageNo);
  261. }
  262. componentWillMount() {
  263. this.loadData();
  264. }
  265. render() {
  266. const { searchInfor, details } = this.state
  267. return (
  268. <div>
  269. <div className="user-content">
  270. <Tabs defaultActiveKey="1" className="test">
  271. <TabPane tab="搜索" key="1">
  272. <div
  273. className="user-search"
  274. style={{
  275. marginTop: "10px",
  276. marginLeft: "10px",
  277. marginRight: "10px",
  278. }}
  279. >
  280. <span style={{ marginRight: "10px" }}>
  281. <Select
  282. style={{ width: 160 }}
  283. placeholder="签单金额"
  284. value={searchInfor.amountType}
  285. onChange={(e) => {
  286. this.setState({
  287. searchInfor: Object.assign(searchInfor, {
  288. amountType: e,
  289. }),
  290. });
  291. }}
  292. >
  293. <Option value="0">全部</Option>
  294. <Option value="1">小于10万</Option>
  295. <Option value="2">10-20万</Option>
  296. <Option value="3">20-30万</Option>
  297. <Option value="4">30万以上</Option>
  298. </Select>
  299. </span>
  300. <span style={{ marginRight: "10px" }}>
  301. <Select
  302. style={{ width: 160 }}
  303. placeholder="最新签单类型"
  304. value={searchInfor.orderType}
  305. onChange={(e) => {
  306. this.setState({
  307. searchInfor: Object.assign(searchInfor, {
  308. orderType: e,
  309. }),
  310. });
  311. }}
  312. >
  313. <Option value="0">所有</Option>
  314. <Option value="1">新签</Option>
  315. <Option value="2">复购</Option>
  316. <Option value="3">渠道</Option>
  317. </Select>
  318. </span>
  319. <span style={{ marginRight: "10px" }}>
  320. <span style={{ marginRight: "5px", marginBottom: "10px" }}>
  321. 签单时间 :
  322. </span>
  323. <RangePicker
  324. style={{ marginRight: "10px", marginBottom: "10px" }}
  325. value={[
  326. searchInfor.signTimeStart
  327. ? moment(searchInfor.signTimeStart)
  328. : null,
  329. searchInfor.signTimeEnd
  330. ? moment(searchInfor.signTimeEnd)
  331. : null,
  332. ]}
  333. onChange={(data, dataString) => {
  334. this.setState({
  335. searchInfor: Object.assign(searchInfor, {
  336. signTimeStart: dataString[0],
  337. signTimeEnd: dataString[1],
  338. }),
  339. });
  340. }}
  341. />
  342. </span>
  343. <Button
  344. type="primary"
  345. onClick={() => {
  346. this.loadData();
  347. }}
  348. style={{ marginRight: "10px", marginBottom: "10px" }}
  349. >
  350. 搜索
  351. </Button>
  352. <Button
  353. onClick={this.resetAll}
  354. style={{ marginRight: "10px", marginBottom: "10px" }}
  355. >
  356. 重置
  357. </Button>
  358. </div>
  359. </TabPane>
  360. <TabPane tab="更改表格显示数据" key="2">
  361. <div style={{ marginLeft: 10 }}>
  362. <Spin spinning={this.state.loading}>
  363. <ChooseList
  364. columns={this.state.columns}
  365. changeFn={this.changeList}
  366. changeList={this.state.changeList}
  367. top={55}
  368. margin={11}
  369. />
  370. </Spin>
  371. </div>
  372. </TabPane>
  373. </Tabs>
  374. <div className="patent-table">
  375. <Spin spinning={this.state.loading}>
  376. <Table
  377. bordered
  378. size="middle"
  379. columns={
  380. this.state.changeList
  381. ? this.state.changeList
  382. : this.state.columns
  383. }
  384. dataSource={this.state.dataSource}
  385. pagination={this.state.pagination}
  386. onRowClick={this.tableRowClick.bind(this)}
  387. />
  388. </Spin>
  389. </div>
  390. </div>
  391. {/* 订单详情 */}
  392. <OrderDesc
  393. data={this.state.orderData}
  394. showDesc={details}
  395. closeDesc={this.closeDesc.bind(this)}
  396. />
  397. </div>
  398. );
  399. }
  400. }
  401. export default DetailList;