details.vue 11 KB

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