index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <view class="column flex-1 hb">
  3. <view class="header-box ptb32 pl20">
  4. <view class="justify-between align-center">
  5. <view class="justify-start">
  6. <u-avatar :src="user.avatar" size="50"></u-avatar>
  7. <view class="column colorf ml16">
  8. <text>{{user.userName}}</text>
  9. <text class="mt20 fs24">ID:{{user.companyId}}</text>
  10. </view>
  11. </view>
  12. <view class="column justify-between mr4 ">
  13. <!-- <view class="box-btn base-color" @click="exportlist">导出列表</view> -->
  14. <view class="box-btn base-color" @click="lableSetup">标签设置</view>
  15. </view>
  16. </view>
  17. <view class="base-bg-f8 mr4 radius20 p32 mt32 justify-start pb32">
  18. <view class="flex-1 pb20" @click="userdataDetail">
  19. <view class="bold">账户可用余额</view>
  20. <view class="bold fs48 base-color">{{balanceuserDay.balance}}</view>
  21. </view>
  22. <view class="flex-1 pb20 pl40" style="border-left:4rpx solid #0cb2ff;" @click="showday=!showday">
  23. <view class="bold"><text class="base-color">
  24. {{PickerName}}</text>已发金额</view>
  25. <view class="bold fs48 base-color">{{balanceuserDay.todayMoney}}</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="bgf centerV" style="border-radius: 10rpx 10rpx 0 0; margin-top: -8rpx;">
  30. <u-tabs :list="list1" @click="clickTab" lineColor='#1773ff' lineWidth='40'
  31. activeStyle="font-weight:bold"></u-tabs>
  32. </view>
  33. <view class="column flex-1 scrolly">
  34. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabled" :refresher-triggered="triggered"
  35. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefresh"
  36. @refresherrestore="triggered = false" :upper-threshold="100" :lower-threshold="100"
  37. @refresherabort="triggered = false" @scrolltolower="reachBottom">
  38. <view class="mtb20 ml20 mr8 p20 bgf radius20" v-for="(item,index) in redpacklist" :key="index"
  39. @click="managedetail(item.userId,item)">
  40. <view class="justify-start align-center">
  41. <u-avatar :src="item.avatar" size="50"></u-avatar>
  42. <view class="ml20" @click.passive.stop>
  43. <view class="justify-start align-center">
  44. <text class="fs28 bold">{{item.nickName}}</text>
  45. <image class="w40 h40" src="@/static/images/copy_icon.png"
  46. @click="copyId(item.userId)" mode="aspectFill">
  47. </view>
  48. <view class="fs24 base-color-6">id:{{item.userId}}</view>
  49. </view>
  50. </view>
  51. <view class="justify-around mt32">
  52. <view class="column align-center">
  53. <view class="fs24 base-color-3">今日观看人数</view>
  54. <view class="base-color fs28">
  55. <text class="bold fs40 base-color">{{item.count}}</text>人
  56. </view>
  57. </view>
  58. <view class="column align-center">
  59. <view class="fs24 base-color-3">今日完播人数</view>
  60. <view class="base-color fs28">
  61. <text class="bold fs40 base-color">{{item.completeCount}}</text>人
  62. </view>
  63. </view>
  64. <view class="column align-center">
  65. <view class="fs24 base-color-3">今日完播率</view>
  66. <view class="base-color fs28">
  67. <text class="bold fs40 base-color">{{item.rate.toFixed(2)}}</text>%
  68. </view>
  69. </view>
  70. <view class="column align-center">
  71. <view class="fs24 base-color-3">今日红包金额</view>
  72. <view class="base-color fs28">
  73. <text class="bold fs40 base-color">{{item.amount}}</text>元
  74. </view>
  75. </view>
  76. </view>
  77. <view class="base-bg-f8 pl20">-</view>
  78. <view class="justify-between fs24 mt20 align-center" @click.passive.stop>
  79. <view >
  80. <text @click="showmoreA(item)">更多</text></view>
  81. <view @click.passive.stop>
  82. <view class="ptb16 plr32 base-bg-false radius50 base-color-red fs28 bold"
  83. @click="changevipDetail(item.userId)">更换会员归属</view>
  84. </view>
  85. </view>
  86. </view>
  87. <u-loadmore :status="status" />
  88. <view class="ptb80"></view>
  89. </scroll-view>
  90. </view>
  91. <!-- <image class="invite-member" src="@/static/images/invite-member-icon.png" mode="aspectFill" @click="vipInvite">
  92. </image> -->
  93. <!-- 不要写在v-for里面 点击存到data里面-->
  94. <view class="">
  95. <u-popup :show="showmore" @close="closemore" @open="openmore" >
  96. <view class="column align-center">
  97. <view class="m20" v-for="(items,index) in morelist"
  98. :key="items.value" @click="nameMore(items)">
  99. {{items.name}}</view>
  100. <u-modal :show="showlist" :title="titlelist" @confirm="confirmchange" >
  101. <view class="slot-content">
  102. <u-input :placeholder="contpl" v-model="changelist" v-if="selnum==1"></u-input>
  103. <u-input :placeholder="contpl" v-model="changephone" v-if="selnum==2"></u-input>
  104. <u-input :placeholder="contpl" v-model="changeremark" v-if="selnum==3"></u-input>
  105. </view>
  106. </u-modal>
  107. </view>
  108. </u-popup>
  109. </view>
  110. <u-picker :show="showday" :columns="columns" keyName="label" style="flex:0;" @cancel="cancel"
  111. @confirm='confirm'></u-picker>
  112. </view>
  113. </template>
  114. <script>
  115. import {
  116. getusergroup,
  117. getuserbalance,
  118. updategroupinfo
  119. } from "@/api/courseManage.js"
  120. export default {
  121. data() {
  122. return {
  123. list1: [{
  124. name: '群管理员(0)',
  125. },
  126. // {
  127. // name: '待审群管(0)'
  128. // }, {
  129. // name: '已拒绝(0)'
  130. // }
  131. ],
  132. user: [],
  133. showmore:false,
  134. showlist:false,
  135. contpl:'',
  136. changelist:'',
  137. changephone:'',
  138. changeremark:'',
  139. titlelist:'',
  140. selnum:0,
  141. showday: false,
  142. columns: [
  143. [{
  144. label: '今日',
  145. id: 1
  146. },
  147. {
  148. label: '昨日',
  149. id: 2
  150. },
  151. {
  152. label: '近七日',
  153. id: 3
  154. },
  155. {
  156. label: '本月',
  157. id: 4
  158. },
  159. ],
  160. ],
  161. redpacklist: [],
  162. triggered: false,
  163. status: 'loadmore',
  164. isEnabled: true,
  165. pageNum: 1,
  166. pageSize: 5,
  167. startTime: '',
  168. endTime: '',
  169. balanceuserDay: [],
  170. pickered: '',
  171. todayday: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  172. PickerName: "今日",
  173. morelist:[
  174. {
  175. name:'复制ID',
  176. value:0,
  177. text:''
  178. },
  179. {
  180. name:'改姓名',
  181. value:1,
  182. text:'请输入姓名'
  183. },
  184. {
  185. name:'改手机号码',
  186. value:2,
  187. text:'请输入手机号码'
  188. },
  189. {
  190. name:'改备注',
  191. value:3,
  192. text:'请输入备注'
  193. }
  194. ],
  195. openData:{}
  196. }
  197. },
  198. mounted() {
  199. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  200. this.getredlist()
  201. this.getuserbalancelist()
  202. },
  203. methods: {
  204. showmoreA(data){
  205. this.openData=data
  206. this.groupid=data.userId,
  207. this.showmore=!this.showmore
  208. },
  209. closemore(){
  210. this.showmore=false
  211. },
  212. openmore(){
  213. },
  214. updatagroup(){
  215. console.log( Number(this.groupid))
  216. const param={
  217. nickName:this.changelist,
  218. phonenumber:this.changephone,
  219. remark:this.changeremark,
  220. userId: this.groupid
  221. }
  222. updategroupinfo(param).then(res=>{
  223. if(res.code==200){
  224. uni.showToast({
  225. icon: 'none',
  226. title: "修改成功"
  227. })
  228. }else{
  229. uni.showToast({
  230. icon: 'none',
  231. title: res.msg
  232. })
  233. }
  234. })
  235. },
  236. nameMore(item){
  237. console.log(item)
  238. this.titlelist=item.name
  239. this.contpl=item.text
  240. this.selnum=item.value
  241. if(item.value==0){
  242. uni.setClipboardData({
  243. data: String(this.openData.userId),
  244. success: () => {
  245. uni.showToast({
  246. title: '复制成功',
  247. icon: 'none',
  248. duration: 2000
  249. });
  250. },
  251. })
  252. }else if(item.value==1){
  253. this.changelist=this.openData.nickName
  254. this.showlist=true
  255. }else if(item.value==2){
  256. console.log(this.openData.phonenumber)
  257. this.changephone=this.openData.phonenumber
  258. this.showlist=true
  259. }else{
  260. this.changeremark=this.openData.remark
  261. this.showlist=true
  262. }
  263. },
  264. confirmchange(){
  265. this.updatagroup()
  266. this.showlist=false
  267. setTimeout(()=>{
  268. this.showmore=false
  269. this.getredlist()
  270. console.log(this.getredlist())
  271. },200)
  272. },
  273. copyId(id) {
  274. uni.setClipboardData({
  275. data: String(id),
  276. success: () => {
  277. uni.showToast({
  278. title: '复制成功',
  279. icon: 'none',
  280. duration: 2000
  281. });
  282. },
  283. })
  284. },
  285. getuserbalancelist() {
  286. const params = {
  287. companyId: this.user.companyId,
  288. endTime: this.endTime,
  289. startTime: this.startTime,
  290. }
  291. getuserbalance(params).then(res => {
  292. if (res.code == 200) {
  293. this.balanceuserDay = res.data
  294. } else {
  295. uni.showToast({
  296. icon: 'none',
  297. title: res.msg
  298. })
  299. }
  300. })
  301. },
  302. pullDownRefresh() {
  303. // 下拉刷新
  304. this.triggered = true; //下拉了状态为true
  305. setTimeout(() => {
  306. this.triggered = false;
  307. uni.stopPullDownRefresh()
  308. this.pageNum = 1;
  309. this.getredlist('refresh') //触底 不穿执行else
  310. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  311. // 请求接口
  312. }, 1000)
  313. },
  314. reachBottom() {
  315. // status这个是加载状态
  316. console.log(111);
  317. if (this.status === 'loadmore') {
  318. this.status = 'loading'
  319. uni.showNavigationBarLoading()
  320. setTimeout(() => {
  321. this.pageNum++
  322. this.getredlist() //触底 不穿执行else
  323. uni.hideNavigationBarLoading()
  324. }, 1000);
  325. }
  326. },
  327. getredlist(type) {
  328. const params = {
  329. pageNum: this.pageNum,
  330. pageSize: this.pageSize,
  331. }
  332. getusergroup(params).then(res => {
  333. if (res.code == 200) {
  334. console.log(res)
  335. this.list1[0].name = '群管理员(' + res.data.total + ')'
  336. // refresh 下拉
  337. if (type == 'refresh') {
  338. this.redpacklist = res.data.list
  339. } else {
  340. // 加载更多 当前页和下一页合并
  341. this.redpacklist = [...this.redpacklist, ...res.data.list]
  342. }
  343. if (this.pageNum >= res.data.pages) {
  344. this.status = 'nomore'
  345. } else {
  346. this.status = 'loadmore'
  347. }
  348. } else {
  349. uni.showToast({
  350. icon: 'none',
  351. title: res.msg
  352. })
  353. }
  354. })
  355. },
  356. cancel() {
  357. this.showday = !this.showday
  358. },
  359. close() {
  360. this.showday = !this.showday
  361. },
  362. confirm(e) {
  363. this.pickered = e.indexs[0]
  364. this.PickerName = e.value[0].label
  365. if (this.pickered == 0) {
  366. this.startTime = this.todayday
  367. this.endTime = this.todayday
  368. } else if (this.pickered == 1) {
  369. let yesterday = new Date();
  370. yesterday.setDate(yesterday.getDate() - 1);
  371. this.startTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd')
  372. this.endTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd')
  373. } else if (this.pickered == 2) {
  374. let yesterday = new Date();
  375. yesterday.setDate(yesterday.getDate() - 6);
  376. this.startTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd')
  377. this.endTime = uni.$u.timeFormat(this.todayday, 'yyyy-mm-dd')
  378. } else {
  379. let today = new Date();
  380. let lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
  381. this.startTime = uni.$u.timeFormat(this.todayday, 'yyyy-mm') + '-01'
  382. this.endTime = uni.$u.timeFormat(lastDayOfMonth, 'yyyy-mm-dd')
  383. }
  384. this.startTime = this.startTime + ' 00:00:00'
  385. this.endTime = this.endTime + ' 23:59:59'
  386. this.showday = !this.showday
  387. this.getuserbalancelist()
  388. },
  389. clickTab(item) {
  390. // console.log('item', item);
  391. },
  392. exportlist() {
  393. uni.navigateTo({
  394. url: "/pages/courseManage/manage/exprotList"
  395. })
  396. },
  397. lableSetup() {
  398. uni.navigateTo({
  399. url: "/pages/courseManage/manage/lableSetup"
  400. })
  401. },
  402. userdataDetail() {
  403. uni.navigateTo({
  404. url: "/pages/courseManage/manage/userDataDetail"
  405. })
  406. },
  407. managedetail(id,item) {
  408. uni.setStorageSync('grouplist', item)
  409. uni.navigateTo({
  410. url: "/pages/courseManage/manage/manageDetail?id="+id
  411. })
  412. },
  413. changevipDetail(id) {
  414. uni.navigateTo({
  415. url: '/pages/courseManage/manage/changeVip?id='+id
  416. })
  417. }
  418. }
  419. }
  420. </script>
  421. <style lang="scss" scoped>
  422. .header-box {
  423. background: linear-gradient(to right, rgba(66, 144, 240, 1.0), rgba(39, 107, 254, 1));
  424. }
  425. .box-btn {
  426. font-size: 28rpx;
  427. background-color: #f8f8f8;
  428. border-radius: 8rpx;
  429. padding: 4rpx 20rpx;
  430. }
  431. .invite-member {
  432. height: 55px;
  433. width: 50px;
  434. position: fixed;
  435. bottom: 80px;
  436. right: 10px;
  437. cursor: pointer;
  438. }
  439. </style>