order.jsx 11 KB

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