clueDetail.vue 12 KB

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