achievementOrderS.jsx 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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/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:2,
  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: 'commodityName',
  126. key: 'commodityName',
  127. render: (text) => {
  128. return (
  129. <Tooltip title={text}>
  130. {text && text.length >12 ? text.substr(0,12) + '...' : text}
  131. </Tooltip>
  132. );
  133. }
  134. },
  135. {
  136. title: '消费者',
  137. dataIndex: 'buyerName',
  138. key: 'buyerName',
  139. },
  140. {
  141. title: '联系方式',
  142. dataIndex: 'buyerMobile',
  143. key: 'buyerMobile'
  144. },
  145. ],
  146. dataSource: []
  147. };
  148. },
  149. componentWillMount() {
  150. this.loadData();
  151. },
  152. //项目列表整行点击
  153. tableRowClick(record, index) {
  154. this.state.RowData = record;
  155. this.setState({
  156. editvisible: true
  157. });
  158. },
  159. edithandleCancel(e) {
  160. this.setState({
  161. editvisible: false
  162. });
  163. },
  164. search() {
  165. this.loadData();
  166. },
  167. //搜索部分的清零
  168. reset() {
  169. this.state.numberSearch = '';
  170. this.state.typeSearch = undefined;
  171. this.state.companyNameSearch = '';
  172. this.state.entryNameSearch = '';
  173. this.state.releaseDate = [];
  174. this.state.searchMore=true;
  175. this.loadData();
  176. },
  177. searchSwitch() {
  178. this.setState({
  179. searchMore: !this.state.searchMore
  180. });
  181. },
  182. render() {
  183. const FormItem = Form.Item;
  184. const rowSelection = {
  185. selectedRowKeys: this.state.selectedRowKeys,
  186. onChange: (selectedRowKeys, selectedRows) => {
  187. this.setState({
  188. selectedRows: selectedRows.slice(-1),
  189. selectedRowKeys: selectedRowKeys.slice(-1)
  190. });
  191. }
  192. };
  193. const { RangePicker } = DatePicker;
  194. const theData = this.state.RowData || {};
  195. return (
  196. <div className="user-content">
  197. <div className="content-title">
  198. <span>成果订单列表</span>
  199. </div>
  200. <div className="user-search">
  201. <Input
  202. placeholder="订单编号"
  203. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  204. value={this.state.numberSearch}
  205. onChange={(e) => {
  206. this.setState({ numberSearch: e.target.value });
  207. }}
  208. />
  209. <Input
  210. placeholder="消费者名称"
  211. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  212. value={this.state.companyNameSearch}
  213. onChange={(e) => {
  214. this.setState({ companyNameSearch: e.target.value });
  215. }}
  216. />
  217. <Input
  218. placeholder="项目名称"
  219. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  220. value={this.state.entryNameSearch}
  221. onChange={(e) => {
  222. this.setState({ entryNameSearch: e.target.value });
  223. }}
  224. />
  225. <Button type="primary" onClick={this.search} style={{ marginRight: '10px' }}>
  226. 搜索
  227. </Button>
  228. <Button onClick={this.reset} style={{ marginRight: '10px' }}>
  229. 重置
  230. </Button>
  231. <span>
  232. 更多搜索<Switch checked={!this.state.searchMore} onChange={this.searchSwitch} />
  233. </span>
  234. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  235. <span style={{ marginRight: 10 }}>订单时间 :</span>
  236. <RangePicker
  237. value={[
  238. this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  239. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null
  240. ]}
  241. onChange={(data, dataString) => {
  242. this.setState({ releaseDate: dataString });
  243. }}
  244. />
  245. </div>
  246. </div>
  247. <div className="patent-table">
  248. <Spin spinning={this.state.loading}>
  249. <Table
  250. columns={this.state.columns}
  251. dataSource={this.state.dataSource}
  252. rowSelection={rowSelection}
  253. pagination={this.state.pagination}
  254. onRowClick={this.tableRowClick}
  255. />
  256. </Spin>
  257. </div>
  258. <div className="patent-desc">
  259. <Modal
  260. className="customeDetails"
  261. title="订单详情"
  262. width="1000px"
  263. visible={this.state.editvisible}
  264. onOk={this.edithandleCancel}
  265. onCancel={this.edithandleCancel}
  266. footer=""
  267. >
  268. <Form layout="horizontal" onSubmit={this.edithandleSubmit} id="demand-form">
  269. <Spin spinning={this.state.loading}>
  270. <div className="clearfix">
  271. <FormItem
  272. className="half-item"
  273. labelCol={{ span: 8 }}
  274. wrapperCol={{ span: 12 }}
  275. label="订单编号"
  276. >
  277. <span>{theData.orderNo}</span>
  278. </FormItem>
  279. <FormItem
  280. className="half-item"
  281. labelCol={{ span: 8 }}
  282. wrapperCol={{ span: 12 }}
  283. label="订单类型"
  284. >
  285. <span>{getOrderType(theData.commodityType)}</span>
  286. </FormItem>
  287. </div>
  288. <div className="clearfix">
  289. <FormItem
  290. className="half-item"
  291. labelCol={{ span: 8 }}
  292. wrapperCol={{ span: 12 }}
  293. label="订单日期"
  294. >
  295. <span>{theData.createTime}</span>
  296. </FormItem>
  297. <FormItem
  298. className="half-item"
  299. labelCol={{ span: 8 }}
  300. wrapperCol={{ span: 12 }}
  301. label="订单金额(万元)"
  302. >
  303. <span>{theData.orderAmount ? theData.orderAmount + '万元' : ''}</span>
  304. </FormItem>
  305. </div>
  306. <div className="clearfix">
  307. <FormItem
  308. className="half-item"
  309. labelCol={{ span: 8 }}
  310. wrapperCol={{ span: 12 }}
  311. label="项目名称"
  312. >
  313. <span>{theData.commodityName}</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>{theData.buyerName}</span>
  324. </FormItem>
  325. <FormItem
  326. className="half-item"
  327. labelCol={{ span: 8 }}
  328. wrapperCol={{ span: 12 }}
  329. label="联系方式"
  330. >
  331. <span>{theData.buyerMobile}</span>
  332. </FormItem>
  333. </div>
  334. </Spin>
  335. </Form>
  336. </Modal>
  337. </div>
  338. </div>
  339. );
  340. }
  341. })
  342. );
  343. export default Order;