123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- <template>
- <view class="column flex-1 hb">
- <view class="p20 justify-between" >
- <view class="column base-bg-f8 p20 mr20 top-item" v-for="(item,index) in list" :key="index"
- style="width: 50%;" @click="change(index)" :class="active==index?'top-itemActive':''">
- <text class="fs28 bold mb4">{{item.name}}</text>
- <text class="fs24 base-color-6">{{item.text}}</text>
- </view>
- </view>
- <view class="pl20 " v-if="active==0">
- <view class="mb20 fs28">选择接收群管</view>
- <view class="base-bg-f8 p10 justify-between align-center mr20 pl20">
- <text class="mr20">接收群管</text>
- <u-input placeholder="请选择接收群管" @focus="selsome" border="none"
- v-model="username"></u-input>
- </view>
- <view class='fs24 mtb12 base-color base-bg-sure mr20 pl20 ptb4'>
- 如更换全部会员,则包含小黑屋会员</view>
-
- </view>
- <view v-else class="pl20 ">
- <view class="mb20 fs28">选择会员</view>
- <view class="base-bg-f8 p10 justify-between align-center mr20 pl20">
- <text class="mr20">标签</text>
- <u-input placeholder="请选择标签" border="none" @focus='changelabel'
- v-model="usertag"></u-input>
- </view>
- <view class="base-bg-f8 p10 justify-between align-center mr20 pl20 mt20">
- <text class="mr20">选择会员</text>
- <u-input placeholder="请选择会员" border="none" @focus='changelabelvip'
- v-model="tagsuser"></u-input>
- </view>
- <view class="mb20 fs28 mt20">选择接收群管</view>
- <view class="base-bg-f8 p10 justify-between align-center mr20 pl20">
- <text class="mr20">接收群管</text>
- <u-input placeholder="请选择接收群管" border="none" @focus='changeuser'
- v-model="username"></u-input>
- </view>
- </view>
- <view class="foot-box justify-around">
- <!-- <view class="box" style="border: 2rpx solid #eee;">取消</view> -->
- <view class="box base-bg-blue colorf" @click="sure">确定</view>
- </view>
- <u-picker :show="show" :columns="columns" @cancel='show=!show'
- @confirm='receiveA' keyName="nickName"
- ></u-picker>
- <u-picker :show="showa" :columns="columnsa" @cancel='showa=!showa'
- @confirm='receiveB' keyName="tag"
- ></u-picker>
- <u-picker :show="showb" :columns="columnsb" @cancel='showb=!showb'
- @confirm='receiveC' keyName="nickName"
- ></u-picker>
- <u-popup :show="showvip" @close="close" @open="open" >
- <view class="p20 h400">
- <view class="justify-between mb20" style="flex-direction: row-reverse">
- <u-icon name="close-circle" color="#ccc" size="28"
- @click="showvip=!showvip"></u-icon>
- </view>
- <view class="justify-start wrap">
- <view class="p16 mlr12" v-for="(item,index) in tagsuserlist" :key="index">
- <u-tag :text="item.nickName" :plain="!item.checked" type="primary" :name="index"
- @click="checkboxClick">
- </u-tag>
- </view>
- </view>
- <view class="centerV">
- <view @click="getuserid" class="surebtn">确定</view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import {
- getgroupList,
- changevipUser,
- getcompanyTaglist,
- changevipUserAll,
- gettagsUser,
- } from "@/api/courseManage.js"
- export default {
- data() {
- return {
- list:[{
- name:'更换全部会员归属',
- text:'一键更换全部会员归属'
- },{
- name:'更换部分会员归属',
- text:'通过筛选,定位会员更换归属'
- }],
- active:0,
- show:false,
- columns:[],
- columnsa:[],
- columnsb:[],
- border:false,
- groupList:[],
- showa:false,
- showb:false,
- userid:0,
- username:'',
- usertag:'',
- tagsid:'',
- showvip:false,
- groupid:0,
- tagsuser:'',
- tagsuserlist:[],
- user:[],
- usertagsid:[]
- }
- },
- onLoad(option) {
- this.groupid=option.id
- console.log(option)
- },
- mounted() {
- this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
- },
- methods: {
- checkboxClick(name){
- console.log(name)
- this.tagsuserlist[name].checked = !this.tagsuserlist[name].checked
- console.log(this.tagsuser)
- },
- getuserid(){
- this.tagsuser = this.tagsuserlist.filter(item => item.checked)
- .map(v => v.nickName).join(',')
- this.usertagsid = this.tagsuserlist.filter(item => item.checked)
- .map(v => v.userId)
- this.showvip=!this.showvip
- },
- close(){
- this.showvip=!this.showvip
- },
- open(){
-
- },
- changelabelvip(){
- if(this.tagsid==''){
- uni.showToast({
- icon: 'none',
- title: "请先选择标签"
- })
- }else{
- this.showvip=!this.showvip
- this.gettagUserlist()
- }
- },
- gettagUserlist(){
- const param={
- companyId:this.user.companyId,
- // companyUserId:this.groupid,
- tagIds:this.tagsid,
- companyUserId:this.userid
- }
- gettagsUser(param).then(res=>{
- if(res.code==200){
- this.tagsuserlist=res.data.map(item => {
- return {
- ...item,
- checked: false,
- }
- })
- console.log(this.tagsuserlist)
- }
- })
- },
- changesomevip(){
- //更换部分会员归属
- const param={
- companyId:this.user.companyId,
- companyUserId:this.groupid,
- tagIds:this.tagsid,
- userId:this.usertagsid
- }
- changevipUser(param).then(res=>{
- if(res.code==200){
- uni.showToast({
- icon: 'none',
- title: '更换会员归属成功'
- })
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- },
- changeall(){
- //更换全部会员
- const param={
- newCompanyUserId:this.userid,
- oldCompanyUserId:this.groupid
- }
- changevipUserAll(param).then(res=>{
- if(res.code==200){
- uni.showToast({
- icon: 'none',
- title: '更换会员归属成功'
- })
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- },
- sure(){
- if(this.active==0){
- if(this.userid==''){
- uni.showToast({
- icon: 'none',
- title: '请选择接收群管'
- })
- }else{
- this.changeall()
- }
- }else{
- if(this.tagsid==''){
- uni.showToast({
- icon: 'none',
- title: '请选择标签'
- })
- }else if(this.usertagsid==''){
- uni.showToast({
- icon: 'none',
- title: '请选择会员'
- })
- }else{
- this.changesomevip()
- }
- }
- },
- receiveC(e){
- this.username=e.value[0].nickName
- this.userid=e.value[0].userId
- this.showb=!this.showb
- },
- receiveB(e){
- this.tagsid=e.value[0].tagId
- this.usertag=e.value[0].tag
- this.showa=!this.showa
- },
- receiveA(e){
- this.username=e.value[0].nickName
- this.userid=e.value[0].userId
- this.show=!this.show
- },
- change(index){
- this.active=index
- },
- selsome(){
- console.log(12)
- this.show=true
- this.getgrouplist()
- },
- changelabel(){
- this.tagsuser=''
- this.showa=true
- this.gettaglist()
- },
- changeuser(){
- this.showb=true
- this.getgrouplist()
- },
- gettaglist(){
- getcompanyTaglist().then(res=>{
- if(res.code==200){
- this.columnsa=[res.data]
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- },
- getgrouplist(){
- //获取群管列表
- getgroupList().then(res=>{
- if(res.code==200){
- this.columns=[res.data]
- this.columnsb=[res.data]
- console.log(this.columns)
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- background-color: #fff;
- }
- .top-itemActive{
- color: #1773ff;
- border-bottom: 4rpx solid #1773ff;
- background-color: rgba(232,242,254,1);
- text{
- color: #1773ff !important;
- }
- }
- .foot-box{
- position: fixed;
- bottom: 0;
- width: 100%;
- padding: 20rpx;
- }
- .box{
- width:70%;
- text-align: center;
- padding: 16rpx 0;
- border-radius: 50rpx;
- font-size: 28rpx;
- }
- .box-list{
- width: fit-content;
- background-color: #eee;
- border-radius: 10rpx;
- font-size: 28rpx;
- }
- .surebtn{
- position: absolute;
- bottom: 0;
- margin-bottom: 20rpx;
- background-color: #1773ff;
- color: #fff;
- width: 80%;
- text-align: center;
- padding: 10rpx 0;
- border-radius: 30rpx;
- }
- </style>
|