contactsList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <div class="container-contactsList">
  3. <div class="top-wrap">
  4. <el-input style="width: 200px; margin-right: 20px" v-model="contactWay" placeholder="手机号/邮箱/姓名/公司名" prefix-icon="el-icon-search" clearable></el-input>
  5. <el-select v-model="decisionValue" placeholder="是否KP" @change="handelGetData" clearable>
  6. <el-option v-for="item in decisionOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
  7. </el-select>
  8. <el-select v-model="registerValue" placeholder="是否注册" @change="handelGetData" clearable>
  9. <el-option v-for="item in registerOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
  10. </el-select>
  11. <el-select v-model="isFollowValue" placeholder="是否关注公众号" @change="handelGetData" clearable>
  12. <el-option v-for="item in decisionOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
  13. </el-select>
  14. <el-cascader
  15. v-model="sales"
  16. placeholder="请选择销售"
  17. style="width: 200px; margin: 0 20px 20px 0"
  18. :options="salesArr"
  19. :props="defaultSalesProps"
  20. :show-all-levels="false"
  21. collapse-tags
  22. clearable
  23. filterable
  24. @change="handelGetData"
  25. >
  26. </el-cascader>
  27. <el-cascader
  28. style="width: 200px; margin-right: 20px"
  29. v-model="clientStatus"
  30. :options="clientOptions"
  31. placeholder="请选择客户状态"
  32. clearable
  33. :props="{ value: 'TryStage', label: 'Name', children: 'List', checkStrictly: true }"
  34. @change="handelGetData"
  35. ></el-cascader>
  36. <el-autocomplete
  37. style="width: 200px; margin-bottom: 20px"
  38. prefix-icon="el-icon-search"
  39. clearable
  40. class="inline-input"
  41. v-model="userLabel"
  42. :fetch-suggestions="querySearchHandler"
  43. placeholder="用户标签搜索"
  44. @clear="handelGetData"
  45. :trigger-on-focus="false"
  46. @select="handelGetData"
  47. >
  48. <template slot-scope="scope">
  49. <div v-if="scope.item.IndustryName">
  50. {{ scope.item.IndustryName }}
  51. </div>
  52. <div v-else style="text-align: center">暂无数据</div>
  53. </template>
  54. </el-autocomplete>
  55. </div>
  56. <el-card>
  57. <el-table :data="tableData" style="width: 100%" border @sort-change="sortChangeHandle">
  58. <el-table-column align="center" prop="RealName" width="90" label="姓名"> </el-table-column>
  59. <el-table-column align="center" prop="Mobile" width="110" label="手机号/邮箱">
  60. <template slot-scope="{ row }"> {{ row.Mobile || row.Email }} </template>
  61. </el-table-column>
  62. <el-table-column align="center" prop="CompanyName" label="公司名称">
  63. <template slot-scope="{row}">
  64. <el-tooltip effect="dark" placement="top-start" content="过去4周,kp均未覆盖服务" v-if="row.IsUserMaker==0">
  65. <span class="deletesty" @click="goDetail(row)">{{ row.CompanyName }}</span>
  66. </el-tooltip>
  67. <span v-else class="editsty" @click="goDetail(row)">{{ row.CompanyName }}</span>
  68. <!-- <span class="editsty" @click="goDetail(scope.row)">{{ scope.row.CompanyName }}</span> -->
  69. </template>
  70. </el-table-column>
  71. <el-table-column align="center" prop="Status" width="110" label="状态"> </el-table-column>
  72. <el-table-column align="center" prop="SellerName" width="110" label="所属销售"> </el-table-column>
  73. <el-table-column align="center" prop="IsMaker" width="80" label="是否KP">
  74. <template slot-scope="{ row }">
  75. {{ row.IsMaker == 1 ? "是" : "否" }}
  76. </template>
  77. </el-table-column>
  78. <el-table-column align="center" prop="RegisterTime" width="110" label="注册时间"> </el-table-column>
  79. <el-table-column align="center" width="120" label="是否关注公众号">
  80. <template slot-scope="{ row }">
  81. {{ row.IsSubscribeCygx == 1 ? "是" : "否" }}
  82. </template>
  83. </el-table-column>
  84. <el-table-column align="center" prop="InteractionNum" width="110" label="互动量" :render-header="renderHeader" sortable="custom">
  85. <template slot-scope="{ row }">
  86. <span class="editsty" @click="lookInteraction(row, '个人')">{{ row.InteractionNum }}</span> /
  87. <el-popover trigger="hover" placement="right" @show="isShowOrganization(row)">
  88. <table class="table-wrap-table-popover">
  89. <tr v-for="(item, index) in organizationTableL" :key="index">
  90. <td class="table-item">{{ item.DateTime }}</td>
  91. <td class="table-item">{{ item.InteractionNum }}</td>
  92. </tr>
  93. </table>
  94. <span slot="reference" class="editsty" @click="lookInteraction(row, '机构')">{{ row.CompanyInteractionNum }}</span>
  95. </el-popover>
  96. </template>
  97. </el-table-column>
  98. <el-table-column prop="" width="350">
  99. <div slot="header" slot-scope="{}" style="text-align: center">标签</div>
  100. <template slot-scope="{ row }">
  101. <div class="popover-item">
  102. <el-tag size="mini" style="margin: 5px 8px; cursor: pointer" v-for="item in lookLabelListNumber(row)" :key="item" :type="userLabel == item && 'danger'" @click="labelChildren(item, row)">
  103. {{ item }}
  104. </el-tag>
  105. <span @click="showLabelDlg(row)" style="font-weight: 700; padding: 5px 10px" class="editsty" v-if="row.Labels && row.Labels.split(',').length > 10">...</span>
  106. </div>
  107. </template>
  108. </el-table-column>
  109. <el-table-column align="center" prop="" label="备注" width="90">
  110. <template slot-scope="{ row }">
  111. <div class="remark-list">
  112. <div class="button">
  113. <span class="editsty" @click="lookOver(row, '添加')">添加</span>
  114. <span v-if="row.Content" style="font-weight: 700; padding: 5px 10px" class="editsty" @click="lookOver(row, '历史')">...</span>
  115. </div>
  116. </div>
  117. </template>
  118. </el-table-column>
  119. <el-table-column align="center" prop="" label="操作" width="160">
  120. <template slot-scope="{ row }">
  121. <span :class="row.IsRemind ? 'deletesty' : 'editsty'" @click="remindHandler(row)">{{ row.IsRemind ? "取消提醒" : "互动提醒" }}</span>
  122. &nbsp;&nbsp;&nbsp;&nbsp;
  123. <span class="editsty" @click="feedbackHandler(row)">交流反馈</span>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. <!-- 分页 -->
  128. <el-col :span="24" class="toolbar">
  129. <m-page :total="total" :page_no="page_no" :pageSize="10" @handleCurrentChange="handleCurrentChange" />
  130. </el-col>
  131. </el-card>
  132. <el-dialog v-dialogDrag :visible.sync="remarkDlgShow" :close-on-click-modal="false" :modal-append-to-body="false" @close="cancelHandle" center :width="addRemarFrom.IsShowSee ? '800px' : '500px'">
  133. <div slot="title">
  134. <i class="el-icon-close" style="fontsize: 24px; cursor: pointer; position: absolute; right: 20px; top: 50%; transform: translateY(-50%)" @click="cancelHandle"></i>
  135. <span style="fontsize: 16px">{{ addRemarFrom.IsShowSee ? "历史备注" : "添加备注" }}</span>
  136. </div>
  137. <div v-if="addRemarFrom.IsShowSee">
  138. <el-table :data="lableRemarkList" style="width: 100%" border height="350">
  139. <el-table-column align="center" prop="Content" label="备注信息"> </el-table-column>
  140. <el-table-column align="center" prop="CreateTime" label="备注时间"> </el-table-column>
  141. </el-table>
  142. </div>
  143. <div v-else>
  144. <el-input type="textarea" :rows="4" placeholder="请输入备注信息" v-model.trim="addRemarText"> </el-input>
  145. </div>
  146. <div style="display: flex; justify-content: center; margin: 40px 0">
  147. <template v-if="!addRemarFrom.IsShowSee">
  148. <el-button type="primary" @click="saveHandle">确定</el-button>
  149. <el-button type="primary" plain @click="cancelHandle">取消</el-button>
  150. </template>
  151. </div>
  152. </el-dialog>
  153. <InteractionDlg :interactionDlg.sync="interactionDlg" :interactionFrom="interactionFrom" />
  154. <label-dlg :isShowLabelDlg.sync="isShowLabelDlg" :dlgLabelList.sync="dlgLabelList" @labelChildren="labelChildren" :userLabel="userLabel" />
  155. <remind-dlg :isShowRemindDlg.sync="isShowRemindDlg" :remindList.sync="remindList" />
  156. <FeedbackDlg :showFeedbackDlg.sync="showFeedbackDlg" :remindList.sync="remindList" />
  157. </div>
  158. </template>
  159. <script>
  160. import { customInterence, equityContacts } from "@/api/api.js";
  161. import mPage from "@/components/mPage.vue";
  162. import mDialog from "@/components/mDialog.vue";
  163. import InteractionDlg from "./compontents/interactionDlg.vue";
  164. import LabelDlg from "./compontents/labelDlg.vue";
  165. import RemindDlg from "./compontents/remindDlg.vue";
  166. import FeedbackDlg from "./compontents/feedbackDlg.vue";
  167. export default {
  168. name: "",
  169. components: { mPage, mDialog, InteractionDlg, LabelDlg, RemindDlg, FeedbackDlg },
  170. props: {},
  171. data() {
  172. return {
  173. contactWay: "", //手机号/邮箱/姓名/公司名
  174. decisionValue: "",
  175. isFollowValue: "", //是否关注公众号
  176. decisionOptions: [
  177. {
  178. label: "是",
  179. value: 1,
  180. },
  181. {
  182. label: "否",
  183. value: 0,
  184. },
  185. ],
  186. registerValue: 1,
  187. registerOptions: [
  188. {
  189. label: "已注册",
  190. value: 1,
  191. },
  192. {
  193. label: "未注册",
  194. value: 0,
  195. },
  196. ],
  197. sales: [],
  198. salesArr: [], //销售
  199. defaultSalesProps: {
  200. multiple: true,
  201. label: "RealName",
  202. children: "ChildrenList",
  203. value: "AdminId",
  204. }, //销售级联配置
  205. clientStatus: "",
  206. clientOptions: ["试用", "冻结", "正式"],
  207. tableData: [],
  208. total: 0, //条数
  209. pageSize: 10, //每页显示几条
  210. page_no: sessionStorage.getItem("contactsListBack") ? JSON.parse(sessionStorage.getItem("contactsListBack")).page_no : 1,
  211. remarkDlgShow: false, // 查看
  212. addRemarFrom: {}, //、添加备注
  213. addRemarText: "",
  214. lableRemarkList: [],
  215. lookLabelList: "啤酒,冷冻烘焙,立高食品,鸿合科技,智能交互平板,速冻火锅料及预制菜,安井食品,千味央厨,速冻米面,视源股份,xx",
  216. userLabel: "",
  217. interactionDlg: false, //互助的弹框
  218. interactionFrom: {}, //互助的数据
  219. orderTable: "",
  220. organizationTableL: [], //互助量机构的
  221. isShowLabelDlg: false, //
  222. dlgLabelList: {}, //
  223. isShowRemindDlg: false, // 消息提醒的弹框
  224. remindList: {}, // 消息提醒的数据
  225. showFeedbackDlg: false, // 交流反馈的弹框
  226. };
  227. },
  228. computed: {},
  229. watch: {
  230. contactWay: {
  231. handler(newval) {
  232. this.clientStatus = "";
  233. this.decisionValue = "";
  234. this.registerValue = "";
  235. this.selesArr = [];
  236. this.page_no = 1;
  237. this.getCygxContactsList();
  238. },
  239. },
  240. },
  241. created() {},
  242. mounted() {
  243. if (sessionStorage.getItem("contactsListBack")) {
  244. const { keyword, decisionValue, registerValue, sales, clientStatus, userLabel, isFollowValue } = JSON.parse(sessionStorage.getItem("contactsListBack"));
  245. this.contactWay = keyword;
  246. this.decisionValue = decisionValue;
  247. this.registerValue = registerValue;
  248. this.sales = sales;
  249. this.clientStatus = clientStatus;
  250. this.userLabel = userLabel;
  251. this.isFollowValue = isFollowValue;
  252. }
  253. this.getUserStatusTable();
  254. this.getCygxContactsList();
  255. this.getSale();
  256. },
  257. methods: {
  258. async getUserStatusTable() {
  259. const res = await equityContacts.getUserStatusTable();
  260. if (res.Ret == 200) {
  261. this.clientOptions = res.Data.List || [];
  262. }
  263. },
  264. /* 获取销售 */
  265. getSale() {
  266. customInterence.getSalesRaiData().then((res) => {
  267. if (res.Ret === 200) {
  268. this.salesArr = res.Data.List;
  269. }
  270. });
  271. },
  272. /* 获取列表 */
  273. async getCygxContactsList() {
  274. let salesArr = [];
  275. if (this.sales.length) {
  276. salesArr = this.sales.map((item) => {
  277. return item[item.length - 1];
  278. });
  279. }
  280. const res = await equityContacts.getCygxContactsList({
  281. PageSize: this.pageSize,
  282. CurrentIndex: this.page_no,
  283. Status: this.clientStatus[0] ? this.clientStatus[0] : "",
  284. TryStage: this.clientStatus[1] ? this.clientStatus[1] : "",
  285. IsMaker: this.decisionValue === 1 ? this.decisionValue : this.decisionValue === 0 ? this.decisionValue : 2,
  286. IsRegister: this.registerValue === 1 ? this.registerValue : this.registerValue === 0 ? this.registerValue : 2,
  287. AdminId: salesArr.join(","),
  288. KeyWord: this.contactWay,
  289. Label: this.userLabel,
  290. SortType: this.orderTable,
  291. IsSubscribeCygx: this.isFollowValue,
  292. });
  293. if (res.Ret === 200) {
  294. this.tableData = res.Data.List || [];
  295. this.total = res.Data.Paging.Totals;
  296. }
  297. },
  298. //table表头自定义
  299. renderHeader(h, { column, $index }) {
  300. return h("div", { attrs: { style: "display:inline-block;" } }, [
  301. h("span", column.label),
  302. h("el-tooltip", { props: { placement: "top" } }, [
  303. h("p", { slot: "content", attrs: { style: "display:block;width:280px;text-align: center" } }, "个人互动量 / 机构总互动量"),
  304. h("p", { slot: "content", attrs: { style: "display:block;width:280px;" } }, "点击右侧排序按钮可按照个人互动量升序/降序排列"),
  305. h("el-button", { props: { icon: "el-icon-info" }, attrs: { style: "border:none;background:none;width:20px;padding:0 0 0 5px;" } }, ""),
  306. ]),
  307. ]);
  308. },
  309. /* 页码改变事件 */
  310. handleCurrentChange(page) {
  311. this.page_no = page;
  312. this.getCygxContactsList();
  313. },
  314. /* 详情页 */
  315. goDetail(item) {
  316. this.$router.push({
  317. path: "/customDetail",
  318. query: {
  319. id: item.CompanyId,
  320. },
  321. });
  322. },
  323. /* 点击了添加备注 和查看 */
  324. async lookOver(item, type) {
  325. this.addRemarFrom = _.cloneDeep(item);
  326. this.addRemarFrom.IsShowSee = type === "历史";
  327. this.remarkDlgShow = true;
  328. if (this.addRemarFrom.IsShowSee) {
  329. const res = await equityContacts.getCygxRemarkList({ UserId: this.addRemarFrom.UserId });
  330. if (res.Ret === 200) {
  331. this.$nextTick(() => {
  332. this.lableRemarkList = res.Data.List || [];
  333. });
  334. }
  335. }
  336. },
  337. /* 弹框的关闭 */
  338. cancelHandle() {
  339. this.remarkDlgShow = false;
  340. this.addRemarText = "";
  341. this.addRemarFrom = {};
  342. },
  343. /* 弹框的确认 */
  344. async saveHandle() {
  345. if (this.addRemarFrom.IsShowSee) {
  346. this.addRemarFrom.IsShowSee = false;
  347. } else {
  348. if (this.addRemarText == "") return this.$message.error("请输入备注信息");
  349. const res = await equityContacts.getCygxAddRemarks({
  350. Content: this.addRemarText,
  351. UserId: this.addRemarFrom.UserId,
  352. });
  353. if (res.Ret === 200) {
  354. this.$message.success("添加成功");
  355. this.getCygxContactsList();
  356. this.remarkDlgShow = false;
  357. this.addRemarText = "";
  358. this.addRemarFrom = {};
  359. }
  360. }
  361. },
  362. /* 筛选的change 事件 */
  363. handelGetData() {
  364. this.page_no = 1;
  365. this.getCygxContactsList();
  366. },
  367. /* 互助量点击 */
  368. lookInteraction(item, type) {
  369. const { href } = this.$router.resolve({
  370. path: type === "个人" ? "/mutualList" : "/organizationList",
  371. query: {
  372. id: item.UserId,
  373. CompanyId: item.CompanyId,
  374. },
  375. });
  376. window.open(href, "_blank");
  377. },
  378. /* 标签下的单独的某一个 */
  379. labelChildren(key, row) {
  380. this.interactionDlg = true;
  381. this.interactionFrom = {
  382. id: row.UserId,
  383. key,
  384. };
  385. },
  386. //鼠标经过了 机构互助量
  387. async isShowOrganization(row) {
  388. const res = await equityContacts.getInteractionNum({
  389. UserId: row.UserId,
  390. });
  391. if (res.Ret === 200) {
  392. this.organizationTableL = res.Data.List || [];
  393. }
  394. },
  395. // 查看标签
  396. async lookLabels(item) {
  397. this.lookLabelList = [];
  398. const res = await equityContacts.getCygxLabelDetail({
  399. UserId: item.UserId,
  400. });
  401. if (res.Ret === 200) {
  402. this.lookLabelList = res.Data.Label && res.Data.Label.split(",");
  403. }
  404. },
  405. async querySearchHandler(query, cb) {
  406. cb([]);
  407. if (!query) return;
  408. const res = await equityContacts.industrialManagementSearch({ KeyWord: query });
  409. if (res.Ret === 200) {
  410. if (res.Data && res.Data.List.length > 0) {
  411. let arr = res.Data.List.map((item) => {
  412. return { value: item.IndustryName, ...item };
  413. });
  414. cb(arr);
  415. } else {
  416. cb([{}]);
  417. }
  418. }
  419. },
  420. //点击操作的互助提醒
  421. async remindHandler(item) {
  422. this.remindList = item;
  423. this.isShowRemindDlg = true;
  424. },
  425. sortChangeHandle(item) {
  426. console.log(item.order);
  427. this.orderTable = item.order === "ascending" ? "asc" : item.order === "descending" ? "desc" : "";
  428. this.getCygxContactsList();
  429. },
  430. // 处理标签不能超过10个
  431. lookLabelListNumber(row) {
  432. let arr = row.Labels ? row.Labels.split(",").splice(0, 10) : [];
  433. return arr;
  434. },
  435. // 展示弹框
  436. showLabelDlg(row) {
  437. this.dlgLabelList = row;
  438. this.isShowLabelDlg = true;
  439. },
  440. // 点击了交流反馈
  441. feedbackHandler(item) {
  442. this.remindList = item;
  443. this.showFeedbackDlg = true;
  444. },
  445. },
  446. /* 页面跳转前记录参数 */
  447. beforeRouteLeave(to, from, next) {
  448. let backData = {
  449. page_no: this.page_no,
  450. keyword: this.contactWay,
  451. decisionValue: this.decisionValue,
  452. registerValue: this.registerValue,
  453. sales: this.sales,
  454. clientStatus: this.clientStatus,
  455. userLabel: this.userLabel,
  456. isFollowValue: this.isFollowValue,
  457. };
  458. sessionStorage.setItem("contactsListBack", JSON.stringify(backData));
  459. next();
  460. },
  461. /* 页面进入前是否清除参数 */
  462. beforeRouteEnter(to, from, next) {
  463. if (from.path !== "/mutualList" && from.path !== "/customDetail") {
  464. sessionStorage.removeItem("contactsListBack");
  465. }
  466. next();
  467. },
  468. };
  469. </script>
  470. <style scoped lang="scss">
  471. .container-contactsList {
  472. .el-select {
  473. width: 200px;
  474. margin-right: 20px;
  475. margin-bottom: 20px;
  476. }
  477. .top-wrap {
  478. margin-bottom: 28px;
  479. padding: 20px 30px 0;
  480. background: #fff;
  481. border: 1px solid #ececec;
  482. border-radius: 4px;
  483. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  484. }
  485. .table-item {
  486. display: inline-block;
  487. width: 90px;
  488. height: 22px;
  489. background: #e8f3ff;
  490. border-radius: 4px;
  491. color: #2d8cf0;
  492. text-align: center;
  493. line-height: 22px;
  494. margin-bottom: 5px;
  495. margin-left: 5px;
  496. &:last-child {
  497. margin-bottom: 0px;
  498. }
  499. }
  500. .remark-list {
  501. .button {
  502. display: flex;
  503. flex-direction: row-reverse;
  504. justify-content: space-between;
  505. align-content: center;
  506. flex-shrink: 0;
  507. }
  508. }
  509. }
  510. .table-wrap-table-popover {
  511. color: #666;
  512. width: 100%;
  513. border-top: 1px solid #dcdfe6;
  514. border-left: 1px solid #dcdfe6;
  515. .table-item {
  516. padding: 5px 10px;
  517. border-right: 1px solid #dcdfe6;
  518. border-bottom: 1px solid #dcdfe6;
  519. }
  520. }
  521. .popover-item {
  522. overflow: hidden;
  523. overflow-y: auto;
  524. }
  525. .popover-not-have {
  526. width: 100%;
  527. text-align: center;
  528. }
  529. </style>