myService.jsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. import React from 'react';
  2. import ReactDom from 'react-dom';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Checkbox ,Modal, Upload ,Popconfirm} from 'antd';
  6. import NewService from "./addService.jsx";
  7. import moment from 'moment';
  8. import '../../userMangagement.less';
  9. import {intentProgress,transactionProgress,contractProgress,projectProgress,orderType, orderStage, orderState,paymentState, projectState,orderChannel, approvedState, lock,paymentMethod,transactionChannel} from '../../../../dataDic.js';
  10. import {getIntentProgress,getTransactionProgress,getProjectState,getContractProgress,getProjectProgress,splitUrl,getOrderType,getOrderStage,getOrderState,getPaymentState,getOrderChannel,getApprovedState,getLock,getPaymentMethod,getTransactionChannel} from '../../../../tools.js';
  11. const MyService=Form.create()(React.createClass({
  12. loadData(pageNo) {
  13. this.state.data = [];
  14. this.setState({
  15. loading: true
  16. });
  17. $.ajax({
  18. method: "post",
  19. dataType: "json",
  20. crossDomain: false,
  21. url: globalConfig.context + '/api/admin/order/listServiceOrder',
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. buyerName:this.state.customerName,
  26. startDate: this.state.releaseDate[0],
  27. endDate: this.state.releaseDate[1],
  28. projectStage:this.state.projectProgress,
  29. liquidationStatus:this.state.settlementState, //结算
  30. orderStatus:this.state.orderStatusSearch,
  31. orderChannel:this.state.orderChannelSearch,
  32. intention:this.state.intentOrder?1:0,
  33. formal:this.state.formalOrder?1:0
  34. },
  35. success: function (data) {
  36. let theArr = [];
  37. if (!data.data) {
  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. id: thisdata.id,
  47. orderNo: thisdata.orderNo,//订单编号
  48. orderType:thisdata.orderType,//订单类型
  49. orderStatus:thisdata.orderStatus,
  50. liquidationStatus:thisdata.liquidationStatus,
  51. createTime:thisdata.createTime,
  52. buyerName:thisdata.buyerName,
  53. signTotalAmount:thisdata.signTotalAmount,
  54. projectStage:thisdata.projectStage,
  55. approval:thisdata.approval,
  56. orderChannel:thisdata.orderChannel,
  57. salesmanName:thisdata.salesmanName,
  58. active:thisdata.active,
  59. });
  60. };
  61. this.state.pagination.current = data.data.pageNo;
  62. this.state.pagination.total = data.data.totalCount;
  63. };
  64. if(!data.data.list.length){
  65. this.state.pagination.current=0
  66. this.state.pagination.total=0
  67. }
  68. this.setState({
  69. pageNo:pageNo,
  70. dataSource: theArr,
  71. pagination: this.state.pagination,
  72. selectedRowKeys:[],
  73. signBillVisible:false
  74. });
  75. }.bind(this),
  76. }).always(function () {
  77. this.setState({
  78. loading: false
  79. });
  80. }.bind(this));
  81. },
  82. getInitialState() {
  83. return {
  84. datauser:{},
  85. selectedRowKeys: [],
  86. releaseDate: [],
  87. signBillState:false,
  88. signBillVisible:false,
  89. selectedRows: [],
  90. searchMore: true,
  91. loading: false,
  92. intentOrder:true,
  93. formalOrder:true,
  94. pagination: {
  95. defaultCurrent: 1,
  96. defaultPageSize: 10,
  97. showQuickJumper: true,
  98. pageSize: 10,
  99. onChange: function (page) {
  100. this.loadData(page);
  101. }.bind(this),
  102. showTotal: function (total) {
  103. return '共' + total + '条数据';
  104. }
  105. },
  106. columns: [
  107. {
  108. title: '订单编号',
  109. dataIndex: 'orderNo',
  110. key: 'orderNo'
  111. }, {
  112. title: '订单类型',
  113. dataIndex: 'orderType',
  114. key: 'orderType',
  115. render:text=>{return getOrderType(text)}
  116. }, {
  117. title: '下单时间',
  118. dataIndex: 'createTime',
  119. key: 'createTime'
  120. },{
  121. title: '订单客户',
  122. dataIndex: 'buyerName',
  123. key: 'buyerName'
  124. }, {
  125. title: '实际下单金额(万元)',
  126. dataIndex: 'signTotalAmount',
  127. key: 'signTotalAmount'
  128. },{
  129. title: '结算状态',
  130. dataIndex: 'liquidationStatus',
  131. key: 'liquidationStatus',
  132. render:text=>{return getPaymentState(text)}
  133. }, {
  134. title: '订单状态',
  135. dataIndex: 'orderStatus',
  136. key: 'orderStatus',
  137. render:text=>{return getOrderState(text)}
  138. }, {
  139. title: '项目状态',
  140. dataIndex: 'projectStage',
  141. key: 'projectStage',
  142. render:text=>{return getProjectState(text)}
  143. }, {
  144. title: '是否特批',
  145. dataIndex: 'approval',
  146. key: 'approval',
  147. render:text=>{return text==2?'已特批':'未特批'}
  148. },{
  149. title: '订单渠道',
  150. dataIndex: 'orderChannel',
  151. key: 'orderChannel',
  152. render:text=>{return getOrderChannel(text)}
  153. },{
  154. title: '财务负责人',
  155. dataIndex: 'salesmanName',
  156. key: 'salesmanName'
  157. },
  158. {
  159. title: '操作',
  160. dataIndex: 'active',
  161. key: 'active',
  162. render: (text, record, index) => {
  163. return <div>
  164. {text.confirmIntention&&<Popconfirm title={'请确认您是否受理来自【'+record.buyerName+'】发起的服务意向订单?'} onConfirm={(e)=>{this.admissibleOrderOk(record)}} onCancel={(e)=>{this.admissibleOrderCancel(record)}} okText="同意" cancelText="拒绝">
  165. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">受理意向</Button>
  166. </Popconfirm>}
  167. {text.applySign&&<Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation(),this.signBill(record)}} type="primary">签单</Button> }
  168. {text.applyForCancel&&<Popconfirm title={'请确认您是否取消客户【'+record.buyerName+'】的服务订单,订单取消将导致业务终止!'} onConfirm={(e)=>{this.cancelOrder(record)}} okText="确认" cancelText="取消">
  169. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">取消订单</Button>
  170. </Popconfirm>}
  171. {text.applyRevoke&&<Popconfirm title={'请确认您是否作废客户【'+record.buyerName+'】的服务订单,订单作废将导致订单失效!'} onConfirm={(e)=>{this.scrapOrder(record)}} okText="确认" cancelText="取消">
  172. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">作废</Button>
  173. </Popconfirm>}
  174. {text.applyLock &&<Popconfirm title={'请确认您是否锁定客户【'+record.buyerName+'】的服务订单,订单锁定将导致订单暂停!'} onConfirm={(e)=>{this.lockOrder(record)}} okText="确认" cancelText="取消">
  175. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">锁定<Icon type="lock" /></Button>
  176. </Popconfirm>}
  177. {text.agreeRefund &&<Popconfirm title={'请确认您是否同意客户【'+record.buyerName+'】的退款?'} onConfirm={(e)=>{this.refundOk(record)}} okText="确认" cancelText="取消">
  178. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">同意退款</Button>
  179. </Popconfirm>}
  180. {text.refuseRefund &&<Popconfirm title={'请确认您是否拒绝客户【'+record.buyerName+'】的退款?'} onConfirm={(e)=>{this.refundCancel(record)}} okText="确认" cancelText="取消">
  181. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">拒绝退款</Button>
  182. </Popconfirm>}
  183. {text.applyUnLock&&<Popconfirm title={'请确认您是否解锁客户【'+record.buyerName+'】的服务订单,订单解锁将导致订单正常!'} onConfirm={(e)=>{this.unlockOrder(record)}} okText="确认" cancelText="取消">
  184. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">解锁<Icon type="unlock" /></Button>
  185. </Popconfirm>}
  186. </div>
  187. }
  188. }
  189. ],
  190. dataSource: [],
  191. };
  192. },
  193. //是否退款
  194. refundCancel(record){
  195. this.refund(record,0)
  196. },
  197. refundOk(record){
  198. this.refund(record,1)
  199. },
  200. refund(record,index){
  201. this.setState({
  202. signBillVisible:false,
  203. selectedRowKeys: [],
  204. loading: true,
  205. userDetaile:false
  206. });
  207. $.ajax({
  208. method: "get",
  209. dataType: "json",
  210. crossDomain: false,
  211. url: globalConfig.context + '/api/admin/order/confirmRefund',
  212. data: {
  213. orderNo:record.orderNo,
  214. confirm:index
  215. }
  216. }).done(function (data) {
  217. if (!data.error.length) {
  218. message.success('操作成功!');
  219. this.setState({
  220. loading: false,
  221. showDesc:false
  222. });
  223. }
  224. this.loadData(this.state.pageNo);
  225. }.bind(this));
  226. },
  227. //受理订单
  228. admissibleOrderOk(e){
  229. this.admissibleOrder(e,true)
  230. },
  231. admissibleOrderCancel(e){
  232. this.admissibleOrder(e,false)
  233. },
  234. admissibleOrder(record,index) {
  235. this.setState({
  236. signBillVisible:false,
  237. selectedRowKeys: [],
  238. loading: true,
  239. userDetaile:false
  240. });
  241. $.ajax({
  242. method: "POST",
  243. dataType: "json",
  244. crossDomain: false,
  245. url: globalConfig.context + '/api/admin/order/confirmIntention',
  246. data: {
  247. orderNo:record.orderNo,
  248. confirm:index
  249. }
  250. }).done(function (data) {
  251. if (!data.error.length) {
  252. message.success('操作成功!');
  253. this.setState({
  254. loading: false,
  255. showDesc:false
  256. });
  257. } else {
  258. message.warning(data.error[0].message);
  259. this.setState({
  260. showDesc:true
  261. })
  262. };
  263. this.loadData(this.state.pageNo);
  264. }.bind(this));
  265. },
  266. //取消订单
  267. cancelOrder(e){
  268. this.operation(e,3)
  269. },
  270. //作废订单
  271. scrapOrder(e){
  272. this.operation(e,2)
  273. },
  274. //锁定订单
  275. lockOrder(e){
  276. this.operation(e,0)
  277. },
  278. //解锁订单
  279. unlockOrder(e){
  280. this.operation(e,1)
  281. },
  282. //签单
  283. signBill(ids){
  284. this.setState({
  285. uid:ids,
  286. signBillVisible:true
  287. })
  288. },
  289. componentWillMount() {
  290. this.loadData();
  291. },
  292. tableRowClick(record, index) {
  293. this.state.userDetaile=true;
  294. this.state.datauser = record;
  295. this.setState({
  296. signBillVisible:false,
  297. signBillState:true,
  298. showDesc: true
  299. });
  300. },
  301. //列表各种骚操作
  302. operation(record,index) {
  303. this.setState({
  304. selectedRowKeys: [],
  305. loading: true,
  306. showDesc:false
  307. });
  308. $.ajax({
  309. method: "get",
  310. dataType: "json",
  311. crossDomain: false,
  312. url: globalConfig.context + '/api/admin/order/lockOrRevokeOrder',
  313. data: {
  314. orderNo:record.orderNo,
  315. operatorType:index
  316. }
  317. }).done(function (data) {
  318. if (!data.error.length) {
  319. message.success('操作成功!');
  320. this.setState({
  321. loading: false,
  322. });
  323. } else {
  324. message.warning(data.error[0].message);
  325. };
  326. this.loadData(this.state.pageNo);
  327. }.bind(this));
  328. },
  329. addClick() {
  330. this.state.userDetaile=false;
  331. this.setState({
  332. signBillVisible:false,
  333. showDesc: true
  334. });
  335. },
  336. closeDesc(e, s) {
  337. this.state.userDetaile=false;
  338. this.state.showDesc = e;
  339. if (s) {
  340. this.loadData(this.state.pageNo);
  341. };
  342. },
  343. searchSwitch() {
  344. this.setState({
  345. signBillVisible:false,
  346. searchMore: !this.state.searchMore
  347. });
  348. },
  349. search() {
  350. this.setState({
  351. signBillVisible:false
  352. })
  353. this.loadData();
  354. },
  355. reset() {
  356. this.setState({
  357. signBillVisible:false
  358. })
  359. this.state.customerName='';
  360. this.state.releaseDate[0] = undefined;
  361. this.state.releaseDate[1] = undefined;
  362. this.state.projectProgress = undefined;
  363. this.state.settlementState = undefined;
  364. this.state.orderStatusSearch = undefined;
  365. this.state.orderChannelSearch = undefined;
  366. this.state.formalOrder=true;
  367. this.state.intentOrder=true;
  368. this.loadData();
  369. },
  370. render() {
  371. const FormItem = Form.Item;
  372. const formItemLayout = {
  373. labelCol: { span: 8 },
  374. wrapperCol: { span: 14 },
  375. };
  376. const rowSelection = {
  377. selectedRowKeys: this.state.selectedRowKeys,
  378. onChange: (selectedRowKeys, selectedRows) => {
  379. this.setState({
  380. selectedRows: selectedRows.slice(-1),
  381. selectedRowKeys: selectedRowKeys.slice(-1)
  382. });
  383. },
  384. onSelectAll: (selected, selectedRows, changeRows) => {
  385. this.setState({
  386. selectedRowKeys:[]
  387. })
  388. },
  389. };
  390. const hasSelected = this.state.selectedRowKeys.length > 0;
  391. const { RangePicker } = DatePicker;
  392. return (
  393. <div className="user-content" >
  394. <div className="content-title">
  395. <span style={{fontSize:'16px'}}>科技服务订单</span>
  396. <div className="user-search">
  397. <Input placeholder="客户名称" style={{width:'150px'}}
  398. value={this.state.customerName}
  399. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  400. <RangePicker
  401. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  402. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  403. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  404. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索<Icon type="search" /></Button>
  405. <Button onClick={this.reset}>重置 <Icon type="reload" /></Button>
  406. <span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  407. <Button type="primary" className="addButton" onClick={this.addClick} >开单<Icon type="plus" /></Button>
  408. </div>
  409. <div className='clearfix' style={{marginTop:'5px'}}>
  410. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  411. <Checkbox checked={this.state.intentOrder} onChange={(e)=>{this.setState({intentOrder:!this.state.intentOrder})}}>意向订单</Checkbox>
  412. <Checkbox checked={this.state.formalOrder} onChange={(e)=>{this.setState({formalOrder:!this.state.formalOrder})}}>正式订单</Checkbox>
  413. <Select placeholder="订单状态"
  414. style={{ width: 150 ,marginRight:'10px',marginBottom:'10px'}}
  415. value={this.state.orderStatusSearch}
  416. onChange={(e) => { this.setState({ orderStatusSearch: e }) }}>
  417. {
  418. orderState.map(function (item) {
  419. return <Select.Option key={item.value} >{item.key}</Select.Option>
  420. })
  421. }
  422. </Select>
  423. <Select placeholder="结算状态"
  424. style={{ width: 150 ,marginRight:'10px'}}
  425. value={this.state.settlementState}
  426. onChange={(e) => { this.setState({ settlementState: e }) }}>
  427. {
  428. paymentState.map(function (item) {
  429. return <Select.Option key={item.value} >{item.key}</Select.Option>
  430. })
  431. }
  432. </Select>
  433. <Select placeholder="项目进度"
  434. style={{ width: 150 ,marginRight:'10px'}}
  435. value={this.state.projectProgress}
  436. onChange={(e) => { this.setState({ projectProgress: e }) }}>
  437. {
  438. projectState.map(function (item) {
  439. return <Select.Option key={item.value} >{item.key}</Select.Option>
  440. })
  441. }
  442. </Select>
  443. <Select placeholder="订单渠道"
  444. style={{ width: 150 }}
  445. value={this.state.orderChannelSearch}
  446. onChange={(e) => { this.setState({ orderChannelSearch: e }) }}>
  447. {
  448. orderChannel.map(function (item) {
  449. return <Select.Option key={item.value} >{item.key}</Select.Option>
  450. })
  451. }
  452. </Select>
  453. </div>
  454. </div>
  455. <div className="patent-table">
  456. <Spin spinning={this.state.loading}>
  457. <Table columns={this.state.columns}
  458. dataSource={this.state.dataSource}
  459. rowSelection={rowSelection}
  460. pagination={this.state.pagination}
  461. onRowClick={this.tableRowClick} />
  462. </Spin>
  463. </div>
  464. <NewService
  465. uid={this.state.uid}
  466. signBillVisible={this.state.signBillVisible}
  467. signBillState={this.state.signBillState}
  468. operation={this.operation}
  469. admissibleOrder={this.admissibleOrder}
  470. userDetaile={this.state.userDetaile}
  471. datauser={this.state.datauser}
  472. showDesc={this.state.showDesc}
  473. closeDesc={this.closeDesc} />
  474. </div >
  475. </div>
  476. );
  477. }
  478. }));
  479. export default MyService;