You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
zhishifufei_uniapp/pages/spread/my_promoter.vue

461 lines
9.8 KiB

<template>
<BaseContainer class="my-promoter">
<NavBar title="我的推广" fixed />
<view class="header">
<view class="search-info">
<view class="search">
<view class="form">
<view :class="{ zIndex: zIndex }" class="input-box">
<i class="iconfont2 iconsousuo"></i>
<input :focus="zIndex" v-model.trim="search" placeholder="输入昵称或手机号搜索" placeholder-style="color: #ffffff"
id="search" @confirm="handleSearch" />
</view>
<view class="label" :class="{ zIndex: zIndex }" @click="zIndex = true">
<i class="iconfont2 iconsousuo"></i>
<text>输入昵称或手机号搜索</text>
</view>
</view>
</view>
<view class="info">
<view class="list">
<view class="item">
<view>推广人数</view>
<view>{{ promoterData.one_spread_count || 0 }}</view>
</view>
<view class="item">
<view>直推订单</view>
<view>{{ promoterData.order_count || 0 }}</view>
</view>
</view>
</view>
</view>
<view class="caption">
<view>推广人信息</view>
<view :class="{ hide: action }">订单数/金额</view>
<view :class="{ hide: !action }">操作管理</view>
</view>
</view>
<view class="main">
<view class="main-list" v-if="spreadList.length">
<view class="main-item" :key="item.id" v-for="(item, index) in spreadList">
<view>
<image class="avatar" :src="item.avatar" alt="" />
</view>
<view>
<view>{{ item.nickname }}</view>
<view>{{ item.phone }}</view>
</view>
<view v-if="!action">
<view>
直推<text>{{ item.sellout_count }}</text>单
</view>
<view>共{{ item.sellout_money }}元</view>
</view>
<view v-if="action" @click="removeSpread(item, index)">移除</view>
</view>
</view>
<view v-if="!spreadList.length && finished" class="empty">
<image mode="widthFix" :src="getImgPath('/wap/first/zsff/images/empty.png')" alt="暂无数据" />
<view>暂无数据</view>
</view>
</view>
<view class="footer">
<button class="flex flex-center" type="button" @click="action = !action">
{{ action ? "取消学员管理" : "学员管理" }}
</button>
<button class="flex flex-center" type="button" @click="goPosterSpread">
推广学员
</button>
</view>
<TkiQrcode loadMake v-if="isQrcodeCanvasVisable" ref="qrcode" :showLoading="false" :val="qrcodeText"
@result="handleQrcodeCreateSuccess" />
<canvas canvas-id="poster" v-if="isPosterCanvasVisable" class="poster-canvas" />
</BaseContainer>
</template>
<script>
import { getMyPromoter, getSpreadList, removeSpread, getPosterSpread } from "@/api/spread";
import posterMixin from "@/mixins/poster";
export default {
mixins: [posterMixin],
data() {
return {
now_money_order: "desc",
page: 1,
limit: 16,
search: "",
spreadList: [],
finished: false,
action: false,
zIndex: false,
promoterData: {},
url: '',
poster_image: '',
site_name: '',
uid: 0,
qrcodeText: "",
isQrcodeCanvasVisable: false,
isPosterCanvasVisable: false,
};
},
onLoad() {
this.getPersonData();
this.getSpreadList();
},
onReachBottom() {
this.getSpreadList();
},
methods: {
async getPosterInfo() {
try {
const { data } = await getPosterSpread();
const { url, spread_poster_url: poster_image, site_name, uid } = data;
Object.assign(this, {
url,
poster_image,
site_name,
uid
});
} catch (err) {
this.$util.showMsg(err);
}
},
getPersonData() {
getMyPromoter().then(({ data }) => {
this.promoterData = data.data;
});
},
// 推广信息
async getSpreadList() {
if (this.finished) return;
uni.showLoading({ mask: true });
try {
const { data } = await getSpreadList({
special_order: "",
now_money_order: "desc",
page: this.page++,
limit: this.limit,
search: this.search,
});
const { list } = data;
uni.hideLoading();
this.spreadList = this.spreadList.concat(list);
this.finished = this.limit > list.length;
} catch (err) {
uni.hideLoading();
this.$util.showMsg(err);
}
},
// 点击移除
async removeSpread(spread, index) {
const { confirm } = await this.$util.wrapFn(uni.showModal, {
title: "提示",
content: "确认移除吗,确认后不可恢复哦~",
});
if (!confirm) return;
uni.showLoading({ mask: true });
try {
const { msg } = await removeSpread(spread.uid);
uni.hideLoading();
this.spreadList.splice(index, 1);
this.$util.showMsg(msg);
} catch (err) {
uni.hideLoading();
this.$util.showMsg(err);
}
},
// 点击推广学员
goPosterSpread() {
this.getPosterInfo().then(() => {
this.createSharePoster("spread", {
spread_uid: this.uid ?? 0,
url: 'pages/spread/become_promoter'
});
});
// uni.navigateTo({
// url: "/pages/spread/poster_spread",
// });
},
handleSearch() {
this.finished = false;
this.page = 1;
this.spreadList = [];
this.getSpreadList();
},
},
};
</script>
<style>
page {
background: #f5f5f5;
}
</style>
<style scoped lang="scss">
/* 我的推广 */
.my-promoter .header {
position: fixed;
top: calc(88rpx + var(--safe-top));
right: 0;
left: 0;
z-index: 10;
padding-bottom: 10rpx;
background: #f5f5f5;
}
.my-promoter .header .search-info {
padding: 0 30rpx;
background: linear-gradient(180deg, #2c8eff 0%, #f5f5f5 100%) left top/100% 100% no-repeat;
}
.my-promoter .header .search {
padding: 40rpx 45rpx;
}
.my-promoter .header .form {
position: relative;
height: 64rpx;
border-radius: 32rpx;
background: rgba(255, 255, 255, 0.3);
}
.my-promoter .header .form .input-box {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -2;
display: flex;
align-items: center;
padding: 0 32rpx;
transition: 0.3s;
&.zIndex {
z-index: 2;
}
}
.my-promoter .header .iconfont2 {
margin-right: 15rpx;
font-size: 24rpx;
color: #ffffff;
}
.my-promoter .header input {
flex: 1;
min-width: 0;
font-size: 26rpx;
color: #ffffff;
}
.my-promoter .header .label {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
font-size: 26rpx;
color: #ffffff;
transition: 0.3s;
}
.my-promoter .header .label.zIndex {
z-index: -2;
}
.my-promoter .header .info .list {
display: flex;
align-items: center;
height: 140rpx;
border-radius: 12rpx;
background: #ffffff;
}
.my-promoter .header .info .item {
position: relative;
flex: 1;
min-width: 0;
font-size: 24rpx;
line-height: 33rpx;
text-align: center;
color: #666666;
}
.my-promoter .header .info .item::before {
content: "";
position: absolute;
top: 50%;
left: 0;
z-index: 2;
width: 1px;
height: 60rpx;
background: #eeeeee;
transform: translateY(-50%);
}
.my-promoter .header .info .item:first-child::before {
display: none;
}
.my-promoter .header .info .item view:last-child {
margin-top: 10rpx;
font-weight: bold;
font-size: 40rpx;
line-height: 56rpx;
color: #282828;
}
.my-promoter .header .caption {
display: flex;
margin-top: 30rpx;
background: #ffffff;
}
.my-promoter .header .caption view {
flex: 1;
min-width: 0;
font-size: 28rpx;
line-height: 76rpx;
text-align: center;
color: #333333;
&.hide {
display: none;
}
}
.my-promoter .header .caption view:last-child {
flex: none;
width: 274rpx;
}
.main {
margin-bottom: 150rpx;
padding-top: 400rpx;
}
.main .main-list {
background: #ffffff;
}
.main .main-item {
display: flex;
align-items: center;
padding: 23rpx 0 23rpx 30rpx;
}
.main .main-item+.main-item {
border-top: 1px solid #eeeeee;
}
.main .avatar {
display: block;
width: 106rpx;
height: 106rpx;
border-radius: 50%;
object-fit: cover;
}
.main .main-item>view:nth-child(2) {
flex: 1;
min-width: 0;
padding: 0 25rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #333333;
}
.main .main-item>view:nth-child(2)>view:first-child {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.main .main-item>view:nth-child(2)>view:last-child {
margin-top: 11rpx;
font-size: 24rpx;
line-height: 33rpx;
color: #666666;
}
.main .main-item>view:nth-child(3) {
padding-right: 30rpx;
font-size: 22rpx;
line-height: 30rpx;
text-align: right;
color: #333333;
}
.main .main-item>view:nth-child(3) text {
color: #ff6b00;
}
.main .main-item>view:last-child {
width: 274rpx;
font-size: 28rpx;
line-height: 40rpx;
text-align: center;
color: #2c8eff;
cursor: pointer;
}
.my-promoter .footer {
position: fixed;
right: 0;
bottom: 0;
left: 0;
z-index: 10;
display: flex;
justify-content: space-between;
align-items: center;
padding: 15rpx 30rpx calc(15rpx + var(--safe-bottom));
background: #ffffff;
}
.my-promoter .footer button {
width: 330rpx;
height: 76rpx;
border-radius: 38rpx;
border: 1px solid #2c8eff;
font-size: 30rpx;
color: #2c8eff;
}
.my-promoter .footer button:last-child {
background: #2c8eff;
color: #ffffff;
}
.my-promoter .empty {
font-size: 28rpx;
text-align: center;
color: #cdcdcd;
}
.my-promoter .empty image {
display: block;
width: 414rpx;
margin: 0 auto;
}
</style>