techList.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. import React from 'react';
  2. import { Spin, Button, Tabs, Table } from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js'
  4. import $ from 'jquery/src/ajax';
  5. import DemandDesc from '../../portal/search/demandDesc';
  6. import AchievementDesc from '../../portal/search/achievementDesc';
  7. import { getOrderStatus } from '../../tools';
  8. import './content.less';
  9. const TabPane = Tabs.TabPane;
  10. const Content = React.createClass({
  11. achievementLoadData(pageNo) {
  12. this.state.data = [];
  13. this.setState({
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "get",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + "/api/user/portal/order/achievementOrderList",
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.achievementPagination.pageSize
  24. },
  25. success: function (data) {
  26. let theArr = [];
  27. if (!data.data || !data.data.list) {
  28. if (data.error && data.error.length) {
  29. message.warning(data.error[0].message);
  30. };
  31. } else {
  32. for (let i = 0; i < data.data.list.length; i++) {
  33. let thisdata = data.data.list[i];
  34. theArr.push({
  35. key: i,
  36. orderId: thisdata.id,
  37. serialNumber: thisdata.serialNumber,
  38. id: thisdata.achievementId,
  39. createTime: thisdata.createTime,
  40. status: thisdata.status,
  41. intentionMoney: thisdata.intentionMoney,
  42. contractMoney: thisdata.contractMoney,
  43. commission: thisdata.commission,
  44. serviceMoney: thisdata.serviceMoney,
  45. name: thisdata.name,
  46. achievementSerialNumber: thisdata.achievementSerialNumber,
  47. deletedSign: thisdata.deletedSign,
  48. auditStatus: thisdata.auditStatus,
  49. createTimeFormattedDate: thisdata.createTimeFormattedDate
  50. });
  51. };
  52. }
  53. this.state.achievementPagination.current = data.data.pageNo;
  54. this.state.achievementPagination.total = data.data.totalCount;
  55. this.setState({
  56. achievementDataSource: theArr,
  57. achievementPagination: this.state.achievementPagination
  58. });
  59. }.bind(this),
  60. }).always(function () {
  61. this.setState({
  62. loading: false
  63. });
  64. }.bind(this));
  65. },
  66. demandLoadData(pageNo) {
  67. this.state.data = [];
  68. this.setState({
  69. loading: true
  70. });
  71. $.ajax({
  72. method: "get",
  73. dataType: "json",
  74. crossDomain: false,
  75. url: globalConfig.context + "/api/user/portal/order/demandOrderList",
  76. data: {
  77. pageNo: pageNo || 1,
  78. pageSize: this.state.demandPagination.pageSize
  79. },
  80. success: function (data) {
  81. let theArr = [];
  82. if (!data.data || !data.data.list) {
  83. if (data.error && data.error.length) {
  84. message.warning(data.error[0].message);
  85. };
  86. } else {
  87. for (let i = 0; i < data.data.list.length; i++) {
  88. let thisdata = data.data.list[i];
  89. theArr.push({
  90. key: i,
  91. orderId: thisdata.id,
  92. name: thisdata.name,
  93. demandSerialNumber: thisdata.demandSerialNumber,
  94. id: thisdata.demandId,
  95. createTime: thisdata.createTime,
  96. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  97. serialNumber: thisdata.serialNumber,
  98. status: thisdata.status,
  99. auditStatus: thisdata.auditStatus,
  100. deletedSign: thisdata.deletedSign,
  101. intentionMoney: thisdata.intentionMoney, //意向金
  102. contractMoney: thisdata.contractMoney, //合同金
  103. commission: thisdata.commission, //佣金
  104. serviceMoney: thisdata.serviceMoney //服务金
  105. });
  106. };
  107. }
  108. this.state.demandPagination.current = data.data.pageNo;
  109. this.state.demandPagination.total = data.data.totalCount;
  110. this.setState({
  111. demandDataSource: theArr,
  112. demandPagination: this.state.demandPagination
  113. });
  114. }.bind(this),
  115. }).always(function () {
  116. this.setState({
  117. loading: false
  118. });
  119. }.bind(this));
  120. },
  121. getInitialState() {
  122. return {
  123. loading: false,
  124. demandShowDesc: false,
  125. achievementShowDesc: false,
  126. achievementPagination: {
  127. defaultCurrent: 1,
  128. defaultPageSize: 10,
  129. showQuickJumper: true,
  130. pageSize: 10,
  131. onChange: function (page) {
  132. this.achievementLoadData(page);
  133. }.bind(this),
  134. showTotal: function (total) {
  135. return '共' + total + '条数据';
  136. }
  137. },
  138. achievementColumns: [
  139. {
  140. title: '编号',
  141. dataIndex: 'serialNumber',
  142. key: 'serialNumber',
  143. }, {
  144. title: '成果名称',
  145. dataIndex: 'name',
  146. key: 'name',
  147. }, {
  148. title: '订单状态',
  149. dataIndex: 'auditStatus',
  150. key: 'auditStatus',
  151. render: (text, record) => {
  152. if (record.deletedSign == 1) {
  153. return "已删除"
  154. } else if (record.auditStatus != 3) {
  155. return "已下架"
  156. } else {
  157. return "正常"
  158. }
  159. }
  160. }, {
  161. title: '流程状态',
  162. dataIndex: 'status',
  163. key: 'status',
  164. render: (text, record) => { return getOrderStatus(text); }
  165. }, {
  166. title: '意向金',
  167. dataIndex: 'intentionMoney',
  168. key: 'intentionMoney',
  169. }, {
  170. title: '合同金',
  171. dataIndex: 'contractMoney',
  172. key: 'contractMoney',
  173. }, {
  174. title: '佣金',
  175. dataIndex: 'commission',
  176. key: 'commission',
  177. }, {
  178. title: '服务金',
  179. dataIndex: 'serviceMoney',
  180. key: 'serviceMoney',
  181. }, {
  182. title: '接单时间',
  183. dataIndex: 'createTimeFormattedDate',
  184. key: 'createTimeFormattedDate',
  185. }
  186. ],
  187. achievementDataSource: [],
  188. demandPagination: {
  189. defaultCurrent: 1,
  190. defaultPageSize: 10,
  191. showQuickJumper: true,
  192. pageSize: 10,
  193. onChange: function (page) {
  194. this.demandLoadData(page);
  195. }.bind(this),
  196. showTotal: function (total) {
  197. return '共' + total + '条数据';
  198. }
  199. },
  200. demandColumns: [
  201. {
  202. title: '编号',
  203. dataIndex: 'serialNumber',
  204. key: 'serialNumber',
  205. }, {
  206. title: '需求名称',
  207. dataIndex: 'name',
  208. key: 'name',
  209. }, {
  210. title: '订单状态',
  211. dataIndex: 'auditStatus',
  212. key: 'auditStatus',
  213. render: (text, record) => {
  214. if (record.deletedSign == 1) {
  215. return "已删除"
  216. } else if (record.auditStatus != 3) {
  217. return "已下架"
  218. } else {
  219. return "正常"
  220. }
  221. }
  222. }, {
  223. title: '流程状态',
  224. dataIndex: 'status',
  225. key: 'status',
  226. render: (text, record) => { return getOrderStatus(text); }
  227. }, {
  228. title: '意向金',
  229. dataIndex: 'intentionMoney',
  230. key: 'intentionMoney',
  231. }, {
  232. title: '合同金',
  233. dataIndex: 'contractMoney',
  234. key: 'contractMoney',
  235. }, {
  236. title: '佣金',
  237. dataIndex: 'commission',
  238. key: 'commission',
  239. }, {
  240. title: '服务金',
  241. dataIndex: 'serviceMoney',
  242. key: 'serviceMoney',
  243. }, {
  244. title: '接单时间',
  245. dataIndex: 'createTimeFormattedDate',
  246. key: 'createTimeFormattedDate',
  247. }
  248. ],
  249. demandDataSource: [],
  250. };
  251. },
  252. componentWillMount() {
  253. this.achievementLoadData();
  254. this.demandLoadData();
  255. },
  256. tabChange(key) {
  257. },
  258. demandRowClick(record, index) {
  259. this.state.demandRowData = record;
  260. if (record.deletedSign != 1 && record.auditStatus == 3) {
  261. this.setState({
  262. demandShowDesc: true
  263. });
  264. };
  265. },
  266. achievementRowClick(record, index) {
  267. this.state.achievementRowData = record;
  268. if (record.deletedSign != 1 && record.auditStatus == 3) {
  269. this.setState({
  270. achievementShowDesc: true
  271. });
  272. };
  273. },
  274. demandCloseDesc(e) {
  275. this.setState({
  276. demandShowDesc: e
  277. });
  278. this.demandLoadData();
  279. },
  280. achievementCloseDesc(e) {
  281. this.setState({
  282. achievementShowDesc: e
  283. });
  284. this.achievementLoadData();
  285. },
  286. render() {
  287. return (
  288. <div className="collection">
  289. <Spin spinning={this.state.loading} >
  290. <Tabs defaultActiveKey="1" onChange={this.tabChange}>
  291. <TabPane tab="我的成果订单" key="1">
  292. <Table columns={this.state.achievementColumns}
  293. dataSource={this.state.achievementDataSource}
  294. pagination={this.state.achievementPagination}
  295. onRowClick={this.achievementRowClick} />
  296. </TabPane>
  297. <TabPane tab="我的需求订单" key="2">
  298. <Table columns={this.state.demandColumns}
  299. dataSource={this.state.demandDataSource}
  300. pagination={this.state.demandPagination}
  301. onRowClick={this.demandRowClick} />
  302. </TabPane>
  303. </Tabs>
  304. </Spin>
  305. <DemandDesc data={this.state.demandRowData}
  306. showDesc={this.state.demandShowDesc}
  307. closeDesc={this.demandCloseDesc} />
  308. <AchievementDesc data={this.state.achievementRowData}
  309. showDesc={this.state.achievementShowDesc}
  310. closeDesc={this.achievementCloseDesc} />
  311. </div>
  312. )
  313. }
  314. });
  315. export default Content;