index.vue 76 KB

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