billing.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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 {projectProgress,specially} from '../../../dataDic.js';
  10. import {getApprovedState,getProcessStatus,getLiquidationStatus,getNewOrderStatus} 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: "get",
  19. dataType: "json",
  20. crossDomain: false,
  21. url: globalConfig.context + '/api/admin/newOrder/orderNewList',
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. specially:0,
  26. name:this.state.customerName,
  27. orderNo:this.state.orderNo,
  28. starTime: this.state.releaseDate[0],
  29. endTime: this.state.releaseDate[1],
  30. },
  31. success: function (data) {
  32. let theArr = [];
  33. if (!data.data) {
  34. if (data.error && data.error.length) {
  35. message.warning(data.error[0].message);
  36. };
  37. } else {
  38. for (let i = 0; i < data.data.list.length; i++) {
  39. let thisdata = data.data.list[i];
  40. theArr.push({
  41. key: i,
  42. id: thisdata.id,
  43. orderNo: thisdata.orderNo,//订单编号
  44. totalAmount:thisdata.totalAmount,//签单金额
  45. processStatus:thisdata.processStatus,//流程状态
  46. liquidationStatus:thisdata.liquidationStatus,//结算状态
  47. approval:thisdata.approval,//特批状态
  48. signDate:thisdata.signDate,//签单时间
  49. userName:thisdata.userName,//客户名称
  50. salesmanName:thisdata.salesmanName,//营销员名称
  51. financeName:thisdata.financeName,//财务名称
  52. createDate:thisdata.createDate,//下单时间
  53. orderStatus:thisdata.orderStatus,//订单状态
  54. });
  55. };
  56. this.state.pagination.current = data.data.pageNo;
  57. this.state.pagination.total = data.data.totalCount;
  58. };
  59. if(!data.data.list.length){
  60. this.state.pagination.current=0
  61. this.state.pagination.total=0
  62. }
  63. this.setState({
  64. pageNo:pageNo,
  65. dataSource: theArr,
  66. pagination: this.state.pagination,
  67. selectedRowKeys:[],
  68. });
  69. }.bind(this),
  70. }).always(function () {
  71. this.setState({
  72. loading: false
  73. });
  74. }.bind(this));
  75. },
  76. getInitialState() {
  77. return {
  78. datauser:{},
  79. selectedRowKeys: [],
  80. releaseDate: [],
  81. signBillState:false,
  82. signBillVisible:false,
  83. selectedRows: [],
  84. searchMore: true,
  85. loading: false,
  86. intentOrder:true,
  87. formalOrder:true,
  88. pagination: {
  89. defaultCurrent: 1,
  90. defaultPageSize: 10,
  91. showQuickJumper: true,
  92. pageSize: 10,
  93. onChange: function (page) {
  94. this.loadData(page);
  95. }.bind(this),
  96. showTotal: function (total) {
  97. return '共' + total + '条数据';
  98. }
  99. },
  100. columns: [
  101. {
  102. title: '订单编号',
  103. dataIndex: 'orderNo',
  104. key: 'orderNo'
  105. },{
  106. title: '客户名称',
  107. dataIndex: 'userName',
  108. key: 'userName',
  109. render:(text)=>{
  110. return (text&&text.length>9?text.substr(0,9)+'...':text)
  111. }
  112. }, {
  113. title: '下单时间',
  114. dataIndex: 'createDate',
  115. key: 'createTime'
  116. },{
  117. title: '合同签订时间',
  118. dataIndex: 'signDate',
  119. key: 'signDate'
  120. }, {
  121. title: '流程状态',
  122. dataIndex: 'processStatus',
  123. key: 'processStatus',
  124. render:text=>{return getProcessStatus(text)}
  125. }, {
  126. title: '签单金额(万元)',
  127. dataIndex: 'totalAmount',
  128. key: 'totalAmount'
  129. },{
  130. title: '结算状态',
  131. dataIndex: 'liquidationStatus',
  132. key: 'liquidationStatus',
  133. render:text=>{return getLiquidationStatus(text)}
  134. }, {
  135. title: '是否特批',
  136. dataIndex: 'approval',
  137. key: 'approval',
  138. render:text=>{return getApprovedState(text)}
  139. },{
  140. title: '订单状态',
  141. dataIndex: 'orderStatus',
  142. key: 'orderStatus',
  143. render:text=>{return getNewOrderStatus(text)}
  144. },{
  145. title: '财务负责人',
  146. dataIndex: 'financeName',
  147. key: 'financeName'
  148. }, {
  149. title: '操作',
  150. dataIndex: 'abc',
  151. key: 'abc',
  152. render: (text, record, index) => {
  153. return <div>
  154. {record.liquidationStatus==2?<Popconfirm title="是否结项?" onConfirm={(e)=>{this.delectRow(record)}} okText="是" cancelText="否">
  155. <Button type="primary" style={{marginRight:'10px',color:'#ffffff',border:'none'}} onClick={(e) =>{ e.stopPropagation()}}>结项</Button>
  156. </Popconfirm>:''}
  157. </div>
  158. }
  159. }
  160. ],
  161. dataSource: [],
  162. };
  163. },
  164. //结项
  165. delectRow(record) {
  166. this.setState({
  167. loading: true
  168. });
  169. $.ajax({
  170. method: "get",
  171. dataType: "json",
  172. crossDomain: false,
  173. url: globalConfig.context + "/api/admin/newOrder/OrderOver",
  174. data: {
  175. orderNo:record.orderNo
  176. }
  177. }).done(function (data) {
  178. if (!data.error.length) {
  179. message.success('该项目已成功结项!');
  180. this.loadData();
  181. } else {
  182. message.warning(data.error[0].message);
  183. };
  184. this.setState({
  185. loading: false,
  186. });
  187. }.bind(this));
  188. },
  189. //是否退款
  190. refundCancel(record){
  191. this.refund(record,0)
  192. },
  193. refundOk(record){
  194. this.refund(record,1)
  195. },
  196. refund(record,index){
  197. this.setState({
  198. signBillVisible:false,
  199. selectedRowKeys: [],
  200. loading: true,
  201. userDetaile:false
  202. });
  203. $.ajax({
  204. method: "get",
  205. dataType: "json",
  206. crossDomain: false,
  207. url: globalConfig.context + '/api/admin/order/confirmRefund',
  208. data: {
  209. orderNo:record.orderNo,
  210. confirm:index
  211. }
  212. }).done(function (data) {
  213. if (!data.error.length) {
  214. message.success('操作成功!');
  215. this.setState({
  216. loading: false,
  217. showDesc:false
  218. });
  219. }
  220. this.loadData(this.state.pageNo);
  221. }.bind(this));
  222. },
  223. //受理订单
  224. admissibleOrderOk(e){
  225. this.admissibleOrder(e,true)
  226. },
  227. admissibleOrderCancel(e){
  228. this.admissibleOrder(e,false)
  229. },
  230. admissibleOrder(record,index) {
  231. this.setState({
  232. signBillVisible:false,
  233. selectedRowKeys: [],
  234. loading: true,
  235. userDetaile:false
  236. });
  237. $.ajax({
  238. method: "POST",
  239. dataType: "json",
  240. crossDomain: false,
  241. url: globalConfig.context + '/api/admin/order/confirmIntention',
  242. data: {
  243. orderNo:record.orderNo,
  244. confirm:index
  245. }
  246. }).done(function (data) {
  247. if (!data.error.length) {
  248. message.success('操作成功!');
  249. this.setState({
  250. loading: false,
  251. showDesc:false
  252. });
  253. } else {
  254. message.warning(data.error[0].message);
  255. this.setState({
  256. showDesc:true
  257. })
  258. };
  259. this.loadData(this.state.pageNo);
  260. }.bind(this));
  261. },
  262. //取消订单
  263. cancelOrder(e){
  264. this.operation(e,3)
  265. },
  266. //作废订单
  267. scrapOrder(e){
  268. this.operation(e,2)
  269. },
  270. //锁定订单
  271. lockOrder(e){
  272. this.operation(e,0)
  273. },
  274. //解锁订单
  275. unlockOrder(e){
  276. this.operation(e,1)
  277. },
  278. //签单
  279. signBill(ids){
  280. this.setState({
  281. uid:ids,
  282. signBillVisible:true
  283. })
  284. },
  285. componentWillMount() {
  286. this.loadData();
  287. let data=localStorage.getItem('newData');
  288. if(data!='{}'&&data){
  289. var newData = JSON.parse(data);
  290. this.tableRowClick(newData);
  291. };
  292. },
  293. tableRowClick(record, index) {
  294. this.state.userDetaile=true;
  295. this.state.datauser = record;
  296. this.setState({
  297. signBillVisible:false,
  298. signBillState:true,
  299. showDesc: true
  300. });
  301. localStorage.setItem('newData','{}');
  302. },
  303. //列表各种骚操作
  304. operation(record,index) {
  305. this.setState({
  306. selectedRowKeys: [],
  307. loading: true,
  308. showDesc:false
  309. });
  310. $.ajax({
  311. method: "get",
  312. dataType: "json",
  313. crossDomain: false,
  314. url: globalConfig.context + '/api/admin/order/lockOrRevokeOrder',
  315. data: {
  316. orderNo:record.orderNo,
  317. operatorType:index
  318. }
  319. }).done(function (data) {
  320. if (!data.error.length) {
  321. message.success('操作成功!');
  322. this.setState({
  323. loading: false,
  324. });
  325. } else {
  326. message.warning(data.error[0].message);
  327. };
  328. this.loadData(this.state.pageNo);
  329. }.bind(this));
  330. },
  331. addClick() {
  332. this.state.userDetaile=false;
  333. this.setState({
  334. signBillVisible:false,
  335. showDesc: true
  336. });
  337. },
  338. closeDesc(e, s) {
  339. this.state.userDetaile=false;
  340. this.state.signBillVisible=false;
  341. this.state.showDesc = e;
  342. if (s) {
  343. this.loadData(this.state.pageNo);
  344. };
  345. },
  346. searchSwitch() {
  347. this.setState({
  348. signBillVisible:false,
  349. searchMore: !this.state.searchMore
  350. });
  351. },
  352. search() {
  353. this.setState({
  354. signBillVisible:false
  355. })
  356. this.loadData();
  357. },
  358. reset() {
  359. this.setState({
  360. signBillVisible:false
  361. })
  362. this.state.orderNo='';
  363. this.state.customerName='';
  364. this.state.releaseDate[0] = undefined;
  365. this.state.releaseDate[1] = undefined;
  366. this.state.projectProgress = undefined;
  367. this.state.settlementState = undefined;
  368. this.state.orderStatusSearch = undefined;
  369. this.state.orderChannelSearch = undefined;
  370. this.state.approval= undefined;
  371. this.state.formalOrder=true;
  372. this.state.intentOrder=true;
  373. this.loadData();
  374. },
  375. render() {
  376. const FormItem = Form.Item;
  377. const formItemLayout = {
  378. labelCol: { span: 8 },
  379. wrapperCol: { span: 14 },
  380. };
  381. const rowSelection = {
  382. selectedRowKeys: this.state.selectedRowKeys,
  383. onChange: (selectedRowKeys, selectedRows) => {
  384. this.setState({
  385. selectedRows: selectedRows.slice(-1),
  386. selectedRowKeys: selectedRowKeys.slice(-1)
  387. });
  388. },
  389. onSelectAll: (selected, selectedRows, changeRows) => {
  390. this.setState({
  391. selectedRowKeys:[]
  392. })
  393. },
  394. };
  395. const hasSelected = this.state.selectedRowKeys.length > 0;
  396. const { RangePicker } = DatePicker;
  397. return (
  398. <div className="user-content" >
  399. <div className="content-title">
  400. <span style={{fontSize:'16px'}}>开单与签单</span>
  401. <div className="user-search">
  402. <Input placeholder="客户名称" style={{width:'150px'}}
  403. value={this.state.customerName}
  404. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  405. <Input placeholder="订单编号" style={{width:'150px'}}
  406. value={this.state.orderNo}
  407. onChange={(e) => { this.setState({ orderNo: e.target.value }); }} />
  408. <span style={{marginRight:"10px"}}>合同签订时间 :</span>
  409. <RangePicker
  410. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  411. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  412. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  413. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索<Icon type="search" /></Button>
  414. <Button onClick={this.reset}>重置 <Icon type="reload" /></Button>
  415. <Button type="primary" className="addButton" onClick={this.addClick} >开单<Icon type="plus" /></Button>
  416. </div>
  417. <div className="patent-table">
  418. <Spin spinning={this.state.loading}>
  419. <Table columns={this.state.columns}
  420. dataSource={this.state.dataSource}
  421. rowSelection={rowSelection}
  422. pagination={this.state.pagination}
  423. onRowClick={this.tableRowClick} />
  424. </Spin>
  425. </div>
  426. <NewService
  427. uid={this.state.uid}
  428. signBillVisible={this.state.signBillVisible}
  429. signBillState={this.state.signBillState}
  430. operation={this.operation}
  431. admissibleOrder={this.admissibleOrder}
  432. userDetaile={this.state.userDetaile}
  433. datauser={this.state.datauser}
  434. showDesc={this.state.showDesc}
  435. closeDesc={this.closeDesc} />
  436. </div >
  437. </div>
  438. );
  439. }
  440. }));
  441. export default MyService;