index.vue 76 KB

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