press.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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 } from '@/dataDic.js';
  8. import { getLiquidationStatus,getApprovedState,getProcessStatus,splitUrl,getjiedian,getboutique,getNewOrderStatus,getProjectStatus} 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/dunOrderNewList",
  86. data: {
  87. pageNo: pageNo || 1,
  88. pageSize: this.state.pagination.pageSize,
  89. name: this.state.customerName,//名称
  90. orderNo: this.state.orderNo,//订单编号
  91. starTime: this.state.releaseDate[0],//开始时间
  92. endTime: this.state.releaseDate[1],//结束时间
  93. },
  94. success: function(data) {
  95. let theArr = [];
  96. if(data.error.length || data.data.list == "") {
  97. if(data.error && data.error.length) {
  98. message.warning(data.error[0].message);
  99. };
  100. } else {
  101. for(let i = 0; i < data.data.list.length; i++) {
  102. let thisdata = data.data.list[i];
  103. theArr.push({
  104. key: i,
  105. id:thisdata.id,//ID
  106. orderNo: thisdata.orderNo,//订单编号
  107. totalAmount:thisdata.totalAmount,//签单金额
  108. settlementAmount:thisdata.settlementAmount,//已收款
  109. orderStatus:thisdata.orderStatus,//订单状态
  110. projectStatus:thisdata.projectStatus,//项目状态
  111. liquidationStatus:thisdata.liquidationStatus,//结算状态
  112. signDate:thisdata.signDate,//签单时间
  113. userName:thisdata.userName,//客户名称
  114. salesmanName:thisdata.salesmanName,//营销员名称
  115. dunSubject:thisdata.dunSubject,//催收科目
  116. startDate:thisdata.startDate,//催收启动时间
  117. });
  118. };
  119. this.state.pagination.total = data.data.totalCount;
  120. };
  121. if(data.data&&data.data.list&&!data.data.list.length){
  122. this.state.pagination.total=0
  123. }
  124. this.setState({
  125. dataSource: theArr,
  126. pageNo: pageNo,
  127. pagination: this.state.pagination,
  128. selectedRowKeys:[]
  129. });
  130. }.bind(this),
  131. }).always(function() {
  132. this.setState({
  133. loading: false
  134. });
  135. }.bind(this));
  136. },
  137. loadDatas(dunId) {
  138. this.setState({
  139. loading: true,
  140. });
  141. $.ajax({
  142. method: "get",
  143. dataType: "json",
  144. crossDomain: false,
  145. url: globalConfig.context +"/api/admin/newOrder/selectDunLogList",
  146. data: {
  147. dunId:dunId,
  148. },
  149. success: function(data) {
  150. let theArr = [];
  151. if(data.error.length || data.data == "") {
  152. if(data.error && data.error.length) {
  153. message.warning(data.error[0].message);
  154. };
  155. } else {
  156. for(let i = 0; i < data.data.length; i++) {
  157. let thisdata = data.data[i];
  158. theArr.push({
  159. key: i,
  160. id:thisdata.id,//ID
  161. dunId: thisdata.dunId,//催款ID
  162. dumBy:thisdata.dumBy,//催款人
  163. dumTime:thisdata.dumDate,//催款时间
  164. remarks:thisdata.remarks,//备注
  165. });
  166. };
  167. };
  168. this.setState({
  169. dataSources: theArr,
  170. });
  171. }.bind(this),
  172. }).always(function() {
  173. this.setState({
  174. loading: false
  175. });
  176. }.bind(this));
  177. },
  178. getInitialState() {
  179. return {
  180. page:1,
  181. releaseDate: [],
  182. selectedRowKeys: [],
  183. orgCodeUrl:[],
  184. paginations:false,
  185. pagination: {
  186. defaultCurrent: 1,
  187. defaultPageSize: 10,
  188. showQuickJumper: true,
  189. pageSize: 10,
  190. onChange: function(page) {
  191. this.loadData(page);
  192. }.bind(this),
  193. showTotal: function(total) {
  194. return '共' + total + '条数据';
  195. }
  196. },
  197. columns: [
  198. {
  199. title: '订单编号',
  200. dataIndex: 'orderNo',
  201. key: 'orderNo'
  202. }, {
  203. title: '签单时间',
  204. dataIndex: 'signDate',
  205. key: 'signDate'
  206. },{
  207. title: '客户名称',
  208. dataIndex: 'userName',
  209. key: 'userName',
  210. render:(text)=>{
  211. return (text&&text.length>9?text.substr(0,9)+'...':text)
  212. }
  213. },{
  214. title: '订单状态',
  215. dataIndex: 'orderStatus',
  216. key: 'orderStatus',
  217. render:text=>{return getNewOrderStatus(text)}
  218. }, {
  219. title: '签单金额(万元)',
  220. dataIndex: 'totalAmount',
  221. key: 'totalAmount'
  222. },{
  223. title: '项目状态',
  224. dataIndex: 'projectStatus',
  225. key: 'projectStatus',
  226. render:text=>{return getProjectStatus(text)}
  227. },{
  228. title: '结算状态',
  229. dataIndex: 'liquidationStatus',
  230. key: 'liquidationStatus',
  231. render:text=>{return getLiquidationStatus(text)}
  232. }, {
  233. title: '已收款',
  234. dataIndex: 'settlementAmount',
  235. key: 'settlementAmount'
  236. },{
  237. title: '订单负责人',
  238. dataIndex: 'salesmanName',
  239. key: 'salesmanName'
  240. },{
  241. title: '催收科目',
  242. dataIndex: 'dunSubject',
  243. key: 'dunSubject'
  244. },{
  245. title: '催款启动日期',
  246. dataIndex: 'startDate',
  247. key: 'startDate'
  248. }, {
  249. title: '催收操作',
  250. dataIndex: 'abc',
  251. key: 'abc',
  252. render: (text, record, index) => {
  253. return <div>
  254. <Button onClick={(e) =>{ e.stopPropagation(), this.visit(record)}} type="primary">添加催款记录</Button>
  255. </div>
  256. }
  257. }
  258. ],
  259. data: [],
  260. dataSource: [],
  261. columnsX: [
  262. {
  263. title: '催款人',
  264. dataIndex: 'dumBy',
  265. key: 'dumBy'
  266. }, {
  267. title: '催款时间',
  268. dataIndex: 'dumTime',
  269. key: 'dumTime',
  270. },{
  271. title: '催款情况',
  272. dataIndex: 'remarks',
  273. key: 'remarks'
  274. }
  275. ],
  276. dataSources: [],
  277. }
  278. },
  279. //页面加载函数
  280. componentWillMount() {
  281. this.loadData();
  282. },
  283. //进入新增拜访记录
  284. visit(record) {
  285. this.setState({
  286. visible:true,
  287. dunId:record.id
  288. })
  289. },
  290. // //整行点击
  291. tableRowClick(record, index) {
  292. this.setState({
  293. visibles:true,
  294. });
  295. this.loadDatas(record.id);
  296. },
  297. //新增催款记录
  298. examOk(){
  299. $.ajax({
  300. method: "post",
  301. dataType: "json",
  302. crossDomain: false,
  303. url: globalConfig.context +"/api/admin/newOrder/createDunLog",
  304. data: {
  305. dunId:this.state.dunId,
  306. dumTime:this.state.dumTime,
  307. remarks:this.state.remarks,
  308. },
  309. success: function(data) {
  310. if(data.error.length || data.data.list == "") {
  311. if(data.error && data.error.length) {
  312. message.warning(data.error[0].message);
  313. };
  314. } else {
  315. message.success("新增催款记录成功~");
  316. this.setState({
  317. visible:false,
  318. });
  319. this.loadData();
  320. this.resets();
  321. };
  322. }.bind(this),
  323. }).always(function() {
  324. this.setState({
  325. loading: false
  326. });
  327. }.bind(this));
  328. },
  329. //关闭输入理由框
  330. noCancel(){
  331. this.setState({
  332. noVisible:false
  333. })
  334. },
  335. //搜索
  336. search() {
  337. this.setState({
  338. //signBillVisible:false
  339. })
  340. this.loadData();
  341. },
  342. //重置
  343. reset() {
  344. this.setState({
  345. signBillVisible:false
  346. })
  347. this.state.orderNo='';
  348. this.state.customerName='';
  349. this.state.releaseDate[0] = undefined;
  350. this.state.releaseDate[1] = undefined;
  351. this.loadData();
  352. },
  353. resets(){
  354. this.state.orderNo='';
  355. this.state.customerName='';
  356. this.state.releaseDate[0] = undefined;
  357. this.state.releaseDate[1] = undefined;
  358. },
  359. getOrgCodeUrl(e) {
  360. this.setState({ orgCodeUrl: e });
  361. },
  362. //关闭详情
  363. visitCancel(e){
  364. this.setState({
  365. visible:false
  366. })
  367. this.resets();
  368. },
  369. visitOk(e){
  370. this.setState({
  371. visible:false
  372. })
  373. this.resets();
  374. },
  375. //关闭详情
  376. visitCancels(e){
  377. this.setState({
  378. visibles:false
  379. })
  380. this.resets();
  381. },
  382. //导出
  383. exportExec(){
  384. var data = {
  385. name: this.state.customerName,//订单负责人
  386. orderNo: this.state.orderNo,//订单编号
  387. startTime: this.state.releaseDate[0],
  388. endTime: this.state.releaseDate[1],
  389. }
  390. window.location.href=(globalConfig.context+'/api/admin/newOrder/exportOrderDunData?'+$.param(data));
  391. },
  392. visitOks(e){
  393. this.setState({
  394. visibles:false
  395. })
  396. this.resets();
  397. },
  398. render() {
  399. const formItemLayout = {
  400. labelCol: { span: 8 },
  401. wrapperCol: { span: 14 },
  402. };
  403. const FormItem = Form.Item;
  404. const { RangePicker } = DatePicker;
  405. const rowSelection = {
  406. selectedRowKeys: this.state.selectedRowKeys,
  407. onChange: (selectedRowKeys, selectedRows) => {
  408. this.setState({
  409. modalVisible:false,
  410. selectedRows: selectedRows.slice(-1),
  411. selectedRowKeys: selectedRowKeys.slice(-1)
  412. });
  413. },
  414. onSelect: (recordt, selected, selectedRows) => {
  415. this.setState({
  416. modalVisible:false,
  417. recordt: recordt.id
  418. })
  419. },
  420. };
  421. const hasSelected = this.state.selectedRowKeys.length > 0;
  422. return(
  423. <div className="user-content">
  424. <div className="content-title">
  425. <span>催款节点统计</span>
  426. </div>
  427. <div className="user-search">
  428. <Button type="primary" onClick={this.exportExec} style={{float:'right'}}>导出催款列表</Button>
  429. <Input placeholder="客户名称" style={{width:'150px',marginBottom:'10px'}}
  430. value={this.state.customerName}
  431. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  432. <Input placeholder="订单编号" style={{width:'150px'}}
  433. value={this.state.orderNo}
  434. onChange={(e) => { this.setState({ orderNo: e.target.value }); }} />
  435. <span style={{marginRight:"10px"}}>合同签订时间 :</span>
  436. <RangePicker
  437. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  438. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  439. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  440. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  441. <Button onClick={this.reset}>重置</Button>
  442. <div className="patent-table">
  443. <Spin spinning={this.state.loading}>
  444. <Table columns={this.state.columns}
  445. dataSource={this.state.dataSource}
  446. rowSelection={rowSelection}
  447. pagination={this.state.pagination}
  448. onRowClick={this.tableRowClick}
  449. />
  450. </Spin>
  451. </div>
  452. <Modal
  453. className="customeDetails"
  454. footer=''
  455. title="新增催款记录"
  456. width='500px'
  457. visible={this.state.visible}
  458. onOk={this.visitOk}
  459. onCancel={this.visitCancel}
  460. >
  461. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form" style={{paddingBottom:'40px'}} >
  462. <Spin spinning={this.state.loading}>
  463. <div className="clearfix">
  464. <div className='clearfix'>
  465. <FormItem className="half-item" {...formItemLayout} label="催款时间">
  466. <DatePicker
  467. style={{marginTop:"2px",width: '240px',height:"32px" }}
  468. showTime
  469. format="YYYY-MM-DD"
  470. onOk={(e)=>{}}
  471. value={this.state.dumTime ? moment(this.state.dumTime) : null}
  472. onChange={(data, dataString) => { this.setState({ dumTime: dataString }); }} />
  473. </FormItem>
  474. </div>
  475. <div className='clearfix'>
  476. <FormItem
  477. labelCol={{ span: 4 }}
  478. wrapperCol={{ span: 16 }}
  479. label="催款情况" >
  480. <Input type="textarea" placeholder="请输入催款情况" rows={4} value={this.state.remarks}
  481. onChange={(e)=>{this.setState({remarks:e.target.value})}}/>
  482. </FormItem>
  483. </div>
  484. <div className='clearfix'>
  485. <Button className="cancel" type="primary" onClick={this.examOk} style={{marginLeft:"50px"}} htmlType="submit">添加</Button>
  486. <Button className="cancel" type="ghost" onClick={this.noCancel} style={{marginLeft:"50px"}}>取消</Button>
  487. </div>
  488. </div>
  489. </Spin>
  490. </Form>
  491. </Modal>
  492. <Modal
  493. className="customeDetails"
  494. footer=''
  495. title="催款记录查看"
  496. width='500px'
  497. visible={this.state.visibles}
  498. onOk={this.visitOks}
  499. onCancel={this.visitCancels}
  500. >
  501. <div className="user-content">
  502. <div className="patent-table">
  503. <Spin spinning={this.state.loading}>
  504. <Table columns={this.state.columnsX}
  505. dataSource={this.state.dataSources}
  506. rowSelection={rowSelection}
  507. pagination={this.state.paginations}
  508. onRowClick={this.tableRowClick}
  509. />
  510. </Spin>
  511. </div>
  512. </div>
  513. </Modal>
  514. </div>
  515. </div>
  516. );
  517. }
  518. }));
  519. export default IntentionCustomer;