commission-log2.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. <!-- 佣金明细 -->
  2. <template>
  3. <view>
  4. <z-paging ref="paging" refresher-complete-delay="200" v-model="rewardLog" @query="queryList">
  5. <!-- #ifdef H5 -->
  6. <view style="color: #000000;">
  7. <tn-nav-bar backgroundColor="#ffffff" :bottomShadow="false">推广佣金明细</tn-nav-bar>
  8. <view :style="{height: tobheight+'px'}"></view>
  9. </view>
  10. <!-- #endif -->
  11. <!-- <view slot="top" class="z_tabs" :style="{marginTop: tobheight+'px'}"></view> -->
  12. <view class="commission-log-wrap">
  13. <!-- 钱包卡片 -->
  14. <view class="wallet-wrap">
  15. <view class="wallet-card">
  16. <view class="head-box u-flex">
  17. <view class="head-title">累计收入</view>
  18. <button class="u-reset-button look-btn" @tap="showMoney = !showMoney">
  19. <!-- <view class="u-iconfont" :class="showMoney ? 'uicon-eye-fill' : 'uicon-eye-off'" style="color: #fff;font-size: 50rpx;"></view> -->
  20. <u-icon :name="showMoney ? 'eye-fill':'eye-off'" color="#fff" size="22"></u-icon>
  21. </button>
  22. </view>
  23. <view class="card-num">{{ showMoney ? Number(recommendSum.total_income).toFixed(2) : '***' }}
  24. </view>
  25. <view class="card-bottom u-flex u-row-left">
  26. <view class="card-item u-flex-1">
  27. <view class="item-title">待入账佣金</view>
  28. <view class="item-value">
  29. {{ showMoney ? Number(recommendSum.wait_income).toFixed(2) : '***' }}
  30. </view>
  31. </view>
  32. <view class="card-item u-flex-1">
  33. <view class="item-title">可提现佣金</view>
  34. <view class="item-value">
  35. {{ showMoney ?Number(recommendSum.cashing).toFixed(2) : '***' }}
  36. </view>
  37. </view>
  38. <!-- <view class="card-item u-flex-1">
  39. <view class="item-title">待入账佣金</view>
  40. <view class="item-value">{{ showMoney ? on_cashout_money || '0.00' : '***' }}</view>
  41. </view> -->
  42. <view class="card-item u-flex-1">
  43. <view class="item-title">已提现佣金</view>
  44. <view class="item-value">
  45. {{ showMoney ? Number(recommendSum.cashed).toFixed(2) : '***' }}
  46. </view>
  47. </view>
  48. </view>
  49. <button class="u-reset-button draw-btn"
  50. @tap="jump('/pages/user/commission/withdraw',{type:2})">提现</button>
  51. <view class="cashTips">
  52. 注:可提现佣金/已提现佣金包含了任务佣金和推广佣金
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 筛选 -->
  57. <view class="item-box">
  58. <!-- 佣金明细列表 -->
  59. <view class="log-item u-flex u-row-between" v-for="item in commissionList" :key="item.id">
  60. <view class="item-left u-flex">
  61. <view class="">
  62. <view class="log-name">{{ item.title }}</view>
  63. <view class="log-notice">{{ item.created_at }}</view>
  64. <view class="nextUser" v-if="item.source_user">
  65. <image class="nextAvatar"
  66. :src="item.source_user.avatar!=''?item.source_user.avatar:'/static/images/head.jpg'"
  67. mode=""></image>
  68. <view class="nextUserName">
  69. {{item.source_user.nickname }}
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="item-right">
  75. <!-- <view class="log-num" :style="{ color: item.type?'#05C3A1' :'red'}">
  76. {{(item.type?'+':'-')+ item.money }}
  77. </view> -->
  78. <view class="log-num" :style="{ color: item.type==3? 'red':'#05C3A1'}">
  79. {{(item.type==3? '-':'+')+item.amount}}
  80. </view>
  81. <view class="log-date"></view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </z-paging>
  87. <wike-loading-page :isLoading="isLoading"></wike-loading-page>
  88. </view>
  89. </template>
  90. <script>
  91. import {
  92. mapMutations,
  93. mapActions,
  94. mapState,
  95. mapGetters
  96. } from 'vuex';
  97. import {
  98. recommendList,
  99. recommendCount
  100. } from '@/api/my/index.js'
  101. export default {
  102. data() {
  103. return {
  104. // isLoading: true,
  105. isLoading: false,
  106. tobheight: 45,
  107. platform: this.$platform.get(),
  108. stateCurrent: 'all', //默认
  109. stateMap: {
  110. all: '全部收入',
  111. waiting: '待入账',
  112. accounted: '已入账',
  113. back: '已退回',
  114. cancel: '已取消'
  115. },
  116. classType: {
  117. '-1': '#EB2B3D',
  118. '0': '#05C3A1',
  119. '1': '#7063D2',
  120. '-2': '#EEEEEE'
  121. },
  122. statusList: [{
  123. name: '全部',
  124. value: 'all'
  125. },
  126. {
  127. name: '待入账',
  128. value: 'waiting'
  129. },
  130. {
  131. name: '已入账',
  132. value: 'accounted'
  133. },
  134. // {
  135. // name: '已退回',
  136. // value: 'back'
  137. // },
  138. // {
  139. // name: '已取消',
  140. // value: 'cancel'
  141. // }
  142. ],
  143. incomeLog: [],
  144. showMoney: true, //是否显示金额
  145. //日期选择
  146. showCalendar: false,
  147. selDateText: '',
  148. rewardLog: [{
  149. mark: '任务佣金收入',
  150. create_time: '2023-06-02',
  151. money: '99.00'
  152. },
  153. {
  154. mark: '任务佣金收入',
  155. create_time: '2023-06-02',
  156. money: '99.00'
  157. },
  158. {
  159. mark: '任务佣金收入',
  160. create_time: '2023-06-02',
  161. money: '99.00'
  162. },
  163. {
  164. mark: '任务佣金收入',
  165. create_time: '2023-06-02',
  166. money: '99.00'
  167. }
  168. ], //佣金记录
  169. propsDate: '', //日期参数
  170. totalMoney: '', //收入
  171. loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
  172. currentPage: 1,
  173. lastPage: 1,
  174. isEmpty: false,
  175. on_cashout_money: '0.00',
  176. money_total: '0.00',
  177. money: '0.00',
  178. alreadyWithdral_money: '0.00',
  179. commissionList: [],
  180. recommendSum: {}
  181. };
  182. },
  183. computed: {
  184. ...mapGetters(['appInfo', 'isLogin', 'userInfo'])
  185. },
  186. async onLoad() {
  187. let ress = await recommendCount()
  188. console.log('推广佣金汇总返回值', ress);
  189. if (ress.code == 0) {
  190. this.recommendSum = ress.data
  191. }
  192. let res = await recommendList()
  193. if (res.code == 0) {
  194. res.data.data.forEach((item, index) => {
  195. item.description = JSON.parse(item.description)
  196. })
  197. this.commissionList = res.data.data
  198. console.log('推广佣金明细返回值', res, this.commissionList);
  199. }
  200. },
  201. onShow() {
  202. // this.getCheck()
  203. },
  204. methods: {
  205. queryList(pageNo, pageSize) {
  206. //这里的pageNo和pageSize会自动计算好,直接传给服务器即可
  207. this.$refs.paging.complete([{
  208. mark: '任务佣金收入',
  209. create_time: '2023-06-02',
  210. money: '99.00',
  211. type: 1
  212. },
  213. {
  214. mark: '任务佣金收入',
  215. create_time: '2023-06-02',
  216. money: '99.00',
  217. type: 1
  218. },
  219. {
  220. mark: '任务佣金收入',
  221. create_time: '2023-06-02',
  222. money: '99.00',
  223. type: 1
  224. },
  225. {
  226. mark: '任务佣金收入',
  227. create_time: '2023-06-02',
  228. money: '99.00',
  229. type: 1
  230. },
  231. {
  232. mark: '佣金提现',
  233. create_time: '2023-06-02',
  234. money: '99.00',
  235. type: 0
  236. },
  237. {
  238. mark: '佣金提现',
  239. create_time: '2023-06-02',
  240. money: '99.00',
  241. type: 0
  242. },
  243. {
  244. mark: 'gpt消耗',
  245. create_time: '2023-06-02',
  246. money: '99.00',
  247. type: 0
  248. },
  249. {
  250. mark: 'gpt消耗',
  251. create_time: '2023-06-02',
  252. money: '99.00',
  253. type: 0
  254. },
  255. {
  256. mark: 'gpt消耗',
  257. create_time: '2023-06-02',
  258. money: '99.00',
  259. type: 0
  260. },
  261. ]);
  262. // const params = {
  263. // page: pageNo,
  264. // limit: pageSize,
  265. // // level: this.level,
  266. // };
  267. // this.$http('commission.incomeLog', params).then(res => {
  268. // if (res.code == 0) {
  269. // this.$refs.paging.complete(res.data.data);
  270. // }
  271. // });
  272. },
  273. getCheck() {
  274. var that = this;
  275. that.$http('commission.auth').then(res => {
  276. if (res.code == 0) {
  277. uni.setNavigationBarTitle({
  278. title: this.appInfo.site_name
  279. });
  280. that.on_cashout_money = res.data.on_cashout_money > 0 ? res.data.on_cashout_money : '0.00'
  281. that.money_total = res.data.money_total > 0 ? res.data.money_total : '0.00'
  282. that.money = res.data.money
  283. that.isLoading = false
  284. }
  285. })
  286. },
  287. jump(path, parmas) {
  288. this.$Router.push({
  289. path: path,
  290. query: parmas
  291. });
  292. },
  293. // 切换分类
  294. onTab(state) {
  295. if (this.stateCurrent !== state) {
  296. this.rewardLog = [];
  297. this.currentPage = 1;
  298. this.lastPage = 1;
  299. this.stateCurrent = state;
  300. this.getCommissionLog();
  301. }
  302. },
  303. // 今日
  304. getToday() {
  305. let now = new Date();
  306. this.selDateText = `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
  307. let dateText = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
  308. this.propsDate = `${dateText}-${dateText}`;
  309. },
  310. // 选择日期
  311. selDate(e) {
  312. this.rewardLog = [];
  313. this.currentPage = 1;
  314. this.lastPage = 1;
  315. this.selDateText = `${e.startYear}.${e.startMonth}.${e.startDay}-${e.endYear}.${e.endMonth}.${e.endDay}`;
  316. let dateText = `${e.startYear}/${e.startMonth}/${e.startDay}-${e.endYear}/${e.endMonth}/${e.endDay}`;
  317. this.propsDate = dateText;
  318. this.getCommissionLog();
  319. this.$refs.uCalendar.init();
  320. },
  321. // 佣金明细
  322. getCommissionLog() {
  323. let that = this;
  324. that.loadStatus = 'loading';
  325. that.$http(
  326. 'commission.incomeLog', {
  327. // date: that.propsDate,
  328. // type: that.stateCurrent,
  329. page: that.currentPage
  330. },
  331. '加载中...'
  332. ).then(res => {
  333. uni.stopPullDownRefresh();
  334. if (res.code === 0) {
  335. // that.totalMoney = res.data.total_money;
  336. that.rewardLog = [...that.rewardLog, ...res.data.data];
  337. that.lastPage = res.data.last_page;
  338. that.isEmpty = !that.rewardLog.length;
  339. that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
  340. }
  341. });
  342. },
  343. // 加载更多
  344. loadMore() {
  345. if (this.currentPage < this.lastPage) {
  346. this.currentPage += 1;
  347. this.getCommissionLog();
  348. }
  349. }
  350. }
  351. };
  352. </script>
  353. <style lang="scss">
  354. .nextUser {
  355. display: flex;
  356. align-items: center;
  357. margin-top: 10rpx;
  358. margin-bottom: 10rpx;
  359. .nextAvatar {
  360. width: 40rpx;
  361. height: 40rpx;
  362. border-radius: 50%;
  363. margin-right: 20rpx;
  364. }
  365. .nextUserName {
  366. font-size: 24rpx;
  367. color: #ccc;
  368. // font-weight: 600;
  369. }
  370. }
  371. .cashTips {
  372. margin-top: 20rpx;
  373. color: white;
  374. font-size: 12rpx;
  375. }
  376. // 分类
  377. .state-item {
  378. height: 100%;
  379. display: flex;
  380. flex-direction: column;
  381. align-items: center;
  382. justify-content: center;
  383. background-color: #fff;
  384. border-bottom: 1rpx solid rgba(#999, 0.5);
  385. .state-title {
  386. color: #666;
  387. font-weight: 500;
  388. font-size: 28rpx;
  389. line-height: 90rpx;
  390. }
  391. .title-active {
  392. color: #333;
  393. }
  394. .underline {
  395. display: block;
  396. width: 68rpx;
  397. height: 4rpx;
  398. background: #fff;
  399. border-radius: 2rpx;
  400. }
  401. .underline-active {
  402. background: #5e49c3;
  403. display: block;
  404. width: 68rpx;
  405. height: 4rpx;
  406. border-radius: 2rpx;
  407. }
  408. }
  409. // 钱包卡片
  410. .wallet-wrap {
  411. background-color: #fff;
  412. padding: 30rpx;
  413. }
  414. .wallet-card {
  415. width: 690rpx;
  416. // height: 301rpx;
  417. background: url('http://file.shopro.top/imgs/commission/commission_card_bg.png') no-repeat;
  418. background-size: 100% 100%;
  419. border-radius: 20rpx;
  420. padding: 30rpx;
  421. position: relative;
  422. box-shadow: 1rpx 5rpx 16rpx 0px rgba(94, 73, 195, 0.81);
  423. .head-box {
  424. margin-bottom: 20rpx;
  425. .head-title {
  426. font-size: 24rpx;
  427. font-weight: 400;
  428. color: #ffffff;
  429. }
  430. .look-btn {
  431. color: #fff;
  432. font-size: 30rpx;
  433. background: none;
  434. padding: 0;
  435. margin-left: 20rpx;
  436. }
  437. }
  438. .card-num {
  439. font-size: 40rpx;
  440. font-weight: 500;
  441. color: #fefefe;
  442. margin-bottom: 30rpx;
  443. }
  444. .card-bottom {
  445. .card-item {
  446. .item-title {
  447. font-size: 24rpx;
  448. font-weight: 400;
  449. color: #ffffff;
  450. margin-bottom: 10rpx;
  451. }
  452. .item-value {
  453. font-size: 30rpx;
  454. font-weight: 500;
  455. color: #fefefe;
  456. }
  457. }
  458. }
  459. .draw-btn {
  460. position: absolute;
  461. top: 35rpx;
  462. right: 35rpx;
  463. width: 121rpx;
  464. line-height: 58rpx;
  465. background: #ffffff;
  466. border-radius: 29rpx;
  467. padding: 0;
  468. font-size: 24rpx;
  469. font-weight: 500;
  470. color: #5848c4;
  471. }
  472. }
  473. // 表头
  474. .head_box {
  475. height: 120rpx;
  476. padding: 0 30rpx;
  477. background-color: #f6f6f6;
  478. .date-btn {
  479. background-color: #fff;
  480. line-height: 54rpx;
  481. border-radius: 27rpx;
  482. padding: 0 20rpx;
  483. font-size: 24rpx;
  484. font-weight: 500;
  485. color: #666666;
  486. }
  487. .total-box {
  488. font-size: 24rpx;
  489. font-weight: 500;
  490. color: #666666;
  491. }
  492. }
  493. // 佣金明细列表
  494. .item-box {
  495. margin: 20rpx 0;
  496. }
  497. .log-item {
  498. // height: 200rpx;
  499. background-color: #fff;
  500. padding: 0 60rpx;
  501. border-bottom: 1rpx solid #eee;
  502. padding-top: 10rpx;
  503. .item-left {
  504. .log-img {
  505. width: 50rpx;
  506. height: 50rpx;
  507. border-radius: 50%;
  508. margin-right: 24rpx;
  509. }
  510. .log-name {
  511. font-size: 28rpx;
  512. font-weight: 500;
  513. color: #333333;
  514. margin-bottom: 12rpx;
  515. }
  516. .log-notice {
  517. font-size: 22rpx;
  518. font-weight: 500;
  519. color: #c0c0c0;
  520. }
  521. }
  522. .item-right {
  523. .log-num {
  524. font-size: 28rpx;
  525. font-weight: 500;
  526. color: #05c3a1;
  527. }
  528. .log-date {
  529. font-size: 24rpx;
  530. font-weight: 400;
  531. color: #c0c0c0;
  532. }
  533. }
  534. }
  535. </style>