ManageDetail.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <view>
  3. <view class="topBgline plr20">
  4. <view class="justify-start p30 bgcolf radius12">
  5. <u-avatar :src='detailUser.avatar'></u-avatar>
  6. <view class="ml16">
  7. <view class="bold fs28">{{detailUser.nickname}}</view>
  8. <view class="fs24 base-color-3">注册时间:{{detailUser.createTime}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="plr20 ptb32 justify-around bgf">
  13. <view v-for="(item,index) in typeOption" :key="item.value" class='fs24 base-color-3 ptb4 plr20 radius4'
  14. @click="tabActive(item)" :class="tabindex==index?'actsel':'notact'">{{item.label}}</view>
  15. </view>
  16. <view class="bgf pb40">
  17. <u-collapse :border='false' :value='collapseValue' @change="changeCollapse">
  18. <!-- #ifdef MP-WEIXIN -->
  19. <u-collapse-item name="course" title="看课统计">
  20. <!-- #endif -->
  21. <!-- #ifndef MP-WEIXIN -->
  22. <u-collapse-item name="course">
  23. <text slot="title" class="bold">看课统计</text>
  24. <!-- #endif -->
  25. <text slot="value" class="base-color fs24">{{collapseValue.includes('course')?'收回':'展开'}}</text>
  26. <view slot="right-icon">
  27. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  28. </view>
  29. <view class="justify-between">
  30. <view class="justify-between livebox">
  31. <view class="base-color-3">观看次数</view>
  32. <view class="base-color fs24"><text class="fs32 bold">{{answerlist.watchTimes}}</text>次</view>
  33. </view>
  34. <view class="livebox justify-between">
  35. <view class="base-color-3">完播次数</view>
  36. <view class="base-color fs24"><text class="fs32 bold">{{answerlist.completeWatchCount}}</text>次</view>
  37. </view>
  38. </view>
  39. </u-collapse-item>
  40. <!-- #ifdef MP-WEIXIN -->
  41. <u-collapse-item name="questions" title="答题统计">
  42. <!-- #endif -->
  43. <!-- #ifndef MP-WEIXIN -->
  44. <u-collapse-item name="questions">
  45. <text slot="title" class="bold">答题统计</text>
  46. <!-- #endif -->
  47. <text slot="value" class="base-color fs24">{{collapseValue.includes('course')?'收回':'展开'}}</text>
  48. <view slot="right-icon">
  49. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  50. </view>
  51. <view class="justify-between">
  52. <view class=" liveboxs">
  53. <view class="base-color-3">答题次数</view>
  54. <view class="base-color fs24">
  55. <text class="fs32 bold">{{answerlist.answerTime}}</text>次
  56. </view>
  57. </view>
  58. <view class="liveboxs ">
  59. <view class="base-color-3">正确次数</view>
  60. <view class="base-color fs24">
  61. <text class="fs32 bold">{{answerlist.answerRightTime}}</text>次
  62. </view>
  63. </view>
  64. <view class="liveboxs ">
  65. <view class="base-color-3">答题红包数</view>
  66. <view class="base-color fs24">
  67. <text class="fs32 bold">{{answerlist.answerRedPacketTime}}</text>次
  68. </view>
  69. </view>
  70. </view>
  71. </u-collapse-item>
  72. </u-collapse>
  73. <view class="justify-start align-center base-bg-f8 mlr30 radius12 plr20 ptb20">
  74. <u-image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/manergevip/book.png" width="30" height="30"></u-image>
  75. <view class="ml20">
  76. <view class="base-color-3">答题红包金额</view>
  77. <view class="base-color fs24"><text class="fs32 bold mr4">
  78. {{answerlist.answerRedPacketAmount==0?'00.00':answerlist.answerRedPacketAmount}}</text>元</view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="justify-center botfun">
  83. <view class="justify-start align-center bottom-btns" style="border: 2rpx solid #ee0a25;"
  84. @click="disableUser" :class="this.detailUser.status==1?'bgf':'base-bg-red'">
  85. <u-icon name="close-circle" :color="this.detailUser.status==1?'#ee0a25':'#fff'" size="22" ></u-icon>
  86. <view class=" ml12" :class="this.detailUser.status==1?'base-color-red':'colorf'">{{answerText}}</view>
  87. </view>
  88. <!-- <view class="justify-start align-center bottom-btns" style="border: 2rpx solid #1677ff;">
  89. <u-icon name="pushpin" color="#1677ff" size="22"></u-icon>
  90. <view class="base-color">会员分组</view>
  91. </view>
  92. <view class="justify-start align-center base-bg bottom-btns">
  93. <u-icon name="rmb-circle" color="#fff" size="22"></u-icon>
  94. <view class="colorf">新会员奖励</view>
  95. </view> -->
  96. </view>
  97. </view>
  98. </template>
  99. <script>
  100. import {
  101. getanswerlist,
  102. Addblacklist,
  103. removebalcklist
  104. } from "@/api/courseManage.js";
  105. export default {
  106. data() {
  107. return {
  108. typeOption: [{
  109. label: '全部',
  110. value: 0
  111. }, {
  112. label: '今天',
  113. value: 1
  114. }, {
  115. label: '昨天',
  116. value: 2
  117. }, {
  118. label: '前天',
  119. value: 3
  120. }, {
  121. label: '近七天',
  122. value: 4
  123. }],
  124. tabindex: 0,
  125. collapseValue: ['course', 'questions', 'redenvelope'],
  126. detailUser: [],
  127. user: [],
  128. answerlist:[],
  129. answerText:'禁用',
  130. userId:[],
  131. id:'',
  132. dateTag:''
  133. }
  134. },
  135. onShow() {
  136. this.getAnswerlists()
  137. this.detailUser =uni.getStorageSync('detailUser')
  138. if(this.detailUser.status==0){
  139. this.answerText='取消禁用'
  140. }
  141. },
  142. mounted() {
  143. },
  144. onLoad(option) {
  145. this.id=option.id
  146. },
  147. methods: {
  148. tabActive(item) {
  149. this.tabindex = item.value
  150. this.dateTag=item.label
  151. console.log(item.label)
  152. this.getAnswerlists()
  153. },
  154. changeCollapse(e) {
  155. this.collapseValue = e.filter(item => item.status == 'open').map(it => it.name)
  156. },
  157. getAnswerlists() {
  158. const params = {
  159. dateTag:this.dateTag,
  160. userId: this.id
  161. }
  162. getanswerlist(params).then(res => {
  163. if (res.code == 200) {
  164. this.answerlist=res.data
  165. console.log(this.answerlist)
  166. } else {
  167. uni.showToast({
  168. icon: 'none',
  169. title: res.msg
  170. })
  171. }
  172. })
  173. },
  174. disableUser(){
  175. if(this.detailUser.status==1){
  176. this.addblack()
  177. this.detailUser.status=0
  178. this.answerText='已禁用'
  179. }else{
  180. this.deleteblack()
  181. this.detailUser.status==1
  182. this.answerText='禁用'
  183. }
  184. },
  185. addblack(){
  186. //添加到黑名单
  187. this.userId[0]=this.detailUser.userId
  188. const params={
  189. array: this.userId
  190. }
  191. Addblacklist(this.userId).then(res=>{
  192. if(res.code==200){
  193. console.log(res)
  194. uni.showToast({
  195. icon: 'none',
  196. title: '用户成功被禁用'
  197. })
  198. setTimeout(()=>{
  199. console.log(1232)
  200. uni.navigateBack({
  201. data:1
  202. })
  203. },500)
  204. }else{
  205. uni.showToast({
  206. icon: 'none',
  207. title: res.msg
  208. })
  209. }
  210. })
  211. },
  212. deleteblack(){
  213. //移除黑名单
  214. this.userId[0]=this.detailUser.userId
  215. removebalcklist(this.userId).then(res=>{
  216. if(res.code){
  217. uni.showToast({
  218. icon: 'none',
  219. title: '用户成功取消禁用'
  220. })
  221. setTimeout(()=>{
  222. uni.switchTab({
  223. url:'/pages/customer/index'
  224. })
  225. },500)
  226. }else{
  227. uni.showToast({
  228. icon: 'none',
  229. title: res.msg
  230. })
  231. }
  232. })
  233. }
  234. }
  235. }
  236. </script>
  237. <style lang="scss" scoped>
  238. // page {
  239. // background-color: #fff;
  240. // }
  241. .topBgline {
  242. background: linear-gradient(to right, rgba(225, 238, 255, 1), rgba(223, 224, 254, 1));
  243. padding-top: 40rpx;
  244. }
  245. .bgcolf {
  246. background: rgba(255, 255, 255, 0.4);
  247. }
  248. .actsel {
  249. background-color: #1773ff;
  250. color: #fff;
  251. transition: background-color 0.4s ease-in-out;
  252. }
  253. .notact {
  254. background-color: #f8f8f8;
  255. }
  256. .livebox {
  257. width: calc(50% - 10rpx);
  258. background-color: #f8f8f8;
  259. padding: 20rpx 10rpx;
  260. border-radius: 12rpx;
  261. }
  262. .liveboxs {
  263. width: calc(33% - 10rpx);
  264. background-color: #f8f8f8;
  265. padding: 20rpx 10rpx;
  266. border-radius: 12rpx;
  267. }
  268. .bottom-btns {
  269. padding: 10rpx 40rpx;
  270. border-radius: 50rpx;
  271. }
  272. .botfun {
  273. position: fixed;
  274. bottom: 32rpx;
  275. right: 32rpx;
  276. }
  277. </style>