clueDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <view class="clueDetail_wrap">
  3. <view class="telPhone">
  4. <view class="left">
  5. <view class="phone">电话:
  6. <show-real-text :real="clueDetail.telephone" :type='params.type'
  7. v-if="clueDetail.telephone"></show-real-text>
  8. <template v-if="clueDetail.telAddr">
  9. ({{clueDetail.telAddr}})
  10. </template>
  11. </view>
  12. <view class="copy_btn" v-if="params.type != '1'" @click="handleCopy(clueDetail)">复制</view>
  13. </view>
  14. <view class="right">
  15. 运营人 : {{ clueDetail.clueOperationName }}
  16. </view>
  17. </view>
  18. <view class="clueDetail_top_info">
  19. <view class="top_info_item">
  20. <view class="top">
  21. {{defaultText(clueDetail.clueOwnerName)}}
  22. </view>
  23. <view class="bottom">
  24. 线索所属人
  25. </view>
  26. </view>
  27. <view class="top_info_item">
  28. <view class="top">
  29. {{defaultText(clueDetail.appName)}}
  30. </view>
  31. <view class="bottom">
  32. 流量来源
  33. </view>
  34. </view>
  35. <view class="top_info_item">
  36. <view class="top">
  37. {{defaultText(clueDetail.clueType)}}
  38. </view>
  39. <view class="bottom">
  40. 线索类型
  41. </view>
  42. </view>
  43. <view class="top_info_item">
  44. <view class="top">
  45. {{defaultText(clueDetail.createTime)}}
  46. </view>
  47. <view class="bottom">
  48. 线索创建时间
  49. </view>
  50. </view>
  51. <view class="top_info_item">
  52. <view class="top">
  53. {{defaultText(clueDetail.clueDataSource)}}
  54. </view>
  55. <view class="bottom">
  56. 线索渠道
  57. </view>
  58. </view>
  59. <view class="top_info_item">
  60. <view class="top">
  61. {{crmFollowStatusFormat(clueDetail.handleState)}}
  62. </view>
  63. <view class="bottom">
  64. 跟进状态
  65. </view>
  66. </view>
  67. </view>
  68. <view class="clue_state_wrap">
  69. <view class="clue_state_top_wrap">
  70. <view class="top_left">线索阶段</view>
  71. <view class="top_right" @click="handleIsInvalid">
  72. <template v-if="clueDetail.clueState === '6'">已标记无效</template>
  73. <template v-else>标记无效</template>
  74. </view>
  75. </view>
  76. <view class="steps_wrap">
  77. <u-steps :current="currentSteps" dot>
  78. <u-steps-item :title="item.dictLabel" @click.native="handleClickStepsItem(item)"
  79. v-for="(item,index) in crmCluePhaseDict" :key="index"></u-steps-item>
  80. </u-steps>
  81. </view>
  82. </view>
  83. <view class="clue_tag_wrap">
  84. <view class="clue_tag_add_btn" @click="handleAddClueTag">
  85. + 添加标签
  86. </view>
  87. <u-tag :text="tag.name" plain plainFill :closable="true" @close="hanldeTagClose(tag)" borderColor="#fff"
  88. v-for="(tag) in clueDetail.clueTags" :key="tag.id" style="margin-left: 10px;margin-bottom: 10px;"
  89. :bgColor="tag.color" color="#fff"></u-tag>
  90. </view>
  91. <yui-tabs :tabs="tabs" v-model="activeIndex" :lineWidth="'120rpx'" :isLazyRender="false"
  92. color="#108cff" titleActiveColor="#108cff" :swipeable="true" :swiper="false" :ellipsis="false" :scroll-threshold="3">
  93. <template #clueInfo>
  94. <clueInfo :clueId="clueDetail.id" v-if="clueDetail.id" :params="params" ref="clueInfoRef" type="1"></clueInfo>
  95. </template>
  96. <template #advertising>
  97. <advertising :clueId="clueDetail.id" v-if="clueDetail.id" ref="advertisingRef"></advertising>
  98. </template>
  99. <template #followRecord>
  100. <followRecord :clueId="clueDetail.id" v-if="clueDetail.id" ref="followRecordRef" type="1"></followRecord>
  101. </template>
  102. <template #callRecord>
  103. <callRecord :clueId="clueDetail.id" :clueDetail="clueDetail" v-if="clueDetail.id" ref="callRecordRef">
  104. </callRecord>
  105. </template>
  106. <template #orderFollow>
  107. <followRecord :clueId="clueDetail.id" v-if="clueDetail.id" ref="followRecordRef" type="3"></followRecord>
  108. </template>
  109. </yui-tabs>
  110. <u-tabbar class="clueDetail_tabber" :fixed="true" inactiveColor="#ffffff" :placeholder="true"
  111. :safeAreaInsetBottom="true">
  112. <u-tabbar-item text="拨打电话" icon="../../static/clueDetail/icon-phone.png"
  113. @click="handleCallPhone"></u-tabbar-item>
  114. <!-- <u-tabbar-item text="转移线索" icon="../../static/clueDetail/icon-clue.png"
  115. @click="handleDistribution"></u-tabbar-item> -->
  116. <u-tabbar-item text="发单" icon="../../static/clueDetail/icon-order.png"
  117. @click="handleClueSend"></u-tabbar-item>
  118. <u-tabbar-item text="写新跟进" icon="../../static/caseDetail/icon-follow.png"
  119. @click="handleAddFollow"></u-tabbar-item>
  120. <u-tabbar-item text="上传录音" icon="../../static/caseDetail/icon-record.png"
  121. @click="handleUploadRecord"></u-tabbar-item>
  122. </u-tabbar>
  123. <distribution-modal :clueDetail="clueDetail" ref="distribution"
  124. @handleSuccess="distributionSuccess"></distribution-modal>
  125. <group-select class="clueTagsSelect" :list="clueTagGroupVoList" scrollHeight="720rpx" groupName="groupName"
  126. groupChild="clueTagDataList" label-key="name" value-key="id" placeholder="请选择线索标签" v-model="checkTags"
  127. multiple clearable ref="clueTag" @confirm="handleClueTagConfirm"></group-select>
  128. </view>
  129. </template>
  130. <script>
  131. import {
  132. cloneDeep
  133. } from "lodash";
  134. import {
  135. selectDictLabel
  136. } from "@/utils/util";
  137. import clueInfo from "../tabs/clueInfo/index";
  138. import advertising from "../tabs/advertising/index";
  139. import followRecord from "../tabs/followRecord/index";
  140. import callRecord from "../tabs/callRecord/index";
  141. export default {
  142. components: {
  143. clueInfo,
  144. advertising,
  145. followRecord,
  146. callRecord,
  147. },
  148. props: {
  149. clueId: {
  150. type: String,
  151. required: true
  152. },
  153. params: {
  154. type: Object,
  155. required: true
  156. },
  157. },
  158. computed: {
  159. currentSteps() {
  160. const index = this.crmCluePhaseDict.findIndex(v => v.dictValue === this.clueDetail.clueState);
  161. return index;
  162. },
  163. },
  164. data() {
  165. return {
  166. showModal: false,
  167. clueDetail: {},
  168. checkTags: [],
  169. clueTagGroupVoList: [],
  170. crmHandelStatusDict: [],
  171. crmCluePhaseDict: [],
  172. tabs: [{
  173. label: '基础信息',
  174. slot: 'clueInfo'
  175. }, {
  176. label: '广告信息',
  177. slot: 'advertising'
  178. }, {
  179. label: '跟进记录',
  180. slot: 'followRecord'
  181. },
  182. {
  183. label: '通话记录',
  184. slot: 'callRecord'
  185. },
  186. {
  187. label: '后端跟进',
  188. slot: 'orderFollow'
  189. }
  190. ],
  191. activeIndex: 0,
  192. }
  193. },
  194. methods: {
  195. distributionSuccess() {
  196. this.handleInit();
  197. },
  198. async hanldeTagClose(tag) {
  199. const {
  200. cfId: id,
  201. clueTags
  202. } = this.clueDetail;
  203. const copyClueTags = cloneDeep(clueTags);
  204. if (id == null) {
  205. this.$message.error("修改异常");
  206. return;
  207. }
  208. const index = copyClueTags.findIndex(v => v.id === tag.id);
  209. if (index !== -1) {
  210. copyClueTags.splice(index, 1);
  211. const allTags = copyClueTags.map(v => v.id).join(",");
  212. await uni.$u.api.updateClueFixedFieldsAllTags({
  213. id,
  214. allTags
  215. });
  216. this.clueDetail.clueTags = copyClueTags;
  217. this.checkTags = this.clueDetail.clueTags.map(v => v.id);
  218. }
  219. },
  220. handleDistribution() {
  221. this.$refs.distribution.show();
  222. },
  223. confirm() {
  224. },
  225. async handleClueTagConfirm() {
  226. const allTags = this.checkTags.join(",");
  227. await uni.$u.api.updateClueFixedFieldsAllTags({
  228. id: this.clueDetail.cfId,
  229. allTags
  230. });
  231. this.getDetail();
  232. },
  233. handleAddClueTag() {
  234. this.$refs.clueTag.showModal();
  235. },
  236. handleIsInvalid() {
  237. const invalidDict = {
  238. dictValue: '6'
  239. };
  240. this.handleClickStepsItem(invalidDict);
  241. },
  242. async handleClickStepsItem(item) {
  243. const {
  244. cfId: id,
  245. clueState
  246. } = this.clueDetail;
  247. if (clueState === '6') {
  248. if (clueState === item.dictValue) {
  249. item.dictValue = '1';
  250. } else {
  251. uni.$u.toast("当前标记无效,请先取消");
  252. return;
  253. }
  254. }
  255. if (clueState === item.dictValue) {
  256. return;
  257. }
  258. if (id == null) {
  259. this.$message.error("修改异常");
  260. return;
  261. }
  262. uni.$u.api.updateClueFixedFieldsClueState({
  263. id,
  264. clueState: item.dictValue
  265. }).then(() => {
  266. this.$set(this.clueDetail, "clueState", item.dictValue);
  267. });
  268. },
  269. defaultText(text) {
  270. return text ? text : "-";
  271. },
  272. crmFollowStatusFormat(v) {
  273. return selectDictLabel(this.crmHandelStatusDict, v);
  274. },
  275. handleCopy(item) {
  276. uni.setClipboardData({
  277. data: item.telephone,
  278. success: function() {
  279. uni.$u.toast("复制成功");
  280. }
  281. });
  282. },
  283. // 添加联系人
  284. handleCallPhone() {
  285. uni.makePhoneCall({
  286. phoneNumber: this.clueDetail.telephone,
  287. success: () => {
  288. this.$store.commit("call/SET_FORM", {
  289. clueId: this.clueId,
  290. type: '3',
  291. callee: this.clueDetail.telephone
  292. })
  293. }
  294. });
  295. },
  296. // 发单
  297. async handleClueSend() {
  298. const {
  299. data: count
  300. } = await uni.$u.api.getClueSendFormCountByClueId({
  301. clueId: this.clueId
  302. });
  303. if (count > 0) {
  304. uni.showModal({
  305. title: '该线索已发单是否再次发单?',
  306. success: function (res) {
  307. if (res.confirm) {
  308. uni.navigateTo({
  309. url: `/pages/orderForm/index?clueId=${this.clueId}`
  310. })
  311. }
  312. }
  313. });
  314. }else{
  315. uni.navigateTo({
  316. url: `/pages/orderForm/index?clueId=${this.clueId}`
  317. })
  318. }
  319. },
  320. // 添加跟进记录
  321. handleAddFollow() {
  322. uni.navigateTo({
  323. url: `/pages/addFollow/index?clueId=${this.clueId}`
  324. })
  325. },
  326. handleUploadRecord() {
  327. uni.navigateTo({
  328. url: `/pages/uploadRecord/index?clueId=${this.clueId}`
  329. })
  330. },
  331. // 初始化详情页
  332. async handleInit() {
  333. this.$getDicts('crm_follow_status').then((res => {
  334. this.crmHandelStatusDict = res;
  335. }))
  336. this.$getDicts('crm_clue_phase').then((res => {
  337. this.crmCluePhaseDict = res.filter(v => v.dictValue !== '6');
  338. }))
  339. uni.$u.api.getClueTagGroupVoList({
  340. tagGroupApplication: '1'
  341. }).then(({
  342. data
  343. }) => {
  344. this.clueTagGroupVoList = data;
  345. });
  346. this.getDetail();
  347. },
  348. getDetail() {
  349. uni.$u.api.getClueMainInfoVoById({
  350. id: this.clueId
  351. }).then(res => {
  352. this.clueDetail = res.data;
  353. this.checkTags = this.clueDetail.clueTags.map(v => v.id);
  354. });
  355. },
  356. // 标签点击事件
  357. tabClick(index, item) {
  358. // // 根据索引调用对应组件的getData方法
  359. // const componentRefs = [
  360. // this.$refs.clueInfoRef,
  361. // this.$refs.advertisingRef,
  362. // this.$refs.followRecordRef,
  363. // this.$refs.callRecordRef
  364. // ];
  365. // const currentComponent = componentRefs[index];
  366. // if (currentComponent && typeof currentComponent.getData === 'function') {
  367. // currentComponent.getData();
  368. // }
  369. },
  370. // 标签切换事件
  371. tabChange(index, item) {
  372. // console.log("tabChange", index, item);
  373. },
  374. },
  375. created() {
  376. this.handleInit();
  377. },
  378. }
  379. </script>
  380. <style lang="scss" scoped>
  381. .clueTagsSelect {
  382. height: 0;
  383. overflow: hidden;
  384. }
  385. .clue_tag_wrap {
  386. display: flex;
  387. align-items: center;
  388. background-color: #fff;
  389. padding: 0 10px;
  390. margin: 20px 0;
  391. flex-wrap: wrap;
  392. min-height: 50px;
  393. .clue_tag_add_btn {
  394. font-size: 14px;
  395. color: #108cff;
  396. }
  397. }
  398. .clue_state_wrap {
  399. background-color: #fff;
  400. padding: 10px;
  401. margin-bottom: 20px;
  402. .clue_state_top_wrap {
  403. display: flex;
  404. justify-content: space-between;
  405. margin-bottom: 10px;
  406. .top_left {
  407. font-size: 16px;
  408. }
  409. .top_right {
  410. font-size: 14px;
  411. color: #4fa5fe;
  412. }
  413. }
  414. .steps_wrap {}
  415. }
  416. .clueDetail_tabber {
  417. ::v-deep .u-tabbar__content {
  418. background: #108cff;
  419. border-top-right-radius: 10px;
  420. border-top-left-radius: 10px;
  421. }
  422. }
  423. .clueDetail_wrap {
  424. .telPhone {
  425. display: flex;
  426. background: #fff;
  427. padding: 20px;
  428. justify-content: space-between;
  429. .left {
  430. display: flex;
  431. }
  432. .copy_btn {
  433. color: #4fa5fe;
  434. margin-left: 10px;
  435. }
  436. }
  437. .clueDetail_top_info {
  438. display: flex;
  439. flex-wrap: wrap;
  440. background-color: #ffffff;
  441. padding-top: 20px;
  442. margin: 18px 0;
  443. .top_info_item {
  444. width: 33.33%;
  445. text-align: center;
  446. margin-bottom: 20px;
  447. .top {
  448. font-size: 15px;
  449. color: #202020;
  450. margin-bottom: 5px;
  451. font-weight: bold;
  452. }
  453. .bottom {
  454. font-size: 15px;
  455. color: #c0c0c7;
  456. }
  457. }
  458. }
  459. }
  460. </style>