前端小程序

这个提交包含在:
可乐加冰
2026-09-14 17:24:53 +08:00
父节点 bb69a43a0f
当前提交 019630f12c
共有 2629 个文件被更改,包括 403657 次插入 和 0 次删除

查看文件

@@ -0,0 +1,456 @@
<!-- 申请分销商 / 我的资料 / 汇付进件 -->
<template>
<view class="apply-page brand-page">
<view class="page-wrap">
<shopro-navbar variant="gradient" :backText="pageTitle"></shopro-navbar>
<scroll-view scroll-y class="page-scroll" :scroll-into-view="scrollIntoView" scroll-with-animation>
<view class="page-content">
<view v-if="showBanner" class="banner-box brand-card">
<image
class="banner-img"
:src="formHeadImg"
mode="aspectFill"
@error="onBannerError"
></image>
</view>
<view class="notice-card brand-card" v-if="noticeText" :class="noticeType">
<text class="notice-icon">{{ noticeIcon }}</text>
<text class="notice-text">{{ noticeText }}</text>
</view>
<view class="section-card brand-card" v-if="formList.length">
<view class="section-head">
<text class="section-title">{{ shopSectionTitle }}</text>
<text class="section-sub" v-if="formReadonly">只读</text>
</view>
<u-form :model="model" :rules="rules" ref="uForm" :errorType="errorType">
<block v-for="(form, index) in formList" :key="index">
<u-form-item
v-if="form.type === 'input'"
:labelStyle="labelStyle"
label-width="150"
label-position="left"
:label="form.name"
:prop="`value${index}`"
>
<view v-if="formReadonly" class="readonly-value">{{ displayValue(index) }}</view>
<u-input
v-else
:placeholder="`请输入${form.name}`"
:placeholderStyle="placeholderStyle"
v-model="model['value' + index]"
type="text"
:custom-style="inputStyle"
></u-input>
</u-form-item>
<u-form-item
v-if="form.type === 'number'"
:labelStyle="labelStyle"
label-position="left"
:label="form.name"
:prop="`value${index}`"
label-width="150"
>
<view v-if="formReadonly" class="readonly-value">{{ displayValue(index) }}</view>
<u-input
v-else
:placeholder="`请输入${form.name}`"
:placeholderStyle="placeholderStyle"
v-model="model['value' + index]"
type="number"
:custom-style="inputStyle"
></u-input>
</u-form-item>
<u-form-item
v-if="form.type === 'image'"
:labelStyle="labelStyle"
:prop="`value${index}`"
:label="form.name"
label-position="top"
label-width="150"
:borderBottom="true"
>
<u-upload
:deletable="!formReadonly"
:placeholderStyle="placeholderStyle"
:showProgress="false"
@on-uploaded="uploadSuccess($event, `value${index}`)"
@on-remove="uploadRemove($event, `value${index}`)"
:file-list="model[`valueList${index}`]"
:action="`${$API_URL}/index/upload`"
width="148"
height="148"
maxCount="1"
></u-upload>
</u-form-item>
</block>
</u-form>
</view>
<view class="footer-card brand-card" v-if="showSubmitBtn">
<view class="agreement u-flex" v-if="protocol">
<u-checkbox v-model="model.agreement" activeColor="#1677FF" shape="circle" @change="onAgreement"></u-checkbox>
<view class="agreement-text" @tap="$Router.push({ path: '/pages/public/richtext', query: { id: protocol.richtext_id } })">
我已阅读并遵守
<text class="text-underline">{{ protocol.name }}</text>
</view>
</view>
<button class="u-reset-button save-btn brand-btn-primary" @tap="onSubmit" :disabled="isFormEnd">
{{ submitBtnText }}
</button>
</view>
<view class="scroll-bottom-safe"></view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
formList: [],
formHeadImg: '',
protocol: null,
isFormEnd: false,
hasPostBtn: false,
formReadonly: false,
pageMode: 'apply',
hasSavedData: false,
agentStatus: '',
bannerLoadFailed: false,
scrollIntoView: '',
defaultHeadImg: '',
errorType: ['message'],
labelStyle: {
'font-size': '28rpx',
'font-weight': '500',
color: '#1F2937'
},
inputStyle: {
background: '#F9FAFB',
borderRadius: '12rpx',
padding: '0 24rpx',
height: '88rpx'
},
placeholderStyle: 'font-size: 28rpx;color:#9CA3AF;',
model: {},
inputNumber: [
{
required: true,
message: '内容不能为空!',
trigger: ['change', 'blur']
}
],
inputImage: [
{
required: true,
message: '请上传图片',
trigger: ['change', 'blur']
}
],
rules: {}
};
},
computed: {
pageTitle() {
if (this.pageMode === 'profile') return '我的资料';
if (this.pageMode === 'pending') return '申请资料';
return '申请分销商';
},
shopSectionTitle() {
if (this.pageMode === 'profile') return '分销商资料';
return '申请信息';
},
submitBtnText() {
return '确认提交';
},
showSubmitBtn() {
return this.hasPostBtn && this.pageMode === 'apply';
},
showBanner() {
return (
this.pageMode === 'apply' &&
this.formHeadImg &&
this.formHeadImg !== this.defaultHeadImg &&
!this.bannerLoadFailed
);
},
noticeType() {
if (this.pageMode === 'profile') return 'is-info';
if (this.pageMode === 'pending') return 'is-warn';
return 'is-primary';
},
noticeIcon() {
if (this.pageMode === 'profile') return 'ℹ';
if (this.pageMode === 'pending') return '⏳';
return '✎';
},
noticeText() {
if (this.pageMode === 'profile') return '您已是分销商,以下为您的资料';
if (this.pageMode === 'pending') return '资料审核中,暂不可修改';
if (this.showSubmitBtn && this.pageMode === 'apply' && this.agentStatus === 'needinfo') return '请完善资料后提交申请';
if (this.showSubmitBtn && this.pageMode === 'apply') return '提交申请后,请到「提现」页完成分账进件绑定';
return '';
}
},
onLoad() {
this.defaultHeadImg = this.$IMG_URL + '/imgs/commission/apply_bg.png';
this.formHeadImg = this.defaultHeadImg;
this.getFrom();
},
methods: {
uploadSuccess(e, value) {
this.model[value] = e[0].response.data.url;
},
uploadRemove(index, value) {
this.model[value] = '';
},
onAgreement(e) {
this.model.agreement = e.value;
},
displayValue(index) {
const val = this.model['value' + index];
return val !== '' && val != null ? val : '—';
},
onBannerError() {
this.bannerLoadFailed = true;
},
getFrom() {
let that = this;
that.$http('commission.form').then(res => {
if (res.code !== 1) {
that.$u.toast(res.msg || '加载申请表单失败');
return;
}
that.protocol = res.data.apply_protocol;
that.formList = res.data.apply_info || [];
that.hasSavedData = !!res.data.has_saved_apply_info;
that.agentStatus = res.data.agent_status || '';
that.pageMode = res.data.page_mode || 'apply';
that.formReadonly = that.pageMode !== 'apply' || !!res.data.form_readonly;
that.hasPostBtn = res.data.apply_status === true;
if (res.data.background_image) {
that.bannerLoadFailed = false;
that.formHeadImg = res.data.background_image;
}
that.initRules();
that.$nextTick(() => {
if (that.$refs.uForm) {
that.$refs.uForm.setRules(that.rules);
}
});
});
},
initRules() {
let that = this;
that.formList.forEach((item, index) => {
that.model = {
...that.model,
[`value${index}`]: item.value ? item.value : ''
};
that.model.agreement = false;
if (item.type === 'input' || item.type === 'number') {
that.rules = {
...that.rules,
[`value${index}`]: that.inputNumber
};
}
if (item.type === 'image') {
if (item.value) {
let arr = [{ url: item.value }];
that.model = {
...that.model,
[`valueList${index}`]: arr
};
}
that.rules = {
...that.rules,
[`value${index}`]: that.inputImage
};
}
});
},
applyCommission(data) {
let that = this;
that.isFormEnd = true;
const payload = { data: data };
that.$http('commission.apply', payload, '申请中...').then(res => {
that.isFormEnd = false;
if (res.code === 1) {
uni.showToast({
title: res.msg,
success: () => {
that.$Router.back();
}
});
}
}).catch(() => {
that.isFormEnd = false;
});
},
onSubmit() {
let that = this;
const submitApply = () => {
let formData = that.formList.map((item, index) => ({
...item,
value: that.model[`value${index}`] != null ? that.model[`value${index}`] : item.value
}));
that.applyCommission(formData);
};
if (!this.$refs.uForm) {
submitApply();
return;
}
this.$refs.uForm.validate(valid => {
if (!valid) {
this.$u.toast('请完善表单');
return;
}
if (!this.model.agreement && this.protocol) {
return this.$u.toast('请勾选协议');
}
submitApply();
});
}
}
};
</script>
<style lang="scss" scoped>
.apply-page {
height: 100vh;
}
.page-wrap {
background: $brand-header-gradient;
height: 100%;
display: flex;
flex-direction: column;
}
.page-scroll {
flex: 1;
height: 0;
}
.page-content {
padding: 16rpx $brand-page-gutter 0;
box-sizing: border-box;
}
.banner-box {
height: 200rpx;
margin-bottom: 20rpx;
overflow: hidden;
.banner-img {
width: 100%;
height: 100%;
display: block;
}
}
.notice-card {
display: flex;
align-items: flex-start;
padding: 24rpx 28rpx;
margin-bottom: 20rpx;
font-size: 26rpx;
line-height: 1.5;
.notice-icon {
flex-shrink: 0;
margin-right: 12rpx;
font-size: 28rpx;
}
&.is-info {
background: #f0f9ff;
border: 1rpx solid #bae6fd;
color: #0369a1;
}
&.is-warn {
background: #fffbeb;
border: 1rpx solid #fde68a;
color: #b45309;
}
&.is-primary {
background: $brand-primary-light;
border: 1rpx solid rgba(22, 119, 255, 0.2);
color: $brand-primary-dark;
}
}
.section-card {
padding: 28rpx 28rpx 8rpx;
margin-bottom: 0;
}
.section-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8rpx;
}
.section-title {
font-size: 30rpx;
font-weight: 600;
color: $brand-text;
}
.section-sub {
font-size: 22rpx;
color: $brand-text-muted;
padding: 4rpx 12rpx;
background: #f3f4f6;
border-radius: 8rpx;
}
.readonly-value {
flex: 1;
font-size: 28rpx;
color: $brand-text;
line-height: 1.5;
padding: 16rpx 0;
word-break: break-all;
}
.footer-card {
margin-top: 24rpx;
padding: 28rpx;
}
.agreement {
margin-bottom: 24rpx;
.agreement-text {
font-size: 24rpx;
font-weight: 500;
color: $brand-primary;
margin-left: 8rpx;
.text-underline {
text-decoration: underline;
}
}
}
.save-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
font-size: 30rpx;
font-weight: 600;
border-radius: 44rpx;
}
.scroll-bottom-safe {
height: calc(40rpx + env(safe-area-inset-bottom));
}
</style>

