|
|
@@ -12,20 +12,20 @@
|
|
|
</view>
|
|
|
<view class="fe-grid">
|
|
|
<view class="fe-item">
|
|
|
- <text class="fe-value orange">{{ fenToYuan(familySummary.totalEarned) }}</text>
|
|
|
- <text class="fe-label">累计推荐收入</text>
|
|
|
+ <text class="fe-value orange">{{ cfVal(familySummary.totalEarned) }}</text>
|
|
|
+ <text class="fe-label">累计推荐CF</text>
|
|
|
</view>
|
|
|
<view class="fe-item">
|
|
|
- <text class="fe-value blue">{{ fenToYuan(familySummary.availableAmount) }}</text>
|
|
|
- <text class="fe-label">可支配余额</text>
|
|
|
+ <text class="fe-value blue">{{ cfVal(familySummary.availableAmount) }}</text>
|
|
|
+ <text class="fe-label">可支配CF</text>
|
|
|
</view>
|
|
|
<view class="fe-item">
|
|
|
- <text class="fe-value green">{{ fenToYuan(familySummary.withdrawnAmount) }}</text>
|
|
|
- <text class="fe-label">已提现</text>
|
|
|
+ <text class="fe-value green">{{ cfVal(familySummary.withdrawnAmount) }}</text>
|
|
|
+ <text class="fe-label">已提现CF</text>
|
|
|
</view>
|
|
|
<view class="fe-item">
|
|
|
- <text class="fe-value purple">{{ fenToYuan(familySummary.distributedAmount) }}</text>
|
|
|
- <text class="fe-label">已分配</text>
|
|
|
+ <text class="fe-value purple">{{ cfVal(familySummary.distributedAmount) }}</text>
|
|
|
+ <text class="fe-label">已分配CF</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -58,9 +58,9 @@
|
|
|
<text class="member-balance-tag disabled-tag" v-else>池关闭</text>
|
|
|
</view>
|
|
|
<view class="member-amounts">
|
|
|
- <text class="member-amount allocated">+{{ fenToYuan(m.allocatedAmount) }}</text>
|
|
|
- <text class="member-amount consumed">-{{ fenToYuan(m.consumedAmount) }}</text>
|
|
|
- <text class="member-amount available">={{ fenToYuan(m.availableAmount) }}</text>
|
|
|
+ <text class="member-amount allocated">+{{ cfVal(m.allocatedAmount) }}</text>
|
|
|
+ <text class="member-amount consumed">-{{ cfVal(m.consumedAmount) }}</text>
|
|
|
+ <text class="member-amount available">={{ cfVal(m.availableAmount) }}</text>
|
|
|
</view>
|
|
|
<!-- 管理员可切换成员池权限 -->
|
|
|
<switch v-if="isAdmin && !m.isAdmin" class="member-switch" :checked="m.canUseFamilyBalance" @change="toggleMemberAccess(m)" color="#F97316"></switch>
|
|
|
@@ -85,15 +85,15 @@
|
|
|
<view class="stats-cards">
|
|
|
<view class="stat-card today-card">
|
|
|
<text class="stat-value">{{ stats.todayCommission || 0 }}</text>
|
|
|
- <text class="stat-label">今日佣金(分)</text>
|
|
|
+ <text class="stat-label">今日CF</text>
|
|
|
</view>
|
|
|
<view class="stat-card month-card">
|
|
|
<text class="stat-value">{{ stats.monthCommission || 0 }}</text>
|
|
|
- <text class="stat-label">本月佣金(分)</text>
|
|
|
+ <text class="stat-label">本月CF</text>
|
|
|
</view>
|
|
|
<view class="stat-card total-card">
|
|
|
<text class="stat-value">{{ stats.totalCommission || 0 }}</text>
|
|
|
- <text class="stat-label">累计佣金(分)</text>
|
|
|
+ <text class="stat-label">累计CF</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -115,21 +115,21 @@
|
|
|
</view>
|
|
|
<view class="earnings-body">
|
|
|
<view class="earning-item">
|
|
|
- <text class="earning-label">累计获取</text>
|
|
|
- <text class="earning-value orange" v-if="summary">{{ cfToYuan(summary.totalEarned) }}</text>
|
|
|
- <text class="earning-value orange" v-else>¥0.00</text>
|
|
|
+ <text class="earning-label">累计获取CF</text>
|
|
|
+ <text class="earning-value orange" v-if="summary">{{ cfVal(summary.totalEarned) }}</text>
|
|
|
+ <text class="earning-value orange" v-else>0</text>
|
|
|
</view>
|
|
|
<view class="earning-divider"></view>
|
|
|
<view class="earning-item">
|
|
|
- <text class="earning-label">可用余额</text>
|
|
|
- <text class="earning-value blue" v-if="summary">{{ cfToYuan(summary.available) }}</text>
|
|
|
- <text class="earning-value blue" v-else>¥0.00</text>
|
|
|
+ <text class="earning-label">可用CF</text>
|
|
|
+ <text class="earning-value blue" v-if="summary">{{ cfVal(summary.available) }}</text>
|
|
|
+ <text class="earning-value blue" v-else>0</text>
|
|
|
</view>
|
|
|
<view class="earning-divider"></view>
|
|
|
<view class="earning-item">
|
|
|
- <text class="earning-label">冻结</text>
|
|
|
- <text class="earning-value green" v-if="summary">{{ cfToYuan(summary.frozen) }}</text>
|
|
|
- <text class="earning-value green" v-else>¥0.00</text>
|
|
|
+ <text class="earning-label">冻结CF</text>
|
|
|
+ <text class="earning-value green" v-if="summary">{{ cfVal(summary.frozen) }}</text>
|
|
|
+ <text class="earning-value green" v-else>0</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -149,24 +149,6 @@
|
|
|
</view>
|
|
|
<text class="menu-text">立即提现</text>
|
|
|
</view> -->
|
|
|
- <view class="menu-item" @click="goInvite">
|
|
|
- <view class="menu-icon-wrap icon-invite">
|
|
|
- <text class="menu-icon-text">👥</text>
|
|
|
- </view>
|
|
|
- <text class="menu-text">邀请好友</text>
|
|
|
- </view>
|
|
|
- <view class="menu-item" @click="shareToFriend">
|
|
|
- <view class="menu-icon-wrap icon-share">
|
|
|
- <text class="menu-icon-text">📤</text>
|
|
|
- </view>
|
|
|
- <text class="menu-text">分享给好友</text>
|
|
|
- </view>
|
|
|
- <view class="menu-item" @click="goTeam">
|
|
|
- <view class="menu-icon-wrap icon-team">
|
|
|
- <text class="menu-icon-text">🤝</text>
|
|
|
- </view>
|
|
|
- <text class="menu-text">推广团队</text>
|
|
|
- </view>
|
|
|
<view class="menu-item" @click="goLeaderboard">
|
|
|
<view class="menu-icon-wrap icon-leaderboard">
|
|
|
<text class="menu-icon-text">🏆</text>
|
|
|
@@ -189,11 +171,11 @@
|
|
|
<view class="sheet-mask" v-if="showDistributeSheet" @click="showDistributeSheet = false">
|
|
|
<view class="sheet-content" @click.stop>
|
|
|
<text class="sheet-title">分配收益</text>
|
|
|
- <text class="sheet-hint">选择成员并输入分配金额(分)</text>
|
|
|
+ <text class="sheet-hint">选择成员并输入分配CF值</text>
|
|
|
<picker class="sheet-picker" mode="selector" :range="memberOptions" :value="distributeMemberIdx" @change="onDistributeMemberChange">
|
|
|
<text>{{ distributeMemberIdx >= 0 ? memberOptions[distributeMemberIdx] : '选择成员' }}</text>
|
|
|
</picker>
|
|
|
- <input class="sheet-input" type="digit" v-model="distributeAmount" placeholder="输入分配金额(分)" />
|
|
|
+ <input class="sheet-input" type="digit" v-model="distributeAmount" placeholder="输入分配CF值" />
|
|
|
<view class="sheet-actions">
|
|
|
<button class="sheet-cancel" @click="showDistributeSheet = false">取消</button>
|
|
|
<button class="sheet-confirm" @click="doDistribute" :disabled="distributeMemberIdx < 0 || !distributeAmount || distributeAmount <= 0">确认分配</button>
|
|
|
@@ -201,16 +183,13 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <SharePoster :show="showPoster" :qrCodeBase64="inviteQrCode" :nickname="shareNickname" :userAvatar="shareAvatar" :familyName="familyName" @close="showPoster = false" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getReferralSummary, getCfSummary, getFamilyEarningsSummary, getFamilyEarningsMembers, getFamilyEarningsRecords, distributeToMember, toggleMemberBalance, withdrawFamilyEarnings, getInviteQrCode, getFamilyMemberList, getReferralCode, extractReferralCode } from '../../utils/api.js'
|
|
|
-import SharePoster from '@/pages/promotion/components/SharePoster.vue'
|
|
|
+import { getReferralSummary, getCfSummary, getFamilyEarningsSummary, getFamilyEarningsMembers, getFamilyEarningsRecords, distributeToMember, toggleMemberBalance, withdrawFamilyEarnings, getReferralCode, extractReferralCode } from '../../utils/api.js'
|
|
|
|
|
|
export default {
|
|
|
- components: { SharePoster },
|
|
|
data() {
|
|
|
return {
|
|
|
totalEarnings: '0.00',
|
|
|
@@ -231,12 +210,7 @@ export default {
|
|
|
distributeAmount: '',
|
|
|
distributeMemberIdx: -1,
|
|
|
memberOptions: [],
|
|
|
- // 分享海报
|
|
|
- showPoster: false,
|
|
|
- inviteQrCode: '',
|
|
|
- familyName: '',
|
|
|
- shareNickname: '',
|
|
|
- shareAvatar: '',
|
|
|
+ // 分享推广码(用于右上角菜单分享)
|
|
|
shareReferralCode: ''
|
|
|
}
|
|
|
},
|
|
|
@@ -343,7 +317,7 @@ export default {
|
|
|
var opts = []
|
|
|
var arr = this.members
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
- opts.push((arr[i].nickname || '用户' + arr[i].userId) + ' (余额:' + this.fenToYuan(arr[i].availableAmount) + ')')
|
|
|
+ opts.push((arr[i].nickname || '用户' + arr[i].userId) + ' (余额:' + this.cfVal(arr[i].availableAmount) + ' CF)')
|
|
|
}
|
|
|
this.memberOptions = opts
|
|
|
}
|
|
|
@@ -406,17 +380,11 @@ export default {
|
|
|
{ label: '订单', count: data.totalOrders || 0, width: Math.round(((data.totalOrders || 0) / max) * 100) }
|
|
|
]
|
|
|
},
|
|
|
- fenToYuan(fen) {
|
|
|
- if (fen === null || fen === undefined) return '0.00'
|
|
|
- var num = Number(fen)
|
|
|
- if (isNaN(num)) return '0.00'
|
|
|
- return (num / 100).toFixed(2)
|
|
|
- },
|
|
|
- cfToYuan(val) {
|
|
|
- if (val === null || val === undefined) return '¥0.00'
|
|
|
+ cfVal(val) {
|
|
|
+ if (val === null || val === undefined) return '0'
|
|
|
var num = Number(val)
|
|
|
- if (isNaN(num)) return '¥0.00'
|
|
|
- return '¥' + (num / 100).toFixed(2)
|
|
|
+ if (isNaN(num)) return '0'
|
|
|
+ return String(num)
|
|
|
},
|
|
|
// 管理员操作
|
|
|
toggleMemberAccess(m) {
|
|
|
@@ -500,42 +468,8 @@ export default {
|
|
|
goWithdraw() {
|
|
|
uni.navigateTo({ url: '/pages/promotion/withdraw' })
|
|
|
},
|
|
|
- goInvite() {
|
|
|
- uni.navigateTo({ url: '/pages/promotion/invite' })
|
|
|
- },
|
|
|
- async shareToFriend() {
|
|
|
- uni.showLoading({ title: '生成中...' })
|
|
|
- try {
|
|
|
- await this.ensureShareCode()
|
|
|
- var qrRes = await getInviteQrCode()
|
|
|
- if (qrRes && qrRes.data) {
|
|
|
- this.inviteQrCode = qrRes.data.qrCodeBase64 || ''
|
|
|
- }
|
|
|
- if (!this.familyName) {
|
|
|
- try {
|
|
|
- var famRes = await getFamilyMemberList({ includeFamily: true })
|
|
|
- if (famRes.code === 200 && famRes.data && famRes.data.familyName) {
|
|
|
- this.familyName = famRes.data.familyName
|
|
|
- }
|
|
|
- } catch (e) {}
|
|
|
- }
|
|
|
- this.shareNickname = uni.getStorageSync('nickname') || ''
|
|
|
- this.shareAvatar = uni.getStorageSync('avatar') || ''
|
|
|
- this.showPoster = true
|
|
|
- } catch (e) {
|
|
|
- uni.showToast({ title: '生成失败', icon: 'none' })
|
|
|
- } finally {
|
|
|
- uni.hideLoading()
|
|
|
- }
|
|
|
- },
|
|
|
- goTeam() {
|
|
|
- uni.navigateTo({ url: '/pages/promotion/team' })
|
|
|
- },
|
|
|
goLeaderboard() {
|
|
|
uni.navigateTo({ url: '/pages/promotion/leaderboard' })
|
|
|
- },
|
|
|
- closePoster() {
|
|
|
- this.showPoster = false
|
|
|
}
|
|
|
}
|
|
|
}
|