reject.jsx 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225
  1. import React from 'react';
  2. import { Radio, Icon, Button, AutoComplete,Cascader,Input, Select, Spin, Popconfirm, Table, Switch, message,Calendar , DatePicker, Upload, Form ,Modal,Tabs,Card ,Col} from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import Jquery from 'jquery/dist/jquery.js';
  6. import moment from 'moment';
  7. import {boutique ,tepi,jiedian} from '@/dataDic.js';
  8. import { getLiquidationStatus,getApprovedState,getProcessStatus,splitUrl,getjiedian,getboutique} from '@/tools.js';
  9. import './customer.less';
  10. const TabPane = Tabs.TabPane;
  11. const Dragger = Upload.Dragger;
  12. //图片组件
  13. const PicturesWall = React.createClass({
  14. getInitialState() {
  15. return {
  16. previewVisible: false,
  17. previewImage: '',
  18. fileList: [],
  19. }
  20. },
  21. handleCancel() {
  22. this.setState({
  23. previewVisible: false
  24. })
  25. },
  26. handlePreview(file) {
  27. this.setState({
  28. previewImage: file.url || file.thumbUrl,
  29. previewVisible: true,
  30. });
  31. },
  32. handleChange(info) {
  33. let fileList = info.fileList;
  34. this.setState({
  35. fileList
  36. });
  37. this.props.fileList(fileList);
  38. },
  39. componentWillReceiveProps(nextProps) {
  40. this.state.fileList = nextProps.pictureUrl;
  41. this.state.pojectApplicationUrl = undefined;
  42. },
  43. render() {
  44. const {
  45. previewVisible,
  46. previewImage,
  47. fileList
  48. } = this.state;
  49. const uploadButton = (
  50. <div>
  51. <Icon type="plus" />
  52. <div className="ant-upload-text">点击上传</div>
  53. </div>
  54. );
  55. return(
  56. <div style={{display:"inline-block"}}>
  57. <Upload
  58. action={globalConfig.context + "/api/admin/customer/uploadCustomerImg"}
  59. data={{ 'sign': '' }}
  60. listType="picture-card"
  61. fileList={fileList}
  62. onPreview={this.handlePreview}
  63. onChange={this.handleChange} >
  64. {fileList.length >= 1 ? null : uploadButton}
  65. </Upload>
  66. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  67. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  68. </Modal>
  69. </div>
  70. );
  71. }
  72. });
  73. const IntentionCustomer = Form.create()(React.createClass({
  74. loadData(pageNo, apiUrl) {
  75. this.setState({
  76. visitModul:false,
  77. loading: true,
  78. ispage:pageNo,
  79. modalVisible:false
  80. });
  81. $.ajax({
  82. method: "get",
  83. dataType: "json",
  84. crossDomain: false,
  85. url: globalConfig.context +"/api/admin/newOrder/orderNewList",
  86. data: {
  87. pageNo: pageNo || 1,
  88. pageSize: this.state.pagination.pageSize,
  89. specially: 2,//审核列表
  90. name: this.state.name,//名称
  91. orderNo: this.state.orderNo,//订单编号
  92. starTime: this.state.releaseDate[0],//开始时间
  93. endTime: this.state.releaseDate[1],//结束时间
  94. },
  95. success: function(data) {
  96. let theArr = [];
  97. if(data.error.length || data.data.list == "") {
  98. if(data.error && data.error.length) {
  99. message.warning(data.error[0].message);
  100. };
  101. } else {
  102. for(let i = 0; i < data.data.list.length; i++) {
  103. let thisdata = data.data.list[i];
  104. let diqu=(thisdata.province==null?"":thisdata.province)+(thisdata.city==null?"":"-"+thisdata.city)+(thisdata.area==null?"":"-"+thisdata.area);
  105. theArr.push({
  106. key: i,
  107. id: thisdata.id,//用户ID
  108. orderNo: thisdata.orderNo,//订单编号
  109. totalAmount:thisdata.totalAmount,//签单金额
  110. processStatus:thisdata.processStatus,//流程状态
  111. liquidationStatus:thisdata.liquidationStatus,//结算状态
  112. approval:thisdata.approval,//特批状态
  113. signDate:thisdata.signDate,//签单时间
  114. userName:thisdata.userName,//客户名称
  115. salesmanName:thisdata.salesmanName,//营销员名称
  116. financeName:thisdata.financeName,//财务名称
  117. createDate:thisdata.createDate,//下单时间
  118. initiateName:thisdata.initiateName,//驳回人
  119. reason:thisdata.reason,//驳回信息
  120. backDate:thisdata.backDate,//驳回日期
  121. backId:thisdata.backId,//驳回编号
  122. });
  123. };
  124. this.state.pagination.total = data.data.totalCount;
  125. };
  126. if(data.data&&data.data.list&&!data.data.list.length){
  127. this.state.pagination.total=0
  128. }
  129. this.setState({
  130. dataSource: theArr,
  131. pageNo: pageNo,
  132. pagination: this.state.pagination,
  133. selectedRowKeys:[]
  134. });
  135. }.bind(this),
  136. }).always(function() {
  137. this.setState({
  138. loading: false
  139. });
  140. }.bind(this));
  141. },
  142. getInitialState() {
  143. return {
  144. page:1,
  145. releaseDate: [],
  146. selectedRowKeys: [],
  147. orgCodeUrl:[],
  148. customerArr:[],
  149. pagination: {
  150. defaultCurrent: 1,
  151. defaultPageSize: 10,
  152. showQuickJumper: true,
  153. pageSize: 10,
  154. onChange: function(page) {
  155. this.loadData(page);
  156. }.bind(this),
  157. showTotal: function(total) {
  158. return '共' + total + '条数据';
  159. }
  160. },
  161. columns: [
  162. {
  163. title: '驳回编号',
  164. dataIndex: 'backId',
  165. key: 'backId'
  166. },{
  167. title: '驳回日期',
  168. dataIndex: 'backDate',
  169. key: 'backDate'
  170. },
  171. {
  172. title: '订单编号',
  173. dataIndex: 'orderNo',
  174. key: 'orderNo'
  175. }, {
  176. title: '客户名称',
  177. dataIndex: 'userName',
  178. key: 'userName',
  179. render:(text)=>{
  180. return (text&&text.length>9?text.substr(0,9)+'...':text)
  181. }
  182. }, {
  183. title: '驳回人',
  184. dataIndex: 'initiateName',
  185. key: 'initiateName'
  186. },{
  187. title: '驳回原因',
  188. dataIndex: 'reason',
  189. key: 'reason'
  190. }
  191. ],
  192. data: [],
  193. dataSource: [],
  194. columnsX: [
  195. {
  196. title: '业务项目名称',
  197. dataIndex: 'commodityName',
  198. key: 'commodityName'
  199. }, {
  200. title: '项目类别',
  201. dataIndex: 'cname',
  202. key: 'cname',
  203. },{
  204. title: '项目数量',
  205. dataIndex: 'commodityQuantity',
  206. key: 'commodityQuantity'
  207. }, {
  208. title: '金额(万元)',
  209. dataIndex: 'commodityPrice',
  210. key: 'commodityPrice'
  211. }, {
  212. title: '负责人',
  213. dataIndex: 'contacts',
  214. key: 'contacts'
  215. }, {
  216. title: '负责人电话',
  217. dataIndex: 'contactsMobile',
  218. key: 'contactsMobile'
  219. }, {
  220. title: '主要项目',
  221. dataIndex: 'main',
  222. key: 'main',
  223. render:(text)=>{
  224. return (text?'是':'否')
  225. }
  226. }, {
  227. title: '项目说明',
  228. dataIndex: 'taskComment',
  229. key: 'taskComment',
  230. render:(text)=>{
  231. return (text&&text.length>8?text.substr(0,8)+'…':text)
  232. }
  233. }, {
  234. title: '操作',
  235. dataIndex: 'ABC',
  236. key: 'ABC',
  237. render: (text, record, index) => {
  238. return <div>
  239. {this.state.processStatus==0?<Popconfirm title="是否删除?" onConfirm={(e)=>{this.delectRow(record)}} okText="是" cancelText="否">
  240. <Button onClick={(e) =>{ e.stopPropagation()}} type="danger">删除</Button>
  241. </Popconfirm>:""}
  242. </div>
  243. }
  244. }
  245. ],
  246. dataSourceX: [],
  247. ContactsLists: [{
  248. title: '催款科目',
  249. dataIndex: 'dunSubject',
  250. key: 'dunSubject',
  251. render: (text, record, index) => {
  252. return <Select placeholder="请选择催款科目" value={record.dunSubject} style={{width:'150px'}}
  253. onChange={(e) => { record.dunSubject = e; this.setState({ contactList: this.state.contactList }); }}>
  254. {
  255. jiedian.map(function (item) {
  256. return <Select.Option key={item.value} >{item.key}</Select.Option>
  257. })
  258. }
  259. </Select>
  260. }
  261. },{
  262. title: '金额(万)',
  263. dataIndex: 'money',
  264. key: 'money',
  265. render: (text, record, index) => {
  266. return <Input value={record.money} placeholder="请输入金额(必填项)" key={record.id} required="required"
  267. onChange={(e) => { record.money = e.target.value; this.setState({ contactList: this.state.contactList }); }} style={{width:'120px'}}/>
  268. }
  269. }, {
  270. title: '催款状态',
  271. dataIndex: 'dunStatus',
  272. key: 'dunStatus',
  273. render: (text, record, index) => {
  274. return text?'已完成':'催款中'
  275. }
  276. },
  277. {
  278. title: '操作',
  279. dataIndex: 'dels',
  280. key: 'dels',
  281. render: (text, record, index) => {
  282. return <div>
  283. {this.state.processStatus==0?<Popconfirm title="是否删除?" onConfirm={(e)=>{this.confirmDelet(record.key)}} okText="删除" cancelText="不删除">
  284. <Button style={{marginRight:'10px',color:'#ffffff',background:'#f00',border:'none'}}>删除</Button>
  285. </Popconfirm>
  286. :''}
  287. {record.id?'': <Button type="primary" onClick={this.contactSave}>保存</Button>}
  288. </div>
  289. }
  290. }
  291. ],
  292. };
  293. },
  294. //删除
  295. delectRow(record) {
  296. this.setState({
  297. loading: true
  298. });
  299. $.ajax({
  300. method: "post",
  301. dataType: "json",
  302. crossDomain: false,
  303. url: globalConfig.context + "/api/admin/newOrder/deleteOrderTask",
  304. data: {
  305. id:record.id
  306. }
  307. }).done(function (data) {
  308. if (!data.error.length) {
  309. message.success('删除成功!');
  310. this.setState({
  311. loading: false,
  312. });
  313. this.xiangmu(this.state.orderNo)
  314. this.loadData();
  315. } else {
  316. message.warning(data.error[0].message);
  317. };
  318. }.bind(this));
  319. },
  320. //页面加载函数
  321. componentWillMount() {
  322. this.loadData();
  323. },
  324. //整行点击
  325. tableRowClick(record, index) {
  326. this.setState({
  327. visible:true,
  328. });
  329. this.xiangqing(record.orderNo);
  330. this.xiangmu(record.orderNo);
  331. this.jiedian(record.orderNo);
  332. },
  333. //点击打卡项目详情
  334. tableRowClickX(record, index) {
  335. this.setState({
  336. jid:record.id,//项目ID
  337. kid:record.commodityId,//商品ID
  338. commodityName:record.commodityName,//金额
  339. commodityPrice:record.commodityPrice,//金额
  340. commodityQuantity:record.commodityQuantity,//数量
  341. taskComment:record.taskComment,//备注
  342. main:record.main.toString(),//是否为主要
  343. addnextVisible:true,
  344. addState:0,
  345. });
  346. },
  347. //项目详情关闭
  348. nextCancel() {
  349. this.setState({
  350. addnextVisible: false
  351. })
  352. },
  353. //订单详情
  354. xiangqing(orderNos) {
  355. $.ajax({
  356. method: "get",
  357. dataType: "json",
  358. crossDomain: false,
  359. url: globalConfig.context +"/api/admin/newOrder/getOrderNewDetail",
  360. data: {
  361. orderNo:orderNos
  362. },
  363. success: function(data) {
  364. let theArr = [];
  365. if(data.error.length || data.data.list == "") {
  366. if(data.error && data.error.length) {
  367. message.warning(data.error[0].message);
  368. };
  369. } else {
  370. let thisdata=data.data;
  371. this.setState({
  372. id:thisdata.id,
  373. kehuId:thisdata.buyerId,
  374. orderNo: thisdata.orderNo,//订单编号
  375. contractNo: thisdata.contractNo,//合同编号
  376. userName:thisdata.userName,//客户名称
  377. signDate:thisdata.signDate,//签单时间
  378. processStatus:thisdata.processStatus,//流程状态
  379. liquidationStatus:thisdata.liquidationStatus,//结算状态
  380. contacts:thisdata.contacts,//企业联系人
  381. contactMobile:thisdata.contactMobile,//联系人电话
  382. legalPerson:thisdata.legalPerson,//法人
  383. legalPersonTel:thisdata.legalPersonTel,//法人电话
  384. firstAmount:thisdata.firstAmount,//签单金额
  385. totalAmount:thisdata.totalAmount,//首付金额
  386. settlementAmount:thisdata.settlementAmount,//已收款项
  387. orderRemarks:thisdata.orderRemarks,//订单留言
  388. orgCodeUrl: thisdata.contractPictureUrl ? splitUrl(thisdata.contractPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],//图片地址
  389. salesmanName:thisdata.salesmanName,//营销员名称
  390. salesmanMobile:thisdata.salesmanMobile,//营销员电话
  391. financeName:thisdata.financeName,//财务名称
  392. financeMobile:thisdata.financeMobile,//财务电话
  393. approval:thisdata.approval.toString(),//特批状态
  394. //approval:thisdata.approval==0?thisdata.approval.toString():thisdata.approval,//特批状态
  395. })
  396. };
  397. }.bind(this),
  398. }).always(function() {
  399. this.setState({
  400. loading: false
  401. });
  402. }.bind(this));
  403. },
  404. //项目列表
  405. xiangmu(orderNos) {
  406. $.ajax({
  407. method: "get",
  408. dataType: "json",
  409. crossDomain: false,
  410. url: globalConfig.context +"/api/admin/newOrder/getOrderTask",
  411. data: {
  412. orderNo:orderNos
  413. },
  414. success: function(data) {
  415. let theArr = [];
  416. if(data.error.length || data.data.list == "") {
  417. if(data.error && data.error.length) {
  418. message.warning(data.error[0].message);
  419. };
  420. } else {
  421. for (let i = 0; i < data.data.length; i++) {
  422. let thisdata = data.data[i];
  423. theArr.push({
  424. key: i,
  425. id:thisdata.id,
  426. orderNo:thisdata.orderNo,//订单编号
  427. commodityId:thisdata.commodityId,//项目ID
  428. commodityName:thisdata.commodityName,//项目名称
  429. cname:thisdata.cname,//项目类别
  430. commodityPrice:thisdata.commodityPrice,//项目价格
  431. commodityQuantity:thisdata.commodityQuantity,//项目数量
  432. main:thisdata.main,//是否为主要任务
  433. taskComment:thisdata.taskComment,//任务说明
  434. contacts:thisdata.contacts,//联系人
  435. contactsMobile:thisdata.contactsMobile,//联系人电话
  436. });
  437. };
  438. };
  439. this.setState({
  440. dataSourceX: theArr,
  441. paginations: false,
  442. });
  443. }.bind(this),
  444. }).always(function() {
  445. this.setState({
  446. loading: false
  447. });
  448. }.bind(this));
  449. },
  450. //节点列表
  451. jiedian(orderNos) {
  452. $.ajax({
  453. method: "get",
  454. dataType: "json",
  455. crossDomain: false,
  456. url: globalConfig.context +"/api/admin/newOrder/selectOrderDun",
  457. data: {
  458. orderNo:orderNos
  459. },
  460. success: function(data) {
  461. let theArr = [];
  462. let thisData=[];
  463. if(data.error.length || data.data.list == "") {
  464. if(data.error && data.error.length) {
  465. message.warning(data.error[0].message);
  466. };
  467. } else {
  468. for(let i = 0; i < data.data.length; i++) {
  469. thisData= data.data[i];
  470. theArr.push({
  471. key:i,
  472. dunSubject:thisData.dunSubject?thisData.dunSubject.toString():"",//催款科目
  473. id:thisData.id,//节点Id
  474. money:thisData.money,//催款金额
  475. dunStatus:thisData.dunStatus,//催款状态
  476. orderNo:thisData.orderNo,
  477. })
  478. }
  479. this.setState({
  480. contactList:theArr
  481. })
  482. };
  483. }.bind(this),
  484. }).always(function() {
  485. this.setState({
  486. loading: false
  487. });
  488. }.bind(this));
  489. },
  490. //催款节点保存
  491. contactSave(e) {
  492. this.setState({
  493. loading: true
  494. });
  495. $.ajax({
  496. url: globalConfig.context + '/api/admin/newOrder/createOrderDun',
  497. method: 'post',
  498. data: {
  499. orderNo: this.state.orderNo,
  500. orderDun: JSON.stringify(this.state.contactList)
  501. }
  502. }).done(function(data) {
  503. this.setState({
  504. loading: false
  505. });
  506. if(!data.error.length) {
  507. message.success('保存成功!');
  508. this.jiedian(this.state.orderNo);
  509. } else {
  510. message.warning(data.error[0].message);
  511. }
  512. }.bind(this));
  513. },
  514. //点击新增催款节点
  515. addcontact(record) {
  516. this.state.contactList.push({
  517. key:this.state.contactList.length,
  518. money: '',
  519. dunSubject:undefined,
  520. orderNo: this.state.orderNo,
  521. dunTarget:this.state.kehuId,
  522. });
  523. this.setState({
  524. contactList: this.state.contactList
  525. })
  526. },
  527. //删除收款节点
  528. confirmDelet(index) {
  529. this.state.contactList.splice(index,1);
  530. this.setState({
  531. contactList: this.state.contactList
  532. })
  533. this.contactSave();
  534. },
  535. //重新提交
  536. examOk(){
  537. let theorgCodeUrl = [];
  538. if (this.state.orgCodeUrl.length) {
  539. let picArr = [];
  540. this.state.orgCodeUrl.map(function (item) {
  541. if ( item.response && item.response.data && item.response.data.length ){
  542. picArr.push(item.response.data);
  543. }
  544. });
  545. theorgCodeUrl = picArr.join(",");
  546. };
  547. if(!this.state.contacts){
  548. message.warning('企业负责人不能为空');
  549. this.refs.signFirstPayment.focus()
  550. return false;
  551. };
  552. if(!this.state.contactMobile){
  553. message.warning('企业负责人电话不能为空');
  554. this.refs.signFirstPayment.focus()
  555. return false;
  556. };
  557. if(!this.state.totalAmount){
  558. message.warning('签单金额不能为空');
  559. this.refs.signFirstPayment.focus()
  560. return false;
  561. };
  562. if(!this.state.firstAmount){
  563. message.warning('首付金额不能为空');
  564. this.refs.signFirstPayment.focus()
  565. return false;
  566. };
  567. if(!theorgCodeUrl){
  568. message.warning('企业负责人不能为空');
  569. this.refs.signFirstPayment.focus()
  570. return false;
  571. };
  572. $.ajax({
  573. method: "post",
  574. dataType: "json",
  575. crossDomain: false,
  576. url: globalConfig.context +"/api/admin/newOrder/updateServiceOrderNew",
  577. data: {
  578. orderNo: this.state.orderNo,//订单编号
  579. totalAmount: this.state.totalAmount,//总金额
  580. firstAmount: this.state.firstAmount,//首付
  581. isSubmit: 1,//保存草稿还是提交
  582. signDate: this.state.signDate,//签单日期
  583. contacts: this.state.contacts,//企业负责人
  584. contactMobile: this.state.contactMobile,//负责人联系方式
  585. legalPerson: this.state.legalPerson,//企业法人
  586. legalPersonTel: this.state.legalPersonTel,//企业法人联系电话
  587. approval: this.state.approval,//特批状态
  588. contractNo: this.state.contractNo,//合同编号
  589. orderRemarks: this.state.orderRemarks,//订单备注
  590. contractPictureUrl:theorgCodeUrl.length?theorgCodeUrl:'',
  591. },
  592. success: function(data) {
  593. if(data.error.length || data.data.list == "") {
  594. if(data.error && data.error.length) {
  595. message.warning(data.error[0].message);
  596. };
  597. } else {
  598. message.success("该订单已重新提交~");
  599. this.setState({
  600. visible:false,
  601. });
  602. this.resets();
  603. this.loadData();
  604. };
  605. }.bind(this),
  606. }).always(function() {
  607. this.setState({
  608. loading: false
  609. });
  610. }.bind(this));
  611. },
  612. //重新提交
  613. examOks(){
  614. $.ajax({
  615. method: "post",
  616. dataType: "json",
  617. crossDomain: false,
  618. url: globalConfig.context +"/api/admin/newOrder/deleteOrderNew",
  619. data: {
  620. orderNo: this.state.orderNo,//订单编号
  621. },
  622. success: function(data) {
  623. if(data.error.length || data.data.list == "") {
  624. if(data.error && data.error.length) {
  625. message.warning(data.error[0].message);
  626. };
  627. } else {
  628. message.success("该订单已作废~");
  629. this.setState({
  630. visible:false,
  631. });
  632. this.resets();
  633. this.loadData();
  634. };
  635. }.bind(this),
  636. }).always(function() {
  637. this.setState({
  638. loading: false
  639. });
  640. }.bind(this));
  641. },
  642. //新建项目明细保存
  643. nextSubmit(e) {
  644. e.preventDefault();
  645. if(this.state.gid==undefined||!this.state.gid){
  646. message.warning('服务名称不匹配!');
  647. return false;
  648. };
  649. if(!this.state.commodityPrice){
  650. message.warning('请输入金额!');
  651. this.refs.commodityPrice.focus();
  652. return false;
  653. };
  654. if(!this.state.commodityQuantity){
  655. message.warning('请输入商品数量!');
  656. this.refs.commodityQuantity.focus();
  657. return false;
  658. };
  659. if(!this.state.main){
  660. message.warning('请选择是否为主要项目!');
  661. this.refs.commodityQuantity.focus();
  662. return false;
  663. };
  664. this.setState({
  665. loading: true
  666. });
  667. let api=this.state.addState?'/api/admin/newOrder/addOrderTask':'/api/bianji';
  668. $.ajax({
  669. method: "POST",
  670. dataType: "json",
  671. crossDomain: false,
  672. url: globalConfig.context +api ,
  673. data: {
  674. commodityId:this.state.gid,//商品ID
  675. orderNo:this.state.orderNo,//订单编号
  676. commodityName:this.state.commodityName,//商品名称
  677. commodityQuantity:this.state.commodityQuantity,//商品数量
  678. commodityPrice:this.state.commodityPrice,//签单总价
  679. taskComment:this.state.taskComment,//服务说明
  680. main:this.state.main,//是否为主要项目
  681. }
  682. }).done(function(data) {
  683. this.setState({
  684. loading: false
  685. });
  686. if(!data.error.length) {
  687. message.success('保存成功!');
  688. this.nextCancel()
  689. this.xiangmu(this.state.orderNo)
  690. } else {
  691. message.warning(data.error[0].message);
  692. }
  693. }.bind(this));
  694. },
  695. //点击签单
  696. handleCancels(e) {
  697. this.setState({
  698. isSubmit:1
  699. })
  700. },
  701. //点击签单
  702. handleCancelq(e) {
  703. this.setState({
  704. isSubmit:0
  705. })
  706. },
  707. resets(){
  708. this.state.orderNo='';
  709. this.state.customerName='';
  710. this.state.releaseDate[0] = undefined;
  711. this.state.releaseDate[1] = undefined;
  712. },
  713. //点击添加项目明细
  714. addDetailed(){
  715. this.setState({
  716. gid:'',
  717. customerArr:[],
  718. commodityName:'',
  719. commodityQuantity:'',
  720. commodityId:'',
  721. taskComment:'',
  722. main:undefined,
  723. commodityPrice:'',
  724. addState:1,
  725. addnextVisible: true
  726. })
  727. },
  728. //搜索
  729. search() {
  730. this.setState({
  731. //signBillVisible:false
  732. })
  733. this.loadData();
  734. },
  735. getOrgCodeUrl(e) {
  736. this.setState({ orgCodeUrl: e });
  737. },
  738. //关闭详情
  739. visitCancel(e){
  740. this.setState({
  741. visible:false
  742. })
  743. this.resets();
  744. },
  745. visitOk(e){
  746. this.setState({
  747. visible:false
  748. })
  749. this.resets();
  750. },
  751. //客户
  752. selectAutoCUT(value){
  753. let autoIds;
  754. let fwList=this.state.customerArr;
  755. fwList.map(function(item){
  756. if(value==item.name){
  757. autoIds=item.id
  758. }
  759. })
  760. this.setState({
  761. customerName:value,
  762. autoId:autoIds
  763. })
  764. },
  765. //加载(自动补全)
  766. supervisor(e,state){ //客户名称与服务名称自动补全
  767. let api=state?'/api/admin/customer/getCustomerByName':'/api/admin/order/getBusinessProjectByName';
  768. $.ajax({
  769. method: "get",
  770. dataType: "json",
  771. crossDomain: false,
  772. url: globalConfig.context + api,
  773. data:state?{
  774. name:e,
  775. type:this.state.customType
  776. }:{
  777. businessName:e
  778. },
  779. success: function (data) {
  780. let thedata=data.data;
  781. if (!thedata) {
  782. if (data.error && data.error.length) {
  783. message.warning(data.error[0].message);
  784. };
  785. thedata = {};
  786. };
  787. this.setState({
  788. states:state,
  789. customerArr:thedata,
  790. });
  791. }.bind(this),
  792. }).always(function () {
  793. this.setState({
  794. loading: false
  795. });
  796. }.bind(this));
  797. },
  798. //上级主管输入框失去焦点是判断客户是否存在
  799. selectAuto(value){
  800. let kid=[];
  801. let fwList=this.state.customerArr;
  802. fwList.map(function(item){
  803. if(value==item.bname){
  804. kid=item
  805. }
  806. })
  807. this.setState({
  808. commodityName:value,
  809. gid:kid.id,
  810. //commodityPrice:kid.price==0?kid.price.toString():kid.price,
  811. commodityFirstPayment:kid.firstPayment==0?kid.firstPayment.toString():kid.firstPayment
  812. })
  813. },
  814. //服务值改变时请求客户名称
  815. httpChange(e){
  816. this.state.gid='';
  817. if(e.length>=1){
  818. this.supervisor(e,false);
  819. }
  820. this.setState({
  821. commodityName:e
  822. })
  823. },
  824. render() {
  825. const formItemLayout = {
  826. labelCol: { span: 8 },
  827. wrapperCol: { span: 14 },
  828. };
  829. const FormItem = Form.Item;
  830. const { RangePicker } = DatePicker;
  831. const rowSelection = {
  832. selectedRowKeys: this.state.selectedRowKeys,
  833. onChange: (selectedRowKeys, selectedRows) => {
  834. this.setState({
  835. modalVisible:false,
  836. selectedRows: selectedRows.slice(-1),
  837. selectedRowKeys: selectedRowKeys.slice(-1)
  838. });
  839. },
  840. onSelect: (recordt, selected, selectedRows) => {
  841. this.setState({
  842. modalVisible:false,
  843. recordt: recordt.id
  844. })
  845. },
  846. };
  847. const dataSources=this.state.customerArr || [];
  848. const options = this.state.states?dataSources.map((group,index) =>
  849. <Select.Option key={group.id} value={group.name}>{group.name}</Select.Option>
  850. ):dataSources.map((group,index) =>
  851. <Select.Option key={index} value={group.bname}>{group.bname}</Select.Option>
  852. )
  853. const hasSelected = this.state.selectedRowKeys.length > 0;
  854. return(
  855. <div className="user-content">
  856. <div className="content-title">
  857. <span>订单审核</span>
  858. </div>
  859. <div className="user-search">
  860. <Input placeholder="客户名称" style={{width:'150px',marginBottom:'10px'}}
  861. value={this.state.customerName}
  862. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  863. <Input placeholder="订单编号" style={{width:'150px'}}
  864. value={this.state.orderNo}
  865. onChange={(e) => { this.setState({ orderNo: e.target.value }); }} />
  866. <span style={{marginRight:"10px"}}>合同签订时间 :</span>
  867. <RangePicker
  868. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  869. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  870. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  871. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  872. <Button onClick={this.reset}>重置</Button>
  873. <div className="patent-table">
  874. <Spin spinning={this.state.loading}>
  875. <Table columns={this.state.columns}
  876. dataSource={this.state.dataSource}
  877. rowSelection={rowSelection}
  878. pagination={this.state.pagination}
  879. onRowClick={this.tableRowClick}
  880. />
  881. </Spin>
  882. </div>
  883. <Modal
  884. className="customeDetails"
  885. footer=''
  886. title="订单详情"
  887. width='900px'
  888. visible={this.state.visible}
  889. onOk={this.visitOk}
  890. onCancel={this.visitCancel}
  891. >
  892. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form" style={{paddingBottom:'40px'}} >
  893. <Spin spinning={this.state.loading}>
  894. <div className="clearfix">
  895. <FormItem className="half-item"
  896. {...formItemLayout}
  897. label="订单编号" >
  898. <span>{this.state.orderNo}</span>
  899. </FormItem>
  900. <FormItem className="half-item"
  901. {...formItemLayout}
  902. label="合同编号" >
  903. <Input placeholder="请输入合同编号" value={this.state.contractNo}
  904. onChange={(e)=>{this.setState({contractNo:e.target.value})}} style={{width:'240px'}} />
  905. </FormItem>
  906. <FormItem className="half-item"
  907. {...formItemLayout}
  908. label="客户名称" >
  909. <span>{this.state.userName}</span>
  910. </FormItem>
  911. <FormItem className="half-item"
  912. {...formItemLayout}
  913. label="流程状态" >
  914. <span>{getProcessStatus(this.state.processStatus)}</span>
  915. </FormItem>
  916. <FormItem className="half-item"
  917. {...formItemLayout}
  918. label="结算状态" >
  919. <span>{getLiquidationStatus(this.state.liquidationStatus)}</span>
  920. </FormItem>
  921. <FormItem className="half-item"
  922. {...formItemLayout}
  923. label="已收款项(万元)" >
  924. <span>{this.state.settlementAmount}</span>
  925. </FormItem>
  926. <FormItem className="half-item"
  927. {...formItemLayout}
  928. label="企业联系人" >
  929. <Input placeholder="请输入联系人" ref='signTotalAmount' value={this.state.contacts} onChange={(e)=>{this.setState({contacts:e.target.value})}} style={{width:'240px'}} />
  930. <span className="mandatory">*</span>
  931. </FormItem>
  932. <FormItem className="half-item"
  933. {...formItemLayout}
  934. label="联系人电话" >
  935. <Input placeholder="请输入联系人电话" ref='signTotalAmount' value={this.state.contactMobile} onChange={(e)=>{this.setState({contactMobile:e.target.value})}} style={{width:'240px'}} />
  936. <span className="mandatory">*</span>
  937. </FormItem>
  938. <FormItem className="half-item"
  939. {...formItemLayout}
  940. label="企业法人" >
  941. <Input placeholder="请输入法人" ref='signTotalAmount' value={this.state.legalPerson} onChange={(e)=>{this.setState({legalPerson:e.target.value})}} style={{width:'240px'}} />
  942. </FormItem>
  943. <FormItem className="half-item"
  944. {...formItemLayout}
  945. label="法人电话" >
  946. <Input placeholder="请输入法人电话" ref='signTotalAmount' value={this.state.legalPersonTel} onChange={(e)=>{this.setState({legalPersonTel:e.target.value})}} style={{width:'240px'}} />
  947. </FormItem>
  948. <FormItem className="half-item"
  949. {...formItemLayout}
  950. label="签单金额(万元)" >
  951. <Input placeholder="签单金额" ref='signTotalAmount' value={this.state.totalAmount} onChange={(e)=>{this.setState({totalAmount:e.target.value})}} style={{width:'240px'}} />
  952. <span className="mandatory">*</span>
  953. </FormItem>
  954. <FormItem className="half-item"
  955. {...formItemLayout}
  956. label="首付金额(万元)" >
  957. <Input placeholder="请输入实签首款金额" ref='signFirstPayment' value={this.state.firstAmount} onChange={(e)=>{this.setState({firstAmount:e.target.value})}} style={{width:'240px'}} />
  958. <span className="mandatory">*</span>
  959. </FormItem>
  960. <FormItem className="half-item"
  961. {...formItemLayout}
  962. label="特批立项" >
  963. <Select placeholder="请选择客户所属类型"
  964. style={{ width:'240px'}}
  965. value={this.state.approval}
  966. onChange={(e)=>{this.setState({approval:e})}}>
  967. {
  968. tepi.map(function (item) {
  969. return <Select.Option key={item.value} >{item.key}</Select.Option>
  970. })
  971. }
  972. </Select>
  973. </FormItem>
  974. <FormItem className="half-item" {...formItemLayout} label="合同签订时间">
  975. <DatePicker
  976. style={{marginTop:"2px",width: '240px',height:"32px" }}
  977. showTime
  978. format="YYYY-MM-DD"
  979. onOk={(e)=>{}}
  980. value={this.state.signDate ? moment(this.state.signDate) : null}
  981. onChange={(data, dataString) => { this.setState({ signDate: dataString }); }} />
  982. </FormItem>
  983. <div className='clearfix'>
  984. <FormItem
  985. labelCol={{ span: 4 }}
  986. wrapperCol={{ span: 18 }}
  987. label={
  988. <span>
  989. <strong style={{ color: '#f00' }}>*</strong>合同扫描件
  990. </span>
  991. }
  992. >
  993. <PicturesWall
  994. fileList={this.getOrgCodeUrl}
  995. pictureUrl={this.state.orgCodeUrl} />
  996. <p>图片建议:要清晰。</p>
  997. </FormItem>
  998. </div>
  999. <div className='clearfix'>
  1000. <FormItem
  1001. labelCol={{ span: 4 }}
  1002. wrapperCol={{ span: 16 }}
  1003. label="订单留言" >
  1004. <Input type="textarea" placeholder="请输入订单留言" rows={4} value={this.state.orderRemarks}
  1005. onChange={(e)=>{this.setState({orderRemarks:e.target.value})}}/>
  1006. </FormItem>
  1007. </div>
  1008. <div className='clearfix'>
  1009. <FormItem className="half-item"
  1010. {...formItemLayout}
  1011. label="订单负责人" >
  1012. <span>{this.state.salesmanName}</span>
  1013. </FormItem>
  1014. <FormItem className="half-item"
  1015. {...formItemLayout}
  1016. label="订单负责人电话" >
  1017. <span>{this.state.salesmanMobile}</span>
  1018. </FormItem>
  1019. </div>
  1020. <div className='clearfix'>
  1021. <FormItem className="half-item"
  1022. {...formItemLayout}
  1023. label="财务负责人" >
  1024. <span>{this.state.financeName}</span>
  1025. </FormItem>
  1026. <FormItem className="half-item"
  1027. {...formItemLayout}
  1028. label="财务负责人电话" >
  1029. <span>{this.state.financeMobile}</span>
  1030. </FormItem>
  1031. </div>
  1032. <div>
  1033. <span style={{marginLeft:'50px',fontSize:'20px'}}>催款节点</span>
  1034. <Button type='primary' onClick={this.addcontact} style={{float:'right',marginRight:'50px',marginBottom:'15px'}}>添加催款节点</Button>
  1035. </div>
  1036. <div className="clearfix">
  1037. <Spin spinning={this.state.loading}>
  1038. <Form layout="horizontal" id="demand-form" >
  1039. <Table
  1040. pagination={false}
  1041. columns={this.state.ContactsLists}
  1042. dataSource={this.state.contactList}
  1043. />
  1044. <Col span={24} offset={9} style={{marginTop:'15px'}}>
  1045. </Col>
  1046. </Form>
  1047. </Spin>
  1048. </div>
  1049. <div>
  1050. <span style={{marginLeft:'50px',fontSize:'20px'}}>项目业务</span>
  1051. <Button type='primary' onClick={this.addDetailed} style={{float:'right',marginRight:'50px',marginBottom:'15px'}}>添加项目明细</Button>
  1052. </div>
  1053. <div className="patent-table">
  1054. <Spin spinning={this.state.loading}>
  1055. <Table columns={this.state.columnsX}
  1056. dataSource={this.state.dataSourceX}
  1057. pagination={this.state.paginations}
  1058. onRowClick={this.tableRowClickX}
  1059. />
  1060. </Spin>
  1061. </div>
  1062. <div className='addSave' style={{marginTop:'15px'}}>
  1063. <Button className="cancel" type="primary" onClick={this.examOk} style={{marginLeft:"200px"}} htmlType="submit">重新提交</Button>
  1064. <Button className="cancel" type="primary" onClick={this.examOks} style={{marginLeft:"50px"}} htmlType="submit">订单作废</Button>
  1065. <Button className="cancel" type="ghost" onClick={this.visitCancel} style={{marginLeft:"50px"}}>取消</Button>
  1066. </div>
  1067. </div>
  1068. </Spin>
  1069. </Form>
  1070. </Modal>
  1071. <Modal maskClosable={false} visible={this.state.addnextVisible}
  1072. onOk={this.nextCancel} onCancel={this.nextCancel}
  1073. width='800px'
  1074. title={this.state.addState?'添加项目任务':'项目任务详情'}
  1075. footer=''
  1076. className="admin-desc-content">
  1077. <Form layout="horizontal" onSubmit={this.nextSubmit} id="demand-form">
  1078. <Spin spinning={this.state.loading}>
  1079. {this.state.addState?<div className="clearfix">
  1080. <FormItem className="half-item"
  1081. {...formItemLayout}
  1082. label="服务名称" >
  1083. <AutoComplete
  1084. className="certain-category-search"
  1085. dropdownClassName="certain-category-search-dropdown"
  1086. dropdownMatchSelectWidth={false}
  1087. dropdownStyle={{ width: 200 }}
  1088. style={{ width: '200px' }}
  1089. dataSource={options}
  1090. placeholder="输入服务名称"
  1091. value={this.state.commodityName}
  1092. onChange={this.httpChange}
  1093. filterOption={true}
  1094. onSelect={this.selectAuto}
  1095. >
  1096. <Input/>
  1097. </AutoComplete>
  1098. <span className="mandatory">*</span>
  1099. </FormItem>
  1100. <FormItem className="half-item"
  1101. {...formItemLayout}
  1102. label="服务数量" >
  1103. <Input placeholder="请输入服务数量" value={this.state.commodityQuantity} style={{width:'200px'}}
  1104. onChange={(e)=>{this.setState({commodityQuantity:e.target.value})}} ref="commodityQuantity"/>
  1105. <span className="mandatory">*</span>
  1106. </FormItem>
  1107. <FormItem className="half-item"
  1108. {...formItemLayout}
  1109. label="实签价格(万元)" >
  1110. <Input placeholder="请输入实签价格" value={this.state.commodityPrice} style={{width:'200px'}}
  1111. onChange={(e)=>{this.setState({commodityPrice:e.target.value})}} ref="commodityPrice"/>
  1112. <span className="mandatory">*</span>
  1113. </FormItem>
  1114. <FormItem className="half-item"
  1115. {...formItemLayout}
  1116. label="主要业务" >
  1117. <Select placeholder="选择是否为主要业务"
  1118. style={{ width:'200px'}}
  1119. value={this.state.main}
  1120. onChange={(e)=>{this.setState({main:e})}}>
  1121. {
  1122. boutique.map(function (item) {
  1123. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1124. })
  1125. }
  1126. </Select>
  1127. <span className="mandatory">*</span>
  1128. </FormItem>
  1129. <div className='clearfix'>
  1130. <FormItem
  1131. labelCol={{ span: 4 }}
  1132. wrapperCol={{ span: 16 }}
  1133. label="服务说明" >
  1134. <Input type='textarea' placeholder="请输入服务说明" value={this.state.taskComment}
  1135. onChange={(e)=>{this.setState({taskComment:e.target.value})}} />
  1136. </FormItem>
  1137. </div>
  1138. <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
  1139. <Button className="submitSave" type="primary" htmlType="submit">保存</Button>
  1140. <Button className="submitSave" type="ghost" onClick={this.nextCancel}>取消</Button>
  1141. </FormItem>
  1142. </div>:
  1143. <div className='clearfix'>
  1144. <FormItem className="half-item"
  1145. {...formItemLayout}
  1146. label="项目名称" >
  1147. <span>{this.state.commodityName}</span>
  1148. </FormItem>
  1149. <FormItem className="half-item"
  1150. {...formItemLayout}
  1151. label="项目数量" >
  1152. <Input placeholder="请输入数量" value={this.state.commodityQuantity} style={{width:'200px'}}
  1153. onChange={(e)=>{this.setState({commodityQuantity:e.target.value})}} />
  1154. <span className="mandatory">*</span>
  1155. </FormItem>
  1156. <FormItem className="half-item"
  1157. {...formItemLayout}
  1158. label="金额(万元)" >
  1159. <Input placeholder="请输入签单金额" value={this.state.commodityPrice} style={{width:'200px'}}
  1160. onChange={(e)=>{this.setState({commodityPrice:e.target.value})}} />
  1161. <span className="mandatory">*</span>
  1162. </FormItem>
  1163. <FormItem className="half-item"
  1164. {...formItemLayout}
  1165. label="主要项目" >
  1166. <Select placeholder="选择是否为主要业务"
  1167. style={{ width:'200px'}}
  1168. value={this.state.main}
  1169. onChange={(e)=>{this.setState({main:e})}}>
  1170. {
  1171. boutique.map(function (item) {
  1172. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1173. })
  1174. }
  1175. </Select>
  1176. <span className="mandatory">*</span>
  1177. </FormItem>
  1178. <div className='clearfix'>
  1179. <FormItem
  1180. labelCol={{ span: 4 }}
  1181. wrapperCol={{ span: 16 }}
  1182. label="服务说明" >
  1183. <Input type='textarea' placeholder="请输入服务说明" value={this.state.taskComment}
  1184. onChange={(e)=>{this.setState({taskComment:e.target.value})}} />
  1185. </FormItem>
  1186. </div>
  1187. <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
  1188. <Button className="submitSave" type="primary" onClick={this.tabRowSave}>保存</Button>
  1189. <Button className="submitSave" type="ghost" onClick={this.nextCancel}>取消</Button>
  1190. </FormItem>
  1191. </div>}
  1192. </Spin>
  1193. </Form >
  1194. </Modal>
  1195. </div>
  1196. </div>
  1197. );
  1198. }
  1199. }));
  1200. export default IntentionCustomer;