index.vue 75 KB

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