查看文件

@@ -0,0 +1,82 @@
<!-- 绑定邀请码 -->
<template>
<view class="bind-invite-page brand-page">
<view class="page-wrap">
<shopro-navbar variant="gradient" backText="绑定邀请码"></shopro-navbar>
<view class="page-content">
<view class="form-card brand-card">
<view class="form-title">输入邀请人的邀请码</view>
<input class="invite-input" v-model="inviteCode" placeholder="请输入邀请码" />
<button class="submit-btn" @tap="bindCode">确认绑定</button>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
inviteCode: ''
};
},
methods: {
bindCode() {
if (!this.inviteCode) {
this.$u.toast('请输入邀请码');
return;
}
this.$http('commission.bindInviteCode', { invite_code: this.inviteCode }).then(res => {
if (res.code === 1) {
this.$u.toast('绑定成功');
setTimeout(() => this.$Router.back(), 1500);
}
});
}
}
};
</script>
<style lang="scss" scoped>
.bind-invite-page {
height: 100vh;
}
.page-wrap {
background: $brand-header-gradient;
min-height: 100vh;
}
.page-content {
padding: 0 $brand-page-gutter 24rpx;
}
.form-card {
padding: 40rpx 32rpx;
.form-title {
font-size: 28rpx;
color: #666;
margin-bottom: 24rpx;
}
.invite-input {
height: 88rpx;
border: 1rpx solid #e5e5e5;
border-radius: 12rpx;
padding: 0 24rpx;
font-size: 32rpx;
margin-bottom: 32rpx;
}
.submit-btn {
height: 88rpx;
line-height: 88rpx;
background: #1677FF;
color: #fff;
border-radius: 44rpx;
font-size: 30rpx;
}
}
</style>

查看文件

