visit.jsx 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. import React from "react";
  2. import {
  3. Button,
  4. Spin,
  5. message,
  6. Table,
  7. Tooltip,
  8. Input,
  9. Modal,
  10. Alert,
  11. } from "antd";
  12. import $ from "jquery/src/ajax";
  13. import FollowDetail from "../../../../../component/manageCenter/customer/NEW/intentionCustomer/followDetail";
  14. import { getContactType } from "@/tools.js";
  15. import PublicSupplement from "../../../../../component/publicSupplement/index";
  16. import VisitDetail from "./visitDetail";
  17. const confirm = Modal.confirm;
  18. const Visit = React.createClass({
  19. getInitialState() {
  20. return {
  21. visitArrList: [],
  22. loading: false,
  23. visitModul: false,
  24. visitModuls: false,
  25. followId: 0,
  26. ispage: 1,
  27. paginations: {
  28. defaultCurrent: 1,
  29. defaultPageSize: 10,
  30. showQuickJumper: true,
  31. pageSize: 10,
  32. onChange: function (page) {
  33. this.loadVisit(page);
  34. }.bind(this),
  35. showTotal: function (total) {
  36. return "共" + total + "条数据";
  37. },
  38. },
  39. visitsList: [
  40. {
  41. title: "客户名称",
  42. dataIndex: "nickname",
  43. key: "nickname",
  44. width: 150,
  45. render: (text) => {
  46. return (
  47. <Tooltip title={text}>
  48. <div>{text}</div>
  49. </Tooltip>
  50. );
  51. },
  52. },
  53. {
  54. title: "跟进方式",
  55. dataIndex: "contactType",
  56. key: "contactType",
  57. width: 80,
  58. render: (text) => {
  59. return getContactType(text);
  60. },
  61. },
  62. {
  63. title: "联系人",
  64. dataIndex: "contacts",
  65. key: "contacts",
  66. width: 100,
  67. render: (text, record) => {
  68. return (
  69. <div>
  70. {record.readOnly ? <span>***</span> : <span>{text}</span>}
  71. </div>
  72. );
  73. },
  74. },
  75. {
  76. title: "联系电话",
  77. dataIndex: "contactMobile",
  78. key: "contactMobile",
  79. width: 100,
  80. render: (text, record) => {
  81. return (
  82. <div>
  83. {record.readOnly ? <span>***</span> : <span>{text}</span>}
  84. </div>
  85. );
  86. },
  87. },
  88. {
  89. title: "跟进人",
  90. dataIndex: "adminName",
  91. key: "adminName",
  92. width: 80,
  93. },
  94. {
  95. title: "跟进时间",
  96. dataIndex: "followTime",
  97. key: "followTime",
  98. width: 110,
  99. },
  100. {
  101. title: "公出目标",
  102. dataIndex: "result",
  103. key: "result",
  104. width: 200,
  105. },
  106. {
  107. title: "公出计划",
  108. dataIndex: "plan",
  109. key: "plan",
  110. width: 200,
  111. render: (text) => {
  112. return <div>{text}</div>;
  113. },
  114. },
  115. {
  116. title: "预计效果",
  117. dataIndex: "expectedEffect",
  118. key: "expectedEffect",
  119. width: 200,
  120. render: (text) => {
  121. return <div>{text}</div>;
  122. },
  123. },
  124. {
  125. title: "本次公出目标总结",
  126. dataIndex: "supplement",
  127. key: "supplement",
  128. width: 200,
  129. render: (text, record) => {
  130. return (
  131. <div style={{ wordBreak: "break-all" }}>
  132. {getContactType(record.contactType) === "公出打卡" && (
  133. <div
  134. style={{
  135. wordBreak: "break-all",
  136. }}
  137. >
  138. {text}
  139. <div>
  140. <PublicSupplement
  141. closeModel={this.closeModel}
  142. infor={record}
  143. onCancel={() => {
  144. this.loadVisit(this.state.ispage);
  145. }}
  146. />
  147. </div>
  148. </div>
  149. )}
  150. </div>
  151. );
  152. },
  153. },
  154. {
  155. title: "下一次公出计划",
  156. dataIndex: "nextPlan",
  157. key: "nextPlan",
  158. width: 200,
  159. render: (text) => {
  160. return <div>{text}</div>;
  161. },
  162. },
  163. {
  164. title: "指导时间",
  165. dataIndex: "guidanceTime",
  166. key: "guidanceTime",
  167. width: 105,
  168. render: (text, record) => {
  169. return <span>{text ? text : ""}</span>;
  170. },
  171. },
  172. {
  173. title: "指导意见",
  174. dataIndex: "abc",
  175. key: "abc",
  176. width: 200,
  177. render: (text, record) => {
  178. return (
  179. <div>
  180. {record.guidance ? (
  181. <Tooltip
  182. placement="topLeft"
  183. title={
  184. <div style={{ wordBreak: "break-all" }}>
  185. {(record.guidanceName
  186. ? "(" + record.guidanceName + ")"
  187. : "") + record.guidance}
  188. </div>
  189. }
  190. >
  191. <div
  192. style={{
  193. cursor: "pointer",
  194. width: "150px",
  195. whiteSpace: "nowrap",
  196. overflow: "hidden",
  197. textOverflow: "ellipsis",
  198. }}
  199. >
  200. {record.guidanceName
  201. ? "(" + record.guidanceName + ")"
  202. : null}
  203. {record.guidance}
  204. </div>
  205. </Tooltip>
  206. ) : (
  207. <span>暂未指导</span>
  208. )}
  209. </div>
  210. );
  211. },
  212. },
  213. ],
  214. guidanceVisible: false,
  215. guidance: "",
  216. };
  217. },
  218. closeModel() {
  219. this.setState({
  220. visitModul: false,
  221. });
  222. },
  223. //查看跟进记录列表
  224. loadVisit(pageNo) {
  225. this.setState({
  226. loading: true,
  227. });
  228. $.ajax({
  229. method: "get",
  230. dataType: "json",
  231. crossDomain: false,
  232. url: globalConfig.context + "/api/admin/customer/listFollowHistory",
  233. data: {
  234. pageNo: pageNo || 1,
  235. pageSize: this.state.paginations.pageSize,
  236. uid: this.props.data.id, //名称1
  237. },
  238. success: function (data) {
  239. let theArr = [];
  240. if (data.error.length || data.data.list == "") {
  241. if (data.error && data.error.length) {
  242. message.warning(data.error[0].message);
  243. }
  244. } else {
  245. for (let i = 0; i < data.data.list.length; i++) {
  246. let thisdata = data.data.list[i];
  247. theArr.push(thisdata);
  248. }
  249. this.state.paginations.current = data.data.pageNo;
  250. this.state.paginations.total = data.data.totalCount;
  251. this.setState({
  252. ispage: data.data.pageNo,
  253. });
  254. }
  255. if (data.data.list && !data.data.list.length) {
  256. this.state.paginations.current = 0;
  257. this.state.paginations.total = 0;
  258. }
  259. this.setState({
  260. visitArrList: theArr,
  261. paginations: this.state.paginations,
  262. });
  263. }.bind(this),
  264. }).always(
  265. function () {
  266. this.setState({
  267. loading: false,
  268. });
  269. }.bind(this)
  270. );
  271. },
  272. componentWillMount() {
  273. this.loadVisit();
  274. },
  275. //点击整行
  276. VisitRowClick(record) {
  277. this.setState({
  278. followData: record,
  279. visitModul: true,
  280. });
  281. },
  282. //进入新增拜访记录
  283. visit() {
  284. let obj = {
  285. id: this.props.data.id,
  286. };
  287. this.setState({
  288. followData: obj,
  289. visitModuls: true,
  290. });
  291. },
  292. componentDidMount() {
  293. this.setState({
  294. visitModul: false,
  295. });
  296. },
  297. closeDesc(e, s) {
  298. this.state.visitModul = e;
  299. this.state.visitModuls = e;
  300. if (s) {
  301. this.loadVisit();
  302. }
  303. },
  304. componentWillReceiveProps(nextProps) {
  305. if (nextProps.data.id) {
  306. this.loadVisit();
  307. }
  308. this.setState({
  309. visitModul: false,
  310. });
  311. },
  312. render() {
  313. const { addbt = true } = this.props
  314. return (
  315. <div className="clearfix">
  316. <Alert
  317. message="注:面谈公出补充,沟通完后记录今天交流的情况。计划下一次什么时候再面谈?该如何面谈?该如何跟进?"
  318. banner
  319. />
  320. {
  321. addbt &&
  322. <Button
  323. onClick={(e) => {
  324. e.stopPropagation();
  325. this.visit();
  326. }}
  327. type="primary"
  328. style={{ marginTop: "10px", float: "right" }}
  329. >
  330. 渠道跟进
  331. </Button>
  332. }
  333. <Spin spinning={this.state.loading}>
  334. <Table
  335. size="middle"
  336. style={{
  337. marginTop: "60px",
  338. cursor: "pointer",
  339. }}
  340. pagination={this.state.paginations}
  341. columns={this.state.visitsList}
  342. dataSource={this.state.visitArrList}
  343. onRowClick={this.VisitRowClick}
  344. scroll={{ x: "130%", y: 440 }}
  345. />
  346. </Spin>
  347. <FollowDetail
  348. categoryArr={this.props.categoryArr}
  349. followData={this.state.followData}
  350. visitModul={this.state.visitModuls}
  351. closeDesc={this.closeDesc}
  352. loadData={this.loadVisit}
  353. />
  354. <VisitDetail
  355. categoryArr={this.props.categoryArr}
  356. followData={this.state.followData}
  357. visitModul={this.state.visitModul}
  358. closeDesc={this.closeDesc}
  359. mid={this.props.data.id}
  360. />
  361. </div>
  362. );
  363. },
  364. });
  365. export default Visit;