memberOrderS.jsx 9.1 KB

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