@@ -0,0 +1,415 @@
<!-- 差价明细 -->
<template>
<view class="commission-log-wrap">
<!-- 钱包卡片 -->
<view class="wallet-wrap">
<view class="wallet-card">
<view class="head-box u-flex">
<view class="head-title">总收益(元)</view>
<button class="u-reset-button look-btn" @tap="showMoney = !showMoney">
<view class="u-iconfont" :class="showMoney ? 'uicon-eye-fill' : 'uicon-eye-off'"
style="color: #fff;font-size: 50rpx;"></view>
</button>
</view>
<view class="card-num">{{ showMoney ? agentInfo.total_income || '0.00' : '***' }}</view>
<view class="card-bottom u-flex u-row-left">
<view class="card-item u-flex-1">
<view class="item-title">待入账差价</view>
<view class="item-value">{{ showMoney ? agentInfo.delay_money || '0.00' : '***' }}</view>
</view>
<view class="card-item u-flex-1">
<view class="item-title">可提现差价</view>
<view class="item-value">{{ showMoney ? userInfo.money || '0.00' : '***' }}</view>
</view>
</view>
<button class="u-reset-button draw-btn" @tap="jump('/pages/user/wallet/withdraw')">提现</button>
</view>
</view>
<!-- 筛选 -->
<u-sticky offset-top="0" :enable="true">
<view class="head_box u-flex u-row-between">
<button class="u-reset-button date-btn u-flex u-col-center" @tap="showCalendar = true">
{{ selDateText }}
<text class="u-iconfont uicon-arrow-down-fill u-m-l-20"
style="color:#e5e5e5 ; font-size: 34rpx;"></text>
</button>
<view class="">
<view class="total-box">{{ stateMap[stateCurrent] }}¥{{ totalMoney || '0.00' }}</view>
</view>
</view>
<!-- 状态分类 -->
<view class="u-flex nav-box">
<view class="state-item u-flex-1 " v-for="(state, index) in statusList" :key="state.value"
@tap="onTab(state.value)">
<text class="state-title"
:class="{ 'title-active': stateCurrent === state.value }">{{ state.name }}</text>
<text class="underline" :class="{ 'underline-active': stateCurrent === state.value }"></text>
</view>
</view>
</u-sticky>
<view class="item-box">
<!-- 佣金明细列表 -->
<view class="log-item u-flex u-row-between" v-for="item in rewardLog" :key="item.id">
<view class="item-left u-flex">
<image class="log-img" :src="item.buyer.avatar" mode=""></image>
<view class="">
<view class="log-name">{{ item.buyer.nickname }}</view>
<view class="log-notice">{{ item.award_type_name || '推广差价' }} · {{ $u.timeFormat(item.createtime, 'yyyy.mm.dd') }}</view>
</view>
</view>
<view class="item-right">
<view class="log-num" :style="{ color: classType[item.status] }">{{ item.status < 0 ? '-' : '+' }}
{{ item.commission }}</view>
<view class="log-date"></view>
</view>
</view>
<!-- 更多 -->
<u-loadmore v-if="rewardLog.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
<!-- 缺省页 -->
<shopro-empty v-if="isEmpty" marginTop="100rpx" :image="$IMG_URL + '/imgs/empty/empty_goods_null.png'"
tipText="暂无数据"></shopro-empty>
</view>
<!-- 日期选择 -->
<u-calendar v-model="showCalendar" safeAreaInsetBottom ref="uCalendar" mode="range" start-text="开始"
end-text="结束" active-bg-color="#1677FF" active-color="#fff" range-bg-color="rgba(22,119,255,.15)" range-color="#1677FF"
:customStyle="{ background: 'linear-gradient(90deg, #1677FF, #1677FF)', boxShadow: '0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34)' }"
@change="selDate"></u-calendar>
</view>
</template>
<script>
import {
mapMutations,
mapActions,
mapState,
mapGetters
} from 'vuex';
export default {
components: {},
data() {
return {
stateCurrent: 'all', //默认
stateMap: {
all: '全部收入',
waiting: '待入账',
accounted: '已入账',
back: '已退回',
cancel: '已取消'
},
classType: {
'-1': '#1677FF',
'0': '#05C3A1',
'1': '#7063D2',
'-2': '#EEEEEE'
},
statusList: [{
name: '全部',
value: 'all'
},
{
name: '待入账',
value: 'waiting'
},
{
name: '已入账',
value: 'accounted'
},
{
name: '已退回',
value: 'back'
},
{
name: '已取消',
value: 'cancel'
}
],
showMoney: true, //是否显示金额
//日期选择
showCalendar: false,
selDateText: '',
rewardLog: [], //佣金记录
propsDate: '', //日期参数
totalMoney: '', //收入
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1,
isEmpty: false
};
},
computed: {
...mapGetters(['userInfo', 'agentInfo'])
},
onLoad() {
this.getToday();
this.getCommissionLog();
},
onPullDownRefresh() {
this.rewardLog = [];
this.currentPage = 1;
this.lastPage = 1;
this.getCommissionLog();
},
onReachBottom() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getCommissionLog();
}
},
methods: {
jump(path, parmas) {
this.$Router.push({
path: path,
query: parmas
});
},
// 切换分类
onTab(state) {
if (this.stateCurrent !== state) {
this.rewardLog = [];
this.currentPage = 1;
this.lastPage = 1;
this.stateCurrent = state;
this.getCommissionLog();
}
},
// 今日
getToday() {
let now = new Date();
this.selDateText = `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
let dateText = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
this.propsDate = `${dateText}-${dateText}`;
},
// 选择日期
selDate(e) {
this.rewardLog = [];
this.currentPage = 1;
this.lastPage = 1;
this.selDateText = `${e.startYear}.${e.startMonth}.${e.startDay}-${e.endYear}.${e.endMonth}.${e.endDay}`;
let dateText = `${e.startYear}/${e.startMonth}/${e.startDay}-${e.endYear}/${e.endMonth}/${e.endDay}`;
this.propsDate = dateText;
this.getCommissionLog();
this.$refs.uCalendar.init();
},
// 佣金明细
getCommissionLog() {
let that = this;
that.loadStatus = 'loading';
that.$http(
'commission.rewardLog', {
date: that.propsDate,
type: that.stateCurrent,
page: that.currentPage
},
'加载中...'
).then(res => {
uni.stopPullDownRefresh();
if (res.code === 1) {
that.totalMoney = res.data.total_money;
that.rewardLog = [...that.rewardLog, ...res.data.rewards.data];
that.lastPage = res.data.rewards.last_page;
that.isEmpty = !that.rewardLog.length;
that.loadStatus = that.currentPage < res.data.rewards.last_page ? 'loadmore' : 'nomore';
}
});
},
// 加载更多
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getCommissionLog();
}
}
}
};
</script>
<style lang="scss">
// 分类
.state-item {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #fff;
border-bottom: 1rpx solid rgba(#999, 0.5);
.state-title {
color: #666;
font-weight: 500;
font-size: 28rpx;
line-height: 90rpx;
}
.title-active {
color: #333;
}
.underline {
display: block;
width: 68rpx;
height: 4rpx;
background: #fff;
border-radius: 2rpx;
}
.underline-active {
background: #1677FF;
display: block;
width: 68rpx;
height: 4rpx;
border-radius: 2rpx;
}
}
// 钱包卡片
.wallet-wrap {
background-color: #fff;
padding: 30rpx;
}
.wallet-card {
width: 690rpx;
height: 301rpx;
background: $brand-primary-gradient;
// background: url($IMG_URL+'/imgs/commission/commission_card_bg.png') no-repeat;
background-size: 100% 100%;
border-radius: 20rpx;
padding: 30rpx;
position: relative;
// box-shadow: 1rpx 5rpx 16rpx 0px rgba(94, 73, 195, 0.81);
.head-box {
margin-bottom: 20rpx;
.head-title {
font-size: 24rpx;
font-weight: 400;
color: #ffffff;
}
.look-btn {
color: #fff;
font-size: 30rpx;
background: none;
padding: 0;
margin-left: 20rpx;
}
}
.card-num {
font-size: 40rpx;
font-weight: 500;
color: #fefefe;
margin-bottom: 30rpx;
}
.card-bottom {
.card-item {
.item-title {
font-size: 24rpx;
font-weight: 400;
color: #ffffff;
margin-bottom: 10rpx;
}
.item-value {
font-size: 30rpx;
font-weight: 500;
color: #fefefe;
}
}
}
.draw-btn {
position: absolute;
top: 35rpx;
right: 35rpx;
width: 121rpx;
line-height: 58rpx;
background: #ffffff;
border-radius: 29rpx;
padding: 0;
font-size: 24rpx;
font-weight: 500;
color: #1677FF;
}
}
// 表头
.head_box {
height: 120rpx;
padding: 0 30rpx;
background-color: $brand-page-bg;
.date-btn {
background-color: #fff;
line-height: 54rpx;
border-radius: 27rpx;
padding: 0 20rpx;
font-size: 24rpx;
font-weight: 500;
color: #666666;
}
.total-box {
font-size: 24rpx;
font-weight: 500;
color: #666666;
}
}
// 佣金明细列表
.item-box {
margin: 20rpx 0;
}
.log-item {
height: 142rpx;
background-color: #fff;
padding: 0 30rpx;
border-bottom: 1rpx solid #eee;
.item-left {
.log-img {
width: 50rpx;
height: 50rpx;
border-radius: 50%;
margin-right: 24rpx;
}
.log-name {
font-size: 28rpx;
font-weight: 500;
color: #333333;
margin-bottom: 12rpx;
}
.log-notice {
font-size: 22rpx;
font-weight: 500;
color: #c0c0c0;
}
}
.item-right {
.log-num {
font-size: 28rpx;
font-weight: 500;
color: #05c3a1;
}
.log-date {
font-size: 24rpx;
font-weight: 400;
color: #c0c0c0;
}
}
}
</style>

查看文件

@@ -0,0 +1,167 @@
<!-- 推广商品 -->
<template>
<view class="promotion-goods-wrap">
<view class="goods-list u-flex" v-for="(item, index) in goodsList" :key="item.goods_id" @tap="jump('/pages/goods/detail', { id: item.id })">
<view class="img-box"><image class="goods-img" :src="item.image" mode=""></image></view>
<view class="goods-info u-flex-col u-row-between">
<view class="goods-title u-ellipsis-1">{{ item.title }}</view>
<view class="goods-des u-ellipsis-1">{{ item.subtitle }}</view>
<view class="goods-price u-flex font-OPPOSANS">
<view class="price">¥{{ item.price }}</view>
<view class="origin-price">¥{{ item.original_price }}</view>
</view>
<view class="commission-num">预计差价:¥{{ item.commission_money }}</view>
</view>
<button class="share-btn u-reset-button" @tap.stop="toShare(index)">分享赚</button>
</view>
<!-- 分享组件 -->
<shopro-share v-model="showShare" :posterInfo="posterInfo" :posterType="'goods'"></shopro-share>
<!-- 缺省页 -->
<shopro-empty v-if="isEmpty" :image="$IMG_URL + '/imgs/empty/empty_goods_null.png'" tipText="暂无数据"></shopro-empty>
<!-- 更多 -->
<u-loadmore v-if="goodsList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
</view>
</template>
<script>
import share from '@/shopro/share';
export default {
components: {},
data() {
return {
showShare: false, //是否分享
posterInfo: {}, //分享信息
goodsList: [], //分销商品
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1,
isEmpty: false
};
},
computed: {},
onLoad() {
this.getGoodList();
},
onUnload() {
share.setShareInfo();
},
onReachBottom() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getGoodList();
}
},
methods: {
jump(path, parmas) {
this.$Router.push({
path: path,
query: parmas
});
},
// 去分享
toShare(index) {
const that = this;
let goodsInfo = this.goodsList[index];
this.posterInfo = goodsInfo;
share.setShareInfo({
title: goodsInfo.title,
desc: goodsInfo.subtitle,
image: goodsInfo.image,
params: {
page: 2,
pageId: goodsInfo.id
}
});
this.showShare = true;
},
getGoodList() {
let that = this;
that.loadStatus = 'loading';
that.$http('commission.goods', {
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.goodsList = [...that.goodsList, ...res.data.data];
that.lastPage = res.data.last_page;
that.isEmpty = !that.goodsList.length;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
}
}
};
</script>
<style lang="scss">
page {
background-color: #fff;
}
// 推广商品列表
.goods-list {
padding: 30rpx;
border-bottom: 1rpx solid rgba(#dfdfdf, 0.5);
position: relative;
.share-btn {
position: absolute;
bottom: 30rpx;
right: 30rpx;
width: 160rpx;
line-height: 60rpx;
background: linear-gradient(90deg, #1677FF, #1677FF);
box-shadow: 0px 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
border-radius: 30rpx;
font-size: 28rpx;
color: #fff;
font-weight: 500;
}
.img-box {
border: 1rpx solid rgba(223, 223, 223, 0.43);
margin-right: 30rpx;
.goods-img {
width: 200rpx;
height: 200rpx;
}
}
.goods-info {
align-items: flex-start;
height: 200rpx;
.goods-title {
width: 400rpx;
font-size: 28rpx;
font-weight: 500;
color: #333333;
margin-bottom: 10rpx;
}
.goods-des {
width: 400rpx;
font-size: 22rpx;
font-weight: 500;
color: $brand-price;
margin-bottom: 10rpx;
}
.goods-price {
margin-bottom: 10rpx;
.price {
font-size: 28rpx;
font-weight: 500;
color: #333333;
margin-right: 16rpx;
}
.origin-price {
font-size: 24rpx;
font-weight: 400;
text-decoration: line-through;
color: #999999;
}
}
.commission-num {
font-size: 24rpx;
font-weight: 500;
color: #1677FF;
}
}
}
</style>

文件差异内容过多而无法显示 加载差异

查看文件

@@ -0,0 +1,544 @@
<!-- 分销订单 -->
<template>
<view class="page_box commission-order-wrap">
<view class="head_box">
<!-- 标题栏 -->
<shopro-navbar variant="transparent" lightOnDark
:backTextStyle="{ fontSize: '40rpx', fontWeight: '500' }"
backText="分销订单"></shopro-navbar>
<!-- 团队数据总览 -->
<view class="team-data-box u-flex u-row-between">
<view class="data-card">
<view class="total-item">
<view class="item-title">团队订单数量(单)</view>
<view class="total-num">{{ agentInfo.child_order_count || 0 }}</view>
</view>
<view class="category-item u-flex">
<view class="u-flex-1">
<view class="item-title">一级订单</view>
<view class="category-num">{{ agentInfo.child_order_count_1 || 0 }}</view>
</view>
<view class="u-flex-1">
<view class="item-title">二级订单</view>
<view class="category-num">{{ agentInfo.child_order_count_2 || 0 }}</view>
</view>
</view>
</view>
<view class="data-card">
<view class="total-item">
<view class="item-title">团队订单金额(元)</view>
<view class="total-num">{{ agentInfo.child_order_money || '0.00' }}</view>
</view>
<view class="category-item u-flex">
<view class="u-flex-1">
<view class="item-title">一级订单</view>
<view class="category-num">{{ agentInfo.child_order_money_1 || '0.00' }}</view>
</view>
<view class="u-flex-1">
<view class="item-title">二级订单</view>
<view class="category-num">{{ agentInfo.child_order_money_2 || '0.00' }}</view>
</view>
</view>
</view>
</view>
<!-- 直推 -->
<view class="direct-box u-flex u-row-between">
<view class="direct-item">
<view class="item-title">直推分销订单数量(单)</view>
<view class="item-value">{{ agentInfo.order_count }}</view>
</view>
<view class="direct-item">
<view class="item-title">直推分销订单金额(元)</view>
<view class="item-value">{{ agentInfo.order_money }}</view>
</view>
</view>
<!-- 筛选 -->
<view class="">
<!-- 日期筛选 -->
<view class="filter-box u-flex u-row-between">
<button class="u-reset-button date-btn u-flex u-col-center" @tap="showCalendar = true">
{{ selDateText }}
<text class="u-iconfont uicon-arrow-down-fill u-m-l-20"
style="color:#e5e5e5 ; font-size: 34rpx;"></text>
</button>
<view class="">
<view class="total-box">{{ stateMap[stateCurrent] }}¥{{ amount || '0.00' }}</view>
</view>
</view>
<!-- 状态分类 -->
<view class="u-flex nav-box">
<view class="state-item u-flex-1" v-for="(state, index) in statusList" :key="state.value"
@tap="onTab(state.value)">
<text class="state-title"
:class="{ 'title-active': stateCurrent === state.value }">{{ state.name }}</text>
<text class="underline" :class="{ 'underline-active': stateCurrent === state.value }"></text>
</view>
</view>
</view>
</view>
<view class="content_box">
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
<!-- 订单列表 -->
<view class="order-list" v-for="item in orderList" :key="item.id">
<view class="order-head u-flex u-row-between">
<text class="order-code">订单编号:{{ item.order.order_sn }}</text>
<text class="order-state">{{ item.order.status_name }}</text>
</view>
<view class="order-from u-flex u-row-between">
<view class="from-user u-flex">
<text>下单人:</text>
<image class="user-avatar" :src="item.buyer.avatar" mode=""></image>
<text class="user-name">{{ item.buyer.nickname }}</text>
</view>
<view class="order-time">{{ $u.timeFormat(item.order.createtime, ' yyyy.mm.dd hh:MM ') }}</view>
</view>
<view class="goods-card u-flex" v-for="corder in item.commission_order" :key="corder.id">
<view class="goods-img-box">
<image class="goods-img" :src="corder.order_item.goods_image" mode=""></image>
</view>
<view class="goods-info u-flex-col u-row-between">
<view class="goods-title more-t">{{ corder.order_item.goods_title }}</view>
<view class="goods-sku">数量:
{{ corder.order_item.goods_num }};{{ corder.order_item.goods_sku_text || '' }}</view>
<view class="total-box u-flex u-flex-1 u-row-between">
<view class="goods-price">
{{ corder.amount }}
<text class="goods-state">{{ corder.commission_order_status_text }}</text>
</view>
<view class="u-flex" v-if="corder.reward">
<text class="name">差价</text>
<text class="commission-num">{{ corder.reward.commission }}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 缺省页 -->
<shopro-empty marginTop="100rpx" v-if="isEmpty" :image="$IMG_URL + '/imgs/empty/empty_goods_null.png'"
tipText="暂无订单"></shopro-empty>
<!-- 更多 -->
<u-loadmore v-if="orderList.length" height="80rpx" :status="loadStatus" icon-type="flower"
color="#ccc" />
</scroll-view>
</view>
<!-- 日期选择 -->
<u-calendar v-model="showCalendar" safeAreaInsetBottom ref="uCalendar" mode="range" start-text="开始"
end-text="结束" active-bg-color="#1677FF" active-color="#fff" range-bg-color="rgba(22,119,255,.15)"
range-color="#1677FF"
:customStyle="{ background: 'linear-gradient(90deg, #1677FF, #1677FF)', boxShadow: '0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34)' }"
@change="selDate"></u-calendar>
</view>
</template>
<script>
import {
mapMutations,
mapActions,
mapState,
mapGetters
} from 'vuex';
export default {
components: {},
data() {
return {
backTextStyle: {
color: '#fff',
fontSize: '40rpx',
fontWeight: '500'
},
stateCurrent: 'all', //默认
stateMap: {
all: '全部',
// no: '不计入',
yes: '已计入',
back: '已退回',
cancel: '已取消'
},
statusList: [{
name: '全部',
value: 'all'
},
// {
// name: '不计入',
// value: 'no'
// },
{
name: '已计入',
value: 'yes'
},
{
name: '已退回',
value: 'back'
},
{
name: '已取消',
value: 'cancel'
}
],
orderList: [], //分销订单
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1,
isEmpty: false,
//日期选择
showCalendar: false,
selDateText: '',
propsDate: '', //日期参数
amount: '' //收入
};
},
computed: {
...mapGetters(['userInfo', 'agentInfo'])
},
onLoad() {
this.getToday();
this.getOrderList();
},
onPullDownRefresh() {
this.orderList = [];
this.currentPage = 1;
this.lastPage = 1;
this.getOrderList();
},
methods: {
jump(path, parmas) {
this.$Router.push({
path: path,
query: parmas
});
},
// 今日
getToday() {
let now = new Date();
this.selDateText = `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
let dateText = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
this.propsDate = `${dateText}-${dateText}`;
},
// 选择日期
selDate(e) {
this.orderList = [];
this.currentPage = 1;
this.lastPage = 1;
this.selDateText = `${e.startYear}.${e.startMonth}.${e.startDay}-${e.endYear}.${e.endMonth}.${e.endDay}`;
let dateText = `${e.startYear}/${e.startMonth}/${e.startDay}-${e.endYear}/${e.endMonth}/${e.endDay}`;
this.propsDate = dateText;
this.getOrderList();
this.$refs.uCalendar.init();
},
// 切换分类
onTab(state) {
if (this.stateCurrent !== state) {
this.orderList = [];
this.currentPage = 1;
this.lastPage = 1;
this.stateCurrent = state;
this.getOrderList();
}
},
// 分销订单
getOrderList() {
let that = this;
that.loadStatus = 'loading';
that.$http('commission.orderLog', {
date: that.propsDate,
type: that.stateCurrent,
page: that.currentPage
}).then(res => {
uni.stopPullDownRefresh();
if (res.code === 1) {
that.orderList = [...that.orderList, ...res.data.orders.data];
that.amount = res.data.amount;
that.lastPage = res.data.orders.last_page;
that.isEmpty = !that.orderList.length;
that.loadStatus = that.currentPage < res.data.orders.last_page ? 'loadmore' : 'nomore';
}
});
},
// 加载更多
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getOrderList();
}
}
}
};
</script>
<style lang="scss">
// 直推
.direct-box {
margin: 20rpx;
.direct-item {
width: 341rpx;
height: 117rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 20rpx;
.item-title {
font-size: 22rpx;
font-weight: 500;
color: #999999;
margin-bottom: 6rpx;
}
.item-value {
font-size: 38rpx;
font-weight: 600;
color: #333333;
}
}
}
// 团队信息总览
.team-data-box {
margin: 20rpx;
.data-card {
width: 340rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 20rpx;
.item-title {
font-size: 22rpx;
font-weight: 500;
color: #999999;
line-height: 30rpx;
margin-bottom: 10rpx;
}
.total-item {
margin-bottom: 20rpx;
}
.total-num {
font-size: 38rpx;
font-weight: 600;
color: #333333;
}
.category-num {
font-size: 26rpx;
font-weight: 600;
color: #333333;
}
}
}
// 状态分类
.head_box {
width: 750rpx;
background: $brand-header-gradient;
}
.content_box {
background: $brand-page-bg;
}
// 表头
.filter-box {
height: 120rpx;
padding: 0 30rpx;
background-color: $brand-card-bg;
border-radius: 20rpx 20rpx 0 0;
.date-btn {
background-color: $brand-page-bg;
line-height: 54rpx;
border-radius: 27rpx;
padding: 0 20rpx;
font-size: 24rpx;
font-weight: 500;
color: $brand-text;
}
.total-box {
font-size: 24rpx;
font-weight: 500;
color: $brand-text-muted;
}
}
.nav-box {
background-color: $brand-card-bg;
}
.state-item {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.state-title {
color: #666;
font-weight: 500;
font-size: 28rpx;
line-height: 90rpx;
}
.title-active {
color: $brand-primary;
}
.underline {
display: block;
width: 68rpx;
height: 4rpx;
background: #fff;
border-radius: 2rpx;
}
.underline-active {
background: #1677FF;
display: block;
width: 68rpx;
height: 4rpx;
border-radius: 2rpx;
}
}
// 订单列表
.order-list {
background-color: #fff;
margin-top: 20rpx;
.order-head {
padding: 20rpx;
.order-code {
font-size: 26rpx;
font-weight: 400;
color: #999999;
}
.order-state {
font-size: 26rpx;
font-weight: 500;
color: #05c3a1;
}
}
.order-from {
background-color: #f9f9f9;
padding: 20rpx;
.from-user {
font-size: 24rpx;
font-weight: 400;
color: #666666;
.user-avatar {
width: 26rpx;
height: 26rpx;
border-radius: 50%;
margin-right: 8rpx;
}
.user-name {
font-size: 24rpx;
font-weight: 400;
color: #999999;
}
}
.order-time {
font-size: 24rpx;
font-weight: 400;
color: #999999;
}
}
.goods-card {
padding: 30rpx 20rpx;
// border-bottom: 1rpx solid #dfdfdf;
.goods-img-box {
margin-right: 30rpx;
.goods-img {
width: 160rpx;
height: 160rpx;
background-color: #ccc;
}
}
.goods-info {
height: 160rpx;
width: 600rpx;
align-items: flex-start;
.goods-title {
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
.goods-sku {
font-size: 24rpx;
font-weight: 400;
color: #666666;
}
.goods-price {
font-size: 30rpx;
font-weight: 500;
color: #333333;
.goods-state {
line-height: 30rpx;
padding: 0 10rpx;
background: $brand-primary-light;
border: 1rpx solid $brand-primary;
border-radius: 30rpx;
margin-left: 20rpx;
font-size: 20rpx;
color: $brand-primary;
}
&::before {
content: '¥';
font-size: 20rpx;
}
}
.total-box {
height: 80rpx;
width: 100%;
.num-price {
font-size: 24rpx;
font-weight: 400;
color: #999999;
}
.name {
font-size: 24rpx;
font-weight: 400;
color: #999999;
}
.commission-num {
font-size: 30rpx;
font-weight: 500;
color: $brand-primary;
&::before {
content: '¥';
font-size: 22rpx;
}
}
}
}
}
}
</style>

查看文件

@@ -0,0 +1,149 @@
<!-- 分销排行 -->
<template>
<view class="rankings-wrap brand-page">
<shopro-navbar variant="transparent" lightOnDark
:backTextStyle="{ fontSize: '40rpx', fontWeight: '500' }"
backText="分销排行榜"></shopro-navbar>
<!-- 排行榜 -->
<view class="rankings-list-box">
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
<view class="ranking-list u-flex u-row-between" v-for="(item, index) in rankingsList" :key="index">
<view class="list-left u-flex">
<view class="tag-box u-flex u-row-center u-col-center">
<text class="tag-text" v-if="index >= 3">{{ index + 1 }}</text>
<image v-else class="tag-icon" :src="rankingsIcon[index]" mode=""></image>
</view>
<image class="user-avatar" :src="item.user ? item.user.avatar : $IMG_URL + '/imgs/base_avatar.png'" mode=""></image>
<view class="user-info">
<view class="name u-m-b-10">{{ item.user ? item.user.nickname : '当前用户已注销' }}</view>
<view class="date">{{ $u.timeFormat(item.createtime, 'yyyy年mm月dd日') }}</view>
</view>
</view>
<view class="list-right y-end">
<view class="num u-m-b-10">{{ item.total_income }}</view>
<view class="des">累计收益</view>
</view>
</view>
<!-- 更多 -->
<u-loadmore v-if="rankingsList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
<view class="hack-box" style="height: 200rpx;width: 100%;"></view>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
rankingsIcon: {
0: this.$IMG_URL + '/imgs/commission/01.png',
1: this.$IMG_URL + '/imgs/commission/02.png',
2: this.$IMG_URL + '/imgs/commission/03.png'
},
rankingsList: [], //排行榜
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1
};
},
computed: {},
onLoad() {
this.getRankings();
},
methods: {
getRankings() {
let that = this;
that.loadStatus = 'loading';
that.$http('commission.ranking', {
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.rankingsList = [...that.rankingsList, ...res.data.data];
that.lastPage = res.data.last_page;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
},
// 加载更多
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getRankings();
}
}
}
};
</script>
<style lang="scss">
.rankings-wrap {
background: $brand-header-gradient;
min-height: 100vh;
overflow: hidden;
}
// 排行榜列表
.rankings-list-box {
background-color: $brand-card-bg;
border-radius: 20rpx 20rpx 0px 0px;
width: calc(100% - 48rpx);
max-width: 690rpx;
margin: 24rpx auto 0;
box-shadow: $brand-shadow;
.scroll-box {
height: 100%;
}
.ranking-list {
height: 140rpx;
padding: 0 30rpx;
border-bottom: 1rpx solid #e5e5e5;
.list-left {
.tag-box {
width: 50rpx;
font-size: 36rpx;
font-weight: 500;
color: #beb4b3;
margin-right: 20rpx;
.tag-icon {
width: 40rpx;
height: 60rpx;
}
}
.user-avatar {
width: 66rpx;
height: 66rpx;
border-radius: 50%;
margin-right: 30rpx;
}
.user-info {
.name {
font-size: 28rpx;
font-weight: bold;
color: #333333;
}
.date {
font-size: 24rpx;
font-weight: 400;
color: #999999;
}
}
}
.list-right {
.num {
font-size: 30rpx;
font-weight: 600;
color: $brand-primary;
}
.des {
font-size: 24rpx;
font-weight: 500;
color: $brand-text-muted;
}
}
}
}
</style>

