index.vue 76 KB

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