userDataDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  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="imgPath+'/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="imgPath+'/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. computed: {
  187. imgPath() {
  188. return this.$store.state.imgpath
  189. }
  190. },
  191. mounted() {
  192. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  193. this.getuserList()
  194. this.getuserbalancelist()
  195. },
  196. methods: {
  197. pullDownRefreshs() {
  198. // 下拉
  199. this.triggereds = true; //下拉了状态为true
  200. setTimeout(() => {
  201. this.triggereds = false;
  202. uni.stopPullDownRefresh()
  203. this.pageNums = 1;
  204. this.getCourseListsmall('refresh') //触底 不穿执行else
  205. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  206. // 请求接口
  207. }, 1000)
  208. },
  209. reachBottoms() {
  210. // status这个是加载状态
  211. console.log(111);
  212. if (this.statusA === 'loadmore') {
  213. this.statusA = 'loading'
  214. uni.showNavigationBarLoading()
  215. setTimeout(() => {
  216. this.pageNums++
  217. this.getCourseListsmall() //触底 不穿执行else
  218. uni.hideNavigationBarLoading()
  219. }, 1000);
  220. }
  221. },
  222. getCourseOne(id) {
  223. this.courseid = id
  224. },
  225. getCourseTwo(id) {
  226. this.courseids = id
  227. },
  228. getCourseList() {
  229. //获取课程列表
  230. const param = {
  231. companyId: this.user.companyId,
  232. companyUserId: this.user.userId,
  233. type: this.user.userType == '00' ? 0 : 1, // 0:经销商/1:群管
  234. }
  235. getFsCourseList(param).then(res => {
  236. if (res.code == 200) {
  237. this.courseOne = res.data
  238. // console.log(res)
  239. } else {
  240. uni.showToast({
  241. icon: 'none',
  242. title: res.msg
  243. })
  244. }
  245. })
  246. },
  247. getCourseListsmall(type) {
  248. //获取小节目录
  249. const param = {
  250. courseId: this.courseid,
  251. pageNum: this.pageNums,
  252. pageSize: this.pageSizes, //
  253. status: ''
  254. }
  255. getCourseVdieoList(param).then(res => {
  256. if (res.code == 200) {
  257. // refresh 下拉
  258. if (type == 'refresh') {
  259. this.courseTwo = res.data.list
  260. } else {
  261. // 加载更多 当前页和下一页合并
  262. this.courseTwo = [...this.courseTwo, ...res.data.list]
  263. }
  264. if (this.pageNums >= res.data.pages) {
  265. this.statusA = 'nomore'
  266. } else {
  267. this.statusA = 'loadmore'
  268. }
  269. } else {
  270. }
  271. })
  272. },
  273. selredbag(item) {
  274. this.redid =item.id
  275. this.redprice=item.redPacketMoney
  276. },
  277. selredgroup(id) {
  278. this.groupid = id
  279. },
  280. getredlist() {
  281. //获取红包价格表
  282. const params = {
  283. companyId: this.user.companyId
  284. }
  285. getredPrice(params).then(res => {
  286. if (res.code == 200) {
  287. this.redlist = res.data
  288. } else {
  289. uni.showToast({
  290. icon: 'none',
  291. title: res.msg
  292. })
  293. }
  294. })
  295. },
  296. getgrouplist() {
  297. //获取群管列表
  298. const params = {
  299. companyId: this.user.companyId
  300. }
  301. getgroupList(params).then(res => {
  302. if (res.code == 200) {
  303. this.grouplist = res.data
  304. } else {
  305. uni.showToast({
  306. icon: 'none',
  307. title: res.msg
  308. })
  309. }
  310. })
  311. },
  312. getuserbalancelist() {
  313. const params = {
  314. companyId: this.user.companyId,
  315. endTime: this.endTime,
  316. startTime: this.startTime,
  317. }
  318. getuserbalance(params).then(res => {
  319. if (res.code == 200) {
  320. this.balanceuserDay = res.data
  321. } else {
  322. uni.showToast({
  323. icon: 'none',
  324. title: res.msg
  325. })
  326. }
  327. })
  328. },
  329. pullDownRefresh() {
  330. // 下拉
  331. this.triggered = true; //下拉了状态为true
  332. setTimeout(() => {
  333. this.triggered = false;
  334. uni.stopPullDownRefresh()
  335. this.pageNum = 1;
  336. this.getuserList('refresh') //触底 不穿执行else
  337. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  338. // 请求接口
  339. }, 1000)
  340. },
  341. reachBottom() {
  342. // status这个是加载状态
  343. console.log(111);
  344. if (this.status === 'loadmore') {
  345. this.status = 'loading'
  346. uni.showNavigationBarLoading()
  347. setTimeout(() => {
  348. this.pageNum++
  349. this.getuserList() //触底 不穿执行else
  350. uni.hideNavigationBarLoading()
  351. }, 1000);
  352. }
  353. },
  354. getuserList(type) {
  355. const params = {
  356. companyId: this.user.companyId,
  357. companyUserId:this.groupid,
  358. redPacketId:this.redprice,
  359. courseId:this.courseid,
  360. videoId:this.courseids,
  361. endTime: this.endTime,
  362. startTime: this.startTime,
  363. }
  364. getCourseRedPacklist(params).then(res => {
  365. if (res.code == 200) {
  366. console.log(res)
  367. // refresh 下拉
  368. if (type == 'refresh') {
  369. this.userlist = res.data.list
  370. } else {
  371. // 加载更多 当前页和下一页合并
  372. this.userlist = [...this.userlist, ...res.data.list]
  373. }
  374. if (this.pageNum >= res.data.pages) {
  375. this.status = 'nomore'
  376. } else {
  377. this.status = 'loadmore'
  378. }
  379. } else {
  380. uni.showToast({
  381. icon: 'none',
  382. title: res.msg
  383. })
  384. }
  385. })
  386. },
  387. clickTab(item) {
  388. // console.log('item', item);
  389. },
  390. handleType(type) {
  391. console.log(type);
  392. this.queryParam.type = type
  393. this.userlist = []
  394. if (this.queryParam.type == 0) {
  395. this.endTime = ''
  396. this.startTime = ''
  397. this.getuserbalancelist()
  398. this.getuserList()
  399. } else if (this.queryParam.type == 1) {
  400. this.startTime = this.todayday + ' 00:00:00'
  401. this.endTime = this.todayday + ' 23:59:59'
  402. this.getuserbalancelist()
  403. this.getuserList()
  404. } else if (this.queryParam.type == 2) {
  405. let yesterday = new Date();
  406. yesterday.setDate(yesterday.getDate() - 1);
  407. this.startTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd') + ' 00:00:00'
  408. this.endTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd') + ' 23:59:59'
  409. this.getuserbalancelist()
  410. this.getuserList()
  411. console.log(this.userlist)
  412. } else if (this.queryParam.type == 3) {
  413. let yesterday = new Date();
  414. yesterday.setDate(yesterday.getDate() - 6);
  415. this.startTime = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd') + ' 00:00:00'
  416. this.endTime = this.todayday + ' 23:59:59'
  417. this.getuserbalancelist()
  418. this.getuserList()
  419. } else {
  420. let today = new Date();
  421. let lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
  422. this.startTime = uni.$u.timeFormat(this.todayday, 'yyyy-mm') + '-01' + " 00:00:00"
  423. this.endTime = uni.$u.timeFormat(lastDayOfMonth, 'yyyy-mm-dd') + " 23:59:59"
  424. this.getuserbalancelist()
  425. this.getuserList()
  426. }
  427. },
  428. onChange(index) {
  429. this.searchbarNav = index
  430. this.courseTwo=[]
  431. if (index == 0) {
  432. console.log(11)
  433. this.getredlist()
  434. } else if (index == 1) {
  435. this.getgrouplist()
  436. } else if (index == 2) {
  437. this.getCourseList()
  438. } else {
  439. if(this.courseid==''){
  440. uni.showToast({
  441. icon: 'none',
  442. title: '请先选择训练营-营期'
  443. })
  444. }else{
  445. this.getCourseListsmall()
  446. }
  447. }
  448. },
  449. confirm() {
  450. this.userlist=[]
  451. this.getuserList()
  452. },
  453. reset() {
  454. if(this.searchbarNav==0){
  455. this.redprice=''
  456. this.getuserList()
  457. }else if(this.searchbarNav==1){
  458. this.groupid=''
  459. this.getuserList()
  460. }else if(this.searchbarNav==1){
  461. this.courseid=''
  462. this.getuserList()
  463. }else{
  464. this.courseids=''
  465. this.getuserList()
  466. }
  467. console.log(this.searchbarNav)
  468. }
  469. }
  470. }
  471. </script>
  472. <style lang="scss" scoped>
  473. .warpbox {
  474. width: fit-content;
  475. }
  476. .activebag {
  477. border: 2rpx solid #1773ff;
  478. background-color: #e7f2fe;
  479. color: #1677ff;
  480. }
  481. .searchbox {
  482. background-color: #fff;
  483. border-radius: 8rpx 8rpx 0 0;
  484. padding: 15px;
  485. &-item {
  486. height: 23px;
  487. line-height: 23px;
  488. width: fit-content;
  489. padding: 0 20rpx;
  490. background: #f5f5f5;
  491. text-align: center;
  492. border-radius: 5px;
  493. font-family: PingFang SC, PingFang SC;
  494. font-weight: 400;
  495. font-size: 12px;
  496. color: #888;
  497. }
  498. }
  499. .active {
  500. color: #fff !important;
  501. background-color: #1677ff !important;
  502. }
  503. :deep .navs .c-flex-center text {
  504. width: max-content;
  505. }
  506. .actNav {
  507. color: #1677ff !important;
  508. background-color: #e7f2fe;
  509. }
  510. </style>