ManageDetail.vue 8.3 KB

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