myExternalContact.vue 80 KB

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