feat(commission): 支持计奖商品参与设置、独立分成与多规格规则,完善团队中心与微信快捷登录

这个提交包含在:
chen
2026-09-17 19:27:17 +08:00
父节点 3c7df9688b
当前提交 829e88cfa9
共有 54 个文件被更改,包括 3536 次插入 和 666 次删除

查看文件

@@ -1,5 +1,5 @@
<template>
<s-layout title="积分商城">
<s-layout title="兑换商城">
<!-- 资产看板:当前积分与可用兑换券 -->
<view class="asset-banner ss-m-20 ss-p-20">
<view class="ss-flex ss-row-between ss-col-center">
@@ -17,7 +17,7 @@
</button>
</view>
<view class="asset-tip ss-m-t-16">
💡 兑换商品时支持使用兑换券 1:1 抵扣现金部分
💡 兑换商品时支持使用可用兑换券 1:1 全额抵扣现金
</view>
</view>
@@ -34,7 +34,7 @@
<s-empty
v-if="state.pagination.total === 0"
icon="/static/goods-empty.png"
text="暂无积分商品"
text="暂无兑换商品"
></s-empty>
<uni-load-more
v-if="state.pagination.total > 0"

查看文件

@@ -12,6 +12,28 @@
</view>
<!-- 账户信息 -->
<account-info />
<!-- 团队作战快捷看板 -->
<view class="team-quick-card ss-flex ss-row-between ss-col-center" @tap="sheep.$router.go('/pages/commission/team')">
<view class="team-quick-left ss-flex ss-col-center">
<view class="icon-wrap ss-flex ss-row-center ss-col-center">
<uni-icons type="staff" size="24" color="#ff6000"></uni-icons>
</view>
<view class="team-quick-info ss-m-l-16">
<view class="team-title ss-flex ss-col-center">
<text class="title-bold">团队作战中心</text>
<text class="active-badge ss-m-l-10" v-if="userInfo?.active_30d !== false && agentInfo?.active_30d !== false">正常活跃</text>
<text class="warn-badge ss-m-l-10" v-else>奖励暂停</text>
</view>
<view class="team-sub ss-m-t-6">
直推 {{ agentInfo?.child_user_count_1 || 0 }} 人 · 团队共 {{ agentInfo?.child_user_count_all || 0 }} 人
</view>
</view>
</view>
<view class="team-quick-right ss-flex ss-col-center">
<text class="manage-text">去管理</text>
<uni-icons type="right" size="14" color="#ff6000"></uni-icons>
</view>
</view>
<!-- 菜单栏 -->
<commission-menu />
<!-- 分销记录 -->
@@ -103,4 +125,62 @@
color: #ffffff;
}
}
.team-quick-card {
width: 694rpx;
margin: 20rpx auto 0;
padding: 22rpx 28rpx;
box-sizing: border-box;
background: linear-gradient(135deg, #ffffff 0%, #fffbf0 100%);
border-radius: 16rpx;
border: 1rpx solid #ffe8c2;
box-shadow: 0 4rpx 16rpx rgba(247, 213, 152, 0.25);
position: relative;
z-index: 3;
.icon-wrap {
width: 72rpx;
height: 72rpx;
border-radius: 36rpx;
background: #fff0e6;
}
.team-quick-info {
.title-bold {
font-size: 28rpx;
font-weight: bold;
color: #692e04;
}
.active-badge {
font-size: 20rpx;
padding: 2rpx 10rpx;
border-radius: 12rpx;
background: #ecfdf5;
color: #059669;
font-weight: 500;
}
.warn-badge {
font-size: 20rpx;
padding: 2rpx 10rpx;
border-radius: 12rpx;
background: #fef2f2;
color: #dc2626;
font-weight: 500;
}
.team-sub {
font-size: 22rpx;
color: #a17545;
font-family: OPPOSANS;
}
}
.team-quick-right {
.manage-text {
font-size: 24rpx;
font-weight: 500;
color: #ff6000;
margin-right: 4rpx;
}
}
}
</style>

查看文件

@@ -12,6 +12,19 @@
</view>
</view>
<!-- 穿透查看成员明细提示条 -->
<view v-if="state.buyerId > 0" class="buyer-filter-bar ss-flex ss-row-between ss-col-center">
<view class="ss-flex ss-col-center">
<uni-icons type="person-filled" size="16" color="#ff6000"></uni-icons>
<text class="filter-tip-text ss-m-l-10">
正在筛选成员:<text class="buyer-highlight">【{{ state.buyerName || ('ID:' + state.buyerId) }}】</text>的贡献
</text>
</view>
<button class="ss-reset-button clear-filter-btn" @tap="onClearBuyerFilter">
查看全部
</button>
</view>
<su-sticky>
<su-tabs
:list="tabMaps"
@@ -139,6 +152,8 @@
loadStatus: '',
showDetail: false,
current: null,
buyerId: 0,
buyerName: '',
overview: {
month_income: '0.00',
skip_count: 0,
@@ -179,11 +194,15 @@
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',
const params = {
tab: tabMaps.value[state.currentTab]?.value || 'all',
page,
list_rows,
});
};
if (state.buyerId > 0) {
params.buyer_id = state.buyerId;
}
const res = await sheep.$api.partner.rewards(params);
if (res?.code === 1) {
const pageData = pickList(res.data);
state.pagination = {
@@ -220,7 +239,20 @@
state.showDetail = true;
}
onLoad(() => {
function onClearBuyerFilter() {
state.buyerId = 0;
state.buyerName = '';
state.pagination = { ...emptyPagination };
getLogList(1);
}
onLoad((options) => {
if (options?.buyer_id) {
state.buyerId = Number(options.buyer_id) || 0;
}
if (options?.buyer_name) {
state.buyerName = decodeURIComponent(options.buyer_name);
}
getOverview();
getLogList();
});
@@ -239,6 +271,29 @@
</script>
<style lang="scss" scoped>
.buyer-filter-bar {
margin: 16rpx 24rpx;
padding: 16rpx 24rpx;
background: #fff4e5;
border-radius: 12rpx;
border: 1rpx solid #ffd8a8;
.filter-tip-text {
font-size: 24rpx;
color: #a17545;
}
.buyer-highlight {
font-weight: bold;
color: #ff6000;
}
.clear-filter-btn {
font-size: 22rpx;
padding: 6rpx 18rpx;
border-radius: 20rpx;
background: #ff6000;
color: #ffffff;
}
}
.header-box {
background-color: $white;
padding: 30rpx;

查看文件

@@ -22,6 +22,25 @@
<text class="referrer-name">{{ userInfo.parent_user.nickname }}</text>
</view>
<!-- 专属邀请码与拓展卡片 -->
<view class="invite-action-card ss-flex ss-row-between ss-col-center">
<view class="invite-code-wrap ss-flex ss-col-center">
<text class="invite-label">专属邀请码:</text>
<text class="invite-code">HL{{ userInfo.id || '---' }}</text>
<button class="ss-reset-button copy-code-btn ss-m-l-10" @tap="onCopyInviteCode">复制</button>
</view>
<view class="invite-btn-group ss-flex ss-col-center">
<button class="ss-reset-button invite-btn-poster ss-flex ss-col-center" @tap="onOpenShareModal">
<uni-icons type="image" size="14" color="#ffffff"></uni-icons>
<text class="ss-m-l-6">邀请海报</text>
</button>
<button class="ss-reset-button invite-btn-link ss-m-l-12 ss-flex ss-col-center" @tap="onCopyShareLink">
<uni-icons type="link" size="14" color="#ff6000"></uni-icons>
<text class="ss-m-l-6">复制链接</text>
</button>
</view>
</view>
<!-- 团队核心数据总览卡片 -->
<view class="team-data-box ss-flex ss-col-center ss-row-between">
<!-- 团队总人数卡片 -->
@@ -85,6 +104,20 @@
</view>
</view>
<!-- 团队收益与业绩统计大盘 -->
<view class="team-wealth-box ss-flex ss-col-center ss-row-between">
<view class="wealth-card ss-flex-1 ss-m-r-16">
<view class="wealth-title">团队贡献总收益(元)</view>
<view class="wealth-num text-orange">¥{{ state.summary.team_total_reward || '0.00' }}</view>
<view class="wealth-sub">本月贡献: ¥{{ state.summary.team_month_reward || '0.00' }}</view>
</view>
<view class="wealth-card ss-flex-1">
<view class="wealth-title">团队自购总业绩(元)</view>
<view class="wealth-num text-gold">¥{{ state.summary.team_total_consume || '0.00' }}</view>
<view class="wealth-sub">团队累计订单: {{ state.summary.team_order_count || 0 }} 笔</view>
</view>
</view>
<!-- 30天自购保活健康度胶囊条 -->
<view class="health-bar ss-flex ss-row-between ss-col-center">
<view class="health-title">保活健康度:</view>
@@ -206,6 +239,10 @@
{{ item.team_level === 1 ? '一级直推' : '二级间推' }}
</text>
</view>
<view class="member-sub-info ss-flex ss-col-center ss-m-t-4" v-if="item.mobile_hide || item.id">
<text class="member-phone" v-if="item.mobile_hide">{{ item.mobile_hide }}</text>
<text class="member-id-tag ss-m-l-8">ID: {{ item.id }}</text>
</view>
<view class="member-meta-row ss-flex ss-col-center ss-m-t-8">
<!-- 身份徽章 -->
<view v-if="memberLevelName(item)" class="tag-box ss-flex ss-col-center">
@@ -310,13 +347,20 @@
<text class="ss-m-l-6">拨打</text>
</button>
<button
v-if="item.mobile_raw"
v-if="item.mobile_raw || item.mobile_hide"
class="ss-reset-button action-btn btn-copy ss-m-l-12"
@tap.stop="onCopyText(item.mobile_raw, '手机号已复制')"
@tap.stop="onCopyText(item.mobile_raw || item.mobile_hide, '手机号已复制')"
>
<uni-icons type="paperclip" size="14" color="#666666"></uni-icons>
<text class="ss-m-l-6">复制手机</text>
</button>
<button
class="ss-reset-button action-btn btn-reward ss-m-l-12"
@tap.stop="onJumpRewards(item.id, item.nickname)"
>
<uni-icons type="wallet" size="14" color="#ff6000"></uni-icons>
<text class="ss-m-l-6">收益</text>
</button>
<button
class="ss-reset-button action-btn btn-detail ss-m-l-12"
@tap.stop="onOpenMemberDetail(item)"
@@ -387,6 +431,8 @@
<view class="drawer-sub ss-flex ss-col-center ss-m-t-8">
<text class="user-id">ID: {{ state.currentMember.id }}</text>
<text class="dot-split">·</text>
<text class="user-phone">手机: {{ state.currentMember.mobile_hide || '未绑定' }}</text>
<text class="dot-split">·</text>
<text class="join-time">{{ formatTime(state.currentMember.createtime) }} 加入</text>
</view>
</view>
@@ -496,16 +542,16 @@
<text class="ss-m-l-8">呼叫成员</text>
</button>
<button
v-if="state.currentMember.mobile_raw"
v-if="state.currentMember.mobile_raw || state.currentMember.mobile_hide"
class="ss-reset-button drawer-btn drawer-btn-sub ss-flex-1 ss-m-r-16"
@tap="onCopyText(state.currentMember.mobile_raw, '手机号已复制')"
@tap="onCopyText(state.currentMember.mobile_raw || state.currentMember.mobile_hide, '手机号已复制')"
>
<uni-icons type="paperclip" size="16" color="#ff6000"></uni-icons>
<text class="ss-m-l-8">复制电话</text>
</button>
<button
class="ss-reset-button drawer-btn drawer-btn-outline ss-flex-1"
@tap="onJumpRewards(state.currentMember.id)"
@tap="onJumpRewards(state.currentMember.id, state.currentMember.nickname)"
>
<uni-icons type="list" size="16" color="#666666"></uni-icons>
<text class="ss-m-l-8">查收益流水</text>
@@ -577,6 +623,10 @@
expiring_count: 0,
inactive_count: 0,
partner_count: 0,
team_total_consume: '0.00',
team_total_reward: '0.00',
team_month_reward: '0.00',
team_order_count: 0,
},
pagination: {
data: [],
@@ -728,9 +778,32 @@
state.showDetail = true;
}
function onJumpRewards(buyerId) {
function onJumpRewards(buyerId, buyerName = '') {
state.showDetail = false;
sheep.$router.go(`/pages/commission/rewards?buyer_id=${buyerId}`);
const nameParam = buyerName ? `&buyer_name=${encodeURIComponent(buyerName)}` : '';
sheep.$router.go(`/pages/commission/rewards?buyer_id=${buyerId}${nameParam}`);
}
function onCopyInviteCode() {
if (!userInfo.value?.id) {
sheep.$helper.toast('请先登录');
return;
}
const code = `HL${userInfo.value.id}`;
sheep.$helper.copyText(code, '专属邀请码已复制');
}
function onCopyShareLink() {
if (!userInfo.value?.id) {
sheep.$helper.toast('请先登录');
return;
}
const shareQuery = sheep.$platform.share.buildSpmQuery({
page: '1',
query: '0',
});
const shareUrl = sheep.$platform.share.buildSpmPath(shareQuery);
sheep.$helper.copyText(shareUrl, '专属推广链接已复制');
}
function onOpenShareModal() {
@@ -825,6 +898,59 @@
}
}
// 专属邀请码卡片
.invite-action-card {
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
border-radius: 16rpx;
padding: 12rpx 20rpx;
margin-bottom: 20rpx;
.invite-code-wrap {
.invite-label {
font-size: 24rpx;
color: #ffffff;
font-weight: 500;
}
.invite-code {
font-size: 28rpx;
font-weight: bold;
color: #ffffff;
font-family: OPPOSANS;
letter-spacing: 1rpx;
}
.copy-code-btn {
font-size: 20rpx;
padding: 4rpx 14rpx;
border-radius: 16rpx;
background: #ffffff;
color: #ff6000;
font-weight: 500;
}
}
.invite-btn-group {
.invite-btn-poster {
height: 48rpx;
padding: 0 16rpx;
border-radius: 24rpx;
background: #ff6000;
color: #ffffff;
font-size: 22rpx;
font-weight: 500;
}
.invite-btn-link {
height: 48rpx;
padding: 0 16rpx;
border-radius: 24rpx;
background: #ffffff;
color: #ff6000;
font-size: 22rpx;
font-weight: 500;
}
}
}
// 团队信息总览
.team-data-box {
.data-card {
@@ -893,6 +1019,41 @@
color: #333333;
font-family: OPPOSANS;
}
// 团队收益与业绩看板
.team-wealth-box {
margin-top: 20rpx;
.wealth-card {
background: #ffffff;
border-radius: 20rpx;
padding: 18rpx 20rpx;
box-sizing: border-box;
.wealth-title {
font-size: 22rpx;
color: #999999;
line-height: 28rpx;
margin-bottom: 6rpx;
}
.wealth-num {
font-size: 32rpx;
font-weight: bold;
font-family: OPPOSANS;
line-height: 38rpx;
margin-bottom: 6rpx;
&.text-orange {
color: #ff6000;
}
&.text-gold {
color: #c48a3a;
}
}
.wealth-sub {
font-size: 20rpx;
color: #888888;
line-height: 24rpx;
}
}
}
@@ -1127,6 +1288,24 @@
}
}
.member-sub-info {
font-size: 20rpx;
color: #999999;
font-family: OPPOSANS;
.member-phone {
color: #666666;
font-size: 22rpx;
}
.member-id-tag {
background: #f3f4f6;
color: #9ca3af;
padding: 2rpx 8rpx;
border-radius: 6rpx;
font-size: 18rpx;
}
}
.member-meta-row {
gap: 8rpx;
}
@@ -1240,6 +1419,10 @@
background: #f3f4f6;
color: #4b5563;
}
&.btn-reward {
background: #fff7ed;
color: #ea580c;
}
&.btn-detail {
background: #ffffff;
color: #666666;

查看文件

@@ -33,13 +33,14 @@
<view v-if="goodsPrice.price > 0" class="price-text"> ¥{{ goodsPrice.price }} </view>
<text v-if="goodsPrice.price > 0 && goodsPrice.score > 0">+</text>
<image
v-if="goodsPrice.score > 0"
:src="sheep.$url.static('/assets/addons/shopro/uniapp/goods/score1.svg')"
class="score-img"
></image>
<view class="score-text ss-m-r-16">
<view v-if="goodsPrice.score > 0" class="score-text ss-m-r-16">
{{ goodsPrice.score }}
</view>
<view v-if="goodsPrice.price > 0" class="voucher-tip-tag">支持兑换券抵扣</view>
<view v-if="goodsPrice.price > 0" class="voucher-tip-tag">支持兑换券全额抵扣</view>
</view>
<view class="sales-text">
{{ formatExchange(state.goodsInfo.sales_show_type, state.goodsInfo.sales) }}

查看文件

@@ -5,7 +5,7 @@
navbar="custom"
tabbar="/pages/index/index"
:bgStyle="template.style?.background"
:navbarStyle="template.style?.navbar"
:navbarStyle="navbarStyle"
onShareAppMessage
:showFloatButton="true"
>
@@ -30,6 +30,43 @@
});
const template = computed(() => sheep.$store('app').template?.home);
// 代码直接接管首页顶部导航栏 Logo,不依赖后台装修配置
const navbarStyle = computed(() => {
const base = template.value?.style?.navbar || {};
return {
...base,
mode: 'normal',
type: 'color',
color: '#FFFFFF',
list: {
mp: [
{
width: 3,
height: 1,
top: 0,
left: 0,
type: 'image',
src: '/static/logo.png',
url: '/pages/index/index',
borderRadius: 0,
},
],
app: [
{
width: 4,
height: 1,
top: 0,
left: 2,
type: 'image',
src: '/static/logo.png',
url: '/pages/index/index',
borderRadius: 0,
},
],
},
};
});
onLoad((options) => {
// #ifdef MP
// 小程序识别二维码

查看文件

@@ -8,7 +8,7 @@
:num="state.goodsItem.goods_num"></s-goods-item>
</view>
<uni-forms ref="form" v-model="formData" :rules="rules" label-position="top">
<uni-forms ref="form" :modelValue="formData" :rules="rules" label-position="top">
<!-- 售后类型 -->
<view class="refund-item">
<view class="item-title ss-m-b-20">售后类型</view>
@@ -135,7 +135,7 @@ const state = reactive({
},
],
});
const formData = reactive({
let formData = reactive({
type: '',
reason: '',
mobile: '',

查看文件

@@ -100,7 +100,7 @@
>
<view class="item-title">兑换券</view>
<view class="ss-flex ss-col-center" @tap="openVoucher">
<text class="item-value text-red" v-if="state.orderPayload.voucher_fee > 0"
<text class="item-value text-red" v-if="Number(state.orderInfo.voucher_fee || state.orderPayload.voucher_fee) > 0"
>-¥{{ state.orderInfo.voucher_fee || state.orderPayload.voucher_fee }}</text
>
<text
@@ -197,7 +197,7 @@
<view class="footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center">
<view class="total-box-footer ss-flex ss-col-center">
<view class="total-num ss-font-30 text-red"> ¥{{ state.orderInfo.pay_fee }} </view>
<view v-if="state.orderPayload.order_type === 'score'" class="ss-flex">
<view v-if="state.orderPayload.order_type === 'score' && Number(state.orderInfo.score_amount) > 0" class="ss-flex">
<view class="total-num ss-font-30 text-red ss-m-l-4">+</view>
<image
:src="sheep.$url.static('/assets/addons/shopro/uniapp/goods/score1.svg')"
@@ -313,10 +313,22 @@
}
if (exchangeNow.value) {
const hasScore = Number(state.orderInfo.score_amount) > 0;
const voucherFee = Number(state.orderInfo.voucher_fee || state.orderPayload.voucher_fee || 0);
let confirmContent = '确定立即兑换此商品?';
if (hasScore && voucherFee > 0) {
confirmContent = `确定使用 ${voucherFee} 元兑换券与 ${state.orderInfo.score_amount} 积分立即兑换?`;
} else if (voucherFee > 0) {
confirmContent = `确定使用 ${voucherFee} 元兑换券立即兑换(现金实付 0 元)?`;
} else if (hasScore) {
confirmContent = `确定使用 ${state.orderInfo.score_amount} 积分立即兑换?`;
}
uni.showModal({
title: '提示',
content: '确定使用积分立即兑换?',
title: '兑换确认',
content: confirmContent,
cancelText: '再想想',
confirmText: '确定兑换',
success: async function (res) {
if (res.confirm) {
submitOrder();
@@ -359,6 +371,10 @@
state.orderInfo.goods_list.forEach((item) => {
state.totalNumber += item.goods_num;
});
// 积分/兑换商城订单:若后端自动计算了兑换券抵扣,同步至 orderPayload
if (state.orderPayload.order_type === 'score' && state.orderPayload.voucher_fee === undefined && data.voucher_fee !== undefined) {
state.orderPayload.voucher_fee = data.voucher_fee;
}
}
// 获取可用优惠券