approveOrder.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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, Modal, Upload ,Popconfirm,Checkbox,Tabs} from 'antd';
  6. import ApproveOrderDetaile from "./approveOrderDetaile.jsx";
  7. import moment from 'moment';
  8. import '../../userMangagement.less';
  9. import {orderState,paymentState,orderChannel} from '../../../../dataDic.js';
  10. import {getOrderState,getPaymentState,getOrderChannel,getProjectState,getApprovedState,getOrderType } from '../../../../tools.js';
  11. import {ChooseList} from "../../orderNew/chooseList";
  12. import DepartmentList from "../../../../common/departmentList";
  13. const {TabPane} = Tabs
  14. const ApproveOrder=Form.create()(React.createClass({
  15. loadData(pageNo) {
  16. this.state.data = [];
  17. this.setState({
  18. loading: true
  19. });
  20. $.ajax({
  21. method: "post",
  22. dataType: "json",
  23. crossDomain: false,
  24. url: globalConfig.context + '/api/admin/order/listApprovalServiceOrder',
  25. data: {
  26. pageNo: pageNo || 1,
  27. pageSize: this.state.pagination.pageSize,
  28. buyerName:this.state.customerName,
  29. startDate: this.state.releaseDate[0],
  30. endDate: this.state.releaseDate[1],
  31. depIds:this.state.departmentSearch , //部门
  32. salesmanName:this.state.orderLeader, //负责人
  33. orderStatus:this.state.orderStateSearch , //订单状态
  34. liquidationStatus:this.state.paymentStateSearch , //结算状态
  35. orderChannel:this.state.orderChannelSearch, //订单渠道
  36. approvalHistory:this.state.approvalHistorySearch?1:0 //特批历史
  37. },
  38. success: function (data) {
  39. let theArr = [];
  40. if (!data.data) {
  41. if (data.error && data.error.length) {
  42. message.warning(data.error[0].message);
  43. };
  44. } else {
  45. for (let i = 0; i < data.data.list.length; i++) {
  46. let thisdata = data.data.list[i];
  47. theArr.push({
  48. key: i,
  49. id: thisdata.id,
  50. orderNo: thisdata.orderNo,
  51. orderType:thisdata.orderType,
  52. orderStatus:thisdata.orderStatus,
  53. liquidationStatus:thisdata.liquidationStatus,
  54. createTime:thisdata.createTime,
  55. buyerName:thisdata.buyerName,
  56. signTotalAmount:thisdata.signTotalAmount,
  57. projectStage:thisdata.projectStage,
  58. approval:thisdata.approval,
  59. salesmanName:thisdata.salesmanName,
  60. orderChannel:thisdata.orderChannel,
  61. financeName:thisdata.financeName,
  62. departmentName:thisdata.departmentName
  63. });
  64. };
  65. this.state.pagination.current = data.data.pageNo;
  66. this.state.pagination.total = data.data.totalCount;
  67. };
  68. if(!data.data.list.length){
  69. this.state.pagination.current=0
  70. this.state.pagination.total=0
  71. }
  72. this.setState({
  73. pageNo:pageNo,
  74. dataSource: theArr,
  75. pagination: this.state.pagination,
  76. selectedRowKeys:[]
  77. });
  78. }.bind(this),
  79. }).always(function () {
  80. this.setState({
  81. loading: false
  82. });
  83. }.bind(this));
  84. },
  85. getInitialState() {
  86. return {
  87. datauser:{},
  88. selectedRowKeys: [],
  89. releaseDate: [],
  90. selectedRows: [],
  91. approvalHistorySearch:true,
  92. searchMore: true,
  93. loading: false,
  94. distributionVisible:false,
  95. intentOrder:false,
  96. visible:false,
  97. showDesc:false,
  98. pagination: {
  99. defaultCurrent: 1,
  100. defaultPageSize: 10,
  101. showQuickJumper: true,
  102. pageSize: 10,
  103. onChange: function (page) {
  104. this.loadData(page);
  105. }.bind(this),
  106. showTotal: function (total) {
  107. return '共' + total + '条数据';
  108. }
  109. },
  110. distributionPagination: {
  111. defaultCurrent: 1,
  112. defaultPageSize: 10,
  113. showQuickJumper: true,
  114. pageSize: 10,
  115. onChange: function (page) {
  116. this.contactList(page);
  117. }.bind(this),
  118. showTotal: function (total) {
  119. return '共' + total + '条数据';
  120. }
  121. },
  122. columns: [
  123. {
  124. title: '订单编号',
  125. dataIndex: 'orderNo',
  126. key: 'orderNo'
  127. }, {
  128. title: '订单类型',
  129. dataIndex: 'orderType',
  130. key: 'orderType',
  131. render:(text)=>{return getOrderType(text)}
  132. }, {
  133. title: '下单时间',
  134. dataIndex: 'createTime',
  135. key: 'createTime'
  136. },{
  137. title: '订单客户',
  138. dataIndex: 'buyerName',
  139. key: 'buyerName',
  140. render:(text)=>{return (text&&text.length>8)?(text).substr(0,8)+'…':text}
  141. },
  142. {
  143. title: '实际下单金额(万元)',
  144. dataIndex: 'signTotalAmount',
  145. key: 'signTotalAmount'
  146. }, {
  147. title: '结算状态',
  148. dataIndex: 'liquidationStatus',
  149. key: 'liquidationStatus',
  150. render:(text)=>{return getPaymentState(text) }
  151. }, {
  152. title: '订单状态',
  153. dataIndex: 'orderStatus',
  154. key: 'orderStatus',
  155. render:(text)=>{return getOrderState(text) }
  156. }, {
  157. title: '项目状态',
  158. dataIndex: 'projectStage',
  159. key: 'projectStage',
  160. render:(text)=>{return getProjectState(text) }
  161. },{
  162. title: '是否特批',
  163. dataIndex: 'approval',
  164. key: 'approval',
  165. render:text=>{return getApprovedState(text)}
  166. },{
  167. title: '订单渠道',
  168. dataIndex: 'orderChannel',
  169. key: 'orderChannel',
  170. render:(text)=>{return getOrderChannel(text) }
  171. },{
  172. title: '部门机构',
  173. dataIndex: 'departmentName',
  174. key: 'departmentName',
  175. },{
  176. title: '订单跟进人',
  177. dataIndex: 'salesmanName',
  178. key: 'salesmanName',
  179. },{
  180. title: '财务跟进人',
  181. dataIndex: 'financeName',
  182. key: 'financeName',
  183. },{
  184. title: '操作',
  185. dataIndex: 'operation',
  186. key: 'operation',
  187. render: (text, record, index) => {
  188. return <div>
  189. {record.approval==1&&<div>
  190. <Popconfirm title={'您确认驳回 【'+ record.salesmanName +'】的特批申请?'} onConfirm={(e)=>{this.reject(record)}} okText="确认" cancelText="取消">
  191. <Button style={{marginRight:'5px'}} type="danger" onClick={(e) =>{ e.stopPropagation()}}>驳回</Button>
  192. </Popconfirm>
  193. <Popconfirm title={'您确定同意 【'+ record.salesmanName +'】的特批申请?'} onConfirm={(e)=>{this.confirm(record)}} okText="确认" cancelText="取消">
  194. <Button style={{marginRight:'5px'}} type="primary" onClick={(e) =>{ e.stopPropagation()}}>同意</Button>
  195. </Popconfirm>
  196. </div>}
  197. </div>
  198. }
  199. }
  200. ],
  201. dataSource: [],
  202. };
  203. },
  204. //操作分配
  205. confirmDelet(index){
  206. this.setState({
  207. userDetaile:false,
  208. });
  209. this.contactList(1,index.id)
  210. },
  211. //驳回
  212. reject(record){
  213. this.confirmSelect(0,record)
  214. },
  215. //确认
  216. confirm(record){
  217. this.confirmSelect(1,record)
  218. },
  219. confirmSelect(nub,record){
  220. this.setState({
  221. loading: true
  222. });
  223. $.ajax({
  224. method: "get",
  225. dataType: "json",
  226. crossDomain: false,
  227. url: globalConfig.context + '/api/admin/order/approvalServiceOrder',
  228. data: {
  229. orderNo:record.orderNo,
  230. confirm:nub
  231. }
  232. }).done(function (data) {
  233. if (!data.error.length) {
  234. message.success('操作成功');
  235. this.setState({
  236. loading: false,
  237. });
  238. this.loadData(this.state.pageNo);
  239. } else {
  240. message.warning(data.error[0].message);
  241. };
  242. }.bind(this));
  243. },
  244. componentWillMount() {
  245. this.loadData();
  246. },
  247. tableRowClick(record, index) {
  248. this.state.userDetaile=true;
  249. this.state.datauser = record;
  250. this.setState({
  251. showDesc: true
  252. });
  253. },
  254. closeDesc(e, s) {
  255. this.state.userDetaile=false;
  256. this.state.showDesc = e;
  257. if (s) {
  258. this.loadData(this.state.pageNo);
  259. };
  260. },
  261. searchSwitch() {
  262. this.setState({
  263. searchMore: !this.state.searchMore
  264. });
  265. },
  266. search() {
  267. this.loadData();
  268. },
  269. //分配时搜索
  270. searchOrder() {
  271. this.contactList();
  272. },
  273. //分配时重置
  274. resetOrder() {
  275. this.contactList();
  276. },
  277. reset() {
  278. this.state.customerName='';
  279. this.state.releaseDate[0] = undefined;
  280. this.state.releaseDate[1] = undefined;
  281. this.state.orderLeader = '';
  282. this.state.departmentSearch=undefined;
  283. this.state.approvalHistorySearch=true;
  284. this.state.orderStateSearch = undefined;
  285. this.state.paymentStateSearch = undefined;
  286. this.loadData();
  287. },
  288. changeList(arr) {
  289. const newArr = [];
  290. this.state.columns.forEach(item => {
  291. arr.forEach(val => {
  292. if (val === item.title) {
  293. newArr.push(item);
  294. }
  295. });
  296. });
  297. this.setState({
  298. changeList: newArr
  299. });
  300. },
  301. render() {
  302. const rowSelection = {
  303. selectedRowKeys: this.state.selectedRowKeys,
  304. onChange: (selectedRowKeys, selectedRows) => {
  305. this.setState({
  306. selectedRows: selectedRows.slice(-1),
  307. selectedRowKeys: selectedRowKeys.slice(-1)
  308. });
  309. },
  310. onSelectAll: (selected, selectedRows, changeRows) => {
  311. this.setState({
  312. selectedRowKeys:[]
  313. })
  314. },
  315. };
  316. const hasSelected = this.state.selectedRowKeys.length > 0;
  317. const { RangePicker } = DatePicker;
  318. return (
  319. <div className="user-content" >
  320. <div className="content-title">
  321. <span style={{fontSize:'16px'}}>特批订单</span>
  322. <Tabs
  323. defaultActiveKey="1"
  324. onChange={this.callback}
  325. className="test">
  326. <TabPane tab="搜索" key="1">
  327. <div className="user-search">
  328. <Input placeholder="客户名称" style={{width:'150px',marginLeft:10}}
  329. value={this.state.customerName}
  330. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  331. <RangePicker
  332. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  333. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  334. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  335. <DepartmentList
  336. value={this.state.departmentSearch}
  337. onChange={e => {
  338. this.setState({ departmentSearch: e });
  339. }}/>
  340. <Input placeholder="订单负责人" style={{width:'150px'}}
  341. value={this.state.orderLeader}
  342. onChange={(e) => { this.setState({ orderLeader: e.target.value }); }} />
  343. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  344. <Button onClick={this.reset}>重置</Button>
  345. <span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  346. </div>
  347. <div className='clearfix' style={{marginTop:'5px'}}>
  348. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  349. <Checkbox checked={this.state.approvalHistorySearch} style={{marginLeft:10}} onChange={(e)=>{this.setState({approvalHistorySearch:!this.state.approvalHistorySearch})}}>特批历史订单</Checkbox>
  350. <Select placeholder="订单状态"
  351. style={{ width: 150 ,marginRight:'10px',marginBottom:'10px'}}
  352. value={this.state.orderStateSearch}
  353. onChange={(e) => { this.setState({ orderStateSearch: e }) }}>
  354. {
  355. orderState.map(function (item) {
  356. return <Select.Option key={item.value} >{item.key}</Select.Option>
  357. })
  358. }
  359. </Select>
  360. <Select placeholder="结算状态"
  361. style={{ width: 150 ,marginRight:'10px'}}
  362. value={this.state.paymentStateSearch}
  363. onChange={(e) => { this.setState({ paymentStateSearch: e }) }}>
  364. {
  365. paymentState.map(function (item) {
  366. return <Select.Option key={item.value} >{item.key}</Select.Option>
  367. })
  368. }
  369. </Select>
  370. </div>
  371. </div>
  372. </TabPane>
  373. <TabPane tab="更改表格显示数据" key="2">
  374. <div style={{ marginLeft: 10 }}>
  375. <ChooseList
  376. columns={this.state.columns}
  377. changeFn={this.changeList}
  378. changeList={this.state.changeList}
  379. top={55}
  380. margin={11}
  381. />
  382. </div>
  383. </TabPane>
  384. </Tabs>
  385. <div className="patent-table">
  386. <Spin spinning={this.state.loading}>
  387. <Table columns={
  388. this.state.changeList
  389. ? this.state.changeList
  390. : this.state.columns
  391. }
  392. dataSource={this.state.dataSource}
  393. // rowSelection={rowSelection}
  394. pagination={this.state.pagination}
  395. onRowClick={this.tableRowClick}
  396. bordered
  397. size="small" />
  398. </Spin>
  399. </div>
  400. <ApproveOrderDetaile
  401. confirmDelet={this.confirmDelet}
  402. userDetaile={this.state.userDetaile}
  403. datauser={this.state.datauser}
  404. showDesc={this.state.showDesc}
  405. closeDesc={this.closeDesc} />
  406. </div >
  407. </div>
  408. );
  409. }
  410. }));
  411. export default ApproveOrder;