288
uniapp/pages/commission/apply.vue
普通文件
288
uniapp/pages/commission/apply.vue
普通文件
@@ -0,0 +1,288 @@
|
||||
<!-- 申请分销商 -->
|
||||
<template>
|
||||
<s-layout title="申请分销商" class="apply-wrap" navbar="inner">
|
||||
<s-empty
|
||||
v-if="state.code === 0"
|
||||
paddingTop="0"
|
||||
icon="/static/comment-empty.png"
|
||||
text="未开启分销商申请"
|
||||
></s-empty>
|
||||
|
||||
<view v-if="state.code === 1" class="distribution-apply-wrap">
|
||||
<view class="apply-header">
|
||||
<view class="header-box ss-flex">
|
||||
<image
|
||||
class="bg-img"
|
||||
:src="sheep.$url.cdn(state.background)"
|
||||
mode="widthFix"
|
||||
@load="onImgLoad"
|
||||
></image>
|
||||
<view class="heaer-title">申请分销商</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="apply-box bg-white" :style="{ marginTop: state.imgHeight + 'rpx' }">
|
||||
<uni-forms
|
||||
label-width="200"
|
||||
:model="state.model"
|
||||
:rules="state.rules"
|
||||
border
|
||||
class="form-box"
|
||||
>
|
||||
<view class="item-box">
|
||||
<uni-forms-item
|
||||
v-for="(item, index) in state.formList"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:required="true"
|
||||
:label-position="item.type == 'image' ? 'top' : 'left'"
|
||||
>
|
||||
<uni-easyinput
|
||||
v-if="item.type !== 'image'"
|
||||
:inputBorder="false"
|
||||
:type="item.type"
|
||||
:styles="{ disableColor: '#fff' }"
|
||||
placeholderStyle="color:#BBBBBB;font-size:28rpx;line-height:normal"
|
||||
v-model="item.value"
|
||||
:placeholder="`请填写${item.name}`"
|
||||
/>
|
||||
<s-uploader
|
||||
v-if="item.type === 'image'"
|
||||
v-model:url="item.value"
|
||||
fileMediatype="image"
|
||||
limit="1"
|
||||
mode="grid"
|
||||
:imageStyles="{ width: '168rpx', height: '168rpx' }"
|
||||
></s-uploader>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-forms>
|
||||
<label class="ss-flex ss-m-t-20" v-if="state.protocol?.status == 1" @tap="onChange">
|
||||
<radio
|
||||
:checked="state.isAgree"
|
||||
color="var(--ui-BG-Main)"
|
||||
style="transform: scale(0.6)"
|
||||
@tap.stop="onChange"
|
||||
/>
|
||||
<view class="agreement-text ss-flex">
|
||||
<view class="ss-m-r-4">勾选代表同意</view>
|
||||
<view
|
||||
class="tcp-text"
|
||||
@tap.stop="
|
||||
sheep.$router.go('/pages/public/richtext', {
|
||||
id: state.protocol.id,
|
||||
title: state.protocol.title,
|
||||
})
|
||||
"
|
||||
>
|
||||
《{{ state.protocol.title }}》
|
||||
</view>
|
||||
</view>
|
||||
</label>
|
||||
<su-fixed bottom placeholder>
|
||||
<view class="submit-box ss-flex ss-row-center ss-p-30">
|
||||
<button class="submit-btn ss-reset-button ui-BG-Main ui-Shadow-Main" @tap="submit">
|
||||
{{ submitText }}
|
||||
</button>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { isEmpty } from 'lodash';
|
||||
|
||||
const state = reactive({
|
||||
code: -1,
|
||||
status: '-',
|
||||
config: {},
|
||||
isAgree: false,
|
||||
formList: [],
|
||||
protocol: {},
|
||||
applyInfo: [],
|
||||
background: '',
|
||||
imgHeight: 400,
|
||||
});
|
||||
|
||||
//勾选协议
|
||||
function onChange() {
|
||||
state.isAgree = !state.isAgree;
|
||||
}
|
||||
|
||||
const submitText = computed(() => {
|
||||
if (state.status === 'normal') return '修改信息';
|
||||
if (state.status === 'needinfo') return '提交审核';
|
||||
if (state.status === 'reject') return '重新提交';
|
||||
return '';
|
||||
});
|
||||
|
||||
async function getAgentForm() {
|
||||
const { code, data } = await sheep.$api.commission.form();
|
||||
state.code = code;
|
||||
if (code === 1) {
|
||||
state.status = data.status;
|
||||
state.background = data.background;
|
||||
state.formList = data.form;
|
||||
state.applyInfo = data.applyInfo;
|
||||
state.protocol = data.protocol;
|
||||
|
||||
if (data.protocol.status != 1) {
|
||||
state.isAgree = true;
|
||||
}
|
||||
mergeFormList();
|
||||
}
|
||||
}
|
||||
function onImgLoad(e) {
|
||||
state.imgHeight = (e.detail.height / e.detail.width) * 750 - 88;
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
if (!state.isAgree) {
|
||||
sheep.$helper.toast('请同意申请协议');
|
||||
return;
|
||||
}
|
||||
|
||||
const validate = state.formList.every((item) => {
|
||||
if (isEmpty(item.value)) {
|
||||
if (item.type !== 'image') {
|
||||
sheep.$helper.toast(`请填写${item.name}`);
|
||||
} else {
|
||||
sheep.$helper.toast(`请上传${item.name}`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!validate) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { code } = await sheep.$api.commission.apply({
|
||||
data: state.formList,
|
||||
});
|
||||
if (code === 1) {
|
||||
sheep.$router.back();
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
getAgentForm();
|
||||
});
|
||||
|
||||
// 初始化formData
|
||||
function mergeFormList() {
|
||||
state.formList.forEach((form) => {
|
||||
const apply = state.applyInfo.find(
|
||||
(info) => info.type === form.type && info.name === form.name,
|
||||
);
|
||||
if (typeof apply !== 'undefined') form.value = apply.value;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep() {
|
||||
.uni-forms-item__label .label-text {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.file-picker__progress {
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
.uni-list-item__content-title {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.uni-icons {
|
||||
font-size: 40rpx !important;
|
||||
}
|
||||
|
||||
.is-disabled {
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.distribution-apply-wrap {
|
||||
// height: 100vh;
|
||||
// width: 100vw;
|
||||
// position: absolute;
|
||||
// left: 0;
|
||||
// top: 0;
|
||||
// background-color: #fff;
|
||||
// overflow-y: auto;
|
||||
|
||||
.submit-btn {
|
||||
width: 690px;
|
||||
height: 86rpx;
|
||||
border-radius: 43rpx;
|
||||
}
|
||||
.apply-header {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
.header-box {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
.bg-img {
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.heaer-title {
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 50rpx;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
z-index: 11;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 51rpx;
|
||||
height: 8rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 4rpx;
|
||||
position: absolute;
|
||||
z-index: 12;
|
||||
bottom: -20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.apply-box {
|
||||
padding: 0 40rpx;
|
||||
|
||||
.item-box {
|
||||
border-bottom: 2rpx solid #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.agreement-text {
|
||||
font-size: 24rpx;
|
||||
color: #c4c4c4;
|
||||
line-height: normal;
|
||||
|
||||
.tcp-text {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
|
||||
.card-image {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,145 @@
|
||||
<!-- 账户 -->
|
||||
<template>
|
||||
<view class="account-card">
|
||||
<view class="account-card-box">
|
||||
<view class="ss-flex ss-row-between card-box-header">
|
||||
<view class="ss-flex">
|
||||
<view class="header-title ss-m-r-16">账户信息</view>
|
||||
<button
|
||||
class="ss-reset-button look-btn ss-flex"
|
||||
@tap="state.showMoney = !state.showMoney"
|
||||
>
|
||||
<uni-icons
|
||||
:type="state.showMoney ? 'eye-filled' : 'eye-slash-filled'"
|
||||
color="#A57A55"
|
||||
size="20"
|
||||
></uni-icons>
|
||||
</button>
|
||||
</view>
|
||||
<view class="ss-flex" @tap="sheep.$router.go('/pages/user/wallet/commission')">
|
||||
<view class="header-title ss-m-r-4">查看明细</view>
|
||||
<text class="cicon-play-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 收益 -->
|
||||
<view class="card-content">
|
||||
<view class="metric-row ss-flex">
|
||||
<view
|
||||
class="ss-flex-1 ss-flex-col ss-col-center metric-item"
|
||||
@tap="sheep.$router.go('/pages/user/wallet/commission')"
|
||||
>
|
||||
<view class="item-title">累计收益(元)</view>
|
||||
<view class="item-detail">
|
||||
{{ state.showMoney ? agentInfo?.total_income || '0.00' : '***' }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="ss-flex-1 ss-flex-col ss-col-center metric-item"
|
||||
@tap="sheep.$router.go('/pages/user/wallet/commission')"
|
||||
>
|
||||
<view class="item-title">可提现(元)</view>
|
||||
<view class="item-detail">
|
||||
{{ state.showMoney ? userInfo?.commission || '0.00' : '***' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="metric-row ss-flex">
|
||||
<view
|
||||
class="ss-flex-1 ss-flex-col ss-col-center metric-item"
|
||||
@tap="sheep.$router.go('/pages/commission/madow')"
|
||||
>
|
||||
<view class="item-title">马豆价值(元)</view>
|
||||
<view class="item-detail">
|
||||
{{
|
||||
state.showMoney
|
||||
? agentInfo?.madow_value || userInfo?.madow_value || '0.00'
|
||||
: '***'
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="ss-flex-1 ss-flex-col ss-col-center metric-item"
|
||||
@tap="sheep.$router.go('/pages/commission/voucher')"
|
||||
>
|
||||
<view class="item-title">可用兑换券(元)</view>
|
||||
<view class="item-detail">
|
||||
{{
|
||||
state.showMoney
|
||||
? agentInfo?.voucher_available || userInfo?.voucher_available || '0.00'
|
||||
: '***'
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { computed, reactive } from 'vue';
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
const agentInfo = computed(() => sheep.$store('user').agentInfo);
|
||||
|
||||
const state = reactive({
|
||||
showMoney: false,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.account-card {
|
||||
width: 694rpx;
|
||||
margin: 0 auto;
|
||||
padding: 2rpx;
|
||||
background: linear-gradient(180deg, #ffffff 0.88%, #fff9ec 100%);
|
||||
border-radius: 12rpx;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
.account-card-box {
|
||||
background: #ffefd6;
|
||||
.card-box-header {
|
||||
padding: 0 30rpx;
|
||||
height: 72rpx;
|
||||
box-shadow: 0px 2px 6px #f2debe;
|
||||
.header-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #a17545;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
.cicon-play-arrow {
|
||||
color: #a17545;
|
||||
font-size: 24rpx;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
.card-content {
|
||||
min-height: 220rpx;
|
||||
background: #fdfae9;
|
||||
padding: 16rpx 0 8rpx;
|
||||
.metric-row {
|
||||
padding: 12rpx 0;
|
||||
}
|
||||
.metric-item {
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
.item-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #cba67e;
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.item-detail {
|
||||
font-size: 36rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: bold;
|
||||
color: #692e04;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,184 @@
|
||||
<!-- 页面 -->
|
||||
<template>
|
||||
<su-popup
|
||||
:show="state.show"
|
||||
type="center"
|
||||
round="10"
|
||||
@close="state.show = false"
|
||||
:isMaskClick="false"
|
||||
maskBackgroundColor="rgba(0, 0, 0, 0.7)"
|
||||
>
|
||||
<view class="notice-box">
|
||||
<view class="img-wrap">
|
||||
<image
|
||||
class="notice-img"
|
||||
:src="sheep.$url.static(state.event.image)"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<view class="notice-title">{{ state.event.title }}</view>
|
||||
<view class="notice-detail">{{ state.event.subtitle }}</view>
|
||||
<button
|
||||
class="ss-reset-button notice-btn ui-Shadow-Main ui-BG-Main-Gradient"
|
||||
@tap="onTap(state.event.action)"
|
||||
>
|
||||
{{ state.event.button }}
|
||||
</button>
|
||||
<button class="ss-reset-button back-btn" @tap="sheep.$router.back()"> 返回 </button>
|
||||
</view>
|
||||
</su-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { reactive, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
error: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['getAgentInfo']);
|
||||
const state = reactive({
|
||||
event: {},
|
||||
show: false,
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.error,
|
||||
(error) => {
|
||||
if (error !== 0 && error !== 100) {
|
||||
state.event = eventMap[error];
|
||||
state.show = true;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
async function onTap(eventName) {
|
||||
switch (eventName) {
|
||||
case 'back': // 返回
|
||||
sheep.$router.back();
|
||||
break;
|
||||
case 'apply': // 需提交资料
|
||||
sheep.$router.go('/pages/commission/apply');
|
||||
break;
|
||||
case 'reApply': // 直接重新申请
|
||||
let { error } = await sheep.$api.commission.apply();
|
||||
if (code === 1) {
|
||||
emits('getAgentInfo');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
const eventMap = {
|
||||
// 关闭
|
||||
101: {
|
||||
image: '/assets/addons/shopro/uniapp/commission/close.png',
|
||||
title: '分销中心已关闭',
|
||||
subtitle: '该功能暂不可用',
|
||||
button: '知道了',
|
||||
action: 'back',
|
||||
},
|
||||
// 禁用
|
||||
102: {
|
||||
image: '/assets/addons/shopro/uniapp/commission/forbidden.png',
|
||||
title: '账户已被禁用',
|
||||
subtitle: '该功能暂不可用',
|
||||
button: '知道了',
|
||||
action: 'back',
|
||||
},
|
||||
// 补充信息
|
||||
103: {
|
||||
image: '/assets/addons/shopro/uniapp/commission/apply.png',
|
||||
title: '待完善信息',
|
||||
subtitle: '请补充您的信息后提交审核',
|
||||
button: '完善信息',
|
||||
action: 'apply',
|
||||
},
|
||||
// 审核中
|
||||
104: {
|
||||
image: '/assets/addons/shopro/uniapp/commission/pending.png',
|
||||
title: '正在审核中',
|
||||
subtitle: '请耐心等候结果',
|
||||
button: '知道了',
|
||||
action: 'back',
|
||||
},
|
||||
// 重新提交
|
||||
105: {
|
||||
image: '/assets/addons/shopro/uniapp/commission/reject.png',
|
||||
title: '抱歉!您的申请信息未通过',
|
||||
subtitle: '请尝试修改后重新提交',
|
||||
button: '重新申请',
|
||||
action: 'apply',
|
||||
},
|
||||
// 直接重新申请
|
||||
106: {
|
||||
image: '/assets/addons/shopro/uniapp/commission/reject.png',
|
||||
title: '抱歉!您的申请未通过',
|
||||
subtitle: '请尝试重新申请',
|
||||
button: '重新申请',
|
||||
action: 'reApply',
|
||||
},
|
||||
// 冻结
|
||||
107: {
|
||||
image: '/assets/addons/shopro/uniapp/commission/freeze.png',
|
||||
title: '抱歉!您的账户已被冻结',
|
||||
subtitle: '如有疑问请联系客服',
|
||||
button: '联系客服',
|
||||
action: 'chat',
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.notice-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
width: 612rpx;
|
||||
min-height: 658rpx;
|
||||
background: #ffffff;
|
||||
padding: 30rpx;
|
||||
border-radius: 20rpx;
|
||||
.img-wrap {
|
||||
margin-bottom: 50rpx;
|
||||
.notice-img {
|
||||
width: 180rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
}
|
||||
.notice-title {
|
||||
font-size: 35rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
.notice-detail {
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
line-height: 36rpx;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
.notice-btn {
|
||||
width: 492rpx;
|
||||
line-height: 70rpx;
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.back-btn {
|
||||
width: 492rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main-gradient);
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<su-popup
|
||||
:show="state.show"
|
||||
type="bottom"
|
||||
round="10"
|
||||
:isMaskClick="false"
|
||||
:backgroundImage="sheep.$url.css('/assets/addons/shopro/uniapp/commission/become-agent.png')"
|
||||
@close="show = false"
|
||||
backgroundColor="var(--ui-BG-Main)"
|
||||
>
|
||||
<view class="model-box ss-flex ss-row-center">
|
||||
<view class="content">
|
||||
<scroll-view
|
||||
class="scroll-box"
|
||||
scroll-y="true"
|
||||
:scroll-with-animation="true"
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view v-if="errorData.type === 'goods'">
|
||||
<view class="item-box ss-m-b-20" v-for="item in errorData.value" :key="item.id">
|
||||
<s-goods-item :title="item.title" :img="item.image" :price="item.price[0]" priceColor="#E1212B" @tap="sheep.$router.go('/pages/goods/index', { id: item.id })">
|
||||
<template #groupon>
|
||||
<view class="item-box-subtitle">{{ item.subtitle }}</view>
|
||||
</template>
|
||||
</s-goods-item>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<s-goods-item
|
||||
title="累计消费满"
|
||||
price=""
|
||||
:img="sheep.$url.static('/assets/addons/shopro/uniapp/commission/consume.png')"
|
||||
v-else-if="errorData.type === 'consume'"
|
||||
>
|
||||
<template #groupon>
|
||||
<view class="ss-flex">
|
||||
<view class="progress-box ss-flex">
|
||||
<view
|
||||
class="progerss-active"
|
||||
:style="{
|
||||
width: state.percent < 10 ? '10%' : state.percent + '%',
|
||||
}"
|
||||
></view>
|
||||
</view>
|
||||
<view class="progress-title ss-m-l-10">{{ errorData.value }}元</view>
|
||||
</view>
|
||||
<view class="progress-title ss-m-t-20">{{ userInfo.total_consume }}元</view>
|
||||
</template>
|
||||
</s-goods-item>
|
||||
</scroll-view>
|
||||
<view class="content-des" v-if="errorData.type === 'goods'"
|
||||
>* 购买指定商品即可成为分销商</view
|
||||
>
|
||||
<view class="content-des" v-else-if="errorData.type === 'consume'"
|
||||
>* 满足累计消费即可成为分销商</view
|
||||
>
|
||||
</view>
|
||||
<button class="ss-reset-button go-btn ui-BG-Main-Gradient" @tap="sheep.$router.back()">
|
||||
返回
|
||||
</button>
|
||||
</view>
|
||||
</su-popup>
|
||||
</template>
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
error: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
errorData: {
|
||||
type: Object,
|
||||
default() {},
|
||||
},
|
||||
});
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
const state = reactive({
|
||||
percent: computed(() => {
|
||||
if (props.errorData.type !== 'consume') {
|
||||
return 0;
|
||||
}
|
||||
let percent = (userInfo.value.total_consume / props.errorData.value) * 100;
|
||||
return parseInt(percent);
|
||||
}),
|
||||
show: false,
|
||||
money: '',
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.error,
|
||||
(error) => {
|
||||
if (error == 100) {
|
||||
state.show = true;
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep() {
|
||||
.ss-goods-item-warp {
|
||||
background-color: #f8f8f8 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.progress-title {
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.progress-box {
|
||||
flex: 1;
|
||||
height: 18rpx;
|
||||
background: #e7e7e7;
|
||||
border-radius: 9rpx;
|
||||
}
|
||||
|
||||
.progerss-active {
|
||||
height: 24rpx;
|
||||
background: linear-gradient(90deg, #ff6000 0%, #fe832a 100%);
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.model-box {
|
||||
padding: 140rpx 40rpx 60rpx 40rpx;
|
||||
height: 916rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
|
||||
.content {
|
||||
height: 720rpx;
|
||||
width: 612rpx;
|
||||
padding-top: 30rpx;
|
||||
// background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
|
||||
.content-des {
|
||||
margin-top: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box {
|
||||
height: 620rpx;
|
||||
}
|
||||
.item-box-subtitle {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.go-btn {
|
||||
width: 600rpx;
|
||||
height: 70rpx;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 120rpx;
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,140 @@
|
||||
<!-- 分销商信息 -->
|
||||
<template>
|
||||
<!-- 用户资料 -->
|
||||
<view class="user-card ss-flex ss-col-bottom">
|
||||
<view class="card-top ss-flex ss-row-between">
|
||||
<view class="ss-flex">
|
||||
<view class="head-img-box">
|
||||
<image class="head-img" :src="sheep.$url.cdn(userInfo.avatar)" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="ss-flex-col">
|
||||
<view class="user-name">{{ userInfo.nickname }}</view>
|
||||
<view class="user-info-box ss-flex ss-col-center ss-flex-wrap">
|
||||
<view class="tag-box ss-flex" v-if="agentInfo.level_info">
|
||||
<image
|
||||
v-if="agentInfo.level_info?.image"
|
||||
class="tag-img"
|
||||
:src="sheep.$url.cdn(agentInfo.level_info?.image)"
|
||||
mode="aspectFill"
|
||||
>
|
||||
</image>
|
||||
<text class="tag-title">{{ agentInfo.level_info?.name }}</text>
|
||||
</view>
|
||||
<view v-if="agentInfo.is_venue || agentInfo.identities?.includes('venue')" class="mini-tag">酒道馆</view>
|
||||
<view v-if="agentInfo.is_county || agentInfo.identities?.includes('county')" class="mini-tag">区县</view>
|
||||
<view class="ss-iconfont uicon-arrow-right" style="color: #fff; font-size: 28rpx">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { computed, reactive } from 'vue';
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
const agentInfo = computed(() => sheep.$store('user').agentInfo);
|
||||
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/commission/background.png');
|
||||
|
||||
const state = reactive({
|
||||
showMoney: false,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 用户资料卡片
|
||||
.user-card {
|
||||
width: 690rpx;
|
||||
min-height: 192rpx;
|
||||
height: auto;
|
||||
margin: -88rpx 20rpx 0 20rpx;
|
||||
padding-top: 88rpx;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
|
||||
.head-img-box {
|
||||
margin-right: 20rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
background: #fce0ad;
|
||||
|
||||
.head-img {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.card-top {
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 34rpx;
|
||||
.user-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #692e04;
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.log-btn {
|
||||
width: 84rpx;
|
||||
height: 42rpx;
|
||||
border: 2rpx solid rgba(#ffffff, 0.33);
|
||||
border-radius: 21rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.look-btn {
|
||||
color: #fff;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.user-info-box {
|
||||
.tag-box {
|
||||
background: #ff6000;
|
||||
border-radius: 18rpx;
|
||||
line-height: 36rpx;
|
||||
|
||||
.tag-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
border-radius: 50%;
|
||||
margin-left: -2rpx;
|
||||
}
|
||||
|
||||
.tag-title {
|
||||
font-size: 24rpx;
|
||||
padding: 0 10rpx;
|
||||
font-weight: 500;
|
||||
line-height: 36rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.mini-tag {
|
||||
margin-left: 8rpx;
|
||||
padding: 0 12rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
border-radius: 18rpx;
|
||||
background: rgba(255, 255, 255, 0.28);
|
||||
font-size: 22rpx;
|
||||
color: #692e04;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,189 @@
|
||||
<!-- 分销明细 -->
|
||||
<template>
|
||||
<view class="distribution-log-wrap">
|
||||
<view class="header-box">
|
||||
<image
|
||||
class="header-bg"
|
||||
:src="sheep.$url.static('/assets/addons/shopro/uniapp/commission/title2.png')"
|
||||
/>
|
||||
<view class="ss-flex header-title">
|
||||
<view class="title">实时动态</view>
|
||||
<text class="cicon-forward"></text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view
|
||||
scroll-y="true"
|
||||
@scrolltolower="loadmore"
|
||||
class="scroll-box log-scroll"
|
||||
scroll-with-animation="true"
|
||||
>
|
||||
<view v-if="state.pagination.data">
|
||||
<view
|
||||
class="log-item-box ss-flex ss-row-between"
|
||||
v-for="item in state.pagination.data"
|
||||
:key="item.id"
|
||||
>
|
||||
<view class="log-item-wrap">
|
||||
<view class="log-item ss-flex ss-ellipsis-1 ss-col-center">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<image
|
||||
v-if="item.oper_type === 'user'"
|
||||
class="log-img"
|
||||
:src="sheep.$url.cdn(item.oper?.avatar)"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image
|
||||
v-else-if="item.oper_type === 'admin'"
|
||||
class="log-img"
|
||||
:src="
|
||||
sheep.$url.static('/assets/addons/shopro/uniapp/avatar/default_user.png')
|
||||
"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image
|
||||
v-else
|
||||
class="log-img"
|
||||
:src="sheep.$url.static('/assets/addons/shopro/uniapp/avatar/notice.png')"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<view class="log-text ss-ellipsis-1">{{ item.remark }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="log-time">{{ dayjs(item.createtime).fromNow() }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
color="#333333"
|
||||
@tap="loadmore"
|
||||
/>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { computed, reactive } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const state = reactive({
|
||||
loadStatus: '',
|
||||
pagination: {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 1,
|
||||
last_page: 1,
|
||||
},
|
||||
});
|
||||
|
||||
async function getLog(page = 1) {
|
||||
const res = await sheep.$api.commission.log({
|
||||
page,
|
||||
});
|
||||
if (res.code === 1) {
|
||||
let list = _.concat(state.pagination.data, res.data.data);
|
||||
state.pagination = {
|
||||
...res.data,
|
||||
data: list,
|
||||
};
|
||||
if (state.pagination.current_page < state.pagination.last_page) {
|
||||
state.loadStatus = 'more';
|
||||
} else {
|
||||
state.loadStatus = 'noMore';
|
||||
}
|
||||
}
|
||||
}
|
||||
getLog();
|
||||
|
||||
// 加载更多
|
||||
function loadmore() {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getLog(state.pagination.current_page + 1);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.distribution-log-wrap {
|
||||
width: 690rpx;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
.header-box {
|
||||
width: 690rpx;
|
||||
height: 76rpx;
|
||||
position: relative;
|
||||
.header-bg {
|
||||
width: 690rpx;
|
||||
height: 76rpx;
|
||||
}
|
||||
.header-title {
|
||||
position: absolute;
|
||||
left: 20rpx;
|
||||
top: 24rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
.cicon-forward {
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
.log-scroll {
|
||||
height: 600rpx;
|
||||
background: #fdfae9;
|
||||
padding: 10rpx 20rpx 0;
|
||||
box-sizing: border-box;
|
||||
border-radius: 0 0 12rpx 12rpx;
|
||||
|
||||
.log-item-box {
|
||||
margin-bottom: 20rpx;
|
||||
.log-time {
|
||||
// margin-left: 30rpx;
|
||||
text-align: right;
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 400;
|
||||
color: #c4c4c4;
|
||||
}
|
||||
}
|
||||
|
||||
.loadmore-wrap {
|
||||
// line-height: 80rpx;
|
||||
}
|
||||
|
||||
.log-item {
|
||||
// background: rgba(#ffffff, 0.2);
|
||||
border-radius: 24rpx;
|
||||
padding: 6rpx 20rpx 6rpx 12rpx;
|
||||
|
||||
.log-img {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.log-text {
|
||||
max-width: 480rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,177 @@
|
||||
<!-- 分销商菜单栏 -->
|
||||
<template>
|
||||
<view class="menu-box ss-flex-col">
|
||||
<view class="header-box">
|
||||
<image class="header-bg" :src="sheep.$url.static('/assets/addons/shopro/uniapp/commission/title1.png')" />
|
||||
<view class="ss-flex header-title">
|
||||
<view class="title">功能专区</view>
|
||||
<text class="cicon-forward"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="menu-list ss-flex ss-flex-wrap">
|
||||
<view
|
||||
v-for="(item, index) in state.menuList"
|
||||
:key="index"
|
||||
class="item-box ss-flex-col ss-col-center"
|
||||
@tap="sheep.$router.go(item.path)"
|
||||
>
|
||||
<image
|
||||
class="menu-icon ss-m-b-10"
|
||||
:src="sheep.$url.static(item.img)"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view>{{ item.title }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <uni-grid :column="4" :showBorder="false" :highlight="false">
|
||||
<uni-grid-item
|
||||
v-for="(item, index) in state.menuList"
|
||||
:index="index"
|
||||
:key="index"
|
||||
@tap="sheep.$router.go(item.path)"
|
||||
>
|
||||
<view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center">
|
||||
<image
|
||||
class="menu-icon ss-m-b-10"
|
||||
:src="sheep.$url.static(item.img)"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<text class="menu-title">{{ item.title }}</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
</uni-grid> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
const allMenus = [
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon1.png',
|
||||
title: '我的团队',
|
||||
path: '/pages/commission/team',
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon2.png',
|
||||
title: '收益明细',
|
||||
path: '/pages/commission/rewards',
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon2.png',
|
||||
title: '我的收益',
|
||||
path: '/pages/user/wallet/commission',
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon3.png',
|
||||
title: '我的马豆',
|
||||
path: '/pages/commission/madow',
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon5.png',
|
||||
title: '兑换券',
|
||||
path: '/pages/commission/voucher',
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon3.png',
|
||||
title: '推广订单',
|
||||
path: '/pages/commission/order',
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon7.png',
|
||||
title: '邀请海报',
|
||||
path: 'action:showShareModal',
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon8.png',
|
||||
title: '分享记录',
|
||||
path: '/pages/commission/share-log',
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon5.png',
|
||||
title: '我的资料',
|
||||
path: '/pages/commission/apply',
|
||||
isAgentFrom: true,
|
||||
},
|
||||
{
|
||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon4.png',
|
||||
title: '推广商品',
|
||||
path: '/pages/commission/goods',
|
||||
hideInPartner: true,
|
||||
},
|
||||
];
|
||||
|
||||
const state = {
|
||||
menuList: computed(() =>
|
||||
allMenus.filter((item) => {
|
||||
if (item.isAgentFrom && !userInfo.value?.agent_form) return false;
|
||||
if (item.hideInPartner && userInfo.value?.partner_mode !== false) return false;
|
||||
return true;
|
||||
}),
|
||||
),
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.menu-box {
|
||||
margin: 0 auto;
|
||||
width: 690rpx;
|
||||
margin-bottom: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
}
|
||||
.header-box {
|
||||
width: 690rpx;
|
||||
height: 76rpx;
|
||||
position: relative;
|
||||
.header-bg {
|
||||
width: 690rpx;
|
||||
height: 76rpx;
|
||||
}
|
||||
.header-title {
|
||||
position: absolute;
|
||||
left: 20rpx;
|
||||
top: 24rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
.cicon-forward {
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-list {
|
||||
padding: 50rpx 0 10rpx 0;
|
||||
background: #fdfae9;
|
||||
border-radius: 0 0 12rpx 12rpx;
|
||||
}
|
||||
.item-box {
|
||||
width: 25%;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
width: 68rpx;
|
||||
height: 68rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.menu-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
137
uniapp/pages/commission/goods.vue
普通文件
137
uniapp/pages/commission/goods.vue
普通文件
@@ -0,0 +1,137 @@
|
||||
<!-- 页面 -->
|
||||
<template>
|
||||
<s-layout title="推广商品" :onShareAppMessage="state.shareInfo">
|
||||
<view class="goods-item ss-m-20" v-for="item in state.pagination.data" :key="item.id">
|
||||
<s-goods-item
|
||||
size="lg"
|
||||
:img="item.image"
|
||||
:title="item.title"
|
||||
:subTitle="item.subtitle"
|
||||
:price="item.price[0]"
|
||||
:originPrice="item.original_price"
|
||||
priceColor="#333"
|
||||
@tap="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
>
|
||||
<template #rightBottom>
|
||||
<view class="ss-flex ss-row-between">
|
||||
<view class="commission-num">预计佣金:¥{{ item.commission }}</view>
|
||||
<button
|
||||
class="ss-reset-button share-btn ui-BG-Main-Gradient"
|
||||
@tap.stop="onShareGoods(item)"
|
||||
>
|
||||
分享赚
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
</s-goods-item>
|
||||
</view>
|
||||
<s-empty
|
||||
v-if="state.pagination.total === 0"
|
||||
icon="/static/goods-empty.png"
|
||||
text="暂无推广商品"
|
||||
></s-empty>
|
||||
<!-- 加载更多 -->
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadmore"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import $share from '@/sheep/platform/share';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { computed, reactive } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import { showShareModal } from '@/sheep/hooks/useModal';
|
||||
|
||||
const state = reactive({
|
||||
pagination: {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 1,
|
||||
last_page: 1,
|
||||
},
|
||||
loadStatus: '',
|
||||
shareInfo: {},
|
||||
});
|
||||
|
||||
function onShareGoods(goodsInfo) {
|
||||
state.shareInfo = $share.getShareInfo(
|
||||
{
|
||||
title: goodsInfo.title,
|
||||
image: sheep.$url.cdn(goodsInfo.image),
|
||||
desc: goodsInfo.subtitle,
|
||||
params: {
|
||||
page: '2',
|
||||
query: goodsInfo.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
title: goodsInfo.title, // 商品标题
|
||||
image: sheep.$url.cdn(goodsInfo.image), // 商品主图
|
||||
price: goodsInfo.price[0], // 商品价格
|
||||
original_price: goodsInfo.original_price, // 商品原价
|
||||
},
|
||||
);
|
||||
showShareModal();
|
||||
}
|
||||
|
||||
async function getGoodsList(page = 1, list_rows = 8) {
|
||||
state.loadStatus = 'loading';
|
||||
let res = await sheep.$api.commission.goods({
|
||||
list_rows,
|
||||
page,
|
||||
});
|
||||
if (res.code === 1) {
|
||||
let orderList = _.concat(state.pagination.data, res.data.data);
|
||||
state.pagination = {
|
||||
...res.data,
|
||||
data: orderList,
|
||||
};
|
||||
if (state.pagination.current_page < state.pagination.last_page) {
|
||||
state.loadStatus = 'more';
|
||||
} else {
|
||||
state.loadStatus = 'noMore';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(async () => {
|
||||
getGoodsList();
|
||||
});
|
||||
|
||||
// 加载更多
|
||||
function loadmore() {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getGoodsList(state.pagination.current_page + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadmore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goods-item {
|
||||
.commission-num {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: $red;
|
||||
}
|
||||
|
||||
.share-btn {
|
||||
width: 120rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
106
uniapp/pages/commission/index.vue
普通文件
106
uniapp/pages/commission/index.vue
普通文件
@@ -0,0 +1,106 @@
|
||||
<!-- 收益中心 -->
|
||||
<template>
|
||||
<s-layout navbar="inner" class="index-wrap" title="收益中心" :bgStyle="bgStyle" onShareAppMessage>
|
||||
<!-- 分销商信息 -->
|
||||
<commission-info />
|
||||
<!-- 30 日活跃警示 -->
|
||||
<view v-if="userInfo.active_30d === false" class="active-warn">
|
||||
<view class="warn-text">近 30 日暂无本人订单,推广与分红已暂停。</view>
|
||||
<button class="ss-reset-button warn-btn" @tap="sheep.$router.go('/pages/index/index')">
|
||||
去首页
|
||||
</button>
|
||||
</view>
|
||||
<!-- 账户信息 -->
|
||||
<account-info />
|
||||
<!-- 菜单栏 -->
|
||||
<commission-menu />
|
||||
<!-- 分销记录 -->
|
||||
<commission-log />
|
||||
<!-- 弹框 -->
|
||||
<commission-condition :error="state.error" :errorData="state.errorData" />
|
||||
|
||||
<!-- 权限 -->
|
||||
<commission-auth :error="state.error" @getAgentInfo="getAgentInfo" />
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import { computed, reactive } from 'vue';
|
||||
import commissionInfo from './components/commission-info.vue';
|
||||
import accountInfo from './components/account-info.vue';
|
||||
import commissionLog from './components/commission-log.vue';
|
||||
import commissionMenu from './components/commission-menu.vue';
|
||||
import commissionAuth from './components/commission-auth.vue';
|
||||
import commissionCondition from './components/commission-condition.vue';
|
||||
|
||||
const state = reactive({
|
||||
error: 0,
|
||||
errorData: {},
|
||||
config: {
|
||||
background: '/storage/default/20220704/29ac76a3c9d0d983200d612e45a052ca.png',
|
||||
},
|
||||
});
|
||||
|
||||
const agentInfo = computed(() => sheep.$store('user').agentInfo);
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
async function getUserInfo() {
|
||||
await sheep.$store('user').getInfo();
|
||||
}
|
||||
|
||||
const bgStyle = {
|
||||
color: '#F7D598',
|
||||
};
|
||||
|
||||
async function getAgentInfo() {
|
||||
const res = await sheep.$store('user').getAgentInfo();
|
||||
if (res?.code !== 1) {
|
||||
state.error = res?.code || 0;
|
||||
state.errorData = res?.data || {};
|
||||
}
|
||||
}
|
||||
onShow(() => {
|
||||
getUserInfo();
|
||||
getAgentInfo();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.page-main) {
|
||||
background-size: 100% 100% !important;
|
||||
}
|
||||
|
||||
.active-warn {
|
||||
width: 694rpx;
|
||||
margin: 0 auto 16rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
background: #fff4e5;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
|
||||
.warn-text {
|
||||
flex: 1;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
color: #a17545;
|
||||
padding-right: 16rpx;
|
||||
}
|
||||
|
||||
.warn-btn {
|
||||
flex-shrink: 0;
|
||||
height: 52rpx;
|
||||
padding: 0 22rpx;
|
||||
background: #ff6000;
|
||||
border-radius: 26rpx;
|
||||
font-size: 22rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
227
uniapp/pages/commission/madow.vue
普通文件
227
uniapp/pages/commission/madow.vue
普通文件
@@ -0,0 +1,227 @@
|
||||
<template>
|
||||
<s-layout class="wallet-wrap" title="我的马豆">
|
||||
<view class="header-box ss-flex ss-row-center ss-col-center">
|
||||
<view class="card-box ui-BG-Main ui-Shadow-Main">
|
||||
<view class="card-head ss-flex ss-col-center">
|
||||
<view class="card-title">马豆数量</view>
|
||||
</view>
|
||||
<view class="money-num ss-m-t-24">{{ state.info.madow || '0' }}</view>
|
||||
<view class="card-sub ss-m-t-16">
|
||||
当前汇率 1 马豆 = {{ state.info.madow_rate || '0' }} 元
|
||||
</view>
|
||||
<view class="card-sub ss-m-t-8">约合 ¥{{ state.info.madow_value || '0.00' }}</view>
|
||||
<view class="help-btn" @tap="state.showHelp = !state.showHelp">说明</view>
|
||||
<view v-if="state.showHelp" class="help-text">
|
||||
汇率随全平台订单增加而上浮,仅作价值展示,不可提现。
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<s-empty
|
||||
v-if="state.inited && state.list.length === 0"
|
||||
icon="/static/data-empty.png"
|
||||
text="完成一笔订单后,次日 00:30 起参与分红。"
|
||||
></s-empty>
|
||||
|
||||
<view v-if="state.list.length > 0">
|
||||
<view class="wallet-list ss-flex border-bottom" v-for="(item, index) in state.list" :key="item.id || index">
|
||||
<view class="list-content">
|
||||
<view class="title-box ss-flex ss-row-between ss-m-b-12">
|
||||
<text class="title">每日分红马豆</text>
|
||||
<view class="money">
|
||||
<text class="add">+{{ item.madow || item.amount || '0' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="desc">
|
||||
{{ item.date || item.createtime || '' }}
|
||||
<text v-if="item.user_count || item.count || item.people">
|
||||
· 当日 {{ item.user_count || item.count || item.people }} 人
|
||||
</text>
|
||||
<text v-if="item.gmv || item.order_money">
|
||||
· GMV {{ item.gmv || item.order_money }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-load-more
|
||||
v-if="state.list.length > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import _ from 'lodash';
|
||||
|
||||
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/user/wallet_card_bg.png');
|
||||
|
||||
const state = reactive({
|
||||
info: {
|
||||
madow: sheep.$store('user').userInfo?.madow || '0',
|
||||
madow_rate: sheep.$store('user').userInfo?.madow_rate || '0',
|
||||
madow_value: sheep.$store('user').userInfo?.madow_value || '0.00',
|
||||
},
|
||||
list: [],
|
||||
inited: false,
|
||||
page: 1,
|
||||
lastPage: 1,
|
||||
loadStatus: '',
|
||||
showHelp: false,
|
||||
});
|
||||
|
||||
function pickList(payload) {
|
||||
if (!payload) return [];
|
||||
if (Array.isArray(payload)) return payload;
|
||||
if (Array.isArray(payload.list)) return payload.list;
|
||||
if (Array.isArray(payload.list?.data)) return payload.list.data;
|
||||
if (Array.isArray(payload.data)) return payload.data;
|
||||
return [];
|
||||
}
|
||||
|
||||
async function getMadow(page = 1) {
|
||||
state.loadStatus = 'loading';
|
||||
try {
|
||||
const res = await sheep.$api.partner.madow({ page });
|
||||
if (res?.code === 1) {
|
||||
const data = res.data || {};
|
||||
state.info.madow = data.madow ?? state.info.madow;
|
||||
state.info.madow_rate = data.madow_rate ?? state.info.madow_rate;
|
||||
state.info.madow_value = data.madow_value ?? state.info.madow_value;
|
||||
const list = pickList(data);
|
||||
state.list = page === 1 ? list : _.concat(state.list, list);
|
||||
state.page = data.list?.current_page || data.current_page || page;
|
||||
state.lastPage = data.list?.last_page || data.last_page || 1;
|
||||
state.loadStatus = state.page < state.lastPage ? 'more' : 'noMore';
|
||||
state.inited = true;
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
if (page === 1) {
|
||||
state.list = [];
|
||||
}
|
||||
state.loadStatus = 'noMore';
|
||||
state.inited = true;
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
getMadow();
|
||||
});
|
||||
|
||||
onPullDownRefresh(async () => {
|
||||
await getMadow(1);
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
|
||||
onReachBottom(() => {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getMadow(state.page + 1);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-box {
|
||||
background-color: $white;
|
||||
padding: 30rpx;
|
||||
|
||||
.card-box {
|
||||
width: 100%;
|
||||
min-height: 280rpx;
|
||||
padding: 40rpx;
|
||||
border-radius: 30rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card-head,
|
||||
.card-title,
|
||||
.money-num,
|
||||
.card-sub,
|
||||
.help-btn,
|
||||
.help-text {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.money-num {
|
||||
font-size: 40rpx;
|
||||
font-weight: 500;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.card-sub {
|
||||
font-size: 24rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.help-btn {
|
||||
margin-top: 20rpx;
|
||||
font-size: 22rpx;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.help-text {
|
||||
margin-top: 12rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 34rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wallet-list {
|
||||
padding: 30rpx;
|
||||
background-color: #ffffff;
|
||||
|
||||
.list-content {
|
||||
flex: 1;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: $dark-3;
|
||||
}
|
||||
|
||||
.desc {
|
||||
color: $gray-c;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.money {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
.add {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
418
uniapp/pages/commission/order.vue
普通文件
418
uniapp/pages/commission/order.vue
普通文件
@@ -0,0 +1,418 @@
|
||||
<!-- 分销订单 -->
|
||||
<template>
|
||||
<s-layout title="推广订单" :class="state.scrollTop ? 'order-warp' : ''" navbar="inner">
|
||||
<view
|
||||
class="header-box"
|
||||
:style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
|
||||
paddingTop: Number(statusBarHeight + 108) + 'rpx',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<!-- 团队数据总览 -->
|
||||
<view class="team-data-box ss-flex ss-col-center ss-row-between">
|
||||
<view class="data-card">
|
||||
<view class="total-item">
|
||||
<view class="item-title">团队订单数量(单)</view>
|
||||
<view class="total-num">
|
||||
{{ state.agentInfo.child_order_count_all || 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="category-item ss-flex">
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">一级订单</view>
|
||||
<view class="category-num">
|
||||
{{ state.agentInfo.child_order_count_1 || 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">二级订单</view>
|
||||
<view class="category-num">
|
||||
{{ state.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">
|
||||
{{ state.agentInfo.child_order_money_all || '0.00' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="category-item ss-flex">
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">一级订单</view>
|
||||
<view class="category-num">
|
||||
{{ state.agentInfo.child_order_money_1 || '0.00' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">二级订单</view>
|
||||
<view class="category-num">
|
||||
{{ state.agentInfo.child_order_money_2 || '0.00' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 自购 -->
|
||||
<view class="direct-box ss-flex ss-row-between">
|
||||
<view class="direct-item">
|
||||
<view class="item-title">自购分销订单数量(单)</view>
|
||||
<view class="item-value">
|
||||
{{ state.agentInfo.child_order_count_0 || 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="direct-item">
|
||||
<view class="item-title">自购分销订单金额(元)</view>
|
||||
<view class="item-value">
|
||||
{{ state.agentInfo.child_order_money_0 || '0.00' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- tab -->
|
||||
<su-sticky bgColor="#fff">
|
||||
<su-tabs
|
||||
:list="tabMaps"
|
||||
:scrollable="false"
|
||||
:current="state.currentTab"
|
||||
@change="onTabsChange"
|
||||
>
|
||||
</su-tabs>
|
||||
</su-sticky>
|
||||
|
||||
<!-- 订单 -->
|
||||
<view class="order-box">
|
||||
<view class="order-item" v-for="item in state.pagination.data" :key="item.id">
|
||||
<view class="order-header">
|
||||
<view class="no-box ss-flex ss-col-center ss-row-between">
|
||||
<text class="order-code">订单编号:{{ item.order.order_sn }}</text>
|
||||
<text class="order-state">{{ item.order_item.status_text }}</text>
|
||||
</view>
|
||||
<view class="order-from ss-flex ss-col-center ss-row-between">
|
||||
<view class="from-user ss-flex ss-col-center">
|
||||
<text>下单人:</text>
|
||||
<image class="user-avatar" :src="sheep.$url.cdn(item.buyer.avatar)" mode="aspectFill">
|
||||
</image>
|
||||
<text class="user-name">{{ item.buyer.nickname }}</text>
|
||||
</view>
|
||||
<view class="order-time">{{ item.createtime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<s-goods-item
|
||||
class="border-bottom"
|
||||
:img="item.order_item.goods_image"
|
||||
:title="item.order_item.goods_title"
|
||||
:skuText="item.order_item.goods_sku_text"
|
||||
:price="item.order_item.goods_price"
|
||||
:num="item.order_item.goods_num"
|
||||
>
|
||||
<template #rightBottom>
|
||||
<view class="ss-flex commission-box ss-row-between ss-m-t-10">
|
||||
<view class="ss-flex" v-if="Number(item.partner_amount) > 0">
|
||||
<text class="name">本单收益:</text>
|
||||
<text class="commission-num">¥{{ item.partner_amount }}</text>
|
||||
</view>
|
||||
<view class="order-status">
|
||||
{{ item.commission_order_status_text }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</s-goods-item>
|
||||
</view>
|
||||
<!-- 数据为空 -->
|
||||
<s-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单">
|
||||
</s-empty>
|
||||
<!-- 加载更多 -->
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadmore"
|
||||
/>
|
||||
</view>
|
||||
<!-- </view> -->
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { computed, reactive } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import { onPageScroll } from '@dcloudio/uni-app';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/user/withdraw_bg.png');
|
||||
|
||||
onPageScroll((e) => {
|
||||
if (e.scrollTop > 100) {
|
||||
state.scrollTop = false;
|
||||
} else {
|
||||
state.scrollTop = true;
|
||||
}
|
||||
});
|
||||
|
||||
const state = reactive({
|
||||
pagination: {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 1,
|
||||
last_page: 1,
|
||||
},
|
||||
loadStatus: '',
|
||||
currentTab: 0,
|
||||
agentInfo: {},
|
||||
scrollTop: false,
|
||||
});
|
||||
|
||||
const tabMaps = [
|
||||
{
|
||||
name: '全部',
|
||||
value: 'all',
|
||||
},
|
||||
// {
|
||||
// name: '不计入',
|
||||
// value: 'no'
|
||||
// },
|
||||
{
|
||||
name: '已计入',
|
||||
value: 'yes',
|
||||
},
|
||||
{
|
||||
name: '已扣除',
|
||||
value: 'back',
|
||||
},
|
||||
{
|
||||
name: '已取消',
|
||||
value: 'cancel',
|
||||
},
|
||||
];
|
||||
// 切换选项卡
|
||||
function onTabsChange(e) {
|
||||
state.pagination = {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 1,
|
||||
last_page: 1,
|
||||
};
|
||||
state.currentTab = e.index;
|
||||
getOrderList();
|
||||
}
|
||||
|
||||
// 获取订单列表
|
||||
async function getOrderList(page = 1, list_rows = 5) {
|
||||
state.loadStatus = 'loading';
|
||||
let res = await sheep.$api.commission.order({
|
||||
type: tabMaps[state.currentTab].value,
|
||||
list_rows,
|
||||
page,
|
||||
});
|
||||
if (res.code === 1) {
|
||||
let orderList = _.concat(state.pagination.data, res.data.data);
|
||||
state.pagination = {
|
||||
...res.data,
|
||||
data: orderList,
|
||||
};
|
||||
if (state.pagination.current_page < state.pagination.last_page) {
|
||||
state.loadStatus = 'more';
|
||||
} else {
|
||||
state.loadStatus = 'noMore';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function getAgentInfo() {
|
||||
const { code, data, msg } = await sheep.$api.commission.agent();
|
||||
if (code === 1) {
|
||||
state.agentInfo = data;
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
getAgentInfo();
|
||||
getOrderList();
|
||||
});
|
||||
|
||||
// 加载更多
|
||||
function loadmore() {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getOrderList(state.pagination.current_page + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadmore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-box {
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx 20rpx 20rpx;
|
||||
width: 750rpx;
|
||||
background: v-bind(headerBg) no-repeat,
|
||||
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
background-size: 750rpx 100%;
|
||||
// 团队信息总览
|
||||
.team-data-box {
|
||||
.data-card {
|
||||
width: 305rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
|
||||
.total-item {
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
.item-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
line-height: normal;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.total-num {
|
||||
font-size: 38rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
|
||||
.category-num {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 直推
|
||||
.direct-box {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.direct-item {
|
||||
width: 340rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.item-title {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.item-value {
|
||||
font-size: 38rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单
|
||||
.order-box {
|
||||
.order-item {
|
||||
background: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
margin: 20rpx;
|
||||
|
||||
.order-footer {
|
||||
padding: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.order-header {
|
||||
.no-box {
|
||||
padding: 20rpx;
|
||||
|
||||
.order-code {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.order-state {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
|
||||
.order-from {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.commission-box {
|
||||
.name {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.commission-num {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: $red;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 22rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-status {
|
||||
line-height: 30rpx;
|
||||
padding: 0 10rpx;
|
||||
border-radius: 30rpx;
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
341
uniapp/pages/commission/rewards.vue
普通文件
341
uniapp/pages/commission/rewards.vue
普通文件
@@ -0,0 +1,341 @@
|
||||
<template>
|
||||
<s-layout class="wallet-wrap" title="收益明细">
|
||||
<view class="header-box ss-flex ss-row-center ss-col-center">
|
||||
<view class="card-box ui-BG-Main ui-Shadow-Main">
|
||||
<view class="card-head ss-flex ss-col-center">
|
||||
<view class="card-title">本月已入账现金(元)</view>
|
||||
</view>
|
||||
<view class="money-num ss-m-t-24">{{ state.overview.month_income || '0.00' }}</view>
|
||||
<view class="card-sub ss-m-t-20">
|
||||
本月未发放 {{ state.overview.skip_count || 0 }} 笔
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<su-sticky>
|
||||
<su-tabs
|
||||
:list="tabMaps"
|
||||
@change="onChangeTab"
|
||||
:scrollable="true"
|
||||
:current="state.currentTab"
|
||||
></su-tabs>
|
||||
</su-sticky>
|
||||
|
||||
<s-empty
|
||||
v-if="state.inited && state.pagination.total === 0"
|
||||
icon="/static/data-empty.png"
|
||||
text="暂无收益记录,邀请好友下单后将在此展示。"
|
||||
></s-empty>
|
||||
|
||||
<view v-if="state.pagination.total > 0">
|
||||
<view
|
||||
class="wallet-list ss-flex border-bottom"
|
||||
v-for="item in state.pagination.data"
|
||||
:key="item.id || item.createtime"
|
||||
@tap="onOpenDetail(item)"
|
||||
>
|
||||
<view class="list-content">
|
||||
<view class="title-box ss-flex ss-row-between ss-m-b-12">
|
||||
<text class="title ss-line-1">{{ item.reward_type_text || item.reward_type || '收益' }}</text>
|
||||
<view class="money">
|
||||
<text :class="Number(item.amount) >= 0 ? 'add' : 'minus'">
|
||||
{{ formatAmount(item.amount) }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="desc ss-line-1">
|
||||
来自 {{ item.buyer_nickname || '好友' }}
|
||||
<text v-if="item.order_id"> · 订单 {{ item.order_id }}</text>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between ss-m-t-8">
|
||||
<text class="time">{{ item.createtime || '' }}</text>
|
||||
<text class="status-text">{{ item.status_text || '' }}</text>
|
||||
</view>
|
||||
<view v-if="item.skip_reason_text" class="skip-text ss-m-t-8">
|
||||
{{ item.skip_reason_text }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
/>
|
||||
|
||||
<su-popup :show="state.showDetail" type="bottom" round="20" @close="state.showDetail = false" showClose>
|
||||
<view class="ss-p-x-30 ss-p-y-30" v-if="state.current">
|
||||
<view class="model-title ss-m-b-20">{{ state.current.reward_type_text || '收益详情' }}</view>
|
||||
<view class="detail-row ss-m-b-12">
|
||||
金额:{{ state.current.amount || '0.00' }}
|
||||
</view>
|
||||
<view class="detail-row ss-m-b-12">
|
||||
状态:{{ state.current.status_text || '--' }}
|
||||
</view>
|
||||
<view class="detail-row ss-m-b-12" v-if="state.current.buyer_nickname">
|
||||
来自:{{ state.current.buyer_nickname }}
|
||||
</view>
|
||||
<view class="detail-row ss-m-b-12" v-if="state.current.order_id">
|
||||
订单:{{ state.current.order_id }}
|
||||
</view>
|
||||
<view class="detail-row ss-m-b-12" v-if="state.current.createtime">
|
||||
时间:{{ state.current.createtime }}
|
||||
</view>
|
||||
<view class="detail-row ss-m-b-12" v-if="state.current.formula">
|
||||
公式:{{ state.current.formula }}
|
||||
</view>
|
||||
<view class="skip-text" v-if="state.current.skip_reason_text">
|
||||
{{ state.current.skip_reason_text }}
|
||||
</view>
|
||||
</view>
|
||||
</su-popup>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import _ from 'lodash';
|
||||
|
||||
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/user/wallet_card_bg.png');
|
||||
|
||||
const tabMaps = [
|
||||
{ name: '全部', value: 'all' },
|
||||
{ name: '推三返一', value: 'push3' },
|
||||
{ name: '创客', value: 'maker' },
|
||||
{ name: '酒道馆', value: 'venue' },
|
||||
{ name: '区县', value: 'county' },
|
||||
{ name: '均分', value: 'share' },
|
||||
];
|
||||
|
||||
const emptyPagination = {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 0,
|
||||
last_page: 1,
|
||||
};
|
||||
|
||||
const state = reactive({
|
||||
currentTab: 0,
|
||||
inited: false,
|
||||
pagination: { ...emptyPagination },
|
||||
loadStatus: '',
|
||||
showDetail: false,
|
||||
current: null,
|
||||
overview: {
|
||||
month_income: '0.00',
|
||||
skip_count: 0,
|
||||
},
|
||||
});
|
||||
|
||||
function formatAmount(amount) {
|
||||
const value = Number(amount);
|
||||
if (Number.isNaN(value)) return amount || '0.00';
|
||||
return value >= 0 ? `+${amount}` : `${amount}`;
|
||||
}
|
||||
|
||||
function pickList(payload) {
|
||||
if (!payload) return { ...emptyPagination };
|
||||
if (Array.isArray(payload)) {
|
||||
return { data: payload, current_page: 1, last_page: 1, total: payload.length };
|
||||
}
|
||||
const listWrap = payload.list || payload;
|
||||
const data = listWrap?.data || payload.data || [];
|
||||
return {
|
||||
data: Array.isArray(data) ? data : [],
|
||||
current_page: listWrap?.current_page || payload.current_page || 1,
|
||||
last_page: listWrap?.last_page || payload.last_page || 1,
|
||||
total: listWrap?.total ?? payload.total ?? (Array.isArray(data) ? data.length : 0),
|
||||
};
|
||||
}
|
||||
|
||||
async function getOverview() {
|
||||
try {
|
||||
const res = await sheep.$api.partner.overview();
|
||||
if (res?.code === 1) {
|
||||
state.overview.month_income = res.data?.month_income || '0.00';
|
||||
state.overview.skip_count = res.data?.skip_count || 0;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function getLogList(page = 1, list_rows = 10) {
|
||||
state.loadStatus = 'loading';
|
||||
try {
|
||||
const res = await sheep.$api.partner.rewards({
|
||||
tab: tabMaps[state.currentTab]?.value || 'all',
|
||||
page,
|
||||
list_rows,
|
||||
});
|
||||
if (res?.code === 1) {
|
||||
const pageData = pickList(res.data);
|
||||
state.pagination = {
|
||||
...pageData,
|
||||
data: page === 1 ? pageData.data : _.concat(state.pagination.data, pageData.data),
|
||||
};
|
||||
if (res.data?.month_income !== undefined) {
|
||||
state.overview.month_income = res.data.month_income;
|
||||
}
|
||||
if (res.data?.skip_count !== undefined) {
|
||||
state.overview.skip_count = res.data.skip_count;
|
||||
}
|
||||
state.loadStatus =
|
||||
state.pagination.current_page < state.pagination.last_page ? 'more' : 'noMore';
|
||||
state.inited = true;
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
if (page === 1) {
|
||||
state.pagination = { ...emptyPagination };
|
||||
}
|
||||
state.loadStatus = 'noMore';
|
||||
state.inited = true;
|
||||
}
|
||||
|
||||
function onChangeTab(e) {
|
||||
state.currentTab = e.index;
|
||||
state.pagination = { ...emptyPagination };
|
||||
getLogList();
|
||||
}
|
||||
|
||||
function onOpenDetail(item) {
|
||||
state.current = item || {};
|
||||
state.showDetail = true;
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
getOverview();
|
||||
getLogList();
|
||||
});
|
||||
|
||||
onPullDownRefresh(async () => {
|
||||
state.pagination = { ...emptyPagination };
|
||||
await Promise.all([getOverview(), getLogList(1)]);
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
|
||||
onReachBottom(() => {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getLogList(state.pagination.current_page + 1);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-box {
|
||||
background-color: $white;
|
||||
padding: 30rpx;
|
||||
|
||||
.card-box {
|
||||
width: 100%;
|
||||
min-height: 220rpx;
|
||||
padding: 40rpx;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 30rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card-head,
|
||||
.card-title,
|
||||
.money-num,
|
||||
.card-sub {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.money-num {
|
||||
font-size: 40rpx;
|
||||
font-weight: 500;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.card-sub {
|
||||
font-size: 24rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wallet-list {
|
||||
padding: 30rpx;
|
||||
background-color: #ffffff;
|
||||
|
||||
.list-content {
|
||||
flex: 1;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: $dark-3;
|
||||
width: 400rpx;
|
||||
}
|
||||
|
||||
.desc,
|
||||
.time,
|
||||
.status-text {
|
||||
color: $gray-c;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.skip-text {
|
||||
font-size: 22rpx;
|
||||
color: #c48a3a;
|
||||
}
|
||||
}
|
||||
|
||||
.money {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
.add {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
|
||||
.minus {
|
||||
color: $dark-3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.model-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.detail-row {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.skip-text {
|
||||
font-size: 24rpx;
|
||||
color: #c48a3a;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,173 @@
|
||||
<!-- 分销记录 -->
|
||||
<template>
|
||||
<s-layout title="分享记录">
|
||||
<view class="distraction-share-wrap">
|
||||
<view class="share-log-box">
|
||||
<!-- 分享记录列表 -->
|
||||
<view class="log-list ss-flex" v-for="item in state.pagination.data" :key="item.id">
|
||||
<view class="log-avatar-wrap">
|
||||
<image
|
||||
class="log-avatar"
|
||||
:src="sheep.$url.cdn(item.user?.avatar)"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
|
||||
<view class="item-right">
|
||||
<view class="name">{{ item.user?.nickname }}</view>
|
||||
<view class="content ss-flex">
|
||||
<view v-if="item.ext?.image" class="content-img-wrap">
|
||||
<image class="content-img" :src="sheep.$url.cdn(item.ext?.image)" mode="aspectFill">
|
||||
</image>
|
||||
</view>
|
||||
|
||||
<view v-if="item.ext?.memo" class="content-text">
|
||||
{{ item.ext?.memo }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-bottom ss-flex ss-row-between">
|
||||
<view class="from-text"></view>
|
||||
<view class="time">{{ dayjs(item.createtime).fromNow() }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<s-empty
|
||||
v-if="state.pagination.total === 0"
|
||||
icon="/static/data-empty.png"
|
||||
text="暂无分享记录"
|
||||
>
|
||||
</s-empty>
|
||||
<!-- 加载更多 -->
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadmore"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { computed, reactive } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const state = reactive({
|
||||
pagination: {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 1,
|
||||
last_page: 1,
|
||||
},
|
||||
loadStatus: '',
|
||||
});
|
||||
|
||||
async function getShareLog(page = 1, list_rows = 8) {
|
||||
state.loadStatus = 'loading';
|
||||
let res = await sheep.$api.user.share.list({
|
||||
list_rows,
|
||||
page,
|
||||
});
|
||||
if (res.code === 1) {
|
||||
let orderList = _.concat(state.pagination.data, res.data.data);
|
||||
state.pagination = {
|
||||
...res.data,
|
||||
data: orderList,
|
||||
};
|
||||
if (state.pagination.current_page < state.pagination.last_page) {
|
||||
state.loadStatus = 'more';
|
||||
} else {
|
||||
state.loadStatus = 'noMore';
|
||||
}
|
||||
}
|
||||
}
|
||||
// 加载更多
|
||||
function loadmore() {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getShareLog(state.pagination.current_page + 1);
|
||||
}
|
||||
}
|
||||
onLoad(async () => {
|
||||
getShareLog();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.share-log-box {
|
||||
// 分享记录列表
|
||||
.log-list {
|
||||
background-color: #fff;
|
||||
padding: 30rpx;
|
||||
margin: 10rpx 0;
|
||||
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: #7f7aa5;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
background: rgba(241, 241, 241, 0.46);
|
||||
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: #c8c8c8;
|
||||
}
|
||||
|
||||
.from-text {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #c8c8c8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
313
uniapp/pages/commission/team.vue
普通文件
313
uniapp/pages/commission/team.vue
普通文件
@@ -0,0 +1,313 @@
|
||||
<!-- 页面 -->
|
||||
<template>
|
||||
<s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
|
||||
<view
|
||||
class="header-box"
|
||||
:style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
|
||||
paddingTop: Number(statusBarHeight + 108) + 'rpx',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<!-- 推荐人 -->
|
||||
<view v-if="userInfo.parent_user" class="referrer-box ss-flex ss-col-center">
|
||||
推荐人:
|
||||
<image
|
||||
class="referrer-avatar ss-m-r-10"
|
||||
:src="sheep.$url.cdn(userInfo.parent_user.avatar)"
|
||||
mode="aspectFill"
|
||||
>
|
||||
</image>
|
||||
{{ userInfo.parent_user.nickname }}
|
||||
</view>
|
||||
<!-- 团队数据总览 -->
|
||||
<view class="team-data-box ss-flex ss-col-center ss-row-between">
|
||||
<view class="data-card">
|
||||
<view class="total-item">
|
||||
<view class="item-title">团队总人数(人)</view>
|
||||
<view class="total-num">{{ headerNum('child_user_count_all') }}</view>
|
||||
</view>
|
||||
<view class="category-item ss-flex">
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">一级成员</view>
|
||||
<view class="category-num">{{ headerNum('child_user_count_1') }}</view>
|
||||
</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">二级成员</view>
|
||||
<view class="category-num">{{ headerNum('child_user_count_2') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="data-card">
|
||||
<view class="total-item">
|
||||
<view class="item-title">团队合伙股东人数(人)</view>
|
||||
<view class="total-num">{{ headerNum('child_agent_count_all') }}</view>
|
||||
</view>
|
||||
<view class="category-item ss-flex">
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">一级成员</view>
|
||||
<view class="category-num">{{ headerNum('child_agent_count_1') }}</view>
|
||||
</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">二级成员</view>
|
||||
<view class="category-num">{{ headerNum('child_agent_count_2') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="list-box">
|
||||
<uni-list :border="false">
|
||||
<uni-list-chat
|
||||
v-for="item in state.pagination.data"
|
||||
:key="item.id"
|
||||
:avatar-circle="true"
|
||||
:title="item.nickname"
|
||||
:avatar="sheep.$url.cdn(item.avatar)"
|
||||
:note="filterUserNum(item.agent?.child_user_count_1)"
|
||||
>
|
||||
<view class="chat-custom-right">
|
||||
<view class="ss-flex ss-col-center ss-row-right tag-row">
|
||||
<view v-if="memberLevelName(item)" class="tag-box ss-flex ss-col-center">
|
||||
<image
|
||||
v-if="item.agent?.level_info?.image"
|
||||
class="tag-img"
|
||||
:src="sheep.$url.cdn(item.agent.level_info.image)"
|
||||
mode="aspectFill"
|
||||
>
|
||||
</image>
|
||||
<text class="tag-title">{{ memberLevelName(item) }}</text>
|
||||
</view>
|
||||
<view v-if="item.agent?.is_venue || item.agent?.identities?.includes('venue')" class="mini-tag">馆</view>
|
||||
<view v-if="item.agent?.is_county || item.agent?.identities?.includes('county')" class="mini-tag">县</view>
|
||||
</view>
|
||||
|
||||
<text class="time-text">{{ item.createtime }}</text>
|
||||
</view>
|
||||
</uni-list-chat>
|
||||
</uni-list>
|
||||
</view>
|
||||
<s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无团队信息">
|
||||
</s-empty>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onShow, onReachBottom, onPullDownRefresh, onPageScroll } from '@dcloudio/uni-app';
|
||||
import { computed, reactive } from 'vue';
|
||||
import _ from 'lodash';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const agentInfo = computed(() => sheep.$store('user').agentInfo);
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/user/withdraw_bg.png');
|
||||
|
||||
onPageScroll((e) => {
|
||||
if (e.scrollTop > 100) {
|
||||
state.scrollTop = false;
|
||||
} else {
|
||||
state.scrollTop = true;
|
||||
}
|
||||
});
|
||||
const state = reactive({
|
||||
pagination: {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 0,
|
||||
last_page: 1,
|
||||
},
|
||||
loadStatus: '',
|
||||
});
|
||||
|
||||
function headerNum(field) {
|
||||
const stored = Number(agentInfo.value?.[field] || 0);
|
||||
if (stored > 0) {
|
||||
return stored;
|
||||
}
|
||||
const listTotal = Number(state.pagination.total || 0);
|
||||
if (
|
||||
listTotal > 0 &&
|
||||
['child_user_count_1', 'child_user_count_all', 'child_agent_count_1', 'child_agent_count_all'].includes(field)
|
||||
) {
|
||||
return listTotal;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function memberLevelName(item) {
|
||||
return (
|
||||
item?.agent?.level_info?.name ||
|
||||
item?.agent?.maker_level_name ||
|
||||
item?.agent?.identity_text ||
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
function filterUserNum(num) {
|
||||
if (_.isNil(num)) {
|
||||
return '直推 0 人';
|
||||
}
|
||||
return `直推 ${num} 人`;
|
||||
}
|
||||
|
||||
async function getTeamList(page = 1, list_rows = 16) {
|
||||
state.loadStatus = 'loading';
|
||||
let res = await sheep.$api.commission.team({
|
||||
list_rows,
|
||||
page,
|
||||
});
|
||||
if (res.code === 1) {
|
||||
const rows = res.data?.data || [];
|
||||
state.pagination = {
|
||||
...res.data,
|
||||
data: page === 1 ? rows : _.concat(state.pagination.data, rows),
|
||||
};
|
||||
if (state.pagination.current_page < state.pagination.last_page) {
|
||||
state.loadStatus = 'more';
|
||||
} else {
|
||||
state.loadStatus = 'noMore';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshHeader() {
|
||||
await Promise.all([sheep.$store('user').getAgentInfo(), sheep.$store('user').getInfo()]);
|
||||
}
|
||||
|
||||
async function refreshPage() {
|
||||
await Promise.all([refreshHeader(), getTeamList(1)]);
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
refreshPage();
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
refreshHeader();
|
||||
});
|
||||
|
||||
onPullDownRefresh(async () => {
|
||||
await refreshPage();
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
|
||||
onReachBottom(() => {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getTeamList(state.pagination.current_page + 1);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-box {
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx 20rpx 20rpx;
|
||||
width: 750rpx;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
background: v-bind(headerBg) no-repeat,
|
||||
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
background-size: 750rpx 100%;
|
||||
// 团队信息总览
|
||||
.team-data-box {
|
||||
.data-card {
|
||||
width: 305rpx;
|
||||
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: 30rpx;
|
||||
}
|
||||
|
||||
.total-num {
|
||||
font-size: 38rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.category-num {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.list-box {
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
}
|
||||
.chat-custom-right {
|
||||
.time-text {
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.tag-row {
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.mini-tag {
|
||||
margin-left: 8rpx;
|
||||
padding: 0 10rpx;
|
||||
height: 32rpx;
|
||||
line-height: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #c48a3a;
|
||||
font-size: 18rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border-radius: 21rpx;
|
||||
line-height: 30rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
min-width: 120rpx;
|
||||
width: auto;
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 推荐人
|
||||
.referrer-box {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
padding: 20rpx;
|
||||
|
||||
.referrer-avatar {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
282
uniapp/pages/commission/voucher.vue
普通文件
282
uniapp/pages/commission/voucher.vue
普通文件
@@ -0,0 +1,282 @@
|
||||
<template>
|
||||
<s-layout class="wallet-wrap" title="兑换券">
|
||||
<view class="header-box ss-flex ss-row-center ss-col-center">
|
||||
<view class="card-box ui-BG-Main ui-Shadow-Main">
|
||||
<view class="metric-grid">
|
||||
<view class="metric-item">
|
||||
<view class="metric-label">累计获得</view>
|
||||
<view class="metric-value">{{ state.info.voucher_total || '0.00' }}</view>
|
||||
</view>
|
||||
<view class="metric-item">
|
||||
<view class="metric-label">已释放</view>
|
||||
<view class="metric-value">{{ state.info.voucher_released || '0.00' }}</view>
|
||||
</view>
|
||||
<view class="metric-item">
|
||||
<view class="metric-label">已使用</view>
|
||||
<view class="metric-value">{{ state.info.voucher_used || '0.00' }}</view>
|
||||
</view>
|
||||
<view class="metric-item">
|
||||
<view class="metric-label">可用</view>
|
||||
<view class="metric-value">{{ state.info.voucher_available || '0.00' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="progress-text">第 {{ state.progress.current || 0 }} / {{ state.progress.total || 365 }} 天</view>
|
||||
<view class="progress-bar">
|
||||
<view class="progress-inner" :style="{ width: progressWidth }"></view>
|
||||
</view>
|
||||
<button class="ss-reset-button exchange-btn" @tap="sheep.$router.go('/pages/index/index')">
|
||||
去兑换
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<s-empty
|
||||
v-if="state.inited && state.plans.length === 0"
|
||||
icon="/static/data-empty.png"
|
||||
text="下单后将获得 1.5 倍兑换券,分 365 天释放。"
|
||||
></s-empty>
|
||||
|
||||
<view v-if="state.plans.length > 0">
|
||||
<view class="wallet-list border-bottom" v-for="(item, index) in state.plans" :key="item.id || index">
|
||||
<view class="title-box ss-flex ss-row-between ss-m-b-12">
|
||||
<text class="title">订单 {{ item.order_sn || item.order_id || '--' }}</text>
|
||||
<text class="money">总额 {{ item.total || item.voucher_total || '0.00' }}</text>
|
||||
</view>
|
||||
<view class="desc ss-m-b-16">
|
||||
已释放 {{ item.released || item.voucher_released || '0.00' }} · 可用
|
||||
{{ item.available || item.voucher_available || '0.00' }} · 已用
|
||||
{{ item.used || item.voucher_used || '0.00' }}
|
||||
</view>
|
||||
<view class="progress-bar">
|
||||
<view class="progress-inner dark" :style="{ width: planProgress(item) }"></view>
|
||||
</view>
|
||||
<view class="desc ss-m-t-8">
|
||||
{{ planDay(item) }} / {{ planTotal(item) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive } from 'vue';
|
||||
import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/user/wallet_card_bg.png');
|
||||
const userInfo = sheep.$store('user').userInfo || {};
|
||||
const agentInfo = sheep.$store('user').agentInfo || {};
|
||||
|
||||
const state = reactive({
|
||||
info: {
|
||||
voucher_total: agentInfo.voucher_total || '0.00',
|
||||
voucher_released: agentInfo.voucher_released || '0.00',
|
||||
voucher_used: agentInfo.voucher_used || '0.00',
|
||||
voucher_available: agentInfo.voucher_available || userInfo.voucher_available || '0.00',
|
||||
},
|
||||
plans: [],
|
||||
inited: false,
|
||||
progress: {
|
||||
current: 0,
|
||||
total: 365,
|
||||
},
|
||||
});
|
||||
|
||||
const progressWidth = computed(() => {
|
||||
const total = Number(state.progress.total) || 365;
|
||||
const current = Number(state.progress.current) || 0;
|
||||
const percent = Math.min(100, Math.max(0, (current / total) * 100));
|
||||
return `${percent}%`;
|
||||
});
|
||||
|
||||
function planDay(item = {}) {
|
||||
return item.day || item.released_days || item.current_day || 0;
|
||||
}
|
||||
|
||||
function planTotal(item = {}) {
|
||||
return item.days || item.total_days || 365;
|
||||
}
|
||||
|
||||
function planProgress(item = {}) {
|
||||
const total = Number(planTotal(item)) || 365;
|
||||
const current = Number(planDay(item)) || 0;
|
||||
return `${Math.min(100, Math.max(0, (current / total) * 100))}%`;
|
||||
}
|
||||
|
||||
function pickPlans(payload) {
|
||||
if (!payload) return [];
|
||||
if (Array.isArray(payload.plans)) return payload.plans;
|
||||
if (Array.isArray(payload.list)) return payload.list;
|
||||
if (Array.isArray(payload.data)) return payload.data;
|
||||
return [];
|
||||
}
|
||||
|
||||
function calcProgress(plans) {
|
||||
if (!plans.length) {
|
||||
state.progress.current = 0;
|
||||
state.progress.total = 365;
|
||||
return;
|
||||
}
|
||||
let maxCurrent = 0;
|
||||
let total = 365;
|
||||
plans.forEach((item) => {
|
||||
const current = Number(planDay(item)) || 0;
|
||||
if (current > maxCurrent) {
|
||||
maxCurrent = current;
|
||||
total = Number(planTotal(item)) || 365;
|
||||
}
|
||||
});
|
||||
state.progress.current = maxCurrent;
|
||||
state.progress.total = total;
|
||||
}
|
||||
|
||||
async function getVoucher() {
|
||||
try {
|
||||
const res = await sheep.$api.partner.voucher();
|
||||
if (res?.code === 1) {
|
||||
const data = res.data || {};
|
||||
state.info.voucher_total = data.voucher_total || state.info.voucher_total;
|
||||
state.info.voucher_released = data.voucher_released || state.info.voucher_released;
|
||||
state.info.voucher_used = data.voucher_used || state.info.voucher_used;
|
||||
state.info.voucher_available = data.voucher_available || state.info.voucher_available;
|
||||
state.plans = pickPlans(data);
|
||||
calcProgress(state.plans);
|
||||
state.inited = true;
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
state.plans = [];
|
||||
state.inited = true;
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
getVoucher();
|
||||
});
|
||||
|
||||
onPullDownRefresh(async () => {
|
||||
await getVoucher();
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-box {
|
||||
background-color: $white;
|
||||
padding: 30rpx;
|
||||
|
||||
.card-box {
|
||||
width: 100%;
|
||||
min-height: 300rpx;
|
||||
padding: 36rpx 30rpx 30rpx;
|
||||
border-radius: 30rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.metric-grid,
|
||||
.progress-text,
|
||||
.progress-bar,
|
||||
.exchange-btn {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.metric-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.metric-item {
|
||||
width: 50%;
|
||||
padding: 12rpx 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.metric-label {
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.metric-value {
|
||||
font-size: 32rpx;
|
||||
color: $white;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
font-size: 22rpx;
|
||||
color: $white;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.exchange-btn {
|
||||
margin-top: 24rpx;
|
||||
width: 180rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-radius: 30rpx;
|
||||
background: $white;
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 12rpx;
|
||||
background: rgba(255, 255, 255, 0.35);
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.progress-inner {
|
||||
height: 100%;
|
||||
background: $white;
|
||||
border-radius: 8rpx;
|
||||
|
||||
&.dark {
|
||||
background: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wallet-list {
|
||||
padding: 30rpx;
|
||||
background-color: #ffffff;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: $dark-3;
|
||||
}
|
||||
|
||||
.money {
|
||||
font-size: 26rpx;
|
||||
color: $dark-3;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.desc {
|
||||
color: $gray-c;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
background: #f3e6d2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户