clueDetail.vue 10 KB

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