| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- <template>
- <slide-view
- v-empty="!canShowDetail"
- :listener-ids="listenerIDs"
- :no-listener-ids="noListenerIDs"
- :no-listener-class="noListenerClass"
- :body-style="{padding: 0, height: '100%'}"
- xs-empty-icon="nopermission"
- xs-empty-text="暂无权限"
- @afterEnter="viewAfterEnter"
- @close="hideView">
- <div
- v-loading="loading"
- ref="crmDetailMain"
- class="detail-main">
- <flexbox
- v-if="canShowDetail && detailData"
- direction="column"
- align="stretch"
- class="d-container">
- <c-r-m-detail-head
- :detail="detailData"
- :head-details="headDetails"
- :id="id"
- :crm-type="crmType"
- @handle="detailHeadHandle"
- @close="hideView">
- <template slot="name">
- <el-tooltip :content="detailData.star == 0 ? '添加关注' : '取消关注'" effect="dark" placement="top">
- <i
- :class="{active: detailData.star != 0}"
- class="wk wk-focus-on focus-icon"
- @click="toggleStar()" />
- </el-tooltip>
- </template>
- </c-r-m-detail-head>
- <flexbox class="d-container-bd" align="stretch">
- <el-tabs
- v-model="tabCurrentName"
- type="border-card"
- class="d-container-bd--left">
- <el-tab-pane
- v-for="(item, index) in tabNames"
- :key="index"
- :label="item.label"
- :name="item.name"
- lazy>
- <component
- :is="item.name"
- :detail="detailData"
- :type-list="logTyps"
- :id="id"
- :handle="activityHandle"
- :crm-type="crmType" />
- </el-tab-pane>
- </el-tabs>
- <transition name="slide-fade">
- <el-tabs
- v-show="showImportInfo"
- value="chiefly-contacts"
- type="border-card"
- class="d-container-bd--right">
- <el-tab-pane
- label="重要信息"
- name="chiefly-contacts"
- lazy>
- <contacts-import
- :id="id"
- :customer-id="customerId" />
- </el-tab-pane>
- </el-tabs>
- </transition>
- </flexbox>
- </flexbox>
- </div>
- <el-button
- class="firse-button"
- @click="showImportInfo= !showImportInfo">重<br>要<br>信<br>息<br><i :class="{ 'is-reverse': !showImportInfo }" class="el-icon-arrow-right el-icon--right" /></el-button>
- <c-r-m-all-create
- v-if="isCreate"
- :action="{type: 'update', id: id, batchId: detailData.batchId}"
- :crm-type="crmType"
- @save-success="editSaveSuccess"
- @close="isCreate=false"/>
- </slide-view>
- </template>
-
- <script>
- import { crmContactsReadAPI } from '@/api/crm/contacts'
-
- import SlideView from '@/components/SlideView'
- import CRMDetailHead from '../components/CRMDetailHead'
- import Activity from '../components/Activity' // 活动
- import ContactsImport from './components/ContactsImport' // 重要信息
- import CRMEditBaseInfo from '../components/CRMEditBaseInfo' // 联系人基本信息
-
- import RelativeBusiness from '../components/RelativeBusiness' // 相关商机
- import RelativeHandle from '../components/RelativeHandle' // 相关操作
- import RelativeFiles from '../components/RelativeFiles' // 相关附件
- import CRMAllCreate from '../components/CRMAllCreate' // 新建页面
- import DetailMixin from '../mixins/Detail'
-
- export default {
- /** 联系人管理 的 联系人详情 */
- name: 'ContactsDetail',
- components: {
- SlideView,
- CRMDetailHead,
- Activity,
- CRMEditBaseInfo,
- RelativeBusiness,
- RelativeHandle,
- RelativeFiles,
- CRMAllCreate,
- ContactsImport
- },
- mixins: [DetailMixin],
- props: {
- // 详情信息id
- id: [String, Number],
- // 监听的dom 进行隐藏详情
- listenerIDs: {
- type: Array,
- default: () => {
- return ['crm-main-container']
- }
- },
- // 不监听
- noListenerIDs: {
- type: Array,
- default: () => {
- return []
- }
- },
- noListenerClass: {
- type: Array,
- default: () => {
- return ['el-table__body']
- }
- }
- },
- data() {
- return {
- // 展示加载loading
- loading: false,
- crmType: 'contacts',
- headDetails: [
- { title: '客户名称', value: '' },
- { title: '职务', value: '' },
- { title: '手机', value: '' },
- { title: '创建时间', value: '' }
- ],
- tabCurrentName: 'Activity',
- // 编辑操作
- isCreate: false,
- // 展示重要信息
- showImportInfo: true
- }
- },
- computed: {
- /**
- * 活动操作
- */
- activityHandle() {
- let temps = [
- {
- type: 'task',
- label: '创建任务'
- }, {
- type: 'business',
- label: '创建商机'
- }, {
- type: 'contract',
- label: '创建合同'
- }, {
- type: 'receivables',
- label: '创建回款'
- }
- ]
-
- if (this.canCreateFollowRecord) {
- temps = [{
- type: 'log',
- label: '写跟进'
- }].concat(temps)
- }
-
- return temps
- },
-
- /**
- * tabs
- */
- tabNames() {
- var tempsTabs = []
- tempsTabs.push({ label: '活动', name: 'Activity' })
- if (this.crm.contacts && this.crm.contacts.read) {
- tempsTabs.push({ label: '详细资料', name: 'CRMEditBaseInfo' })
- }
- if (this.crm.business && this.crm.business.index) {
- tempsTabs.push({ label: this.getTabName('商机', this.tabsNumber.businessCount), name: 'RelativeBusiness' })
- }
- tempsTabs.push({ label: this.getTabName('附件', this.tabsNumber.fileCount), name: 'RelativeFiles' })
- tempsTabs.push({ label: '操作记录', name: 'RelativeHandle' })
- return tempsTabs
- },
-
- /**
- * 根据记录筛选
- */
- logTyps() {
- return [{
- icon: 'all',
- color: '#2362FB',
- command: '',
- label: '全部活动'
- }, {
- icon: 'contacts',
- color: '#27BA4A',
- command: 3,
- label: '联系人'
- }, {
- icon: 'o-task',
- color: '#D376FF',
- command: 11,
- label: '任务'
- }, {
- icon: 'log',
- color: '#5864FF',
- command: 8,
- label: '日志'
- }, {
- icon: 'approve',
- color: '#9376FF',
- command: 9,
- label: '审批'
- }]
- },
-
- /**
- * 客户ID
- */
- customerId() {
- return this.detailData ? this.detailData.customer_id || '' : ''
- }
- },
- mounted() {},
- methods: {
- /**
- * 详情
- */
- getDetial() {
- this.loading = true
- crmContactsReadAPI({
- id: this.id
- })
- .then(res => {
- this.loading = false
- this.detailData = res.data
- if (this.detailData.dataAuth === 0) return
-
- // 负责人
- this.headDetails[0].value = res.data.customer_name
- this.headDetails[1].value = res.data.post
- this.headDetails[2].value = res.data.mobile
- this.headDetails[3].value = res.data.create_time
- })
- .catch(() => {
- this.loading = false
- this.hideView()
- })
- },
-
- /**
- * 关闭
- */
- hideView() {
- this.$emit('hide-view')
- }
-
- // /**
- // * 编辑成功
- // */
- // editSaveSuccess() {
- // this.$emit('handle', { type: 'save-success' })
- // this.getDetial()
- // }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- @import '../styles/crmdetail.scss';
- </style>
|