myService.jsx 23 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} onClose={() => { this.setState({ showModal: false }) }} />
  452. <div className="content-title" style={{ marginBottom: 10 }}>
  453. <span style={{ fontWeight: 900, fontSize: 16 }}>科技服务订单</span>
  454. </div>
  455. <div className="user-search">
  456. <Tabs
  457. defaultActiveKey="1"
  458. onChange={this.callback}
  459. className="test">
  460. <TabPane tab="搜索" key="1">
  461. <div>
  462. <Input
  463. placeholder="订单编号"
  464. style={{ width: 150, marginLeft: 10 }}
  465. value={this.state.orderNo}
  466. onChange={e => {
  467. this.setState({ orderNo: e.target.value });
  468. }}
  469. />
  470. <Input
  471. placeholder="客户名称"
  472. style={{ width: 150, marginLeft: 10 }}
  473. value={this.state.customerName}
  474. onChange={e => {
  475. this.setState({ customerName: e.target.value });
  476. }}
  477. />
  478. <RangePicker
  479. style={{ marginLeft: 10 }}
  480. value={[
  481. this.state.releaseDate[0]
  482. ? moment(this.state.releaseDate[0])
  483. : null,
  484. this.state.releaseDate[1]
  485. ? moment(this.state.releaseDate[1])
  486. : null
  487. ]}
  488. onChange={(data, dataString) => {
  489. this.setState({ releaseDate: dataString });
  490. }}
  491. />
  492. <Select
  493. placeholder="特批筛选"
  494. style={{ width: 150, marginLeft: "10px" }}
  495. value={this.state.approval}
  496. onChange={e => {
  497. this.setState({ approval: e });
  498. }}
  499. >
  500. {specially.map(function (item) {
  501. return (
  502. <Select.Option key={item.value}>{item.key}</Select.Option>
  503. );
  504. })}
  505. </Select>
  506. <Button
  507. type="primary"
  508. onClick={this.search}
  509. style={{ marginLeft: "10px" }}
  510. >
  511. 搜索
  512. <Icon type="search" />
  513. </Button>
  514. <Button onClick={this.reset}>
  515. 重置
  516. <Icon type="reload" />
  517. </Button>
  518. <span style={{ marginLeft: "10px", marginRight: "20px" }}>
  519. 更多搜索
  520. <Switch defaultChecked={false} onChange={this.searchSwitch} />
  521. </span>
  522. </div>
  523. <div className="clearfix" style={{ marginTop: "5px", marginLeft: 10 }}>
  524. <div
  525. className="search-more"
  526. style={this.state.searchMore ? { display: "none" } : {}}
  527. >
  528. <Checkbox
  529. checked={this.state.intentOrder}
  530. onChange={e => {
  531. this.setState({ intentOrder: !this.state.intentOrder });
  532. }}
  533. >
  534. 意向订单
  535. </Checkbox>
  536. <Checkbox
  537. checked={this.state.formalOrder}
  538. onChange={e => {
  539. this.setState({ formalOrder: !this.state.formalOrder });
  540. }}
  541. >
  542. 正式订单
  543. </Checkbox>
  544. <Select
  545. placeholder="订单状态"
  546. style={{
  547. width: 150,
  548. marginRight: "10px",
  549. marginBottom: "10px"
  550. }}
  551. value={this.state.orderStatusSearch}
  552. onChange={e => {
  553. this.setState({ orderStatusSearch: e });
  554. }}
  555. >
  556. {orderState.map(function (item) {
  557. return (
  558. <Select.Option key={item.value}>
  559. {item.key}
  560. </Select.Option>
  561. );
  562. })}
  563. </Select>
  564. <Select
  565. placeholder="结算状态"
  566. style={{ width: 150, marginRight: "10px" }}
  567. value={this.state.settlementState}
  568. onChange={e => {
  569. this.setState({ settlementState: e });
  570. }}
  571. >
  572. {paymentState.map(function (item) {
  573. return (
  574. <Select.Option key={item.value}>
  575. {item.key}
  576. </Select.Option>
  577. );
  578. })}
  579. </Select>
  580. <Select
  581. placeholder="项目进度"
  582. style={{ width: 150, marginRight: "10px" }}
  583. value={this.state.projectProgress}
  584. onChange={e => {
  585. this.setState({ projectProgress: e });
  586. }}
  587. >
  588. {projectState.map(function (item) {
  589. return (
  590. <Select.Option key={item.value}>
  591. {item.key}
  592. </Select.Option>
  593. );
  594. })}
  595. </Select>
  596. <Select
  597. placeholder="订单外联"
  598. style={{ width: 150 }}
  599. value={this.state.orderChannelSearch}
  600. onChange={e => {
  601. this.setState({ orderChannelSearch: e });
  602. }}
  603. >
  604. {orderChannel.map(function (item) {
  605. return (
  606. <Select.Option key={item.value}>
  607. {item.key}
  608. </Select.Option>
  609. );
  610. })}
  611. </Select>
  612. </div>
  613. </div>
  614. </TabPane>
  615. <TabPane tab="更改表格显示数据" key="2">
  616. <div style={{ marginLeft: 10 }}>
  617. <ChooseList
  618. columns={this.state.columns}
  619. changeFn={this.changeList}
  620. changeList={this.state.changeList}
  621. top={55}
  622. margin={11}
  623. />
  624. </div>
  625. </TabPane>
  626. <TabPane tab="开单" key="3">
  627. <Button
  628. type="primary"
  629. className="addButton"
  630. style={{ margin: 10, float: "left" }}
  631. onClick={this.addClick}
  632. >
  633. 开单
  634. <Icon type="plus" />
  635. </Button>
  636. </TabPane>
  637. </Tabs>
  638. <div className="patent-table">
  639. <Spin spinning={this.state.loading}>
  640. <Table
  641. columns={
  642. this.state.changeList
  643. ? this.state.changeList
  644. : this.state.columns
  645. }
  646. dataSource={this.state.dataSource}
  647. rowSelection={rowSelection}
  648. pagination={this.state.pagination}
  649. onRowClick={this.tableRowClick}
  650. bordered
  651. size="small"
  652. />
  653. </Spin>
  654. </div>
  655. <NewService
  656. uid={this.state.uid}
  657. signBillVisible={this.state.signBillVisible}
  658. signBillState={this.state.signBillState}
  659. operation={this.operation}
  660. admissibleOrder={this.admissibleOrder}
  661. userDetaile={this.state.userDetaile}
  662. datauser={this.state.datauser}
  663. showDesc={this.state.showDesc}
  664. closeDesc={this.closeDesc}
  665. />
  666. </div>
  667. </div>
  668. );
  669. }
  670. }));
  671. export default MyService;