details.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-15 18:21:43
  6. * @Description: file content
  7. * @FilePath: \oms\pages\customer\details.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <view class="back" @click="goBack()">
  15. <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
  16. </view>
  17. <text>客户详情</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="main">
  22. <view class="main-top">
  23. <view class="customer-box">
  24. <view class="header flex1">
  25. <view class="name flex_l">
  26. <image class="img" src="../../static/images/menu1.png" mode="scaleToFill" />
  27. <text>{{ customerData.custName }}</text>
  28. </view>
  29. <view class="date">{{ parseTime(customerData.createdTime, '{y}-{m}-{d} {h}:{i}') }}</view>
  30. </view>
  31. <view class="info">
  32. <view class="info-item">
  33. <u-row>
  34. <u-col span="7">
  35. <view class="flex_l">
  36. <view class="info-label">客户编码:</view>
  37. <text class="info-txt">{{ customerData.custCode }}</text>
  38. </view>
  39. </u-col>
  40. <u-col span="5">
  41. <view class="flex_l">
  42. <view class="info-label">客户行业:</view>
  43. <text class="info-txt">{{ customerData.custIndustry }}</text>
  44. </view>
  45. </u-col>
  46. </u-row>
  47. </view>
  48. <view class="info-item">
  49. <u-row justify="space-between">
  50. <u-col span="7">
  51. <view class="flex_l">
  52. <view class="info-label">所在位置:</view>
  53. <text class="info-txt">{{ customerData.custProvince + '' + customerData.custCity }}</text>
  54. </view>
  55. </u-col>
  56. <u-col span="5">
  57. <view class="flex_l">
  58. <view class="info-label">客户状态:</view>
  59. <text class="info-txt">{{ custStatus[customerData.custStatus] }}</text>
  60. </view>
  61. </u-col>
  62. </u-row>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="tabs">
  67. <u-tabs
  68. @change="changeTabs"
  69. lineWidth="8"
  70. :current="curTabIndex"
  71. lineHeight="8"
  72. :scrollable="false"
  73. :list="list"
  74. :lineColor="`url(${lineBg}) 100% 100%`"
  75. :activeStyle="{
  76. color: '#3E7EF8',
  77. fontWeight: 'bold',
  78. }"
  79. :inactiveStyle="{
  80. color: '#969696',
  81. }"
  82. itemStyle="height: 90rpx;"></u-tabs>
  83. </view>
  84. </view>
  85. <view class="data-list">
  86. <!-- 跟进记录 -->
  87. <follow-records v-if="curTabIndex == 0" ref="follow" :customerId="customerId"></follow-records>
  88. <!-- 详情 -->
  89. <customer-detail v-if="curTabIndex == 1" :detail="customerData" :abstract="abstractDetail"></customer-detail>
  90. <!-- 联系人 -->
  91. <contacts v-if="curTabIndex == 2" :customerId="customerId"></contacts>
  92. </view>
  93. </view>
  94. <!-- 新增按钮 -->
  95. <view class="fixed-btn-group" v-if="!isPublic" :style="{ width: openBtnWidth ? '320rpx' : '90rpx' }">
  96. <view class="flex1" v-if="openBtnWidth">
  97. <view class="btn center" @click="linkToTransfer()">转</view>
  98. <view class="btn center" @click="$refs.moveCust.open(customerId)">公</view>
  99. <view class="btn center" @click="openFollow()">跟</view>
  100. </view>
  101. <view class="btn center" @click="openBtnWidth = !openBtnWidth">
  102. <u-icon name="plus" color="#fff" size="20"></u-icon>
  103. </view>
  104. </view>
  105. <view v-else class="fixed-btn-group">
  106. <view class="btn center" @click.stop="$refs.collection.open(customerId)">领</view>
  107. </view>
  108. <!-- 移入公海 -->
  109. <move-in-open-sea ref="moveCust" @fetchList="goBack()"></move-in-open-sea>
  110. <!-- 领用 -->
  111. <collection-customer ref="collection" @fetchList="goBack()"></collection-customer>
  112. </view>
  113. </template>
  114. <script>
  115. import customerApi from '../../api/customer'
  116. import to from 'await-to-js'
  117. import customerDetail from './components/customerDetail'
  118. import followRecords from './components/followRecords'
  119. import MoveInOpenSea from './components/moveInOpenSea'
  120. import CollectionCustomer from '../openSeaCustomer/components/collectionCustomer'
  121. import Contacts from 'pages/customer/components/contacts'
  122. export default {
  123. name: 'omsIndex',
  124. components: { customerDetail, followRecords, MoveInOpenSea, CollectionCustomer, Contacts },
  125. data() {
  126. return {
  127. openBtnWidth: false,
  128. lineBg: require('../../static/images/up.png'),
  129. curTabIndex: 0,
  130. fllowList: [], //跟进数据
  131. list: [
  132. {
  133. name: '活动记录',
  134. index: 0,
  135. },
  136. {
  137. name: '详细信息',
  138. index: 1,
  139. },
  140. {
  141. name: '联系人',
  142. index: 2,
  143. },
  144. ],
  145. height: '',
  146. paddingTop: '',
  147. customerData: {},
  148. abstractDetail: null,
  149. custStatus: {
  150. 10: '正常',
  151. 20: '异常',
  152. },
  153. customerId: 0, //客户id
  154. isPublic: false,
  155. }
  156. },
  157. onLoad(option) {
  158. this.customerId = parseInt(option.id)
  159. this.isPublic = option.type == 'public'
  160. },
  161. created() {
  162. const navData = uni.getMenuButtonBoundingClientRect()
  163. this.height = navData.height + 'px'
  164. this.paddingTop = navData.top + 'px'
  165. },
  166. onShow() {
  167. this.getCustomerDetail()
  168. this.getAbstractDetail()
  169. },
  170. methods: {
  171. async getCustomerDetail() {
  172. const [err, res] = await to(customerApi.getDetail({ ids: [this.customerId] }))
  173. if (err) return
  174. if (res && res.code == 200) {
  175. console.log(res)
  176. this.customerData = res.data.list[0]
  177. }
  178. },
  179. async getAbstractDetail() {
  180. const [err, res] = await to(customerApi.getAbstract({ id: this.customerId }))
  181. if (err) return
  182. if (res && res.code == 200) {
  183. this.abstractDetail = res.data.list
  184. this.$refs.follow.getRecords()
  185. }
  186. },
  187. // 改变tab
  188. changeTabs(data) {
  189. console.log(data)
  190. this.curTabIndex = data.index
  191. },
  192. // 打开转移
  193. openFollow() {
  194. this.$store.commit('setDetails', this.customerData)
  195. uni.navigateTo({
  196. //保留当前页面,跳转到应用内的某个页面
  197. url: '/pages/publicPages/follow?targetType=10',
  198. })
  199. },
  200. // 跳转到转移客户
  201. linkToTransfer() {
  202. uni.navigateTo({
  203. //保留当前页面,跳转到应用内的某个页面
  204. url: '/pages/customer/transfer?id=' + this.customerId,
  205. })
  206. },
  207. goBack() {
  208. uni.navigateBack({
  209. //关闭当前页面,返回上一页面或多级页面。
  210. delta: 1,
  211. })
  212. },
  213. },
  214. }
  215. </script>
  216. <style>
  217. page {
  218. background: #f2f3f5;
  219. }
  220. </style>
  221. <style lang="scss" scoped>
  222. .home {
  223. padding-top: 200rpx;
  224. .nav {
  225. position: absolute;
  226. left: 0;
  227. top: 0;
  228. width: 100%;
  229. height: 356rpx;
  230. background: #3e7ef8;
  231. border-radius: 0 0 31rpx 31rpx;
  232. .title {
  233. position: relative;
  234. text-align: center;
  235. font-size: 32rpx;
  236. font-weight: bold;
  237. color: #ffffff;
  238. .back {
  239. position: absolute;
  240. top: 0;
  241. bottom: 0;
  242. margin: auto;
  243. left: 70rpx;
  244. display: flex;
  245. }
  246. }
  247. }
  248. .main {
  249. position: absolute;
  250. width: 100%;
  251. height: calc(100vh - 200rpx);
  252. overflow: hidden;
  253. padding-bottom: 64rpx;
  254. .main-top {
  255. padding: 0 32rpx;
  256. }
  257. .customer-box {
  258. width: 100%;
  259. background: #ffffff;
  260. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  261. border-radius: 32rpx;
  262. padding: 22rpx 38rpx 68rpx 40rpx;
  263. .header {
  264. .name {
  265. .img {
  266. width: 46rpx;
  267. height: 46rpx;
  268. border-radius: 50%;
  269. margin-right: 8rpx;
  270. }
  271. text {
  272. font-size: 28rpx;
  273. font-weight: bold;
  274. color: #323232;
  275. }
  276. }
  277. .date {
  278. font-size: 24rpx;
  279. color: #3e7ef8;
  280. }
  281. }
  282. .info {
  283. .info-item {
  284. margin-top: 18rpx;
  285. .info-label {
  286. width: 116rpx;
  287. text-align: left;
  288. font-size: 24rpx;
  289. color: #646464;
  290. }
  291. .info-txt {
  292. flex: 1;
  293. font-size: 24rpx;
  294. color: #323232;
  295. }
  296. }
  297. }
  298. }
  299. .data-list {
  300. margin-top: 16rpx;
  301. width: 100%;
  302. height: calc(100vh - 532rpx);
  303. background: #ffffff;
  304. padding: 32rpx;
  305. overflow: auto;
  306. padding-bottom: 145rpx;
  307. .status1 {
  308. color: #4096fb;
  309. background: rgba(64, 150, 251, 0.2);
  310. }
  311. .status2 {
  312. background: rgba(255, 184, 60, 0.2);
  313. color: #ffb83c;
  314. }
  315. .status3 {
  316. color: #fe6936;
  317. background: rgba(254, 105, 54, 0.2);
  318. }
  319. }
  320. }
  321. .fixed-btn-group {
  322. position: fixed;
  323. display: flex;
  324. justify-content: space-around;
  325. align-items: center;
  326. width: 90rpx;
  327. height: 90rpx;
  328. bottom: 50rpx;
  329. right: 50rpx;
  330. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  331. border-radius: 20px;
  332. transition: all 0.2s;
  333. .btn {
  334. width: 60rpx;
  335. height: 60rpx;
  336. background: #3e7ef8;
  337. border-radius: 50%;
  338. margin: 10rpx;
  339. font-size: 26rpx;
  340. font-weight: bold;
  341. color: #ffffff;
  342. }
  343. }
  344. }
  345. </style>