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. <!-- @click="toactdetail" >查看行动轨迹</view> -->
  15. </view>
  16. </view>
  17. <view class="plr20 ptb32 justify-around bgf">
  18. <view v-for="(item,index) in typeOption" :key="item.value" class='fs24 base-color-3 ptb4 plr20 radius4'
  19. @click="tabActive(item)" :class="tabindex==index?'actsel':'notact'">{{item.label}}</view>
  20. </view>
  21. <view class="bgf pb40">
  22. <u-collapse :border='false' :value='collapseValue' @change="changeCollapse">
  23. <!-- #ifdef MP-WEIXIN -->
  24. <u-collapse-item name="course" title="看课统计">
  25. <!-- #endif -->
  26. <!-- #ifndef MP-WEIXIN -->
  27. <u-collapse-item name="course">
  28. <text slot="title" class="bold">看课统计</text>
  29. <!-- #endif -->
  30. <text slot="value" class="base-color fs24">{{collapseValue.includes('course')?'收回':'展开'}}</text>
  31. <view slot="right-icon">
  32. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  33. </view>
  34. <view class="justify-between">
  35. <view class="justify-between livebox">
  36. <view class="base-color-3">观看次数</view>
  37. <view class="base-color fs24"><text class="fs32 bold">{{answerlist.watchTimes}}</text>次</view>
  38. </view>
  39. <view class="livebox justify-between">
  40. <view class="base-color-3">完播次数</view>
  41. <view class="base-color fs24"><text class="fs32 bold">{{answerlist.completeWatchCount}}</text>次</view>
  42. </view>
  43. </view>
  44. </u-collapse-item>
  45. <!-- #ifdef MP-WEIXIN -->
  46. <u-collapse-item name="questions" title="答题统计">
  47. <!-- #endif -->
  48. <!-- #ifndef MP-WEIXIN -->
  49. <u-collapse-item name="questions">
  50. <text slot="title" class="bold">答题统计</text>
  51. <!-- #endif -->
  52. <text slot="value" class="base-color fs24">{{collapseValue.includes('course')?'收回':'展开'}}</text>
  53. <view slot="right-icon">
  54. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  55. </view>
  56. <view class="justify-between">
  57. <view class=" liveboxs">
  58. <view class="base-color-3">答题次数</view>
  59. <view class="base-color fs24">
  60. <text class="fs32 bold">{{answerlist.answerTime}}</text>次
  61. </view>
  62. </view>
  63. <view class="liveboxs ">
  64. <view class="base-color-3">正确次数</view>
  65. <view class="base-color fs24">
  66. <text class="fs32 bold">{{answerlist.answerRightTime}}</text>次
  67. </view>
  68. </view>
  69. <view class="liveboxs ">
  70. <view class="base-color-3">答题红包数</view>
  71. <view class="base-color fs24">
  72. <text class="fs32 bold">{{answerlist.answerRedPacketTime}}</text>次
  73. </view>
  74. </view>
  75. </view>
  76. </u-collapse-item>
  77. </u-collapse>
  78. <view class="justify-start align-center base-bg-f8 mlr30 radius12 plr20 ptb20">
  79. <u-image :src="imgPath+'/app/manergevip/book.png'" width="30" height="30"></u-image>
  80. <view class="ml20">
  81. <view class="base-color-3">答题红包金额</view>
  82. <view class="base-color fs24"><text class="fs32 bold mr4">
  83. {{answerlist.answerRedPacketAmount==0?'00.00':answerlist.answerRedPacketAmount}}</text>元</view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="justify-center botfun">
  88. <view class="justify-start align-center bottom-btns" style="border: 2rpx solid #ee0a25;"
  89. @click="disableUser" :class="this.detailUser.status!==1?'bgf':'base-bg-red'">
  90. <u-icon name="close-circle" :color="this.detailUser.status!==1?'#ee0a25':'#fff'" size="22" ></u-icon>
  91. <view class=" ml12" :class="this.detailUser.status!==1?'base-color-red':'colorf'">{{answerText}}</view>
  92. </view>
  93. <!-- <view class="justify-start align-center bottom-btns" style="border: 2rpx solid #1677ff;">
  94. <u-icon name="pushpin" color="#1677ff" size="22"></u-icon>
  95. <view class="base-color">会员分组</view>
  96. </view>
  97. <view class="justify-start align-center base-bg bottom-btns">
  98. <u-icon name="rmb-circle" color="#fff" size="22"></u-icon>
  99. <view class="colorf">新会员奖励</view>
  100. </view> -->
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import {
  106. getanswerlist,
  107. Addblacklist,
  108. removebalcklist
  109. } from "@/api/courseManage.js";
  110. export default {
  111. data() {
  112. return {
  113. typeOption: [{
  114. label: '全部',
  115. value: 0
  116. }, {
  117. label: '今天',
  118. value: 1
  119. }, {
  120. label: '昨天',
  121. value: 2
  122. }, {
  123. label: '前天',
  124. value: 3
  125. }, {
  126. label: '近七天',
  127. value: 4
  128. }],
  129. tabindex: 0,
  130. collapseValue: ['course', 'questions', 'redenvelope'],
  131. detailUser: [],
  132. user: [],
  133. answerlist:[],
  134. answerText:'禁用',
  135. userId:[],
  136. id:'',
  137. dateTag:'',
  138. userCompanyId:''
  139. }
  140. },
  141. computed: {
  142. imgPath() {
  143. return this.$store.state.imgpath
  144. },
  145. imgname() {
  146. return this.$store.state.logoname
  147. }
  148. },
  149. onShow() {
  150. this.getAnswerlists()
  151. this.detailUser =uni.getStorageSync('detailUser')
  152. if(this.detailUser.status!==1){
  153. this.answerText='取消禁用'
  154. }
  155. },
  156. mounted() {
  157. },
  158. onLoad(option) {
  159. this.id=option.id
  160. this.userCompanyId=option.userCompanyId
  161. },
  162. methods: {
  163. toactdetail(){
  164. console.log(11)
  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. userCompanyId:this.userCompanyId
  187. }
  188. getanswerlist(params).then(res => {
  189. if (res.code == 200) {
  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.userCompanyId
  214. const params={
  215. userCompanyUserIds : 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.userCompanyId
  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>