diff --git a/common/api.js b/common/api.js index 29920af..15bf8d4 100644 --- a/common/api.js +++ b/common/api.js @@ -58,6 +58,8 @@ export const API_WECHAT_SETPROFILE = '/api/wechat/setProfile'; // 用户授权 export const API_WXLOGIN_VIEW = '/api/wxlogin/view'; // 获取登录页协议 export const API_ARTICLE_DETAIL = '/api/article/detail'; // 协议文章详情 export const API_WXCODE = '/api/salesman/qrcode'//小程序二维码 +export const API_INCOMELIST = '/api/salesman/income'//获取佣金记录 +export const API_EXTRACTLIST = '/api/salesman/extract'//获取提取记录 /* 商户相关 */ export const API_CONFIRM_CODE = '/api/confirm/code'; // 扫码核销 \ No newline at end of file diff --git a/pages/center/invite.vue b/pages/center/invite.vue index a26c805..fb31ebc 100644 --- a/pages/center/invite.vue +++ b/pages/center/invite.vue @@ -118,15 +118,13 @@ that.canvasHidden = true that.maskHidden = true } - console.log('海报生成成功') - console.log(res) - console.log('图片链接', that.imagePath) + console.log('海报生成成功,图片链接', that.imagePath) }, fail: function(res) { console.log(res); } }); - }, 900); + },800); }, saveBill() { var that = this diff --git a/pages/center/wallet.vue b/pages/center/wallet.vue index 3e2f6c4..738d95c 100644 --- a/pages/center/wallet.vue +++ b/pages/center/wallet.vue @@ -3,7 +3,7 @@ - 2000.48 + {{walletBalance}} 佣金(元) @@ -14,7 +14,7 @@ {{ item.name }} + @click="changeTab(index)">{{ item.name }} @@ -24,14 +24,14 @@ :refresher-triggered="isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh"> - + - -¥10.00 - 结余 ¥34.43 + +¥{{item.add_price}} + 结余 ¥{{item.final_price}} - 内部粉丝购买商品获得 - 2021-7-6 22:32:43 + {{item.reffer}} + {{item.created_at}} @@ -45,17 +45,17 @@ - + - -¥11.00 - 申请中 + +¥{{item.extract_price}} + {{item.state}} - 流水号 638763485895875 - 2021-7-6 22:32:43 + 流水号 {{item.order_no}} + {{item.created_at}} @@ -77,37 +77,99 @@ isRefresher: false, // scroll-view下拉刷新状态,当前默认没有触发 tab_list: [{ name: '佣金记录', - list: [1,2,3,4,5,6,7,8,9], + list: [], page: 1, isPage: false, loadingClass: false, loadingText: '已加载全部数据' },{ name: '提取记录', - list: [1], + list: [], page: 1, isPage: false, loadingClass: true, loadingText: '正在加载中' }], - windowHeight: 0 + windowHeight: 0, + walletBalance: 0 } }, onLoad(){ this.windowHeight = uni.getSystemInfoSync().windowHeight; + this.getIncomeList() }, methods: { + changeTab(index) { + if(this.current == index) { + return + }else { + this.current = index + if(index == 0) { + this.getIncomeList() + }else { + this.getWidthList() + } + } + }, + //提取记录 + getWidthList() { + let per_page = this.pageSize; + let tab_item = this.tab_list[this.current]; + this.$http(this.API.API_EXTRACTLIST, { + page: tab_item.page, + limit: per_page + }).then(res => { + this.isRefresher = false; + let isPage = res.data.has_more_page; + tab_item.isPage = isPage; + if(!isPage){ + tab_item.loadingClass = false; + tab_item.loadingText = '没有更多数据啦~'; + } + if(tab_item.page == 1){ + tab_item.list = res.data.items; + }else{ + tab_item.list.push(...res.data.items); + } + }) + }, + //佣金记录 + getIncomeList() { + let per_page = this.pageSize; + let tab_item = this.tab_list[this.current]; + this.$http(this.API.API_INCOMELIST, { + page: tab_item.page, + limit: per_page + }).then(res => { + this.isRefresher = false; + this.walletBalance = res.data.income + let isPage = res.data.has_more_page; + tab_item.isPage = isPage; + if(!isPage){ + tab_item.loadingClass = false; + tab_item.loadingText = '没有更多数据啦~'; + } + if(tab_item.page == 1){ + tab_item.list = res.data.items; + }else{ + tab_item.list.push(...res.data.items); + } + }) + }, // 页面触底,加载下一页 onScrolltolower(){ + let tab_item = this.tab_list[this.current]; + if(tab_item.isPage){ + tab_item.page = tab_item.page + 1; + this.getIncomeList() + } console.log('加载下一页') }, // scroll-view 下拉刷新 onRefresherrefresh(){ this.isRefresher = true; console.log('下拉刷新') - setTimeout(() => { - this.isRefresher = false; - },1000) + this.getIncomeList() } } }