myService.jsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  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,Tabs} 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 {
  11. getIntentProgress,
  12. getTransactionProgress,
  13. getProjectState,
  14. getContractProgress,
  15. getProjectProgress,
  16. splitUrl,
  17. getOrderType,
  18. getOrderStage,
  19. getOrderState,
  20. getPaymentState,
  21. getOrderChannel,
  22. getApprovedState,
  23. getLock,
  24. getPaymentMethod,
  25. getTransactionChannel,
  26. ShowModal
  27. } from "../../../../tools.js";
  28. import ShowModalDiv from "@/showModal.jsx";
  29. import {ChooseList} from "../../orderNew/chooseList";
  30. const {TabPane} = Tabs
  31. const MyService=Form.create()(React.createClass({
  32. loadData(pageNo) {
  33. this.state.data = [];
  34. this.setState({
  35. loading: true
  36. });
  37. $.ajax({
  38. method: "post",
  39. dataType: "json",
  40. crossDomain: false,
  41. url: globalConfig.context + '/api/admin/order/listServiceOrder',
  42. data: {
  43. pageNo: pageNo || 1,
  44. pageSize: this.state.pagination.pageSize,
  45. buyerName:this.state.customerName,
  46. orderNo:this.state.orderNo,
  47. startDate: this.state.releaseDate[0],
  48. endDate: this.state.releaseDate[1],
  49. projectStage:this.state.projectProgress,
  50. liquidationStatus:this.state.settlementState, //结算
  51. orderStatus:this.state.orderStatusSearch,
  52. approval:this.state.approval,
  53. orderChannel:this.state.orderChannelSearch,
  54. intention:this.state.intentOrder?1:0,
  55. formal:this.state.formalOrder?1:0,
  56. },
  57. success: function (data) {
  58. ShowModal(this);
  59. let theArr = [];
  60. if (!data.data) {
  61. if (data.error && data.error.length) {
  62. message.warning(data.error[0].message);
  63. };
  64. } else {
  65. for (let i = 0; i < data.data.list.length; i++) {
  66. let thisdata = data.data.list[i];
  67. theArr.push({
  68. key: i,
  69. id: thisdata.id,
  70. orderNo: thisdata.orderNo,//订单编号
  71. orderType:thisdata.orderType,//订单类型
  72. orderStatus:thisdata.orderStatus,
  73. liquidationStatus:thisdata.liquidationStatus,
  74. createTime:thisdata.createTime,
  75. buyerName:thisdata.buyerName,
  76. signTotalAmount:thisdata.signTotalAmount,
  77. projectStage:thisdata.projectStage,
  78. approval:thisdata.approval,
  79. orderChannel:thisdata.orderChannel,
  80. salesmanName:thisdata.salesmanName,
  81. active:thisdata.active,
  82. signTime:thisdata.signTime,
  83. financeName:thisdata.financeName
  84. });
  85. };
  86. this.state.pagination.current = data.data.pageNo;
  87. this.state.pagination.total = data.data.totalCount;
  88. };
  89. if(!data.data.list.length){
  90. this.state.pagination.current=0
  91. this.state.pagination.total=0
  92. }
  93. this.setState({
  94. pageNo:pageNo,
  95. dataSource: theArr,
  96. pagination: this.state.pagination,
  97. selectedRowKeys:[],
  98. });
  99. }.bind(this),
  100. }).always(function () {
  101. this.setState({
  102. loading: false
  103. });
  104. }.bind(this));
  105. },
  106. getInitialState() {
  107. return {
  108. datauser:{},
  109. selectedRowKeys: [],
  110. releaseDate: [],
  111. signBillState:false,
  112. signBillVisible:false,
  113. selectedRows: [],
  114. searchMore: true,
  115. loading: false,
  116. intentOrder:true,
  117. formalOrder:true,
  118. pagination: {
  119. defaultCurrent: 1,
  120. defaultPageSize: 10,
  121. showQuickJumper: true,
  122. pageSize: 10,
  123. onChange: function (page) {
  124. this.loadData(page);
  125. }.bind(this),
  126. showTotal: function (total) {
  127. return '共' + total + '条数据';
  128. }
  129. },
  130. columns: [
  131. {
  132. title: '订单编号',
  133. dataIndex: 'orderNo',
  134. key: 'orderNo'
  135. }, {
  136. title: '订单类型',
  137. dataIndex: 'orderType',
  138. key: 'orderType',
  139. render:text=>{return getOrderType(text)}
  140. }, {
  141. title: '下单时间',
  142. dataIndex: 'createTime',
  143. key: 'createTime'
  144. },{
  145. title: '签单时间',
  146. dataIndex: 'signTime',
  147. key: 'signTime'
  148. },{
  149. title: '订单客户',
  150. dataIndex: 'buyerName',
  151. key: 'buyerName',
  152. render:(text)=>{
  153. return (text&&text.length>8?text.substr(0,8)+'...':text)
  154. }
  155. }, {
  156. title: '实际下单金额(万元)',
  157. dataIndex: 'signTotalAmount',
  158. key: 'signTotalAmount'
  159. },{
  160. title: '结算状态',
  161. dataIndex: 'liquidationStatus',
  162. key: 'liquidationStatus',
  163. render:text=>{return getPaymentState(text)}
  164. }, {
  165. title: '订单状态',
  166. dataIndex: 'orderStatus',
  167. key: 'orderStatus',
  168. render:text=>{return getOrderState(text)}
  169. }, {
  170. title: '项目状态',
  171. dataIndex: 'projectStage',
  172. key: 'projectStage',
  173. render:text=>{return getProjectState(text)}
  174. }, {
  175. title: '是否特批',
  176. dataIndex: 'approval',
  177. key: 'approval',
  178. render:text=>{return getApprovedState(text)}
  179. },{
  180. title: '订单渠道',
  181. dataIndex: 'orderChannel',
  182. key: 'orderChannel',
  183. render:text=>{return getOrderChannel(text)}
  184. },{
  185. title: '订单负责人',
  186. dataIndex: 'salesmanName',
  187. key: 'salesmanName'
  188. },{
  189. title: '财务负责人',
  190. dataIndex: 'financeName',
  191. key: 'financeName'
  192. },
  193. {
  194. title: '操作',
  195. dataIndex: 'active',
  196. key: 'active',
  197. render: (text, record, index) => {
  198. return <div>
  199. {text.confirmIntention&&<Popconfirm title={'请确认您是否受理来自【'+record.buyerName+'】发起的服务意向订单?'} onConfirm={(e)=>{this.admissibleOrderOk(record)}} onCancel={(e)=>{this.admissibleOrderCancel(record)}} okText="同意" cancelText="拒绝">
  200. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">受理意向</Button>
  201. </Popconfirm>}
  202. {/*{text.applySign&&<Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation(),this.signBill(record)}} type="primary">签单</Button> } */}
  203. {text.applyForCancel&&<Popconfirm title={'请确认您是否取消客户【'+record.buyerName+'】的服务订单,订单取消将导致业务终止!'} onConfirm={(e)=>{this.cancelOrder(record)}} okText="确认" cancelText="取消">
  204. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">取消订单</Button>
  205. </Popconfirm>}
  206. {text.applyRevoke&&<Popconfirm title={'请确认您是否作废客户【'+record.buyerName+'】的服务订单,订单作废将导致订单失效!'} onConfirm={(e)=>{this.scrapOrder(record)}} okText="确认" cancelText="取消">
  207. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">作废</Button>
  208. </Popconfirm>}
  209. {text.applyLock &&<Popconfirm title={'请确认您是否锁定客户【'+record.buyerName+'】的服务订单,订单锁定将导致订单暂停!'} onConfirm={(e)=>{this.lockOrder(record)}} okText="确认" cancelText="取消">
  210. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">锁定<Icon type="lock" /></Button>
  211. </Popconfirm>}
  212. {text.agreeRefund &&<Popconfirm title={'请确认您是否同意客户【'+record.buyerName+'】的退款?'} onConfirm={(e)=>{this.refundOk(record)}} okText="确认" cancelText="取消">
  213. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">同意退款</Button>
  214. </Popconfirm>}
  215. {text.refuseRefund &&<Popconfirm title={'请确认您是否拒绝客户【'+record.buyerName+'】的退款?'} onConfirm={(e)=>{this.refundCancel(record)}} okText="确认" cancelText="取消">
  216. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">拒绝退款</Button>
  217. </Popconfirm>}
  218. {text.applyUnLock&&<Popconfirm title={'请确认您是否解锁客户【'+record.buyerName+'】的服务订单,订单解锁将导致订单正常!'} onConfirm={(e)=>{this.unlockOrder(record)}} okText="确认" cancelText="取消">
  219. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">解锁<Icon type="unlock" /></Button>
  220. </Popconfirm>}
  221. </div>
  222. }
  223. }
  224. ],
  225. dataSource: [],
  226. };
  227. },
  228. //是否退款
  229. refundCancel(record){
  230. this.refund(record,0)
  231. },
  232. refundOk(record){
  233. this.refund(record,1)
  234. },
  235. refund(record,index){
  236. this.setState({
  237. signBillVisible:false,
  238. selectedRowKeys: [],
  239. loading: true,
  240. userDetaile:false
  241. });
  242. $.ajax({
  243. method: "get",
  244. dataType: "json",
  245. crossDomain: false,
  246. url: globalConfig.context + '/api/admin/order/confirmRefund',
  247. data: {
  248. orderNo:record.orderNo,
  249. confirm:index
  250. }
  251. }).done(function (data) {
  252. if (!data.error.length) {
  253. message.success('操作成功!');
  254. this.setState({
  255. loading: false,
  256. showDesc:false
  257. });
  258. }
  259. this.loadData(this.state.pageNo);
  260. }.bind(this));
  261. },
  262. //受理订单
  263. admissibleOrderOk(e){
  264. this.admissibleOrder(e,true)
  265. },
  266. admissibleOrderCancel(e){
  267. this.admissibleOrder(e,false)
  268. },
  269. admissibleOrder(record,index) {
  270. this.setState({
  271. signBillVisible:false,
  272. selectedRowKeys: [],
  273. loading: true,
  274. userDetaile:false
  275. });
  276. $.ajax({
  277. method: "POST",
  278. dataType: "json",
  279. crossDomain: false,
  280. url: globalConfig.context + '/api/admin/order/confirmIntention',
  281. data: {
  282. orderNo:record.orderNo,
  283. confirm:index
  284. }
  285. }).done(function (data) {
  286. if (!data.error.length) {
  287. message.success('操作成功!');
  288. this.setState({
  289. loading: false,
  290. showDesc:false
  291. });
  292. } else {
  293. message.warning(data.error[0].message);
  294. this.setState({
  295. showDesc:true
  296. })
  297. };
  298. this.loadData(this.state.pageNo);
  299. }.bind(this));
  300. },
  301. //取消订单
  302. cancelOrder(e){
  303. this.operation(e,3)
  304. },
  305. //作废订单
  306. scrapOrder(e){
  307. this.operation(e,2)
  308. },
  309. //锁定订单
  310. lockOrder(e){
  311. this.operation(e,0)
  312. },
  313. //解锁订单
  314. unlockOrder(e){
  315. this.operation(e,1)
  316. },
  317. //签单
  318. signBill(ids){
  319. this.setState({
  320. uid:ids,
  321. signBillVisible:true
  322. })
  323. },
  324. componentWillMount() {
  325. this.loadData();
  326. let data=localStorage.getItem('newData');
  327. if(data!='{}'&&data){
  328. var newData = JSON.parse(data);
  329. this.tableRowClick(newData);
  330. };
  331. },
  332. tableRowClick(record, index) {
  333. this.state.userDetaile=true;
  334. this.state.datauser = record;
  335. this.setState({
  336. signBillVisible:false,
  337. signBillState:true,
  338. showDesc: true
  339. });
  340. localStorage.setItem('newData','{}');
  341. },
  342. //列表各种骚操作
  343. operation(record,index) {
  344. this.setState({
  345. selectedRowKeys: [],
  346. loading: true,
  347. showDesc:false
  348. });
  349. $.ajax({
  350. method: "get",
  351. dataType: "json",
  352. crossDomain: false,
  353. url: globalConfig.context + '/api/admin/order/lockOrRevokeOrder',
  354. data: {
  355. orderNo:record.orderNo,
  356. operatorType:index
  357. }
  358. }).done(function (data) {
  359. if (!data.error.length) {
  360. message.success('操作成功!');
  361. this.setState({
  362. loading: false,
  363. });
  364. } else {
  365. message.warning(data.error[0].message);
  366. };
  367. this.loadData(this.state.pageNo);
  368. }.bind(this));
  369. },
  370. addClick() {
  371. this.state.userDetaile=false;
  372. this.setState({
  373. signBillVisible:false,
  374. showDesc: true
  375. });
  376. },
  377. closeDesc(e, s) {
  378. this.state.userDetaile=false;
  379. this.state.signBillVisible=false;
  380. this.state.showDesc = e;
  381. if (s) {
  382. this.loadData(this.state.pageNo);
  383. };
  384. },
  385. searchSwitch() {
  386. this.setState({
  387. signBillVisible:false,
  388. searchMore: !this.state.searchMore
  389. });
  390. },
  391. search() {
  392. this.setState({
  393. signBillVisible:false
  394. })
  395. this.loadData();
  396. },
  397. reset() {
  398. this.setState({
  399. signBillVisible:false
  400. })
  401. this.state.orderNo='';
  402. this.state.customerName='';
  403. this.state.releaseDate[0] = undefined;
  404. this.state.releaseDate[1] = undefined;
  405. this.state.projectProgress = undefined;
  406. this.state.settlementState = undefined;
  407. this.state.orderStatusSearch = undefined;
  408. this.state.orderChannelSearch = undefined;
  409. this.state.approval= undefined;
  410. this.state.formalOrder=true;
  411. this.state.intentOrder=true;
  412. this.loadData();
  413. },
  414. changeList(arr) {
  415. const newArr = [];
  416. this.state.columns.forEach(item => {
  417. arr.forEach(val => {
  418. if (val === item.title) {
  419. newArr.push(item);
  420. }
  421. });
  422. });
  423. this.setState({
  424. changeList: newArr
  425. });
  426. },
  427. render() {
  428. const FormItem = Form.Item;
  429. const formItemLayout = {
  430. labelCol: { span: 8 },
  431. wrapperCol: { span: 14 },
  432. };
  433. const rowSelection = {
  434. selectedRowKeys: this.state.selectedRowKeys,
  435. onChange: (selectedRowKeys, selectedRows) => {
  436. this.setState({
  437. selectedRows: selectedRows.slice(-1),
  438. selectedRowKeys: selectedRowKeys.slice(-1)
  439. });
  440. },
  441. onSelectAll: (selected, selectedRows, changeRows) => {
  442. this.setState({
  443. selectedRowKeys:[]
  444. })
  445. },
  446. };
  447. const hasSelected = this.state.selectedRowKeys.length > 0;
  448. const { RangePicker } = DatePicker;
  449. return (
  450. <div className="user-content">
  451. <ShowModalDiv ShowModal={this.state.showModal} />
  452. <div className="content-title">
  453. <span style={{ fontSize: "16px" }}>科技服务订单</span>
  454. <Tabs
  455. defaultActiveKey="1"
  456. onChange={this.callback}
  457. className="test">
  458. <TabPane tab="更改表格显示数据" key="1">
  459. <div style={{ marginLeft: 10 }}>
  460. <ChooseList
  461. columns={this.state.columns}
  462. changeFn={this.changeList}
  463. changeList={this.state.changeList}
  464. top={55}
  465. margin={11}
  466. />
  467. </div>
  468. </TabPane>
  469. <TabPane tab="搜索" key="2">
  470. <div className="user-search">
  471. <Input
  472. placeholder="客户名称"
  473. style={{ width: "150px",marginLeft:10}}
  474. value={this.state.customerName}
  475. onChange={e => {
  476. this.setState({ customerName: e.target.value });
  477. }}
  478. />
  479. <Input
  480. placeholder="订单编号"
  481. style={{ width: "150px" }}
  482. value={this.state.orderNo}
  483. onChange={e => {
  484. this.setState({ orderNo: e.target.value });
  485. }}
  486. />
  487. <RangePicker
  488. value={[
  489. this.state.releaseDate[0]
  490. ? moment(this.state.releaseDate[0])
  491. : null,
  492. this.state.releaseDate[1]
  493. ? moment(this.state.releaseDate[1])
  494. : null
  495. ]}
  496. onChange={(data, dataString) => {
  497. this.setState({ releaseDate: dataString });
  498. }}
  499. />
  500. <Select
  501. placeholder="特批筛选"
  502. style={{ width: 150, marginLeft: "10px" }}
  503. value={this.state.approval}
  504. onChange={e => {
  505. this.setState({ approval: e });
  506. }}
  507. >
  508. {specially.map(function(item) {
  509. return (
  510. <Select.Option key={item.value}>{item.key}</Select.Option>
  511. );
  512. })}
  513. </Select>
  514. <Button
  515. type="primary"
  516. onClick={this.search}
  517. style={{ marginLeft: "10px" }}
  518. >
  519. 搜索
  520. <Icon type="search" />
  521. </Button>
  522. <Button onClick={this.reset}>
  523. 重置 <Icon type="reload" />
  524. </Button>
  525. <span style={{ marginLeft: "10px", marginRight: "20px" }}>
  526. 更多搜索
  527. <Switch defaultChecked={false} onChange={this.searchSwitch} />
  528. </span>
  529. </div>
  530. <div className="clearfix" style={{ marginTop: "5px",marginLeft:10 }}>
  531. <div
  532. className="search-more"
  533. style={this.state.searchMore ? { display: "none" } : {}}
  534. >
  535. <Checkbox
  536. checked={this.state.intentOrder}
  537. onChange={e => {
  538. this.setState({ intentOrder: !this.state.intentOrder });
  539. }}
  540. >
  541. 意向订单
  542. </Checkbox>
  543. <Checkbox
  544. checked={this.state.formalOrder}
  545. onChange={e => {
  546. this.setState({ formalOrder: !this.state.formalOrder });
  547. }}
  548. >
  549. 正式订单
  550. </Checkbox>
  551. <Select
  552. placeholder="订单状态"
  553. style={{
  554. width: 150,
  555. marginRight: "10px",
  556. marginBottom: "10px"
  557. }}
  558. value={this.state.orderStatusSearch}
  559. onChange={e => {
  560. this.setState({ orderStatusSearch: e });
  561. }}
  562. >
  563. {orderState.map(function(item) {
  564. return (
  565. <Select.Option key={item.value}>
  566. {item.key}
  567. </Select.Option>
  568. );
  569. })}
  570. </Select>
  571. <Select
  572. placeholder="结算状态"
  573. style={{ width: 150, marginRight: "10px" }}
  574. value={this.state.settlementState}
  575. onChange={e => {
  576. this.setState({ settlementState: e });
  577. }}
  578. >
  579. {paymentState.map(function(item) {
  580. return (
  581. <Select.Option key={item.value}>
  582. {item.key}
  583. </Select.Option>
  584. );
  585. })}
  586. </Select>
  587. <Select
  588. placeholder="项目进度"
  589. style={{ width: 150, marginRight: "10px" }}
  590. value={this.state.projectProgress}
  591. onChange={e => {
  592. this.setState({ projectProgress: e });
  593. }}
  594. >
  595. {projectState.map(function(item) {
  596. return (
  597. <Select.Option key={item.value}>
  598. {item.key}
  599. </Select.Option>
  600. );
  601. })}
  602. </Select>
  603. <Select
  604. placeholder="订单渠道"
  605. style={{ width: 150 }}
  606. value={this.state.orderChannelSearch}
  607. onChange={e => {
  608. this.setState({ orderChannelSearch: e });
  609. }}
  610. >
  611. {orderChannel.map(function(item) {
  612. return (
  613. <Select.Option key={item.value}>
  614. {item.key}
  615. </Select.Option>
  616. );
  617. })}
  618. </Select>
  619. </div>
  620. </div>
  621. </TabPane>
  622. <TabPane tab="开单" key="3">
  623. <Button
  624. type="primary"
  625. className="addButton"
  626. style={{margin:10,float:"left"}}
  627. onClick={this.addClick}
  628. >
  629. 开单
  630. <Icon type="plus" />
  631. </Button>
  632. </TabPane>
  633. </Tabs>
  634. <div className="patent-table">
  635. <Spin spinning={this.state.loading}>
  636. <Table
  637. columns={
  638. this.state.changeList
  639. ? this.state.changeList
  640. : this.state.columns
  641. }
  642. dataSource={this.state.dataSource}
  643. rowSelection={rowSelection}
  644. pagination={this.state.pagination}
  645. onRowClick={this.tableRowClick}
  646. bordered
  647. size="small"
  648. />
  649. </Spin>
  650. </div>
  651. <NewService
  652. uid={this.state.uid}
  653. signBillVisible={this.state.signBillVisible}
  654. signBillState={this.state.signBillState}
  655. operation={this.operation}
  656. admissibleOrder={this.admissibleOrder}
  657. userDetaile={this.state.userDetaile}
  658. datauser={this.state.datauser}
  659. showDesc={this.state.showDesc}
  660. closeDesc={this.closeDesc}
  661. />
  662. </div>
  663. </div>
  664. );
  665. }
  666. }));
  667. export default MyService;