commission-log.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <!-- 佣金明细 -->
  2. <template>
  3. <view>
  4. <view style="color: #000000;">
  5. <tn-nav-bar backgroundColor="#ffffff" :bottomShadow="false">佣金明细</tn-nav-bar>
  6. <!-- <view :style="{height: tobheight+'px'}"></view> -->
  7. </view>
  8. <z-paging ref="paging" refresher-complete-delay="200" v-model="rewardLog" @query="queryList">
  9. <view slot="top" class="z_tabs" :style="{marginTop: tobheight+'px'}"></view>
  10. <view class="commission-log-wrap">
  11. <!-- 钱包卡片 -->
  12. <view class="wallet-wrap">
  13. <view class="wallet-card">
  14. <view class="head-box u-flex">
  15. <view class="head-title">累计收入</view>
  16. <button class="u-reset-button look-btn" @tap="showMoney = !showMoney">
  17. <!-- <view class="u-iconfont" :class="showMoney ? 'uicon-eye-fill' : 'uicon-eye-off'" style="color: #fff;font-size: 50rpx;"></view> -->
  18. <u-icon :name="showMoney ? 'eye-fill':'eye-off'" color="#fff" size="22"></u-icon>
  19. </button>
  20. </view>
  21. <view class="card-num">{{ showMoney ? money_total || '0.00' : '***' }}</view>
  22. <view class="card-bottom u-flex u-row-left">
  23. <view class="card-item u-flex-1">
  24. <view class="item-title">待入账佣金</view>
  25. <view class="item-value">{{ showMoney ? on_cashout_money || '0.00' : '***' }}</view>
  26. </view>
  27. <view class="card-item u-flex-1">
  28. <view class="item-title">可提现佣金</view>
  29. <view class="item-value">{{ showMoney ? money || '0.00' : '***' }}</view>
  30. </view>
  31. </view>
  32. <button class="u-reset-button draw-btn"
  33. @tap="jump('/pages/user/commission/withdraw')">提现</button>
  34. </view>
  35. </view>
  36. <!-- 筛选 -->
  37. <view class="item-box">
  38. <!-- 佣金明细列表 -->
  39. <view class="log-item u-flex u-row-between" v-for="item in rewardLog" :key="item.id">
  40. <view class="item-left u-flex">
  41. <view class="item-notice">
  42. <view class="log-mark">{{ item.mark }}</view>
  43. <view v-if="item.buy_userinfo" class="u-flex" style="margin-bottom: 12rpx;">
  44. <image class="log-img"
  45. :src="item.buy_userinfo.avatar?item.buy_userinfo.avatar:'/static/images/head.jpg'"
  46. mode="aspectFill"></image>
  47. <view class="log-name">
  48. {{item.buy_userinfo.nickname+'/'+item.buy_userinfo.id_number}}
  49. </view>
  50. </view>
  51. <view class="log-notice">{{ item.create_time }}</view>
  52. </view>
  53. </view>
  54. <view class="item-right">
  55. <!-- <view class="log-num" :style="{ color: classType[item.status] }">{{ item.status < 0 ? '-' : '+' }} {{ item.commission }}</view> -->
  56. <view class="log-num" :style="{ color: '#05C3A1' }">{{'+'+ item.money }}</view>
  57. <view class="log-date"></view>
  58. </view>
  59. </view>
  60. <!-- 日期选择 -->
  61. </view>
  62. </view>
  63. </z-paging>
  64. <wike-loading-page :isLoading="isLoading"></wike-loading-page>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. mapMutations,
  70. mapActions,
  71. mapState,
  72. mapGetters
  73. } from 'vuex';
  74. export default {
  75. data() {
  76. return {
  77. isLoading: true,
  78. tobheight: 45,
  79. platform: this.$platform.get(),
  80. stateCurrent: 'all', //默认
  81. stateMap: {
  82. all: '全部收入',
  83. waiting: '待入账',
  84. accounted: '已入账',
  85. back: '已退回',
  86. cancel: '已取消'
  87. },
  88. classType: {
  89. '-1': '#EB2B3D',
  90. '0': '#05C3A1',
  91. '1': '#7063D2',
  92. '-2': '#EEEEEE'
  93. },
  94. statusList: [{
  95. name: '全部',
  96. value: 'all'
  97. },
  98. {
  99. name: '待入账',
  100. value: 'waiting'
  101. },
  102. {
  103. name: '已入账',
  104. value: 'accounted'
  105. },
  106. // {
  107. // name: '已退回',
  108. // value: 'back'
  109. // },
  110. // {
  111. // name: '已取消',
  112. // value: 'cancel'
  113. // }
  114. ],
  115. incomeLog: [],
  116. showMoney: true, //是否显示金额
  117. //日期选择
  118. showCalendar: false,
  119. selDateText: '',
  120. rewardLog: [{}], //佣金记录
  121. propsDate: '', //日期参数
  122. totalMoney: '', //收入
  123. loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
  124. currentPage: 1,
  125. lastPage: 1,
  126. isEmpty: false,
  127. on_cashout_money: '0.00',
  128. money_total: '0.00',
  129. money: '0.00'
  130. };
  131. },
  132. computed: {
  133. ...mapGetters(['appInfo', 'isLogin', 'userInfo'])
  134. },
  135. onLoad() {
  136. const that = this;
  137. if (this.platform == 'wxMiniProgram') {
  138. var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight
  139. var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop
  140. this.tobheight = (menumtop + paddingtop + uni.getMenuButtonBoundingClientRect().height)
  141. }
  142. this.getToday();
  143. this.getCommissionLog();
  144. },
  145. onShow() {
  146. this.getCheck()
  147. },
  148. methods: {
  149. queryList(pageNo, pageSize) {
  150. //这里的pageNo和pageSize会自动计算好,直接传给服务器即可
  151. const params = {
  152. page: pageNo,
  153. limit: pageSize,
  154. // level: this.level,
  155. };
  156. this.$http('commission.incomeLog', params).then(res => {
  157. if (res.code == 0) {
  158. this.$refs.paging.complete(res.data.data);
  159. }
  160. });
  161. },
  162. getCheck() {
  163. var that = this;
  164. that.$http('commission.auth').then(res => {
  165. if (res.code == 0) {
  166. uni.setNavigationBarTitle({
  167. title: this.appInfo.site_name
  168. });
  169. that.on_cashout_money = res.data.on_cashout_money > 0 ? res.data.on_cashout_money : '0.00'
  170. that.money_total = res.data.money_total > 0 ? res.data.money_total : '0.00'
  171. that.money = res.data.money
  172. that.isLoading = false
  173. }
  174. })
  175. },
  176. jump(path, parmas) {
  177. this.$Router.push({
  178. path: path,
  179. query: parmas
  180. });
  181. },
  182. // 切换分类
  183. onTab(state) {
  184. if (this.stateCurrent !== state) {
  185. this.rewardLog = [];
  186. this.currentPage = 1;
  187. this.lastPage = 1;
  188. this.stateCurrent = state;
  189. this.getCommissionLog();
  190. }
  191. },
  192. // 今日
  193. getToday() {
  194. let now = new Date();
  195. this.selDateText = `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
  196. let dateText = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
  197. this.propsDate = `${dateText}-${dateText}`;
  198. },
  199. // 选择日期
  200. selDate(e) {
  201. this.rewardLog = [];
  202. this.currentPage = 1;
  203. this.lastPage = 1;
  204. this.selDateText = `${e.startYear}.${e.startMonth}.${e.startDay}-${e.endYear}.${e.endMonth}.${e.endDay}`;
  205. let dateText = `${e.startYear}/${e.startMonth}/${e.startDay}-${e.endYear}/${e.endMonth}/${e.endDay}`;
  206. this.propsDate = dateText;
  207. this.getCommissionLog();
  208. this.$refs.uCalendar.init();
  209. },
  210. // 佣金明细
  211. getCommissionLog() {
  212. let that = this;
  213. that.loadStatus = 'loading';
  214. that.$http(
  215. 'commission.incomeLog', {
  216. // date: that.propsDate,
  217. // type: that.stateCurrent,
  218. page: that.currentPage
  219. },
  220. '加载中...'
  221. ).then(res => {
  222. uni.stopPullDownRefresh();
  223. if (res.code === 0) {
  224. // that.totalMoney = res.data.total_money;
  225. that.rewardLog = [...that.rewardLog, ...res.data.data];
  226. that.lastPage = res.data.last_page;
  227. that.isEmpty = !that.rewardLog.length;
  228. that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
  229. }
  230. });
  231. },
  232. // 加载更多
  233. loadMore() {
  234. if (this.currentPage < this.lastPage) {
  235. this.currentPage += 1;
  236. this.getCommissionLog();
  237. }
  238. }
  239. }
  240. };
  241. </script>
  242. <style lang="scss">
  243. // 分类
  244. .state-item {
  245. height: 100%;
  246. display: flex;
  247. flex-direction: column;
  248. align-items: center;
  249. justify-content: center;
  250. background-color: #fff;
  251. border-bottom: 1rpx solid rgba(#999, 0.5);
  252. .state-title {
  253. color: #666;
  254. font-weight: 500;
  255. font-size: 28rpx;
  256. line-height: 90rpx;
  257. }
  258. .title-active {
  259. color: #333;
  260. }
  261. .underline {
  262. display: block;
  263. width: 68rpx;
  264. height: 4rpx;
  265. background: #fff;
  266. border-radius: 2rpx;
  267. }
  268. .underline-active {
  269. background: #5e49c3;
  270. display: block;
  271. width: 68rpx;
  272. height: 4rpx;
  273. border-radius: 2rpx;
  274. }
  275. }
  276. // 钱包卡片
  277. .wallet-wrap {
  278. background-color: #fff;
  279. padding: 30rpx;
  280. }
  281. .wallet-card {
  282. // width: 690rpx;
  283. height: 301rpx;
  284. background: url('http://file.shopro.top/imgs/commission/commission_card_bg.png') no-repeat;
  285. background-size: 100% 100%;
  286. border-radius: 20rpx;
  287. padding: 30rpx;
  288. position: relative;
  289. box-shadow: 1rpx 5rpx 16rpx 0px rgba(94, 73, 195, 0.81);
  290. .head-box {
  291. margin-bottom: 20rpx;
  292. .head-title {
  293. font-size: 24rpx;
  294. font-weight: 400;
  295. color: #ffffff;
  296. }
  297. .look-btn {
  298. color: #fff;
  299. font-size: 30rpx;
  300. background: none;
  301. padding: 0;
  302. margin-left: 20rpx;
  303. }
  304. }
  305. .card-num {
  306. font-size: 40rpx;
  307. font-weight: 500;
  308. color: #fefefe;
  309. margin-bottom: 30rpx;
  310. }
  311. .card-bottom {
  312. .card-item {
  313. .item-title {
  314. font-size: 24rpx;
  315. font-weight: 400;
  316. color: #ffffff;
  317. margin-bottom: 10rpx;
  318. }
  319. .item-value {
  320. font-size: 30rpx;
  321. font-weight: 500;
  322. color: #fefefe;
  323. }
  324. }
  325. }
  326. .draw-btn {
  327. position: absolute;
  328. top: 35rpx;
  329. right: 35rpx;
  330. width: 121rpx;
  331. line-height: 58rpx;
  332. background: #ffffff;
  333. border-radius: 29rpx;
  334. padding: 0;
  335. font-size: 24rpx;
  336. font-weight: 500;
  337. color: #5848c4;
  338. }
  339. }
  340. // 表头
  341. .head_box {
  342. height: 120rpx;
  343. padding: 0 30rpx;
  344. background-color: #f6f6f6;
  345. .date-btn {
  346. background-color: #fff;
  347. line-height: 54rpx;
  348. border-radius: 27rpx;
  349. padding: 0 20rpx;
  350. font-size: 24rpx;
  351. font-weight: 500;
  352. color: #666666;
  353. }
  354. .total-box {
  355. font-size: 24rpx;
  356. font-weight: 500;
  357. color: #666666;
  358. }
  359. }
  360. // 佣金明细列表
  361. .item-box {
  362. margin: 20rpx 0;
  363. }
  364. .log-item {
  365. // height: 142rpx;
  366. background-color: #fff;
  367. padding: 0 60rpx;
  368. border-bottom: 1rpx solid #eee;
  369. .item-left {
  370. .item-notice {
  371. // width: 80%;
  372. .log-img {
  373. width: 35rpx;
  374. height: 35rpx;
  375. border-radius: 50%;
  376. margin-right: 15rpx;
  377. }
  378. .log-name {
  379. font-size: 24rpx;
  380. color: #9E9E9E
  381. }
  382. .log-mark {
  383. font-size: 28rpx;
  384. font-weight: 500;
  385. color: #333333;
  386. margin-bottom: 12rpx;
  387. }
  388. .log-notice {
  389. font-size: 22rpx;
  390. font-weight: 500;
  391. color: #c0c0c0;
  392. }
  393. }
  394. }
  395. .item-right {
  396. .log-num {
  397. font-size: 28rpx;
  398. font-weight: 500;
  399. color: #05c3a1;
  400. }
  401. .log-date {
  402. font-size: 24rpx;
  403. font-weight: 400;
  404. color: #c0c0c0;
  405. }
  406. }
  407. }
  408. </style>