userDataDetail.vue 14 KB

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