查看文件

@@ -0,0 +1,262 @@
<!-- 分享记录 -->
<template>
<view class="page_box brand-page">
<!-- 标题栏 -->
<view class="head_box">
<view class="nav-box">
<shopro-navbar variant="transparent" lightOnDark
:backTextStyle="{ fontSize: '40rpx', fontWeight: '500' }"
backText="分享记录"></shopro-navbar>
</view>
<!-- 分类tab -->
<view class="tab-box u-flex">
<view class="tab-item u-flex-1 " v-for="(tab, index) in tabsList" :key="tab.value" @tap="onTab(tab.value)">
<text class="tab-title" :class="{ 'title-active': tabCurrent === tab.value }">{{ tab.name }}</text>
<text class="underline" :class="{ 'underline-active': tabCurrent === tab.value }"></text>
</view>
</view>
</view>
<view class="content_box">
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
<!-- 分享记录列表 -->
<view class="log-list u-flex" v-for="item in shareLogList" :key="item.id">
<view class="log-avatar-wrap"><image class="log-avatar" :src="item.user.avatar" mode=""></image></view>
<view class="item-right">
<view class="name">{{ item.user.nickname }}</view>
<view class="content u-flex">
<view class="content-img-wrap" v-if="item.type_data"><image class="content-img" :src="item.type_data.image" mode=""></image></view>
<view class="content-text">{{ item.msg }}</view>
</view>
<view class="item-bottom u-flex u-row-between">
<view class="time">{{ $u.timeFormat(item.createtime, 'yyyy年mm月dd日 hh:MM') }}</view>
<view class="from-text">来自{{ typeObj[item.type] }}分享</view>
</view>
</view>
</view>
<!-- 缺省页 -->
<shopro-empty v-if="isEmpty" :image="$IMG_URL + '/imgs/empty/empty_goods_null.png'" tipText="暂无数据"></shopro-empty>
<!-- 更多 -->
<u-loadmore v-if="shareLogList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
</scroll-view>
</view>
<view class="foot_box"></view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
shareLogList: [], //分享记录
tabCurrent: 'all', //默认
tabsList: [
{
name: '全部',
value: 'all'
},
{
name: '名片',
value: 'index'
},
{
name: '商品',
value: 'goods'
},
{
name: '拼团',
value: 'groupon'
}
],
typeObj: {
index: '名片',
goods: '商品',
groupon: '拼团'
},
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1,
isEmpty: false
};
},
computed: {},
onLoad() {
this.getShareLog();
},
onPullDownRefresh() {
this.currentPage = 1;
this.lastPage = 1;
this.shareLogList = [];
this.getShareLog();
},
methods: {
// 切换分类
onTab(type) {
if (this.tabCurrent !== type) {
this.tabCurrent = type;
this.currentPage = 1;
this.lastPage = 1;
this.shareLogList = [];
this.getShareLog();
}
},
// 分享记录数据
getShareLog() {
let that = this;
that.loadStatus = 'loading';
that.$http('commission.share', {
type: that.tabCurrent,
page: that.currentPage
}).then(res => {
uni.stopPullDownRefresh();
if (res.code === 1) {
that.shareLogList = [...that.shareLogList, ...res.data.data];
that.lastPage = res.data.last_page;
that.isEmpty = !that.shareLogList.length;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
},
// 加载更多
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getShareLog();
}
}
}
};
</script>
<style lang="scss">
// nav
.head_box {
height: 280rpx;
background: $brand-header-gradient;
position: relative;
}
.content_box {
background: $brand-page-bg;
}
// 分类
.tab-box {
background-color: $brand-card-bg;
border-radius: 20rpx 20rpx 0px 0px;
position: absolute;
width: 100%;
bottom: 0;
.tab-item {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.tab-title {
color: #666;
font-weight: 500;
font-size: 28rpx;
line-height: 90rpx;
}
.title-active {
color: $brand-primary;
font-weight: 600;
}
.underline {
display: block;
width: 68rpx;
height: 4rpx;
background: #fff;
border-radius: 2rpx;
}
.underline-active {
background: #1677FF;
display: block;
width: 68rpx;
height: 4rpx;
border-radius: 2rpx;
}
}
}
// 分享记录列表
.log-list {
background-color: $brand-card-bg;
padding: 30rpx;
margin: 10rpx $brand-page-gutter;
border-radius: $brand-card-radius;
box-shadow: $brand-shadow;
align-items: flex-start;
.log-avatar-wrap {
margin-right: 14rpx;
.log-avatar {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
}
}
.item-right {
flex: 1;
.name {
font-size: 26rpx;
font-weight: 500;
color: $brand-primary;
margin-bottom: 30rpx;
}
.content {
background: $brand-primary-light;
border-radius: 2rpx;
padding: 10rpx;
margin-bottom: 20rpx;
.content-img-wrap {
margin-right: 16rpx;
width: 80rpx;
height: 80rpx;
.content-img {
width: 80rpx;
height: 80rpx;
border-radius: 6rpx;
}
}
.content-text {
font-size: 24rpx;
font-weight: 500;
color: #333333;
}
}
.item-bottom {
width: 100%;
.time {
font-size: 22rpx;
font-weight: 500;
color: $brand-text-muted;
}
.from-text {
font-size: 22rpx;
font-weight: 500;
color: $brand-text-muted;
}
}
}
}
</style>

