removeQuestionDig.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <van-popup
  3. :show="show"
  4. position="bottom"
  5. :close-on-click-overlay="true"
  6. closeable
  7. @close="handleClose"
  8. round
  9. >
  10. <view class="remove-question-wrap">
  11. <view class="title">转移问题</view>
  12. <view class="main-box">
  13. <view class="left">
  14. <view
  15. :class="['item',index==fIndex&&'active']"
  16. v-for="(item,index) in opts"
  17. :key="item.classify_id"
  18. @click="fIndex=index,adminId=0,secIndex=0"
  19. >{{item.classify_name}}</view>
  20. </view>
  21. <view class="center">
  22. <view
  23. :class="['item',index==secIndex&&'active']"
  24. v-for="(item,index) in opts[fIndex].tags"
  25. :key="item.tag_id"
  26. @click="secIndex=index,adminId=0"
  27. >{{item.tag_name}}</view>
  28. </view>
  29. <view class="right">
  30. <view
  31. :class="['item',item.admin_id==adminId&&'active',!item.allow_select&&'disabled']"
  32. v-for="item in opts[fIndex].tags[secIndex].researcher_list"
  33. :key="item.admin_id"
  34. @click="handleSelectAdmin(item)"
  35. >{{item.admin_name}}</view>
  36. </view>
  37. </view>
  38. <view class="btn" @click="handleConfirmTrans">确定</view>
  39. </view>
  40. </van-popup>
  41. </template>
  42. <script>
  43. import {apiGetTagTree} from '@/api/common'
  44. import {apiQuestionTransfer} from '@/api/question'
  45. export default {
  46. props:{
  47. qid:{
  48. default:0
  49. },
  50. show:{
  51. type:Boolean,
  52. default:false
  53. }
  54. },
  55. watch:{
  56. qid(){
  57. this.getOpts()
  58. }
  59. },
  60. data() {
  61. return {
  62. opts:[],
  63. fIndex:0,
  64. secIndex:0,
  65. adminId:0,//选择的人id
  66. }
  67. },
  68. methods: {
  69. async getOpts(){
  70. const res=await apiGetTagTree({
  71. community_question_id:this.qid||0
  72. })
  73. if(res.code===200){
  74. this.opts=res.data||[]
  75. }
  76. },
  77. // 选择转移人
  78. handleSelectAdmin(item){
  79. if(!item.allow_select) return
  80. this.adminId=item.admin_id
  81. },
  82. //确认转移
  83. async handleConfirmTrans(){
  84. if(!this.adminId){
  85. uni.showToast({
  86. title:"请选择转移人",
  87. icon:'none'
  88. })
  89. return
  90. }
  91. const res=await apiQuestionTransfer({
  92. community_question_id:Number(this.qid),
  93. variety_classify_id:this.opts[this.fIndex].classify_id,
  94. variety_tag_id:this.opts[this.fIndex].tags[this.secIndex].tag_id,
  95. admin_id:this.adminId
  96. })
  97. if(res.code===200){
  98. uni.showToast({
  99. title:"转移成功",
  100. icon:'none'
  101. })
  102. this.handleClose()
  103. setTimeout(()=>{
  104. uni.navigateBack({
  105. delta:1,
  106. fail(){
  107. uni.switchTab({
  108. url: '/pages/question/question'
  109. })
  110. }
  111. })
  112. },1500)
  113. }
  114. },
  115. handleClose(){
  116. this.$emit('close')
  117. }
  118. },
  119. }
  120. </script>
  121. <style lang="scss">
  122. .remove-question-wrap{
  123. .title{
  124. padding: 30rpx 0 10rpx 0;
  125. font-size: 32rpx;
  126. text-align: center;
  127. }
  128. .main-box{
  129. height: 30vh;
  130. display: flex;
  131. .left,.center,.right{
  132. flex: 1;
  133. height: 100%;
  134. overflow-y: auto;
  135. &::-webkit-scrollbar{
  136. width: 0;
  137. height: 0;
  138. display: none;
  139. }
  140. .item{
  141. padding: 20rpx 10rpx;
  142. font-size: 32rpx;
  143. }
  144. .active{
  145. color: #E3B377;
  146. }
  147. .disabled{
  148. color: #999;
  149. }
  150. }
  151. .center{
  152. border-left: 1px solid #ededed;
  153. border-right: 1px solid #ededed;
  154. }
  155. }
  156. .btn{
  157. margin-top: 20rpx;
  158. width: 80%;
  159. text-align: center;
  160. background: #333333;
  161. border-radius: 40px;
  162. margin-left: auto;
  163. margin-right: auto;
  164. color: #E3B377;
  165. line-height: 80rpx;
  166. font-size: 32rpx;
  167. }
  168. }
  169. </style>