index.vue 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476
  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="corpId">
  5. <el-select v-model="queryParams.corpId" placeholder="企微公司" size="small" @change="updateCorpId()">
  6. <el-option
  7. v-for="dict in myQwCompanyList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  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="活码id" prop="wayId">
  24. <el-input
  25. v-model="queryParams.wayId"
  26. placeholder="请输入活码id"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item>
  32. <el-form-item label="销售企微昵称" prop="qwUserName">
  33. <el-input
  34. v-model="queryParams.qwUserName"
  35. placeholder="请输入销售企微昵称"
  36. clearable
  37. size="small"
  38. @keyup.enter.native="handleQuery"
  39. @input="searchQwUser"
  40. @focus="showQwUserDropdown = true"
  41. @blur="hideDropdownWithDelay"
  42. @clear="onQwUserNameClear"
  43. />
  44. <!-- 下拉建议 -->
  45. <div v-if="showQwUserDropdown && qwUserSuggestions.length > 0" class="suggestion-box" @scroll="handleScroll">
  46. <div
  47. v-for="item in qwUserSuggestions"
  48. :key="item.dictValue"
  49. class="suggestion-item"
  50. @click="selectQwUser(item.dictValue,item.dictLabel)"
  51. >
  52. {{ item.dictLabel }}
  53. </div>
  54. </div>
  55. </el-form-item>
  56. <el-form-item label="用户类别" prop="type">
  57. <el-select v-model="queryParams.type" placeholder="请选择用户类别" clearable size="small">
  58. <el-option
  59. v-for="dict in typeOptions"
  60. :key="dict.dictValue"
  61. :label="dict.dictLabel"
  62. :value="dict.dictValue"
  63. />
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item label="所属销售" prop="companyUser">
  67. <el-input
  68. v-model="queryParams.companyUser"
  69. placeholder="请输入昵称或者手机号"
  70. clearable
  71. size="small"
  72. @keyup.enter.native="handleQuery"
  73. />
  74. </el-form-item>
  75. <el-form-item label="性别" prop="gender">
  76. <el-select v-model="queryParams.gender" placeholder="性别" clearable size="small">
  77. <el-option
  78. v-for="dict in genderOptions"
  79. :key="dict.dictValue"
  80. :label="dict.dictLabel"
  81. :value="dict.dictValue"
  82. />
  83. </el-select>
  84. </el-form-item>
  85. <el-form-item label="是否重粉" prop="userRepeat">
  86. <el-select v-model="queryParams.userRepeat" placeholder="重粉" clearable size="small">
  87. <el-option label="否" :value="0"/>
  88. <el-option label="是" :value="1"/>
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item label="客户等级" prop="level">
  92. <el-select v-model="queryParams.level" placeholder="客户等级" clearable size="small">
  93. <el-option
  94. v-for="dict in ratingType"
  95. :key="dict.dictValue"
  96. :label="dict.dictLabel"
  97. :value="dict.dictValue"
  98. />
  99. </el-select>
  100. </el-form-item>
  101. <el-form-item label="等级升降" prop="levelType">
  102. <el-select v-model="queryParams.levelType" placeholder="等级升降" clearable size="small">
  103. <el-option
  104. v-for="dict in ratingUpFall"
  105. :key="dict.dictValue"
  106. :label="dict.dictLabel"
  107. :value="dict.dictValue"
  108. />
  109. </el-select>
  110. </el-form-item>
  111. <el-form-item label="电话号码" prop="remarkMobiles">
  112. <el-input
  113. v-model="queryParams.remarkMobiles"
  114. placeholder="请输入备注电话号码"
  115. clearable
  116. size="small"
  117. @keyup.enter.native="handleQuery"
  118. />
  119. </el-form-item>
  120. <el-form-item label="来源" prop="addWay">
  121. <el-select v-model="queryParams.addWay" placeholder="来源" clearable size="small">
  122. <el-option
  123. v-for="dict in addWayOptions"
  124. :key="dict.dictValue"
  125. :label="dict.dictLabel"
  126. :value="dict.dictValue"
  127. />
  128. </el-select>
  129. </el-form-item>
  130. <el-form-item label="状态" prop="status">
  131. <el-select v-model="queryParams.status" placeholder="状态" clearable size="small">
  132. <el-option
  133. v-for="dict in statusOptions"
  134. :key="dict.dictValue"
  135. :label="dict.dictLabel"
  136. :value="dict.dictValue"
  137. />
  138. </el-select>
  139. </el-form-item>
  140. <el-form-item label="转接状态" prop="addWay">
  141. <el-select v-model="queryParams.transferStatus" placeholder="转接状态" clearable size="small">
  142. <el-option
  143. v-for="dict in transferStatusOptions"
  144. :key="dict.dictValue"
  145. :label="dict.dictLabel"
  146. :value="dict.dictValue"
  147. />
  148. </el-select>
  149. </el-form-item>
  150. <el-form-item label="是否绑定会员" prop="isBindMini">
  151. <el-select v-model="queryParams.isBindMini" placeholder="是否绑定会员" clearable size="small" @change="handleQuery" >
  152. <el-option
  153. v-for="dict in isBindMiniOptions"
  154. :key="dict.dictValue"
  155. :label="dict.dictLabel"
  156. :value="dict.dictValue"
  157. />
  158. </el-select>
  159. </el-form-item>
  160. <el-form-item label="标签" prop="tagIds">
  161. <div @click="hangleChangeTags()" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
  162. <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
  163. <el-tag type="success"
  164. closable
  165. :disable-transitions="false"
  166. v-for="list in this.selectTags"
  167. :key="list.tagId"
  168. @close="handleCloseTags(list)"
  169. style="margin: 3px;"
  170. >{{list.name}}
  171. </el-tag>
  172. </div>
  173. </div>
  174. </el-form-item>
  175. <el-form-item label="排除标签" prop="outTagIds">
  176. <div @click="hangleChangeOutTags()"
  177. style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
  178. <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
  179. <el-tag type="success"
  180. closable
  181. :disable-transitions="false"
  182. v-for="list in this.outSelectTags"
  183. :key="list.tagId"
  184. @close="handleCloseOutTags(list)"
  185. style="margin: 3px;"
  186. >{{ list.name }}
  187. </el-tag>
  188. </div>
  189. </div>
  190. </el-form-item>
  191. <el-form-item label="备注" prop="remark">
  192. <el-input
  193. v-model="queryParams.remark"
  194. placeholder="请输入备注"
  195. clearable
  196. size="small"
  197. @keyup.enter.native="handleQuery"
  198. />
  199. </el-form-item>
  200. <el-form-item label="添加时间" prop="createTime">
  201. <el-date-picker
  202. v-model="createTime"
  203. size="small"
  204. style="width: 240px"
  205. value-format="yyyy-MM-dd HH:mm:ss"
  206. type="datetimerange"
  207. range-separator="-"
  208. start-placeholder="开始日期"
  209. end-placeholder="结束日期"
  210. @change="change"
  211. ></el-date-picker>
  212. </el-form-item>
  213. <el-form-item label="流失时间" prop="lossTime">
  214. <el-date-picker clearable size="small"
  215. v-model="queryParams.lossTime"
  216. type="date"
  217. value-format="yyyy-MM-dd"
  218. placeholder="选择流失时间">
  219. </el-date-picker>
  220. </el-form-item>
  221. <el-form-item label="删除时间" prop="delTime">
  222. <el-date-picker clearable size="small"
  223. v-model="queryParams.delTime"
  224. type="date"
  225. value-format="yyyy-MM-dd"
  226. placeholder="选择删除时间">
  227. </el-date-picker>
  228. </el-form-item>
  229. <el-form-item>
  230. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  231. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  232. </el-form-item>
  233. </el-form>
  234. <el-row :gutter="10" class="mb8">
  235. <!-- <el-col :span="1.5">
  236. <el-button
  237. type="primary"
  238. plain
  239. icon="el-icon-plus"
  240. size="mini"
  241. @click="handleAdd"
  242. v-hasPermi="['qw:externalContact:add']"
  243. >同步</el-button>
  244. </el-col> -->
  245. <el-col :span="1.5">
  246. <el-button
  247. type="success"
  248. plain
  249. icon="el-icon-edit"
  250. size="mini"
  251. @click="handleBatchUpdateNotes"
  252. v-hasPermi="['qw:externalContact:edit']"
  253. >批量修改备注
  254. </el-button>
  255. </el-col>
  256. <el-col :span="1.5">
  257. <el-button
  258. type="success"
  259. plain
  260. icon="el-icon-edit"
  261. size="mini"
  262. @click="handleBatchUpdateNotesFilter"
  263. v-hasPermi="['qw:externalContact:edit']"
  264. >批量修改备注(筛选条件)
  265. </el-button>
  266. </el-col>
  267. <el-col :span="1.5">
  268. <el-button
  269. type="success"
  270. plain
  271. icon="el-icon-edit"
  272. size="mini"
  273. :disabled="single"
  274. @click="handleUpdate"
  275. v-hasPermi="['qw:externalContact:edit']"
  276. >修改备注</el-button>
  277. </el-col>
  278. <el-col :span="1.5">
  279. <el-button
  280. type="warning"
  281. plain
  282. icon="el-icon-download"
  283. size="mini"
  284. :loading="exportLoading"
  285. @click="handleExport"
  286. v-hasPermi="['qw:externalContact:export']"
  287. >导出</el-button>
  288. </el-col>
  289. <el-col :span="1.5">
  290. <el-button
  291. type="primary"
  292. plain
  293. size="mini"
  294. @click="addUserTag"
  295. v-hasPermi="['qw:externalContact:addTag']"
  296. >批量添加标签</el-button>
  297. </el-col>
  298. <el-col :span="1.5">
  299. <el-button
  300. type="primary"
  301. plain
  302. size="mini"
  303. @click="addUserTagFilter"
  304. v-hasPermi="['qw:externalContact:addTag']"
  305. >批量添加标签(筛选条件)</el-button>
  306. </el-col>
  307. <el-col :span="1.5">
  308. <el-button
  309. type="primary"
  310. plain
  311. size="mini"
  312. @click="delUserTag"
  313. v-hasPermi="['qw:externalContact:delTag']"
  314. >批量移除标签</el-button>
  315. </el-col>
  316. <el-col :span="1.5">
  317. <el-button
  318. type="primary"
  319. plain
  320. size="mini"
  321. @click="updateTalk"
  322. v-hasPermi="['qw:externalContactInfo:updateTalk']"
  323. >批量更改交流状态</el-button>
  324. </el-col>
  325. <!-- <el-col :span="1.5">-->
  326. <!-- <el-button-->
  327. <!-- type="primary"-->
  328. <!-- plain-->
  329. <!-- size="mini"-->
  330. <!-- @click="setUserCourseSop"-->
  331. <!-- v-hasPermi="['qw:externalContact:setCourseSop']"-->
  332. <!-- >批量设置课程SOP</el-button>-->
  333. <!-- </el-col>-->
  334. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  335. </el-row>
  336. <!-- <el-tabs type="card" v-model="isBindActiveName" @tab-click="handleClickX">-->
  337. <!-- <el-tab-pane label="全部" name="all"></el-tab-pane>-->
  338. <!-- <el-tab-pane label="已绑定CRM" name="isBind"></el-tab-pane>-->
  339. <!-- <el-tab-pane label="未绑定CRM" name="noBind"></el-tab-pane>-->
  340. <!-- </el-tabs>-->
  341. <el-table v-loading="loading" :data="externalContactList" @selection-change="handleSelectionChange" border>
  342. <el-table-column type="selection" width="55" align="center" />
  343. <el-table-column label="企微客户ID" align="center" prop="id" />
  344. <el-table-column label="企微客户头像" align="center" prop="avatar" width="100px">
  345. <template slot-scope="scope">
  346. <el-popover
  347. placement="right"
  348. title=""
  349. trigger="hover">
  350. <img slot="reference" :src="scope.row.avatar" width="60px">
  351. <img :src="scope.row.avatar" style="max-width: 200px;">
  352. </el-popover>
  353. </template>
  354. </el-table-column>
  355. <el-table-column label="企微客户名称" prop="name" width="110px"/>
  356. <el-table-column label="客户称呼" prop="stageStatus" width="110px"/>
  357. <el-table-column label="销售企微昵称" align="center" prop="qwUserName" width="120px"/>
  358. <el-table-column label="企微部门" align="center" prop="departmentName" width="120px"/>
  359. <el-table-column label="用户类别" align="center" prop="type">
  360. <template slot-scope="scope">
  361. <dict-tag :options="typeOptions" :value="scope.row.type"/>
  362. </template>
  363. </el-table-column>
  364. <el-table-column label="性别" align="center" prop="gender">
  365. <template slot-scope="scope">
  366. <dict-tag :options="genderOptions" :value="scope.row.gender"/>
  367. </template>
  368. </el-table-column>
  369. <el-table-column label="备注" align="center" prop="remark" />
  370. <el-table-column label="描述信息" align="center" prop="description" />
  371. <el-table-column label="标签" align="center" prop="tagIdsName" width="300px">
  372. <!-- <template slot-scope="scope">-->
  373. <!-- <div v-for="name in scope.row.tagIdsName" style="display: inline;">-->
  374. <!-- <el-tag type="success">{{ name }}</el-tag>-->
  375. <!-- </div>-->
  376. <!-- </template>-->
  377. <template slot-scope="scope">
  378. <div class="tag-container">
  379. <div class="tag-list">
  380. <el-tag
  381. v-for="name in scope.row.tagIdsName"
  382. :key="name"
  383. type="success"
  384. size="small"
  385. >
  386. {{ name }}
  387. </el-tag>
  388. </div>
  389. </div>
  390. </template>
  391. </el-table-column>
  392. <el-table-column label="是否回复" align="center" prop="isReply" width="120px" >
  393. <template slot-scope="scope">
  394. <span v-if="scope.row.isReply === 1"><el-tag type="success">已回复</el-tag></span>
  395. <span v-else-if="scope.row.isReply === 0"><el-tag type="info">未回复</el-tag></span>
  396. <span v-else>{{ scope.row.isReply }}</span>
  397. </template>
  398. </el-table-column>
  399. <el-table-column label="状态" align="center" prop="status" width="120px" >
  400. <template slot-scope="scope">
  401. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  402. </template>
  403. </el-table-column>
  404. <el-table-column label="客户等级" align="center" prop="level" width="120px" >
  405. <template slot-scope="scope">
  406. <dict-tag :options="ratingType" :value="scope.row.level"/>
  407. </template>
  408. </el-table-column>
  409. <el-table-column label="state参数" align="center" prop="state" width="100px" />
  410. <el-table-column label="等级状态" align="center" prop="levelType" width="120px" >
  411. <template slot-scope="scope">
  412. <dict-tag :options="ratingUpFall" :value="scope.row.levelType"/>
  413. </template>
  414. </el-table-column>
  415. <el-table-column label="添加时间" align="center" prop="createTime" width="100px" />
  416. <el-table-column label="流失时间" align="center" prop="lossTime" width="100px" />
  417. <el-table-column label="删除时间" align="center" prop="delTime" width="100px" />
  418. <el-table-column label="注册时间" align="center" prop="registerTime" width="100px" />
  419. <el-table-column label="备注电话号码" align="center" prop="remarkMobiles" width="150px">
  420. <template slot-scope="scope">
  421. <div v-for="i in JSON.parse(scope.row.remarkMobiles)" :key="i">{{i}}</div>
  422. </template>
  423. </el-table-column>
  424. <el-table-column label="备注企业名称" align="center" prop="remarkCorpName" />
  425. <el-table-column label="来源" align="center" prop="addWay" width="100px">
  426. <template slot-scope="scope">
  427. <dict-tag :options="addWayOptions" :value="scope.row.addWay"/>
  428. </template>
  429. </el-table-column>
  430. <el-table-column label="转接状态" align="center" prop="transferStatus" width="100px" >
  431. <template slot-scope="scope">
  432. <dict-tag :options="transferStatusOptions" :value="scope.row.transferStatus"/>
  433. </template>
  434. </el-table-column>
  435. <el-table-column label="企业id" align="center" prop="corpId" />
  436. <el-table-column label="广告业务ID" align="center" prop="traceId" />
  437. <el-table-column label="重粉看课历史" width="100px" align="center" fixed="right">
  438. <template slot-scope="scope">
  439. <div v-if="scope.row.fsUserId">
  440. <el-tag type="success" v-if="scope.row.userRepeat == 0">正常</el-tag>
  441. <el-tag type="danger" v-if="scope.row.userRepeat == 1">重粉</el-tag>
  442. <el-button
  443. size="mini"
  444. type="text"
  445. @click="showLog(scope.row)"
  446. >重粉看课历史
  447. </el-button>
  448. </div>
  449. </template>
  450. </el-table-column>
  451. <el-table-column label="是否绑定会员" width="100px" align="center" fixed="right">
  452. <template slot-scope="scope">
  453. <el-tag v-if="scope.row.fsUserId" >已绑定</el-tag>
  454. <el-tag v-else type="info"> 未绑定</el-tag>
  455. </template>
  456. </el-table-column>
  457. <el-table-column label="修改" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  458. <template slot-scope="scope">
  459. <el-button
  460. v-if="scope.row.status==0||scope.row.status==2"
  461. size="mini"
  462. type="text"
  463. icon="el-icon-edit"
  464. @click="handleUpdate(scope.row)"
  465. v-hasPermi="['qw:externalContact:edit']"
  466. >修改备注</el-button>
  467. <el-button
  468. size="mini"
  469. type="text"
  470. icon="el-icon-user-solid"
  471. @click="handleAppellation(scope.row)"
  472. >修改客户称呼</el-button>
  473. </template>
  474. </el-table-column>
  475. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  476. <template slot-scope="scope">
  477. <!-- <el-button-->
  478. <!-- size="mini"-->
  479. <!-- type="text"-->
  480. <!-- icon="el-icon-edit-outline"-->
  481. <!-- @click="handleUpdateCustomer(scope.row)"-->
  482. <!-- >-->
  483. <!-- <span v-if="scope.row.customerId">换绑CRM</span>-->
  484. <!-- <span v-else>绑定CRM</span>-->
  485. <!-- </el-button>-->
  486. <el-button
  487. size="mini"
  488. type="text"
  489. icon="el-icon-edit-outline"
  490. @click="handleUpdateUser(scope.row)"
  491. >
  492. <span v-if="scope.row.fsUserId">换绑会员</span>
  493. <span v-else>绑定会员</span>
  494. </el-button>
  495. <el-button
  496. v-if="scope.row.fsUserId"
  497. size="mini"
  498. type="text"
  499. icon="el-icon-thumb"
  500. @click="handleUnBindUserId(scope.row)"
  501. v-hasPermi="['qw:externalContact:unBindUserId']"
  502. >
  503. <span>解除会员绑定</span>
  504. </el-button>
  505. <!-- <el-button v-if="scope.row.customerId"-->
  506. <!-- size="mini"-->
  507. <!-- type="text"-->
  508. <!-- icon="el-icon-paperclip"-->
  509. <!-- @click="handleShow(scope.row)"-->
  510. <!-- >CRM客户详情</el-button>-->
  511. <el-button
  512. size="mini"
  513. type="text"
  514. @click="handledetails(scope.row)"
  515. >AI获取用户信息
  516. </el-button>
  517. <el-button
  518. size="mini"
  519. type="text"
  520. @click="handleMemberdetails(scope.row)"
  521. v-if="scope.row.fsUserId"
  522. >
  523. <span>会员详情</span>
  524. </el-button>
  525. <el-button
  526. size="mini"
  527. type="text"
  528. @click="handleInfoCollection(scope.row)"
  529. v-if="false"
  530. >
  531. <span>信息采集</span>
  532. </el-button>
  533. <el-button
  534. size="mini"
  535. type="text"
  536. icon="el-icon-edit"
  537. @click="handleChangeStatus(scope.row)"
  538. v-hasPermi="['qw:externalContact:changeStatus']"
  539. >
  540. 修改状态
  541. </el-button>
  542. </template>
  543. </el-table-column>
  544. </el-table>
  545. <pagination
  546. v-show="total>0"
  547. :total="total"
  548. :page.sync="queryParams.pageNum"
  549. :limit.sync="queryParams.pageSize"
  550. @pagination="getList"
  551. />
  552. <el-drawer size="75%" :title="show.title" :visible.sync="show.open">
  553. <customer-details ref="customerDetails" @refreshList="refreshList"/>
  554. </el-drawer>
  555. <el-drawer
  556. :with-header="false"
  557. size="75%"
  558. :title="show.title" :visible.sync="show.open">
  559. <userDetails ref="userDetails" />
  560. </el-drawer>
  561. <!-- 搜索标签 -->
  562. <el-dialog :title="changeTagDialog.title" :visible.sync="changeTagDialog.open" style="width:100%;height: 100%" append-to-body>
  563. <div>搜索标签:
  564. <el-input v-model="queryTagParams.name" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  565. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(queryTagParams.name)">搜索</el-button>
  566. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  567. </div>
  568. <div v-for="item in tagGroupList" :key="item.id" >
  569. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  570. <span class="name-background">{{ item.name }}</span>
  571. </div>
  572. <!-- 添加外层滚动容器 -->
  573. <div class="scroll-wrapper">
  574. <div class="tag-container">
  575. <a
  576. v-for="tagItem in item.tag"
  577. class="tag-box"
  578. @click="tagSelection(tagItem)"
  579. :class="{ 'tag-selected': tagItem.isSelected }"
  580. >
  581. {{ tagItem.name }}
  582. </a>
  583. </div>
  584. </div>
  585. </div>
  586. <pagination
  587. v-show="tagTotal>0"
  588. :total="tagTotal"
  589. :page.sync="queryTagParams.pageNum"
  590. :limit.sync="queryTagParams.pageSize"
  591. @pagination="getPageListTagGroup"
  592. />
  593. <div slot="footer" class="dialog-footer">
  594. <el-button type="primary" @click="tagSubmitForm(changeTagDialog.type)">确 定</el-button>
  595. <el-button @click="tagCancel(changeTagDialog.type)">取消</el-button>
  596. </div>
  597. </el-dialog>
  598. <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
  599. <div>搜索标签:
  600. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  601. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  602. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  603. </div>
  604. <el-form ref="form" :model="addTagForm" label-width="80px">
  605. <div v-for="item in tagGroupList" :key="item.id" >
  606. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  607. <span class="name-background">{{ item.name }}</span>
  608. </div>
  609. <!-- 添加外层滚动容器 -->
  610. <div class="scroll-wrapper">
  611. <div class="tag-container">
  612. <a
  613. v-for="tagItem in item.tag"
  614. class="tag-box"
  615. @click="tagSelection(tagItem)"
  616. :class="{ 'tag-selected': tagItem.isSelected }"
  617. >
  618. {{ tagItem.name }}
  619. </a>
  620. </div>
  621. </div>
  622. </div>
  623. </el-form>
  624. <pagination
  625. v-show="tagTotal>0"
  626. :total="tagTotal"
  627. :page.sync="queryTagParams.pageNum"
  628. :limit.sync="queryTagParams.pageSize"
  629. @pagination="getPageListTagGroup"
  630. />
  631. <div slot="footer" class="dialog-footer">
  632. <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
  633. <el-button @click="addTagCancel">取 消</el-button>
  634. </div>
  635. </el-dialog>
  636. <el-dialog title="批量添加客户备注" :visible.sync="notesOpen.open" width="800px" append-to-body>
  637. <el-card>
  638. <el-row>
  639. <el-col>
  640. <el-radio-group v-model="notesOpen.nameType" style="margin-bottom: 2%">
  641. <el-radio :label="1">
  642. 客户名称添加在【新备注】【前】
  643. </el-radio>
  644. <el-radio :label="2">
  645. 客户名称添加在【新备注】【后】
  646. </el-radio>
  647. <el-radio :label="3">
  648. 不添加客户名称
  649. </el-radio>
  650. </el-radio-group>
  651. </el-col>
  652. <el-col>
  653. <el-radio-group v-model="notesOpen.type">
  654. <el-radio
  655. :label="1"
  656. >添加【新备注】在最【前】面
  657. </el-radio>
  658. <el-radio
  659. :label="2"
  660. >添加【新备注】在最【后】面
  661. </el-radio>
  662. <el-radio
  663. :label="3"
  664. >替换所有备注
  665. </el-radio>
  666. </el-radio-group>
  667. </el-col>
  668. <el-col>
  669. <el-input v-model="notesOpen.notes" placeholder="请输入客户备注(最多20个字,含已有的)" clearable size="small"
  670. maxlength="20" show-word-limit style="width: 500px;margin-top: 3%"/>
  671. <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
  672. <i class="el-icon-info"></i>
  673. 由于企业微信官方限制,备注最多20个字,且自动会去除末尾超出的字
  674. </div>
  675. </el-col>
  676. </el-row>
  677. </el-card>
  678. <div slot="footer" class="dialog-footer">
  679. <el-button type="primary" @click="notesSubmitForm()">确 定</el-button>
  680. <el-button @click="notesCancel()">取消</el-button>
  681. </div>
  682. </el-dialog>
  683. <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
  684. <div>搜索标签:
  685. <el-input v-model="queryTagParams.name" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  686. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(queryTagParams.name)">搜索</el-button>
  687. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  688. </div>
  689. <el-form ref="form" :model="addTagForm" label-width="80px">
  690. <div v-for="item in tagGroupList" :key="item.id" >
  691. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  692. <span class="name-background">{{ item.name }}</span>
  693. </div>
  694. <!-- 添加外层滚动容器 -->
  695. <div class="scroll-wrapper">
  696. <div class="tag-container">
  697. <a
  698. v-for="tagItem in item.tag"
  699. class="tag-box"
  700. @click="tagSelection(tagItem)"
  701. :class="{ 'tag-selected': tagItem.isSelected }"
  702. >
  703. {{ tagItem.name }}
  704. </a>
  705. </div>
  706. </div>
  707. </div>
  708. </el-form>
  709. <pagination
  710. v-show="tagTotal>0"
  711. :total="tagTotal"
  712. :page.sync="queryTagParams.pageNum"
  713. :limit.sync="queryTagParams.pageSize"
  714. @pagination="getPageListTagGroup"
  715. />
  716. <div slot="footer" class="dialog-footer">
  717. <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
  718. <el-button @click="DelTagCancel">取 消</el-button>
  719. </div>
  720. </el-dialog>
  721. <!-- 添加或修改企业微信客户对话框 -->
  722. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  723. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  724. <el-form-item label="备注" prop="remark">
  725. <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
  726. </el-form-item>
  727. <el-form-item label="描述信息" prop="description">
  728. <el-input v-model="form.description" type="textarea" :rows="3" placeholder="请输入描述信息" />
  729. </el-form-item>
  730. <el-form-item label="备注电话号码" prop="remarkMobiles">
  731. <el-tag
  732. :key="tag"
  733. v-for="tag in remarkMobiles"
  734. closable
  735. :disable-transitions="false"
  736. @close="handleClose(tag)">
  737. {{tag}}
  738. </el-tag>
  739. <el-input
  740. style="width:110px"
  741. class="input-new-tag"
  742. v-if="inputVisible"
  743. v-model="inputValue"
  744. ref="saveTagInput"
  745. size="small"
  746. @keyup.enter.native="handleInputConfirm"
  747. @blur="handleInputConfirm"
  748. >
  749. </el-input>
  750. <el-button v-else class="button-new-tag" size="small" style="width: 110px" @click="showInput">新增电话</el-button>
  751. </el-form-item>
  752. <el-form-item label="备注企业名称" prop="remarkCorpName">
  753. <el-input v-model="form.remarkCorpName" placeholder="请输入备注企业名称" />
  754. </el-form-item>
  755. </el-form>
  756. <div slot="footer" class="dialog-footer">
  757. <el-button type="primary" @click="submitForm">确 定</el-button>
  758. <el-button @click="cancel">取 消</el-button>
  759. </div>
  760. </el-dialog>
  761. <el-dialog :title="callOpen.title" :visible.sync="callOpen.open" width="500px" append-to-body>
  762. <el-form ref="callOpenFrom" :model="callOpenFrom" :rules="callOpenRule" label-width="110px">
  763. <el-form-item label="客户称呼" prop="stageStatus">
  764. <el-input v-model="callOpenFrom.stageStatus" placeholder="请输入客户称呼" />
  765. </el-form-item>
  766. </el-form>
  767. <div slot="footer" class="dialog-footer" >
  768. <el-button type="primary" @click="submitCallOpenFrom">确 定</el-button>
  769. </div>
  770. </el-dialog>
  771. <!-- 绑定客户 -->
  772. <el-dialog :title="bindCustomer.title" :visible.sync="bindCustomer.open" width="1200px" append-to-body>
  773. <mycustomer ref="mycustomer" @bindCustomerId="bindCustomerId"></mycustomer>
  774. </el-dialog>
  775. <!-- 重粉看课记录 -->
  776. <el-drawer title="重粉看课历史" :visible.sync="log.open" size="75%" append-to-body>
  777. <div style="padding: 10px">
  778. <el-form :model="log.queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  779. <el-form-item label="所属项目" prop="project">
  780. <el-select v-model="log.queryParams.project" placeholder="请选择项目" filterable clearable size="small">
  781. <el-option
  782. v-for="dict in projectOptions"
  783. :key="dict.dictValue"
  784. :label="dict.dictLabel"
  785. :value="dict.dictValue"
  786. />
  787. </el-select>
  788. </el-form-item>
  789. <el-form-item label="课程" prop="courseId">
  790. <el-select filterable v-model="log.queryParams.courseId" placeholder="请选择课程" clearable size="small"
  791. @change="courseChange(log.queryParams.courseId)">
  792. <el-option
  793. v-for="dict in courseLists"
  794. :key="dict.dictValue"
  795. :label="dict.dictLabel"
  796. :value="dict.dictValue"
  797. />
  798. </el-select>
  799. </el-form-item>
  800. <el-form-item label="小节" prop="videoId">
  801. <el-select filterable v-model="log.queryParams.videoId" placeholder="请选择小节" clearable size="small">
  802. <el-option
  803. v-for="dict in videoList"
  804. :key="dict.dictValue"
  805. :label="dict.dictLabel"
  806. :value="dict.dictValue"
  807. />
  808. </el-select>
  809. </el-form-item>
  810. <el-form-item>
  811. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryWatchLog">搜索</el-button>
  812. </el-form-item>
  813. </el-form>
  814. <el-table v-loading="log.loading" :data="log.list">
  815. <el-table-column label="编号" align="center" prop="id"/>
  816. <el-table-column label="所属企微主体" align="center" prop="corpName"/>
  817. <el-table-column label="所属企微" align="center" prop="qwUserName"/>
  818. <!-- <el-table-column label="企微" align="center" prop="qwUserName"/>-->
  819. <el-table-column label="项目" align="center" prop="projectName"/>
  820. <el-table-column label="课程" align="center" prop="courseName"/>
  821. <el-table-column label="小节" align="aligner" prop="videoName"/>
  822. <el-table-column label="记录时间" align="center" prop="createTime"/>
  823. <el-table-column label="是否完课" align="center" prop="logType">
  824. <template slot-scope="scope">
  825. <el-tag v-if="scope.row.logType == 2" type="success">已完课</el-tag>
  826. <el-tag v-else type="success">未完课</el-tag>
  827. </template>
  828. </el-table-column>
  829. <el-table-column label="完课时间" align="center" prop="finishTime"/>
  830. </el-table>
  831. <pagination
  832. v-show="log.total>0"
  833. :total="log.total"
  834. :page.sync="log.queryParams.pageNum"
  835. :limit.sync="log.queryParams.pageSize"
  836. @pagination="logList"
  837. />
  838. </div>
  839. </el-drawer>
  840. <!-- 设置一个课程sop-->
  841. <el-dialog :title="setSop.title" :visible.sync="setSop.open" width="1200px" append-to-body>
  842. <SopDialog ref="SopDialog" @bindCourseSop="bindCourseSop"></SopDialog>
  843. </el-dialog>
  844. <el-dialog :title="user.title" :visible.sync="user.open" width="800px" append-to-body>
  845. <selectUser ref="selectUser" @bindMiniCustomerId="bindMiniCustomerId"></selectUser>
  846. </el-dialog>
  847. <el-dialog :title="info.title" :visible.sync="info.open" width="1100px" append-to-body>
  848. <info ref="Details" />
  849. </el-dialog>
  850. <el-dialog :title="collection.title" :visible.sync="collection.open" width="1100px" append-to-body>
  851. <collection ref="collection" />
  852. </el-dialog>
  853. <el-dialog title="修改客户状态" :visible.sync="statusDialog.open" width="500px" append-to-body>
  854. <el-form ref="statusForm" :model="statusForm" :rules="statusRules" label-width="100px">
  855. <el-form-item label="状态" prop="status">
  856. <el-select v-model="statusForm.status" placeholder="请选择状态" size="small">
  857. <el-option
  858. v-for="dict in statusOptions"
  859. :key="dict.dictValue"
  860. :label="dict.dictLabel"
  861. :value="dict.dictValue"
  862. />
  863. </el-select>
  864. </el-form-item>
  865. </el-form>
  866. <div slot="footer" class="dialog-footer">
  867. <el-button @click="statusDialog.open = false">取 消</el-button>
  868. <el-button type="primary" @click="submitStatusForm">提 交</el-button>
  869. </div>
  870. </el-dialog>
  871. </div>
  872. </template>
  873. <script>
  874. import {
  875. bindUserId,
  876. addTag,
  877. delTag,
  878. batchUpdateExternalContactNotes,
  879. listExternalContact,
  880. getExternalContact,
  881. delExternalContact,
  882. addExternalContact,
  883. updateExternalContact,
  884. exportExternalContact,
  885. editbindCustomer,
  886. setCustomerCourseSop,
  887. getCustomerCourseSop,
  888. setCustomerCourseSopList,
  889. unBindUserId, updateExternalContactCall,updateExternalContactStatus,getWatchLogList
  890. } from '@/api/qw/externalContact'
  891. import {getMyQwUserList, getMyQwCompanyList, updateUser,getQwUserListLikeName} from "@/api/qw/user";
  892. import {listTag, getTag, searchTags} from "@/api/qw/tag";
  893. import { allListTagGroup,allListTagGroupPage} from "@/api/qw/tagGroup";
  894. import mycustomer from '@/views/qw/externalContact/mycustomer'
  895. import customerDetails from '@/views/qw/externalContact/customerDetails'
  896. import SopDialog from '@/views/course/sop/SopDialog.vue'
  897. import selectUser from "@/views/qw/externalContact/selectUser.vue";
  898. import collection from "@/views/qw/externalContact/collection.vue";
  899. import info from "@/views/qw/externalContact/info.vue";
  900. import { editTalk } from "@/api/qw/externalContactInfo";
  901. import PaginationMore from "../../../components/PaginationMore/index.vue";
  902. import userDetails from '@/views/store/components/userDetails.vue';
  903. import {courseList, videoList} from "@/api/course/courseRedPacketLog";
  904. import Collection from './collection.vue';
  905. export default {
  906. name: "ExternalContact",
  907. components:{PaginationMore, mycustomer,customerDetails,SopDialog,selectUser,info,userDetails,collection},
  908. data() {
  909. return {
  910. projectOptions: [],
  911. courseLists: [],
  912. videoList: [],
  913. //重粉记录的参数
  914. log: {
  915. open: false,
  916. loading: true,
  917. list: [],
  918. total: 0,
  919. queryParams: {
  920. pageNum: 1,
  921. pageSize: 10,
  922. externalUserId: null,
  923. fsUserId: null,
  924. projectId: null,
  925. courseId: null,
  926. videoId: null,
  927. },
  928. },
  929. statusDialog: {
  930. open: false,
  931. title: "修改客户状态"
  932. },
  933. statusForm: {
  934. id: null,
  935. status: null
  936. },
  937. statusRules: {
  938. status: [
  939. {required: true, message: '状态不能为空', trigger: 'change'}
  940. ]
  941. },
  942. notesOpen: {
  943. type: 1,
  944. nameType: 3,
  945. addType: 0,
  946. filter: false,
  947. open: false,
  948. notes: null,
  949. },
  950. user:{
  951. open:false,
  952. title:"修改客户"
  953. },
  954. userForm:{
  955. id:null,
  956. fsUserId:null,
  957. },
  958. info:{
  959. title:"用户信息",
  960. open:false,
  961. },
  962. collection:{
  963. titile:"信息采集",
  964. open:false,
  965. },
  966. // ...其他已有数据
  967. qwUserSuggestions: [], // 已展示的数据
  968. showQwUserDropdown: false, // 控制下拉框显示
  969. qwUserLoading: false, // 加载状态
  970. qwUserNoMore: false, // 是否还有更多数据
  971. qwUserPageNum: 1, // 当前页码
  972. qwUserPageSize: 10, // 每页数量
  973. qwUserTotal: 0, // 总数
  974. isBindMiniOptions:[
  975. {dictLabel:"已绑定",dictValue:'isBindMini'},
  976. {dictLabel:"未绑定",dictValue:'noBindMini'},
  977. ],
  978. //标签弹窗选择
  979. tagChange:{
  980. open:false,
  981. index:null,
  982. },
  983. sTime:null,
  984. eTime:null,
  985. createTime:null,
  986. // 遮罩层
  987. loading: false,
  988. // 导出遮罩层
  989. exportLoading: false,
  990. tagOpen:false,
  991. tagDelOpen:false,
  992. // 选中数组
  993. ids: [],
  994. isBindActiveName:"all",
  995. remarkMobiles: [],
  996. inputVisible: false,
  997. inputValue: '',
  998. // 非单个禁用
  999. single: true,
  1000. tagGroupList: [],
  1001. // 非多个禁用
  1002. multiple: true,
  1003. // 显示搜索条件
  1004. showSearch: true,
  1005. // 总条数
  1006. total: 0,
  1007. // 企业微信客户表格数据
  1008. externalContactList: [],
  1009. // 弹出层标题
  1010. title: "",
  1011. // 是否显示弹出层
  1012. open: false,
  1013. // 用户类别字典
  1014. typeOptions: [],
  1015. ratingType: [],
  1016. ratingUpFall: [],
  1017. // 性别字典
  1018. genderOptions: [],
  1019. addTagForm:{
  1020. userIds:[],
  1021. tagIds:[],
  1022. filter: false,
  1023. addType: 0,
  1024. },
  1025. myQwCompanyList:[],
  1026. show:{
  1027. title:"客户详情",
  1028. open:false,
  1029. },
  1030. //存储选择的客户
  1031. chooseCustomerSOP:null,
  1032. setSop:{
  1033. title:"选择课节SOP",
  1034. open:false,
  1035. //区分单选1还是多选2
  1036. type:null,
  1037. },
  1038. //合成的客户-课节SOP参数
  1039. customerCourseForm:{},
  1040. //查询是否已经设置过客户-某个课节的SOP
  1041. customerCourseFormLogs:{},
  1042. //绑定客户
  1043. bindCustomer:{
  1044. title:null,
  1045. open:false,
  1046. },
  1047. callOpen:{
  1048. open:false,
  1049. title: '修改客户称呼',
  1050. },
  1051. callOpenFrom:{
  1052. id:null,
  1053. stageStatus:null,
  1054. },
  1055. callOpenRule:{
  1056. stageStatus:[{required:true,message:"员工称呼不能为空",trigger:"blur"}]
  1057. },
  1058. //绑定的参数表
  1059. qwFormCustomer:{
  1060. externalContactId:null,
  1061. customerId:null,
  1062. },
  1063. // 来源字典
  1064. addWayOptions: [],
  1065. //标签
  1066. changeTagDialog:{
  1067. title:"",
  1068. open:false,
  1069. type: null,
  1070. },
  1071. queryTagParams:{
  1072. pageNum: 1,
  1073. pageSize: 5,
  1074. total:0,
  1075. name:null,
  1076. corpId:null,
  1077. },
  1078. tagTotal:0,
  1079. tagFilter:false,
  1080. // 查询参数
  1081. queryParams: {
  1082. pageNum: 1,
  1083. pageSize: 10,
  1084. userId: null,
  1085. qwUserName:null,
  1086. externalUserId: null,
  1087. name: null,
  1088. avatar: null,
  1089. type: null,
  1090. qwUserId:null,
  1091. gender: null,
  1092. description: null,
  1093. tagIds: null,
  1094. outTagIds: null,
  1095. remark:null,
  1096. remarkMobiles: null,
  1097. remarkCorpName: null,
  1098. addWay: null,
  1099. operUserid: null,
  1100. corpId: null,
  1101. companyId: null,
  1102. status:null,
  1103. transferStatus:null,
  1104. isBind:null,
  1105. isBindMini:null,
  1106. lossTime:null,
  1107. sTime:null,
  1108. eTime:null,
  1109. createTime:null,
  1110. level:null,
  1111. wayId:null,
  1112. levelType:null,
  1113. companyUser:null,
  1114. userRepeat: null
  1115. },
  1116. //选择的标签
  1117. selectTags:[],
  1118. //排除的标签
  1119. outSelectTags:[],
  1120. // 表单参数
  1121. form: {},
  1122. tagList:[],
  1123. transferStatusOptions:[],
  1124. statusOptions:[],
  1125. // 表单校验
  1126. rules: {
  1127. },
  1128. userId:null,
  1129. };
  1130. },
  1131. created() {
  1132. this.getDicts("sys_course_project").then(response => {
  1133. this.projectOptions = response.data;
  1134. });
  1135. this.getDicts("sys_qw_externalContact_type").then(response => {
  1136. this.typeOptions = response.data;
  1137. });
  1138. this.getDicts("sys_qw_sop_rating_type").then(response => {
  1139. this.ratingType = response.data;
  1140. });
  1141. this.getDicts("sys_qw_sop_rating_upFall").then(response => {
  1142. this.ratingUpFall = response.data;
  1143. });
  1144. getMyQwCompanyList().then(response => {
  1145. this.myQwCompanyList = response.data;
  1146. if(this.myQwCompanyList!=null){
  1147. this.queryParams.corpId=this.myQwCompanyList[0].dictValue
  1148. var listTagFrom={corpId:this.queryParams.corpId}
  1149. listTag(listTagFrom).then(response => {
  1150. this.tagList = response.rows;
  1151. });
  1152. this.getList();
  1153. }
  1154. });
  1155. this.getDicts("sys_sex").then(response => {
  1156. this.genderOptions = response.data;
  1157. });
  1158. this.getDicts("sys_qw_externalContact_addWay").then(response => {
  1159. this.addWayOptions = response.data;
  1160. });
  1161. this.getDicts("sys_qw_external_contact_status").then(response => {
  1162. this.statusOptions = response.data;
  1163. });
  1164. this.getDicts("sys_qw_transfer_status").then(response => {
  1165. this.transferStatusOptions = response.data;
  1166. });
  1167. },
  1168. methods: {
  1169. /** 重粉查看操作 */
  1170. showLog(row) {
  1171. this.log.queryParams.fsUserId = row.fsUserId;
  1172. this.log.open = true;
  1173. this.log.loading = true;
  1174. courseList().then(response => {
  1175. this.courseLists = response.list;
  1176. this.logList();
  1177. })
  1178. },
  1179. handleQueryWatchLog() {
  1180. this.log.queryParams.pageNum = 1;
  1181. this.log.queryParams.pageSize = 10;
  1182. this.logList();
  1183. },
  1184. logList() {
  1185. getWatchLogList(this.log.queryParams).then(e => {
  1186. this.log.loading = false;
  1187. this.log.list = e.rows;
  1188. this.log.total = e.total;
  1189. });
  1190. },
  1191. courseChange(row) {
  1192. this.log.queryParams.videoId = null;
  1193. if (row === '') {
  1194. this.videoList = [];
  1195. return
  1196. }
  1197. videoList(row).then(response => {
  1198. this.videoList = response.list
  1199. });
  1200. },
  1201. handleMemberdetails(row){
  1202. this.show.open=true;
  1203. setTimeout(() => {
  1204. this.$refs.userDetails.getDetails(row.fsUserId);
  1205. }, 1);
  1206. },
  1207. handleInfoCollection(row){
  1208. this.collection.title = "信息采集";
  1209. this.collection.open = true;
  1210. this.userId = row.fsUserId;
  1211. setTimeout(() => {
  1212. this.$refs.collection.getCollectionInfo(row.fsUserId);
  1213. }, 1);
  1214. },
  1215. closeCollection(){
  1216. this.collection.open = false;
  1217. },
  1218. onQwUserNameClear() {
  1219. this.queryParams.qwUserId = null; // 同时清空 qwUserId
  1220. },
  1221. // 搜索企微用户
  1222. searchQwUser(query) {
  1223. if (!query.trim()) {
  1224. this.qwUserSuggestions = [];
  1225. this.showQwUserDropdown = false;
  1226. this.qwUserNoMore = false;
  1227. this.qwUserPageNum = 1;
  1228. return;
  1229. }
  1230. this.queryParams.qwUserName = query;
  1231. this.qwUserPageNum = 1;
  1232. this.qwUserNoMore = false;
  1233. this.qwUserSuggestions = [];
  1234. this.fetchQwUsers(query);
  1235. },
  1236. fetchQwUsers(query) {
  1237. const params = {
  1238. qwUserName: query,
  1239. pageNum: this.qwUserPageNum,
  1240. pageSize: this.qwUserPageSize
  1241. };
  1242. this.qwUserLoading = true;
  1243. getQwUserListLikeName(params).then(res => {
  1244. const list = res.data.list || [];
  1245. const total = res.data.total || 0;
  1246. this.qwUserSuggestions = [...this.qwUserSuggestions, ...list];
  1247. this.qwUserTotal = total;
  1248. // 判断是否还有更多数据
  1249. if (this.qwUserSuggestions.length >= total) {
  1250. this.qwUserNoMore = true;
  1251. }
  1252. this.showQwUserDropdown = true;
  1253. }).finally(() => {
  1254. this.qwUserLoading = false;
  1255. });
  1256. },
  1257. // 选择企微用户
  1258. selectQwUser(key,value) {
  1259. this.queryParams.qwUserName = value;
  1260. this.queryParams.qwUserId = key;
  1261. this.showQwUserDropdown = false;
  1262. this.handleQuery(); // 可选:自动触发查询
  1263. },
  1264. // 延迟隐藏下拉框,防止点击失效
  1265. hideDropdownWithDelay() {
  1266. setTimeout(() => {
  1267. this.showQwUserDropdown = false;
  1268. }, 200);
  1269. },
  1270. handleScroll(e) {
  1271. const container = e.target;
  1272. const scrollTop = container.scrollTop;
  1273. const scrollHeight = container.scrollHeight;
  1274. const clientHeight = container.clientHeight;
  1275. // 距离底部小于 20px 触发加载
  1276. if (scrollHeight - scrollTop - clientHeight < 20 && !this.qwUserLoading && !this.qwUserNoMore) {
  1277. this.qwUserPageNum += 1;
  1278. this.fetchQwUsers(this.queryParams.qwUserName);
  1279. }
  1280. },
  1281. change(){
  1282. if(this.createTime!=null){
  1283. this.queryParams.sTime=this.createTime[0];
  1284. this.queryParams.eTime=this.createTime[1];
  1285. }else{
  1286. this.queryParams.sTime=null;
  1287. this.queryParams.eTime=null;
  1288. }
  1289. },
  1290. updateCorpId(){
  1291. var listTagFrom={corpId:this.queryParams.corpId}
  1292. listTag(listTagFrom).then(response => {
  1293. this.tagList = response.rows;
  1294. });
  1295. this.getList();
  1296. },
  1297. handleChangeStatus(row) {
  1298. this.statusForm = {
  1299. id: row.id,
  1300. status: String(row.status) // 保证与 dictValue 类型一致
  1301. };
  1302. this.statusDialog.open = true;
  1303. },
  1304. submitStatusForm() {
  1305. this.$refs["statusForm"].validate(valid => {
  1306. if (valid) {
  1307. const params = {
  1308. id: this.statusForm.id,
  1309. status: this.statusForm.status
  1310. };
  1311. // 调用接口更新状态
  1312. updateExternalContactStatus(params).then(response => {
  1313. this.msgSuccess("状态修改成功");
  1314. this.statusDialog.open = false;
  1315. this.getList(); // 刷新列表
  1316. }).catch(error => {
  1317. console.error('状态修改失败:', error);
  1318. this.$message.error('状态修改失败');
  1319. });
  1320. }
  1321. });
  1322. },
  1323. /** 查询企业微信客户列表 */
  1324. getList() {
  1325. this.loading = true;
  1326. const { qwUserName, ...queryParams } = this.queryParams;
  1327. listExternalContact(queryParams).then(response => {
  1328. this.externalContactList = response.rows;
  1329. this.total = response.total;
  1330. this.loading = false;
  1331. });
  1332. },
  1333. bindMiniCustomerId(row){
  1334. console.log(row)
  1335. this.userForm.fsUserId=row;
  1336. bindUserId(this.userForm).then(res=>{
  1337. if (res.code==200){
  1338. this.$message.success('绑定成功')
  1339. }else {
  1340. this.$message.error('绑定失败:',res.msg)
  1341. }
  1342. this.getList()
  1343. this.user.open=false;
  1344. })
  1345. },
  1346. /** 查看客户详情 */
  1347. handleShow(row){
  1348. this.show.open=true;
  1349. var that=this;
  1350. const tab = "visit";
  1351. setTimeout(() => {
  1352. that.$refs.customerDetails.getDetails(row.customerId);
  1353. that.$refs.customerDetails.handleClick(tab);
  1354. }, 200);
  1355. },
  1356. handledetails(row){
  1357. this.info.open=true;
  1358. setTimeout(() => {
  1359. this.$refs.Details.getDetails(row.id);
  1360. }, 1);
  1361. },
  1362. closeInfo(){
  1363. this.info.open=false
  1364. },
  1365. handleClickX(tab, event) {
  1366. this.queryParams.isBind=tab.name;
  1367. this.handleQuery();
  1368. },
  1369. handleClose(tag) {
  1370. this.remarkMobiles.splice(this.remarkMobiles.indexOf(tag), 1);
  1371. },
  1372. showInput() {
  1373. this.inputVisible = true;
  1374. this.$nextTick(_ => {
  1375. this.$refs.saveTagInput.$refs.input.focus();
  1376. });
  1377. },
  1378. handleInputConfirm() {
  1379. let inputValue = this.inputValue;
  1380. if (inputValue) {
  1381. this.remarkMobiles.push(inputValue);
  1382. }
  1383. this.inputVisible = false;
  1384. this.inputValue = '';
  1385. },
  1386. addUserTag(){
  1387. if(this.ids==null||this.ids==""){
  1388. return this.$message('请选择需要添加标签的客户');
  1389. }
  1390. this.getPageListTagGroup();
  1391. setTimeout(() => {
  1392. for (let i = 0; i < this.tagGroupList.length; i++) {
  1393. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1394. this.tagGroupList[i].tag[x].isSelected=false;
  1395. }
  1396. }
  1397. }, 200);
  1398. this.tagOpen = true;
  1399. this.tagFilter = false;
  1400. },
  1401. addUserTagFilter(){
  1402. if(this.externalContactList.length == 0){
  1403. return this.$message('无可添加标签客户');
  1404. }
  1405. this.getPageListTagGroup();
  1406. setTimeout(() => {
  1407. for (let i = 0; i < this.tagGroupList.length; i++) {
  1408. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1409. this.tagGroupList[i].tag[x].isSelected=false;
  1410. }
  1411. }
  1412. }, 200);
  1413. this.tagOpen = true;
  1414. this.tagFilter = true;
  1415. },
  1416. getPageListTagGroup(){
  1417. this.queryTagParams.corpId=this.queryParams.corpId
  1418. allListTagGroupPage(this.queryTagParams).then(response => {
  1419. this.tagGroupList = response.rows;
  1420. this.tagTotal = response.total;
  1421. });
  1422. },
  1423. delUserTag(){
  1424. if(this.ids==null||this.ids==""){
  1425. return this.$message('请选择需要移除标签的客户');
  1426. }
  1427. this.getPageListTagGroup();
  1428. setTimeout(() => {
  1429. for (let i = 0; i < this.tagGroupList.length; i++) {
  1430. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1431. this.tagGroupList[i].tag[x].isSelected=false;
  1432. }
  1433. }
  1434. }, 200);
  1435. this.tagDelOpen = true;
  1436. },
  1437. //搜索的标签
  1438. hangleChangeTags(){
  1439. this.changeTagDialog.title="搜索的标签"
  1440. this.changeTagDialog.open=true;
  1441. this.changeTagDialog.type = 1;
  1442. // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
  1443. const selectedTagIds = new Set(
  1444. (this.selectTags || []).map(tagItem => tagItem?.tagId)
  1445. );
  1446. this.queryTagParams.name=null;
  1447. this.getPageListTagGroup();
  1448. setTimeout(() => {
  1449. for (let i = 0; i < this.tagGroupList.length; i++) {
  1450. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1451. this.tagGroupList[i].tag[x].isSelected = selectedTagIds.has(this.tagGroupList[i].tag[x].tagId);
  1452. }
  1453. }
  1454. }, 200);
  1455. },
  1456. //选择排除标签
  1457. hangleChangeOutTags() {
  1458. this.changeTagDialog.title="搜索的标签"
  1459. this.changeTagDialog.open=true;
  1460. this.changeTagDialog.type = 2;
  1461. // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
  1462. const selectedTagIds = new Set(
  1463. (this.outSelectTags || []).map(tagItem => tagItem?.tagId)
  1464. );
  1465. this.queryTagParams.name=null;
  1466. this.getPageListTagGroup();
  1467. setTimeout(() => {
  1468. for (let i = 0; i < this.tagGroupList.length; i++) {
  1469. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1470. this.tagGroupList[i].tag[x].isSelected = selectedTagIds.has(this.tagGroupList[i].tag[x].tagId);
  1471. }
  1472. }
  1473. }, 200);
  1474. },
  1475. //删除一些选择的标签
  1476. handleCloseTags(list){
  1477. const ls = this.selectTags.findIndex(t => t.tagId === list.tagId);
  1478. if (ls !== -1) {
  1479. this.selectTags.splice(ls, 1);
  1480. this.selectTags = [...this.selectTags];
  1481. }
  1482. if (this.selectTags!=null && this.selectTags.length>0){
  1483. // 确保 this.form.tags 是数组
  1484. if (!this.queryParams.tagIds) {
  1485. this.queryParams.tagIds = []; // 如果未定义,初始化
  1486. } else {
  1487. this.queryParams.tagIds = []; // 清空已有数据
  1488. }
  1489. // 遍历并添加 tagId
  1490. this.selectTags.forEach(tag => {
  1491. if (tag.tagId) { // 确保 tagId 存在
  1492. this.queryParams.tagIds.push(tag.tagId);
  1493. }
  1494. });
  1495. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  1496. }else {
  1497. this.queryParams.tagIds=null;
  1498. }
  1499. },
  1500. //删除一些排除的标签
  1501. handleCloseOutTags(list){
  1502. const ls = this.outSelectTags.findIndex(t => t.tagId === list.tagId);
  1503. if (ls !== -1) {
  1504. this.outSelectTags.splice(ls, 1);
  1505. this.outSelectTags = [...this.selectTags];
  1506. }
  1507. if (this.outSelectTags!=null && this.outSelectTags.length>0){
  1508. // 确保 this.form.tags 是数组
  1509. if (!this.queryParams.outTagIds) {
  1510. this.queryParams.outTagIds = []; // 如果未定义,初始化
  1511. } else {
  1512. this.queryParams.outTagIds = []; // 清空已有数据
  1513. }
  1514. // 遍历并添加 tagId
  1515. this.outSelectTags.forEach(tag => {
  1516. if (tag.tagId) { // 确保 tagId 存在
  1517. this.queryParams.outTagIds.push(tag.tagId);
  1518. }
  1519. });
  1520. this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
  1521. }else {
  1522. this.queryParams.outTagIds=null;
  1523. }
  1524. },
  1525. //重新获取页面数据
  1526. refreshList(){
  1527. this.getList();
  1528. },
  1529. //批量设置课程sop
  1530. setUserCourseSop(){
  1531. if(this.ids==null||this.ids==""){
  1532. return this.$message('请选择需要设置课程SOP的客户');
  1533. }
  1534. this.$confirm('批量设置客户课节SOP可能会存在重复,确定要批量设置吗?', "警告", {
  1535. confirmButtonText: "确定",
  1536. cancelButtonText: "取消",
  1537. type: "warning"
  1538. }).then(() => {
  1539. this.setSop.open = true;
  1540. this.setSop.type = 2;
  1541. })
  1542. .catch(() => {
  1543. // 可以处理用户点击“取消”的逻辑
  1544. });
  1545. },
  1546. tagSelection(row){
  1547. row.isSelected= !row.isSelected;
  1548. this.$forceUpdate();
  1549. },
  1550. // 取消按钮
  1551. cancel() {
  1552. this.open = false;
  1553. this.reset();
  1554. },
  1555. addTagCancel() {
  1556. this.tagOpen = false;
  1557. this.addTagForm={
  1558. userIds:[],
  1559. tagIds:[]
  1560. };
  1561. },
  1562. DelTagCancel() {
  1563. this.tagDelOpen = false;
  1564. this.addTagForm={
  1565. userIds:[],
  1566. tagIds:[]
  1567. };
  1568. },
  1569. addTagSubmitForm(){
  1570. for (let i = 0; i < this.tagGroupList.length; i++) {
  1571. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1572. if(this.tagGroupList[i].tag[x].isSelected==true){
  1573. this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1574. }
  1575. }
  1576. }
  1577. if(this.addTagForm.tagIds==[]||this.addTagForm.tagIds==null||this.addTagForm.tagIds==""){
  1578. return this.$message('请选择标签');
  1579. }
  1580. this.addTagForm.corpId=this.queryParams.corpId
  1581. this.addTagForm.userIds=this.ids;
  1582. this.addTagForm.filter = this.tagFilter;
  1583. // 修改这里:正确处理参数对象
  1584. let obj = JSON.parse(JSON.stringify(this.queryParams));
  1585. // 将逗号分隔的字符串转换为数组
  1586. if(obj.tagIds && typeof obj.tagIds === 'string') {
  1587. obj.tagIds = obj.tagIds.split(",");
  1588. }
  1589. if(obj.outTagIds && typeof obj.outTagIds === 'string') {
  1590. obj.outTagIds = obj.outTagIds.split(",");
  1591. }
  1592. this.addTagForm.param = obj;
  1593. let loadingRock = this.$loading({
  1594. lock: true,
  1595. text: '正在执行中请稍后~~请不要刷新页面!!',
  1596. spinner: 'el-icon-loading',
  1597. background: 'rgba(0, 0, 0, 0.7)'
  1598. });
  1599. addTag(this.addTagForm).then(response => {
  1600. this.msgSuccess(response.msg);
  1601. this.tagOpen = false;
  1602. loadingRock.close();
  1603. this.addTagForm={
  1604. filter: false,
  1605. addType: 0,
  1606. userIds:[],
  1607. tagIds:[]
  1608. };
  1609. this.getList()
  1610. }).finally(res=>{
  1611. loadingRock.close();
  1612. });
  1613. },
  1614. tagDelSubmitForm(){
  1615. for (let i = 0; i < this.tagGroupList.length; i++) {
  1616. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1617. if(this.tagGroupList[i].tag[x].isSelected==true){
  1618. this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1619. }
  1620. }
  1621. }
  1622. if(this.addTagForm.tagIds==[]||this.addTagForm.tagIds==null||this.addTagForm.tagIds==""){
  1623. return this.$message('请选择标签');
  1624. }
  1625. this.addTagForm.corpId=this.queryParams.corpId
  1626. this.addTagForm.userIds=this.ids;
  1627. let loadingRock = this.$loading({
  1628. lock: true,
  1629. text: '正在执行中请稍后~~请不要刷新页面!!',
  1630. spinner: 'el-icon-loading',
  1631. background: 'rgba(0, 0, 0, 0.7)'
  1632. });
  1633. delTag(this.addTagForm).then(response => {
  1634. this.msgSuccess(response.msg);
  1635. this.tagDelOpen = false;
  1636. loadingRock.close();
  1637. this.addTagForm={
  1638. userIds:[],
  1639. tagIds:[]
  1640. };
  1641. this.getList()
  1642. }).finally(res=>{
  1643. loadingRock.close();
  1644. });
  1645. },
  1646. // 表单重置
  1647. reset() {
  1648. this.form = {
  1649. id: null,
  1650. userId: null,
  1651. externalUserId: null,
  1652. name: null,
  1653. companyUserId:null,
  1654. customerId:null,
  1655. avatar: null,
  1656. type: null,
  1657. gender: null,
  1658. remark: null,
  1659. description: null,
  1660. tagIds: null,
  1661. remarkMobiles: null,
  1662. remarkCorpName: null,
  1663. addWay: null,
  1664. operUserid: null,
  1665. corpId: null,
  1666. companyId: null,
  1667. transferStatus:null,
  1668. status:null,
  1669. sTime:null,
  1670. eTime:null,
  1671. createTime:null,
  1672. transferTime:null,
  1673. transferNum:null,
  1674. lossTime:null,
  1675. delTime:null,
  1676. state:null,
  1677. wayId:null,
  1678. stageStatus:null,
  1679. customerName:null
  1680. };
  1681. this.resetForm("form");
  1682. },
  1683. /** 搜索按钮操作 */
  1684. handleQuery() {
  1685. if (this.selectTags!=null && this.selectTags.length>0){
  1686. // 确保 this.form.tags 是数组
  1687. if (!this.queryParams.tagIds) {
  1688. this.queryParams.tagIds = []; // 如果未定义,初始化
  1689. } else {
  1690. this.queryParams.tagIds = []; // 清空已有数据
  1691. }
  1692. // 遍历并添加 tagId
  1693. this.selectTags.forEach(tag => {
  1694. if (tag.tagId) { // 确保 tagId 存在
  1695. this.queryParams.tagIds.push(tag.tagId);
  1696. }
  1697. });
  1698. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  1699. }else {
  1700. this.queryParams.tagIds=null;
  1701. }
  1702. if (this.outSelectTags!=null && this.outSelectTags.length>0){
  1703. // 确保 this.form.tags 是数组
  1704. if (!this.queryParams.outTagIds) {
  1705. this.queryParams.outTagIds = []; // 如果未定义,初始化
  1706. } else {
  1707. this.queryParams.outTagIds = []; // 清空已有数据
  1708. }
  1709. // 遍历并添加 tagId
  1710. this.outSelectTags.forEach(tag => {
  1711. if (tag.tagId) { // 确保 tagId 存在
  1712. this.queryParams.outTagIds.push(tag.tagId);
  1713. }
  1714. });
  1715. this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
  1716. }else {
  1717. this.queryParams.outTagIds=null;
  1718. }
  1719. this.queryParams.pageNum = 1;
  1720. this.getList();
  1721. },
  1722. handleSearchTags(name){
  1723. if (!name){
  1724. return this.$message.error("请输入要搜索的标签")
  1725. }
  1726. this.queryTagParams.name=name;
  1727. this.queryTagParams.corpId=this.queryParams.corpId;
  1728. searchTags(this.queryTagParams).then(response => {
  1729. this.tagGroupList = response.rows;
  1730. this.tagTotal = response.total;
  1731. });
  1732. },
  1733. cancelSearchTags(){
  1734. this.resetSearchQueryTag()
  1735. this.getPageListTagGroup();
  1736. },
  1737. //确定选择标签
  1738. tagSubmitForm(type){
  1739. if (type==1){
  1740. for (let i = 0; i < this.tagGroupList.length; i++) {
  1741. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1742. if (this.tagGroupList[i].tag[x].isSelected === true) {
  1743. if (!this.selectTags) {
  1744. this.selectTags = [];
  1745. }
  1746. // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
  1747. let tagExists = this.selectTags.some(
  1748. tag => tag.id === this.tagGroupList[i].tag[x].id
  1749. );
  1750. // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
  1751. if (!tagExists) {
  1752. this.selectTags.push(this.tagGroupList[i].tag[x]);
  1753. }
  1754. }
  1755. }
  1756. }
  1757. if (!this.selectTags || this.selectTags.length === 0) {
  1758. return this.$message('请选择标签');
  1759. }
  1760. }else if (type == 2) {
  1761. for (let i = 0; i < this.tagGroupList.length; i++) {
  1762. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1763. if (this.tagGroupList[i].tag[x].isSelected === true) {
  1764. if (!this.outSelectTags) {
  1765. this.outSelectTags = [];
  1766. }
  1767. // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
  1768. let tagExists = this.outSelectTags.some(
  1769. tag => tag.id === this.tagGroupList[i].tag[x].id
  1770. );
  1771. // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
  1772. if (!tagExists) {
  1773. this.outSelectTags.push(this.tagGroupList[i].tag[x]);
  1774. }
  1775. }
  1776. }
  1777. }
  1778. if (!this.outSelectTags || this.outSelectTags.length === 0) {
  1779. return this.$message('请选择标签');
  1780. }
  1781. }
  1782. this.changeTagDialog.open = false;
  1783. },
  1784. //取消选择标签
  1785. tagCancel(){
  1786. this.changeTagDialog.open = false;
  1787. },
  1788. resetSearchQueryTag(){
  1789. this.queryTagParams= {
  1790. pageNum: 1,
  1791. pageSize: 10,
  1792. total:0,
  1793. name:null,
  1794. };
  1795. },
  1796. /** 重置按钮操作 */
  1797. resetQuery() {
  1798. this.resetForm("queryForm");
  1799. this.queryParams.transferStatus=null;
  1800. this.queryParams.corpId= this.myQwCompanyList[0].dictValue;
  1801. this.selectTags=[];
  1802. this.outSelectTags=[];
  1803. this.createTime=null;
  1804. this.queryParams.sTime=null;
  1805. this.queryParams.eTime=null;
  1806. this.handleQuery();
  1807. },
  1808. // 多选框选中数据
  1809. handleSelectionChange(selection) {
  1810. this.ids = selection.map(item => item.id)
  1811. this.single = selection.length!==1
  1812. this.multiple = !selection.length
  1813. },
  1814. /** 新增按钮操作 */
  1815. handleAdd() {
  1816. this.loading=true;
  1817. this.form.corpId=this.queryParams.corpId
  1818. addExternalContact(this.form).then(response => {
  1819. this.msgSuccess("同步成功");
  1820. this.getList();
  1821. }).finally(()=>{
  1822. this.loading=false;
  1823. });
  1824. },
  1825. /** 修改按钮操作 */
  1826. handleUpdate(row) {
  1827. this.reset();
  1828. const id = row.id || this.ids
  1829. getExternalContact(id).then(response => {
  1830. this.form = response.data;
  1831. if(this.form.remarkMobiles!=null){
  1832. this.remarkMobiles=JSON.parse(this.form.remarkMobiles)
  1833. }else{
  1834. this.remarkMobiles=[]
  1835. }
  1836. this.open = true;
  1837. this.title = "修改企业微信客户";
  1838. });
  1839. },
  1840. handleAppellation(val){
  1841. this.callOpen.open=true;
  1842. this.callOpenFrom.stageStatus=val.stageStatus;
  1843. this.callOpenFrom.id=val.id;
  1844. },
  1845. /** 绑定客户操作 */
  1846. handleUpdateCustomer(row){
  1847. this.bindCustomer.title="绑定客户"
  1848. this.bindCustomer.open=true;
  1849. this.form.id=row.id
  1850. this.form.externalUserId=row.externalUserId
  1851. this.form.name=row.name
  1852. },
  1853. handleUpdateUser(row){
  1854. this.user.title="绑定客户"
  1855. this.user.open=true;
  1856. this.userForm.id=row.id;
  1857. },
  1858. handleUnBindUserId(val){
  1859. this.$confirm(
  1860. '确认解绑客户:<span style="color: green;">' + val.name + '' +
  1861. '</span> 的小程序用户?<br><span style="color: red;">【ps:可能会导致客户无法看课】</span>',
  1862. {
  1863. confirmButtonText: "确定",
  1864. cancelButtonText: "取消",
  1865. type: "warning",
  1866. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1867. }
  1868. ).then(() => {
  1869. return unBindUserId(val.id);
  1870. }).then(response => {
  1871. this.getList();
  1872. this.msgSuccess("解绑成功");
  1873. }).finally(res=>{
  1874. this.getList();
  1875. })
  1876. },
  1877. bindCustomerId(row){
  1878. console.log("row",row)
  1879. // this.qwFormCustomer.customerId=row;
  1880. this.form.customerId=row;
  1881. this.form.corpId=this.queryParams.corpId;
  1882. this.msgWarning("绑定中.....同步信息中.....");
  1883. editbindCustomer(this.form).then(res=>{
  1884. //清空表单
  1885. this.reset();
  1886. this.bindCustomer.open = false;
  1887. this.msgSuccess("绑定成功");
  1888. this.getList();
  1889. })
  1890. },
  1891. //设置一个SOP
  1892. setCourseSOP(row) {
  1893. // 检查 row.miniUserId 是否为 null
  1894. if (row.miniUserId === null || row.miniUserId === undefined) {
  1895. return this.$confirm('当前客户【CRM客户详情】中 未绑定小程序客户,请先绑定', "警告", {
  1896. confirmButtonText: "确定",
  1897. cancelButtonText: "取消",
  1898. type: "warning"
  1899. }).catch(error => {
  1900. this.msgWarning("操作取消:", error);
  1901. });
  1902. } else {
  1903. this.chooseCustomerSOP = row;
  1904. this.setSop.open = true;
  1905. this.setSop.type=1;
  1906. }
  1907. },
  1908. //选择课程SOP
  1909. // 用于设置 customerCourseForm 和 customerCourseFormLogs 的共同属性
  1910. setCommonProperties(form, row) {
  1911. form.qwUserid = this.chooseCustomerSOP.userId;
  1912. form.companyUserId = this.chooseCustomerSOP.companyUserId;
  1913. form.externalUserId = this.chooseCustomerSOP.externalUserId;
  1914. form.customerId = this.chooseCustomerSOP.customerId;
  1915. form.miniUserId = this.chooseCustomerSOP.miniUserId;
  1916. form.businessId = row.businessId;
  1917. },
  1918. bindCourseSop(row,days) {
  1919. if (this.setSop.type==2){
  1920. this.setSop.open = false;
  1921. this.loading=true;
  1922. this.msgWarning("设定中.....同步信息中.....");
  1923. setCustomerCourseSopList({ids:this.ids,fsCourseSopId:row.id,days:days}).then(res=>{
  1924. let msg=" 批量设置成功数【" + res.successNum + "】,<br>"
  1925. if (res.failCRM.length>0){
  1926. msg+="失败的客户【" + res.failCRM + "】,原因是未绑定CRM客户。<br>"
  1927. }
  1928. if (res.failMiNi.length>0){
  1929. msg+="失败的客户【" + res.failMiNi + "】,原因是CRM中未绑定小程序客户。<br>"
  1930. }
  1931. if (res.failCompany.length>0){
  1932. msg+="失败的客户【" + res.failCompany + "】,原因是客户没有所属成员。<br>"
  1933. }
  1934. return this.$confirm(msg, "提示", {
  1935. confirmButtonText: "确定",
  1936. cancelButtonText: "取消",
  1937. type: "warning",
  1938. dangerouslyUseHTMLString: true // 允许使用HTML标签
  1939. }).catch(error => {
  1940. this.msgSuccess("操作完成~");
  1941. });
  1942. }).finally(()=>{
  1943. this.loading = false;
  1944. this.getList();
  1945. })
  1946. }else if (this.setSop.type==1){
  1947. // 设置 customerCourseFormLogs 的属性
  1948. this.setCommonProperties(this.customerCourseFormLogs, row);
  1949. // 设置 customerCourseForm 的属性
  1950. this.setCommonProperties(this.customerCourseForm, row);
  1951. this.customerCourseForm.sopId = row.id;
  1952. this.customerCourseForm.sopType = row.sopType;
  1953. this.customerCourseForm.setting = row.setting;
  1954. this.customerCourseForm.days = days;
  1955. // 执行异步操作
  1956. getCustomerCourseSop(this.customerCourseFormLogs)
  1957. .then(res => {
  1958. if (res) {
  1959. return this.$confirm('当前客户已设置过相同课程课节SOP,确定还要再次设置吗?', "警告", {
  1960. confirmButtonText: "确定",
  1961. cancelButtonText: "取消",
  1962. type: "warning"
  1963. });
  1964. } else {
  1965. return Promise.resolve(); // 如果没有设置过,直接执行后续操作
  1966. }
  1967. })
  1968. .then(() => {
  1969. this.loading = true;
  1970. this.setSop.open = false;
  1971. this.msgSuccess("设定中.....同步信息中.....");
  1972. return setCustomerCourseSop(this.customerCourseForm);
  1973. })
  1974. .then(() => {
  1975. this.msgSuccess("设定成功");
  1976. })
  1977. .catch(error => {
  1978. this.msgWarning("操作取消:", error);
  1979. })
  1980. .finally(() => {
  1981. this.loading = false;
  1982. this.getList();
  1983. });
  1984. }
  1985. },
  1986. submitCallOpenFrom(){
  1987. this.$refs["callOpenFrom"].validate(valid => {
  1988. if (valid) {
  1989. if (this.callOpenFrom.id != null && this.callOpenFrom.stageStatus != null) {
  1990. updateExternalContactCall(this.callOpenFrom).then(res=>{
  1991. this.$message.success('修改成功');
  1992. this.callOpen.open=false;
  1993. this.getList();
  1994. });
  1995. }
  1996. }
  1997. });
  1998. },
  1999. /** 提交按钮 */
  2000. submitForm() {
  2001. this.$refs["form"].validate(valid => {
  2002. if (valid) {
  2003. if (this.form.id != null) {
  2004. this.form.remarkMobiles=JSON.stringify(this.remarkMobiles)
  2005. updateExternalContact(this.form).then(response => {
  2006. this.msgSuccess("修改成功");
  2007. this.open = false;
  2008. this.getList();
  2009. });
  2010. } else {
  2011. addExternalContact(this.form).then(response => {
  2012. this.msgSuccess("新增成功");
  2013. this.open = false;
  2014. this.getList();
  2015. });
  2016. }
  2017. }
  2018. });
  2019. },
  2020. /** 删除按钮操作 */
  2021. handleDelete(row) {
  2022. const ids = row.id || this.ids;
  2023. this.$confirm('是否确认删除企业微信客户编号为"' + ids + '"的数据项?', "警告", {
  2024. confirmButtonText: "确定",
  2025. cancelButtonText: "取消",
  2026. type: "warning"
  2027. }).then(function() {
  2028. return delExternalContact(ids);
  2029. }).then(() => {
  2030. this.getList();
  2031. this.msgSuccess("删除成功");
  2032. }).catch(() => {});
  2033. },
  2034. updateTalk(row){
  2035. const ids = row.id || this.ids;
  2036. this.$confirm('是否确认批量更改用户信息为非首次交流', "警告", {
  2037. confirmButtonText: "确定",
  2038. cancelButtonText: "取消",
  2039. type: "warning"
  2040. }).then(function() {
  2041. return editTalk(ids);
  2042. }).then(() => {
  2043. this.getList();
  2044. this.msgSuccess("成功");
  2045. }).catch(() => {});
  2046. },
  2047. /** 导出按钮操作 */
  2048. handleExport() {
  2049. const { qwUserName, ...queryParams } = this.queryParams;
  2050. this.$confirm('是否确认导出所有企业微信客户数据项?', "警告", {
  2051. confirmButtonText: "确定",
  2052. cancelButtonText: "取消",
  2053. type: "warning"
  2054. }).then(() => {
  2055. this.exportLoading = true;
  2056. return exportExternalContact(queryParams);
  2057. }).then(response => {
  2058. this.download(response.msg);
  2059. this.exportLoading = false;
  2060. }).catch(() => {});
  2061. },
  2062. handleBatchUpdateNotesFilter() {
  2063. this.notesOpen.open = true;
  2064. this.notesOpen.filter = true;
  2065. },
  2066. handleBatchUpdateNotes() {
  2067. if (this.ids == null || this.ids == "") {
  2068. return this.$message('请选择需要添加备注的客户');
  2069. }
  2070. this.notesOpen.open = true;
  2071. this.notesOpen.filter = false;
  2072. },
  2073. notesCancel(){
  2074. this.notesOpen={
  2075. open: false,
  2076. notes: null,
  2077. type: 1,
  2078. nameType:3,
  2079. }
  2080. },
  2081. notesSubmitForm() {
  2082. if (this.notesOpen.notes == null || this.notesOpen.notes == "") {
  2083. return this.$message.error("请输入备注内容");
  2084. }
  2085. // let loadingRock = this.$loading({
  2086. // lock: true,
  2087. // text: '正在执行中请稍后~~请不要刷新页面!!',
  2088. // spinner: 'el-icon-loading',
  2089. // background: 'rgba(0, 0, 0, 0.7)'
  2090. // });
  2091. let obj = JSON.parse(JSON.stringify(this.queryParams))
  2092. console.log(obj);
  2093. if(obj.tagIds !== null && obj.tagIds !== undefined && obj.tagIds !== ''){
  2094. obj.tagIds = obj.tagIds.split(",");
  2095. }
  2096. batchUpdateExternalContactNotes({
  2097. addType: 0,
  2098. userIds: this.ids,
  2099. notes: this.notesOpen.notes,
  2100. type: this.notesOpen.type,
  2101. nameType: this.notesOpen.nameType,
  2102. filter: this.notesOpen.filter,
  2103. param: obj
  2104. }).then(res => {
  2105. this.resultMessage = res.msg;
  2106. this.$message.success("正在执行中...");
  2107. // this.resultDialogVisible = true; // 显示弹窗
  2108. // this.resultTitle = '批量修改备注结果';
  2109. }).finally(res => {
  2110. this.getList();
  2111. // loadingRock.close();
  2112. this.notesCancel();
  2113. })
  2114. },
  2115. }
  2116. };
  2117. </script>
  2118. <style scoped>
  2119. /* CSS 样式 */
  2120. .tag-container {
  2121. display: flex;
  2122. flex-wrap: wrap; /* 超出宽度时自动换行 */
  2123. gap: 8px; /* 设置标签之间的间距 */
  2124. }
  2125. .name-background {
  2126. display: inline-block;
  2127. background-color: #abece6; /* 背景颜色 */
  2128. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  2129. border-radius: 4px; /* 可选:设置圆角 */
  2130. }
  2131. /* CSS 样式 */
  2132. .tag-container {
  2133. display: flex;
  2134. flex-wrap: wrap; /* 超出宽度时自动换行 */
  2135. gap: 8px; /* 设置标签之间的间距 */
  2136. }
  2137. .name-background {
  2138. display: inline-block;
  2139. background-color: #abece6; /* 背景颜色 */
  2140. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  2141. border-radius: 4px; /* 可选:设置圆角 */
  2142. }
  2143. .tag-box {
  2144. padding: 8px 12px;
  2145. border: 1px solid #989797;
  2146. border-radius: 4px;
  2147. cursor: pointer;
  2148. display: inline-block;
  2149. }
  2150. .tag-selected {
  2151. background-color: #00bc98;
  2152. color: #fff;
  2153. border-color: #00bc98;
  2154. }
  2155. .el-tag + .el-tag {
  2156. margin-left: 10px;
  2157. }
  2158. .button-new-tag {
  2159. margin-left: 10px;
  2160. height: 32px;
  2161. line-height: 30px;
  2162. padding-top: 0;
  2163. padding-bottom: 0;
  2164. }
  2165. .input-new-tag {
  2166. width: 90px;
  2167. margin-left: 10px;
  2168. vertical-align: bottom;
  2169. }
  2170. .suggestion-box {
  2171. position: absolute;
  2172. z-index: 999;
  2173. background: #fff;
  2174. border: 1px solid #ddd;
  2175. max-height: 200px;
  2176. overflow-y: auto;
  2177. width: 100%;
  2178. }
  2179. .suggestion-item {
  2180. padding: 10px;
  2181. cursor: pointer;
  2182. }
  2183. .suggestion-item:hover {
  2184. background-color: #f5f7fa;
  2185. }
  2186. /* 新增的滚动容器样式(不影响原有样式) */
  2187. .scroll-wrapper {
  2188. max-height: 130px; /* 大约三行的高度 */
  2189. overflow-y: auto; /* 垂直滚动 */
  2190. padding-right: 5px; /* 为滚动条留出空间 */
  2191. }
  2192. /* 美化滚动条(可选) */
  2193. .scroll-wrapper::-webkit-scrollbar {
  2194. width: 6px;
  2195. }
  2196. .scroll-wrapper::-webkit-scrollbar-thumb {
  2197. background: rgba(0, 0, 0, 0.2);
  2198. border-radius: 3px;
  2199. }
  2200. .tag-container {
  2201. max-height: 200px;
  2202. overflow-y: auto;
  2203. padding: 1px;
  2204. border: 1px solid #ebeef5;
  2205. border-radius: 1px;
  2206. background-color: #fafafa;
  2207. }
  2208. .tag-list {
  2209. display: flex;
  2210. flex-wrap: wrap;
  2211. gap: 8px;
  2212. }
  2213. .scroll-hint {
  2214. text-align: center;
  2215. color: #909399;
  2216. font-size: 12px;
  2217. padding: 1px 0;
  2218. }
  2219. .container {
  2220. max-width: 800px;
  2221. margin: 0 auto;
  2222. padding: 10px;
  2223. }
  2224. .title {
  2225. text-align: center;
  2226. color: #303133;
  2227. margin-bottom: 30px;
  2228. }
  2229. .demo-table {
  2230. width: 100%;
  2231. margin-bottom: 30px;
  2232. }
  2233. .instructions {
  2234. background-color: #f5f7fa;
  2235. padding: 15px;
  2236. border-radius: 1px;
  2237. margin-bottom: 20px;
  2238. }
  2239. </style>