userDataDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <view class="column flex-1 hb">
  3. <view class="justify-between align-center plr32 m20 base-bg
  4. colorf ptb48 radius20">
  5. <view>账户可用余额</view>
  6. <view class="bold fs40">{{balanceuserDay.balance}}</view>
  7. </view>
  8. <view class="bgf">
  9. <view class="centerV">
  10. <u-tabs :list="list1" @click="clickTab" lineColor='#1773ff' lineWidth='40'
  11. activeStyle="font-weight:bold"></u-tabs>
  12. </view>
  13. <view class="justify-around ptb20">
  14. <view :class="queryParam.type == index ? 'searchbox-item active':'searchbox-item'"
  15. v-for="(item,index) in typeOption" :key="index" @click="handleType(index)">{{item.label}}</view>
  16. </view>
  17. </view>
  18. <view style="z-index: 999;">
  19. <dropdownPanel :filterData='filterData' @onChange="onChange" @confirm="confirm" @reset="reset">
  20. <view v-if="searchbarNav == 0" class="justify-start wrap p20 ">
  21. <view class="warpbox ptb8 plr16 m10 radius12 base-bg-f8 base-color-6"
  22. :class="redid==item.id?'activebag':''" @click="selredbag(item)"
  23. v-for="(item,index) in redlist" :key="item.id">{{item.redPacketMoney}}</view>
  24. </view>
  25. <view v-if="searchbarNav == 1" class="justify-start wrap p20 ">
  26. <view class="warpbox ptb8 plr16 m10 radius12 base-bg-f8 base-color-6"
  27. :class="groupid==item.userId?'activebag':''" @click="selredgroup(item.userId)"
  28. v-for="(item,index) in grouplist" :key="item.userId">
  29. {{item.nickName}}
  30. </view>
  31. </view>
  32. <view v-if="searchbarNav == 2">
  33. <view class="p20 fs28 column flex-1 scrolly">
  34. <view v-for="(item,index) in courseOne" :key="item.index"
  35. :class="courseid==item.courseId?'actNav':''" class="m10 p10 center"
  36. style="border-bottom: 2rpx solid #eee;" @click="getCourseOne(item.courseId)">
  37. {{item.courseName}}
  38. </view>
  39. </view>
  40. </view>
  41. <view class="p20 fs28 column flex-1 hidden h100" v-if="searchbarNav == 3">
  42. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
  43. :refresher-triggered="triggereds" refresher-background="rgba(0,0,0,0)"
  44. @refresherrefresh="pullDownRefreshs" @refresherrestore="triggereds = false" :upper-threshold="100"
  45. :lower-threshold="100" @refresherabort="triggereds = false" @scrolltolower="reachBottoms">
  46. <view v-for="(item,index) in courseTwo" :key="item.index"
  47. :class="courseids==item.videoId?'actNav':''" class="m10 p10 center"
  48. style="border-bottom: 2rpx solid #eee;" @click="getCourseTwo(item.videoId)">
  49. {{item.title}}
  50. </view>
  51. <u-loadmore :status="statusA" />
  52. <view class="ptb40"></view>
  53. </scroll-view>
  54. </view>
  55. </dropdownPanel>
  56. </view>
  57. <view class="m20 plr32 ptb40 justify-between align-center base-bg-sure radius20"
  58. style="border: 2rpx solid #1773ff;">
  59. <view class="bold">发放金额</view>
  60. <view class="bold fs40">{{balanceuserDay.todayMoney}}</view>
  61. </view>
  62. <view class="column flex-1 scrolly">
  63. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabled" :refresher-triggered="triggered"
  64. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefresh"
  65. @refresherrestore="triggered = false" :upper-threshold="100" :lower-threshold="100"
  66. @refresherabort="triggered = false" @scrolltolower="reachBottom">
  67. <view class="bgf m20 p20 radius16" v-for="(item,index) in userlist" :key="index">
  68. <view class="justify-between align-center">
  69. <view class="justify-start align-center">
  70. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/manergevip/book.png" class="w80 h80"></image>
  71. <view class="fs36 bold ml20">课程答题红包</view>
  72. <view class="fs28 ml8 base-color-6">归属</view>
  73. </view>
  74. <view class="base-color fs40 bold">{{item.amount}}</view>
  75. </view>
  76. <view class="justify-start mtb20">
  77. <u-avatar :src="item.avatar" size="50"></u-avatar>
  78. <view class="ml20">
  79. <view class="justify-start align-center">
  80. <text class="fs28 bold">{{item.nickName}}</text>
  81. <image class="w40 h40" src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/copy_icon.png" mode="aspectFill">
  82. </view>
  83. <view class="fs24 base-color-6">
  84. <text>--</text>
  85. <text class="ml20">{{item.fsUserCreatTime}} 注册</text>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="base-bg-f8 radius16 p20">
  90. <view class="justify-start fs28 mb8">
  91. <view class="base-color-6 mr20">观看课程</view>
  92. <view>{{item.courseName}}</view>
  93. </view>
  94. <view class="justify-start fs28">
  95. <view class="base-color-6 mr20">领取时间</view>
  96. <view>{{item.createTime}}</view>
  97. </view>
  98. </view>
  99. </view>
  100. <u-loadmore :status="status" />
  101. </scroll-view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import {
  107. getCourseRedPacklist,
  108. getuserbalance,
  109. getredPrice,
  110. getgroupList,
  111. getFsCourseList,
  112. getCourseVdieoList
  113. } from "@/api/courseManage.js"
  114. import dropdownPanel from "@/components/dropdownPanel.vue"
  115. export default {
  116. components: {
  117. dropdownPanel
  118. },
  119. data() {
  120. return {
  121. list1: [{
  122. name: '发放记录'
  123. }],
  124. typeOption: [{
  125. label: '全部',
  126. value: 0
  127. }, {
  128. label: '今日',
  129. value: 1
  130. }, {
  131. label: '昨日',
  132. value: 2
  133. }, {
  134. label: '近七天',
  135. value: 3
  136. }, {
  137. label: '本月',
  138. value: 4
  139. }],
  140. queryParam: {
  141. type: 0
  142. },
  143. filterData: [{
  144. name: '答题红包',
  145. value: 0,
  146. },
  147. {
  148. name: '群管',
  149. value: 1,
  150. }, {
  151. name: '训练营-营期',
  152. value: 2,
  153. }, {
  154. name: '课程',
  155. value: 3,
  156. }
  157. ],
  158. searchbarNav: 0,
  159. userlist: [],
  160. triggered: false,
  161. status: 'loadmore',
  162. isEnabled: true,
  163. pageNum: 1,
  164. pageSize: 5,
  165. startTime: '',
  166. endTime: '',
  167. todayday: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  168. balanceuserDay: [],
  169. user: [],
  170. redlist: [],
  171. redid: '',
  172. groupid: '',
  173. grouplist: [],
  174. courseid: '',
  175. courseids: '',
  176. courseOne: [],
  177. courseTwo: [],
  178. triggereds: false,
  179. statusA: 'loadmore',
  180. isEnableds: true,
  181. pageNums: 1,
  182. pageSizes: 5,
  183. redprice:''
  184. }
  185. },
  186. mounted() {
  187. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  188. this.getuserList()
  189. this.getuserbalancelist()
  190. },
  191. methods: {
  192. pullDownRefreshs() {
  193. // 下拉
  194. this.triggereds = true; //下拉了状态为true
  195. setTimeout(() => {
  196. this.triggereds = false;
  197. uni.stopPullDownRefresh()
  198. this.pageNums = 1;
  199. this.getCourseListsmall('refresh') //触底 不穿执行else
  200. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  201. // 请求接口
  202. }, 1000)
  203. },
  204. reachBottoms() {
  205. // status这个是加载状态
  206. console.log(111);
  207. if (this.statusA === 'loadmore') {
  208. this.statusA = 'loading'
  209. uni.showNavigationBarLoading()
  210. setTimeout(() => {
  211. this.pageNums++
  212. this.getCourseListsmall() //触底 不穿执行else
  213. uni.hideNavigationBarLoading()
  214. }, 1000);
  215. }
  216. },
  217. getCourseOne(id) {
  218. this.courseid = id
  219. },
  220. getCourseTwo(id) {
  221. this.courseids = id
  222. },
  223. getCourseList() {
  224. //获取课程列表
  225. const param = {
  226. companyId: this.user.companyId,
  227. companyUserId: this.user.userId,
  228. type: this.user.userType == '00' ? 0 : 1, // 0:经销商/1:群管
  229. }
  230. getFsCourseList(param).then(res => {
  231. if (res.code == 200) {
  232. this.courseOne = res.data
  233. // console.log(res)
  234. } else {
  235. uni.showToast({
  236. icon: 'none',
  237. title: res.msg
  238. })
  239. }
  240. })
  241. },
  242. getCourseListsmall(type) {
  243. //获取小节目录
  244. const param = {
  245. courseId: this.courseid,
  246. pageNum: this.pageNums,
  247. pageSize: this.pageSizes, //
  248. status: ''
  249. }
  250. getCourseVdieoList(param).then(res => {
  251. if (res.code == 200) {
  252. // refresh 下拉
  253. if (type == 'refresh') {
  254. this.courseTwo = res.data.list
  255. } else {
  256. // 加载更多 当前页和下一页合并
  257. this.courseTwo = [...this.courseTwo, ...res.data.list]
  258. }
  259. if (this.pageNums >= res.data.pages) {
  260. this.statusA = 'nomore'
  261. } else {
  262. this.statusA = 'loadmore'
  263. }
  264. } else {
  265. }
  266. })
  267. },
  268. selredbag(item) {
  269. this.redid =item.id
  270. this.redprice=item.redPacketMoney
  271. },
  272. selredgroup(id) {
  273. this.groupid = id
  274. },
  275. getredlist() {
  276. //获取红包价格表
  277. const params = {
  278. companyId: this.user.companyId
  279. }
  280. getredPrice(params).then(res => {
  281. if (res.code == 200) {
  282. this.redlist = res.data
  283. } else {
  284. uni.showToast({
  285. icon: 'none',
  286. title: res.msg
  287. })
  288. }
  289. })
  290. },
  291. getgrouplist() {
  292. //获取群管列表
  293. const params = {
  294. companyId: this.user.companyId
  295. }
  296. getgroupList(params).then(res => {
  297. if (res.code == 200) {
  298. this.grouplist = res.data
  299. } else {
  300. uni.showToast({
  301. icon: 'none',
  302. title: res.msg
  303. })
  304. }
  305. })
  306. },
  307. getuserbalancelist() {
  308. const params = {
  309. companyId: this.user.companyId,
  310. endTime: this.endTime,
  311. startTime: this.startTime,
  312. }
  313. getuserbalance(params).then(res => {
  314. if (res.code == 200) {
  315. this.balanceuserDay = res.data
  316. } else {
  317. uni.showToast({
  318. icon: 'none',
  319. title: res.msg
  320. })
  321. }
  322. })
  323. },
  324. pullDownRefresh() {
  325. // 下拉
  326. this.triggered = true; //下拉了状态为true
  327. setTimeout(() => {
  328. this.triggered = false;
  329. uni.stopPullDownRefresh()
  330. this.pageNum = 1;
  331. this.getuserList('refresh') //触底 不穿执行else
  332. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  333. // 请求接口
  334. }, 1000)
  335. },
  336. reachBottom() {
  337. // status这个是加载状态
  338. console.log(111);
  339. if (this.status === 'loadmore') {
  340. this.status = 'loading'
  341. uni.showNavigationBarLoading()
  342. setTimeout(() => {
  343. this.pageNum++
  344. this.getuserList() //触底 不穿执行else
  345. uni.hideNavigationBarLoading()
  346. }, 1000);
  347. }
  348. },
  349. getuserList(type) {
  350. const params = {
  351. companyId: this.user.companyId,
  352. companyUserId:this.groupid,
  353. redPacketId:this.redprice,
  354. courseId:this.courseid,
  355. videoId:this.courseids,
  356. endTime: this.endTime,
  357. startTime: this.startTime,
  358. }
  359. getCourseRedPacklist(params).then(res => {
  360. if (res.code == 200) {
  361. console.log(res)
  362. // refresh 下拉
  363. if (type == 'refresh') {
  364. this.userlist = res.data.list
  365. } else {
  366. // 加载更多 当前页和下一页合并
  367. this.userlist = [...this.userlist, ...res.data.list]
  368. }
  369. if (this.pageNum >= res.data.pages) {
  370. this.status = 'nomore'
  371. } else {
  372. this.status = 'loadmore'
  373. }
  374. } else {
  375. uni.showToast({
  376. icon: 'none',
  377. title: res.msg
  378. })
  379. }
  380. })
  381. },
  382. clickTab(item) {
  383. // console.log('item', item);
  384. },
  385. handleType(type) {
  386. console.log(type);
  387. this.queryParam.type = type
  388. this.userlist = []
  389. if (this.queryParam.type == 0) {
  390. this.endTime = ''
  391. this.startTime = ''
  392. this.getuserbalancelist()
  393. this.getuserList()
  394. } else if (this.queryParam.type == 1) {
  395. this.startTime = this.todayday + ' 00:00:00'
  396. this.endTime = this.todayday + ' 23:59:59'
  397. this.getuserbalancelist()
  398. this.getuserList()
  399. } else if (this.queryParam.type == 2) {
  400. let yesterday = new Date();
  401. yesterday.setDate(yesterday.getDate() - 1);
  402. this.startTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd') + ' 00:00:00'
  403. this.endTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd') + ' 23:59:59'
  404. this.getuserbalancelist()
  405. this.getuserList()
  406. console.log(this.userlist)
  407. } else if (this.queryParam.type == 3) {
  408. let yesterday = new Date();
  409. yesterday.setDate(yesterday.getDate() - 6);
  410. this.startTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd') + ' 00:00:00'
  411. this.endTime = this.todayday + ' 23:59:59'
  412. this.getuserbalancelist()
  413. this.getuserList()
  414. } else {
  415. let today = new Date();
  416. let lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
  417. this.startTime = uni.$u.timeFormat(this.todayday, 'yyyy-mm') + '-01' + " 00:00:00"
  418. this.endTime = uni.$u.timeFormat(lastDayOfMonth, 'yyyy-mm-dd') + " 23:59:59"
  419. this.getuserbalancelist()
  420. this.getuserList()
  421. }
  422. },
  423. onChange(index) {
  424. this.searchbarNav = index
  425. this.courseTwo=[]
  426. if (index == 0) {
  427. console.log(11)
  428. this.getredlist()
  429. } else if (index == 1) {
  430. this.getgrouplist()
  431. } else if (index == 2) {
  432. this.getCourseList()
  433. } else {
  434. if(this.courseid==''){
  435. uni.showToast({
  436. icon: 'none',
  437. title: '请先选择训练营-营期'
  438. })
  439. }else{
  440. this.getCourseListsmall()
  441. }
  442. }
  443. },
  444. confirm() {
  445. this.userlist=[]
  446. this.getuserList()
  447. },
  448. reset() {
  449. if(this.searchbarNav==0){
  450. this.redprice=''
  451. this.getuserList()
  452. }else if(this.searchbarNav==1){
  453. this.groupid=''
  454. this.getuserList()
  455. }else if(this.searchbarNav==1){
  456. this.courseid=''
  457. this.getuserList()
  458. }else{
  459. this.courseids=''
  460. this.getuserList()
  461. }
  462. console.log(this.searchbarNav)
  463. }
  464. }
  465. }
  466. </script>
  467. <style lang="scss" scoped>
  468. .warpbox {
  469. width: fit-content;
  470. }
  471. .activebag {
  472. border: 2rpx solid #1773ff;
  473. background-color: #e7f2fe;
  474. color: #1677ff;
  475. }
  476. .searchbox {
  477. background-color: #fff;
  478. border-radius: 8rpx 8rpx 0 0;
  479. padding: 15px;
  480. &-item {
  481. height: 23px;
  482. line-height: 23px;
  483. width: fit-content;
  484. padding: 0 20rpx;
  485. background: #f5f5f5;
  486. text-align: center;
  487. border-radius: 5px;
  488. font-family: PingFang SC, PingFang SC;
  489. font-weight: 400;
  490. font-size: 12px;
  491. color: #888;
  492. }
  493. }
  494. .active {
  495. color: #fff !important;
  496. background-color: #1677ff !important;
  497. }
  498. :deep .navs .c-flex-center text {
  499. width: max-content;
  500. }
  501. .actNav {
  502. color: #1677ff !important;
  503. background-color: #e7f2fe;
  504. }
  505. </style>