manageIndex.vue 13 KB

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