details.vue 10 KB

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