expertS.jsx 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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. //主体
  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/user/jtOrder/list',
  25. data: {
  26. pageNo: pageNo || 1,
  27. pageSize: this.state.pagination.pageSize,
  28. orderNo: this.state.numberSearch,
  29. userType:1,
  30. orderType:10,
  31. commodityName: this.state.entryNameSearch,
  32. buyerName: this.state.companyNameSearch,
  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. createTime: thisdata.createTime ? new Date(thisdata.createTime).toLocaleString() : ''
  56. });
  57. }
  58. this.state.pagination.current = data.data.pageNo;
  59. this.state.pagination.total = data.data.totalCount;
  60. }
  61. this.setState({
  62. dataSource: theArr,
  63. pagination: this.state.pagination
  64. });
  65. }.bind(this)
  66. }).always(
  67. function() {
  68. this.setState({
  69. loading: false
  70. });
  71. }.bind(this)
  72. );
  73. },
  74. getInitialState() {
  75. return {
  76. searchMore: true,
  77. selectedRowKeys: [],
  78. selectedRows: [],
  79. loading: false,
  80. releaseDate: [],
  81. pagination: {
  82. defaultCurrent: 1,
  83. defaultPageSize: 10,
  84. showQuickJumper: true,
  85. pageSize: 10,
  86. onChange: function(page) {
  87. this.loadData(page);
  88. this.setState({
  89. selectedRowKeys: []
  90. });
  91. }.bind(this),
  92. showTotal: function(total) {
  93. return '共' + total + '条数据';
  94. }
  95. },
  96. columns: [
  97. {
  98. title: '订单编号',
  99. dataIndex: 'orderNo',
  100. key: 'orderNo'
  101. },
  102. {
  103. title: '订单类型',
  104. dataIndex: 'commodityType',
  105. key: 'commodityType',
  106. render: (text) => {
  107. return getOrderType(text);
  108. }
  109. },
  110. {
  111. title: '订单日期',
  112. dataIndex: 'createTime',
  113. key: 'createTime'
  114. },
  115. {
  116. title: '订单金额(万元)',
  117. dataIndex: 'orderAmount',
  118. key: 'orderAmount',
  119. render:(text)=>{
  120. return text?text:'面议'
  121. }
  122. },
  123. {
  124. title: '购买者',
  125. dataIndex: 'buyerName',
  126. key: 'buyerName',
  127. },
  128. {
  129. title: '联系方式',
  130. dataIndex: 'buyerMobile',
  131. key: 'buyerMobile'
  132. },
  133. ],
  134. dataSource: []
  135. };
  136. },
  137. componentWillMount() {
  138. this.loadData();
  139. },
  140. //项目列表整行点击
  141. tableRowClick(record, index) {
  142. this.state.RowData = record;
  143. this.setState({
  144. editvisible: true
  145. });
  146. },
  147. edithandleCancel(e) {
  148. this.setState({
  149. editvisible: false
  150. });
  151. },
  152. search() {
  153. this.loadData();
  154. },
  155. //搜索部分的清零
  156. reset() {
  157. this.state.numberSearch = '';
  158. this.state.typeSearch = undefined;
  159. this.state.companyNameSearch = '';
  160. this.state.entryNameSearch = '';
  161. this.state.releaseDate = [];
  162. this.state.searchMore=true;
  163. this.loadData();
  164. },
  165. searchSwitch() {
  166. this.setState({
  167. searchMore: !this.state.searchMore
  168. });
  169. },
  170. render() {
  171. const FormItem = Form.Item;
  172. const rowSelection = {
  173. selectedRowKeys: this.state.selectedRowKeys,
  174. onChange: (selectedRowKeys, selectedRows) => {
  175. this.setState({
  176. selectedRows: selectedRows.slice(-1),
  177. selectedRowKeys: selectedRowKeys.slice(-1)
  178. });
  179. }
  180. };
  181. const { RangePicker } = DatePicker;
  182. const theData = this.state.RowData || {};
  183. return (
  184. <div className="user-content">
  185. <div className="content-title">
  186. <span>专家订单列表</span>
  187. </div>
  188. <div className="user-search">
  189. <Input
  190. placeholder="订单编号"
  191. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  192. value={this.state.numberSearch}
  193. onChange={(e) => {
  194. this.setState({ numberSearch: e.target.value });
  195. }}
  196. />
  197. <Input
  198. placeholder="消费者名称"
  199. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  200. value={this.state.companyNameSearch}
  201. onChange={(e) => {
  202. this.setState({ companyNameSearch: e.target.value });
  203. }}
  204. />
  205. <Input
  206. placeholder="项目名称"
  207. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  208. value={this.state.entryNameSearch}
  209. onChange={(e) => {
  210. this.setState({ entryNameSearch: e.target.value });
  211. }}
  212. />
  213. <Button type="primary" onClick={this.search} style={{ marginRight: '10px' }}>
  214. 搜索
  215. </Button>
  216. <Button onClick={this.reset} style={{ marginRight: '10px' }}>
  217. 重置
  218. </Button>
  219. <span>
  220. 更多搜索<Switch checked={!this.state.searchMore} onChange={this.searchSwitch} />
  221. </span>
  222. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  223. <span style={{ marginRight: 10 }}>订单时间 :</span>
  224. <RangePicker
  225. value={[
  226. this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  227. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null
  228. ]}
  229. onChange={(data, dataString) => {
  230. this.setState({ releaseDate: dataString });
  231. }}
  232. />
  233. </div>
  234. </div>
  235. <div className="patent-table">
  236. <Spin spinning={this.state.loading}>
  237. <Table
  238. columns={this.state.columns}
  239. dataSource={this.state.dataSource}
  240. rowSelection={rowSelection}
  241. pagination={this.state.pagination}
  242. onRowClick={this.tableRowClick}
  243. />
  244. </Spin>
  245. </div>
  246. <div className="patent-desc">
  247. <Modal
  248. className="customeDetails"
  249. title="订单详情"
  250. width="1000px"
  251. visible={this.state.editvisible}
  252. onOk={this.edithandleCancel}
  253. onCancel={this.edithandleCancel}
  254. footer=""
  255. >
  256. <Form layout="horizontal" onSubmit={this.edithandleSubmit} id="demand-form">
  257. <Spin spinning={this.state.loading}>
  258. <div className="clearfix">
  259. <FormItem
  260. className="half-item"
  261. labelCol={{ span: 8 }}
  262. wrapperCol={{ span: 12 }}
  263. label="订单编号"
  264. >
  265. <span>{theData.orderNo}</span>
  266. </FormItem>
  267. <FormItem
  268. className="half-item"
  269. labelCol={{ span: 8 }}
  270. wrapperCol={{ span: 12 }}
  271. label="订单类型"
  272. >
  273. <span>{getOrderType(theData.commodityType)}</span>
  274. </FormItem>
  275. </div>
  276. <div className="clearfix">
  277. <FormItem
  278. className="half-item"
  279. labelCol={{ span: 8 }}
  280. wrapperCol={{ span: 12 }}
  281. label="订单日期"
  282. >
  283. <span>{theData.createTime}</span>
  284. </FormItem>
  285. <FormItem
  286. className="half-item"
  287. labelCol={{ span: 8 }}
  288. wrapperCol={{ span: 12 }}
  289. label="订单金额(万元)"
  290. >
  291. <span>{theData.orderAmount ? theData.orderAmount + '万元' : ''}</span>
  292. </FormItem>
  293. </div>
  294. <div className="clearfix">
  295. <FormItem
  296. className="half-item"
  297. labelCol={{ span: 8 }}
  298. wrapperCol={{ span: 12 }}
  299. label="项目名称"
  300. >
  301. <span>{theData.commodityName}</span>
  302. </FormItem>
  303. </div>
  304. <div className="clearfix">
  305. <FormItem
  306. className="half-item"
  307. labelCol={{ span: 8 }}
  308. wrapperCol={{ span: 12 }}
  309. label="消费者"
  310. >
  311. <span>{theData.buyerName}</span>
  312. </FormItem>
  313. <FormItem
  314. className="half-item"
  315. labelCol={{ span: 8 }}
  316. wrapperCol={{ span: 12 }}
  317. label="联系方式"
  318. >
  319. <span>{theData.buyerMobile}</span>
  320. </FormItem>
  321. </div>
  322. </Spin>
  323. </Form>
  324. </Modal>
  325. </div>
  326. </div>
  327. );
  328. }
  329. })
  330. );
  331. export default Order;