detail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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_leads.png')" class="type-icon" />
  20. <view class="title-text">
  21. {{ detailData.leadsName || '' }}
  22. </view>
  23. </view>
  24. <view class="main-info">
  25. <view class="info-item">
  26. <text class="label">
  27. 联系方式:
  28. </text>
  29. <text class="value">
  30. {{ detailData.mobile || '&#45;&#45;' }}
  31. </text>
  32. </view>
  33. <view class="info-item">
  34. <text class="label">
  35. 负责人:
  36. </text>
  37. <text class="value">
  38. {{ detailData.ownerUserName || '&#45;&#45;' }}
  39. </text>
  40. </view>
  41. <view class="info-item">
  42. <text class="label">
  43. 最后跟进:
  44. </text>
  45. <text class="value">
  46. {{ detailData.lastTime || '&#45;&#45;' }}
  47. </text>
  48. </view>
  49. </view>
  50. <view class="main-info">
  51. <flow-progress
  52. v-if="detailData"
  53. :type="comType"
  54. :detail-id="id"
  55. :detail-data="detailData" />
  56. </view>
  57. </view>
  58. </view>
  59. <view class="wk-tabs">
  60. <view
  61. v-for="(tab, index) in tabs"
  62. :key="index"
  63. :class="{active: activeTab === tab.value}"
  64. class="wk-tab-item"
  65. @click="handleToggleTabs(tab.value)">
  66. {{ tab.label }}
  67. </view>
  68. </view>
  69. <wk-keep-alive v-if="id" v-model="activeTab">
  70. <wk-keep-alive-item>
  71. <detail-activity-list
  72. ref="activity"
  73. :detail-id="id"
  74. :type="comType"
  75. activity-title="线索" />
  76. </wk-keep-alive-item>
  77. <wk-keep-alive-item>
  78. <detail-base-info :detail-id="id" :type="comType" class="detail-container" />
  79. </wk-keep-alive-item>
  80. <wk-keep-alive-item>
  81. <detail-about :detail-id="id" :batch-id="detailData.batchId" class="detail-about-container" />
  82. </wk-keep-alive-item>
  83. </wk-keep-alive>
  84. </scroll-view>
  85. <uni-popup ref="popup" type="dialog">
  86. <uni-popup-dialog
  87. :content="dialogMsg"
  88. type="warning"
  89. @confirm="handleDialogConfirm" />
  90. </uni-popup>
  91. </view>
  92. </template>
  93. <script>
  94. import {
  95. QueryById,
  96. ChangeOwnerUser,
  97. Transfer,
  98. DeleteByIds
  99. } from 'API/crm/leads'
  100. import DetailBaseInfo from '../components/detailSection/baseInfo'
  101. import DetailActivityList from '../components/detailSection/activityList'
  102. import DetailAbout from './components/tabsAbout'
  103. import FlowProgress from '../components/customFlow/flowProgress.vue'
  104. import detailMixins from '../mixins/detail.js'
  105. export default {
  106. name: 'LeadsDetail',
  107. components: {
  108. DetailBaseInfo,
  109. DetailActivityList,
  110. DetailAbout,
  111. FlowProgress
  112. },
  113. mixins: [detailMixins],
  114. data() {
  115. return {
  116. comType: 'crm_leads',
  117. commandList: [
  118. {
  119. label: '转移',
  120. imgIcon: 'transfer',
  121. auth: 'crm.leads.transfer',
  122. value: 'transfer'
  123. },
  124. {
  125. label: '转化为客户',
  126. imgIcon: 'transform',
  127. auth: 'crm.leads.transform',
  128. value: 'transform'
  129. },
  130. {
  131. label: '编辑',
  132. imgIcon: 'update',
  133. auth: 'crm.leads.update',
  134. value: 'update'
  135. },
  136. {
  137. label: '删除',
  138. imgIcon: 'delete',
  139. auth: 'crm.leads.delete',
  140. value: 'delete'
  141. }
  142. ]
  143. }
  144. },
  145. methods: {
  146. /**
  147. * 获取详情
  148. */
  149. getDetail() {
  150. QueryById({
  151. leadsId: this.id,
  152. }).then(response => {
  153. console.log('leadsDetail: ', response)
  154. this.detailData = response
  155. }).catch(() => {
  156. this.goBack()
  157. })
  158. },
  159. handleCommand(command) {
  160. this.commandValue = command.value
  161. switch (command.value) {
  162. case 'transfer':
  163. this.handleToChangeOwnerUser()
  164. break
  165. case 'transform':
  166. this.dialogMsg = '您确定要把该线索转化为客户吗?'
  167. this.$refs.popup.open()
  168. break
  169. case 'update':
  170. this.handleEdit()
  171. break
  172. case 'delete':
  173. this.dialogMsg = '您确定要删除该线索吗?'
  174. this.$refs.popup.open()
  175. break
  176. }
  177. },
  178. handleDialogConfirm(next) {
  179. switch (this.commandValue) {
  180. case 'transfer':
  181. break
  182. case 'transform':
  183. this.transformCustomer()
  184. break
  185. case 'update':
  186. break
  187. case 'delete':
  188. this.handleDelete()
  189. break
  190. }
  191. console.log('next fn: ', next)
  192. next()
  193. },
  194. selectedUser(data) {
  195. if (this.guid === data.guid) {
  196. if (data.data.length > 0) {
  197. this.$nextTick(function() {
  198. this.handleTransfer(data.data[0])
  199. })
  200. }
  201. }
  202. uni.$off('selected-user')
  203. },
  204. /**
  205. * 转移
  206. */
  207. handleTransfer(user) {
  208. ChangeOwnerUser({
  209. ids: [this.id],
  210. ownerUserId: user.userId
  211. }).then(() => {
  212. this.$toast('转移成功')
  213. this.$refreshAndToPrev(this)
  214. }).catch()
  215. },
  216. /**
  217. * 转化为客户
  218. */
  219. transformCustomer() {
  220. Transfer([this.id]).then(() => {
  221. this.$toast('转化成功')
  222. this.$refreshAndToPrev(this)
  223. }).catch()
  224. },
  225. /**
  226. * 删除
  227. */
  228. handleDelete() {
  229. DeleteByIds([this.id]).then(() => {
  230. this.$toast('删除成功')
  231. this.$refreshAndToPrev(this)
  232. }).catch()
  233. },
  234. }
  235. }
  236. </script>
  237. <style scoped lang="scss">
  238. @import "../style/detail.scss";
  239. </style>