list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <div class="app-container">
  3. <div class="title-container">
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
  5. </div>
  6. <y-page-list-layout :page-list="pageData" :page-para="listQuery" :get-page-list="getList">
  7. <template slot="left">
  8. <PermissionButton menu-code="_views_market_customer_add" class-name="filter-item" type="primary" name size="mini"
  9. :page-jump="true" round style="float: left" />
  10. <el-input v-model="listQuery.name" placeholder="客户名字" clearable
  11. style="margin-left: 20px;width: 320px;float: left;">
  12. </el-input>
  13. <el-select clearable style="margin-left: 20px;width: 200px;float: left;" v-model="listQuery.level"
  14. placeholder="客户等级">
  15. <el-option v-for="(item, index) in AllEnum['客户等级']" :key="index" :label="item" :value="item" />
  16. </el-select>
  17. <el-button class="filter-item" style="margin-left: 10px;float: left;" type="primary" @click="searchList" round>搜索
  18. </el-button>
  19. <el-button class="filter-item" style="float: left;" round type="warning" @click="resetSearch()">重置
  20. </el-button>
  21. </template>
  22. <template slot="right">
  23. <PermissionButton menu-code="_views_customer_template" class-name="filter-item" round icon="el-icon-download"
  24. name="下载模板" @click="handleDownload" />
  25. <PermissionButton menu-code="_views_customer_import" class-name="filter-item" round type="text" name=""
  26. style="padding: 0; margin-bottom: 10px">
  27. <excelImport ref="uploadControl" flag="customer/importExcel" :style-type="1" title="导入" @fath="getList" />
  28. </PermissionButton>
  29. <PermissionButton menu-code="_views_customer_export" class-name="filter-item" round type="primary" name="导出"
  30. @click="customerExport">
  31. </PermissionButton>
  32. </template>
  33. <parentTable v-loading="listLoading" :data="pageData.records" slot="table" style="width: 100%;">
  34. <el-table-column label="客户名字" align="center" width="120">
  35. <template slot-scope="{row}">
  36. <span>{{ row.name }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="市/州" align="center" width="150">
  40. <template slot-scope="{row}">
  41. <span>{{ row.firstCity }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="区/县" align="center" width="120">
  45. <template slot-scope="{row}">
  46. <span>{{ row.secCity }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="单位" align="center" width="300">
  50. <template slot-scope="{row}">
  51. <span>{{ row.department }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="职位" align="center" width="120">
  55. <template slot-scope="{row}">
  56. <span>{{ row.position }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="科室" align="center" width="120">
  60. <template slot-scope="{row}">
  61. <span>{{ row.section }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="联系电话" align="center" width="120">
  65. <template slot-scope="{row}">
  66. <span>{{ row.mobile }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="微信号" align="center" width="120">
  70. <template slot-scope="{row}">
  71. <span>{{ row.wechatNo }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="QQ号" align="center" width="120">
  75. <template slot-scope="{row}">
  76. <span>{{ row.qq }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="客户等级" align="center" width="120">
  80. <template slot-scope="{row}">
  81. <span v-if="row.level === '重点客户'" style="color: red">{{ row.level }}</span>
  82. <span v-if="row.level === '普通客户'" style="color: sandybrown">{{ row.level }}</span>
  83. <span v-if="row.level === '一般客户'" style="color: green">{{ row.level }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="客户地址" align="center" width="200">
  87. <template slot-scope="{row}">
  88. <span>{{ row.address }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="客户经理" align="center" width="120">
  92. <template slot-scope="{row}">
  93. <span>{{ row.userName }}</span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="操作" align="center" width="300" fixed="right">
  97. <template slot-scope="{row}">
  98. <PermissionButton menu-code="_views_market_customer_detail" class-name="filter-item" name="" type="primary"
  99. :page-jump="true" :page-query="{ id: row.id, listQuery: listQuery }" round size="mini" />
  100. <PermissionButton menu-code="_views_market_customer_remove" class-name="filter-item" name="" type="danger"
  101. round size="mini" @click="deleteInfo(row.id)" />
  102. <PermissionButton menu-code="_views_customer_transfer" class-name="filter-item" name="" type="success" round
  103. size="mini" @click="openTransferDialog(row)" />
  104. </template>
  105. </el-table-column>
  106. </parentTable>
  107. </y-page-list-layout>
  108. <el-dialog :visible.sync="dialogFormVisible" :close-on-click-modal="false" custom-class="tansferDialog">
  109. <div class="detail">
  110. <el-divider content-position="left">项目信息</el-divider>
  111. <el-descriptions :column="4" size="lager" border>
  112. <el-descriptions-item label="客户名字">{{ detail.name }}</el-descriptions-item>
  113. <el-descriptions-item label="市/州">{{ detail.firstCity }}</el-descriptions-item>
  114. <el-descriptions-item label="区/县">{{ detail.secCity }}</el-descriptions-item>
  115. <el-descriptions-item label="单位">{{ detail.department }}</el-descriptions-item>
  116. <el-descriptions-item label="职位">{{ detail.position }}</el-descriptions-item>
  117. <el-descriptions-item label="科室">{{ detail.section }}</el-descriptions-item>
  118. <el-descriptions-item label="联系电话">{{ detail.mobile }}</el-descriptions-item>
  119. <el-descriptions-item label="微信号">{{ detail.wechatNo }}</el-descriptions-item>
  120. <el-descriptions-item label="QQ号">{{ detail.qq }}</el-descriptions-item>
  121. <el-descriptions-item label="客户经理">
  122. <el-select v-model="detail.userId">
  123. <el-option v-for="(item, index) in managers" :key="index" :label="item.name" :value="item.id"></el-option>
  124. </el-select>
  125. <el-tooltip class="item" effect="dark" content="点击转交" placement="bottom-start">
  126. <el-button type="success" icon="el-icon-check" circle style="margin-left: 20px;" placeholder="转交"
  127. @click="saveManager"></el-button>
  128. </el-tooltip>
  129. </el-descriptions-item>
  130. <el-descriptions-item label="客户等级">{{ detail.level }}</el-descriptions-item>
  131. </el-descriptions>
  132. </div>
  133. <div class="histroy">
  134. <el-divider content-position="left">转交记录</el-divider>
  135. <el-collapse v-model="activeNames">
  136. <el-collapse-item name="1">
  137. <el-timeline>
  138. <el-timeline-item v-for="item in historys" :key="item.id" :timestamp="item.created" placement="top">
  139. <el-card>
  140. <el-descriptions :column="3" border>
  141. <el-descriptions-item label="前客户经理"><el-tag type="info">{{ item.originalUserName
  142. }}</el-tag></el-descriptions-item>
  143. <el-descriptions-item label="后客户经理"><el-tag type="success">{{ item.currentUserName
  144. }}</el-tag></el-descriptions-item>
  145. <el-descriptions-item label="操作人"><el-tag>{{ item.operatorName }}</el-tag></el-descriptions-item>
  146. </el-descriptions>
  147. </el-card>
  148. </el-timeline-item>
  149. </el-timeline>
  150. </el-collapse-item>
  151. </el-collapse>
  152. </div>
  153. </el-dialog>
  154. </div>
  155. </template>
  156. <script>
  157. import YPageListLayout from '@/components/YPageListLayout'
  158. import Breadcrumb from '@/components/Breadcrumb'
  159. import PermissionButton from '@/components/PermissionButton/PermissionButton'
  160. export default {
  161. name: 'ViewsMarketCustomerList',
  162. components: {
  163. Breadcrumb,
  164. YPageListLayout,
  165. PermissionButton,
  166. },
  167. filters: {
  168. statusFilter(status) {
  169. const statusMap = {
  170. published: 'success',
  171. draft: 'info',
  172. deleted: 'danger',
  173. }
  174. return statusMap[status]
  175. },
  176. },
  177. data() {
  178. return {
  179. isDisable: false,
  180. tableKey: 0,
  181. pageData: { records: [] },
  182. total: 20,
  183. listLoading: true,
  184. listQuery: {
  185. page: 1,
  186. size: 10,
  187. descs: 'id',
  188. },
  189. listQueryKey: 'keyword',
  190. importLoading: false,
  191. name: null,
  192. city: null,
  193. county: null,
  194. AllEnum: [],
  195. dialogFormVisible: false,
  196. detail: {},
  197. activeNames: ['1'],
  198. historys: [],
  199. managers: [],
  200. }
  201. },
  202. created() {
  203. const that = this;
  204. if (that.$route.query.current && !isNaN(that.$route.query.current)) {
  205. that.listQuery.current = parseInt(that.$route.query.current);
  206. }
  207. if (that.$route.query.name) {
  208. that.listQuery.name = that.$route.query.name;
  209. }
  210. if (that.$route.query.level) {
  211. that.listQuery.level = that.$route.query.level;
  212. }
  213. that.getAllEnum();
  214. that.getList();
  215. },
  216. methods: {
  217. customerExport() {
  218. this.$utils.exportUtil(
  219. "/customer/export", this.listQuery,
  220. "导出"
  221. );
  222. },
  223. handleDownload() {
  224. this.$utils.exportUtil('/customer/download/importTemplate', {}, '模板下载')
  225. },
  226. getAllEnum() {
  227. const that = this;
  228. that.$api.globalConfig.getAllEnum().then(data => {
  229. if (data.code === 200) {
  230. that.AllEnum = data.data
  231. } else {
  232. this.$message({
  233. type: 'error',
  234. message: data.msg
  235. })
  236. }
  237. })
  238. },
  239. resetSearch() {
  240. this.$router.push({ query: {} });
  241. this.listQuery = {
  242. current: 1,
  243. size: 10,
  244. descs: 'id',
  245. }
  246. this.getList()
  247. },
  248. removeHandle(row) {
  249. // console.log(data)
  250. const that = this
  251. that
  252. .$confirm('确认删除当前记录吗?', '警告', {
  253. confirmButtonText: '确认',
  254. cancelButtonText: '取消',
  255. type: 'warning',
  256. })
  257. .then(async () => {
  258. this.$api.customer.delete(row.id).then((res) => {
  259. if (res.code === 200) {
  260. this.$message({
  261. type: 'success',
  262. message: '删除成功',
  263. })
  264. this.getList()
  265. }
  266. })
  267. })
  268. .catch((err) => {
  269. console.error(err)
  270. })
  271. },
  272. searchList() {
  273. // 重置分页
  274. this.listQuery.page = 1
  275. this.listQuery.size = 10
  276. this.getList()
  277. },
  278. getList() {
  279. const that = this
  280. this.listLoading = true
  281. // console.log(that.listQuery)
  282. const key = {}
  283. key[this.listQueryKey] = this.listQuery.description
  284. this.$api.customer
  285. .list(Object.assign({}, that.listQuery, key))
  286. .then((res) => {
  287. that.pageData = res.data
  288. setTimeout(() => {
  289. that.listLoading = false
  290. }, 200)
  291. })
  292. .catch(() => {
  293. that.listLoading = false
  294. })
  295. },
  296. deleteInfo(id) {
  297. const that = this
  298. that.$confirm('请确认是否删除该数据?', '提示', {
  299. confirmButtonText: '确定',
  300. cancelButtonText: '取消',
  301. type: 'warning',
  302. center: true
  303. }).then(() => {
  304. that.$api.customer.delete(id).then(data => {
  305. that.loading = false
  306. if (data.code === 200) {
  307. that.getList()
  308. } else {
  309. this.$message({
  310. type: 'error',
  311. message: data.msg
  312. })
  313. }
  314. })
  315. }).catch(() => {
  316. })
  317. },
  318. openTransferDialog(row) {
  319. const originalUserId = row.userId;
  320. this.dialogFormVisible = true;
  321. this.detail = row;
  322. this.detail.originalUserId = originalUserId;
  323. this.getHistroyList(row.id);
  324. this.getManagers();
  325. },
  326. getManagers() {
  327. this.$api.user.usersByDepartment("市场部").then(res => {
  328. this.managers = res.data
  329. })
  330. },
  331. getHistroyList(id) {
  332. this.$api.resourceTransfer.history({ "resourceType": "CUSTOMER", "resourceId": id }).then(res => {
  333. if (res.code === 200) {
  334. this.historys = res.data;
  335. }
  336. })
  337. },
  338. saveManager() {
  339. if (this.detail.userId === this.detail.originalUserId){
  340. this.$message({
  341. type: 'error',
  342. message: '抱歉,不能转交给本人。'
  343. });
  344. return ;
  345. }
  346. this.$api.customer.changeManager(this.detail).then(res => {
  347. if (res.code === 200 && res.data === true) {
  348. this.$message({
  349. type: 'success',
  350. message: '转交成功'
  351. });
  352. this.getHistroyList(this.detail.id);
  353. }
  354. }
  355. );
  356. },
  357. },
  358. }
  359. </script>
  360. <style lang="scss" scoped>
  361. .right {
  362. flex: 1;
  363. .title {
  364. font-size: 16px;
  365. font-weight: 500;
  366. color: rgba(51, 51, 51, 1);
  367. line-height: 35px;
  368. margin-bottom: 8px;
  369. }
  370. .menu-2-box {
  371. display: flex;
  372. flex-wrap: wrap;
  373. width: 100%;
  374. }
  375. .menu-2-item {
  376. display: flex;
  377. align-items: center;
  378. color: #656565;
  379. font-size: 12px;
  380. width: 230px;
  381. height: 101px;
  382. background: rgb(255, 185, 129);
  383. border-radius: 3px;
  384. padding-left: 20px;
  385. margin-right: 10px;
  386. margin-bottom: 10px;
  387. cursor: pointer;
  388. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  389. .text {
  390. margin-left: 16px;
  391. }
  392. }
  393. }
  394. /deep/ .tansferDialog {
  395. width: 60%;
  396. border-radius: 10px;
  397. }
  398. .el-dropdown-link {
  399. cursor: pointer;
  400. color: red;
  401. }
  402. .el-icon-arrow-down {
  403. font-size: 12px;
  404. }
  405. </style>