commission-log.vue 9.8 KB

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