detail.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. <!--
  2. * @Author: wanglj 471442253@qq.com
  3. * @Date: 2022-12-26 09:30:47
  4. * @LastEditors: wanglj
  5. * @LastEditTime: 2023-01-13 14:36:06
  6. * @Description: file content
  7. * @FilePath: \opms_frontend\src\views\customer\detail.vue
  8. -->
  9. <template>
  10. <div class="detail">
  11. <div class="side-layout">
  12. <div class="info">
  13. <div class="title">
  14. <p>客户</p>
  15. <h3>
  16. {{ detail.custName }}
  17. <div>
  18. <span v-show="detail.salesId > 0">
  19. <el-button v-permissions="['cust:list:shift']" @click="handleShift">转移客户</el-button>
  20. <el-button v-permissions="['cust:list:open']" @click="handleToOpen">移入公海</el-button>
  21. <el-button v-permissions="['cust:list:project']" @click="handleBusiness">创建项目</el-button>
  22. </span>
  23. <span v-show="detail.salesId == 0">
  24. <el-button v-permissions="['cust:open:receive']" @click="handleReceive">领取客户</el-button>
  25. <el-button v-permissions="['cust:open:allocate']" @click="handleAllocate">分配客户</el-button>
  26. </span>
  27. </div>
  28. </h3>
  29. </div>
  30. <header>
  31. <el-descriptions :colon="false" :column="6" direction="vertical">
  32. <el-descriptions-item content-class-name="my-content" label="客户编码" label-class-name="my-label">
  33. {{ detail.custCode }}
  34. </el-descriptions-item>
  35. <el-descriptions-item content-class-name="my-content" label="助记名" label-class-name="my-label">
  36. {{ detail.abbrName }}
  37. </el-descriptions-item>
  38. <el-descriptions-item content-class-name="my-content" label="客户级别" label-class-name="my-label">
  39. {{ selectDictLabel(levelOptions, detail.custLevel) }}
  40. </el-descriptions-item>
  41. <el-descriptions-item content-class-name="my-content" label="客户类型" label-class-name="my-label">
  42. {{ selectDictLabel(industryOptions, detail.custIndustry) }}
  43. </el-descriptions-item>
  44. <!-- <el-descriptions-item content-class-name="my-content" label="客户状态" label-class-name="my-label">
  45. {{ detail.custStatus == 10 ? '正常' : '异常' }}
  46. </el-descriptions-item> -->
  47. <el-descriptions-item content-class-name="my-content" label="最后跟进时间" label-class-name="my-label">
  48. {{ parseTime(detail.followUpDate, '{y}-{m}-{d} {h}:{i}') }}
  49. </el-descriptions-item>
  50. </el-descriptions>
  51. </header>
  52. <el-tabs v-model="activeName" @tab-click="handleClick">
  53. <el-tab-pane label="详细信息" name="detail">
  54. <el-descriptions
  55. border
  56. :column="2"
  57. :content-style="{ width: '25%', 'word-break': 'break-all' }"
  58. :label-style="{ width: '25%' }"
  59. size="medium">
  60. <el-descriptions-item label="客户级别">
  61. {{ selectDictLabel(levelOptions, detail.custLevel) }}
  62. </el-descriptions-item>
  63. <el-descriptions-item label="下次联系时间">
  64. {{ detail.followUpDate }}
  65. </el-descriptions-item>
  66. <el-descriptions-item label="所在省">
  67. {{ detail.custProvince }}
  68. </el-descriptions-item>
  69. <el-descriptions-item label="所在市">
  70. {{ detail.custCity }}
  71. </el-descriptions-item>
  72. <el-descriptions-item label="所在区">
  73. {{ detail.custRegion }}
  74. </el-descriptions-item>
  75. <el-descriptions-item label="详细地址">
  76. {{ detail.custAddress }}
  77. </el-descriptions-item>
  78. <el-descriptions-item label="创建人">
  79. {{ detail.createdName }}
  80. </el-descriptions-item>
  81. <el-descriptions-item label="创建时间">
  82. {{ detail.createdTime }}
  83. </el-descriptions-item>
  84. <el-descriptions-item label="跟进次数">
  85. {{ abstract.followContent }}
  86. </el-descriptions-item>
  87. <el-descriptions-item label="未跟进时长">
  88. {{ abstract.notFollowDay }}
  89. </el-descriptions-item>
  90. <el-descriptions-item label="项目数量">
  91. {{ abstract.business }}
  92. </el-descriptions-item>
  93. <el-descriptions-item label="项目总额">
  94. {{ formatPrice(abstract.businessTotal) }}
  95. </el-descriptions-item>
  96. <el-descriptions-item label="成交次数">
  97. {{ abstract.dealCotal }}
  98. </el-descriptions-item>
  99. <el-descriptions-item label="成交总额">
  100. {{ formatPrice(abstract.dealTotal) }}
  101. </el-descriptions-item>
  102. <el-descriptions-item label="回款总额">
  103. {{ formatPrice(abstract.paymentTotal) }}
  104. </el-descriptions-item>
  105. <el-descriptions-item label="未回款总额">
  106. {{ formatPrice(abstract.notPaymentTotal) }}
  107. </el-descriptions-item>
  108. <el-descriptions-item label="开票总额" :span="24">
  109. {{ formatPrice(abstract.drawTotal) }}
  110. </el-descriptions-item>
  111. <el-descriptions-item label="备注" :span="24">
  112. {{ detail.remark }}
  113. </el-descriptions-item>
  114. </el-descriptions>
  115. </el-tab-pane>
  116. <el-tab-pane label="跟进记录" name="follow">
  117. <ul v-if="followList.length" class="follow">
  118. <li v-for="(date, index) in followList" :key="index">
  119. <div class="date">
  120. <h2>{{ date.followDay.split('-')[2] }}</h2>
  121. <h3>
  122. {{ date.followDay.split('-').splice(0, 2).join('.') }}
  123. </h3>
  124. </div>
  125. <ul class="content">
  126. <li v-for="(item, idx) in date.followupList" :key="idx">
  127. <!-- <el-avatar class="user-avatar"
  128. :src="avatar" />-->
  129. <div class="text-container">
  130. <vab-icon class="user-avatar" icon="account-circle-fill" />
  131. <div class="text">
  132. <p class="action">
  133. <span>{{ item.createdName }} 跟进({{ formatType(item.followType) }})</span>
  134. <span>
  135. <vab-icon icon="time-line" />
  136. {{ item.followDate }}
  137. </span>
  138. </p>
  139. <p>{{ item.followContent }}</p>
  140. <div class="footer">
  141. <p>
  142. 来自客户:
  143. <span>{{ item.custName }}</span>
  144. </p>
  145. <div>
  146. <el-button size="mini" @click="showDetail(item)">
  147. <vab-icon icon="arrow-right-circle-fill" />
  148. 详情
  149. </el-button>
  150. <el-button size="mini" @click="showComment(item)">评论({{ item.commentNumber }})</el-button>
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. <transition name="height">
  156. <ul v-if="item.showComment" class="comments">
  157. <li v-for="comment in item.comments" :key="comment.id">
  158. <vab-icon class="user-avatar" icon="account-circle-fill" />
  159. <div class="text">
  160. <p>{{ comment.createdName }}</p>
  161. <p>{{ comment.content }}</p>
  162. <p>{{ comment.createdTime }}</p>
  163. </div>
  164. </li>
  165. </ul>
  166. </transition>
  167. </li>
  168. </ul>
  169. </li>
  170. </ul>
  171. <div v-else class="no-follow">暂无跟进记录</div>
  172. </el-tab-pane>
  173. <el-tab-pane label="联系人" name="contact">
  174. <vab-query-form>
  175. <vab-query-form-left-panel :span="12">
  176. <el-input
  177. v-model="cuctName"
  178. placeholder="请输入单据名称/编号"
  179. prefix-icon="el-icon-search"
  180. style="width: 50%"
  181. @blur="handleClick({ name: 'contact' })"
  182. @keyup.enter.native="handleClick({ name: 'contact' })" />
  183. </vab-query-form-left-panel>
  184. <vab-query-form-right-panel :span="12">
  185. <el-button v-permissions="['cust:detail:contact:add']" icon="el-icon-plus" @click="addContact">
  186. 新建联系人
  187. </el-button>
  188. </vab-query-form-right-panel>
  189. </vab-query-form>
  190. <el-table border :data="contactList" height="calc(100% - 42px)" @selection-change="setSelectRows">
  191. <el-table-column align="center" type="selection" />
  192. <el-table-column align="center" label="姓名" prop="cuctName" />
  193. <el-table-column align="center" label="岗位" prop="postion" />
  194. <el-table-column align="center" label="电话" prop="telephone" />
  195. <el-table-column align="center" label="微信" prop="wechat" />
  196. <el-table-column align="center" label="邮箱" prop="email" />
  197. <el-table-column align="center" label="是否决策人">
  198. <template slot-scope="scope">
  199. <el-switch v-model="scope.row.isDecision" active-value="10" disabled inactive-value="20" />
  200. </template>
  201. </el-table-column>
  202. <el-table-column align="center" label="操作">
  203. <template slot-scope="scope">
  204. <el-button v-permissions="['cust:deatil:contact:edit']" type="text" @click="contactEdit(scope.row)">
  205. 编辑
  206. </el-button>
  207. <el-button v-permissions="['cust:detail:contact:delete']" type="text" @click="contactDel(scope.row)">
  208. 删除
  209. </el-button>
  210. </template>
  211. </el-table-column>
  212. </el-table>
  213. </el-tab-pane>
  214. <el-tab-pane label="项目记录" name="item">
  215. <el-table border :data="items" height="calc(100% - 42px)">
  216. <el-table-column align="center" label="项目编号" prop="nboCode" width="120px" />
  217. <el-table-column align="center" label="项目名称" prop="nboName" width="200px" />
  218. <el-table-column align="center" label="审批状态" prop="approStatus" width="120px">
  219. <template slot-scope="scope">
  220. {{ getStatus(scope.row.approStatus) }}
  221. </template>
  222. </el-table-column>
  223. <!-- <el-table-column align="center" label="项目类别" prop="nboType" width="80px" />-->
  224. <!-- <el-table-column align="center" label="产品线" prop="productLine" width="120px" />-->
  225. <el-table-column align="center" label="经销商/代理商" prop="distributorName" width="200px" />
  226. <el-table-column align="center" label="项目预算(万元)" prop="nboBudget" width="120px" />
  227. <el-table-column align="center" label="项目备案时间" prop="filingTime" width="160px" />
  228. <!-- <el-table-column align="center" label="项目来源" prop="nboSource" width="160px" />-->
  229. <!-- <el-table-column align="center" label="销售模式" prop="salesModel" width="160px" />-->
  230. <el-table-column align="center" label="最后跟进时间" prop="finalFollowTime" width="160px" />
  231. <el-table-column align="center" label="下次跟进时间" prop="nextFollowTime " width="160px" />
  232. </el-table>
  233. </el-tab-pane>
  234. <el-tab-pane label="合同记录" name="contract">
  235. <el-table border :data="contracts" height="calc(100% - 42px)">
  236. <el-table-column align="center" label="合同编号" prop="contractCode" width="320px" />
  237. <el-table-column align="center" label="合同名称" prop="contractName" width="200px" />
  238. <el-table-column align="center" label="项目名称" prop="nboName" width="320px" />
  239. <el-table-column align="center" label="审批状态" prop="approStatus" width="120px">
  240. <template slot-scope="scope">
  241. {{ getStatus(scope.row.approStatus) }}
  242. </template>
  243. </el-table-column>
  244. <el-table-column align="center" label="合同类型" prop="contractType" width="120px" />
  245. <el-table-column align="center" label="合同金额" prop="contractAmount" width="120px" />
  246. <el-table-column align="center" label="负责人" prop="inchargeName" width="120px" />
  247. <el-table-column align="center" label="公司签约人" prop="signatoryName" width="140px" />
  248. <el-table-column align="center" label="经销商" prop="distributorName" width="320px" />
  249. </el-table>
  250. </el-tab-pane>
  251. <el-tab-pane label="工单记录" name="worksheet">工单记录</el-tab-pane>
  252. <el-tab-pane label="归属记录" name="belong">
  253. <el-table border :data="belongs" height="calc(100% - 42px)">
  254. <el-table-column align="center" label="归属销售" prop="saleName" />
  255. <el-table-column align="center" label="原来归属" prop="origSaleName" />
  256. <el-table-column align="center" label="操作方式" prop="opnType">
  257. <template slot-scope="scope">
  258. <el-tag v-if="scope.row.opnType == 10">分配</el-tag>
  259. <el-tag v-else-if="scope.row.opnType == 20">转移</el-tag>
  260. <el-tag v-else-if="scope.row.opnType == 30">领取</el-tag>
  261. <el-tag v-else-if="scope.row.opnType == 40">合并</el-tag>
  262. </template>
  263. </el-table-column>
  264. <el-table-column align="center" label="操作人" prop="createdName" />
  265. <el-table-column align="center" label="操作时间" min-width="160px" prop="opnDatetime" />
  266. <el-table-column align="center" label="开始时间" min-width="160px" prop="startDate" />
  267. <el-table-column align="center" label="结束时间" min-width="160px" prop="endDate" />
  268. <el-table-column align="center" label="备注" prop="remark" />
  269. </el-table>
  270. </el-tab-pane>
  271. <el-tab-pane label="招标记录" name="bid">
  272. <vab-query-form>
  273. <vab-query-form-left-panel :span="12">
  274. <el-input
  275. v-model="bidSearchText"
  276. placeholder="招标产品名称/招标信息标题/中标单位"
  277. prefix-icon="el-icon-search"
  278. style="width: 50%"
  279. @blur="handleClick({ name: 'bid' })"
  280. @keyup.enter.native="handleClick({ name: 'bid' })" />
  281. </vab-query-form-left-panel>
  282. <vab-query-form-right-panel :span="12">
  283. <el-button icon="el-icon-plus" @click="addBid">新建招标记录</el-button>
  284. </vab-query-form-right-panel>
  285. </vab-query-form>
  286. <el-table border :data="bidlist" height="calc(100% - 42px)">
  287. <el-table-column align="center" label="客户名称" prop="cuctName" width="120px" />
  288. <el-table-column align="center" label="招标产品名称" prop="productName" width="120px" />
  289. <el-table-column align="center" label="发布招标日期" prop="publishedTime" width="160px" />
  290. <el-table-column align="center" label="项目预算" prop="budget" width="120px" />
  291. <el-table-column align="center" label="招标信息标题" prop="title" width="120px" />
  292. <el-table-column align="center" label="信息分类" prop="infoType" width="120px">
  293. <template #default="{ row }">
  294. {{ bidInfoTypeOptions[row.infoType] }}
  295. </template>
  296. </el-table-column>
  297. <el-table-column align="center" label="中标单位" prop="bidder" width="120px" />
  298. <el-table-column align="center" label="备注" prop="remark" width="120px" />
  299. <el-table-column align="center" fixed="right" label="操作" width="90px">
  300. <template slot-scope="scope">
  301. <el-button type="text" @click="bidEdit(scope.row)">编辑</el-button>
  302. <el-button type="text" @click="bidDel(scope.row)">删除</el-button>
  303. </template>
  304. </el-table-column>
  305. </el-table>
  306. </el-tab-pane>
  307. <el-tab-pane label="开票抬头" name="invoiceHeader">
  308. <vab-query-form>
  309. <vab-query-form-left-panel :span="12">
  310. <el-input
  311. v-model="invoiceHeaderSearchText"
  312. placeholder="客户名称/公司名称/纳税人识别号"
  313. prefix-icon="el-icon-search"
  314. style="width: 50%"
  315. @blur="handleClick({ name: 'invoiceHeader' })"
  316. @keyup.enter.native="handleClick({ name: 'invoiceHeader' })" />
  317. </vab-query-form-left-panel>
  318. <vab-query-form-right-panel :span="12">
  319. <el-button icon="el-icon-plus" @click="addInvoiceHeader">新建开票抬头</el-button>
  320. </vab-query-form-right-panel>
  321. </vab-query-form>
  322. <el-table border :data="invoiceHeaderList" height="calc(100% - 42px)">
  323. <el-table-column align="center" label="客户名称" prop="cuctName" width="120px" />
  324. <el-table-column align="center" label="公司名称" prop="companyName" width="120px" />
  325. <el-table-column align="center" label="纳税人识别号" prop="taxNo" width="120px" />
  326. <el-table-column align="center" label="地址" prop="address" width="120px" />
  327. <el-table-column align="center" label="开户行及账号" prop="bankNo" width="120px" />
  328. <el-table-column align="center" label="备注" prop="remark" width="120px" />
  329. <el-table-column align="center" fixed="right" label="操作" width="90px">
  330. <template slot-scope="scope">
  331. <el-button type="text" @click="invoiceHeaderEdit(scope.row)">编辑</el-button>
  332. <el-button type="text" @click="invoiceHeaderDel(scope.row)">删除</el-button>
  333. </template>
  334. </el-table-column>
  335. </el-table>
  336. </el-tab-pane>
  337. </el-tabs>
  338. </div>
  339. <div class="info-side">
  340. <div class="buttons">
  341. <el-button v-if="checkPermi('edit')" type="primary" @click="handleEdit">编辑</el-button>
  342. <el-button v-if="checkPermi('delete')" @click="handleDelete">删除</el-button>
  343. <el-button @click="$router.go(-1)">返回</el-button>
  344. </div>
  345. <ul class="records">
  346. <li v-for="(value, key) in records" :key="key">
  347. <div class="date">
  348. <h2>{{ key.split('-')[2] }}</h2>
  349. <h3>{{ key.split('-').splice(0, 2).join('.') }}</h3>
  350. </div>
  351. <ul class="content">
  352. <li v-for="(item, index) in records[key]" :key="index">
  353. <!-- <el-avatar class="user-avatar"
  354. :src="avatar" /> -->
  355. <vab-icon class="user-avatar" icon="account-circle-fill" />
  356. <div class="text">
  357. <p class="action">{{ item.opnPeople }} {{ item.opnType }}</p>
  358. <p>{{ item.opnDate }}</p>
  359. <p v-if="item.opnContent.custName">
  360. 客户名称:
  361. <span>{{ item.opnContent.custName }}</span>
  362. </p>
  363. <template v-else-if="item.opnContent.cuctName">
  364. <p>
  365. 联系人名称:
  366. <span>{{ item.opnContent.cuctName }}</span>
  367. </p>
  368. <p>职务:{{ item.opnContent.postion }}</p>
  369. <p>手机:{{ item.opnContent.telephone }}</p>
  370. </template>
  371. </div>
  372. </li>
  373. </ul>
  374. </li>
  375. </ul>
  376. </div>
  377. </div>
  378. <Contact ref="contact" @contactSave="contactSave" />
  379. <Edit ref="edit" @customerSave="customerSave" />
  380. <!-- 分配客户 -->
  381. <Allocate ref="allocate" @refresh="back" />
  382. <!-- 转移客户 -->
  383. <Shift ref="shift" @refresh="back" />
  384. <!-- 移入公海 -->
  385. <ToOpen ref="toOpen" @refresh="backToOpen" />
  386. <!-- 跟进详情 -->
  387. <FollowDetail ref="followDetail" />
  388. <!-- 添加项目 -->
  389. <Businessedit ref="businessedit" :cust-info="custInfo" @fetch-data="getBusiness" />
  390. <!-- 领取客户 -->
  391. <Pick ref="pick" />
  392. <Bid ref="bid" @bidSave="bidSave" />
  393. <InvoiceHeader ref="invoiceHeader" @save="invoiceHeaderSave" />
  394. </div>
  395. </template>
  396. <script>
  397. import { hasPermission } from '@/utils/permission'
  398. import { mapGetters } from 'vuex'
  399. import api from '@/api/customer'
  400. import follow from '@/api/customer/follow'
  401. import to from 'await-to-js'
  402. import businessApi from '@/api/proj/business'
  403. import contractApi from '@/api/contract'
  404. import bidApi from '@/api/customer/bid'
  405. import invoiceHeaderApi from '@/api/customer/invoiceHeader'
  406. import Contact from './components/Contact'
  407. import Edit from './components/Edit'
  408. import Allocate from './components/Allocate'
  409. import Shift from './components/Shift'
  410. import ToOpen from './components/ToOpen'
  411. import FollowDetail from './components/FollowDetail'
  412. import Businessedit from '../proj/business/components/BusinessEdit'
  413. import Pick from './components/Pick'
  414. import Bid from './components/Bid'
  415. import InvoiceHeader from './components/InvoiceHeader'
  416. export default {
  417. name: 'CustomerDetail',
  418. components: {
  419. Edit,
  420. Contact,
  421. Allocate,
  422. Shift,
  423. Pick,
  424. Bid,
  425. InvoiceHeader,
  426. ToOpen,
  427. FollowDetail,
  428. Businessedit,
  429. },
  430. data() {
  431. return {
  432. id: '',
  433. detail: {
  434. custCode: '', //客户编码
  435. abbrName: '', //助记名
  436. level: '', //客户级别
  437. indusTry: '', //客户类型
  438. custStatus: '', //客户状态
  439. followUpDate: '', //最后跟进时间
  440. },
  441. abstract: {
  442. followContent: '', //跟进次数
  443. notFollowDay: '', //未跟进天数
  444. business: '', //项目数量
  445. businessTotal: '', //项目总额
  446. dealCotal: '', //成交次数
  447. dealTotal: '', //成交总额
  448. paymentTotal: '', //回款总额
  449. notPaymentTotal: '', //未回款总额
  450. drawTotal: '', //开票总额
  451. },
  452. activeName: 'detail',
  453. cuctName: '',
  454. bidSearchText: '',
  455. invoiceHeaderSearchText: '',
  456. contactList: [],
  457. selectRows: [],
  458. records: [], //操作记录
  459. followList: [], //跟进记录
  460. belongs: [],
  461. bidlist: [],
  462. invoiceHeaderList: [],
  463. items: [], //项目
  464. contracts: [], //合同
  465. appro: [],
  466. bidInfoTypeOptions: {},
  467. custInfo: {},
  468. levelOptions: [],
  469. industryOptions: [],
  470. }
  471. },
  472. computed: {
  473. ...mapGetters({
  474. avatar: 'user/avatar',
  475. username: 'user/username',
  476. }),
  477. },
  478. mounted() {
  479. this.id = this.$route.query.id
  480. this.init()
  481. this.getOptions()
  482. this.getDynamics()
  483. this.handleClick({ name: 'follow' })
  484. },
  485. methods: {
  486. getOptions() {
  487. Promise.all([this.getDicts('cust_level'), this.getDicts('cust_idy')])
  488. .then(([level, industry]) => {
  489. this.levelOptions = level.data.values || []
  490. this.industryOptions = industry.data.values || []
  491. })
  492. .catch((err) => console.log(err))
  493. },
  494. checkPermi(val) {
  495. let str = 'cust:'
  496. if (this.detail.salesId) str += 'list:'
  497. else str += 'open:'
  498. str += val
  499. return hasPermission([str])
  500. },
  501. async init() {
  502. Promise.all([
  503. api.getDetail({ ids: [parseInt(this.id)] }),
  504. api.getAbstract({ id: parseInt(this.id) }),
  505. this.getDicts('proj_appro_status'),
  506. ]).then(([detail, abstract, appro]) => {
  507. if (detail.data.list[0]) this.detail = detail.data.list[0]
  508. if (abstract.data.list) this.abstract = abstract.data.list
  509. this.appro = appro.data.values || []
  510. })
  511. this.getDicts('bid_info_type').then((response) => {
  512. this.bidInfoTypeOptions = {}
  513. response.data.values.filter((i) => {
  514. this.bidInfoTypeOptions[i.key] = i.value
  515. })
  516. })
  517. },
  518. getStatus(val) {
  519. const obj = this.appro.find((item) => item.key == val)
  520. if (obj) return obj.value
  521. },
  522. async getDynamics() {
  523. const [err, res] = await to(api.dynamicsList({ custId: parseInt(this.id) }))
  524. if (err) return
  525. if (res.data.list && res.data.list[0]) {
  526. let obj = res.data.list[0]
  527. const keys = Object.keys(obj).reverse()
  528. let records = {}
  529. for (const item of keys) {
  530. records[item] = obj[item]
  531. }
  532. this.records = records
  533. }
  534. },
  535. setSelectRows(val) {
  536. this.selectRows = val
  537. },
  538. async handleClick(tab) {
  539. let err, res
  540. if (tab.name == 'contact') {
  541. ;[err, res] = await to(api.getContact({ custId: parseInt(this.id), cuctName: this.cuctName }))
  542. if (err) return
  543. this.contactList = res.data.list || []
  544. } else if (tab.name == 'follow') {
  545. let params = {
  546. custId: String(this.id),
  547. DaysBeforeToday: 99999,
  548. }
  549. ;[err, res] = await to(follow.getListByDay(params))
  550. if (err) return
  551. this.followList = res.data.list || []
  552. } else if (tab.name == 'belong') {
  553. ;[err, res] = await to(api.getBelongs({ custId: parseInt(this.id) }))
  554. if (err) return
  555. this.belongs = res.data.list || []
  556. } else if (tab.name == 'item') {
  557. ;[err, res] = await to(businessApi.getList({ custName: this.detail.custName }))
  558. if (err) return
  559. this.items = res.data.list || []
  560. } else if (tab.name == 'contract') {
  561. ;[err, res] = await to(contractApi.getList({ custId: parseInt(this.id) }))
  562. this.contracts = res.data.list || []
  563. } else if (tab.name == 'bid') {
  564. ;[err, res] = await to(api.bidList({ custId: parseInt(this.id), searchText: this.bidSearchText }))
  565. this.bidlist = res.data.list || []
  566. } else if (tab.name == 'invoiceHeader') {
  567. ;[err, res] = await to(
  568. invoiceHeaderApi.list({ custId: parseInt(this.id), searchText: this.invoiceHeaderSearchText })
  569. )
  570. this.invoiceHeaderList = res.data.list || []
  571. }
  572. },
  573. // 添加联系人
  574. addContact() {
  575. this.$refs.contact.contactForm.custId = this.detail.id
  576. this.$refs.contact.contactForm.custName = this.detail.custName
  577. this.$refs.contact.contactVisible = true
  578. },
  579. addBid() {
  580. this.$refs.bid.form.custId = this.detail.id
  581. this.$refs.bid.init()
  582. },
  583. addInvoiceHeader() {
  584. this.$refs.invoiceHeader.form.custId = this.detail.id
  585. this.$refs.invoiceHeader.init()
  586. },
  587. bidEdit(row) {
  588. this.$refs.bid.init(row.id)
  589. },
  590. invoiceHeaderEdit(row) {
  591. this.$refs.invoiceHeader.init(row.id)
  592. },
  593. invoiceHeaderDel(row) {
  594. this.$confirm('确认删除?', '提示', {
  595. confirmButtonText: '确定',
  596. cancelButtonText: '取消',
  597. type: 'warning',
  598. })
  599. .then(async () => {
  600. const [err, res] = await to(invoiceHeaderApi.delete({ id: [row.id] }))
  601. if (err) return
  602. if (res.code == 200) {
  603. this.$message({
  604. type: 'success',
  605. message: '删除成功!',
  606. })
  607. this.handleClick({ name: 'invoiceHeader' })
  608. }
  609. })
  610. .catch((err) => console.log(err))
  611. },
  612. // 删除联系人
  613. bidDel(row) {
  614. this.$confirm('确认删除?', '提示', {
  615. confirmButtonText: '确定',
  616. cancelButtonText: '取消',
  617. type: 'warning',
  618. })
  619. .then(async () => {
  620. const [err, res] = await to(bidApi.delete({ id: [row.id] }))
  621. if (err) return
  622. if (res.code == 200) {
  623. this.$message({
  624. type: 'success',
  625. message: '删除成功!',
  626. })
  627. this.handleClick({ name: 'bid' })
  628. }
  629. })
  630. .catch(() => {})
  631. },
  632. // 保存联系人
  633. contactSave() {
  634. this.handleClick({ name: 'contact' })
  635. this.getDynamics()
  636. },
  637. bidSave() {
  638. this.handleClick({ name: 'bid' })
  639. },
  640. invoiceHeaderSave() {
  641. this.handleClick({ name: 'invoiceHeader' })
  642. },
  643. // 编辑客户
  644. handleEdit() {
  645. this.$refs.edit.title = '编辑客户'
  646. this.$refs.edit.editForm = { ...this.detail }
  647. this.$refs.edit.editVisible = true
  648. this.$refs.edit.areaEditDisable = true
  649. this.$refs.edit.showLocation()
  650. },
  651. // 编辑联系人
  652. contactEdit(row) {
  653. this.$refs.contact.contactForm = { ...row }
  654. this.$refs.contact.contactForm.custName = this.detail.custName
  655. this.$refs.contact.contactVisible = true
  656. },
  657. // 删除联系人
  658. contactDel(row) {
  659. this.$confirm('确认删除?', '提示', {
  660. confirmButtonText: '确定',
  661. cancelButtonText: '取消',
  662. type: 'warning',
  663. })
  664. .then(async () => {
  665. const [err, res] = await to(api.deleteContact({ Ids: [row.id], custId: parseInt(this.id) }))
  666. if (err) return
  667. if (res.code == 200) {
  668. this.$message({
  669. type: 'success',
  670. message: '删除成功!',
  671. })
  672. this.contactSave()
  673. }
  674. })
  675. .catch(() => {})
  676. },
  677. // 转移客户
  678. handleShift() {
  679. this.$refs.shift.form.Ids = [parseInt(this.id)]
  680. this.$refs.shift.visible = true
  681. },
  682. // 移入公海
  683. handleToOpen() {
  684. this.$refs.toOpen.form.ids = [parseInt(this.id)]
  685. this.$refs.toOpen.visible = true
  686. },
  687. // 客户删除
  688. handleDelete() {
  689. this.$confirm('确认删除?', '提示', {
  690. confirmButtonText: '确定',
  691. cancelButtonText: '取消',
  692. type: 'warning',
  693. })
  694. .then(async () => {
  695. const [err, res] = await to(api.deleteCustomer({ Id: parseInt(this.id) }))
  696. if (err) return
  697. if (res.code == 200) {
  698. this.$message({
  699. type: 'success',
  700. message: '删除成功!',
  701. })
  702. this.$router.go(-1)
  703. }
  704. })
  705. .catch(() => {})
  706. },
  707. backToOpen() {
  708. this.$router.push('/customer/openSea')
  709. },
  710. back() {
  711. this.$router.go(-1)
  712. },
  713. // 领取
  714. handleReceive() {
  715. this.$refs.pick.ids = [parseInt(this.id)]
  716. this.$refs.pick.visible = true
  717. // this.$confirm('确认领取客户?', '提示', {
  718. // confirmButtonText: '确定',
  719. // cancelButtonText: '取消',
  720. // type: 'warning',
  721. // })
  722. // .then(async () => {
  723. // const [err, res] = await to(
  724. // api.receiveCustomer({
  725. // ids: [parseInt(this.id)],
  726. // salesId: this.$store.state.user.id,
  727. // salesName: this.$store.state.user.nickName,
  728. // receive: '1',
  729. // })
  730. // )
  731. // if (err) return
  732. // if (res.code == 200) {
  733. // this.$message({
  734. // type: 'success',
  735. // message: '领取成功!',
  736. // })
  737. // this.$router.push('/customer/list')
  738. // }
  739. // })
  740. // .catch(() => {})
  741. },
  742. handleAllocate() {
  743. this.$refs.allocate.ids = [parseInt(this.id)]
  744. this.$refs.allocate.visible = true
  745. },
  746. customerSave() {
  747. this.init()
  748. this.getDynamics()
  749. },
  750. formatType(val) {
  751. let str = ''
  752. if (val == 10) str = '电话'
  753. else if (val == 20) str = '邮件'
  754. else if (val == 30) str = '拜访'
  755. return str
  756. },
  757. // 跟进记录详情
  758. showDetail(row) {
  759. this.$refs.followDetail.init({ ...row })
  760. },
  761. // 展开评论
  762. showComment(row) {
  763. if (!row.comments.length) return this.$message.warning('暂无评论')
  764. row.showComment = !row.showComment
  765. this.$forceUpdate()
  766. },
  767. // 创建项目
  768. handleBusiness() {
  769. this.custInfo = {
  770. custId: parseInt(this.id),
  771. custName: this.detail.custName,
  772. }
  773. this.$refs.businessedit.dialogFormVisible = true
  774. },
  775. getBusiness() {
  776. if (this.activeName == 'item') {
  777. this.handleClick({ name: 'item' })
  778. }
  779. },
  780. },
  781. }
  782. </script>
  783. <style lang="scss" scoped>
  784. $base: '.detail';
  785. #{$base} {
  786. height: calc(100vh - 60px - 12px * 2 - 40px);
  787. display: flex;
  788. padding: 20px 40px;
  789. > .el-row {
  790. flex: 1;
  791. width: 100%;
  792. > .el-col {
  793. height: 100%;
  794. }
  795. }
  796. .title {
  797. p,
  798. h3 {
  799. margin: 0;
  800. }
  801. p {
  802. font-size: 14px;
  803. font-weight: 400;
  804. line-height: 22px;
  805. }
  806. h3 {
  807. font-size: 24px;
  808. font-weight: 500;
  809. line-height: 36px;
  810. color: #333;
  811. display: flex;
  812. justify-content: space-between;
  813. }
  814. }
  815. header {
  816. height: 74px;
  817. background: rgba(196, 196, 196, 0.5);
  818. border-radius: 4px;
  819. display: flex;
  820. align-items: center;
  821. padding: 0 20px;
  822. margin-top: 16px;
  823. ::v-deep .el-descriptions__body {
  824. background: transparent;
  825. }
  826. ::v-deep .my-label {
  827. font-size: 14px;
  828. font-weight: 600;
  829. color: #1d66dc;
  830. }
  831. ::v-deep .my-content {
  832. font-size: 14px;
  833. font-weight: 600;
  834. color: #333;
  835. white-space: nowrap;
  836. overflow: hidden;
  837. text-overflow: ellipsis;
  838. }
  839. }
  840. .el-tabs {
  841. height: calc(100% - 148px);
  842. display: flex;
  843. flex-direction: column;
  844. ::v-deep .el-tabs__content {
  845. flex: 1;
  846. .el-tab-pane {
  847. height: 100%;
  848. .el-descriptions {
  849. table-layout: fixed;
  850. .is-bordered {
  851. table-layout: fixed;
  852. }
  853. }
  854. }
  855. }
  856. }
  857. .buttons {
  858. padding-top: 28px;
  859. text-align: right;
  860. }
  861. .records {
  862. margin: 0;
  863. padding: 10px 20px;
  864. list-style: none;
  865. height: calc(100% - 60px);
  866. overflow-y: auto;
  867. > li {
  868. display: flex;
  869. & + li {
  870. margin-top: 10px;
  871. }
  872. }
  873. .date {
  874. width: 100px;
  875. display: flex;
  876. flex-direction: column;
  877. align-items: center;
  878. h2,
  879. h3 {
  880. margin: 0;
  881. }
  882. h2 {
  883. font-size: 26px;
  884. line-height: 32px;
  885. }
  886. }
  887. .content {
  888. flex: 1;
  889. list-style: none;
  890. li {
  891. display: flex;
  892. & + li {
  893. margin-top: 10px;
  894. }
  895. }
  896. .user-avatar {
  897. font-size: 40px;
  898. }
  899. .text {
  900. flex: 1;
  901. padding-left: 20px;
  902. p {
  903. font-weight: 500;
  904. margin: 0;
  905. line-height: 20px;
  906. span {
  907. color: #1d66dc;
  908. }
  909. }
  910. p:nth-child(2) {
  911. margin-bottom: 10px;
  912. }
  913. .action {
  914. font-weight: bold;
  915. color: #333;
  916. }
  917. }
  918. }
  919. }
  920. .follow {
  921. height: 100%;
  922. padding: 10px 20px;
  923. overflow: auto;
  924. > li {
  925. display: flex;
  926. + li {
  927. margin-top: 10px;
  928. }
  929. }
  930. .date {
  931. width: 100px;
  932. display: flex;
  933. flex-direction: column;
  934. align-items: center;
  935. h2,
  936. h3 {
  937. margin: 0;
  938. }
  939. h2 {
  940. font-size: 26px;
  941. line-height: 32px;
  942. }
  943. }
  944. .content {
  945. flex: 1;
  946. list-style: none;
  947. > li {
  948. border: 1px solid rgb(215, 232, 244);
  949. background: rgb(247, 251, 254);
  950. border-radius: 4px;
  951. padding: 8px;
  952. overflow: hidden;
  953. .text-container {
  954. display: flex;
  955. }
  956. .comments {
  957. padding-left: 60px;
  958. margin-top: 10px;
  959. max-height: 190px;
  960. overflow: auto;
  961. li {
  962. display: flex;
  963. border-top: 1px solid #e3e5e7;
  964. .text {
  965. flex: 1;
  966. padding: 0 10px;
  967. p {
  968. font-weight: 500;
  969. margin: 0;
  970. line-height: 32px;
  971. }
  972. p:first-child {
  973. line-height: 30px;
  974. font-weight: bold;
  975. }
  976. p:last-child {
  977. font-size: 12px;
  978. color: #9499a0;
  979. text-align: right;
  980. }
  981. }
  982. }
  983. }
  984. + li {
  985. margin-top: 10px;
  986. }
  987. }
  988. .user-avatar {
  989. font-size: 40px;
  990. }
  991. .text {
  992. flex: 1;
  993. padding-left: 20px;
  994. padding-right: 10px;
  995. p {
  996. font-weight: 500;
  997. margin: 0;
  998. line-height: 32px;
  999. span {
  1000. color: #1d66dc;
  1001. }
  1002. }
  1003. .action {
  1004. display: flex;
  1005. justify-content: space-between;
  1006. span:first-child {
  1007. font-weight: bold;
  1008. color: #333;
  1009. }
  1010. }
  1011. .footer {
  1012. display: flex;
  1013. justify-content: space-between;
  1014. align-items: center;
  1015. }
  1016. }
  1017. }
  1018. }
  1019. .no-follow {
  1020. height: 100%;
  1021. width: 100%;
  1022. display: flex;
  1023. align-items: center;
  1024. justify-content: center;
  1025. font-size: 12px;
  1026. color: rgba(0, 0, 0, 0.65);
  1027. }
  1028. }
  1029. .height-enter-active,
  1030. .height-leave-active {
  1031. transition: all 0.5s;
  1032. }
  1033. .height-enter-to,
  1034. .height-leave {
  1035. height: 190px;
  1036. }
  1037. .height-enter, .height-leave-to /* .fade-leave-active below version 2.1.8 */ {
  1038. height: 0;
  1039. }
  1040. </style>