techList.jsx 12 KB

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