billing.jsx 15 KB

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