index.vue 71 KB

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