changeVip.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <template>
  2. <view class="column flex-1 hb">
  3. <view class="p20 justify-between" >
  4. <view class="column base-bg-f8 p20 mr20 top-item" v-for="(item,index) in list" :key="index"
  5. style="width: 50%;" @click="change(index)" :class="active==index?'top-itemActive':''">
  6. <text class="fs28 bold mb4">{{item.name}}</text>
  7. <text class="fs24 base-color-6">{{item.text}}</text>
  8. </view>
  9. </view>
  10. <view class="pl20 " v-if="active==0">
  11. <view class="mb20 fs28">选择接收销售</view>
  12. <view class="base-bg-f8 p10 justify-between align-center mr20 pl20">
  13. <text class="mr20">接收销售</text>
  14. <view @click="selsome" class="flex-1" :class="username==''?'base-color-9':'color3'">{{username?username:'请选择销售'}}</view>
  15. </view>
  16. <view class='fs24 mtb12 base-color base-bg-sure mr20 pl20 ptb4'>
  17. 如更换全部会员,则包含小黑屋会员</view>
  18. </view>
  19. <view v-else class="pl20 ">
  20. <view class="mb20 fs28">选择会员</view>
  21. <view class="base-bg-f8 p10 justify-between align-center mr20 pl20">
  22. <text class="mr20">标签</text>
  23. <view @click="changelabel" class="flex-1 fs28" :class="usertag==''?'base-color-9':'color3'">{{usertag?usertag:'请选择销售'}}</view>
  24. </view>
  25. <view class="base-bg-f8 p10 justify-between align-center mr20 pl20 mt20 " >
  26. <text class="mr20">选择项目</text>
  27. <view @click="changeproject" class="flex-1 fs28" :class="projectuser==''?'base-color-9':'color3'"
  28. >{{projectuser?projectuser:'请选择项目'}}</view>
  29. </view>
  30. <view class="base-bg-f8 p10 justify-between align-center mr20 pl20 mt20 " >
  31. <text class="mr20">选择会员</text>
  32. <view @click="changelabelvip" class="flex-1 fs28" :class="tagsuser==''?'base-color-9':'color3'"
  33. >{{tagsuser?tagsuser:'请选择会员'}}</view>
  34. </view>
  35. <view class="mb20 fs28 mt20">选择接收销售</view>
  36. <view class="base-bg-f8 p10 justify-between align-center mr20 pl20">
  37. <text class="mr20">接收销售</text>
  38. <view @click="changeuser" class="flex-1 fs28" :class="username==''?'base-color-9':'color3'"
  39. >{{username?username:"请选择销售"}}</view>
  40. </view>
  41. </view>
  42. <view class="foot-box justify-around">
  43. <!-- <view class="box" style="border: 2rpx solid #eee;">取消</view> -->
  44. <view class="box base-bg-blue colorf" @click="sure">确定</view>
  45. </view>
  46. <u-picker :show="show" :columns="columns" @cancel='show=!show'
  47. @confirm='receiveA' keyName="nickName"
  48. ></u-picker>
  49. <u-picker :show="showb" :columns="columnsb" @cancel='showb=!showb'
  50. @confirm='receiveC' keyName="nickName"
  51. ></u-picker>
  52. <u-popup :show="showvip" @close="close" @open="open" >
  53. <view class="p20 h400">
  54. <view class="mb20" style="text-align: center;">
  55. <view style="display: inline-block; ">选择会员</view>
  56. <u-icon name="close-circle" color="#ccc" size="28"
  57. @click="showvip=!showvip" style="display: inline-block;float: right;"></u-icon>
  58. </view>
  59. <view class="justify-start wrap">
  60. <view class="p16 mlr4" v-for="(item,index) in tagsuserlist" :key="index">
  61. <u-tag :text="item.userName" :plain="!item.checked" type="primary" :name="index"
  62. @click="checkboxClick">
  63. </u-tag>
  64. </view>
  65. <view class="base-color-red fs24 bor-red p8 radius8 plr12" v-if="tagsuserlist.length==0">暂无会员</view>
  66. </view>
  67. <view class="centerV">
  68. <view @click="getuserid" class="surebtn">确定</view>
  69. </view>
  70. </view>
  71. </u-popup>
  72. <u-popup :show="showproject" @close="showproject=!showproject" >
  73. <view class="p20 h400">
  74. <view class="mb20" style="text-align: center;">
  75. <view style="display: inline-block; ">选择项目</view>
  76. <u-icon name="close-circle" color="#ccc" size="28"
  77. @click="showproject=!showproject" style="display: inline-block;float: right;"></u-icon>
  78. </view>
  79. <view class="justify-start wrap">
  80. <view class="p16 mlr12" v-for="(item,index) in projectlist" :key="index">
  81. <u-tag :text="item.dictLabel" :plain="!item.checked" type="primary" :name="index"
  82. @click="checkproClick">
  83. </u-tag>
  84. </view>
  85. <view class="base-color-red fs24 bor-red p8 radius8 plr12" v-if="projectlist.length==0">暂无项目</view>
  86. </view>
  87. <view class="centerV">
  88. <view @click="getprojectid" class="surebtn">确定</view>
  89. </view>
  90. </view>
  91. </u-popup>
  92. <u-popup :show="showPop" :round="12" @close="closePop" class="model" :zIndex="10076" style="flex: 0;">
  93. <view class="popbox">
  94. <view class="popbox-head">
  95. <u-icon class="close-circle" name="close-circle" color="#ccc" size="24" @click="showPop=!showPop"></u-icon>
  96. 标签筛选
  97. </view>
  98. <view class="popbox-body">
  99. <view class="mb20" >
  100. <u-search placeholder="请输入标签 多个标签用 , 隔开" v-model="tagkeywords" :showAction="false" height="30px"
  101. @search='getcompanyTag'></u-search>
  102. </view>
  103. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
  104. :refresher-triggered="triggereds" refresher-background="rgba(0,0,0,0)"
  105. @refresherrefresh="pullDownRefreshs" @refresherrestore="triggereds = false" :upper-threshold="100"
  106. :lower-threshold="100" @refresherabort="triggereds = false" @scrolltolower="reachBottoms">
  107. <view class="tagbox-list x-f" style="white-space: nowrap;flex-wrap: wrap;">
  108. <view class="base-color-red fs24 bor-red p8 radius8 plr12" v-if="columnsa.length<=0">暂无标签</view>
  109. <view class="mlr10 mb10" v-for="(item,index) in columnsa" :key='item.tagId'>
  110. <u-tag :text="item.tag" :plain="!item.checked" :name="index"
  111. @click="chooseTag(index)"></u-tag>
  112. </view>
  113. </view>
  114. <view class="center fs24 mt20">
  115. <text class="mr20" @click="getTagpage('last')">上一页</text>
  116. <text class="base-color-red">{{pagetag.pageNum}}/{{pagetag.pages}}</text>
  117. <text class="ml20" @click="getTagpage('next')">下一页</text>
  118. </view>
  119. </scroll-view>
  120. </view>
  121. <view class="popbox-footer x-bc">
  122. <button class="popbox-footer-btn" @click="resetPop" >重置</button>
  123. <button class="popbox-footer-btn con-btn" @click="confirmPop">确定</button>
  124. </view>
  125. </view>
  126. </u-popup>
  127. </view>
  128. </template>
  129. <script>
  130. import {
  131. getgroupList,
  132. getallTags,
  133. changevipUserAll,
  134. gettagsUser,
  135. getprojectChange
  136. } from "@/api/manageCompany.js"
  137. export default {
  138. data() {
  139. return {
  140. list:[{
  141. name:'更换全部会员归属',
  142. text:'一键更换全部会员归属'
  143. },{
  144. name:'更换部分会员归属',
  145. text:'通过筛选,定位会员更换归属'
  146. }],
  147. active:0,
  148. show:false,
  149. columns:[],
  150. columnsa:[],
  151. columnsb:[],
  152. border:false,
  153. groupList:[],
  154. showa:false,
  155. showb:false,
  156. userid:0,
  157. username:'',
  158. usertag:'',
  159. tagsid:[],
  160. showvip:false,
  161. groupid:0,
  162. tagsuser:'',
  163. tagsuserlist:[],
  164. showproject:false,
  165. projectuser:'',
  166. projectlist:[],
  167. user:[],
  168. usertagsid:[],
  169. showPop:false,
  170. tagkeywords:'',
  171. tagpageNum:1,
  172. tagpageSize:10,
  173. triggereds:false,
  174. statusA: 'loadmore',
  175. isEnableds: true,
  176. pagetag:[],
  177. ids:[],
  178. projectid:[]
  179. }
  180. },
  181. onLoad(option) {
  182. this.groupid=option.id
  183. console.log(option)
  184. },
  185. mounted() {
  186. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  187. },
  188. methods: {
  189. getproject(){
  190. const data={
  191. companyUserId:this.groupid,
  192. tagIds:this.tagsid
  193. }
  194. getprojectChange(data).then(res=>{
  195. if(res.code==200){
  196. this.projectlist=res.data.map(item => {
  197. return {
  198. ...item,
  199. checked: false,
  200. }
  201. })
  202. }else{
  203. uni.showToast({
  204. title:res.msg,
  205. icon: 'none',
  206. duration: 1000
  207. });
  208. }
  209. })
  210. },
  211. resetPop(){
  212. //重置标签
  213. this.tagkeywords=''
  214. this.usertag=''
  215. this.projectuser=''
  216. this.ids=[]
  217. this.projectid=[]
  218. this.tagpageNum=1
  219. this.gettaglist()
  220. },
  221. getcompanyTag(value){
  222. this.tagkeywords=value
  223. this.tagpageNum=1
  224. this.gettaglist()
  225. },
  226. confirmPop() {
  227. //标签选择确定
  228. this.showPop = false
  229. this.usertag = this.columnsa.filter(item => item.checked).map(v => v.tag).join(',')
  230. this.tagsid = this.columnsa.filter(item => item.checked).map(v => v.tagId)
  231. this.projectid=[]
  232. this.projectuser=''
  233. this.ids=[]
  234. this.tagsuser=''
  235. },
  236. chooseTag(i) {
  237. this.columnsa[i].checked = !this.columnsa[i].checked
  238. },
  239. getTagpage(type){
  240. //标签页数选择
  241. if(type=='last'){
  242. if(this.tagpageNum>=2){
  243. this.tagpageNum--
  244. this.gettaglist()
  245. }else{
  246. uni.showToast({
  247. title: '已经是第一页',
  248. icon: 'none',
  249. duration: 1000
  250. });
  251. }
  252. }else{
  253. if(this.tagpageNum<this.pagetag.pages){
  254. this.tagpageNum++
  255. this.gettaglist()
  256. }else{
  257. uni.showToast({
  258. title: '已经是最后一页',
  259. icon: 'none',
  260. duration: 1000
  261. });
  262. }
  263. }
  264. },
  265. //标签展示下拉
  266. pullDownRefreshs() {
  267. // 下拉
  268. this.triggereds = true; //下拉了状态为true
  269. setTimeout(() => {
  270. this.triggereds = false;
  271. uni.stopPullDownRefresh()
  272. this.tagpageNum = 1;
  273. this.gettaglist('refresh') //触底 不穿执行else
  274. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  275. // 请求接口
  276. }, 1000)
  277. },
  278. closePop(){
  279. this.showPop=!this.showPop
  280. console.log(123)
  281. },
  282. checkboxClick(name){
  283. this.tagsuserlist[name].checked = !this.tagsuserlist[name].checked
  284. },
  285. checkproClick(name){
  286. this.projectlist[name].checked = !this.projectlist[name].checked
  287. },
  288. getprojectid(){
  289. //确定项目
  290. this.projectid=this.projectlist.filter(item => item.checked)
  291. .map(v => v.dictValue)
  292. this.projectuser=this.projectlist.filter(item => item.checked)
  293. .map(v => v.dictLabel).join(',')
  294. this.showproject=!this.showproject
  295. this.ids=[]
  296. this.tagsuser=''
  297. },
  298. getuserid(){
  299. //会员确定
  300. this.tagsuser = this.tagsuserlist.filter(item => item.checked)
  301. .map(v => v.userName).join(',')
  302. this.ids = this.tagsuserlist.filter(item => item.checked).map(v => {
  303. return {projectId:v.projectId,userId:v.userId};
  304. })
  305. console.log(this.ids)
  306. this.showvip=!this.showvip
  307. },
  308. close(){
  309. this.showvip=!this.showvip
  310. },
  311. open(){
  312. },
  313. changeproject(){
  314. //选择项目
  315. this.showproject=!this.showproject
  316. this.projectlist=[]
  317. this.getproject()
  318. },
  319. changelabelvip(){
  320. this.showvip=!this.showvip
  321. this.tagsuserlist=[]
  322. this.gettagUserlist()
  323. },
  324. gettagUserlist(){
  325. //会员列表
  326. const param={
  327. tagIds:this.tagsid,
  328. projectIds:this.projectid,
  329. companyUserId:this.groupid
  330. }
  331. gettagsUser(param).then(res=>{
  332. if(res.code==200){
  333. this.tagsuserlist=res.data.map(item => {
  334. return {
  335. ...item,
  336. checked: false,
  337. }
  338. })
  339. console.log(this.tagsuserlist)
  340. }
  341. })
  342. },
  343. changeall(){
  344. //更换会员归属
  345. const param={
  346. from:this.groupid,//发送群主
  347. to:this.userid,//接收群主
  348. type:this.active,//1
  349. ids:this.ids,
  350. tagList:this.tagsid,
  351. project:this.projectid
  352. }
  353. changevipUserAll(param).then(res=>{
  354. if(res.code==200){
  355. uni.showToast({
  356. icon: 'none',
  357. title: '更换会员归属成功'
  358. })
  359. }else{
  360. uni.showToast({
  361. icon: 'none',
  362. title: res.msg
  363. })
  364. }
  365. })
  366. },
  367. sure(){
  368. if(this.active==0){
  369. if(this.userid==''){
  370. uni.showToast({
  371. icon: 'none',
  372. title: '请选择接收销售'
  373. })
  374. }else{
  375. this.changeall()
  376. }
  377. }else{
  378. if(this.ids.length==0&&this.projectid.length==0&&this.tagsid.length==0){
  379. uni.showToast({
  380. icon: 'none',
  381. title: '请选择标签或者项目'
  382. })
  383. }else if(this.userid==''){
  384. uni.showToast({
  385. icon: 'none',
  386. title: '请选择接收销售'
  387. })
  388. }else{
  389. this.changeall()
  390. }
  391. }
  392. },
  393. receiveC(e){
  394. this.username=e.value[0].nickName
  395. this.userid=e.value[0].userId
  396. this.showb=!this.showb
  397. },
  398. receiveA(e){
  399. this.username=e.value[0].nickName
  400. this.userid=e.value[0].userId
  401. this.show=!this.show
  402. },
  403. change(index){
  404. this.active=index
  405. this.username=''
  406. },
  407. selsome(){
  408. console.log(12)
  409. this.show=true
  410. this.getgrouplist()
  411. },
  412. changelabel(){
  413. this.showPop=true
  414. this.gettaglist()
  415. },
  416. changeuser(){
  417. this.showb=true
  418. this.getgrouplist()
  419. },
  420. gettaglist(type){
  421. //获取标签列表
  422. uni.showLoading({
  423. title:'加载中...'
  424. })
  425. const data={
  426. pageNum:this.tagpageNum,
  427. pageSize:this.tagpageSize,
  428. keyword:this.tagkeywords,
  429. companyUserId:this.groupid
  430. }
  431. getallTags(data).then(res=>{
  432. if(res.code==200){
  433. uni.hideLoading()
  434. const dataList = res.data.list.map(item => {
  435. return {
  436. ...item,
  437. checked: false,
  438. }
  439. })
  440. if (type == 'refresh') {
  441. this.columnsa = dataList
  442. }else {
  443. // this.columnsa = [...this.columnsa, ...dataList]
  444. this.columnsa = dataList
  445. }
  446. if (res.data.isLastPage) {
  447. this.statusA = 'nomore'
  448. } else {
  449. this.statusA = 'loadmore'
  450. }
  451. this.pagetag=res.data
  452. this.changetag = this.columnsa
  453. }else{
  454. uni.hideLoading()
  455. uni.showToast({
  456. icon: 'none',
  457. title: res.msg
  458. })
  459. }
  460. })
  461. },
  462. getgrouplist(){
  463. //获取销售列表
  464. getgroupList().then(res=>{
  465. if(res.code==200){
  466. this.columns=[res.data]
  467. this.columnsb=[res.data]
  468. console.log(this.columns)
  469. }else{
  470. uni.showToast({
  471. icon: 'none',
  472. title: res.msg
  473. })
  474. }
  475. })
  476. }
  477. }
  478. }
  479. </script>
  480. <style lang="scss" scoped>
  481. .popbox {
  482. background-color: #fff;
  483. border-radius: 12px;
  484. font-family: PingFang SC, PingFang SC;
  485. font-weight: 400;
  486. font-size: 14px;
  487. color: #333;
  488. &-head {
  489. padding: 15px;
  490. font-weight: bold;
  491. font-size: 15px;
  492. text-align: center;
  493. position: relative;
  494. }
  495. .close-circle {
  496. position: absolute;
  497. right: 10px;
  498. top: 50%;
  499. transform: translateY(-50%);
  500. }
  501. &-body {
  502. padding: 10px 10px;
  503. }
  504. .radiobox {
  505. &-item {
  506. padding: 10px 0;
  507. border-bottom: 1px solid #f5f5f5;
  508. &:last-child {
  509. border-bottom: none;
  510. }
  511. }
  512. }
  513. &-footer {
  514. padding: 15px 0;
  515. }
  516. &-footer-btn {
  517. flex: 1;
  518. height: 44px;
  519. line-height: 44px;
  520. margin: 0 10px;
  521. border-radius: 50px;
  522. border: none;
  523. font-family: PingFang SC, PingFang SC;
  524. font-weight: 400;
  525. font-size: 14px;
  526. color: #333;
  527. &::after {
  528. border: none;
  529. }
  530. }
  531. .con-btn {
  532. background-color: #1677ff;
  533. color: #fff;
  534. }
  535. .choosetitle {
  536. font-family: PingFang SC, PingFang SC;
  537. font-weight: 400;
  538. font-size: 15px;
  539. color: #333;
  540. }
  541. .invitetip {
  542. margin-top: 10px;
  543. background-color: #ebf5fb;
  544. color: #1677ff;
  545. padding: 5px 10px;
  546. border-radius: 5px;
  547. }
  548. .sharePop-item {
  549. padding: 0 10px;
  550. box-sizing: border-box;
  551. font-family: PingFang SC, PingFang SC;
  552. font-weight: 400;
  553. font-size: 14px;
  554. display: inline-flex !important;
  555. image {
  556. height: 48px;
  557. width: 48px;
  558. margin-bottom: 10px;
  559. }
  560. }
  561. }
  562. page{
  563. background-color: #fff;
  564. }
  565. .top-itemActive{
  566. color: #1773ff;
  567. border-bottom: 4rpx solid #1773ff;
  568. background-color: rgba(232,242,254,1);
  569. text{
  570. color: #1773ff !important;
  571. }
  572. }
  573. .foot-box{
  574. position: fixed;
  575. bottom: 0;
  576. width: 100%;
  577. padding: 20rpx;
  578. }
  579. .box{
  580. width:70%;
  581. text-align: center;
  582. padding: 16rpx 0;
  583. border-radius: 50rpx;
  584. font-size: 28rpx;
  585. }
  586. .box-list{
  587. width: fit-content;
  588. background-color: #eee;
  589. border-radius: 10rpx;
  590. font-size: 28rpx;
  591. }
  592. .surebtn{
  593. position: absolute;
  594. bottom: 0;
  595. margin-bottom: 20rpx;
  596. background-color: #1773ff;
  597. color: #fff;
  598. width: 80%;
  599. text-align: center;
  600. padding: 10rpx 0;
  601. border-radius: 30rpx;
  602. }
  603. </style>