reject.jsx 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  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. nextSubmit(e) {
  614. e.preventDefault();
  615. if(this.state.gid==undefined||!this.state.gid){
  616. message.warning('服务名称不匹配!');
  617. return false;
  618. };
  619. if(!this.state.commodityPrice){
  620. message.warning('请输入金额!');
  621. this.refs.commodityPrice.focus();
  622. return false;
  623. };
  624. if(!this.state.commodityQuantity){
  625. message.warning('请输入商品数量!');
  626. this.refs.commodityQuantity.focus();
  627. return false;
  628. };
  629. if(!this.state.main){
  630. message.warning('请选择是否为主要项目!');
  631. this.refs.commodityQuantity.focus();
  632. return false;
  633. };
  634. this.setState({
  635. loading: true
  636. });
  637. let api=this.state.addState?'/api/admin/newOrder/addOrderTask':'/api/bianji';
  638. $.ajax({
  639. method: "POST",
  640. dataType: "json",
  641. crossDomain: false,
  642. url: globalConfig.context +api ,
  643. data: {
  644. commodityId:this.state.gid,//商品ID
  645. orderNo:this.state.orderNo,//订单编号
  646. commodityName:this.state.commodityName,//商品名称
  647. commodityQuantity:this.state.commodityQuantity,//商品数量
  648. commodityPrice:this.state.commodityPrice,//签单总价
  649. taskComment:this.state.taskComment,//服务说明
  650. main:this.state.main,//是否为主要项目
  651. }
  652. }).done(function(data) {
  653. this.setState({
  654. loading: false
  655. });
  656. if(!data.error.length) {
  657. message.success('保存成功!');
  658. this.nextCancel()
  659. this.xiangmu(this.state.orderNo)
  660. } else {
  661. message.warning(data.error[0].message);
  662. }
  663. }.bind(this));
  664. },
  665. //点击签单
  666. handleCancels(e) {
  667. this.setState({
  668. isSubmit:1
  669. })
  670. },
  671. //点击签单
  672. handleCancelq(e) {
  673. this.setState({
  674. isSubmit:0
  675. })
  676. },
  677. resets(){
  678. this.state.orderNo='';
  679. this.state.customerName='';
  680. this.state.releaseDate[0] = undefined;
  681. this.state.releaseDate[1] = undefined;
  682. },
  683. //点击添加项目明细
  684. addDetailed(){
  685. this.setState({
  686. gid:'',
  687. customerArr:[],
  688. commodityName:'',
  689. commodityQuantity:'',
  690. commodityId:'',
  691. taskComment:'',
  692. main:undefined,
  693. commodityPrice:'',
  694. addState:1,
  695. addnextVisible: true
  696. })
  697. },
  698. //搜索
  699. search() {
  700. this.setState({
  701. //signBillVisible:false
  702. })
  703. this.loadData();
  704. },
  705. getOrgCodeUrl(e) {
  706. this.setState({ orgCodeUrl: e });
  707. },
  708. //关闭详情
  709. visitCancel(e){
  710. this.setState({
  711. visible:false
  712. })
  713. this.resets();
  714. },
  715. visitOk(e){
  716. this.setState({
  717. visible:false
  718. })
  719. this.resets();
  720. },
  721. //客户
  722. selectAutoCUT(value){
  723. let autoIds;
  724. let fwList=this.state.customerArr;
  725. fwList.map(function(item){
  726. if(value==item.name){
  727. autoIds=item.id
  728. }
  729. })
  730. this.setState({
  731. customerName:value,
  732. autoId:autoIds
  733. })
  734. },
  735. //加载(自动补全)
  736. supervisor(e,state){ //客户名称与服务名称自动补全
  737. let api=state?'/api/admin/customer/getCustomerByName':'/api/admin/order/getBusinessProjectByName';
  738. $.ajax({
  739. method: "get",
  740. dataType: "json",
  741. crossDomain: false,
  742. url: globalConfig.context + api,
  743. data:state?{
  744. name:e,
  745. type:this.state.customType
  746. }:{
  747. businessName:e
  748. },
  749. success: function (data) {
  750. let thedata=data.data;
  751. if (!thedata) {
  752. if (data.error && data.error.length) {
  753. message.warning(data.error[0].message);
  754. };
  755. thedata = {};
  756. };
  757. this.setState({
  758. states:state,
  759. customerArr:thedata,
  760. });
  761. }.bind(this),
  762. }).always(function () {
  763. this.setState({
  764. loading: false
  765. });
  766. }.bind(this));
  767. },
  768. //上级主管输入框失去焦点是判断客户是否存在
  769. selectAuto(value){
  770. let kid=[];
  771. let fwList=this.state.customerArr;
  772. fwList.map(function(item){
  773. if(value==item.bname){
  774. kid=item
  775. }
  776. })
  777. this.setState({
  778. commodityName:value,
  779. gid:kid.id,
  780. //commodityPrice:kid.price==0?kid.price.toString():kid.price,
  781. commodityFirstPayment:kid.firstPayment==0?kid.firstPayment.toString():kid.firstPayment
  782. })
  783. },
  784. //服务值改变时请求客户名称
  785. httpChange(e){
  786. this.state.gid='';
  787. if(e.length>=1){
  788. this.supervisor(e,false);
  789. }
  790. this.setState({
  791. commodityName:e
  792. })
  793. },
  794. render() {
  795. const formItemLayout = {
  796. labelCol: { span: 8 },
  797. wrapperCol: { span: 14 },
  798. };
  799. const FormItem = Form.Item;
  800. const { RangePicker } = DatePicker;
  801. const rowSelection = {
  802. selectedRowKeys: this.state.selectedRowKeys,
  803. onChange: (selectedRowKeys, selectedRows) => {
  804. this.setState({
  805. modalVisible:false,
  806. selectedRows: selectedRows.slice(-1),
  807. selectedRowKeys: selectedRowKeys.slice(-1)
  808. });
  809. },
  810. onSelect: (recordt, selected, selectedRows) => {
  811. this.setState({
  812. modalVisible:false,
  813. recordt: recordt.id
  814. })
  815. },
  816. };
  817. const dataSources=this.state.customerArr || [];
  818. const options = this.state.states?dataSources.map((group,index) =>
  819. <Select.Option key={group.id} value={group.name}>{group.name}</Select.Option>
  820. ):dataSources.map((group,index) =>
  821. <Select.Option key={index} value={group.bname}>{group.bname}</Select.Option>
  822. )
  823. const hasSelected = this.state.selectedRowKeys.length > 0;
  824. return(
  825. <div className="user-content">
  826. <div className="content-title">
  827. <span>订单审核</span>
  828. </div>
  829. <div className="user-search">
  830. <Input placeholder="客户名称" style={{width:'150px',marginBottom:'10px'}}
  831. value={this.state.customerName}
  832. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  833. <Input placeholder="订单编号" style={{width:'150px'}}
  834. value={this.state.orderNo}
  835. onChange={(e) => { this.setState({ orderNo: e.target.value }); }} />
  836. <span style={{marginRight:"10px"}}>合同签订时间 :</span>
  837. <RangePicker
  838. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  839. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  840. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  841. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  842. <Button onClick={this.reset}>重置</Button>
  843. <div className="patent-table">
  844. <Spin spinning={this.state.loading}>
  845. <Table columns={this.state.columns}
  846. dataSource={this.state.dataSource}
  847. rowSelection={rowSelection}
  848. pagination={this.state.pagination}
  849. onRowClick={this.tableRowClick}
  850. />
  851. </Spin>
  852. </div>
  853. <Modal
  854. className="customeDetails"
  855. footer=''
  856. title="订单详情"
  857. width='900px'
  858. visible={this.state.visible}
  859. onOk={this.visitOk}
  860. onCancel={this.visitCancel}
  861. >
  862. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form" style={{paddingBottom:'40px'}} >
  863. <Spin spinning={this.state.loading}>
  864. <div className="clearfix">
  865. <FormItem className="half-item"
  866. {...formItemLayout}
  867. label="订单编号" >
  868. <span>{this.state.orderNo}</span>
  869. </FormItem>
  870. <FormItem className="half-item"
  871. {...formItemLayout}
  872. label="合同编号" >
  873. <Input placeholder="请输入合同编号" value={this.state.contractNo}
  874. onChange={(e)=>{this.setState({contractNo:e.target.value})}} style={{width:'240px'}} />
  875. </FormItem>
  876. <FormItem className="half-item"
  877. {...formItemLayout}
  878. label="客户名称" >
  879. <span>{this.state.userName}</span>
  880. </FormItem>
  881. <FormItem className="half-item"
  882. {...formItemLayout}
  883. label="流程状态" >
  884. <span>{getProcessStatus(this.state.processStatus)}</span>
  885. </FormItem>
  886. <FormItem className="half-item"
  887. {...formItemLayout}
  888. label="结算状态" >
  889. <span>{getLiquidationStatus(this.state.liquidationStatus)}</span>
  890. </FormItem>
  891. <FormItem className="half-item"
  892. {...formItemLayout}
  893. label="已收款项(万元)" >
  894. <span>{this.state.settlementAmount}</span>
  895. </FormItem>
  896. <FormItem className="half-item"
  897. {...formItemLayout}
  898. label="企业联系人" >
  899. <Input placeholder="请输入联系人" ref='signTotalAmount' value={this.state.contacts} onChange={(e)=>{this.setState({contacts:e.target.value})}} style={{width:'240px'}} />
  900. <span className="mandatory">*</span>
  901. </FormItem>
  902. <FormItem className="half-item"
  903. {...formItemLayout}
  904. label="联系人电话" >
  905. <Input placeholder="请输入联系人电话" ref='signTotalAmount' value={this.state.contactMobile} onChange={(e)=>{this.setState({contactMobile:e.target.value})}} style={{width:'240px'}} />
  906. <span className="mandatory">*</span>
  907. </FormItem>
  908. <FormItem className="half-item"
  909. {...formItemLayout}
  910. label="企业法人" >
  911. <Input placeholder="请输入法人" ref='signTotalAmount' value={this.state.legalPerson} onChange={(e)=>{this.setState({legalPerson:e.target.value})}} style={{width:'240px'}} />
  912. </FormItem>
  913. <FormItem className="half-item"
  914. {...formItemLayout}
  915. label="法人电话" >
  916. <Input placeholder="请输入法人电话" ref='signTotalAmount' value={this.state.legalPersonTel} onChange={(e)=>{this.setState({legalPersonTel:e.target.value})}} style={{width:'240px'}} />
  917. </FormItem>
  918. <FormItem className="half-item"
  919. {...formItemLayout}
  920. label="签单金额(万元)" >
  921. <Input placeholder="签单金额" ref='signTotalAmount' value={this.state.totalAmount} onChange={(e)=>{this.setState({totalAmount:e.target.value})}} style={{width:'240px'}} />
  922. <span className="mandatory">*</span>
  923. </FormItem>
  924. <FormItem className="half-item"
  925. {...formItemLayout}
  926. label="首付金额(万元)" >
  927. <Input placeholder="请输入实签首款金额" ref='signFirstPayment' value={this.state.firstAmount} onChange={(e)=>{this.setState({firstAmount:e.target.value})}} style={{width:'240px'}} />
  928. <span className="mandatory">*</span>
  929. </FormItem>
  930. <FormItem className="half-item"
  931. {...formItemLayout}
  932. label="特批立项" >
  933. <Select placeholder="请选择客户所属类型"
  934. style={{ width:'240px'}}
  935. value={this.state.approval}
  936. onChange={(e)=>{this.setState({approval:e})}}>
  937. {
  938. tepi.map(function (item) {
  939. return <Select.Option key={item.value} >{item.key}</Select.Option>
  940. })
  941. }
  942. </Select>
  943. </FormItem>
  944. <FormItem className="half-item" {...formItemLayout} label="合同签订时间">
  945. <DatePicker
  946. style={{marginTop:"2px",width: '240px',height:"32px" }}
  947. showTime
  948. format="YYYY-MM-DD"
  949. onOk={(e)=>{}}
  950. value={this.state.signDate ? moment(this.state.signDate) : null}
  951. onChange={(data, dataString) => { this.setState({ signDate: dataString }); }} />
  952. </FormItem>
  953. <div className='clearfix'>
  954. <FormItem
  955. labelCol={{ span: 4 }}
  956. wrapperCol={{ span: 18 }}
  957. label={
  958. <span>
  959. <strong style={{ color: '#f00' }}>*</strong>合同扫描件
  960. </span>
  961. }
  962. >
  963. <PicturesWall
  964. fileList={this.getOrgCodeUrl}
  965. pictureUrl={this.state.orgCodeUrl} />
  966. <p>图片建议:要清晰。</p>
  967. </FormItem>
  968. </div>
  969. <div className='clearfix'>
  970. <FormItem
  971. labelCol={{ span: 4 }}
  972. wrapperCol={{ span: 16 }}
  973. label="订单留言" >
  974. <Input type="textarea" placeholder="请输入订单留言" rows={4} value={this.state.orderRemarks}
  975. onChange={(e)=>{this.setState({orderRemarks:e.target.value})}}/>
  976. </FormItem>
  977. </div>
  978. <div className='clearfix'>
  979. <FormItem className="half-item"
  980. {...formItemLayout}
  981. label="订单负责人" >
  982. <span>{this.state.salesmanName}</span>
  983. </FormItem>
  984. <FormItem className="half-item"
  985. {...formItemLayout}
  986. label="订单负责人电话" >
  987. <span>{this.state.salesmanMobile}</span>
  988. </FormItem>
  989. </div>
  990. <div className='clearfix'>
  991. <FormItem className="half-item"
  992. {...formItemLayout}
  993. label="财务负责人" >
  994. <span>{this.state.financeName}</span>
  995. </FormItem>
  996. <FormItem className="half-item"
  997. {...formItemLayout}
  998. label="财务负责人电话" >
  999. <span>{this.state.financeMobile}</span>
  1000. </FormItem>
  1001. </div>
  1002. <div>
  1003. <span style={{marginLeft:'50px',fontSize:'20px'}}>催款节点</span>
  1004. <Button type='primary' onClick={this.addcontact} style={{float:'right',marginRight:'50px',marginBottom:'15px'}}>添加催款节点</Button>
  1005. </div>
  1006. <div className="clearfix">
  1007. <Spin spinning={this.state.loading}>
  1008. <Form layout="horizontal" id="demand-form" >
  1009. <Table
  1010. pagination={false}
  1011. columns={this.state.ContactsLists}
  1012. dataSource={this.state.contactList}
  1013. />
  1014. <Col span={24} offset={9} style={{marginTop:'15px'}}>
  1015. </Col>
  1016. </Form>
  1017. </Spin>
  1018. </div>
  1019. <div>
  1020. <span style={{marginLeft:'50px',fontSize:'20px'}}>项目业务</span>
  1021. <Button type='primary' onClick={this.addDetailed} style={{float:'right',marginRight:'50px',marginBottom:'15px'}}>添加项目明细</Button>
  1022. </div>
  1023. <div className="patent-table">
  1024. <Spin spinning={this.state.loading}>
  1025. <Table columns={this.state.columnsX}
  1026. dataSource={this.state.dataSourceX}
  1027. pagination={this.state.paginations}
  1028. onRowClick={this.tableRowClickX}
  1029. />
  1030. </Spin>
  1031. </div>
  1032. <div className='addSave' style={{marginTop:'15px'}}>
  1033. <Button className="cancel" type="primary" onClick={this.examOk} style={{marginLeft:"200px"}} htmlType="submit">重新提交</Button>
  1034. <Button className="cancel" type="ghost" onClick={this.visitCancel} style={{marginLeft:"50px"}}>取消</Button>
  1035. </div>
  1036. </div>
  1037. </Spin>
  1038. </Form>
  1039. </Modal>
  1040. <Modal maskClosable={false} visible={this.state.addnextVisible}
  1041. onOk={this.nextCancel} onCancel={this.nextCancel}
  1042. width='800px'
  1043. title={this.state.addState?'添加项目任务':'项目任务详情'}
  1044. footer=''
  1045. className="admin-desc-content">
  1046. <Form layout="horizontal" onSubmit={this.nextSubmit} id="demand-form">
  1047. <Spin spinning={this.state.loading}>
  1048. {this.state.addState?<div className="clearfix">
  1049. <FormItem className="half-item"
  1050. {...formItemLayout}
  1051. label="服务名称" >
  1052. <AutoComplete
  1053. className="certain-category-search"
  1054. dropdownClassName="certain-category-search-dropdown"
  1055. dropdownMatchSelectWidth={false}
  1056. dropdownStyle={{ width: 200 }}
  1057. style={{ width: '200px' }}
  1058. dataSource={options}
  1059. placeholder="输入服务名称"
  1060. value={this.state.commodityName}
  1061. onChange={this.httpChange}
  1062. filterOption={true}
  1063. onSelect={this.selectAuto}
  1064. >
  1065. <Input/>
  1066. </AutoComplete>
  1067. <span className="mandatory">*</span>
  1068. </FormItem>
  1069. <FormItem className="half-item"
  1070. {...formItemLayout}
  1071. label="服务数量" >
  1072. <Input placeholder="请输入服务数量" value={this.state.commodityQuantity} style={{width:'200px'}}
  1073. onChange={(e)=>{this.setState({commodityQuantity:e.target.value})}} ref="commodityQuantity"/>
  1074. <span className="mandatory">*</span>
  1075. </FormItem>
  1076. <FormItem className="half-item"
  1077. {...formItemLayout}
  1078. label="实签价格(万元)" >
  1079. <Input placeholder="请输入实签价格" value={this.state.commodityPrice} style={{width:'200px'}}
  1080. onChange={(e)=>{this.setState({commodityPrice:e.target.value})}} ref="commodityPrice"/>
  1081. <span className="mandatory">*</span>
  1082. </FormItem>
  1083. <FormItem className="half-item"
  1084. {...formItemLayout}
  1085. label="主要业务" >
  1086. <Select placeholder="选择是否为主要业务"
  1087. style={{ width:'200px'}}
  1088. value={this.state.main}
  1089. onChange={(e)=>{this.setState({main:e})}}>
  1090. {
  1091. boutique.map(function (item) {
  1092. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1093. })
  1094. }
  1095. </Select>
  1096. <span className="mandatory">*</span>
  1097. </FormItem>
  1098. <div className='clearfix'>
  1099. <FormItem
  1100. labelCol={{ span: 4 }}
  1101. wrapperCol={{ span: 16 }}
  1102. label="服务说明" >
  1103. <Input type='textarea' placeholder="请输入服务说明" value={this.state.taskComment}
  1104. onChange={(e)=>{this.setState({taskComment:e.target.value})}} />
  1105. </FormItem>
  1106. </div>
  1107. <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
  1108. <Button className="submitSave" type="primary" htmlType="submit">保存</Button>
  1109. <Button className="submitSave" type="ghost" onClick={this.nextCancel}>取消</Button>
  1110. </FormItem>
  1111. </div>:
  1112. <div className='clearfix'>
  1113. <FormItem className="half-item"
  1114. {...formItemLayout}
  1115. label="项目名称" >
  1116. <span>{this.state.commodityName}</span>
  1117. </FormItem>
  1118. <FormItem className="half-item"
  1119. {...formItemLayout}
  1120. label="项目数量" >
  1121. <Input placeholder="请输入数量" value={this.state.commodityQuantity} style={{width:'200px'}}
  1122. onChange={(e)=>{this.setState({commodityQuantity:e.target.value})}} />
  1123. <span className="mandatory">*</span>
  1124. </FormItem>
  1125. <FormItem className="half-item"
  1126. {...formItemLayout}
  1127. label="金额(万元)" >
  1128. <Input placeholder="请输入签单金额" value={this.state.commodityPrice} style={{width:'200px'}}
  1129. onChange={(e)=>{this.setState({commodityPrice:e.target.value})}} />
  1130. <span className="mandatory">*</span>
  1131. </FormItem>
  1132. <FormItem className="half-item"
  1133. {...formItemLayout}
  1134. label="主要项目" >
  1135. <Select placeholder="选择是否为主要业务"
  1136. style={{ width:'200px'}}
  1137. value={this.state.main}
  1138. onChange={(e)=>{this.setState({main:e})}}>
  1139. {
  1140. boutique.map(function (item) {
  1141. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1142. })
  1143. }
  1144. </Select>
  1145. <span className="mandatory">*</span>
  1146. </FormItem>
  1147. <div className='clearfix'>
  1148. <FormItem
  1149. labelCol={{ span: 4 }}
  1150. wrapperCol={{ span: 16 }}
  1151. label="服务说明" >
  1152. <Input type='textarea' placeholder="请输入服务说明" value={this.state.taskComment}
  1153. onChange={(e)=>{this.setState({taskComment:e.target.value})}} />
  1154. </FormItem>
  1155. </div>
  1156. <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
  1157. <Button className="submitSave" type="primary" onClick={this.tabRowSave}>保存</Button>
  1158. <Button className="submitSave" type="ghost" onClick={this.nextCancel}>取消</Button>
  1159. </FormItem>
  1160. </div>}
  1161. </Spin>
  1162. </Form >
  1163. </Modal>
  1164. </div>
  1165. </div>
  1166. );
  1167. }
  1168. }));
  1169. export default IntentionCustomer;