需求:小程序端代码要同时同步到服务器与 git 远程仓库,此前前端仅存在于本地目录(无 remote,从未推送), 服务器与 gitcode 上只有后端。现并入本仓库,复用现有「push 即部署」链路,一次推送双端落地。 - 新增 uniapp/:小程序端源码全量快照(150 文件 / 1.2M) pages(13 页面) · components(fc-navbar/fc-tabbar/fc-post-card/fc-empty) · common(api·utils·mock·assets·store·config) · static(74 图标 + 3 轮播插画 + LOGO) · docs(01-04 交付文档) · tests(零依赖全链路用例) · tools(图标/主题/轮播配图生成脚本) - 明确排除:AGENTS.md(含后台密码、服务器 root 密码、小程序 AppSecret,切勿入库)、 unpackage/(构建产物,由 uniapp/.gitignore 忽略)、node_modules、.DS_Store、*.log - .gitignore 新增 /uniapp/AGENTS.md 兜底(与根 /AGENTS.md、/fluniapp/ 同一约定) - README.md 增补「本项目结构 + 部署链路」章节,说明 uniapp/ 为源码快照、 小程序真正上线仍需微信开发者工具 cli upload 说明:本次为源码快照,未携带前端本地仓库历史——其历史提交中含 AGENTS.md 凭据, 若做 subtree 合并会把密码永久写入本仓库历史,故采用快照方式。
539 行
13 KiB
Vue
539 行
13 KiB
Vue
<template>
|
||
<view class="dist fc-page">
|
||
<!-- 佣金概览 -->
|
||
<view class="dist__header">
|
||
<view class="dist__status" :style="{ height: statusBarHeight + 'px' }"></view>
|
||
<view class="dist__overview">
|
||
<text class="dist__overview-label">可提现佣金(元)</text>
|
||
<text class="dist__overview-num">{{ overview.withdrawable || 0 }}</text>
|
||
<view class="dist__overview-row">
|
||
<view class="dist__overview-cell">
|
||
<text class="dist__overview-cell-num">{{ overview.totalCommission || 0 }}</text>
|
||
<text class="dist__overview-cell-label">累计佣金</text>
|
||
</view>
|
||
<view class="dist__overview-cell">
|
||
<text class="dist__overview-cell-num">{{ overview.settled || 0 }}</text>
|
||
<text class="dist__overview-cell-label">已结算</text>
|
||
</view>
|
||
<view class="dist__overview-cell">
|
||
<text class="dist__overview-cell-num">{{ overview.todayCommission || 0 }}</text>
|
||
<text class="dist__overview-cell-label">今日佣金</text>
|
||
</view>
|
||
</view>
|
||
<view class="dist__withdraw-btn" @click="showWithdraw = true"><text>申请提现</text></view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 邀请推广 -->
|
||
<view class="fc-card">
|
||
<text class="dist__section-title">邀请推广</text>
|
||
<view class="dist__invite">
|
||
<view class="dist__invite-poster" @click="savePoster">
|
||
<image class="fc-icon fc-icon--lg" :src="iconUrl('image-white')" mode="aspectFit" />
|
||
<text class="dist__invite-poster-text">邀请海报</text>
|
||
</view>
|
||
<view class="dist__invite-info">
|
||
<view class="dist__invite-row">
|
||
<text class="dist__invite-label">邀请码</text>
|
||
<text class="dist__invite-value">{{ overview.inviteCode }}</text>
|
||
<text class="dist__invite-copy" @click="copy(overview.inviteCode)">复制</text>
|
||
</view>
|
||
<view class="dist__invite-row">
|
||
<text class="dist__invite-label">推广链接</text>
|
||
<text class="dist__invite-link fc-ellipsis">/pages/index/index?ic={{ overview.inviteCode }}</text>
|
||
<text class="dist__invite-copy" @click="copyLink">复制</text>
|
||
</view>
|
||
<view class="dist__invite-share" @click="share"><text>分享给好友 ›</text></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 团队管理 -->
|
||
<view class="fc-card">
|
||
<view class="dist__team-head">
|
||
<text class="dist__section-title">我的团队</text>
|
||
<view class="dist__team-tabs">
|
||
<view v-for="t in levelTabs" :key="t.value" class="dist__team-tab"
|
||
:class="{ 'dist__team-tab--active': level === t.value }" @click="changeLevel(t.value)">
|
||
<text>{{ t.label }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="dist__team-stat">
|
||
<text>团队总人数 {{ overview.teamCount || 0 }}</text>
|
||
<text class="dist__team-stat-gap">一级 {{ overview.l1Count || 0 }} · 二级 {{ overview.l2Count || 0 }}</text>
|
||
</view>
|
||
<fc-empty v-if="!team.length" icon="users" text="暂无下线,快去邀请好友吧" />
|
||
<view v-for="t in team" :key="t.id" class="dist__member">
|
||
<view class="dist__member-avatar">{{ t.nickname.slice(0, 1) }}</view>
|
||
<view class="dist__member-info">
|
||
<view class="dist__member-name-row">
|
||
<text class="dist__member-name">{{ t.nickname }}</text>
|
||
<text class="fc-tag dist__member-level">{{ t.level === 1 ? '一级' : '二级' }}</text>
|
||
</view>
|
||
<text class="dist__member-time">{{ timeText(t.joinedAt) }}加入</text>
|
||
</view>
|
||
<view class="dist__member-right">
|
||
<text class="dist__member-commission">+¥{{ t.commission }}</text>
|
||
<text class="dist__member-perf">业绩 ¥{{ t.performance }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 提现记录 -->
|
||
<view class="fc-card">
|
||
<text class="dist__section-title">提现记录</text>
|
||
<view v-for="w in records" :key="w.id" class="dist__record">
|
||
<view class="dist__record-left">
|
||
<text class="dist__record-no">{{ w.withdrawNo }}</text>
|
||
<text class="dist__record-time">{{ timeText(w.createdAt) }}</text>
|
||
</view>
|
||
<view class="dist__record-right">
|
||
<text class="dist__record-amount">-¥{{ w.amount }}</text>
|
||
<text class="dist__record-status" :class="`dist__record-status--${w.status}`">
|
||
{{ statusText(w.status) }}
|
||
</text>
|
||
</view>
|
||
</view>
|
||
<text v-if="!records.length" class="dist__record-empty">暂无提现记录</text>
|
||
</view>
|
||
|
||
<!-- 提现弹层 -->
|
||
<view v-if="showWithdraw" class="dist__mask" @click="showWithdraw = false">
|
||
<view class="dist__sheet" @click.stop>
|
||
<text class="dist__sheet-title">申请提现</text>
|
||
<text class="dist__sheet-tip">提现将打入微信零钱,最低提现 ¥{{ minWithdraw }}</text>
|
||
<view class="dist__sheet-input-wrap">
|
||
<text class="dist__sheet-symbol">¥</text>
|
||
<input v-model="withdrawAmount" class="dist__sheet-input" type="digit" placeholder="请输入提现金额" />
|
||
</view>
|
||
<text class="dist__sheet-balance">可提现余额 ¥{{ overview.withdrawable || 0 }}</text>
|
||
<view class="dist__sheet-btn" @click="submitWithdraw"><text>确认提现</text></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
|
||
import distributionApi from '@/common/api/distribution.js'
|
||
import { WITHDRAW_TEXT } from '@/common/constants/ui.js'
|
||
import { fromNow } from '@/common/utils/format.js'
|
||
import { iconUrl, loadUiConfig } from '@/common/store/ui.js'
|
||
|
||
export default {
|
||
components: { FcEmpty },
|
||
data() {
|
||
return {
|
||
statusBarHeight: 20,
|
||
overview: {},
|
||
team: [],
|
||
records: [],
|
||
level: 0,
|
||
showWithdraw: false,
|
||
withdrawAmount: '',
|
||
minWithdraw: 50,
|
||
levelTabs: [
|
||
{ label: '全部', value: 0 },
|
||
{ label: '一级', value: 1 },
|
||
{ label: '二级', value: 2 },
|
||
],
|
||
}
|
||
},
|
||
onLoad() {
|
||
try {
|
||
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight || 20
|
||
} catch (e) {}
|
||
loadUiConfig()
|
||
this.init()
|
||
},
|
||
methods: {
|
||
iconUrl,
|
||
async init() {
|
||
try {
|
||
const [overview, team, records] = await Promise.all([
|
||
distributionApi.overview(),
|
||
distributionApi.team({ page: 1, size: 50 }),
|
||
distributionApi.withdrawRecords(),
|
||
])
|
||
this.overview = overview
|
||
this.team = team.list
|
||
this.records = records
|
||
} catch (e) {
|
||
uni.showToast({ title: '分销数据加载失败', icon: 'none' })
|
||
}
|
||
},
|
||
async changeLevel(v) {
|
||
this.level = v
|
||
try {
|
||
const team = await distributionApi.team({ level: v || undefined, page: 1, size: 50 })
|
||
this.team = team.list
|
||
} catch (e) {}
|
||
},
|
||
statusText(s) {
|
||
return WITHDRAW_TEXT[s] || s
|
||
},
|
||
timeText(t) {
|
||
return fromNow(t)
|
||
},
|
||
copy(text) {
|
||
uni.setClipboardData({ data: String(text) })
|
||
uni.showToast({ title: '已复制', icon: 'none' })
|
||
},
|
||
copyLink() {
|
||
this.copy(`/pages/index/index?ic=${this.overview.inviteCode}`)
|
||
},
|
||
savePoster() {
|
||
uni.showToast({ title: '海报已生成,可长按保存', icon: 'none' })
|
||
},
|
||
share() {
|
||
uni.showToast({ title: '点击右上角分享给好友', icon: 'none' })
|
||
},
|
||
async submitWithdraw() {
|
||
const amount = Number(this.withdrawAmount)
|
||
if (!amount || amount <= 0) {
|
||
uni.showToast({ title: '请输入正确的提现金额', icon: 'none' })
|
||
return
|
||
}
|
||
try {
|
||
await distributionApi.withdraw({ amount, channel: 'wxpay' })
|
||
this.showWithdraw = false
|
||
this.withdrawAmount = ''
|
||
uni.showToast({ title: '提现申请已提交', icon: 'none' })
|
||
this.records = await distributionApi.withdrawRecords()
|
||
} catch (e) {
|
||
uni.showToast({ title: e.message || '提现失败', icon: 'none' })
|
||
}
|
||
},
|
||
},
|
||
}
|
||
</script>
|
||
|
||
|
||
<style lang="scss" scoped>
|
||
.dist__header {
|
||
background: $fc-gradient-hero;
|
||
padding-bottom: 90rpx;
|
||
border-radius: 0 0 40rpx 40rpx;
|
||
}
|
||
.dist__overview {
|
||
margin: 20rpx 32rpx 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
.dist__overview-label {
|
||
color: rgba(255, 255, 255, 0.9);
|
||
font-size: $fc-font-sm;
|
||
}
|
||
.dist__overview-num {
|
||
margin-top: 14rpx;
|
||
color: #ffffff;
|
||
font-size: 76rpx;
|
||
font-weight: 700;
|
||
}
|
||
.dist__overview-row {
|
||
width: 100%;
|
||
display: flex;
|
||
margin-top: 36rpx;
|
||
}
|
||
.dist__overview-cell {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
.dist__overview-cell-num {
|
||
color: #ffffff;
|
||
font-size: 34rpx;
|
||
font-weight: 700;
|
||
}
|
||
.dist__overview-cell-label {
|
||
margin-top: 6rpx;
|
||
color: rgba(255, 255, 255, 0.85);
|
||
font-size: $fc-font-xs;
|
||
}
|
||
.dist__withdraw-btn {
|
||
margin-top: 40rpx;
|
||
padding: 20rpx 80rpx;
|
||
border-radius: $fc-radius-pill;
|
||
background: #ffffff;
|
||
color: $fc-primary-text;
|
||
font-size: $fc-font-lg;
|
||
font-weight: 700;
|
||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
|
||
}
|
||
.dist__section-title {
|
||
font-size: $fc-font-lg;
|
||
font-weight: 700;
|
||
color: $fc-text;
|
||
}
|
||
.dist__invite {
|
||
display: flex;
|
||
margin-top: 24rpx;
|
||
}
|
||
.dist__invite-poster {
|
||
width: 180rpx;
|
||
height: 180rpx;
|
||
border-radius: $fc-radius-lg;
|
||
background: $fc-gradient-warm;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex: 0 0 180rpx;
|
||
}
|
||
.dist__invite-poster-text {
|
||
margin-top: 10rpx;
|
||
color: #ffffff;
|
||
font-size: $fc-font-xs;
|
||
}
|
||
.dist__invite-info {
|
||
flex: 1;
|
||
margin-left: 24rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: space-between;
|
||
}
|
||
.dist__invite-row {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.dist__invite-label {
|
||
width: 120rpx;
|
||
font-size: $fc-font-sm;
|
||
color: $fc-text-secondary;
|
||
}
|
||
.dist__invite-value {
|
||
flex: 1;
|
||
font-size: $fc-font;
|
||
font-weight: 700;
|
||
color: $fc-text;
|
||
letter-spacing: 2rpx;
|
||
}
|
||
.dist__invite-link {
|
||
flex: 1;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-regular;
|
||
}
|
||
.dist__invite-copy {
|
||
margin-left: 16rpx;
|
||
padding: 6rpx 20rpx;
|
||
border-radius: $fc-radius-pill;
|
||
background: $fc-primary-lighter;
|
||
color: $fc-primary-text;
|
||
font-size: $fc-font-xs;
|
||
}
|
||
.dist__invite-share {
|
||
margin-top: 12rpx;
|
||
font-size: $fc-font-sm;
|
||
color: $fc-primary-text;
|
||
font-weight: 600;
|
||
}
|
||
.dist__team-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
.dist__team-tabs {
|
||
display: flex;
|
||
}
|
||
.dist__team-tab {
|
||
margin-left: 16rpx;
|
||
padding: 8rpx 24rpx;
|
||
border-radius: $fc-radius-pill;
|
||
background: $fc-bg;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-secondary;
|
||
&--active {
|
||
background: $fc-primary-lighter;
|
||
color: $fc-primary-text;
|
||
font-weight: 700;
|
||
}
|
||
}
|
||
.dist__team-stat {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-top: 20rpx;
|
||
font-size: $fc-font-sm;
|
||
color: $fc-text-regular;
|
||
}
|
||
.dist__team-stat-gap {
|
||
margin-left: 24rpx;
|
||
color: $fc-text-secondary;
|
||
}
|
||
.dist__member {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-top: 24rpx;
|
||
padding-top: 20rpx;
|
||
border-top: 2rpx solid $fc-border;
|
||
}
|
||
.dist__member-avatar {
|
||
width: 80rpx;
|
||
height: 80rpx;
|
||
border-radius: 50%;
|
||
background: $fc-gradient-warm;
|
||
color: #ffffff;
|
||
font-size: 32rpx;
|
||
font-weight: 700;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.dist__member-info {
|
||
flex: 1;
|
||
margin-left: 20rpx;
|
||
}
|
||
.dist__member-name-row {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.dist__member-name {
|
||
font-size: $fc-font;
|
||
font-weight: 600;
|
||
color: $fc-text;
|
||
}
|
||
.dist__member-level {
|
||
margin-left: 12rpx;
|
||
}
|
||
.dist__member-time {
|
||
display: block;
|
||
margin-top: 8rpx;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-placeholder;
|
||
}
|
||
.dist__member-right {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-end;
|
||
}
|
||
.dist__member-commission {
|
||
font-size: $fc-font-lg;
|
||
font-weight: 700;
|
||
color: $fc-price;
|
||
}
|
||
.dist__member-perf {
|
||
margin-top: 8rpx;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-secondary;
|
||
}
|
||
.dist__record {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-top: 24rpx;
|
||
padding-top: 20rpx;
|
||
border-top: 2rpx solid $fc-border;
|
||
}
|
||
.dist__record-no {
|
||
display: block;
|
||
font-size: $fc-font-sm;
|
||
color: $fc-text;
|
||
}
|
||
.dist__record-time {
|
||
display: block;
|
||
margin-top: 8rpx;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-placeholder;
|
||
}
|
||
.dist__record-right {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-end;
|
||
}
|
||
.dist__record-amount {
|
||
font-size: $fc-font-lg;
|
||
font-weight: 700;
|
||
color: $fc-text;
|
||
}
|
||
.dist__record-status {
|
||
margin-top: 8rpx;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-warning;
|
||
&--paid {
|
||
color: $fc-success;
|
||
}
|
||
&--rejected {
|
||
color: $fc-danger;
|
||
}
|
||
}
|
||
.dist__record-empty {
|
||
display: block;
|
||
margin-top: 24rpx;
|
||
text-align: center;
|
||
font-size: $fc-font-sm;
|
||
color: $fc-text-placeholder;
|
||
}
|
||
.dist__mask {
|
||
position: fixed;
|
||
left: 0;
|
||
right: 0;
|
||
top: 0;
|
||
bottom: 0;
|
||
z-index: 200;
|
||
background: rgba(4, 48, 42, 0.5);
|
||
display: flex;
|
||
align-items: flex-end;
|
||
}
|
||
.dist__sheet {
|
||
width: 100%;
|
||
background: #ffffff;
|
||
border-radius: 32rpx 32rpx 0 0;
|
||
padding: 36rpx 32rpx 60rpx;
|
||
}
|
||
.dist__sheet-title {
|
||
display: block;
|
||
text-align: center;
|
||
font-size: $fc-font-lg;
|
||
font-weight: 700;
|
||
}
|
||
.dist__sheet-tip {
|
||
display: block;
|
||
text-align: center;
|
||
margin-top: 14rpx;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-secondary;
|
||
}
|
||
.dist__sheet-input-wrap {
|
||
margin-top: 32rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
height: 110rpx;
|
||
border-radius: $fc-radius;
|
||
background: $fc-bg;
|
||
padding: 0 28rpx;
|
||
}
|
||
.dist__sheet-symbol {
|
||
font-size: 40rpx;
|
||
font-weight: 700;
|
||
color: $fc-price;
|
||
margin-right: 12rpx;
|
||
}
|
||
.dist__sheet-input {
|
||
flex: 1;
|
||
font-size: 40rpx;
|
||
font-weight: 700;
|
||
}
|
||
.dist__sheet-balance {
|
||
display: block;
|
||
margin-top: 16rpx;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-secondary;
|
||
}
|
||
.dist__sheet-btn {
|
||
margin-top: 32rpx;
|
||
height: 90rpx;
|
||
border-radius: $fc-radius-pill;
|
||
background: $fc-gradient-primary;
|
||
color: $fc-primary-ink;
|
||
font-size: 32rpx;
|
||
font-weight: 700;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0 10rpx 28rpx rgba(4, 48, 30, 0.3);
|
||
}
|
||
</style>
|
||
|