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