businessDetail.jsx 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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. },
  55. {
  56. title: '联系电话',
  57. dataIndex: 'contactMobile',
  58. key: 'contactMobile',
  59. }, {
  60. title: '操作',
  61. dataIndex: 'ooo',
  62. key: 'ooo',
  63. render: (text, record) => { return(<Button onClick={(e)=>{this.businessFollowDetails(record)}}>查看</Button>) }
  64. }
  65. ],
  66. }
  67. },
  68. //业务跟进查看跟多
  69. businessFollowDetails(e) {
  70. this.setState({
  71. busData:e,
  72. businessFollowModul: true
  73. })
  74. },
  75. listFollowUp(e) {
  76. $.ajax({
  77. method: "get",
  78. dataType: "json",
  79. crossDomain: false,
  80. url: globalConfig.context + "/api/admin/customer/toUpdateFollowOneBusiness",
  81. data: {
  82. ufbId: e
  83. },
  84. success: function(data) {
  85. let thedata = data.data;
  86. if(!thedata) {
  87. if(data.error && data.error.length) {
  88. message.warning(data.error[0].message);
  89. };
  90. thedata = {};
  91. };
  92. this.setState({
  93. businessGlossoryIds: thedata.businessGlossoryId,
  94. followSituations: thedata.followSituation,
  95. customerStatuss: thedata.customerStatus,
  96. followTimes: thedata.followTime,
  97. createTimes: thedata.createTime,
  98. identifyNames: thedata.identifyName,
  99. contactTypes: parseInt(thedata.contactType),
  100. results: thedata.result,
  101. remarkss: thedata.remarks,
  102. adminNames: thedata.adminName,
  103. contactss: thedata.contacts,
  104. contactMobiles: thedata.contactMobile,
  105. ufbId: thedata.ufbId,
  106. followIds: thedata.followId,
  107. });
  108. }.bind(this),
  109. }).always(function() {
  110. this.setState({
  111. loading: false
  112. });
  113. }.bind(this));
  114. },
  115. //查看跟进记录列表
  116. loadVisit(pageNo) {
  117. this.setState({
  118. loading: true
  119. });
  120. $.ajax({
  121. method: "get",
  122. dataType: "json",
  123. crossDomain: false,
  124. url: globalConfig.context + '/api/admin/customer/listFollowHistory',
  125. data: {
  126. pageNo: pageNo || 1,
  127. pageSize: this.state.paginationst.pageSize,
  128. uid: this.props.ids, //名称1
  129. businessGlossoryId: this.state.businessGlossoryId,
  130. },
  131. success: function(data) {
  132. let theArr = [];
  133. if(data.error.length || data.data.list == "") {
  134. if(data.error && data.error.length) {
  135. message.warning(data.error[0].message);
  136. };
  137. } else {
  138. for(let i = 0; i < data.data.list.length; i++) {
  139. let thisdata = data.data.list[i];
  140. theArr.push({
  141. followId: thisdata.followId,
  142. followTime: thisdata.followTime,
  143. identifyName: thisdata.identifyName,
  144. contacts: thisdata.contacts,
  145. contactMobile: thisdata.contactMobile,
  146. result: thisdata.result,
  147. ufbId: thisdata.ufbId,
  148. adminName: thisdata.adminName,
  149. followSituation: thisdata.followSituation,
  150. customerStatus: thisdata.customerStatus,
  151. contactType: thisdata.contactType
  152. });
  153. };
  154. this.state.paginationst.current = data.data.pageNo;
  155. this.state.paginationst.total = data.data.totalCount;
  156. };
  157. if(data.data.list&&!data.data.list.length){
  158. this.state.paginationst.current =0;
  159. this.state.paginationst.total = 0;
  160. };
  161. this.setState({
  162. visitArrList: theArr,
  163. paginationst: this.state.paginationst
  164. });
  165. }.bind(this),
  166. }).always(function() {
  167. this.setState({
  168. loading: false
  169. });
  170. }.bind(this));
  171. },
  172. businessIntentionDetails(e) {
  173. $.ajax({
  174. method: "get",
  175. dataType: "json",
  176. crossDomain: false,
  177. url: globalConfig.context + '/api/admin/customer/toUpdateBusiness',
  178. data: {
  179. businessId: e.businessId
  180. },
  181. success: function(data) {
  182. let thisData = data.data;
  183. if(!thisData) {
  184. if(data.error && data.error.length) {
  185. message.warning(data.error[0].message);
  186. };
  187. thisData = {};
  188. };
  189. this.setState({
  190. businessGlossoryId: thisData.businessGlossoryId,
  191. identifyName: thisData.identifyName,
  192. uid: thisData.uid,
  193. businessId: thisData.businessId,
  194. followSituation: thisData.followSituation,
  195. customerStatus: thisData.customerStatus,
  196. createTime: thisData.createTime,
  197. followTime: thisData.followTime,
  198. adminName: thisData.adminName,
  199. remarks: thisData.remarks,
  200. result: thisData.result,
  201. });
  202. }.bind(this),
  203. }).always(function() {
  204. this.loadVisit();
  205. this.setState({
  206. loading: false
  207. });
  208. }.bind(this));
  209. this.setState({
  210. businessModul: true
  211. })
  212. },
  213. businessIntentionCancel(){
  214. this.setState({
  215. businessFollowModul:false,
  216. businessModul:false
  217. })
  218. },
  219. componentWillReceiveProps(nextProps) {
  220. if(nextProps.data.businessId&&nextProps.businessModul&&nextProps.ids){
  221. this.setState({
  222. businessModul:true
  223. })
  224. this.businessIntentionDetails(nextProps.data);
  225. }
  226. this.setState({
  227. businessFollowModul:false
  228. })
  229. },
  230. render(){
  231. const formItemLayout = {
  232. labelCol: { span: 8 },
  233. wrapperCol: { span: 14 },
  234. };
  235. return(
  236. <div>
  237. <Modal
  238. footer=''
  239. title="业务意向详情"
  240. width='1000px'
  241. visible={this.state.businessModul}
  242. onOk={this.businessIntentionCancel}
  243. onCancel={this.businessIntentionCancel}
  244. >
  245. <div className="clearfix">
  246. <Form layout="horizontal" id="demand-form" onSubmit={this.passworldSubmit}>
  247. <Spin spinning={this.state.loading}>
  248. <div className="clearfix">
  249. <FormItem className="half-item"
  250. {...formItemLayout}
  251. label="意向业务名称" >
  252. <span>{getCompanyIntention(this.state.businessGlossoryId)}</span>
  253. </FormItem>
  254. <FormItem className="half-item"
  255. {...formItemLayout}
  256. label="意向时间" >
  257. <span>{this.state.createTime}</span>
  258. </FormItem>
  259. <FormItem className="half-item"
  260. {...formItemLayout}
  261. label="客户名称" >
  262. <span>{this.state.identifyName}</span>
  263. </FormItem>
  264. <FormItem className="half-item"
  265. {...formItemLayout}
  266. label="营销员" >
  267. <span>{this.state.adminName}</span>
  268. </FormItem>
  269. <FormItem className="half-item"
  270. {...formItemLayout}
  271. label="意向业务进度" >
  272. <span>{getfllowSituation(this.state.followSituation)}</span>
  273. </FormItem>
  274. <FormItem className="half-item"
  275. {...formItemLayout}
  276. label="业务客户状态" >
  277. <span>{getcustomerStatue(this.state.customerStatus)}</span>
  278. </FormItem>
  279. </div>
  280. <div className="clearfix">
  281. <FormItem className="half-item"
  282. {...formItemLayout}
  283. label="业务意向说明" >
  284. <span>{this.state.remarks}</span>
  285. </FormItem>
  286. </div>
  287. <div className="clearfix">
  288. <div style={{fontSize:'18px',lineHeight:'24px',marginBottom:'10px'}}>业务跟进</div>
  289. <div className="clearfix">
  290. <Spin spinning={this.state.loading}>
  291. <Table
  292. pagination={this.state.paginationst}
  293. columns={this.state.businessFollowList}
  294. dataSource={this.state.visitArrList}
  295. />
  296. </Spin>
  297. </div>
  298. </div>
  299. </Spin>
  300. </Form>
  301. </div>
  302. </Modal>
  303. <BusinFollow
  304. data={this.state.busData}
  305. businessFollowModul={this.state.businessFollowModul}
  306. />
  307. </div>
  308. )
  309. }
  310. });
  311. export default BusinessDetail;