index.vue 77 KB

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