index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="客户会员id" prop="fsUserId">
  5. <el-input
  6. v-model="queryParams.fsUserId"
  7. placeholder="请输入客户会员id"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="企微客户id" prop="extId">
  14. <el-input
  15. v-model="queryParams.extId"
  16. placeholder="请输入客户id"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <!-- <el-col :span="1.5">-->
  29. <!-- <el-button-->
  30. <!-- type="warning"-->
  31. <!-- plain-->
  32. <!-- icon="el-icon-download"-->
  33. <!-- size="mini"-->
  34. <!-- :loading="exportLoading"-->
  35. <!-- @click="handleExport"-->
  36. <!-- v-hasPermi="['qw:externalContact:export']"-->
  37. <!-- >导出</el-button>-->
  38. <!-- </el-col>-->
  39. <!-- <el-col :span="1.5">-->
  40. <!-- <el-button-->
  41. <!-- type="warning"-->
  42. <!-- plain-->
  43. <!-- icon="el-icon-download"-->
  44. <!-- size="mini"-->
  45. <!-- :loading="exportUnionidLoading"-->
  46. <!-- @click="handleExportUnionId"-->
  47. <!-- v-hasPermi="['qw:externalContact:export']"-->
  48. <!-- >导出unionid</el-button>-->
  49. <!-- </el-col>-->
  50. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  51. </el-row>
  52. <el-table v-loading="loading" :data="externalContactList" @selection-change="handleSelectionChange" border>
  53. <el-table-column type="selection" width="55" align="center" />
  54. <el-table-column label="企微客户ID" align="center" prop="id" />
  55. <el-table-column label="客户会员ID" align="center" prop="fsUserId" />
  56. <el-table-column label="企微客户头像" align="center" prop="avatar" width="100px">
  57. <template slot-scope="scope">
  58. <el-popover
  59. placement="right"
  60. title=""
  61. trigger="hover">
  62. <img slot="reference" :src="scope.row.avatar" width="60px">
  63. <img :src="scope.row.avatar" style="max-width: 200px;">
  64. </el-popover>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="企微客户名称" prop="name" width="110px"/>
  68. <el-table-column label="销售企微昵称" align="center" prop="qwUserName" width="120px"/>
  69. <el-table-column label="企微部门" align="center" prop="departmentName" width="120px"/>
  70. <el-table-column label="用户类别" align="center" prop="type">
  71. <template slot-scope="scope">
  72. <dict-tag :options="typeOptions" :value="scope.row.type"/>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="性别" align="center" prop="gender">
  76. <template slot-scope="scope">
  77. <dict-tag :options="genderOptions" :value="scope.row.gender"/>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="备注" align="center" prop="remark" />
  81. <el-table-column label="描述信息" align="center" prop="description" />
  82. <el-table-column label="标签" align="center" prop="tagIdsName" width="250px">
  83. <template slot-scope="scope">
  84. <div v-for="name in scope.row.tagIdsName" style="display: inline;">
  85. <el-tag type="success">{{ name }}</el-tag>
  86. </div>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="状态" align="center" prop="status" width="120px" >
  90. <template slot-scope="scope">
  91. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="客户等级" align="center" prop="level" width="120px" >
  95. <template slot-scope="scope">
  96. <dict-tag :options="ratingType" :value="scope.row.level"/>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="等级状态" align="center" prop="levelType" width="120px" >
  100. <template slot-scope="scope">
  101. <dict-tag :options="ratingUpFall" :value="scope.row.levelType"/>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="添加时间" align="center" prop="createTime" width="100px" />
  105. <el-table-column label="流失时间" align="center" prop="lossTime" width="100px" />
  106. <el-table-column label="删除时间" align="center" prop="delTime" width="100px" />
  107. <el-table-column label="备注电话号码" align="center" prop="remarkMobiles" width="150px">
  108. <template slot-scope="scope">
  109. <div v-for="i in JSON.parse(scope.row.remarkMobiles)" :key="i">{{i}}</div>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="备注企业名称" align="center" prop="remarkCorpName" />
  113. <el-table-column label="来源" align="center" prop="addWay" width="100px">
  114. <template slot-scope="scope">
  115. <dict-tag :options="addWayOptions" :value="scope.row.addWay"/>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="转接状态" align="center" prop="transferStatus" width="100px" >
  119. <template slot-scope="scope">
  120. <dict-tag :options="transferStatusOptions" :value="scope.row.transferStatus"/>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="是否被拉黑" align="center" prop="manageStatusName" width="130px">
  124. <template slot-scope="scope">
  125. {{ scope.row.manageStatusName || (scope.row.manageStatus === 2 ? '是' : scope.row.manageStatus === 1 ? '否' : '-') }}
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="拉黑原因" align="center" prop="manageRemark" show-overflow-tooltip />
  129. <el-table-column label="企业id" align="center" prop="corpId" />
  130. <el-table-column label="重粉看课历史" width="140px" align="center" fixed="right">
  131. <template slot-scope="scope">
  132. <div v-if="scope.row.fsUserId">
  133. <el-tag type="success" v-if="scope.row.isRepeat == 0" size="mini">正常</el-tag>
  134. <el-tag type="danger" v-if="scope.row.isRepeat == 1" size="mini">重粉</el-tag>
  135. <el-button
  136. size="mini"
  137. type="text"
  138. @click="openRepeatCourseHistory(scope.row)"
  139. >看课历史
  140. </el-button>
  141. </div>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="是否绑定会员" width="100px" align="center" fixed="right">
  145. <template slot-scope="scope">
  146. <el-tag v-if="scope.row.fsUserId" >已绑定</el-tag>
  147. <el-tag v-else type="info"> 未绑定</el-tag>
  148. </template>
  149. </el-table-column>
  150. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="80px" fixed="right">
  151. <template slot-scope="scope">
  152. <el-button
  153. size="mini"
  154. type="text"
  155. icon="el-icon-edit"
  156. @click="handleUpdate(scope.row)"
  157. v-hasPermi="['qw:externalContact:edit']"
  158. >修改</el-button>
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. <pagination-more
  163. :total="total"
  164. :page.sync="queryParams.pageNum"
  165. :limit.sync="queryParams.pageSize"
  166. @pagination="getList"
  167. />
  168. <repeat-course-history-drawer ref="repeatCourseHistoryDrawer" />
  169. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  170. <el-form ref="form" :model="form" label-width="100px">
  171. <el-form-item label="是否拉黑" prop="manageStatus">
  172. <el-select v-model="form.manageStatus" placeholder="请选择管理状态" clearable size="small">
  173. <el-option label="否" :value="1" />
  174. <el-option label="是" :value="2" />
  175. </el-select>
  176. </el-form-item>
  177. <el-form-item label="拉黑原因" prop="manageRemark">
  178. <el-input v-model="form.manageRemark" placeholder="请输入拉黑原因" type="textarea"/>
  179. </el-form-item>
  180. </el-form>
  181. <div slot="footer" class="dialog-footer">
  182. <el-button type="primary" @click="submitForm">确 定</el-button>
  183. <el-button @click="cancel">取 消</el-button>
  184. </div>
  185. </el-dialog>
  186. </div>
  187. </template>
  188. <script>
  189. import { listExternalContact, getExternalContact, updateExternalContact } from "@/api/qw/externalContact";
  190. import PaginationMore from '@/components/PaginationMore/index.vue'
  191. import RepeatCourseHistoryDrawer from './RepeatCourseHistoryDrawer.vue'
  192. export default {
  193. name: "ExternalContact",
  194. components: { PaginationMore, RepeatCourseHistoryDrawer },
  195. data() {
  196. return {
  197. loading: false,
  198. ratingUpFall: [],
  199. genderOptions: [],
  200. typeOptions: [],
  201. statusOptions: [],
  202. ratingType: [],
  203. addWayOptions: [],
  204. transferStatusOptions: [],
  205. ids: [],
  206. single: true,
  207. multiple: true,
  208. showSearch: true,
  209. total: 0,
  210. externalContactList: [],
  211. queryParams: {
  212. pageNum: 1,
  213. pageSize: 10,
  214. fsUserId: null,
  215. extId: null,
  216. },
  217. open: false,
  218. title: "",
  219. form: {},
  220. };
  221. },
  222. created() {
  223. //用户类别
  224. this.getDicts("sys_qw_externalContact_type").then(response => {
  225. this.typeOptions = response.data;
  226. });
  227. //客户等级
  228. this.getDicts("sys_qw_sop_rating_type").then(response => {
  229. this.ratingType = response.data;
  230. });
  231. //等级状态
  232. this.getDicts("sys_qw_sop_rating_upFall").then(response => {
  233. this.ratingUpFall = response.data;
  234. });
  235. //性别
  236. this.getDicts("sys_sex").then(response => {
  237. this.genderOptions = response.data;
  238. });
  239. //状态
  240. this.getDicts("sys_qw_external_contact_status").then(response => {
  241. this.statusOptions = response.data;
  242. });
  243. //来源
  244. this.getDicts("sys_qw_externalContact_addWay").then(response => {
  245. this.addWayOptions = response.data;
  246. });
  247. //转接状态
  248. this.getDicts("sys_qw_transfer_status").then(response => {
  249. this.transferStatusOptions = response.data;
  250. });
  251. },
  252. methods: {
  253. openRepeatCourseHistory(row) {
  254. const drawer = this.$refs.repeatCourseHistoryDrawer
  255. if (drawer && typeof drawer.open === 'function') {
  256. drawer.open(row)
  257. }
  258. },
  259. /** 查询企业微信客户列表 */
  260. getList() {
  261. this.loading = true;
  262. listExternalContact(this.queryParams).then(response => {
  263. this.externalContactList = response.rows;
  264. this.total = response.total;
  265. this.loading = false;
  266. });
  267. },
  268. /** 搜索按钮操作 */
  269. handleQuery() {
  270. if (!this.queryParams.fsUserId && !this.queryParams.extId) {
  271. return this.$message.warning({
  272. message: "请至少输入客户会员id或企微客户id",
  273. duration: 3000
  274. });
  275. }
  276. this.queryParams.pageNum = 1;
  277. this.getList();
  278. },
  279. /** 重置按钮操作 */
  280. resetQuery() {
  281. this.resetForm("queryForm");
  282. this.queryParams.fsUserId = null;
  283. this.queryParams.extId = null;
  284. this.externalContactList = [];
  285. this.total = 0;
  286. },
  287. // 多选框选中数据
  288. handleSelectionChange(selection) {
  289. this.ids = selection.map(item => item.id)
  290. this.single = selection.length!==1
  291. this.multiple = !selection.length
  292. },
  293. cancel() {
  294. this.open = false;
  295. this.reset();
  296. },
  297. reset() {
  298. this.form = {
  299. id: null,
  300. manageStatus: 1,
  301. manageRemark: null,
  302. };
  303. this.resetForm("form");
  304. },
  305. handleUpdate(row) {
  306. this.reset();
  307. const id = row.id;
  308. getExternalContact(id).then(response => {
  309. this.form = response.data;
  310. this.form.manageStatus = this.form.manageStatus != null ? Number(this.form.manageStatus) : 1;
  311. this.open = true;
  312. this.title = "修改企微客户";
  313. });
  314. },
  315. submitForm() {
  316. this.$refs["form"].validate(valid => {
  317. if (valid && this.form.id != null) {
  318. updateExternalContact(this.form).then(() => {
  319. this.msgSuccess("修改成功");
  320. this.open = false;
  321. this.getList();
  322. });
  323. }
  324. });
  325. },
  326. }
  327. };
  328. </script>