detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <div class="detail">
  3. <div class="side-layout">
  4. <div class="info">
  5. <div class="title">
  6. <p>经销商</p>
  7. <h3>
  8. {{ detail.distName }}
  9. <el-button @click="handleFollow">添加跟进</el-button>
  10. </h3>
  11. </div>
  12. <header>
  13. <el-descriptions :colon="false" :column="6" direction="vertical" style="padding-top: 15px">
  14. <el-descriptions-item content-class-name="my-content" label="所在省" label-class-name="my-label">
  15. {{ detail.provinceDesc }}
  16. </el-descriptions-item>
  17. <el-descriptions-item content-class-name="my-content" label="现有销售人数" label-class-name="my-label">
  18. {{ detail.saleNum }}
  19. </el-descriptions-item>
  20. <el-descriptions-item content-class-name="my-content" label="ABC项目总数量" label-class-name="my-label">
  21. {{ detail.projectNum }}
  22. </el-descriptions-item>
  23. <el-descriptions-item content-class-name="my-content" label="成交项目数量" label-class-name="my-label">
  24. {{ detail.saledProjectNum }}
  25. </el-descriptions-item>
  26. <el-descriptions-item content-class-name="my-content" label="成交总金额" label-class-name="my-label">
  27. {{ formatPrice(detail.saledAmount) }}
  28. </el-descriptions-item>
  29. <el-descriptions-item content-class-name="my-content" label="归属人员" label-class-name="my-label">
  30. {{ detail.belongSale }}
  31. </el-descriptions-item>
  32. </el-descriptions>
  33. </header>
  34. <el-tabs v-model="activeName">
  35. <el-tab-pane label="详细信息" name="details">
  36. <el-descriptions border :column="2" size="medium" title="经销商详情">
  37. <el-descriptions-item content-class-name="my-content" label="经销商名称" label-class-name="my-label">
  38. {{ detail.distName }}
  39. </el-descriptions-item>
  40. <el-descriptions-item content-class-name="my-content" label="助记名称" label-class-name="my-label">
  41. {{ detail.abbrName }}
  42. </el-descriptions-item>
  43. <el-descriptions-item content-class-name="my-content" label="业务范围" label-class-name="my-label">
  44. {{ detail.businessScope }}
  45. </el-descriptions-item>
  46. <el-descriptions-item content-class-name="my-content" label="注册资金" label-class-name="my-label">
  47. {{ detail.capital }}万元
  48. </el-descriptions-item>
  49. <el-descriptions-item content-class-name="my-content" label="注册地" label-class-name="my-label">
  50. {{ detail.registerDistrict }}
  51. </el-descriptions-item>
  52. <el-descriptions-item content-class-name="my-content" label="授权客户类型" label-class-name="my-label">
  53. {{ setCustomerType(detail.customerType) }}
  54. </el-descriptions-item>
  55. <el-descriptions-item
  56. content-class-name="my-content"
  57. label="ABC项目出货总金额"
  58. label-class-name="my-label">
  59. {{ formatPrice(detail.allProductAmount) }}
  60. </el-descriptions-item>
  61. <el-descriptions-item content-class-name="my-content" label="未回款金额" label-class-name="my-label">
  62. {{ formatPrice(detail.unpaidAmount) }}
  63. </el-descriptions-item>
  64. <el-descriptions-item
  65. content-class-name="my-content"
  66. label="已有代理品牌和产品"
  67. label-class-name="my-label">
  68. {{ detail.existedProduct }}
  69. </el-descriptions-item>
  70. <el-descriptions-item
  71. content-class-name="my-content"
  72. label="历史合作终端客户名称"
  73. label-class-name="my-label">
  74. {{ detail.historyCustomer }}
  75. </el-descriptions-item>
  76. <el-descriptions-item content-class-name="my-content" label="归属销售" label-class-name="my-label">
  77. {{ detail.belongSale }}
  78. </el-descriptions-item>
  79. <el-descriptions-item content-class-name="my-content" label="销售人数" label-class-name="my-label">
  80. {{ detail.saleNum }}
  81. </el-descriptions-item>
  82. <el-descriptions-item content-class-name="my-content" label="创建时间" label-class-name="my-label">
  83. {{ parseTime(detail.createdTime, '{y}-{m}-{d}') }}
  84. </el-descriptions-item>
  85. <el-descriptions-item content-class-name="my-content" label="更新时间" label-class-name="my-label">
  86. {{ parseTime(detail.updatedTime, '{y}-{m}-{d}') }}
  87. </el-descriptions-item>
  88. </el-descriptions>
  89. </el-tab-pane>
  90. <el-tab-pane label="跟进记录" name="follow">
  91. <follow v-if="activeName == 'follow'" ref="followEl" target-type="50" />
  92. </el-tab-pane>
  93. <el-tab-pane label="联系人" name="contacts">
  94. <contacts v-if="activeName == 'contacts'" @initRecords="getRecord" />
  95. </el-tab-pane>
  96. <el-tab-pane label="项目记录" name="projectRecords">
  97. <project-records v-if="activeName == 'projectRecords'" />
  98. </el-tab-pane>
  99. <el-tab-pane label="合同记录" name="contractRecords">
  100. <contract-records v-if="activeName == 'contractRecords'" />
  101. </el-tab-pane>
  102. <el-tab-pane label="历史代理记录" name="historyProxy">
  103. <history-proxy v-if="activeName == 'historyProxy'" />
  104. </el-tab-pane>
  105. <el-tab-pane label="协访记录" name="visit">
  106. <visit v-if="activeName == 'visit'" ref="followEl" target-type="50" />
  107. </el-tab-pane>
  108. </el-tabs>
  109. </div>
  110. <div class="info-side">
  111. <div class="buttons">
  112. <!-- <el-button v-permissions="['contract:manage:edit']" type="primary" @click="handleEdit">编辑</el-button>
  113. <el-button v-permissions="['contract:manage:delete']" @click="handleDelete">删除</el-button> -->
  114. <el-button @click="back">返回</el-button>
  115. </div>
  116. <details-records :dynamics-list="dynamicsList" />
  117. </div>
  118. </div>
  119. <!-- 添加跟进记录 -->
  120. <follow-add ref="follow-add" @fetch-data="getFollowData" />
  121. </div>
  122. </template>
  123. <script>
  124. import to from 'await-to-js'
  125. import { mapGetters } from 'vuex'
  126. import api from '@/api/base/distr'
  127. import Contacts from '../components/Contacts.vue'
  128. import ProjectRecords from '../components/ProjectRecords'
  129. import ContractRecords from '../components/ContractRecords'
  130. import HistoryProxy from '../components/HistoryProxy'
  131. import DetailsRecords from './components/DetailsRecords'
  132. import Follow from '../components/Follow'
  133. import Visit from '../components/Visit'
  134. import FollowAdd from '@/views/proj/business/components/FollowAdd'
  135. export default {
  136. name: 'DistributorDetail',
  137. components: { DetailsRecords, Contacts, ProjectRecords, ContractRecords, HistoryProxy, Follow, FollowAdd, Visit },
  138. data() {
  139. return {
  140. id: 0,
  141. privateCus: '',
  142. list: [],
  143. activeName: 'details',
  144. detail: {
  145. distCode: '', //经销商编码
  146. distName: '', //经销商名称
  147. abbrName: '', //助记名
  148. distBoss: '', //负责人
  149. distBossPhone: '', //负责人电话
  150. belongSale: '', //销售人
  151. provinceDesc: '', //归属省份
  152. businessScope: '', //业务范围
  153. createdName: '', //创建人名字
  154. createdTime: '', //创建时间
  155. },
  156. customerOptions: [],
  157. dynamicsList: [],
  158. }
  159. },
  160. computed: {
  161. ...mapGetters({
  162. avatar: 'user/avatar',
  163. username: 'user/username',
  164. }),
  165. },
  166. mounted() {
  167. this.id = parseInt(this.$route.query.id)
  168. this.privateCus = this.$route.query.privateCus
  169. this.init()
  170. this.getOptions()
  171. this.getRecord()
  172. //this.getDynamics()
  173. },
  174. methods: {
  175. getFollowData() {
  176. if (this.activeName == 'follow') {
  177. this.$refs.followEl.getFollowList()
  178. }
  179. },
  180. // 添加跟进记录
  181. handleFollow() {
  182. this.followup = {
  183. targetId: this.detail.id,
  184. targetType: '50',
  185. targetName: this.detail.distName,
  186. }
  187. let tilte = '经销商联系人'
  188. console.log(this.followup)
  189. this.$refs['follow-add'].showEdit(this.followup, tilte)
  190. },
  191. setCustomerType(type) {
  192. if (this.customerOptions.length == 0) return
  193. if (!type) return
  194. let arr = []
  195. let typeArr = type.split(',')
  196. typeArr.map((item) => {
  197. arr.push(this.customerOptions.find((e) => e.key == item).value)
  198. })
  199. return arr.join(',')
  200. },
  201. getOptions() {
  202. Promise.all([this.getDicts('cust_idy')])
  203. .then(([data]) => {
  204. this.customerOptions = data.data.values
  205. // data.data.values.filter((i) => {
  206. // this.customerOptions[i.key] = i.value
  207. // })
  208. })
  209. .catch((err) => console.log(err))
  210. },
  211. async init() {
  212. Promise.all([api.getEntity({ id: this.id })]).then(([detail]) => {
  213. console.log('detail', detail)
  214. this.detail = detail.data.list
  215. })
  216. },
  217. async getRecord() {
  218. const [err, res] = await to(api.getDynamicsList({ distId: this.id }))
  219. if (err) return
  220. if (res.data.list) {
  221. let obj = res.data.list
  222. const keys = Object.keys(obj).reverse()
  223. let records = {}
  224. for (const item of keys) {
  225. records[item] = obj[item]
  226. }
  227. this.dynamicsList = records
  228. }
  229. },
  230. setSelectRows(val) {
  231. this.selectRows = val
  232. },
  233. back() {
  234. this.$router.go(-1)
  235. },
  236. },
  237. }
  238. </script>
  239. <style lang="scss" scoped>
  240. $base: '.detail';
  241. #{$base} {
  242. height: calc(100vh - 60px - 12px * 2 - 40px);
  243. display: flex;
  244. padding: 20px 40px;
  245. > .el-row {
  246. flex: 1;
  247. > .el-col {
  248. height: 100%;
  249. }
  250. }
  251. .title {
  252. p,
  253. h3 {
  254. margin: 0;
  255. }
  256. p {
  257. font-size: 14px;
  258. font-weight: 400;
  259. line-height: 22px;
  260. }
  261. h3 {
  262. font-size: 24px;
  263. font-weight: 500;
  264. line-height: 36px;
  265. color: #333;
  266. display: flex;
  267. justify-content: space-between;
  268. }
  269. }
  270. header {
  271. height: 74px;
  272. background: rgba(196, 196, 196, 0.5);
  273. border-radius: 4px;
  274. display: flex;
  275. align-items: center;
  276. padding: 0 20px;
  277. margin-top: 16px;
  278. ::v-deep .el-descriptions__body {
  279. background: transparent;
  280. }
  281. ::v-deep .my-label {
  282. font-size: 14px;
  283. font-weight: 600;
  284. color: #1d66dc;
  285. }
  286. ::v-deep .my-content {
  287. font-size: 14px;
  288. font-weight: 600;
  289. color: #333;
  290. white-space: nowrap;
  291. overflow: hidden;
  292. text-overflow: ellipsis;
  293. }
  294. }
  295. .el-tabs {
  296. height: calc(100% - 148px);
  297. display: flex;
  298. flex-direction: column;
  299. ::v-deep .el-tabs__content {
  300. flex: 1;
  301. .el-tab-pane {
  302. height: 100%;
  303. }
  304. }
  305. }
  306. .buttons {
  307. padding-top: 28px;
  308. text-align: right;
  309. }
  310. .records {
  311. margin: 0;
  312. padding: 10px 20px;
  313. list-style: none;
  314. height: calc(100% - 60px);
  315. overflow-y: auto;
  316. > li {
  317. display: flex;
  318. & + li {
  319. margin-top: 10px;
  320. }
  321. }
  322. .date {
  323. width: 100px;
  324. display: flex;
  325. flex-direction: column;
  326. align-items: center;
  327. h2,
  328. h3 {
  329. margin: 0;
  330. }
  331. h2 {
  332. font-size: 26px;
  333. line-height: 32px;
  334. }
  335. }
  336. .content {
  337. flex: 1;
  338. list-style: none;
  339. li {
  340. display: flex;
  341. & + li {
  342. margin-top: 10px;
  343. }
  344. }
  345. .user-avatar {
  346. font-size: 40px;
  347. }
  348. .text {
  349. flex: 1;
  350. padding-left: 20px;
  351. p {
  352. font-weight: 500;
  353. margin: 0;
  354. line-height: 20px;
  355. span {
  356. color: #1d66dc;
  357. }
  358. }
  359. p:nth-child(2) {
  360. margin-bottom: 10px;
  361. }
  362. .action {
  363. font-weight: bold;
  364. color: #333;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. .height-enter-active,
  371. .height-leave-active {
  372. transition: all 0.5s;
  373. }
  374. .height-enter-to,
  375. .height-leave {
  376. height: 200px;
  377. }
  378. .height-enter,
  379. .height-leave-to
  380. /* .fade-leave-active below version 2.1.8 */ {
  381. height: 0;
  382. }
  383. </style>