ManageDetail.vue 8.5 KB

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