detail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view v-if="!refreshPage && !$isEmpty(detailData)" class="uni-app">
  3. <view class="status-bar" />
  4. <wk-nav-bar
  5. :command-list="commandList"
  6. :refresh-prev="refreshPrevPage"
  7. title="联系人详情"
  8. theme="white"
  9. class="nav-bar"
  10. @command="handleCommand" />
  11. <scroll-view
  12. :scroll-y="true"
  13. class="main-container scroll-view-hook"
  14. @scrolltolower="handleScrollTolower">
  15. <view class="header-top">
  16. <view class="bg linear-gradient" />
  17. <view class="card">
  18. <view class="title-cell">
  19. <image :src="$static('images/crm/gray_contacts.png')" class="type-icon" />
  20. <view class="title-text">
  21. {{ detailData.name || '' }}
  22. </view>
  23. </view>
  24. <view class="main-info">
  25. <view class="info-item">
  26. 联系方式:{{ detailData.mobile || '&#45;&#45;' }}
  27. </view>
  28. <view class="info-item">
  29. 负责人:{{ detailData.ownerUserName || '&#45;&#45;' }}
  30. </view>
  31. <view class="info-item">
  32. 最后跟进:{{ detailData.lastTime || '&#45;&#45;' }}
  33. </view>
  34. </view>
  35. <view class="main-info">
  36. <flow-progress
  37. v-if="detailData"
  38. :type="comType"
  39. :detail-id="id"
  40. :detail-data="detailData" />
  41. </view>
  42. <view
  43. class="relevance-cell"
  44. @click="handleToCustomer">
  45. <image :src="$static('images/application/customer.png')" class="cell-icon" />
  46. <text class="cell-body">
  47. {{ detailData.customerName }}
  48. </text>
  49. <text class="cell-link wk wk-arrow-right" />
  50. </view>
  51. </view>
  52. </view>
  53. <view ref="wkTabs" class="wk-tabs">
  54. <view
  55. v-for="(tab, index) in tabs" :key="index" :class="{active: activeTab === tab.value}" class="wk-tab-item"
  56. @click="handleToggleTabs(tab.value)">
  57. {{ tab.label }}
  58. </view>
  59. </view>
  60. <wk-keep-alive v-if="id" v-model="activeTab">
  61. <wk-keep-alive-item>
  62. <detail-activity-list
  63. ref="activity"
  64. :detail-id="id"
  65. :type="comType"
  66. activity-title="联系人" />
  67. </wk-keep-alive-item>
  68. <wk-keep-alive-item>
  69. <detail-base-info :detail-id="id" :type="comType" class="detail-container" />
  70. </wk-keep-alive-item>
  71. <wk-keep-alive-item>
  72. <detail-about
  73. :detail-id="id"
  74. :detail-data="detailData"
  75. :batch-id="detailData.batchId"
  76. class="detail-about-container" />
  77. </wk-keep-alive-item>
  78. </wk-keep-alive>
  79. </scroll-view>
  80. <uni-popup ref="popup" type="dialog">
  81. <uni-popup-dialog
  82. :content="dialogMsg"
  83. type="warning"
  84. @confirm="handleDialogConfirm" />
  85. </uni-popup>
  86. </view>
  87. </template>
  88. <script>
  89. import {
  90. QueryById,
  91. Transfer,
  92. DeleteByIds
  93. } from 'API/crm/concat'
  94. import DetailBaseInfo from '../components/detailSection/baseInfo'
  95. import DetailActivityList from '../components/detailSection/activityList'
  96. import DetailAbout from './components/tabsAbout'
  97. import FlowProgress from '../components/customFlow/flowProgress'
  98. import detailMixins from '../mixins/detail.js'
  99. export default {
  100. name: 'ContactsDetail',
  101. components: {
  102. DetailBaseInfo,
  103. DetailActivityList,
  104. DetailAbout,
  105. FlowProgress
  106. },
  107. mixins: [detailMixins],
  108. data() {
  109. return {
  110. commandList: [
  111. { label: '转移', auth: 'crm.contacts.transfer', imgIcon: 'transfer', value: 'transfer'},
  112. { label: '编辑', auth: 'crm.contacts.update', imgIcon: 'update', value: 'update'},
  113. { label: '删除', auth: 'crm.contacts.delete', imgIcon: 'delete', value: 'delete'},
  114. ],
  115. comType: 'crm_contacts'
  116. }
  117. },
  118. methods: {
  119. /**
  120. * 获取详情
  121. */
  122. getDetail() {
  123. QueryById({contactsId: this.id}).then(response => {
  124. this.detailData = response
  125. }).catch(() => {
  126. this.goBack()
  127. })
  128. },
  129. handleToCustomer() {
  130. this.$Router.navigateTo({
  131. url: '/pages_crm/customer/detail',
  132. query: {
  133. id: this.detailData.customerId
  134. }
  135. })
  136. },
  137. handleCommand(command) {
  138. this.commandValue = command.value
  139. switch (command.value) {
  140. case 'transfer':
  141. this.handleToChangeOwnerUser()
  142. break
  143. case 'update':
  144. this.handleEdit()
  145. break
  146. case 'delete':
  147. this.dialogMsg = '您确定要删除该联系人吗?'
  148. this.$refs.popup.open()
  149. break
  150. }
  151. },
  152. handleDialogConfirm(next) {
  153. switch (this.commandValue) {
  154. case 'delete':
  155. this.handleDelete()
  156. break
  157. }
  158. next()
  159. },
  160. /**
  161. * 转移
  162. * @param {Object} user
  163. */
  164. handleTransfer(user) {
  165. let params = {
  166. ids: [this.id],
  167. ownerUserId: user.userId,
  168. transferType: 1
  169. }
  170. Transfer(params).then(() => {
  171. this.$toast('转移成功')
  172. this.$refreshAndToPrev(this)
  173. }).catch()
  174. },
  175. /**
  176. * 删除
  177. */
  178. handleDelete() {
  179. DeleteByIds([this.id]).then(() => {
  180. this.$toast('删除成功')
  181. this.$refreshAndToPrev(this)
  182. }).catch()
  183. },
  184. }
  185. }
  186. </script>
  187. <style scoped lang="scss">
  188. @import "../style/detail.scss";
  189. .call-icon {
  190. width: 56rpx;
  191. height: 56rpx;
  192. @include center;
  193. .header-phone-icon {
  194. width: 100%;
  195. height: 100%;
  196. }
  197. }
  198. </style>