detail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view v-if="!$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/application/customer.png')" class="type-icon" />
  20. <view class="title-text">
  21. <text class="text">
  22. {{ detailData.customerName || '' }}
  23. </text>
  24. <text v-if="detailData.status === 2" class="wk wk-lock" />
  25. </view>
  26. <view :class="detailData.dealStatus === 1 ? 'success' : 'info'" class="title-status">
  27. <text>{{ detailData.dealStatus === 1 ? '已成交' : '未成交' }}</text>
  28. </view>
  29. </view>
  30. <view class="main-info">
  31. <view class="info-item">
  32. <text class="label">
  33. 客户级别:
  34. </text>
  35. <text class="value">
  36. {{ detailData.level || '&#45;&#45;' }}
  37. </text>
  38. </view>
  39. <view class="info-item">
  40. <text class="label">
  41. 负责人:
  42. </text>
  43. <text class="value">
  44. {{ detailData.ownerUserName || '&#45;&#45;' }}
  45. </text>
  46. </view>
  47. <view class="info-item">
  48. <text class="label">
  49. 更新时间:
  50. </text>
  51. <text class="value">
  52. {{ detailData.updateTime || '&#45;&#45;' }}
  53. </text>
  54. </view>
  55. </view>
  56. <image
  57. v-if="detailData.mobile"
  58. :src="$static('images/icon/call_up.png')"
  59. class="call-up"
  60. @click="ringUp(detailData.mobile)" />
  61. </view>
  62. </view>
  63. <view ref="wkTabs" class="wk-tabs">
  64. <view
  65. v-for="(tab, index) in tabs"
  66. :key="index"
  67. :class="{active: activeTab === tab.value}"
  68. class="wk-tab-item"
  69. @click="handleToggleTabs(tab.value)">
  70. {{ tab.label }}
  71. </view>
  72. </view>
  73. <wk-keep-alive v-if="id" v-model="activeTab">
  74. <wk-keep-alive-item>
  75. <detail-activity-list
  76. ref="activity"
  77. :detail-id="id"
  78. :hidden-add="true"
  79. type="crm_customer"
  80. activity-title="客户" />
  81. </wk-keep-alive-item>
  82. <wk-keep-alive-item>
  83. <detail-base-info
  84. v-if="poolId"
  85. :detail-id="id"
  86. :pool-id="poolId"
  87. :type="comType"
  88. class="detail-container" />
  89. </wk-keep-alive-item>
  90. <wk-keep-alive-item>
  91. <detail-about
  92. :detail-id="id"
  93. :detail-data="detailData"
  94. :batch-id="detailData.batchId"
  95. is-seas
  96. class="detail-container" />
  97. </wk-keep-alive-item>
  98. </wk-keep-alive>
  99. </scroll-view>
  100. <uni-popup ref="popup" type="dialog">
  101. <uni-popup-dialog
  102. :content="dialogMsg"
  103. type="warning"
  104. @confirm="handleDialogConfirm" />
  105. </uni-popup>
  106. </view>
  107. </template>
  108. <script>
  109. import {
  110. QueryById,
  111. DistributeByIds,
  112. ReceiveByIds
  113. } from 'API/crm/customer'
  114. import { DeleteByIds } from 'API/crm/pool'
  115. import DetailBaseInfo from '../components/detailSection/baseInfo'
  116. import DetailActivityList from '../components/detailSection/activityList'
  117. import DetailAbout from '../customer/components/tabsAbout.vue'
  118. import detailMixins from '../mixins/detail.js'
  119. export default {
  120. name: 'SeasDetail',
  121. components: {
  122. DetailBaseInfo,
  123. DetailActivityList,
  124. DetailAbout
  125. },
  126. mixins: [detailMixins],
  127. data() {
  128. return {
  129. comType: 'crm_pool',
  130. poolId: null,
  131. commandList: [
  132. {
  133. label: '分配',
  134. imgIcon: 'alloc',
  135. auth: 'crm.pool.distribute',
  136. value: 'distribute'
  137. },
  138. {
  139. label: '领取',
  140. imgIcon: 'receive',
  141. auth: 'crm.pool.receive',
  142. value: 'receive'
  143. },
  144. {
  145. label: '删除',
  146. imgIcon: 'delete',
  147. noCheck: true,
  148. value: 'delete'
  149. }
  150. ]
  151. }
  152. },
  153. onLoad(options) {
  154. this.routerQuery = options
  155. this.id = options.id || null
  156. this.poolId = options.poolId || null
  157. if (!this.poolId) {
  158. this.commandList = [
  159. {
  160. label: '删除',
  161. imgIcon: 'delete',
  162. noCheck: true,
  163. value: 'delete'
  164. }
  165. ]
  166. }
  167. // this.getDetail()
  168. },
  169. methods: {
  170. getDetail() {
  171. QueryById({customerId: this.id}).then(response => {
  172. console.log('detail: ', response)
  173. this.detailData = response
  174. }).catch(() => {
  175. this.goBack()
  176. })
  177. },
  178. handleCommand(command) {
  179. this.commandValue = command.value
  180. switch (command.value) {
  181. case 'distribute':
  182. this.handleToChangeOwnerUser()
  183. break
  184. case 'receive':
  185. this.dialogMsg = '您确定要领取该客户吗?'
  186. this.$refs.popup.open()
  187. break
  188. case 'delete':
  189. this.dialogMsg = '您确定要删除该客户吗?'
  190. this.$refs.popup.open()
  191. break
  192. }
  193. },
  194. handleDialogConfirm(next) {
  195. switch (this.commandValue) {
  196. case 'receive':
  197. this.getCustomerForMyself()
  198. break
  199. case 'delete':
  200. this.deleteCustomer()
  201. break
  202. }
  203. next()
  204. },
  205. handleTransfer(user) {
  206. DistributeByIds({
  207. userId: user.userId,
  208. ids: [this.id],
  209. poolId: this.poolId
  210. }).then(() => {
  211. this.$toast('分配成功!')
  212. this.$refreshAndToPrev(this)
  213. }).catch()
  214. },
  215. getCustomerForMyself() {
  216. ReceiveByIds({
  217. ids: [this.id],
  218. poolId: this.poolId
  219. }).then(() => {
  220. this.$toast('领取成功!')
  221. this.$refreshAndToPrev(this)
  222. }).catch()
  223. },
  224. /**
  225. * 删除
  226. */
  227. deleteCustomer() {
  228. DeleteByIds({
  229. ids: [this.id],
  230. poolId: this.poolId
  231. }).then(() => {
  232. this.$toast('删除成功')
  233. this.$refreshAndToPrev(this)
  234. })
  235. }
  236. }
  237. }
  238. </script>
  239. <style scoped lang="scss">
  240. @import "../style/detail.scss";
  241. .header-top {
  242. .card {
  243. .title-status {
  244. &.success {
  245. color: #FFFFFF;
  246. background-color: #FF8700;
  247. }
  248. &.info {
  249. color: #BBBBBB;
  250. background-color: #EEEEEE;
  251. }
  252. }
  253. .main-info {
  254. margin-bottom: 25rpx;
  255. }
  256. .call-up {
  257. position: absolute;
  258. right: 50rpx;
  259. bottom: 0;
  260. width: 116rpx;
  261. height: 116rpx;
  262. }
  263. }
  264. }
  265. </style>