martial-arts/pagesA/my-extend/my-extend.vue

124 lines
3.6 KiB
Vue
Raw Normal View History

2022-08-03 13:28:45 +00:00
<template>
<view>
<status-container titlet="我的推广" returnc="#FFFFFF">
2022-08-10 10:18:06 +00:00
<view slot="content" style="margin-top: -20rpx;" v-if="loading">
2022-08-17 07:52:02 +00:00
<view class="bacf pad-zy20 boxshow2 posi-sticky" :style="{top:newtop+'px'}">
2022-08-04 08:01:19 +00:00
<view class="disjcac pad-sx30 bbot">
2022-08-17 07:52:02 +00:00
<view v-if="personCode" class="">
<image :src="personCode" mode="aspectFill" style="width: 124px;height: 124px;" lazy-load></image>
</view>
<view class="" v-else>
<yz-qr @update:qrPath="getPath" ref="qrPath" :text="textstr" :size="124" :colorDark="'#000000'" :colorLight="'#FFFFFF'"></yz-qr>
</view>
2022-08-04 08:01:19 +00:00
</view>
<view class="disjbac pad-sx20 pad-zy10">
<view class="fon22 col26">推广获取积分</view>
2022-08-18 08:21:58 +00:00
<view class="fon26 bold col-e42417">{{scoreInfo || 0}}</view>
2022-08-04 08:01:19 +00:00
</view>
</view>
<view class="mar-s30 pad-zy20 bacf boxshow2">
<view class=" col26 pad-sx20 pad-zy10 disac borbot" v-for="(item,index) in dataList" :key="index">
<image :src="item.account.headimgurl" class="flexs radius_100 mar-y20" style="width: 78rpx;height: 78rpx;" mode="aspectFill" lazy-load></image>
2022-08-04 08:01:19 +00:00
<view class="width100">
<view class="disjbac">
<view class="fon24 colb">{{item.account.nickname}}</view>
<view class="col-e42417 fon24">+{{item.num}}</view>
2022-08-04 08:01:19 +00:00
</view>
<view class="disjbac" style="margin-top: 6rpx;">
<view class="fon20" style="color: #747474;" v-if="item.created_at">{{item.created_at.split('-').join('.')}}</view>
<view class="fon24">{{item.name}}</view>
2022-08-04 08:01:19 +00:00
</view>
</view>
</view>
</view>
2022-08-16 10:06:46 +00:00
<pitera :textStr="`${noMore && total > dataList.length?'上滑加载更多':'到底了'}~~`" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
2022-08-03 13:28:45 +00:00
</view>
</status-container>
</view>
</template>
<script>
import pitera from '@/components/nothing/pitera.vue';
import yzQr from '@/components/yz-qr/yz-qr.vue';
2022-08-10 10:18:06 +00:00
import {base64ToPath} from '@/jsFile/base64-src.js';
2022-08-03 13:28:45 +00:00
export default {
components:{
2022-08-14 14:27:26 +00:00
pitera,
yzQr
2022-08-03 13:28:45 +00:00
},
data() {
return {
2022-08-17 07:52:02 +00:00
newtop:uni.getSystemInfoSync().statusBarHeight + 42,
2022-08-10 10:18:06 +00:00
dataList:[],
page:1,
size:20,
total:0,
noMore:false,
personCode:'',
2022-08-14 14:27:26 +00:00
loading:false,
//二维码相关参数
textstr:`https://chuanwujia.com/share?invite_code=${uni.getStorageSync('invite_code')}`,
scoreInfo:''
2022-08-10 10:18:06 +00:00
}
},
onLoad() {
this.loading = true;
// this.getCode();
2022-08-10 10:18:06 +00:00
this.getExtend();
},
onReachBottom() {
2022-08-17 07:52:02 +00:00
if(this.total!=this.dataList.length){
2022-08-10 10:18:06 +00:00
this.page++;
this.getExtend();
2022-08-03 13:28:45 +00:00
}
},
methods: {
2022-08-17 07:52:02 +00:00
getPath(path){
this.personCode = path;
},
// 获取推广人
2022-08-10 10:18:06 +00:00
getExtend(){
let params = {
action:'order',
2022-08-10 10:18:06 +00:00
page:this.page,
size:this.size
}
this.$requst.get('/api/user/sales',params).then(res=>{
2022-08-10 10:18:06 +00:00
if(res.code==0){
2022-08-18 06:22:40 +00:00
this.scoreInfo = res.data.promotion_score;
this.total = res.data.list.total;
2022-08-10 10:18:06 +00:00
if(this.page==1){this.dataList=[];}
this.dataList = [...this.dataList,...res.data.list.list];
2022-08-10 10:18:06 +00:00
if(this.total==this.dataList.length && this.page!=1){
this.noMore = true;
}
}
})
},
// 获取推广码
getCode(){
if(uni.getStorageSync('personCode')){
this.loading = true;
this.personCode = uni.getStorageSync('personCode');
} else {
this.$toolAll.tools.showToast('加载中...');
this.$requst.get('/api/user/personal-qr').then(res=>{
if(res.code==0){
base64ToPath(res.data.qr).then(result=>{
this.personCode = result;
uni.setStorageSync('personCode',this.personCode);
this.loading = true;
uni.hideToast();
})
}
})
}
}
2022-08-03 13:28:45 +00:00
}
}
</script>
<style>
</style>