changeVip.vue 13 KB

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