expertS.jsx 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. /*
  2. update:2018/08/01
  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. import SpinContainer from "../../SpinContainer";
  12. //主体
  13. const Order = Form.create()(
  14. React.createClass({
  15. loadData(pageNo) {
  16. this.state.data = [];
  17. this.setState({
  18. loading: true,
  19. page: pageNo
  20. });
  21. $.ajax({
  22. method: 'get',
  23. dataType: 'json',
  24. crossDomain: false,
  25. url: globalConfig.context + '/api/user/jtOrder/list',
  26. data: {
  27. pageNo: pageNo || 1,
  28. pageSize: this.state.pagination.pageSize,
  29. orderNo: this.state.numberSearch,
  30. userType:1,
  31. orderType:10,
  32. commodityName: this.state.entryNameSearch,
  33. buyerName: this.state.companyNameSearch,
  34. startCreateDate: this.state.releaseDate[0],
  35. endCreateDate: this.state.releaseDate[1]
  36. },
  37. success: function(data) {
  38. let theArr = [];
  39. if (!data.data || !data.data.list) {
  40. if (data.error && data.error.length) {
  41. message.warning(data.error[0].message);
  42. }
  43. } else {
  44. for (let i = 0; i < data.data.list.length; i++) {
  45. let thisdata = data.data.list[i];
  46. theArr.push({
  47. key: i,
  48. sellerId: thisdata.sellerId,
  49. buyerId:thisdata.buyerId,
  50. orderNo:thisdata.orderNo,
  51. commodityType:thisdata.commodityType,
  52. orderAmount:thisdata.orderAmount,
  53. commodityName:thisdata.commodityName,
  54. buyerName:thisdata.buyerName,
  55. buyerMobile:thisdata.buyerMobile,
  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. render:(text)=>{
  121. return text?text:'面议'
  122. }
  123. },
  124. {
  125. title: '购买者',
  126. dataIndex: 'buyerName',
  127. key: 'buyerName',
  128. },
  129. {
  130. title: '联系方式',
  131. dataIndex: 'buyerMobile',
  132. key: 'buyerMobile'
  133. },
  134. ],
  135. dataSource: []
  136. };
  137. },
  138. componentWillMount() {
  139. this.loadData();
  140. },
  141. //项目列表整行点击
  142. tableRowClick(record, index) {
  143. this.state.RowData = record;
  144. this.setState({
  145. editvisible: true
  146. });
  147. },
  148. edithandleCancel(e) {
  149. this.setState({
  150. editvisible: false
  151. });
  152. },
  153. search() {
  154. this.loadData();
  155. },
  156. //搜索部分的清零
  157. reset() {
  158. this.state.numberSearch = '';
  159. this.state.typeSearch = undefined;
  160. this.state.companyNameSearch = '';
  161. this.state.entryNameSearch = '';
  162. this.state.releaseDate = [];
  163. this.state.searchMore=true;
  164. this.loadData();
  165. },
  166. searchSwitch() {
  167. this.setState({
  168. searchMore: !this.state.searchMore
  169. });
  170. },
  171. render() {
  172. const FormItem = Form.Item;
  173. const rowSelection = {
  174. selectedRowKeys: this.state.selectedRowKeys,
  175. onChange: (selectedRowKeys, selectedRows) => {
  176. this.setState({
  177. selectedRows: selectedRows.slice(-1),
  178. selectedRowKeys: selectedRowKeys.slice(-1)
  179. });
  180. }
  181. };
  182. const { RangePicker } = DatePicker;
  183. const theData = this.state.RowData || {};
  184. return (
  185. <div className="user-content">
  186. <div className="content-title">
  187. <span>专家订单列表</span>
  188. </div>
  189. <div className="user-search">
  190. <Input
  191. placeholder="订单编号"
  192. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  193. value={this.state.numberSearch}
  194. onChange={(e) => {
  195. this.setState({ numberSearch: e.target.value });
  196. }}
  197. />
  198. <Input
  199. placeholder="消费者名称"
  200. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  201. value={this.state.companyNameSearch}
  202. onChange={(e) => {
  203. this.setState({ companyNameSearch: e.target.value });
  204. }}
  205. />
  206. <Input
  207. placeholder="项目名称"
  208. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  209. value={this.state.entryNameSearch}
  210. onChange={(e) => {
  211. this.setState({ entryNameSearch: e.target.value });
  212. }}
  213. />
  214. <Button type="primary" onClick={this.search} style={{ marginRight: '10px' }}>
  215. 搜索
  216. </Button>
  217. <Button onClick={this.reset} style={{ marginRight: '10px' }}>
  218. 重置
  219. </Button>
  220. <span>
  221. 更多搜索<Switch checked={!this.state.searchMore} onChange={this.searchSwitch} />
  222. </span>
  223. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  224. <span style={{ marginRight: 10 }}>订单时间 :</span>
  225. <RangePicker
  226. value={[
  227. this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  228. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null
  229. ]}
  230. onChange={(data, dataString) => {
  231. this.setState({ releaseDate: dataString });
  232. }}
  233. />
  234. </div>
  235. </div>
  236. <div className="patent-table">
  237. <SpinContainer spinning={this.state.loading}>
  238. <Table
  239. columns={this.state.columns}
  240. dataSource={this.state.dataSource}
  241. rowSelection={rowSelection}
  242. pagination={this.state.pagination}
  243. onRowClick={this.tableRowClick}
  244. />
  245. </SpinContainer>
  246. </div>
  247. <div className="patent-desc">
  248. <Modal
  249. className="customeDetails"
  250. title="订单详情"
  251. width="1000px"
  252. visible={this.state.editvisible}
  253. onOk={this.edithandleCancel}
  254. onCancel={this.edithandleCancel}
  255. footer=""
  256. >
  257. <Form layout="horizontal" onSubmit={this.edithandleSubmit} id="demand-form">
  258. <SpinContainer spinning={this.state.loading}>
  259. <div className="clearfix">
  260. <FormItem
  261. className="half-item"
  262. labelCol={{ span: 8 }}
  263. wrapperCol={{ span: 12 }}
  264. label="订单编号"
  265. >
  266. <span>{theData.orderNo}</span>
  267. </FormItem>
  268. <FormItem
  269. className="half-item"
  270. labelCol={{ span: 8 }}
  271. wrapperCol={{ span: 12 }}
  272. label="订单类型"
  273. >
  274. <span>{getOrderType(theData.commodityType)}</span>
  275. </FormItem>
  276. </div>
  277. <div className="clearfix">
  278. <FormItem
  279. className="half-item"
  280. labelCol={{ span: 8 }}
  281. wrapperCol={{ span: 12 }}
  282. label="订单日期"
  283. >
  284. <span>{theData.createTime}</span>
  285. </FormItem>
  286. <FormItem
  287. className="half-item"
  288. labelCol={{ span: 8 }}
  289. wrapperCol={{ span: 12 }}
  290. label="订单金额(万元)"
  291. >
  292. <span>{theData.orderAmount ? theData.orderAmount + '万元' : ''}</span>
  293. </FormItem>
  294. </div>
  295. <div className="clearfix">
  296. <FormItem
  297. className="half-item"
  298. labelCol={{ span: 8 }}
  299. wrapperCol={{ span: 12 }}
  300. label="项目名称"
  301. >
  302. <span>{theData.commodityName}</span>
  303. </FormItem>
  304. </div>
  305. <div className="clearfix">
  306. <FormItem
  307. className="half-item"
  308. labelCol={{ span: 8 }}
  309. wrapperCol={{ span: 12 }}
  310. label="消费者"
  311. >
  312. <span>{theData.buyerName}</span>
  313. </FormItem>
  314. <FormItem
  315. className="half-item"
  316. labelCol={{ span: 8 }}
  317. wrapperCol={{ span: 12 }}
  318. label="联系方式"
  319. >
  320. <span>{theData.buyerMobile}</span>
  321. </FormItem>
  322. </div>
  323. </SpinContainer>
  324. </Form>
  325. </Modal>
  326. </div>
  327. </div>
  328. );
  329. }
  330. })
  331. );
  332. export default Order;