details.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-04-03 11:50:39
  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">{{ selectDictLabel(industryColumns, 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">{{ customerData.salesName }}</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: {
  123. customerDetail,
  124. followRecords,
  125. MoveInOpenSea,
  126. CollectionCustomer,
  127. Contacts,
  128. },
  129. data() {
  130. return {
  131. openBtnWidth: false,
  132. curTabIndex: 0,
  133. fllowList: [], //跟进数据
  134. list: [
  135. {
  136. name: '跟进记录',
  137. index: 0,
  138. },
  139. {
  140. name: '详细信息',
  141. index: 1,
  142. },
  143. {
  144. name: '联系人',
  145. index: 2,
  146. },
  147. ],
  148. height: '',
  149. paddingTop: '',
  150. customerData: {},
  151. abstractDetail: null,
  152. customerId: 0, //客户id
  153. isPublic: false,
  154. industryColumns: [], //行业
  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.curTabIndex = 0
  168. this.openBtnWidth = false
  169. this.getOptions()
  170. this.getCustomerDetail()
  171. this.getAbstractDetail()
  172. },
  173. methods: {
  174. getOptions() {
  175. Promise.all([
  176. this.getDicts('cust_idy'), //行业
  177. ])
  178. .then(([industry]) => {
  179. this.industryColumns = industry.data.values || []
  180. })
  181. .catch((err) => console.log(err))
  182. },
  183. async getCustomerDetail() {
  184. const [err, res] = await to(
  185. customerApi.getDetail({
  186. ids: [this.customerId],
  187. })
  188. )
  189. if (err) return
  190. if (res && res.code == 200) {
  191. this.customerData = res.data.list[0]
  192. }
  193. },
  194. async getAbstractDetail() {
  195. const [err, res] = await to(
  196. customerApi.getAbstract({
  197. id: this.customerId,
  198. })
  199. )
  200. if (err) return
  201. if (res && res.code == 200) {
  202. this.abstractDetail = res.data.list
  203. this.$refs.follow.getRecords()
  204. }
  205. },
  206. // 改变tab
  207. changeTabs(data) {
  208. this.curTabIndex = data.index
  209. },
  210. // 打开转移
  211. openFollow() {
  212. this.$store.commit('setDetails', this.customerData)
  213. uni.navigateTo({
  214. //保留当前页面,跳转到应用内的某个页面
  215. url: '/pages/publicPages/follow?targetType=10&id=' + this.customerData.id,
  216. })
  217. },
  218. // 跳转到转移客户
  219. linkToTransfer() {
  220. uni.navigateTo({
  221. //保留当前页面,跳转到应用内的某个页面
  222. url: '/pages/customer/transfer?id=' + this.customerId,
  223. })
  224. },
  225. // 跳转到创建项目
  226. linkToProject() {
  227. uni.navigateTo({
  228. //保留当前页面,跳转到应用内的某个页面
  229. url: '/pages/project/create?id=' + this.customerId,
  230. })
  231. },
  232. linkToConcat() {
  233. uni.navigateTo({
  234. //保留当前页面,跳转到应用内的某个页面
  235. url: '/pages/publicPages/concatCreate?id=' + this.customerId + '&name=' + this.customerData.custName,
  236. })
  237. },
  238. goBack() {
  239. uni.navigateBack({
  240. //关闭当前页面,返回上一页面或多级页面。
  241. delta: 1,
  242. })
  243. },
  244. },
  245. }
  246. </script>
  247. <style>
  248. page {
  249. background: #f2f3f5;
  250. }
  251. </style>
  252. <style lang="scss" scoped>
  253. .home {
  254. padding-top: 200rpx;
  255. .nav {
  256. position: absolute;
  257. left: 0;
  258. top: 0;
  259. width: 100%;
  260. height: 356rpx;
  261. background: #3e7ef8;
  262. border-radius: 0 0 31rpx 31rpx;
  263. .title {
  264. position: relative;
  265. text-align: center;
  266. font-size: 32rpx;
  267. font-weight: bold;
  268. color: #ffffff;
  269. .back {
  270. position: absolute;
  271. top: 0;
  272. bottom: 0;
  273. margin: auto;
  274. left: 70rpx;
  275. display: flex;
  276. }
  277. }
  278. }
  279. .main {
  280. position: absolute;
  281. width: 100%;
  282. height: calc(100vh - 200rpx);
  283. overflow: hidden;
  284. padding-bottom: 64rpx;
  285. .main-top {
  286. padding: 0 32rpx;
  287. }
  288. .customer-box {
  289. width: 100%;
  290. background: #ffffff;
  291. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  292. border-radius: 32rpx;
  293. padding: 22rpx 38rpx 68rpx 40rpx;
  294. .header {
  295. .name {
  296. .img {
  297. width: 46rpx;
  298. height: 46rpx;
  299. border-radius: 50%;
  300. margin-right: 8rpx;
  301. }
  302. text {
  303. font-size: 28rpx;
  304. font-weight: bold;
  305. color: #323232;
  306. }
  307. }
  308. .date {
  309. font-size: 24rpx;
  310. color: #3e7ef8;
  311. }
  312. }
  313. .info {
  314. .info-item {
  315. margin-top: 18rpx;
  316. .info-label {
  317. width: 116rpx;
  318. text-align: left;
  319. font-size: 24rpx;
  320. color: #646464;
  321. }
  322. .info-txt {
  323. flex: 1;
  324. font-size: 24rpx;
  325. color: #323232;
  326. }
  327. }
  328. }
  329. }
  330. .data-list {
  331. margin-top: 16rpx;
  332. width: 100%;
  333. height: calc(100vh - 532rpx);
  334. background: #ffffff;
  335. padding: 32rpx;
  336. overflow: auto;
  337. padding-bottom: 145rpx;
  338. .status1 {
  339. color: #4096fb;
  340. background: rgba(64, 150, 251, 0.2);
  341. }
  342. .status2 {
  343. background: rgba(255, 184, 60, 0.2);
  344. color: #ffb83c;
  345. }
  346. .status3 {
  347. color: #fe6936;
  348. background: rgba(254, 105, 54, 0.2);
  349. }
  350. }
  351. }
  352. .fixed-btn-group {
  353. position: fixed;
  354. display: flex;
  355. justify-content: space-around;
  356. align-items: center;
  357. width: 90rpx;
  358. height: 90rpx;
  359. bottom: 50rpx;
  360. right: 50rpx;
  361. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  362. border-radius: 20px;
  363. transition: all 0.2s;
  364. background: #fff;
  365. .btn {
  366. width: 60rpx;
  367. height: 60rpx;
  368. background: #3e7ef8;
  369. border-radius: 50%;
  370. margin: 10rpx;
  371. font-size: 26rpx;
  372. font-weight: bold;
  373. color: #ffffff;
  374. }
  375. }
  376. }
  377. </style>