businessDetail.jsx 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. import React from 'react';
  2. import {Form,Button,Spin,message,Table,Popconfirm,Modal} from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import {getCompanyIntention,getfllowSituation,getcustomerStatue,getContactType } from '@/tools.js';
  6. const FormItem =Form.Item;
  7. import BusinFollow from './businFollow.jsx'
  8. const BusinessDetail =React.createClass({
  9. getInitialState(){
  10. return {
  11. loading:false,
  12. visitArrList: [],
  13. busData:{},
  14. paginationst: {
  15. defaultCurrent: 1,
  16. defaultPageSize: 10,
  17. showQuickJumper: true,
  18. pageSize: 10,
  19. onChange: function(page) {
  20. this.loadVisit(page);
  21. }.bind(this),
  22. showTotal: function(total) {
  23. return '共' + total + '条数据';
  24. }
  25. },
  26. businessFollowList: [{
  27. title: '跟进时间',
  28. dataIndex: 'followTime',
  29. key: 'followTime',
  30. }, {
  31. title: '营销员',
  32. dataIndex: 'adminName',
  33. key: 'adminName',
  34. }, {
  35. title: '业务意向进度',
  36. dataIndex: 'followSituation',
  37. key: 'followSituation',
  38. render: text => { return getfllowSituation(text) }
  39. }, {
  40. title: '客户状态',
  41. dataIndex: 'customerStatus',
  42. key: 'customerStatus',
  43. render: text => { return getcustomerStatue(text) }
  44. },
  45. {
  46. title: '拜访方式',
  47. dataIndex: 'contactType',
  48. key: 'contactType',
  49. render: text => { return getContactType(text) }
  50. }, {
  51. title: '联系人',
  52. dataIndex: 'contacts',
  53. key: 'contacts',
  54. render:(text,record)=>{
  55. return <div>
  56. {
  57. !record.readOnly?
  58. <span>{text}</span>:
  59. <span>***</span>
  60. }
  61. </div>
  62. }
  63. },
  64. {
  65. title: '联系电话',
  66. dataIndex: 'contactMobile',
  67. key: 'contactMobile',
  68. render:(text,record)=>{
  69. return <div>
  70. {
  71. !record.readOnly?
  72. <span>{text}</span>:
  73. <span>***</span>
  74. }
  75. </div>
  76. }
  77. }, {
  78. title: '操作',
  79. dataIndex: 'ooo',
  80. key: 'ooo',
  81. render: (text, record) => { return(<Button onClick={(e)=>{this.businessFollowDetails(record)}}>查看历史</Button>) }
  82. }
  83. ],
  84. }
  85. },
  86. //业务跟进查看跟多
  87. businessFollowDetails(e) {
  88. this.setState({
  89. busData:e,
  90. businessFollowModul: true
  91. })
  92. },
  93. listFollowUp(e) {
  94. $.ajax({
  95. method: "get",
  96. dataType: "json",
  97. crossDomain: false,
  98. url: globalConfig.context + "/api/admin/customer/toUpdateFollowOneBusiness",
  99. data: {
  100. ufbId: e
  101. },
  102. success: function(data) {
  103. let thedata = data.data;
  104. if(!thedata) {
  105. if(data.error && data.error.length) {
  106. message.warning(data.error[0].message);
  107. };
  108. thedata = {};
  109. };
  110. this.setState({
  111. businessProjectName: thedata.businessProjectName,
  112. followSituations: thedata.followSituation,
  113. customerStatuss: thedata.customerStatus,
  114. followTimes: thedata.followTime,
  115. createTimes: thedata.createTime,
  116. identifyNames: thedata.identifyName,
  117. contactTypes: parseInt(thedata.contactType),
  118. results: thedata.result,
  119. remarkss: thedata.remarks,
  120. adminNames: thedata.adminName,
  121. contactss: thedata.contacts,
  122. contactMobiles: thedata.contactMobile,
  123. ufbId: thedata.ufbId,
  124. followIds: thedata.followId,
  125. });
  126. }.bind(this),
  127. }).always(function() {
  128. this.setState({
  129. loading: false
  130. });
  131. }.bind(this));
  132. },
  133. //查看跟进记录列表
  134. loadVisit(pageNo) {
  135. this.setState({
  136. loading: true
  137. });
  138. $.ajax({
  139. method: "get",
  140. dataType: "json",
  141. crossDomain: false,
  142. url: globalConfig.context + '/api/admin/customer/listFollowHistory',
  143. data: {
  144. pageNo: pageNo || 1,
  145. pageSize: this.state.paginationst.pageSize,
  146. uid: this.props.ids, //名称1
  147. businessProjectId:this.props.data.businessProjectId
  148. },
  149. success: function(data) {
  150. let theArr = [];
  151. if(data.error.length || data.data.list == "") {
  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.list.length; i++) {
  157. let thisdata = data.data.list[i];
  158. theArr.push({
  159. key:i,
  160. readOnly:thisdata.readOnly,
  161. followId: thisdata.followId,
  162. followTime: thisdata.followTime,
  163. identifyName: thisdata.identifyName,
  164. contacts: thisdata.contacts,
  165. contactMobile: thisdata.contactMobile,
  166. result: thisdata.result,
  167. ufbId: thisdata.ufbId,
  168. adminName: thisdata.adminName,
  169. followSituation: thisdata.followSituation,
  170. customerStatus: thisdata.customerStatus,
  171. contactType: thisdata.contactType
  172. });
  173. };
  174. this.state.paginationst.current = data.data.pageNo;
  175. this.state.paginationst.total = data.data.totalCount;
  176. };
  177. if(data.data.list&&!data.data.list.length){
  178. this.state.paginationst.current = 0;
  179. this.state.paginationst.total = 0;
  180. };
  181. this.setState({
  182. visitArrList: theArr,
  183. paginationst: this.state.paginationst
  184. });
  185. }.bind(this),
  186. }).always(function() {
  187. this.setState({
  188. loading: false
  189. });
  190. }.bind(this));
  191. },
  192. businessIntentionDetails(e) {
  193. $.ajax({
  194. method: "get",
  195. dataType: "json",
  196. crossDomain: false,
  197. url: globalConfig.context + '/api/admin/customer/toUpdateBusiness',
  198. data: {
  199. businessId: e.businessId,
  200. },
  201. success: function(data) {
  202. let thisData = data.data;
  203. if(!thisData) {
  204. if(data.error && data.error.length) {
  205. message.warning(data.error[0].message);
  206. };
  207. thisData = {};
  208. };
  209. this.setState({
  210. businessProjectName: thisData.businessProjectName,
  211. identifyName: thisData.identifyName,
  212. uid: thisData.uid,
  213. businessId: thisData.businessId,
  214. followSituation: thisData.followSituation,
  215. customerStatus: thisData.customerStatus,
  216. createTime: thisData.createTime,
  217. followTime: thisData.followTime,
  218. adminName: thisData.adminName,
  219. remarks: thisData.remarks,
  220. result: thisData.result,
  221. });
  222. }.bind(this),
  223. }).always(function() {
  224. this.loadVisit();
  225. this.setState({
  226. loading: false
  227. });
  228. }.bind(this));
  229. this.setState({
  230. businessModul: true
  231. })
  232. },
  233. businessIntentionCancel(){
  234. this.setState({
  235. businessFollowModul:false,
  236. businessModul:false
  237. })
  238. },
  239. closeBusiness(s){
  240. this.state.businessFollowModul=s
  241. },
  242. componentWillReceiveProps(nextProps) {
  243. if(nextProps.data.businessId&&nextProps.businessModul&&nextProps.ids){
  244. this.setState({
  245. businessModul:true
  246. })
  247. this.businessIntentionDetails(nextProps.data);
  248. }
  249. this.setState({
  250. businessFollowModul:false
  251. })
  252. },
  253. render(){
  254. const formItemLayout = {
  255. labelCol: { span: 8 },
  256. wrapperCol: { span: 14 },
  257. };
  258. return(
  259. <div>
  260. <Modal
  261. footer=''
  262. title="业务意向详情"
  263. width='1200px'
  264. visible={this.state.businessModul}
  265. onOk={this.businessIntentionCancel}
  266. onCancel={this.businessIntentionCancel}
  267. >
  268. <div className="clearfix">
  269. <Form layout="horizontal" id="demand-form" onSubmit={this.passworldSubmit}>
  270. <Spin spinning={this.state.loading}>
  271. <div className="clearfix">
  272. <FormItem className="half-item"
  273. {...formItemLayout}
  274. label="意向业务名称" >
  275. <span>{this.state.businessProjectName}</span>
  276. </FormItem>
  277. <FormItem className="half-item"
  278. {...formItemLayout}
  279. label="意向时间" >
  280. <span>{this.state.createTime}</span>
  281. </FormItem>
  282. <FormItem className="half-item"
  283. {...formItemLayout}
  284. label="客户名称" >
  285. <span>{this.state.identifyName}</span>
  286. </FormItem>
  287. <FormItem className="half-item"
  288. {...formItemLayout}
  289. label="营销员" >
  290. <span>{this.state.adminName}</span>
  291. </FormItem>
  292. <FormItem className="half-item"
  293. {...formItemLayout}
  294. label="意向业务进度" >
  295. <span>{getfllowSituation(this.state.followSituation)}</span>
  296. </FormItem>
  297. <FormItem className="half-item"
  298. {...formItemLayout}
  299. label="业务客户状态" >
  300. <span>{getcustomerStatue(this.state.customerStatus)}</span>
  301. </FormItem>
  302. </div>
  303. <div className="clearfix">
  304. <FormItem className="half-item"
  305. {...formItemLayout}
  306. label="业务意向说明" >
  307. <span>{this.state.remarks}</span>
  308. </FormItem>
  309. </div>
  310. <div className="clearfix">
  311. <div style={{fontSize:'18px',lineHeight:'24px',marginBottom:'10px'}}>业务跟进</div>
  312. <div className="clearfix">
  313. <Spin spinning={this.state.loading}>
  314. <Table
  315. pagination={this.state.paginationst}
  316. columns={this.state.businessFollowList}
  317. dataSource={this.state.visitArrList}
  318. />
  319. </Spin>
  320. </div>
  321. </div>
  322. </Spin>
  323. </Form>
  324. </div>
  325. </Modal>
  326. <BusinFollow
  327. data={this.state.busData}
  328. businessFollowModul={this.state.businessFollowModul}
  329. closeBusiness = {this.closeBusiness}
  330. />
  331. </div>
  332. )
  333. }
  334. });
  335. export default BusinessDetail;