myExternalContact.vue 75 KB

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