changeVip.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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="showa" :columns="columnsa" @cancel='showa=!showa'
  47. @confirm='receiveB' keyName="tag"
  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="justify-between mb20" style="flex-direction: row-reverse">
  55. <u-icon name="close-circle" color="#ccc" size="28"
  56. @click="showvip=!showvip"></u-icon>
  57. </view>
  58. <view class="justify-start wrap">
  59. <view class="p16 mlr12" v-for="(item,index) in tagsuserlist" :key="index">
  60. <u-tag :text="item.nickName" :plain="!item.checked" type="primary" :name="index"
  61. @click="checkboxClick">
  62. </u-tag>
  63. </view>
  64. </view>
  65. <view class="centerV">
  66. <view @click="getuserid" class="surebtn">确定</view>
  67. </view>
  68. </view>
  69. </u-popup>
  70. </view>
  71. </template>
  72. <script>
  73. import {
  74. getgroupList,
  75. changevipUser,
  76. getcompanyTaglist,
  77. changevipUserAll,
  78. gettagsUser,
  79. } from "@/api/courseManage.js"
  80. export default {
  81. data() {
  82. return {
  83. list:[{
  84. name:'更换全部会员归属',
  85. text:'一键更换全部会员归属'
  86. },{
  87. name:'更换部分会员归属',
  88. text:'通过筛选,定位会员更换归属'
  89. }],
  90. active:0,
  91. show:false,
  92. columns:[],
  93. columnsa:[],
  94. columnsb:[],
  95. border:false,
  96. groupList:[],
  97. showa:false,
  98. showb:false,
  99. userid:0,
  100. username:'',
  101. usertag:'',
  102. tagsid:'',
  103. showvip:false,
  104. groupid:0,
  105. tagsuser:'',
  106. tagsuserlist:[],
  107. user:[],
  108. usertagsid:[]
  109. }
  110. },
  111. onLoad(option) {
  112. this.groupid=option.id
  113. console.log(option)
  114. },
  115. mounted() {
  116. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  117. },
  118. methods: {
  119. checkboxClick(name){
  120. console.log(name)
  121. this.tagsuserlist[name].checked = !this.tagsuserlist[name].checked
  122. console.log(this.tagsuser)
  123. },
  124. getuserid(){
  125. this.tagsuser = this.tagsuserlist.filter(item => item.checked)
  126. .map(v => v.nickName).join(',')
  127. this.usertagsid = this.tagsuserlist.filter(item => item.checked)
  128. .map(v => v.userId)
  129. this.showvip=!this.showvip
  130. },
  131. close(){
  132. this.showvip=!this.showvip
  133. },
  134. open(){
  135. },
  136. changelabelvip(){
  137. if(this.tagsid==''){
  138. uni.showToast({
  139. icon: 'none',
  140. title: "请先选择标签"
  141. })
  142. }else{
  143. this.showvip=!this.showvip
  144. this.gettagUserlist()
  145. }
  146. },
  147. gettagUserlist(){
  148. const param={
  149. companyId:this.user.companyId,
  150. // companyUserId:this.groupid,
  151. tagIds:this.tagsid,
  152. companyUserId:this.userid
  153. }
  154. gettagsUser(param).then(res=>{
  155. if(res.code==200){
  156. this.tagsuserlist=res.data.map(item => {
  157. return {
  158. ...item,
  159. checked: false,
  160. }
  161. })
  162. console.log(this.tagsuserlist)
  163. }
  164. })
  165. },
  166. changesomevip(){
  167. //更换部分会员归属
  168. const param={
  169. companyId:this.user.companyId,
  170. companyUserId:this.groupid,
  171. tagIds:this.tagsid,
  172. userId:this.usertagsid
  173. }
  174. changevipUser(param).then(res=>{
  175. if(res.code==200){
  176. uni.showToast({
  177. icon: 'none',
  178. title: '更换会员归属成功'
  179. })
  180. }else{
  181. uni.showToast({
  182. icon: 'none',
  183. title: res.msg
  184. })
  185. }
  186. })
  187. },
  188. changeall(){
  189. //更换全部会员
  190. const param={
  191. newCompanyUserId:this.userid,
  192. oldCompanyUserId:this.groupid
  193. }
  194. changevipUserAll(param).then(res=>{
  195. if(res.code==200){
  196. uni.showToast({
  197. icon: 'none',
  198. title: '更换会员归属成功'
  199. })
  200. }else{
  201. uni.showToast({
  202. icon: 'none',
  203. title: res.msg
  204. })
  205. }
  206. })
  207. },
  208. sure(){
  209. if(this.active==0){
  210. if(this.userid==''){
  211. uni.showToast({
  212. icon: 'none',
  213. title: '请选择接收群管'
  214. })
  215. }else{
  216. this.changeall()
  217. }
  218. }else{
  219. if(this.tagsid==''){
  220. uni.showToast({
  221. icon: 'none',
  222. title: '请选择标签'
  223. })
  224. }else if(this.usertagsid==''){
  225. uni.showToast({
  226. icon: 'none',
  227. title: '请选择会员'
  228. })
  229. }else{
  230. this.changesomevip()
  231. }
  232. }
  233. },
  234. receiveC(e){
  235. this.username=e.value[0].nickName
  236. this.userid=e.value[0].userId
  237. this.showb=!this.showb
  238. },
  239. receiveB(e){
  240. this.tagsid=e.value[0].tagId
  241. this.usertag=e.value[0].tag
  242. this.showa=!this.showa
  243. },
  244. receiveA(e){
  245. this.username=e.value[0].nickName
  246. this.userid=e.value[0].userId
  247. this.show=!this.show
  248. },
  249. change(index){
  250. this.active=index
  251. },
  252. selsome(){
  253. console.log(12)
  254. this.show=true
  255. this.getgrouplist()
  256. },
  257. changelabel(){
  258. this.tagsuser=''
  259. this.showa=true
  260. this.gettaglist()
  261. },
  262. changeuser(){
  263. this.showb=true
  264. this.getgrouplist()
  265. },
  266. gettaglist(){
  267. getcompanyTaglist().then(res=>{
  268. if(res.code==200){
  269. this.columnsa=[res.data]
  270. }else{
  271. uni.showToast({
  272. icon: 'none',
  273. title: res.msg
  274. })
  275. }
  276. })
  277. },
  278. getgrouplist(){
  279. //获取群管列表
  280. getgroupList().then(res=>{
  281. if(res.code==200){
  282. this.columns=[res.data]
  283. this.columnsb=[res.data]
  284. console.log(this.columns)
  285. }else{
  286. uni.showToast({
  287. icon: 'none',
  288. title: res.msg
  289. })
  290. }
  291. })
  292. }
  293. }
  294. }
  295. </script>
  296. <style lang="scss" scoped>
  297. page{
  298. background-color: #fff;
  299. }
  300. .top-itemActive{
  301. color: #1773ff;
  302. border-bottom: 4rpx solid #1773ff;
  303. background-color: rgba(232,242,254,1);
  304. text{
  305. color: #1773ff !important;
  306. }
  307. }
  308. .foot-box{
  309. position: fixed;
  310. bottom: 0;
  311. width: 100%;
  312. padding: 20rpx;
  313. }
  314. .box{
  315. width:70%;
  316. text-align: center;
  317. padding: 16rpx 0;
  318. border-radius: 50rpx;
  319. font-size: 28rpx;
  320. }
  321. .box-list{
  322. width: fit-content;
  323. background-color: #eee;
  324. border-radius: 10rpx;
  325. font-size: 28rpx;
  326. }
  327. .surebtn{
  328. position: absolute;
  329. bottom: 0;
  330. margin-bottom: 20rpx;
  331. background-color: #1773ff;
  332. color: #fff;
  333. width: 80%;
  334. text-align: center;
  335. padding: 10rpx 0;
  336. border-radius: 30rpx;
  337. }
  338. </style>