企微助手 ,仓库名 短剧

manage.vue 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <div v-loading="loading">
  3. <!-- 使用说明 -->
  4. <instructions doc="customManage"></instructions>
  5. <div class="screenBox">
  6. <!-- 搜索客户 -->
  7. <self-input :reset='resetFlag' @inputChange='(val)=>{input_keyword = val;init(1)}'></self-input>
  8. <!-- 所属客服 -->
  9. <self-customerservice :reset='resetFlag' @customerDefine="(val)=>{user_id_list=val;init(1)}"></self-customerservice>
  10. <!-- 企业标签 -->
  11. <enterprise-tag :reset='resetFlag' @tagDefine="tagDefine"></enterprise-tag>
  12. <!-- 添加时间 -->
  13. <date-picker :reset='resetFlag' @changeTime="changeTime"></date-picker>
  14. <!-- 添加渠道 -->
  15. <self-channel :reset='resetFlag' @channelDefine="(val)=>{add_way = val;init(1)}"></self-channel>
  16. <!-- 性别 暂时获取不到 -->
  17. <self-gender :reset='resetFlag' @genderChange="(val)=>{gender = val;init(1)}"></self-gender>
  18. <!-- 流失状态 -->
  19. <loss-body :reset='resetFlag' @lossChange="lossChange"></loss-body>
  20. <!-- 付费情况 -->
  21. <screen-pay :reset='resetFlag' @payChange="payChange"></screen-pay>
  22. <!-- 充值时间 -->
  23. <date-picker :reset='resetFlag' title="充值时间" @changeTime="onChangePayTime" />
  24. <div class="reset" @click="resetEvent">重置</div>
  25. </div>
  26. <div class="tableInfo">
  27. <div>
  28. <div class="flex">
  29. <i class="el-icon-user-solid"></i>
  30. <div class="totalCustom">共<span>{{otherData&&otherData.count}}</span>个客户</div>
  31. <div class="smalLine"></div>
  32. <div class="excludeCustom">排除重复客户
  33. <el-tooltip class="disinblock" content="该数据为去重后的客户数,若客户添加了多个员工只会统计为1个客户" placement="top">
  34. <i class="el-icon-question"></i>
  35. </el-tooltip>
  36. <span>{{otherData&&otherData.exclude_count}}</span>
  37. </div>
  38. <div class="smalLine"></div>
  39. <div class="excludeCustom">流失客户
  40. <span>{{otherData&&otherData.cust_loss_uc}}</span>
  41. </div>
  42. <!-- <div class="smalLine"></div> -->
  43. <!-- <el-button type="primary" plain size="mini"><i class="el-icon-refresh-right"></i> 更新数据</el-button> -->
  44. </div>
  45. <div class="selectCustom">已择{{selectTotal}}个客户</div>
  46. </div>
  47. <div class="flex">
  48. <el-button type="primary" plain size="mini" @click="setCustomerTag(1)">批量打标签</el-button>
  49. <el-button type="primary" plain size="mini" @click="setCustomerTag(2)">批量移除标签</el-button>
  50. <el-button type="primary" plain size="mini" @click="init(1,'export')">导出Excel</el-button>
  51. </div>
  52. </div>
  53. <!-- table -->
  54. <el-table ref="multipleTable" :height='height' :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange" @select-all="handleSelectAll">
  55. <el-table-column type="selection" :selectable="checkSelectable" width="55" align="center"></el-table-column>
  56. <el-table-column width="200" fixed="left">
  57. <template slot-scope="scope" slot="header">
  58. <div class="customTitle" slot="reference">{{old_pageOptionValue==2?'选择当前页面客户':'选择全部客户'}}<i class="el-icon-arrow-down"></i>
  59. <el-select v-model="pageOptionValue" class="customTitleSelect" placeholder="请选择" size="mini" @change="pageOptionSelect" @visible-change="pageOptionValue=''">
  60. <el-option v-for="item in pageOptions" :key="item.id" :label="item.name" :value="item.id">
  61. </el-option>
  62. </el-select>
  63. </div>
  64. </template>
  65. <template slot-scope="scope">
  66. <div class="userBox">
  67. <img v-if="scope.row.avatar" :src="scope.row.avatar" alt="" class="userImg">
  68. <img v-else src="@/assets/img/self_head.png" alt="" class="userImg">
  69. <div class="userInfo">
  70. <div class="userName">
  71. <p class="name">{{scope.row.remark}}</p>
  72. <span v-if="scope.row.type==1">@微信</span>
  73. </div>
  74. <div class="nickname"><span>昵称:</span>{{scope.row.name}}</div>
  75. </div>
  76. </div>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="性别" min-width="60" show-overflow-tooltip align="center">
  80. <template slot-scope="scope">
  81. <div>{{scope.row.gender==1?'男':scope.row.gender==2?'女':''}}</div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="所属客服" min-width="160" align="center">
  85. <template slot-scope="scope">
  86. <div class="customerServiceTagBox">
  87. <div class="customerServiceTag"><i class="el-icon-headset"></i>{{ scope.row.user_list.name }}</div>
  88. </div>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="所属部门" min-width="160" show-overflow-tooltip align="center">
  92. <template slot-scope="scope">
  93. <div>{{scope.row.department_list&&scope.row.department_list.join(',')}}</div>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="标签" min-width="160" align="center">
  97. <template slot-scope="scope">
  98. <div class="customerServiceTagBox biaoqian">
  99. <template v-for="(item,index) in scope.row.tag_list">
  100. <div class="customerServiceTag" v-if="index<=3" :key="index+'biaoqian'">{{item}}</div>
  101. </template>
  102. <el-popover placement="right" width="300" trigger="hover">
  103. <div class="customerServiceTagBox biaoqian" style="justify-content: flex-start;">
  104. <div class="customerServiceTag" v-for="(item,index) in scope.row.tag_list" :key="index+'biaoqian'">{{item}}</div>
  105. </div>
  106. <span slot="reference" class="f12 c-00B38A line21 pointer" v-if="scope.row.tag_list&&scope.row.tag_list.length>4" style="margin-top:4px">更多</span>
  107. </el-popover>
  108. </div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="客户状态" show-overflow-tooltip align="center">
  112. <template slot-scope="scope">
  113. <span v-if="scope.row.relation_enable==0" class="c-F03F5C">已流失</span>
  114. <span v-if="scope.row.relation_enable==1" class="c-448AFF">未流失</span>
  115. <span v-if="scope.row.relation_enable==2" class="c-FFB055">待分配</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="付费情况" min-width="140" align="center">
  119. <template slot-scope="scope">
  120. <div v-if="scope.row.pay_num>0">已付费(<span class="c-00B38A">{{scope.row.pay_num}}次</span>)</div>
  121. <div v-else>未付费</div>
  122. </template>
  123. </el-table-column>
  124. <el-table-column prop="createtime" min-width="160" label="添加时间" show-overflow-tooltip align="center"></el-table-column>
  125. <!-- <el-table-column prop="address" width="160" label="上次对话时间" show-overflow-tooltip align="center"></el-table-column> -->
  126. <el-table-column label="添加渠道" min-width="140" show-overflow-tooltip align="center">
  127. <template slot-scope="scope">
  128. <div>{{scope.row.add_way}}</div>
  129. </template>
  130. </el-table-column>
  131. <el-table-column width="160" label="操作" align="center" fixed="right">
  132. <template slot-scope="scope">
  133. <div class="flex" style="padding:0 10px">
  134. <div :class="[scope.row.blacklist_status==1?'pointer-drop c-999':'pointer c-00B38A']" @click="shieldingEvent(scope.row)">加入黑名单</div>
  135. <!-- <div class="c-00B38A pointer">聊天记录</div> -->
  136. <div class="c-00B38A pointer" @click="showDetial(scope.row,scope.$index)">详情</div>
  137. </div>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <div class="pagination" v-show="total>0">
  142. <el-pagination background :current-page="page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count='Number(pages)'>
  143. </el-pagination>
  144. </div>
  145. <!-- 拉黑用户 -->
  146. <el-dialog title="拉黑原因" :visible.sync="shieldingFlag" width="578px" center>
  147. <shielding-user @cancel='shieldingUserCancel' :shieldingData='shieldingData'></shielding-user>
  148. </el-dialog>
  149. <!--详情-->
  150. <el-drawer :size="drawerSize" :visible.sync="detialDrawer" :with-header="false">
  151. <detial @changeDrawerSize="changeDrawerSize" @closeDrawer="closeDrawer" :rowProp="{
  152. customer_id:rowPro.customer_id,
  153. user_id:rowPro.user_id
  154. }" ref="detial" @tagUpdate='tagUpdate'></detial>
  155. </el-drawer>
  156. <!-- 批量打标签 -->
  157. <el-dialog :title="tagType==1?'批量打标签':'批量移除标签'" :visible.sync="tagVisible" width="600px" center top="15vh">
  158. <tag-dialog @closeTagDialog="closeTagDialog" :tagType='tagType' :userLength='multipleArr.length'></tag-dialog>
  159. </el-dialog>
  160. </div>
  161. </template>
  162. <script>
  163. import selfInput from '@/components/assembly/screen/input.vue'
  164. import selfCustomerservice from '@/components/assembly/screen/customerService.vue'
  165. import enterpriseTag from '@/components/assembly/screen/enterpriseTag.vue'
  166. import datePicker from '@/components/assembly/screen/datePicker.vue'
  167. import selfChannel from '@/components/assembly/screen/channel.vue'
  168. import selfGender from '@/components/assembly/screen/gender.vue'
  169. import lossBody from '@/components/assembly/screen/lossBody.vue'
  170. import screenPay from '@/components/assembly/screen/pay.vue'
  171. import shieldingUser from '@/components/assembly/shieldingUser.vue'
  172. import tagDialog from '@/components/assembly/tagDialog.vue'
  173. import detial from '@/components/detials/index.vue'
  174. export default {
  175. components: { tagDialog, detial, selfInput, selfCustomerservice, enterpriseTag, datePicker, selfChannel, selfGender, lossBody, screenPay, shieldingUser },
  176. data () {
  177. return {
  178. drawerSize: '60%',
  179. detialDrawer: false,
  180. rowPro: {},//去详情的此条对象
  181. loading: false,
  182. page: 1,
  183. pages: 0,
  184. total: 0,
  185. page_size: 20,
  186. shieldingFlag: false,
  187. pageOptions: [
  188. { name: '全部', id: 1 },
  189. { name: '当前页面', id: 2 },
  190. ],
  191. pageOptionValue: 2,
  192. old_pageOptionValue: 2,
  193. input_keyword: '',
  194. tableData: [],
  195. user_id_list: [],//客服user_id列表
  196. add_way: '',//客户来源
  197. tag_id_list: [],//标签id列表 当tag_type值为1或者2时必填
  198. tag_type: 0,//标签筛选类型 0不筛选 1满足其中一个 2同时满足 3无标签
  199. add_date_start: '',//添加日期 起始
  200. add_date_end: '',//添加日期 截止
  201. last_pay_time_start: '',//充值时间 起始
  202. last_pay_time_end: '',//充值时间 截止
  203. loss_status: null,//客户流失状态 没有筛选时传null 0未流失 1已流失
  204. pay_status: null,// 付款状态 没有筛选时传null 0未付款 1已付款
  205. pay_num_min: '',//最小付款次数,当pay_status是1时必传
  206. pay_num_max: '',//最大付款次数,当pay_status是1时必传
  207. resetFlag: false,//重置
  208. otherData: {},
  209. shieldingData: {},//拉黑的数据
  210. multipleSelection: {},
  211. exclude_multiple_selection: {},
  212. multipleArr: [],
  213. filter_multipleArr: [],
  214. selectTotal: 0,
  215. isAll: false,//是否选择全部
  216. tagVisible: false,
  217. tagType: 1,
  218. gender: '',
  219. height: ''
  220. }
  221. },
  222. created () {
  223. this.height = document.documentElement.clientHeight - 400 > 400 ? document.documentElement.clientHeight - 400 : 400
  224. this.init(1)
  225. },
  226. methods: {
  227. checkSelectable (row, index) {//列表可选择的用户
  228. return row.relation_enable == 1
  229. },
  230. changeDrawerSize () {
  231. this.drawerSize = this.drawerSize == '100%' ? '60%' : '100%'
  232. },
  233. closeDrawer () {
  234. this.detialDrawer = false
  235. },
  236. tagUpdate (val) {//标签回调
  237. this.$set(this.rowPro, 'tag_list', val)
  238. this.$set(this.tableData, this.rowPro.self_index, this.rowPro)
  239. },
  240. showDetial (row, index) {
  241. this.rowPro = row
  242. this.rowPro.self_index = index
  243. this.drawerSize = '60%'
  244. this.detialDrawer = true
  245. this.$nextTick(() => {
  246. this.$refs.detial.acIdx = 0
  247. this.$refs.detial.init()
  248. })
  249. },
  250. closeTagDialog (val) {
  251. if (val && val.length != 0) {
  252. let customer_list = [];
  253. let filter_customer_list = []
  254. if (this.isAll) {//全选
  255. filter_customer_list = this.filter_multipleArr.map((v) => {
  256. return { customer_id: v.customer_id, user_id: v.user_id }
  257. })
  258. } else {
  259. customer_list = this.multipleArr.map((v) => {
  260. return { customer_id: v.customer_id, user_id: v.user_id }
  261. })
  262. }
  263. this.$loading(this.$loadingConfig);
  264. this.$axios.post(this.URL.BASEURL + this.URL.customer_setCustomerTag, {
  265. user_id_list: this.user_id_list,
  266. customer_name: this.input_keyword,
  267. add_date_start: this.add_date_start,
  268. add_date_end: this.add_date_end,
  269. last_pay_time_start: this.last_pay_time_start,
  270. last_pay_time_end: this.last_pay_time_end,
  271. add_way: this.add_way,
  272. pay_status: this.pay_status,
  273. pay_num_min: this.pay_num_min,
  274. pay_num_max: this.pay_num_max,
  275. tag_type: this.tag_type,
  276. tag_id_list: this.tag_id_list,
  277. loss_status: this.loss_status,
  278. type: this.tagType,
  279. tag_list: val,
  280. customer_list: customer_list,
  281. select_all: this.isAll ? 1 : 0,
  282. filter_customer_list: filter_customer_list
  283. }).then((res) => {
  284. var res = res.data
  285. this.$loading(this.$loadingConfig).close();
  286. if (res && res.errno == 0) {
  287. this.$notify.info({
  288. title: '提示',
  289. message: `批量${this.tagType == 1 ? '打' : '移除'}标签进行中,请耐心等待!`,
  290. duration: 0
  291. });
  292. this.customer_batchMarkTagResult(res.rst.id)
  293. } else if (res.errno != 4002) {
  294. this.$message({
  295. message: res.err,
  296. type: "warning"
  297. })
  298. }
  299. }).catch((err) => {
  300. this.$loading(this.$loadingConfig).close();
  301. });
  302. }
  303. this.tagVisible = false
  304. },
  305. customer_batchMarkTagResult (id) {//批量编辑标签结果
  306. this.$axios.get(this.URL.BASEURL + this.URL.customer_batchMarkTagResult, {
  307. params: {
  308. id: id
  309. }
  310. }).then((res) => {
  311. var res = res.data
  312. if (res && res.errno == 0) {
  313. if (res.rst.status == 3) {
  314. this.$notify.closeAll()
  315. this.$notify({
  316. title: '成功',
  317. message: '标签编辑成功!',
  318. type: 'success',
  319. duration: 0
  320. });
  321. this.multipleSelection = {};
  322. this.exclude_multiple_selection = {};
  323. this.multipleArr = [];
  324. this.filter_multipleArr = [];
  325. this.selectTotal = 0;
  326. this.isAll = false;
  327. this.init(this.page)
  328. } else if (res.rst.status == 3) {
  329. this.$notify.closeAll()
  330. this.$notify.error({
  331. title: '错误',
  332. message: '标签编辑失败!',
  333. type: 'success',
  334. duration: 0
  335. });
  336. } else {
  337. setTimeout(() => {
  338. this.customer_batchMarkTagResult(id)
  339. }, 2000)
  340. }
  341. } else if (res.errno != 4002) {
  342. this.$notify.closeAll()
  343. this.$notify.error({
  344. title: '错误',
  345. message: res.err,
  346. type: 'success',
  347. duration: 0
  348. });
  349. }
  350. }).catch((err) => {
  351. this.$notify.closeAll()
  352. this.$notify.error({
  353. title: '错误',
  354. message: '标签编辑失败,服务器错误!',
  355. type: 'success',
  356. duration: 0
  357. });
  358. });
  359. },
  360. resetEvent () {//重置
  361. this.resetFlag = !this.resetFlag
  362. this.input_keyword = '';
  363. this.user_id_list = [];
  364. this.add_way = '';
  365. this.tag_id_list = [];
  366. this.tag_type = 0;
  367. this.add_date_start = '';
  368. this.add_date_end = '';
  369. this.last_pay_time_start = '';
  370. this.last_pay_time_end = '';
  371. this.loss_status = null;
  372. this.pay_status = null;
  373. this.pay_num_min = '';
  374. this.pay_num_max = '';
  375. this.gender = '';
  376. this.init(1)
  377. },
  378. shieldingUserCancel (type) {
  379. if (type == 'update') {
  380. this.init(1)
  381. }
  382. this.shieldingFlag = false
  383. },
  384. shieldingEvent (item) {
  385. if (item.blacklist_status != 1) {//1表示被加入黑名单了 0表示没有
  386. this.shieldingFlag = true;
  387. this.shieldingData = {
  388. customer_id: item.customer_id,
  389. user_id: item.user_id
  390. }
  391. }
  392. },
  393. payChange (data) {//付费情况变化
  394. this.pay_status = data.radio;
  395. this.pay_num_min = data.minValue;
  396. this.pay_num_max = data.maxValue;
  397. this.init(1)
  398. },
  399. lossChange (val) {//筛选流失状态变化
  400. if (val == '') {
  401. this.loss_status = null
  402. } else {
  403. this.loss_status = val
  404. }
  405. this.init(1)
  406. },
  407. changeTime (time) {//筛选时间变化
  408. if (!time || time && time.length == 0) {
  409. this.add_date_start = '';
  410. this.add_date_end = '';
  411. } else {
  412. this.add_date_start = time[0]
  413. this.add_date_end = time[1]
  414. }
  415. this.init(1)
  416. },
  417. // 监听“充值时间”筛选变化
  418. onChangePayTime (time) {
  419. if (!time || time && time.length == 0) {
  420. this.last_pay_time_start = '';
  421. this.last_pay_time_end = '';
  422. } else {
  423. this.last_pay_time_start = time[0]
  424. this.last_pay_time_end = time[1]
  425. }
  426. this.init(1)
  427. },
  428. tagDefine (data) {//标签选择回调
  429. if (data.tag == 1 || data.tag == 2) {
  430. if (data.tag_id_list && data.tag_id_list.length != 0) {
  431. this.tag_id_list = data.tag_id_list
  432. this.tag_type = data.tag
  433. } else {
  434. this.tag_type = 0
  435. this.tag_id_list = []
  436. }
  437. } else {
  438. this.tag_type = data.tag
  439. this.tag_id_list = []
  440. }
  441. this.init(1)
  442. },
  443. init (page, type) {
  444. if (type != 'export') {
  445. this.page = page ? page : this.page;
  446. } else {
  447. if (this.total == 0) {
  448. this.$message({
  449. message: '暂无数据可导出',
  450. type: "warning"
  451. })
  452. return
  453. }
  454. }
  455. this.loading = true
  456. this.$axios.get(this.URL.BASEURL + this.URL.customerList, {
  457. params: {
  458. user_id_list: this.user_id_list,
  459. customer_name: this.input_keyword,
  460. add_date_start: this.add_date_start,
  461. add_date_end: this.add_date_end,
  462. last_pay_time_start: this.last_pay_time_start,
  463. last_pay_time_end: this.last_pay_time_end,
  464. add_way: this.add_way,
  465. pay_status: this.pay_status,
  466. pay_num_min: this.pay_num_min,
  467. pay_num_max: this.pay_num_max,
  468. tag_type: this.tag_type,
  469. tag_id_list: this.tag_id_list,
  470. loss_status: this.loss_status,
  471. page: type == 'export' ? 1 : this.page,
  472. page_size: type == 'export' ? 20000 : this.page_size,
  473. source: 1,
  474. gender: this.gender
  475. }
  476. }).then((res) => {
  477. var res = res.data
  478. this.loading = false
  479. if (res && res.errno == 0) {
  480. if (type == 'export') {
  481. this.exportEvent(res.rst.data.list)
  482. } else {
  483. this.tableData = res.rst.data.list;
  484. this.otherData = {
  485. count: res.rst.data.count,
  486. exclude_count: res.rst.data.exclude_count,
  487. cust_loss_uc: res.rst.data.cust_loss_uc
  488. }
  489. this.total = res.rst.pageInfo.total;
  490. this.pages = res.rst.pageInfo.pages;
  491. // 回显选择
  492. let page_multiple_data = [];
  493. if (this.isAll && (this.multipleSelection[this.page] === undefined)) {
  494. page_multiple_data = this.tableData
  495. } else {
  496. let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
  497. return v.user_id + '-' + v.customer_id
  498. }) : []
  499. this.tableData.forEach((item) => {
  500. if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
  501. page_multiple_data.push(item)
  502. }
  503. })
  504. }
  505. this.$nextTick(() => {
  506. page_multiple_data.forEach((row) => {
  507. this.$refs.multipleTable.toggleRowSelection(row, true);
  508. })
  509. })
  510. }
  511. } else if (res.errno != 4002) {
  512. this.$message({
  513. message: res.err,
  514. type: "warning"
  515. })
  516. }
  517. }).catch((err) => {
  518. this.loading = false
  519. });
  520. },
  521. userChange () {
  522. let multipleArr = []
  523. for (var i in this.multipleSelection) {
  524. multipleArr = multipleArr.concat(this.multipleSelection[i] ? this.multipleSelection[i] : [])
  525. }
  526. multipleArr = multipleArr.filter((v) => {//只有未流失的可以打标签
  527. return v.relation_enable == 1
  528. })
  529. this.multipleArr = multipleArr;
  530. if (this.isAll) {//全选
  531. let filter_multipleArr = []
  532. for (var i in this.exclude_multiple_selection) {
  533. filter_multipleArr = filter_multipleArr.concat(this.exclude_multiple_selection[i] ? this.exclude_multiple_selection[i] : [])
  534. }
  535. filter_multipleArr = filter_multipleArr.filter((v) => {//只有未流失的可以打标签
  536. return v.relation_enable == 1
  537. })
  538. this.filter_multipleArr = filter_multipleArr
  539. this.selectTotal = Number(this.total) - filter_multipleArr.length
  540. } else {
  541. this.selectTotal = this.multipleArr.length
  542. }
  543. },
  544. setCustomerTag (type) {//批量打标签、移除标签
  545. //type 操作类型 1添加标签 2移除标签
  546. this.userChange()
  547. if (this.selectTotal <= 0) {
  548. this.$message({
  549. message: '请选择客户!',
  550. type: "warning"
  551. })
  552. return
  553. }
  554. this.tagVisible = true;
  555. this.tagType = type
  556. },
  557. handleCurrentChange (val) {
  558. this.init(val)
  559. },
  560. handleSelectAll (row) {//点击了全选
  561. if (this.isAll && row.length == 0) {
  562. this.multipleSelection = {}
  563. this.exclude_multiple_selection = {}
  564. this.isAll = false
  565. this.userChange()
  566. }
  567. },
  568. handleSelectionChange (row) {//点击选择变化
  569. this.multipleSelection[this.page] = row && row.length != 0 ? row : null;
  570. if (this.isAll) {//全选状态下被排除的用户
  571. let page_multiple_data = [];
  572. let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
  573. return v.user_id + '-' + v.customer_id
  574. }) : []
  575. this.tableData.forEach((item) => {
  576. if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) == -1) {
  577. page_multiple_data.push(item)
  578. }
  579. })
  580. this.exclude_multiple_selection[this.page] = page_multiple_data
  581. }
  582. this.userChange()
  583. },
  584. pageOptionSelect (val) {//选择
  585. if (val && val != '') {
  586. this.old_pageOptionValue = val;
  587. }
  588. this.exclude_multiple_selection = {}
  589. if (this.pageOptionValue == 1) {
  590. this.isAll = true
  591. } else {//选择当前页面
  592. this.isAll = false
  593. let current_page_data = this.multipleSelection[this.page];
  594. this.multipleSelection = {};
  595. this.multipleSelection[this.page] = current_page_data ? current_page_data : null;
  596. }
  597. this.tableData.forEach((row) => {
  598. this.$refs.multipleTable.toggleRowSelection(row, true);
  599. });
  600. this.userChange()
  601. },
  602. exportEvent (data) {
  603. let list = data;
  604. let tHeader = ['客户id', '客户名称', '客户备注', '客户头像', '外部联系人的类型', '客户状态', '所属客服', '客服ID', '所属部门', '标签', '性别', '添加时间', '添加渠道', '付费情况']
  605. let filterVal = ['customer_id', 'name', 'remark', 'avatar', 'self_type', 'self_relation_enable', 'self_user_name', 'user_id', 'department_list', 'tag_list', 'self_gender', 'createtime', 'add_way', 'self_pay_num']
  606. list.forEach((item) => {
  607. item.self_pay_num = item.pay_num > 0 ? ('已付费(' + item.pay_num + '次)') : '未付费';
  608. item.self_gender = item.gender == 1 ? '男' : item.gender == 2 ? '女' : '';
  609. item.self_user_name = item.user_list.name;
  610. item.self_type = item.type == 1 ? '微信用户' : item.type == 2 ? '' : '企业微信';
  611. item.self_relation_enable = item.relation_enable == 0 ? '已流失' : item.relation_enable == 1 ? '未流失' : item.relation_enable == 2 ? '待分配' : ''
  612. })
  613. let excelDatas = [
  614. {
  615. tHeader: tHeader, // sheet表一头部
  616. filterVal: filterVal, // 表一的数据字段
  617. tableDatas: list, // 表一的整体json数据
  618. sheetName: ''// 表一的sheet名字
  619. }
  620. ]
  621. this.$exportOrder({ excelDatas, name: `客户管理(导出时间:${this.$getDay(0)})` })
  622. }
  623. }
  624. }
  625. </script>
  626. <style lang="scss" scoped>
  627. @import "@/style/list.scss";
  628. </style>