myService.jsx 22 KB

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