index.vue 76 KB

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