clueDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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" :swipeThreshold="10" v-model="activeIndex" :lineWidth="'120rpx'" :isLazyRender="false"
  92. color="#108cff" titleActiveColor="#108cff" :swipeable="false">
  93. <template #clueInfo>
  94. <clueInfo :clueId="clueDetail.id" v-if="clueDetail.id" :params="params" ref="clueInfoRef"></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"></followRecord>
  101. </template>
  102. <template #callRecord>
  103. <callRecord :clueId="clueDetail.id" :clueDetail="clueDetail" v-if="clueDetail.id" ref="callRecordRef">
  104. </callRecord>
  105. </template>
  106. </yui-tabs>
  107. <u-tabbar class="clueDetail_tabber" :fixed="true" inactiveColor="#ffffff" :placeholder="true"
  108. :safeAreaInsetBottom="true">
  109. <u-tabbar-item text="拨打电话" icon="../../static/clueDetail/icon-phone.png"
  110. @click="handleCallPhone"></u-tabbar-item>
  111. <u-tabbar-item text="转移线索" icon="../../static/clueDetail/icon-clue.png"
  112. @click="handleDistribution"></u-tabbar-item>
  113. <u-tabbar-item text="写新跟进" icon="../../static/caseDetail/icon-follow.png"
  114. @click="handleAddFollow"></u-tabbar-item>
  115. <u-tabbar-item text="上传录音" icon="../../static/caseDetail/icon-record.png"
  116. @click="handleUploadRecord"></u-tabbar-item>
  117. </u-tabbar>
  118. <distribution-modal :clueDetail="clueDetail" ref="distribution"
  119. @handleSuccess="distributionSuccess"></distribution-modal>
  120. <group-select class="clueTagsSelect" :list="clueTagGroupVoList" scrollHeight="720rpx" groupName="groupName"
  121. groupChild="clueTagDataList" label-key="name" value-key="id" placeholder="请选择线索标签" v-model="checkTags"
  122. multiple clearable ref="clueTag" @confirm="handleClueTagConfirm"></group-select>
  123. </view>
  124. </template>
  125. <script>
  126. import {
  127. cloneDeep
  128. } from "lodash";
  129. import {
  130. selectDictLabel
  131. } from "@/utils/util";
  132. import clueInfo from "../tabs/clueInfo/index";
  133. import advertising from "../tabs/advertising/index";
  134. import followRecord from "../tabs/followRecord/index";
  135. import callRecord from "../tabs/callRecord/index";
  136. export default {
  137. components: {
  138. clueInfo,
  139. advertising,
  140. followRecord,
  141. callRecord,
  142. },
  143. props: {
  144. clueId: {
  145. type: String,
  146. required: true
  147. },
  148. params: {
  149. type: Object,
  150. required: true
  151. },
  152. },
  153. computed: {
  154. currentSteps() {
  155. const index = this.crmCluePhaseDict.findIndex(v => v.dictValue === this.clueDetail.clueState);
  156. return index;
  157. },
  158. },
  159. data() {
  160. return {
  161. showModal: false,
  162. clueDetail: {},
  163. checkTags: [],
  164. clueTagGroupVoList: [],
  165. crmHandelStatusDict: [],
  166. crmCluePhaseDict: [],
  167. tabs: [{
  168. label: '基础信息',
  169. slot: 'clueInfo'
  170. }, {
  171. label: '广告信息',
  172. slot: 'advertising'
  173. }, {
  174. label: '跟进记录',
  175. slot: 'followRecord'
  176. },
  177. {
  178. label: '通话记录',
  179. slot: 'callRecord'
  180. }
  181. ],
  182. activeIndex: 0,
  183. }
  184. },
  185. methods: {
  186. distributionSuccess() {
  187. this.handleInit();
  188. },
  189. async hanldeTagClose(tag) {
  190. const {
  191. cfId: id,
  192. clueTags
  193. } = this.clueDetail;
  194. const copyClueTags = cloneDeep(clueTags);
  195. if (id == null) {
  196. this.$message.error("修改异常");
  197. return;
  198. }
  199. const index = copyClueTags.findIndex(v => v.id === tag.id);
  200. if (index !== -1) {
  201. copyClueTags.splice(index, 1);
  202. const allTags = copyClueTags.map(v => v.id).join(",");
  203. await uni.$u.api.updateClueFixedFieldsAllTags({
  204. id,
  205. allTags
  206. });
  207. this.clueDetail.clueTags = copyClueTags;
  208. this.checkTags = this.clueDetail.clueTags.map(v => v.id);
  209. }
  210. },
  211. handleDistribution() {
  212. this.$refs.distribution.show();
  213. },
  214. confirm() {
  215. },
  216. async handleClueTagConfirm() {
  217. const allTags = this.checkTags.join(",");
  218. await uni.$u.api.updateClueFixedFieldsAllTags({
  219. id: this.clueDetail.cfId,
  220. allTags
  221. });
  222. this.getDetail();
  223. },
  224. handleAddClueTag() {
  225. this.$refs.clueTag.showModal();
  226. },
  227. handleIsInvalid() {
  228. const invalidDict = {
  229. dictValue: '6'
  230. };
  231. this.handleClickStepsItem(invalidDict);
  232. },
  233. async handleClickStepsItem(item) {
  234. const {
  235. cfId: id,
  236. clueState
  237. } = this.clueDetail;
  238. if (clueState === '6') {
  239. if (clueState === item.dictValue) {
  240. item.dictValue = '1';
  241. } else {
  242. uni.$u.toast("当前标记无效,请先取消");
  243. return;
  244. }
  245. }
  246. if (clueState === item.dictValue) {
  247. return;
  248. }
  249. if (id == null) {
  250. this.$message.error("修改异常");
  251. return;
  252. }
  253. uni.$u.api.updateClueFixedFieldsClueState({
  254. id,
  255. clueState: item.dictValue
  256. }).then(() => {
  257. this.$set(this.clueDetail, "clueState", item.dictValue);
  258. });
  259. },
  260. defaultText(text) {
  261. return text ? text : "-";
  262. },
  263. crmFollowStatusFormat(v) {
  264. return selectDictLabel(this.crmHandelStatusDict, v);
  265. },
  266. handleCopy(item) {
  267. uni.setClipboardData({
  268. data: item.telephone,
  269. success: function() {
  270. uni.$u.toast("复制成功");
  271. }
  272. });
  273. },
  274. // 添加联系人
  275. handleCallPhone() {
  276. uni.makePhoneCall({
  277. phoneNumber: this.clueDetail.telephone,
  278. success: () => {
  279. this.$store.commit("call/SET_FORM", {
  280. clueId: this.clueId,
  281. type: '3',
  282. callee: this.clueDetail.telephone
  283. })
  284. }
  285. });
  286. },
  287. // 添加催记
  288. handleAddFollow() {
  289. uni.navigateTo({
  290. url: `/pages/addFollow/index?clueId=${this.clueId}`
  291. })
  292. },
  293. handleUploadRecord() {
  294. uni.navigateTo({
  295. url: `/pages/uploadRecord/index?clueId=${this.clueId}`
  296. })
  297. },
  298. // 初始化详情页
  299. async handleInit() {
  300. this.$getDicts('crm_follow_status').then((res => {
  301. this.crmHandelStatusDict = res;
  302. }))
  303. this.$getDicts('crm_clue_phase').then((res => {
  304. this.crmCluePhaseDict = res.filter(v => v.dictValue !== '6');
  305. }))
  306. uni.$u.api.getClueTagGroupVoList({
  307. tagGroupApplication: '1'
  308. }).then(({
  309. data
  310. }) => {
  311. this.clueTagGroupVoList = data;
  312. });
  313. this.getDetail();
  314. },
  315. getDetail() {
  316. uni.$u.api.getClueMainInfoVoById({
  317. id: this.clueId
  318. }).then(res => {
  319. this.clueDetail = res.data;
  320. this.checkTags = this.clueDetail.clueTags.map(v => v.id);
  321. });
  322. },
  323. // 标签点击事件
  324. tabClick(index, item) {
  325. // // 根据索引调用对应组件的getData方法
  326. // const componentRefs = [
  327. // this.$refs.clueInfoRef,
  328. // this.$refs.advertisingRef,
  329. // this.$refs.followRecordRef,
  330. // this.$refs.callRecordRef
  331. // ];
  332. // const currentComponent = componentRefs[index];
  333. // if (currentComponent && typeof currentComponent.getData === 'function') {
  334. // currentComponent.getData();
  335. // }
  336. },
  337. // 标签切换事件
  338. tabChange(index, item) {
  339. // console.log("tabChange", index, item);
  340. },
  341. },
  342. created() {
  343. this.handleInit();
  344. },
  345. }
  346. </script>
  347. <style lang="scss" scoped>
  348. .clueTagsSelect {
  349. height: 0;
  350. overflow: hidden;
  351. }
  352. .clue_tag_wrap {
  353. display: flex;
  354. align-items: center;
  355. background-color: #fff;
  356. padding: 0 10px;
  357. margin: 20px 0;
  358. flex-wrap: wrap;
  359. min-height: 50px;
  360. .clue_tag_add_btn {
  361. font-size: 14px;
  362. color: #108cff;
  363. }
  364. }
  365. .clue_state_wrap {
  366. background-color: #fff;
  367. padding: 10px;
  368. margin-bottom: 20px;
  369. .clue_state_top_wrap {
  370. display: flex;
  371. justify-content: space-between;
  372. margin-bottom: 10px;
  373. .top_left {
  374. font-size: 16px;
  375. }
  376. .top_right {
  377. font-size: 14px;
  378. color: #4fa5fe;
  379. }
  380. }
  381. .steps_wrap {}
  382. }
  383. .clueDetail_tabber {
  384. ::v-deep .u-tabbar__content {
  385. background: #108cff;
  386. border-top-right-radius: 10px;
  387. border-top-left-radius: 10px;
  388. }
  389. }
  390. .clueDetail_wrap {
  391. .telPhone {
  392. display: flex;
  393. background: #fff;
  394. padding: 20px;
  395. justify-content: space-between;
  396. .left {
  397. display: flex;
  398. }
  399. .copy_btn {
  400. color: #4fa5fe;
  401. margin-left: 10px;
  402. }
  403. }
  404. .clueDetail_top_info {
  405. display: flex;
  406. flex-wrap: wrap;
  407. background-color: #ffffff;
  408. padding-top: 20px;
  409. margin: 18px 0;
  410. .top_info_item {
  411. width: 33.33%;
  412. text-align: center;
  413. margin-bottom: 20px;
  414. .top {
  415. font-size: 15px;
  416. color: #202020;
  417. margin-bottom: 5px;
  418. font-weight: bold;
  419. }
  420. .bottom {
  421. font-size: 15px;
  422. color: #c0c0c7;
  423. }
  424. }
  425. }
  426. }
  427. </style>