myExternalContact.vue 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801
  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="企微账号" prop="qwUserId">
  5. <el-select v-model="queryParams.qwUserId" placeholder="企微账号" size="small" @change="updateQwuser()">
  6. <el-option
  7. v-for="dict in myQwUserList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel+'('+dict.corpName+')'"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="客户名称" prop="name">
  15. <el-input
  16. v-model="queryParams.name"
  17. placeholder="请输入客户名称"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="用户类别" prop="type">
  24. <el-select v-model="queryParams.type" placeholder="请选择用户类别" clearable size="small">
  25. <el-option
  26. v-for="dict in typeOptions"
  27. :key="dict.dictValue"
  28. :label="dict.dictLabel"
  29. :value="dict.dictValue"
  30. />
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="性别" prop="gender">
  34. <el-select v-model="queryParams.gender" placeholder="状态" clearable size="small">
  35. <el-option
  36. v-for="dict in genderOptions"
  37. :key="dict.dictValue"
  38. :label="dict.dictLabel"
  39. :value="dict.dictValue"
  40. />
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item label="电话号码" prop="remarkMobiles">
  44. <el-input
  45. v-model="queryParams.remarkMobiles"
  46. placeholder="请输入备注电话号码"
  47. clearable
  48. size="small"
  49. @keyup.enter.native="handleQuery"
  50. />
  51. </el-form-item>
  52. <el-form-item label="来源" prop="addWay">
  53. <el-select v-model="queryParams.addWay" placeholder="来源" clearable size="small">
  54. <el-option
  55. v-for="dict in addWayOptions"
  56. :key="dict.dictValue"
  57. :label="dict.dictLabel"
  58. :value="dict.dictValue"
  59. />
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item label="状态" prop="status">
  63. <el-select v-model="queryParams.status" placeholder="状态" clearable size="small">
  64. <el-option
  65. v-for="dict in statusOptions"
  66. :key="dict.dictValue"
  67. :label="dict.dictLabel"
  68. :value="dict.dictValue"
  69. />
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item label="客户等级" prop="level">
  73. <el-select v-model="queryParams.level" placeholder="客户等级" clearable size="small">
  74. <el-option
  75. v-for="dict in ratingType"
  76. :key="dict.dictValue"
  77. :label="dict.dictLabel"
  78. :value="dict.dictValue"
  79. />
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item label="等级升降" prop="levelType">
  83. <el-select v-model="queryParams.levelType" placeholder="等级升降" clearable size="small">
  84. <el-option
  85. v-for="dict in ratingUpFall"
  86. :key="dict.dictValue"
  87. :label="dict.dictLabel"
  88. :value="dict.dictValue"
  89. />
  90. </el-select>
  91. </el-form-item>
  92. <el-form-item label="转接状态" prop="addWay">
  93. <el-select v-model="queryParams.transferStatus" placeholder="转接状态" clearable size="small">
  94. <el-option
  95. v-for="dict in transferStatusOptions"
  96. :key="dict.dictValue"
  97. :label="dict.dictLabel"
  98. :value="dict.dictValue"
  99. />
  100. </el-select>
  101. </el-form-item>
  102. <el-form-item label="是否绑定会员" prop="isBindMini">
  103. <el-select v-model="queryParams.isBindMini" placeholder="是否绑定会员" clearable size="small" @change="handleQuery" >
  104. <el-option
  105. v-for="dict in isBindMiniOptions"
  106. :key="dict.dictValue"
  107. :label="dict.dictLabel"
  108. :value="dict.dictValue"
  109. />
  110. </el-select>
  111. </el-form-item>
  112. <el-form-item label="标签" prop="tagIds">
  113. <!-- <el-select v-model="selectTags" remote multiple placeholder="请选择" filterable style="width: 100%;">-->
  114. <!-- <el-option-->
  115. <!-- v-for="dict in tagList"-->
  116. <!-- :label="dict.name"-->
  117. <!-- :value="dict.tagId">-->
  118. <!-- </el-option>-->
  119. <!-- </el-select>-->
  120. <div @click="hangleChangeTags()" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
  121. <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
  122. <el-tag type="success"
  123. closable
  124. :disable-transitions="false"
  125. v-for="list in this.selectTags"
  126. :key="list.tagId"
  127. @close="handleCloseTags(list)"
  128. style="margin: 3px;"
  129. >{{list.name}}
  130. </el-tag>
  131. </div>
  132. </div>
  133. </el-form-item>
  134. <el-form-item label="备注" prop="remark">
  135. <el-input
  136. v-model="queryParams.remark"
  137. placeholder="请输入备注"
  138. clearable
  139. size="small"
  140. @keyup.enter.native="handleQuery"
  141. />
  142. </el-form-item>
  143. <el-form-item label="添加时间" prop="createTime">
  144. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  145. </el-form-item>
  146. <el-form-item label="流失时间" prop="lossTime">
  147. <el-date-picker clearable size="small"
  148. v-model="queryParams.lossTime"
  149. type="date"
  150. value-format="yyyy-MM-dd"
  151. placeholder="选择流失时间">
  152. </el-date-picker>
  153. </el-form-item>
  154. <el-form-item label="删除时间" prop="delTime">
  155. <el-date-picker clearable size="small"
  156. v-model="queryParams.delTime"
  157. type="date"
  158. value-format="yyyy-MM-dd"
  159. placeholder="选择删除时间">
  160. </el-date-picker>
  161. </el-form-item>
  162. <el-form-item>
  163. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  164. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  165. </el-form-item>
  166. </el-form>
  167. <el-row :gutter="10" class="mb8">
  168. <!-- <el-col :span="1.5">
  169. <el-button
  170. type="primary"
  171. plain
  172. icon="el-icon-plus"
  173. size="mini"
  174. @click="handleAdd"
  175. v-hasPermi="['qw:externalContact:add']"
  176. >同步</el-button>
  177. </el-col> -->
  178. <el-col :span="1.5">
  179. <el-button
  180. type="success"
  181. plain
  182. icon="el-icon-edit"
  183. size="mini"
  184. :disabled="single"
  185. @click="handleUpdate"
  186. >修改备注</el-button>
  187. </el-col>
  188. <el-col :span="1.5">
  189. <el-button
  190. type="warning"
  191. plain
  192. icon="el-icon-download"
  193. size="mini"
  194. :loading="exportLoading"
  195. @click="handleSyncMyExternalContact"
  196. >同步我的客户</el-button>
  197. <el-button
  198. type="warning"
  199. plain
  200. icon="el-icon-download"
  201. size="mini"
  202. :loading="exportLoading"
  203. @click="handleSyncAddMyExternalContact"
  204. >新客同步</el-button>
  205. </el-col>
  206. <el-col :span="1.5">
  207. <el-button
  208. type="warning"
  209. plain
  210. icon="el-icon-download"
  211. size="mini"
  212. :loading="exportLoading"
  213. @click="handleExport"
  214. v-hasPermi="['qw:externalContact:myExport']"
  215. >导出</el-button>
  216. </el-col>
  217. <el-col :span="1.5">
  218. <el-button
  219. type="primary"
  220. plain
  221. size="mini"
  222. @click="addUserTag"
  223. >批量添加标签</el-button>
  224. </el-col>
  225. <el-col :span="1.5">
  226. <el-button
  227. type="primary"
  228. plain
  229. size="mini"
  230. @click="delUserTag"
  231. >批量移除标签</el-button>
  232. </el-col>
  233. <el-col :span="1.5">
  234. <el-button
  235. type="primary"
  236. plain
  237. size="mini"
  238. @click="updateTalk"
  239. v-hasPermi="['qw:externalContactInfo:myUpdateTalk']"
  240. >批量更改交流状态</el-button>
  241. </el-col>
  242. <el-col :span="1.5">
  243. <el-button
  244. type="primary"
  245. plain
  246. size="mini"
  247. @click="updateAllTalk"
  248. v-hasPermi="['qw:externalContactInfo:myUpdateAllTalk']"
  249. >更改全部交流状态</el-button>
  250. </el-col>
  251. <!-- <el-col :span="1.5">-->
  252. <!-- <el-button-->
  253. <!-- type="primary"-->
  254. <!-- plain-->
  255. <!-- size="mini"-->
  256. <!-- @click="setUserCourseSop"-->
  257. <!-- v-hasPermi="['qw:externalContact:setCourseSop']"-->
  258. <!-- >批量设置SOP</el-button>-->
  259. <!-- </el-col>-->
  260. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  261. </el-row>
  262. <!-- <el-tabs type="card" v-model="isBindActiveName" @tab-click="handleClickX">-->
  263. <!-- <el-tab-pane label="全部" name="all"></el-tab-pane>-->
  264. <!-- <el-tab-pane label="已绑定CRM" name="isBind"></el-tab-pane>-->
  265. <!-- <el-tab-pane label="未绑定CRM" name="noBind"></el-tab-pane>-->
  266. <!-- </el-tabs>-->
  267. <el-table v-loading="loading" :data="externalContactList" @selection-change="handleSelectionChange" border>
  268. <el-table-column type="selection" width="55" align="center" />
  269. <el-table-column label="企微客户ID" align="center" prop="id"/>
  270. <el-table-column label="企微客户头像" align="center" prop="avatar" width="100px">
  271. <template slot-scope="scope">
  272. <el-popover
  273. placement="right"
  274. title=""
  275. trigger="hover">
  276. <img slot="reference" :src="scope.row.avatar" width="60px">
  277. <img :src="scope.row.avatar" style="max-width: 200px;">
  278. </el-popover>
  279. </template>
  280. </el-table-column>
  281. <el-table-column label="企微客户名称" prop="name" width="110px"/>
  282. <el-table-column label="客户称呼" prop="stageStatus" width="110px"/>
  283. <el-table-column label="销售企微昵称" align="center" prop="qwUserName" width="120px"/>
  284. <el-table-column label="企微部门" align="center" prop="departmentName" width="120px"/>
  285. <el-table-column label="用户类别" align="center" prop="type">
  286. <template slot-scope="scope">
  287. <dict-tag :options="typeOptions" :value="scope.row.type"/>
  288. </template>
  289. </el-table-column>
  290. <el-table-column label="性别" align="center" prop="gender">
  291. <template slot-scope="scope">
  292. <dict-tag :options="genderOptions" :value="scope.row.gender"/>
  293. </template>
  294. </el-table-column>
  295. <el-table-column label="备注" align="center" prop="remark" />
  296. <el-table-column label="描述信息" align="center" prop="description" />
  297. <el-table-column label="标签" align="center" prop="tagIdsName" width="250px">
  298. <template slot-scope="scope">
  299. <div v-for="name in scope.row.tagIdsName" style="display: inline;">
  300. <el-tag type="success">{{ name }}</el-tag>
  301. </div>
  302. </template>
  303. </el-table-column>
  304. <el-table-column label="状态" align="center" prop="status" width="120px" >
  305. <template slot-scope="scope">
  306. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  307. </template>
  308. </el-table-column>
  309. <el-table-column label="客户等级" align="center" prop="level" width="120px" >
  310. <template slot-scope="scope">
  311. <dict-tag :options="ratingType" :value="scope.row.level"/>
  312. </template>
  313. </el-table-column>
  314. <el-table-column label="等级状态" align="center" prop="levelType" width="120px" >
  315. <template slot-scope="scope">
  316. <dict-tag :options="ratingUpFall" :value="scope.row.levelType"/>
  317. </template>
  318. </el-table-column>
  319. <el-table-column label="添加时间" align="center" prop="createTime" width="100px" />
  320. <el-table-column label="流失时间" align="center" prop="lossTime" width="100px" />
  321. <el-table-column label="删除时间" align="center" prop="delTime" width="100px" />
  322. <el-table-column label="备注电话号码" align="center" prop="remarkMobiles" width="150px">
  323. <template slot-scope="scope">
  324. <div v-for="i in JSON.parse(scope.row.remarkMobiles)" :key="i">{{i}}</div>
  325. </template>
  326. </el-table-column>
  327. <el-table-column label="备注企业名称" align="center" prop="remarkCorpName" />
  328. <el-table-column label="来源" align="center" prop="addWay" width="100px">
  329. <template slot-scope="scope">
  330. <dict-tag :options="addWayOptions" :value="scope.row.addWay"/>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="转接状态" align="center" prop="transferStatus" width="100px" >
  334. <template slot-scope="scope">
  335. <dict-tag :options="transferStatusOptions" :value="scope.row.transferStatus"/>
  336. </template>
  337. </el-table-column>
  338. <el-table-column label="企业id" align="center" prop="corpId" />
  339. <el-table-column label="是否绑定会员" width="100px" align="center" fixed="right">
  340. <template slot-scope="scope">
  341. <el-tag v-if="scope.row.fsUserId" >已绑定</el-tag>
  342. <el-tag v-else type="info"> 未绑定</el-tag>
  343. </template>
  344. </el-table-column>
  345. <el-table-column label="修改" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  346. <template slot-scope="scope">
  347. <el-button
  348. v-show="scope.row.status==0||scope.row.status==2"
  349. size="mini"
  350. type="text"
  351. icon="el-icon-edit"
  352. @click="handleUpdate(scope.row)"
  353. v-hasPermi="['qw:externalContact:edit']"
  354. >修改备注</el-button>
  355. <el-button
  356. size="mini"
  357. type="text"
  358. icon="el-icon-user-solid"
  359. @click="handleAppellation(scope.row)"
  360. >修改客户称呼</el-button>
  361. </template>
  362. </el-table-column>
  363. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  364. <template slot-scope="scope">
  365. <!-- <el-button-->
  366. <!-- size="mini"-->
  367. <!-- type="text"-->
  368. <!-- icon="el-icon-edit-outline"-->
  369. <!-- @click="handleUpdateCustomer(scope.row)"-->
  370. <!-- >-->
  371. <!-- <span v-if="scope.row.customerId">换绑CRM</span>-->
  372. <!-- <span v-else>绑定CRM</span>-->
  373. <!-- </el-button>-->
  374. <el-button
  375. size="mini"
  376. type="text"
  377. icon="el-icon-edit-outline"
  378. @click="handleUpdateUser(scope.row)"
  379. >
  380. <span v-if="scope.row.fsUserId">换绑会员</span>
  381. <span v-else>绑定会员</span>
  382. </el-button>
  383. <el-button v-show="scope.row.fsUserId"
  384. size="mini"
  385. type="text"
  386. icon="el-icon-thumb"
  387. @click="handleUnBindUserId(scope.row)"
  388. v-hasPermi="['qw:externalContact:unBindUserId']"
  389. >
  390. <span>解除会员绑定</span>
  391. </el-button>
  392. <!-- <el-button v-if="scope.row.customerId"-->
  393. <!-- size="mini"-->
  394. <!-- type="text"-->
  395. <!-- icon="el-icon-paperclip"-->
  396. <!-- @click="handleShow(scope.row)"-->
  397. <!-- >CRM客户详情</el-button>-->
  398. <el-button
  399. size="mini"
  400. type="text"
  401. @click="handledetails(scope.row)"
  402. >用户信息
  403. </el-button>
  404. <!-- <el-button v-if="scope.row.customerId"
  405. size="mini"
  406. type="text"
  407. icon="el-icon-setting"
  408. @click="setCourseSOP(scope.row)"
  409. >设置课程SOP</el-button> -->
  410. </template>
  411. </el-table-column>
  412. </el-table>
  413. <pagination
  414. v-show="total>0"
  415. :total="total"
  416. :page.sync="queryParams.pageNum"
  417. :limit.sync="queryParams.pageSize"
  418. @pagination="getList"
  419. />
  420. <el-drawer size="75%" :title="show.title" :visible.sync="show.open">
  421. <customer-details ref="customerDetails" @refreshList="refreshList"/>
  422. </el-drawer>
  423. <!-- 搜索标签 -->
  424. <el-dialog :title="changeTagDialog.title" :visible.sync="changeTagDialog.open" style="width:100%;height: 100%" append-to-body>
  425. <div>搜索标签:
  426. <el-input v-model="queryTagParams.name" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  427. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(queryTagParams.name)">搜索</el-button>
  428. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  429. </div>
  430. <div v-for="item in tagGroupList" :key="item.id">
  431. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  432. <span class="name-background">{{ item.name }}</span>
  433. </div>
  434. <!-- 添加外层滚动容器 -->
  435. <div class="scroll-wrapper">
  436. <div class="tag-container">
  437. <a
  438. v-for="tagItem in item.tag"
  439. class="tag-box"
  440. @click="tagSelection(tagItem)"
  441. :class="{ 'tag-selected': tagItem.isSelected }"
  442. >
  443. {{ tagItem.name }}
  444. </a>
  445. </div>
  446. </div>
  447. </div>
  448. <!-- <div v-for="item in tagGroupList" :key="item.id" >-->
  449. <!-- <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">-->
  450. <!-- <span class="name-background">{{ item.name }}</span>-->
  451. <!-- </div>-->
  452. <!-- <div class="tag-container">-->
  453. <!-- <a-->
  454. <!-- v-for="tagItem in item.tag"-->
  455. <!-- class="tag-box"-->
  456. <!-- @click="tagSelection(tagItem)"-->
  457. <!-- :class="{ 'tag-selected': tagItem.isSelected }"-->
  458. <!-- >-->
  459. <!-- {{ tagItem.name }}-->
  460. <!-- </a>-->
  461. <!-- </div>-->
  462. <!-- </div>-->
  463. <pagination
  464. v-show="tagTotal>0"
  465. :total="tagTotal"
  466. :page.sync="queryTagParams.pageNum"
  467. :limit.sync="queryTagParams.pageSize"
  468. @pagination="getPageListTagGroup"
  469. />
  470. <div slot="footer" class="dialog-footer">
  471. <el-button type="primary" @click="tagSubmitForm()">确 定</el-button>
  472. <el-button @click="tagCancel()">取消</el-button>
  473. </div>
  474. </el-dialog>
  475. <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
  476. <div>搜索标签:
  477. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  478. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  479. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  480. </div>
  481. <el-form ref="form" :model="addTagForm" label-width="80px">
  482. <div v-for="item in tagGroupList" :key="item.id" >
  483. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  484. <span class="name-background">{{ item.name }}</span>
  485. </div>
  486. <div class="scroll-wrapper">
  487. <div class="tag-container">
  488. <a
  489. v-for="tagItem in item.tag"
  490. class="tag-box"
  491. @click="tagSelection(tagItem)"
  492. :class="{ 'tag-selected': tagItem.isSelected }"
  493. >
  494. {{ tagItem.name }}
  495. </a>
  496. </div>
  497. </div>
  498. </div>
  499. </el-form>
  500. <pagination
  501. v-show="tagTotal>0"
  502. :total="tagTotal"
  503. :page.sync="queryTagParams.pageNum"
  504. :limit.sync="queryTagParams.pageSize"
  505. @pagination="getPageListTagGroup"
  506. />
  507. <div slot="footer" class="dialog-footer">
  508. <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
  509. <el-button @click="addTagCancel">取 消</el-button>
  510. </div>
  511. </el-dialog>
  512. <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
  513. <div>搜索标签:
  514. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  515. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  516. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  517. </div>
  518. <el-form ref="form" :model="addTagForm" label-width="80px">
  519. <div v-for="item in tagGroupList" :key="item.id" >
  520. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  521. <span class="name-background">{{ item.name }}</span>
  522. </div>
  523. <div class="scroll-wrapper">
  524. <div class="tag-container">
  525. <a
  526. v-for="tagItem in item.tag"
  527. class="tag-box"
  528. @click="tagSelection(tagItem)"
  529. :class="{ 'tag-selected': tagItem.isSelected }"
  530. >
  531. {{ tagItem.name }}
  532. </a>
  533. </div>
  534. </div>
  535. </div>
  536. </el-form>
  537. <pagination
  538. v-show="tagTotal>0"
  539. :total="tagTotal"
  540. :page.sync="queryTagParams.pageNum"
  541. :limit.sync="queryTagParams.pageSize"
  542. @pagination="getPageListTagGroup"
  543. />
  544. <div slot="footer" class="dialog-footer">
  545. <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
  546. <el-button @click="DelTagCancel">取 消</el-button>
  547. </div>
  548. </el-dialog>
  549. <!-- 添加或修改企业微信客户对话框 -->
  550. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  551. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  552. <el-form-item label="备注" prop="remark">
  553. <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
  554. </el-form-item>
  555. <el-form-item label="描述信息" prop="description">
  556. <el-input v-model="form.description" type="textarea" :rows="3" placeholder="请输入描述信息" />
  557. </el-form-item>
  558. <el-form-item label="备注电话号码" prop="remarkMobiles">
  559. <el-tag
  560. :key="tag"
  561. v-for="tag in remarkMobiles"
  562. closable
  563. :disable-transitions="false"
  564. @close="handleClose(tag)">
  565. {{tag}}
  566. </el-tag>
  567. <el-input
  568. style="width:110px"
  569. class="input-new-tag"
  570. v-if="inputVisible"
  571. v-model="inputValue"
  572. ref="saveTagInput"
  573. size="small"
  574. @keyup.enter.native="handleInputConfirm"
  575. @blur="handleInputConfirm"
  576. >
  577. </el-input>
  578. <el-button v-else class="button-new-tag" size="small" style="width: 110px" @click="showInput">新增电话</el-button>
  579. </el-form-item>
  580. <el-form-item label="备注企业名称" prop="remarkCorpName">
  581. <el-input v-model="form.remarkCorpName" placeholder="请输入备注企业名称" />
  582. </el-form-item>
  583. </el-form>
  584. <div slot="footer" class="dialog-footer">
  585. <el-button type="primary" @click="submitForm">确 定</el-button>
  586. <el-button @click="cancel">取 消</el-button>
  587. </div>
  588. </el-dialog>
  589. <el-dialog :title="callOpen.title" :visible.sync="callOpen.open" width="500px" append-to-body>
  590. <el-form ref="callOpenFrom" :model="callOpenFrom" :rules="callOpenRule" label-width="110px">
  591. <el-form-item label="客户称呼" prop="stageStatus">
  592. <el-input v-model="callOpenFrom.stageStatus" placeholder="请输入客户称呼" />
  593. </el-form-item>
  594. </el-form>
  595. <div slot="footer" class="dialog-footer" >
  596. <el-button type="primary" @click="submitCallOpenFrom">确 定</el-button>
  597. </div>
  598. </el-dialog>
  599. <!-- 绑定客户 -->
  600. <el-dialog :title="bindCustomer.title" :visible.sync="bindCustomer.open" width="1200px" append-to-body>
  601. <mycustomer ref="mycustomer" @bindCustomerId="bindCustomerId"></mycustomer>
  602. </el-dialog>
  603. <!-- 设置一个课程sop-->
  604. <el-dialog :title="setSop.title" :visible.sync="setSop.open" width="1200px" append-to-body>
  605. <SopDialog ref="SopDialog" @bindCourseSop="bindCourseSop"></SopDialog>
  606. </el-dialog>
  607. <el-drawer
  608. :with-header="false"
  609. size="75%"
  610. :title="show.title" :visible.sync="show.open">
  611. <info ref="Details" />
  612. </el-drawer>
  613. <el-dialog :title="user.title" :visible.sync="user.open" width="800px" append-to-body>
  614. <selectUser ref="selectUser" @bindMiniCustomerId="bindMiniCustomerId"></selectUser>
  615. </el-dialog>
  616. </div>
  617. </template>
  618. <script>
  619. import {
  620. myList,
  621. bindUserId,
  622. addTag,
  623. delTag,
  624. listExternalContact,
  625. getExternalContact,
  626. delExternalContact,
  627. addExternalContact,
  628. updateExternalContact,
  629. exportExternalContact,
  630. editbindCustomer,
  631. syncMyAddExternalContact,
  632. setCustomerCourseSop,
  633. getCustomerCourseSop,
  634. setCustomerCourseSopList,
  635. syncMyExternalContact, unBindUserId, updateExternalContactCall,exportMyExternalContact
  636. } from '@/api/qw/externalContact'
  637. import info from "@/views/qw/externalContact/info.vue";
  638. import {getMyQwUserList, getMyQwCompanyList, handleInputAuthAppKey, updateUser} from "@/api/qw/user";
  639. import {listTag, getTag, searchTags,} from "@/api/qw/tag";
  640. import { allListTagGroup} from "../../../api/qw/tagGroup";
  641. import mycustomer from '@/views/qw/externalContact/mycustomer'
  642. import customerDetails from '@/views/qw/externalContact/customerDetails'
  643. import SopDialog from '@/views/course/sop/SopDialog.vue'
  644. import selectUser from "@/views/qw/externalContact/selectUser.vue";
  645. import { editTalk,editAllTalk } from "@/api/qw/externalContactInfo";
  646. import {createLinkUrl} from "@/api/course/sopCourseLink";
  647. import PaginationMore from "../../../components/PaginationMore/index.vue";
  648. export default {
  649. name: "ExternalContact",
  650. components:{PaginationMore, mycustomer,customerDetails,SopDialog,selectUser,info},
  651. data() {
  652. return {
  653. user:{
  654. open:false,
  655. title:"修改客户"
  656. },
  657. userForm:{
  658. id:null,
  659. fsUserId:null,
  660. },
  661. myQwUserList:[],
  662. // 遮罩层
  663. loading: false,
  664. // 导出遮罩层
  665. exportLoading: false,
  666. tagOpen:false,
  667. tagDelOpen:false,
  668. sTime:null,
  669. eTime:null,
  670. createTime:null,
  671. // 选中数组
  672. ids: [],
  673. isBindMiniOptions:[
  674. {dictLabel:"已绑定",dictValue:'isBindMini'},
  675. {dictLabel:"未绑定",dictValue:'noBindMini'},
  676. ],
  677. isBindActiveName:"all",
  678. remarkMobiles: [],
  679. inputVisible: false,
  680. inputValue: '',
  681. // 非单个禁用
  682. single: true,
  683. tagGroupList: [],
  684. //标签弹窗选择
  685. tagChange:{
  686. open:false,
  687. index:null,
  688. },
  689. // 非多个禁用
  690. multiple: true,
  691. // 显示搜索条件
  692. showSearch: true,
  693. // 总条数
  694. total: 0,
  695. // 企业微信客户表格数据
  696. externalContactList: [],
  697. // 弹出层标题
  698. title: "",
  699. // 是否显示弹出层
  700. open: false,
  701. // 用户类别字典
  702. typeOptions: [],
  703. ratingType: [],
  704. ratingUpFall: [],
  705. // 性别字典
  706. genderOptions: [],
  707. addTagForm:{
  708. userIds:[],
  709. tagIds:[]
  710. },
  711. myQwCompanyList:[],
  712. // show:{
  713. // title:"客户详情",
  714. // open:false,
  715. // },
  716. //存储选择的客户
  717. chooseCustomerSOP:null,
  718. setSop:{
  719. title:"选择课节SOP",
  720. open:false,
  721. //区分单选1还是多选2
  722. type:null,
  723. },
  724. //合成的客户-课节SOP参数
  725. customerCourseForm:{},
  726. //查询是否已经设置过客户-某个课节的SOP
  727. customerCourseFormLogs:{},
  728. //绑定客户
  729. bindCustomer:{
  730. title:null,
  731. open:false,
  732. },
  733. callOpen:{
  734. open:false,
  735. title: '修改客户称呼',
  736. },
  737. callOpenFrom:{
  738. id:null,
  739. stageStatus:null,
  740. },
  741. callOpenRule:{
  742. stageStatus:[{required:true,message:"员工称呼不能为空",trigger:"blur"}]
  743. },
  744. //绑定的参数表
  745. qwFormCustomer:{
  746. externalContactId:null,
  747. customerId:null,
  748. },
  749. show:{
  750. title:"用户信息",
  751. open:false,
  752. },
  753. // 来源字典
  754. addWayOptions: [],
  755. // 查询参数
  756. queryParams: {
  757. pageNum: 1,
  758. pageSize: 10,
  759. userId: null,
  760. qwUserName:null,
  761. externalUserId: null,
  762. name: null,
  763. avatar: null,
  764. type: null,
  765. qwUserId:null,
  766. gender: null,
  767. description: null,
  768. tagIds: null,
  769. remark:null,
  770. remarkMobiles: null,
  771. remarkCorpName: null,
  772. addWay: null,
  773. operUserid: null,
  774. corpId: null,
  775. companyId: null,
  776. status:null,
  777. transferStatus:null,
  778. isBind:null,
  779. isBindMini:null,
  780. lossTime:null,
  781. createTime:null,
  782. level:null,
  783. levelType:null
  784. },
  785. queryTagParams:{
  786. pageNum: 1,
  787. pageSize: 5,
  788. total:0,
  789. name:null,
  790. corpId:null,
  791. },
  792. tagTotal:0,
  793. //标签
  794. changeTagDialog:{
  795. title:"",
  796. open:false,
  797. },
  798. selectTags:[],
  799. // 表单参数
  800. form: {},
  801. tagList:[],
  802. transferStatusOptions:[],
  803. statusOptions:[],
  804. // 表单校验
  805. rules: {
  806. }
  807. };
  808. },
  809. created() {
  810. this.getDicts("sys_qw_externalContact_type").then(response => {
  811. this.typeOptions = response.data;
  812. });
  813. this.getDicts("sys_qw_sop_rating_type").then(response => {
  814. this.ratingType = response.data;
  815. });
  816. this.getDicts("sys_qw_sop_rating_upFall").then(response => {
  817. this.ratingUpFall = response.data;
  818. });
  819. this.handleGetMyQwUserList();
  820. this.getDicts("sys_sex").then(response => {
  821. this.genderOptions = response.data;
  822. });
  823. this.getDicts("sys_qw_externalContact_addWay").then(response => {
  824. this.addWayOptions = response.data;
  825. });
  826. this.getDicts("sys_qw_external_contact_status").then(response => {
  827. this.statusOptions = response.data;
  828. });
  829. this.getDicts("sys_qw_transfer_status").then(response => {
  830. this.transferStatusOptions = response.data;
  831. });
  832. },
  833. methods: {
  834. change(){
  835. if(this.createTime!=null){
  836. this.queryParams.sTime=this.createTime[0];
  837. this.queryParams.eTime=this.createTime[1];
  838. }else{
  839. this.queryParams.sTime=null;
  840. this.queryParams.eTime=null;
  841. }
  842. },
  843. handledetails(row){
  844. this.show.open=true;
  845. setTimeout(() => {
  846. this.$refs.Details.getDetails(row.id);
  847. }, 1);
  848. },
  849. updateQwuser(){
  850. for (const user of this.myQwUserList) {
  851. if (user.dictValue == this.queryParams.qwUserId) {
  852. this.queryParams.corpId=user.corpId;
  853. break;
  854. }
  855. }
  856. var listTagFrom={corpId:this.queryParams.corpId}
  857. listTag(listTagFrom).then(response => {
  858. this.tagList = response.rows;
  859. });
  860. this.getList();
  861. },
  862. //搜索的标签
  863. hangleChangeTags(){
  864. this.changeTagDialog.title="搜索的标签"
  865. this.changeTagDialog.open=true;
  866. // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
  867. const selectedTagIds = new Set(
  868. (this.selectTags || []).map(tagItem => tagItem?.tagId)
  869. );
  870. this.queryTagParams.name=null;
  871. this.getPageListTagGroup();
  872. setTimeout(() => {
  873. for (let i = 0; i < this.tagGroupList.length; i++) {
  874. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  875. this.tagGroupList[i].tag[x].isSelected = selectedTagIds.has(this.tagGroupList[i].tag[x].tagId);
  876. }
  877. }
  878. }, 200);
  879. },
  880. //确定选择标签
  881. tagSubmitForm(){
  882. for (let i = 0; i < this.tagGroupList.length; i++) {
  883. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  884. if (this.tagGroupList[i].tag[x].isSelected === true) {
  885. if (!this.selectTags) {
  886. this.selectTags = [];
  887. }
  888. // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
  889. let tagExists = this.selectTags.some(
  890. tag => tag.id === this.tagGroupList[i].tag[x].id
  891. );
  892. // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
  893. if (!tagExists) {
  894. this.selectTags.push(this.tagGroupList[i].tag[x]);
  895. }
  896. }
  897. }
  898. }
  899. if (!this.selectTags || this.selectTags.length === 0) {
  900. return this.$message('请选择标签');
  901. }
  902. this.changeTagDialog.open = false;
  903. },
  904. //取消选择标签
  905. tagCancel(){
  906. this.changeTagDialog.open = false;
  907. },
  908. //删除一些选择的标签
  909. handleCloseTags(list){
  910. const ls = this.selectTags.findIndex(t => t.tagId === list.tagId);
  911. if (ls !== -1) {
  912. this.selectTags.splice(ls, 1);
  913. this.selectTags = [...this.selectTags];
  914. }
  915. if (this.selectTags!=null && this.selectTags.length>0){
  916. // 确保 this.form.tags 是数组
  917. if (!this.queryParams.tagIds) {
  918. this.queryParams.tagIds = []; // 如果未定义,初始化
  919. } else {
  920. this.queryParams.tagIds = []; // 清空已有数据
  921. }
  922. // 遍历并添加 tagId
  923. this.selectTags.forEach(tag => {
  924. if (tag.tagId) { // 确保 tagId 存在
  925. this.queryParams.tagIds.push(tag.tagId);
  926. }
  927. });
  928. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  929. }else {
  930. this.queryParams.tagIds=null;
  931. }
  932. },
  933. /** 查询企业微信客户列表 */
  934. getList() {
  935. this.loading = true;
  936. myList(this.queryParams).then(response => {
  937. this.externalContactList = response.rows;
  938. this.total = response.total;
  939. this.loading = false;
  940. });
  941. },
  942. getPageListTagGroup(){
  943. this.queryTagParams.corpId=this.queryParams.corpId
  944. allListTagGroup(this.queryTagParams).then(response => {
  945. this.tagGroupList = response.rows;
  946. this.tagTotal = response.total;
  947. });
  948. },
  949. handleSearchTags(name){
  950. if (!name){
  951. return this.$message.error("请输入要搜索的标签")
  952. }
  953. this.queryTagParams.name=name;
  954. this.queryTagParams.corpId=this.queryParams.corpId;
  955. searchTags(this.queryTagParams).then(response => {
  956. this.tagGroupList = response.rows;
  957. });
  958. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  959. // this.tagGroupList = response.rows;
  960. // });
  961. },
  962. handleGetMyQwUserList(){
  963. getMyQwUserList().then(response => {
  964. this.myQwUserList = response.data;
  965. if(this.myQwUserList!=null){
  966. this.queryParams.qwUserId=this.myQwUserList[0].dictValue
  967. this.queryParams.corpId=this.myQwUserList[0].corpId
  968. this.handleGetTagsList();
  969. this.getList();
  970. }
  971. });
  972. },
  973. cancelSearchTags(){
  974. this.resetSearchQueryTag()
  975. this.getPageListTagGroup();
  976. },
  977. resetSearchQueryTag(){
  978. this.queryTagParams= {
  979. pageNum: 1,
  980. pageSize: 5,
  981. total:0,
  982. name:null,
  983. };
  984. },
  985. handleGetTagsList(){
  986. var listTagFrom={corpId:this.queryParams.corpId}
  987. listTag(listTagFrom).then(response => {
  988. this.tagList = response.rows;
  989. });
  990. },
  991. bindMiniCustomerId(row){
  992. this.userForm.fsUserId=row;
  993. bindUserId(this.userForm).then(res=>{
  994. if (res.code==200){
  995. this.$message.success('绑定成功')
  996. }else {
  997. this.$message.error('绑定失败:',res.msg)
  998. }
  999. this.getList()
  1000. this.user.open=false;
  1001. })
  1002. },
  1003. /** 查看客户详情 */
  1004. handleShow(row){
  1005. this.show.open=true;
  1006. var that=this;
  1007. const tab = "visit";
  1008. setTimeout(() => {
  1009. that.$refs.customerDetails.getDetails(row.customerId);
  1010. that.$refs.customerDetails.handleClick(tab);
  1011. }, 200);
  1012. },
  1013. handleClickX(tab, event) {
  1014. this.queryParams.isBind=tab.name;
  1015. this.handleQuery();
  1016. },
  1017. handleClose(tag) {
  1018. this.remarkMobiles.splice(this.remarkMobiles.indexOf(tag), 1);
  1019. },
  1020. showInput() {
  1021. this.inputVisible = true;
  1022. this.$nextTick(_ => {
  1023. this.$refs.saveTagInput.$refs.input.focus();
  1024. });
  1025. },
  1026. handleInputConfirm() {
  1027. let inputValue = this.inputValue;
  1028. if (inputValue) {
  1029. this.remarkMobiles.push(inputValue);
  1030. }
  1031. this.inputVisible = false;
  1032. this.inputValue = '';
  1033. },
  1034. addUserTag(){
  1035. if(this.ids==null||this.ids==""){
  1036. return this.$message('请选择需要添加标签的客户');
  1037. }
  1038. this.getPageListTagGroup();
  1039. setTimeout(() => {
  1040. for (let i = 0; i < this.tagGroupList.length; i++) {
  1041. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1042. this.tagGroupList[i].tag[x].isSelected=false;
  1043. }
  1044. }
  1045. }, 200);
  1046. this.tagOpen = true;
  1047. },
  1048. delUserTag(){
  1049. if(this.ids==null||this.ids==""){
  1050. return this.$message('请选择需要移除标签的客户');
  1051. }
  1052. this.getPageListTagGroup();
  1053. setTimeout(() => {
  1054. for (let i = 0; i < this.tagGroupList.length; i++) {
  1055. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1056. this.tagGroupList[i].tag[x].isSelected=false;
  1057. }
  1058. }
  1059. }, 200);
  1060. this.tagDelOpen = true;
  1061. },
  1062. //重新获取页面数据
  1063. refreshList(){
  1064. this.getList();
  1065. },
  1066. //批量设置课程sop
  1067. setUserCourseSop(){
  1068. if(this.ids==null||this.ids==""){
  1069. return this.$message('请选择需要设置课程SOP的客户');
  1070. }
  1071. this.$confirm('批量设置客户课节SOP可能会存在重复,确定要批量设置吗?', "警告", {
  1072. confirmButtonText: "确定",
  1073. cancelButtonText: "取消",
  1074. type: "warning"
  1075. }).then(() => {
  1076. this.setSop.open = true;
  1077. this.setSop.type = 2;
  1078. })
  1079. .catch(() => {
  1080. // 可以处理用户点击“取消”的逻辑
  1081. });
  1082. },
  1083. tagSelection(row){
  1084. row.isSelected= !row.isSelected;
  1085. this.$forceUpdate();
  1086. },
  1087. // 取消按钮
  1088. cancel() {
  1089. this.open = false;
  1090. this.reset();
  1091. },
  1092. addTagCancel() {
  1093. this.tagOpen = false;
  1094. this.addTagForm={
  1095. userIds:[],
  1096. tagIds:[]
  1097. };
  1098. },
  1099. DelTagCancel() {
  1100. this.tagDelOpen = false;
  1101. this.addTagForm={
  1102. userIds:[],
  1103. tagIds:[]
  1104. };
  1105. },
  1106. addTagSubmitForm(){
  1107. for (let i = 0; i < this.tagGroupList.length; i++) {
  1108. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1109. if(this.tagGroupList[i].tag[x].isSelected==true){
  1110. this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1111. }
  1112. }
  1113. }
  1114. if(this.addTagForm.tagIds==[]||this.addTagForm.tagIds==null||this.addTagForm.tagIds==""){
  1115. return this.$message('请选择标签');
  1116. }
  1117. this.addTagForm.corpId=this.queryParams.corpId
  1118. this.addTagForm.userIds=this.ids;
  1119. let loadingRock = this.$loading({
  1120. lock: true,
  1121. text: '正在执行中请稍后~~请不要刷新页面!!',
  1122. spinner: 'el-icon-loading',
  1123. background: 'rgba(0, 0, 0, 0.7)'
  1124. });
  1125. addTag(this.addTagForm).then(response => {
  1126. this.msgSuccess(response.msg);
  1127. this.tagOpen = false;
  1128. loadingRock.close();
  1129. this.addTagForm={
  1130. userIds:[],
  1131. tagIds:[]
  1132. };
  1133. this.getList()
  1134. }).finally(res=>{
  1135. loadingRock.close();
  1136. });
  1137. },
  1138. tagDelSubmitForm(){
  1139. for (let i = 0; i < this.tagGroupList.length; i++) {
  1140. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1141. if(this.tagGroupList[i].tag[x].isSelected==true){
  1142. this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1143. }
  1144. }
  1145. }
  1146. if(this.addTagForm.tagIds==[]||this.addTagForm.tagIds==null||this.addTagForm.tagIds==""){
  1147. return this.$message('请选择标签');
  1148. }
  1149. this.addTagForm.corpId=this.queryParams.corpId
  1150. this.addTagForm.userIds=this.ids;
  1151. let loadingRock = this.$loading({
  1152. lock: true,
  1153. text: '正在执行中请稍后~~请不要刷新页面!!',
  1154. spinner: 'el-icon-loading',
  1155. background: 'rgba(0, 0, 0, 0.7)'
  1156. });
  1157. delTag(this.addTagForm).then(response => {
  1158. this.msgSuccess(response.msg);
  1159. this.tagDelOpen = false;
  1160. loadingRock.close();
  1161. this.addTagForm={
  1162. userIds:[],
  1163. tagIds:[]
  1164. };
  1165. this.getList()
  1166. }).finally(res=>{
  1167. loadingRock.close();
  1168. });
  1169. },
  1170. // 表单重置
  1171. reset() {
  1172. this.form = {
  1173. id: null,
  1174. userId: null,
  1175. externalUserId: null,
  1176. name: null,
  1177. companyUserId:null,
  1178. customerId:null,
  1179. avatar: null,
  1180. type: null,
  1181. gender: null,
  1182. remark: null,
  1183. description: null,
  1184. tagIds: null,
  1185. remarkMobiles: null,
  1186. remarkCorpName: null,
  1187. addWay: null,
  1188. operUserid: null,
  1189. corpId: null,
  1190. companyId: null,
  1191. transferStatus:null,
  1192. status:null,
  1193. createTime:null,
  1194. transferTime:null,
  1195. transferNum:null,
  1196. lossTime:null,
  1197. delTime:null,
  1198. state:null,
  1199. wayId:null,
  1200. stageStatus:null,
  1201. customerName:null
  1202. };
  1203. this.resetForm("form");
  1204. },
  1205. /** 搜索按钮操作 */
  1206. handleQuery() {
  1207. if (this.selectTags!=null && this.selectTags.length>0){
  1208. // 确保 this.form.tags 是数组
  1209. if (!this.queryParams.tagIds) {
  1210. this.queryParams.tagIds = []; // 如果未定义,初始化
  1211. } else {
  1212. this.queryParams.tagIds = []; // 清空已有数据
  1213. }
  1214. // 遍历并添加 tagId
  1215. this.selectTags.forEach(tag => {
  1216. if (tag.tagId) { // 确保 tagId 存在
  1217. this.queryParams.tagIds.push(tag.tagId);
  1218. }
  1219. });
  1220. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  1221. }else {
  1222. this.queryParams.tagIds=null;
  1223. }
  1224. this.queryParams.pageNum = 1;
  1225. this.getList();
  1226. },
  1227. /** 重置按钮操作 */
  1228. resetQuery() {
  1229. this.resetForm("queryForm");
  1230. this.queryParams.qwUserId=this.myQwUserList[0].dictValue;
  1231. this.queryParams.corpId=this.myQwUserList[0].corpId;
  1232. this.selectTags=[];
  1233. this.createTime=null;
  1234. this.queryParams.sTime=null;
  1235. this.queryParams.eTime=null;
  1236. this.handleQuery();
  1237. },
  1238. // 多选框选中数据
  1239. handleSelectionChange(selection) {
  1240. this.ids = selection.map(item => item.id)
  1241. this.single = selection.length!==1
  1242. this.multiple = !selection.length
  1243. },
  1244. /** 新增按钮操作 */
  1245. handleAdd() {
  1246. this.loading=true;
  1247. this.form.corpId=this.queryParams.corpId
  1248. addExternalContact(this.form).then(response => {
  1249. this.msgSuccess("同步成功");
  1250. this.getList();
  1251. }).finally(()=>{
  1252. this.loading=false;
  1253. });
  1254. },
  1255. /** 修改按钮操作 */
  1256. handleUpdate(row) {
  1257. this.reset();
  1258. const id = row.id || this.ids
  1259. getExternalContact(id).then(response => {
  1260. this.form = response.data;
  1261. if(this.form.remarkMobiles!=null){
  1262. this.remarkMobiles=JSON.parse(this.form.remarkMobiles)
  1263. }else{
  1264. this.remarkMobiles=[]
  1265. }
  1266. this.open = true;
  1267. this.title = "修改企业微信客户";
  1268. });
  1269. },
  1270. handleAppellation(val){
  1271. this.callOpen.open=true;
  1272. this.callOpenFrom.stageStatus=val.stageStatus;
  1273. this.callOpenFrom.id=val.id;
  1274. },
  1275. /** 绑定客户操作 */
  1276. handleUpdateCustomer(row){
  1277. this.bindCustomer.title="绑定客户"
  1278. this.bindCustomer.open=true;
  1279. this.form.id=row.id
  1280. this.form.externalUserId=row.externalUserId
  1281. this.form.name=row.name
  1282. },
  1283. handleUpdateUser(row){
  1284. this.user.title="绑定客户"
  1285. this.user.open=true;
  1286. this.userForm.id=row.id;
  1287. },
  1288. handleUnBindUserId(val){
  1289. this.$confirm(
  1290. '确认解绑客户:<span style="color: green;">' + val.name + '' +
  1291. '</span> 的小程序用户?<br><span style="color: red;">【ps:可能会导致客户无法看课】</span>',
  1292. {
  1293. confirmButtonText: "确定",
  1294. cancelButtonText: "取消",
  1295. type: "warning",
  1296. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1297. }
  1298. ).then(() => {
  1299. return unBindUserId(val.id);
  1300. }).then(response => {
  1301. this.getList();
  1302. this.msgSuccess("解绑成功");
  1303. }).finally(res=>{
  1304. this.getList();
  1305. })
  1306. },
  1307. bindCustomerId(row){
  1308. console.log("row",row)
  1309. // this.qwFormCustomer.customerId=row;
  1310. this.form.customerId=row;
  1311. this.form.corpId=this.queryParams.corpId;
  1312. this.msgWarning("绑定中.....同步信息中.....");
  1313. editbindCustomer(this.form).then(res=>{
  1314. //清空表单
  1315. this.reset();
  1316. this.bindCustomer.open = false;
  1317. this.msgSuccess("绑定成功");
  1318. this.getList();
  1319. })
  1320. },
  1321. //设置一个SOP
  1322. setCourseSOP(row) {
  1323. // 检查 row.miniUserId 是否为 null
  1324. if (row.miniUserId === null || row.miniUserId === undefined) {
  1325. return this.$confirm('当前客户【CRM客户详情】中 未绑定小程序客户,请先绑定', "警告", {
  1326. confirmButtonText: "确定",
  1327. cancelButtonText: "取消",
  1328. type: "warning"
  1329. }).catch(error => {
  1330. this.msgWarning("操作取消:", error);
  1331. });
  1332. } else {
  1333. this.chooseCustomerSOP = row;
  1334. this.setSop.open = true;
  1335. this.setSop.type=1;
  1336. }
  1337. },
  1338. //选择课程SOP
  1339. // 用于设置 customerCourseForm 和 customerCourseFormLogs 的共同属性
  1340. setCommonProperties(form, row) {
  1341. form.qwUserid = this.chooseCustomerSOP.userId;
  1342. form.companyUserId = this.chooseCustomerSOP.companyUserId;
  1343. form.externalUserId = this.chooseCustomerSOP.externalUserId;
  1344. form.customerId = this.chooseCustomerSOP.customerId;
  1345. form.miniUserId = this.chooseCustomerSOP.miniUserId;
  1346. form.businessId = row.businessId;
  1347. },
  1348. bindCourseSop(row,days) {
  1349. if (this.setSop.type==2){
  1350. this.setSop.open = false;
  1351. this.loading=true;
  1352. this.msgWarning("设定中.....同步信息中.....");
  1353. setCustomerCourseSopList({ids:this.ids,fsCourseSopId:row.id,days:days}).then(res=>{
  1354. let msg=" 批量设置成功数【" + res.successNum + "】,<br>"
  1355. if (res.failCRM.length>0){
  1356. msg+="失败的客户【" + res.failCRM + "】,原因是未绑定CRM客户。<br>"
  1357. }
  1358. if (res.failMiNi.length>0){
  1359. msg+="失败的客户【" + res.failMiNi + "】,原因是CRM中未绑定小程序客户。<br>"
  1360. }
  1361. if (res.failCompany.length>0){
  1362. msg+="失败的客户【" + res.failCompany + "】,原因是客户没有所属成员。<br>"
  1363. }
  1364. return this.$confirm(msg, "提示", {
  1365. confirmButtonText: "确定",
  1366. cancelButtonText: "取消",
  1367. type: "warning",
  1368. dangerouslyUseHTMLString: true // 允许使用HTML标签
  1369. }).catch(error => {
  1370. this.msgSuccess("操作完成~");
  1371. });
  1372. }).finally(()=>{
  1373. this.loading = false;
  1374. this.getList();
  1375. })
  1376. }else if (this.setSop.type==1){
  1377. // 设置 customerCourseFormLogs 的属性
  1378. this.setCommonProperties(this.customerCourseFormLogs, row);
  1379. // 设置 customerCourseForm 的属性
  1380. this.setCommonProperties(this.customerCourseForm, row);
  1381. this.customerCourseForm.sopId = row.id;
  1382. this.customerCourseForm.sopType = row.sopType;
  1383. this.customerCourseForm.setting = row.setting;
  1384. this.customerCourseForm.days = days;
  1385. // 执行异步操作
  1386. getCustomerCourseSop(this.customerCourseFormLogs)
  1387. .then(res => {
  1388. if (res) {
  1389. return this.$confirm('当前客户已设置过相同课程课节SOP,确定还要再次设置吗?', "警告", {
  1390. confirmButtonText: "确定",
  1391. cancelButtonText: "取消",
  1392. type: "warning"
  1393. });
  1394. } else {
  1395. return Promise.resolve(); // 如果没有设置过,直接执行后续操作
  1396. }
  1397. })
  1398. .then(() => {
  1399. this.loading = true;
  1400. this.setSop.open = false;
  1401. this.msgSuccess("设定中.....同步信息中.....");
  1402. return setCustomerCourseSop(this.customerCourseForm);
  1403. })
  1404. .then(() => {
  1405. this.msgSuccess("设定成功");
  1406. })
  1407. .catch(error => {
  1408. this.msgWarning("操作取消:", error);
  1409. })
  1410. .finally(() => {
  1411. this.loading = false;
  1412. this.getList();
  1413. });
  1414. }
  1415. },
  1416. submitCallOpenFrom(){
  1417. this.$refs["callOpenFrom"].validate(valid => {
  1418. if (valid) {
  1419. if (this.callOpenFrom.id != null && this.callOpenFrom.stageStatus != null) {
  1420. updateExternalContactCall(this.callOpenFrom).then(res=>{
  1421. this.$message.success('修改成功');
  1422. this.callOpen.open=false;
  1423. this.getList();
  1424. });
  1425. }
  1426. }
  1427. });
  1428. },
  1429. /** 提交按钮 */
  1430. submitForm() {
  1431. this.$refs["form"].validate(valid => {
  1432. if (valid) {
  1433. if (this.form.id != null) {
  1434. this.form.remarkMobiles=JSON.stringify(this.remarkMobiles)
  1435. updateExternalContact(this.form).then(response => {
  1436. this.msgSuccess("修改成功");
  1437. this.open = false;
  1438. this.getList();
  1439. });
  1440. } else {
  1441. addExternalContact(this.form).then(response => {
  1442. this.msgSuccess("新增成功");
  1443. this.open = false;
  1444. this.getList();
  1445. });
  1446. }
  1447. }
  1448. });
  1449. },
  1450. /** 删除按钮操作 */
  1451. handleDelete(row) {
  1452. const ids = row.id || this.ids;
  1453. this.$confirm('是否确认删除企业微信客户编号为"' + ids + '"的数据项?', "警告", {
  1454. confirmButtonText: "确定",
  1455. cancelButtonText: "取消",
  1456. type: "warning"
  1457. }).then(function() {
  1458. return delExternalContact(ids);
  1459. }).then(() => {
  1460. this.getList();
  1461. this.msgSuccess("删除成功");
  1462. }).catch(() => {});
  1463. },
  1464. handleSyncMyExternalContact(){
  1465. this.loading=true;
  1466. let loadingRock = this.$loading({
  1467. lock: true,
  1468. text: '正在执行中请稍后~~请不要刷新页面!!',
  1469. spinner: 'el-icon-loading',
  1470. background: 'rgba(0, 0, 0, 0.7)'
  1471. });
  1472. syncMyExternalContact(this.queryParams.qwUserId).then(res => {
  1473. this.msgSuccess("同步成功");
  1474. this.loading=false;
  1475. loadingRock.close();
  1476. this.getList();
  1477. }).catch(res=>{
  1478. console.log("asdasdwaaw ")
  1479. loadingRock.close();
  1480. }).finally(res=>{
  1481. loadingRock.close();
  1482. this.loading=false;
  1483. })
  1484. },
  1485. handleSyncAddMyExternalContact(){
  1486. this.loading=true;
  1487. let loadingRock = this.$loading({
  1488. lock: true,
  1489. text: '正在执行中请稍后~~请不要刷新页面!!',
  1490. spinner: 'el-icon-loading',
  1491. background: 'rgba(0, 0, 0, 0.7)'
  1492. });
  1493. syncMyAddExternalContact(this.queryParams.qwUserId).then(res => {
  1494. this.msgSuccess("同步成功");
  1495. this.loading=false;
  1496. loadingRock.close();
  1497. this.getList();
  1498. }).finally(()=>{
  1499. loadingRock.close();
  1500. this.loading=false;
  1501. })
  1502. },
  1503. updateTalk(row){
  1504. const ids = row.id || this.ids;
  1505. this.$confirm('是否确认批量更改用户信息为非首次交流', "警告", {
  1506. confirmButtonText: "确定",
  1507. cancelButtonText: "取消",
  1508. type: "warning"
  1509. }).then(function() {
  1510. return editTalk(ids);
  1511. }).then(() => {
  1512. this.getList();
  1513. this.msgSuccess("成功");
  1514. }).catch(() => {});
  1515. },
  1516. updateAllTalk(row){
  1517. const id = this.queryParams.qwUserId
  1518. this.$confirm('是否确认更改全部用户信息为非首次交流', "警告", {
  1519. confirmButtonText: "确定",
  1520. cancelButtonText: "取消",
  1521. type: "warning"
  1522. }).then(function() {
  1523. return editAllTalk(id);
  1524. }).then(() => {
  1525. this.getList();
  1526. this.msgSuccess("成功");
  1527. }).catch(() => {});
  1528. },
  1529. /** 导出按钮操作 */
  1530. handleExport() {
  1531. const queryParams = this.queryParams;
  1532. this.$confirm('是否确认导出所有企业微信客户数据项?', "警告", {
  1533. confirmButtonText: "确定",
  1534. cancelButtonText: "取消",
  1535. type: "warning"
  1536. }).then(() => {
  1537. this.exportLoading = true;
  1538. return exportMyExternalContact(queryParams);
  1539. }).then(response => {
  1540. this.download(response.msg);
  1541. this.exportLoading = false;
  1542. }).catch(() => {});
  1543. }
  1544. }
  1545. };
  1546. </script>
  1547. <style scoped>
  1548. /* CSS 样式 */
  1549. .tag-container {
  1550. display: flex;
  1551. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1552. gap: 8px; /* 设置标签之间的间距 */
  1553. }
  1554. .name-background {
  1555. display: inline-block;
  1556. background-color: #abece6; /* 背景颜色 */
  1557. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1558. border-radius: 4px; /* 可选:设置圆角 */
  1559. }
  1560. .tag-box {
  1561. padding: 8px 12px;
  1562. border: 1px solid #989797;
  1563. border-radius: 4px;
  1564. cursor: pointer;
  1565. display: inline-block;
  1566. }
  1567. .tag-selected {
  1568. background-color: #00bc98;
  1569. color: #fff;
  1570. border-color: #00bc98;
  1571. }
  1572. .el-tag + .el-tag {
  1573. margin-left: 10px;
  1574. }
  1575. .button-new-tag {
  1576. margin-left: 10px;
  1577. height: 32px;
  1578. line-height: 30px;
  1579. padding-top: 0;
  1580. padding-bottom: 0;
  1581. }
  1582. .input-new-tag {
  1583. width: 90px;
  1584. margin-left: 10px;
  1585. vertical-align: bottom;
  1586. }
  1587. /* 新增的滚动容器样式(不影响原有样式) */
  1588. .scroll-wrapper {
  1589. max-height: 130px; /* 大约三行的高度 */
  1590. overflow-y: auto; /* 垂直滚动 */
  1591. padding-right: 5px; /* 为滚动条留出空间 */
  1592. }
  1593. /* 美化滚动条(可选) */
  1594. .scroll-wrapper::-webkit-scrollbar {
  1595. width: 6px;
  1596. }
  1597. .scroll-wrapper::-webkit-scrollbar-thumb {
  1598. background: rgba(0, 0, 0, 0.2);
  1599. border-radius: 3px;
  1600. }
  1601. </style>