order.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. /*
  2. update:2018/07/16
  3. author:liting
  4. */
  5. import React from 'react';
  6. import $ from 'jquery/src/ajax';
  7. import { Form, Button, Input, Select, Spin, Table, message, Modal, Tooltip, Switch, DatePicker } from 'antd';
  8. import { orderType } from '@/dataDic';
  9. import { getOrderType } from '@/tools.js';
  10. import moment from 'moment';
  11. //主体
  12. const Order = Form.create()(
  13. React.createClass({
  14. loadData(pageNo) {
  15. this.state.data = [];
  16. this.setState({
  17. loading: true,
  18. page: pageNo
  19. });
  20. $.ajax({
  21. method: 'get',
  22. dataType: 'json',
  23. crossDomain: false,
  24. url: globalConfig.context + '/api/admin/jtOrder/list',
  25. data: {
  26. pageNo: pageNo || 1,
  27. pageSize: this.state.pagination.pageSize,
  28. orderNo: this.state.numberSearch,
  29. commodityName: this.state.entryNameSearch,
  30. sellerName: this.state.companyNameSearch,
  31. buyerName: this.state.employerNameSearch,
  32. orderType:this.state.orderTypeSearch,
  33. startCreateDate: this.state.releaseDate[0],
  34. endCreateDate: this.state.releaseDate[1]
  35. },
  36. success: function(data) {
  37. let theArr = [];
  38. if (!data.data || !data.data.list) {
  39. if (data.error && data.error.length) {
  40. message.warning(data.error[0].message);
  41. }
  42. } else {
  43. for (let i = 0; i < data.data.list.length; i++) {
  44. let thisdata = data.data.list[i];
  45. theArr.push({
  46. key: i,
  47. sellerId: thisdata.sellerId,
  48. buyerId:thisdata.buyerId,
  49. orderNo:thisdata.orderNo,
  50. commodityType:thisdata.commodityType,
  51. orderAmount:thisdata.orderAmount,
  52. commodityName:thisdata.commodityName,
  53. buyerName:thisdata.buyerName,
  54. buyerMobile:thisdata.buyerMobile,
  55. sellerName:thisdata.sellerName,
  56. sellerMobile:thisdata.sellerMobile,
  57. createTime: thisdata.createTime ? new Date(thisdata.createTime).toLocaleString() : ''
  58. });
  59. }
  60. this.state.pagination.current = data.data.pageNo;
  61. this.state.pagination.total = data.data.totalCount;
  62. }
  63. this.setState({
  64. dataSource: theArr,
  65. pagination: this.state.pagination
  66. });
  67. }.bind(this)
  68. }).always(
  69. function() {
  70. this.setState({
  71. loading: false
  72. });
  73. }.bind(this)
  74. );
  75. },
  76. getInitialState() {
  77. return {
  78. searchMore: true,
  79. selectedRowKeys: [],
  80. selectedRows: [],
  81. loading: false,
  82. releaseDate: [],
  83. pagination: {
  84. defaultCurrent: 1,
  85. defaultPageSize: 10,
  86. showQuickJumper: true,
  87. pageSize: 10,
  88. onChange: function(page) {
  89. this.loadData(page);
  90. this.setState({
  91. selectedRowKeys: []
  92. });
  93. }.bind(this),
  94. showTotal: function(total) {
  95. return '共' + total + '条数据';
  96. }
  97. },
  98. columns: [
  99. {
  100. title: '订单编号',
  101. dataIndex: 'orderNo',
  102. key: 'orderNo'
  103. },
  104. {
  105. title: '订单类型',
  106. dataIndex: 'commodityType',
  107. key: 'commodityType',
  108. render: (text) => {
  109. return getOrderType(text);
  110. }
  111. },
  112. {
  113. title: '订单日期',
  114. dataIndex: 'createTime',
  115. key: 'createTime'
  116. },
  117. {
  118. title: '订单金额(万元)',
  119. dataIndex: 'orderAmount',
  120. key: 'orderAmount',
  121. render:text=>{
  122. return text?text:'面议'
  123. }
  124. },
  125. {
  126. title: '项目名称',
  127. dataIndex: 'commodityName',
  128. key: 'commodityName',
  129. render: (text) => {
  130. return (
  131. <Tooltip title={text}>
  132. {text && text.length > 12 ? text.substr(0, 12) + '...' : text}
  133. </Tooltip>
  134. );
  135. }
  136. },
  137. {
  138. title: '消费者联系人',
  139. dataIndex: 'buyerName',
  140. key: 'buyerName',
  141. render: (text) => {
  142. return (
  143. <Tooltip title={text}>
  144. {text && text.length >12 ? text.substr(0,12) + '...' : text?text:'佚名'}
  145. </Tooltip>
  146. );
  147. }
  148. },
  149. {
  150. title: '消费者联系方式',
  151. dataIndex: 'buyerMobile',
  152. key: 'buyerMobile',
  153. render:(text)=>{
  154. return text&&text.length>1?text:'暂无'
  155. }
  156. },
  157. {
  158. title: '服务商联系人',
  159. dataIndex: 'sellerName',
  160. key: 'sellerName',
  161. render: (text) => {
  162. return (
  163. <Tooltip title={text}>
  164. {text && text.length >12 ? text.substr(0,12) + '...' : text?text:'佚名'}
  165. </Tooltip>
  166. );
  167. }
  168. },
  169. {
  170. title: '服务商联系方式',
  171. dataIndex: 'sellerMobile',
  172. key: 'sellerMobile',
  173. render:(text)=>{
  174. return text&&text.length>1?text:'暂无'
  175. }
  176. },
  177. ],
  178. dataSource: []
  179. };
  180. },
  181. componentWillMount() {
  182. this.loadData();
  183. },
  184. //项目列表整行点击
  185. tableRowClick(record, index) {
  186. this.setState({
  187. RowData:record,
  188. editvisible: true
  189. });
  190. },
  191. edithandleCancel(e) {
  192. this.setState({
  193. editvisible: false
  194. });
  195. },
  196. search() {
  197. this.loadData();
  198. },
  199. //搜索部分的清零
  200. reset() {
  201. this.state.numberSearch = '';
  202. this.state.typeSearch = undefined;
  203. this.state.orderTypeSearch=undefined;
  204. this.state.companyNameSearch = '';
  205. this.state.entryNameSearch = '';
  206. this.state.releaseDate = [];
  207. this.state.searchMore=true;
  208. this.loadData();
  209. },
  210. searchSwitch() {
  211. this.setState({
  212. searchMore: !this.state.searchMore
  213. });
  214. },
  215. render() {
  216. const FormItem = Form.Item;
  217. const rowSelection = {
  218. selectedRowKeys: this.state.selectedRowKeys,
  219. onChange: (selectedRowKeys, selectedRows) => {
  220. this.setState({
  221. selectedRows: selectedRows.slice(-1),
  222. selectedRowKeys: selectedRowKeys.slice(-1)
  223. });
  224. }
  225. };
  226. const { RangePicker } = DatePicker;
  227. const theData = this.state.RowData || {};
  228. return (
  229. <div className="user-content">
  230. <div className="content-title">
  231. <span>咨询单管理</span>
  232. </div>
  233. <div className="user-search">
  234. <Input
  235. placeholder="订单编号"
  236. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  237. value={this.state.numberSearch}
  238. onChange={(e) => {
  239. this.setState({ numberSearch: e.target.value });
  240. }}
  241. />
  242. <Select placeholder="订单类型" style={{ width: 120 }}
  243. value={this.state.orderTypeSearch}
  244. onChange={(e) => { this.setState({ orderTypeSearch: e }) }}>
  245. {
  246. orderType.map(function (item) {
  247. return <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  248. })
  249. }
  250. </Select>
  251. <Input
  252. placeholder="卖方名称"
  253. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  254. value={this.state.companyNameSearch}
  255. onChange={(e) => {
  256. this.setState({ companyNameSearch: e.target.value });
  257. }}
  258. />
  259. <Input
  260. placeholder="项目名称"
  261. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  262. value={this.state.entryNameSearch}
  263. onChange={(e) => {
  264. this.setState({ entryNameSearch: e.target.value });
  265. }}
  266. />
  267. <Input
  268. style={{ width: 140, marginRight: 10 }}
  269. value={this.state.employerNameSearch}
  270. onChange={(e) => {
  271. this.setState({ employerNameSearch: e.target.value });
  272. }}
  273. placeholder="买方名称"
  274. />
  275. <Button type="primary" onClick={this.search} style={{ marginRight: '10px' }}>
  276. 搜索
  277. </Button>
  278. <Button onClick={this.reset} style={{ marginRight: '10px' }}>
  279. 重置
  280. </Button>
  281. <span>
  282. 更多搜索<Switch checked={!this.state.searchMore} onChange={this.searchSwitch} />
  283. </span>
  284. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  285. <span style={{ marginRight: 10 }}>订单日期 :</span>
  286. <RangePicker
  287. value={[
  288. this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  289. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null
  290. ]}
  291. onChange={(data, dataString) => {
  292. this.setState({ releaseDate: dataString });
  293. }}
  294. />
  295. </div>
  296. </div>
  297. <div className="patent-table">
  298. <Spin spinning={this.state.loading}>
  299. <Table
  300. columns={this.state.columns}
  301. dataSource={this.state.dataSource}
  302. rowSelection={rowSelection}
  303. pagination={this.state.pagination}
  304. onRowClick={this.tableRowClick}
  305. />
  306. </Spin>
  307. </div>
  308. <div className="patent-desc">
  309. <Modal
  310. className="customeDetails"
  311. title="订单详情"
  312. width="1000px"
  313. visible={this.state.editvisible}
  314. onOk={this.edithandleCancel}
  315. onCancel={this.edithandleCancel}
  316. footer=""
  317. >
  318. <Form layout="horizontal" onSubmit={this.edithandleSubmit} id="demand-form">
  319. <Spin spinning={this.state.loading}>
  320. <div className="clearfix">
  321. <FormItem
  322. className="half-item"
  323. labelCol={{ span: 8 }}
  324. wrapperCol={{ span: 12 }}
  325. label="订单编号"
  326. >
  327. <span>{theData.orderNo}</span>
  328. </FormItem>
  329. <FormItem
  330. className="half-item"
  331. labelCol={{ span: 8 }}
  332. wrapperCol={{ span: 12 }}
  333. label="订单类型"
  334. >
  335. <span>{getOrderType(theData.commodityType)}</span>
  336. </FormItem>
  337. </div>
  338. <div className="clearfix">
  339. <FormItem
  340. className="half-item"
  341. labelCol={{ span: 8 }}
  342. wrapperCol={{ span: 12 }}
  343. label="订单日期"
  344. >
  345. <span>{theData.createTime}</span>
  346. </FormItem>
  347. <FormItem
  348. className="half-item"
  349. labelCol={{ span: 8 }}
  350. wrapperCol={{ span: 12 }}
  351. label="订单金额"
  352. >
  353. <span>{theData.orderAmount ? theData.orderAmount + '万元' : '面议'}</span>
  354. </FormItem>
  355. </div>
  356. <div className="clearfix">
  357. <FormItem
  358. className="half-item"
  359. labelCol={{ span: 8 }}
  360. wrapperCol={{ span: 12 }}
  361. label="项目名称"
  362. >
  363. <span>{theData.commodityName}</span>
  364. </FormItem>
  365. </div>
  366. <div className="clearfix">
  367. <FormItem
  368. className="half-item"
  369. labelCol={{ span: 8 }}
  370. wrapperCol={{ span: 12 }}
  371. label="买方联系人"
  372. >
  373. <span>{theData.buyerName}</span>
  374. </FormItem>
  375. <FormItem
  376. className="half-item"
  377. labelCol={{ span: 8 }}
  378. wrapperCol={{ span: 12 }}
  379. label="卖方联系人"
  380. >
  381. <span>{theData.sellerName}</span>
  382. </FormItem>
  383. <FormItem
  384. className="half-item"
  385. labelCol={{ span: 8 }}
  386. wrapperCol={{ span: 12 }}
  387. label="买方联系方式"
  388. >
  389. <span>{theData.buyerMobile}</span>
  390. </FormItem>
  391. <FormItem
  392. className="half-item"
  393. labelCol={{ span: 8 }}
  394. wrapperCol={{ span: 12 }}
  395. label="卖方联系方式"
  396. >
  397. <span>{theData.sellerMobile}</span>
  398. </FormItem>
  399. </div>
  400. </Spin>
  401. </Form>
  402. </Modal>
  403. </div>
  404. </div>
  405. );
  406. }
  407. })
  408. );
  409. export default Order;