index.vue 71 KB

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