查看文件

@@ -0,0 +1,359 @@
<!-- 我的团队 -->
<template>
<view class="page_box team-wrap">
<view class="head_box">
<!-- 标题栏 -->
<shopro-navbar variant="transparent" lightOnDark
:backTextStyle="{ fontSize: '40rpx', fontWeight: '500' }"
backText="我的团队"></shopro-navbar>
<!-- 推荐人 -->
<view class="referrer-box u-flex u-p-x-20" v-if="referrerInfo && referrerInfo.avatar">
推广人:
<image class="referrer-avatar u-m-r-10" :src="referrerInfo.avatar" mode=""></image>
{{ referrerInfo.nickname }}
</view>
<!-- 团队数据总览 -->
<view class="team-data-box u-flex u-row-between">
<view class="data-card">
<view class="total-item">
<view class="item-title">团队总人数(人)</view>
<view class="total-num">{{ userInfo.child_user_count || 0 }}</view>
</view>
<view class="category-item u-flex">
<view class=" u-flex-1">
<view class="item-title">一级成员</view>
<view class="category-num">{{ userInfo.child_user_count_1 || 0 }}</view>
</view>
<view class=" u-flex-1">
<view class="item-title">二级成员</view>
<view class="category-num">{{ userInfo.child_user_count_2 || 0 }}</view>
</view>
</view>
</view>
<view class="data-card">
<view class="total-item">
<view class="item-title">团队分销商人数(人)</view>
<view class="total-num">{{ agentInfo.child_agent_count || 0 }}</view>
</view>
<view class="category-item u-flex">
<view class=" u-flex-1">
<view class="item-title">一级分销商</view>
<view class="category-num">{{ agentInfo.child_agent_count_1 || 0 }}</view>
</view>
<view class="u-flex-1 ">
<view class="item-title">二级分销商</view>
<view class="category-num">{{ agentInfo.child_agent_count_2 || 0 }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="content_box">
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
<!-- 团队列表 -->
<view class="team-box">
<view class="team-list" v-for="(item, index) in teamList" :key="item.id">
<sh-collapse-item :avatar="item.avatar" :dateTime="item.createtime"
:level="item.agent ? item.agent.level : null" :name="item.nickname"
:isUnfold="item.isUnfold" :childNum="item.child_user_count_1"
@click="onTeamList(item.id, index)">
<view slot="collapse-children" v-if="childrenTeamList.length">
<view class="team-children u-flex" v-for="children in childrenTeamList"
:key="children.id">
<image class="head-img" :src="children.avatar" mode=""></image>
<view class="head-info">
<view class="name-box u-flex">
<view class="name-text">{{ children.nickname }}</view>
<view class="grade-tag tag-box u-flex" v-if="children.agent">
<image class="tag-img"
:src="children.agent ? children.agent.level.image : ''" mode="">
</image>
<text
class="tag-title">{{ children.agent ? children.agent.level.name : '' }}</text>
</view>
</view>
<view class="head-time">{{ $u.timeFormat(children.createtime, 'yyyy年mm月dd日') }}
</view>
</view>
</view>
<button class="cu-btn refresh-btn u-flex u-row-center u-col-center"
@tap.stop="childrenLoadMore(item.id)">
<view v-if="childrenCurrentPage < childrenLastPage"
class="u-iconfont uicon-reload u-m-r-10"
:class="{ 'refresh-active': isRefresh }" style="color: #999;font-size: 26rpx;">
</view>
{{ childrenLoad ? '点击加载更多' : '没有更多~' }}
</button>
</view>
</sh-collapse-item>
</view>
</view>
<!-- 缺省页 -->
<shopro-empty v-if="isEmpty" marginTop="50rpx" :image="$IMG_URL + '/imgs/empty/empty_goods_null.png'"
tipText="暂无团队人员"></shopro-empty>
<!-- 更多 -->
<u-loadmore v-if="teamList.length" height="80rpx" :status="loadStatus" icon-type="flower"
color="#ccc" />
</scroll-view>
</view>
</view>
</template>
<script>
import shCollapseItem from '../components/sh-collapse-item.vue';
import {
mapMutations,
mapActions,
mapState,
mapGetters
} from 'vuex';
export default {
components: {
shCollapseItem
},
data() {
return {
isEmpty: false,
referrerInfo: {}, //推荐人信息
twoTeamCount: 0, //二级成员
teamList: [], //团队列表
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1,
// 二级
childrenTeamList: [],
childrenCurrentPage: 1,
childrenLastPage: 1,
childrenLoad: false,
isRefresh: false
};
},
computed: {
...mapGetters(['userInfo', 'agentInfo'])
},
onLoad() {
this.getTeam();
this.getAgent();
},
methods: {
...mapActions(['getAgent']),
// 点击队员项
onTeamList(id, current) {
this.childrenTeamList = [];
this.childrenCurrentPage = 1;
this.childrenLastPage = 1;
this.childrenLoad = false;
this.isRefresh = false;
!this.teamList[current].isUnfold && this.teamList[current].child_user_count_1 && this.getChildrenTeam(id);
this.teamList.map((item, index) => {
if (index === current) {
item.isUnfold ? (item.isUnfold = false) : (item.isUnfold = true);
} else {
item.isUnfold = false;
}
});
},
// 团队列表
getTeam() {
let that = this;
that.loadStatus = 'loadmore';
that.$http('commission.team', {
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.referrerInfo = res.data.parent_user;
let arr = res.data.teams.data;
arr.map(item => {
item.isUnfold = false;
});
that.teamList = [...that.teamList, ...arr];
that.isEmpty = !that.teamList.length;
that.lastPage = res.data.teams.last_page;
that.loadStatus = that.currentPage < res.data.teams.last_page ? 'loadmore' : 'nomore';
}
});
},
// 二级队员
getChildrenTeam(id) {
let that = this;
that.$http(
'commission.team', {
id: id,
page: that.childrenCurrentPage
},
'加载中...'
).then(res => {
if (res.code === 1) {
that.childrenTeamList = [...that.childrenTeamList, ...res.data.teams.data];
that.childrenLastPage = res.data.teams.last_page;
that.childrenLoad = that.childrenCurrentPage < res.data.teams.last_page;
}
});
},
// 二级加载更多
childrenLoadMore(id) {
if (!this.isRefresh) {
// 加载更多
if (this.childrenCurrentPage < this.childrenLastPage) {
this.isRefresh = true;
this.childrenCurrentPage += 1;
this.getChildrenTeam(id);
}
}
},
// 加载更多
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getTeam();
}
}
}
};
</script>
<style lang="scss">
// 推荐人
.referrer-box {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
margin-top: 10rpx;
.referrer-avatar {
width: 34rpx;
height: 34rpx;
border-radius: 50%;
}
}
// 二级加载更多按钮
.refresh-btn {
width: 100%;
line-height: 100rpx;
background: #ffffff;
border-radius: 25rpx;
font-size: 22rpx;
font-weight: 500;
color: #999999;
white-space: nowrap;
}
.refresh-active {
transform: rotate(360deg);
transition: all linear 0.5s;
}
// 头部卡片
.head_box {
background: $brand-header-gradient;
background-size: 100% 100%;
padding-bottom: 30rpx;
}
.content_box {
background: $brand-page-bg;
}
// 团队信息总览
.team-data-box {
margin: 30rpx 20rpx 0;
.data-card {
width: 340rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 20rpx;
.item-title {
font-size: 22rpx;
font-weight: 500;
color: #999999;
line-height: 30rpx;
margin-bottom: 10rpx;
}
.total-item {
margin-bottom: 20rpx;
}
.total-num {
font-size: 38rpx;
font-weight: 500;
color: #333333;
}
.category-num {
font-size: 26rpx;
font-weight: 500;
color: #333333;
}
}
}
// 团队列表
.team-box {
.team-list {
.team-children {
margin-left: 80rpx;
margin-right: 20rpx;
height: 132rpx;
border-bottom: 1rpx solid #eee;
.head-img {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
margin-right: 38rpx;
}
.head-info {
.head-time {
font-size: 22rpx;
font-weight: 400;
color: #999999;
}
.name-box {
margin-bottom: 12rpx;
.name-text {
font-size: 24rpx;
font-weight: 500;
color: #666;
}
.tag-box {
background: rgba(0, 0, 0, 0.2);
border-radius: 21rpx;
line-height: 30rpx;
padding-right: 10rpx;
margin-left: 10rpx;
.tag-img {
width: 34rpx;
height: 34rpx;
margin-right: 6rpx;
border-radius: 50%;
}
.tag-title {
font-size: 18rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
line-height: 20rpx;
}
}
}
}
}
}
}
</style>