index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  1. <template>
  2. <view class="page-wrapper" :style="{ '--font-scale': fontScale }">
  3. <scroll-view class="container" scroll-y scroll-with-animation>
  4. <!-- 家庭公共收益总览 -->
  5. <view class="family-earnings-card" v-if="familySummary">
  6. <view class="fe-header">
  7. <view class="fe-title-row">
  8. <text class="fe-title">🏠 家庭公共收益</text>
  9. <text class="fe-badge" v-if="isAdmin">管理员</text>
  10. </view>
  11. <text class="fe-subtitle">家庭成员共同努力的成果</text>
  12. </view>
  13. <view class="fe-grid">
  14. <view class="fe-item">
  15. <text class="fe-value orange">{{ cfVal(familySummary.totalEarned) }}</text>
  16. <text class="fe-label">累计推荐CF</text>
  17. </view>
  18. <view class="fe-item">
  19. <text class="fe-value blue">{{ cfVal(familySummary.availableAmount) }}</text>
  20. <text class="fe-label">可支配CF</text>
  21. </view>
  22. <view class="fe-item">
  23. <text class="fe-value green">{{ cfVal(familySummary.withdrawnAmount) }}</text>
  24. <text class="fe-label">已提现CF</text>
  25. </view>
  26. <view class="fe-item">
  27. <text class="fe-value purple">{{ cfVal(familySummary.distributedAmount) }}</text>
  28. <text class="fe-label">已分配CF</text>
  29. </view>
  30. </view>
  31. <!-- 管理员操作按钮(仅管理员可见) -->
  32. <view class="fe-actions" v-if="isAdmin">
  33. <button class="fe-btn fe-btn-distribute" @click="showDistributeSheet = true">分配收益</button>
  34. </view>
  35. </view>
  36. <!-- 成员贡献榜 -->
  37. <view class="members-card" v-if="members && members.length > 0">
  38. <view class="members-header">
  39. <text class="members-title">👥 成员贡献榜</text>
  40. <text class="members-toggle" @click="membersExpanded = !membersExpanded">
  41. {{ membersExpanded ? '收起' : '展开全部(' + members.length + ')' }}
  42. </text>
  43. </view>
  44. <view class="member-list">
  45. <view class="member-item" v-for="(m, idx) in displayMembers" :key="m.userId">
  46. <view class="member-rank">
  47. <text class="rank-num" v-if="idx < 3 && !showAllRanks">🏅</text>
  48. <text class="rank-num rank-plain" v-else>{{ idx + 1 }}</text>
  49. </view>
  50. <image v-if="m.avatar" class="member-avatar" :src="m.avatar" mode="aspectFill" lazy-load></image>
  51. <text v-else class="member-avatar-placeholder">{{ m.nickname ? m.nickname.charAt(0) : '?' }}</text>
  52. <view class="member-info">
  53. <text class="member-name">{{ m.nickname || '用户' }}</text>
  54. <text class="member-role-tag" v-if="m.isAdmin">管理员</text>
  55. <text class="member-balance-tag" v-if="m.canUseFamilyBalance">池可用</text>
  56. <text class="member-balance-tag disabled-tag" v-else>池关闭</text>
  57. </view>
  58. <view class="member-amounts">
  59. <text class="member-amount allocated">+{{ cfVal(m.allocatedAmount) }}</text>
  60. <text class="member-amount consumed">-{{ cfVal(m.consumedAmount) }}</text>
  61. <text class="member-amount available">={{ cfVal(m.availableAmount) }}</text>
  62. </view>
  63. <!-- 管理员可切换成员池权限 -->
  64. <switch v-if="isAdmin && !m.isAdmin" class="member-switch" :checked="m.canUseFamilyBalance" @change="toggleMemberAccess(m)" :color="primaryColor"></switch>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 提现弹窗(暂屏蔽) -->
  69. <!-- <view class="sheet-mask" v-if="showWithdrawSheet" @click="showWithdrawSheet = false">
  70. <view class="sheet-content" @click.stop>
  71. <text class="sheet-title">家庭收益提现</text>
  72. <text class="sheet-hint">可提现余额: {{ fenToYuan(familySummary ? familySummary.availableAmount : 0) }}</text>
  73. <input class="sheet-input" type="digit" v-model="withdrawAmount" placeholder="输入提现金额(分)" />
  74. <view class="sheet-actions">
  75. <button class="sheet-cancel" @click="showWithdrawSheet = false">取消</button>
  76. <button class="sheet-confirm" @click="doWithdraw" :disabled="!withdrawAmount || withdrawAmount <= 0">确认提现</button>
  77. </view>
  78. </view>
  79. </view> -->
  80. <!-- 统计卡片 -->
  81. <view class="stats-cards">
  82. <view class="stat-card today-card">
  83. <text class="stat-value">{{ stats.todayCommission || 0 }}</text>
  84. <text class="stat-label">今日CF</text>
  85. </view>
  86. <view class="stat-card month-card">
  87. <text class="stat-value">{{ stats.monthCommission || 0 }}</text>
  88. <text class="stat-label">本月CF</text>
  89. </view>
  90. <view class="stat-card total-card">
  91. <text class="stat-value">{{ stats.totalCommission || 0 }}</text>
  92. <text class="stat-label">累计CF</text>
  93. </view>
  94. </view>
  95. <!-- 转化漏斗 -->
  96. <view class="funnel-section" v-if="funnelSteps && funnelSteps.length > 0">
  97. <text class="section-title">转化漏斗</text>
  98. <view class="funnel">
  99. <view class="funnel-step" v-for="(step, index) in funnelSteps" :key="index" :style="{width: step.width + '%'}">
  100. <text class="funnel-label">{{ step.label }}</text>
  101. <text class="funnel-count">{{ step.count }}</text>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- 收益总览 -->
  106. <view class="earnings-card">
  107. <view class="earnings-header">
  108. <text class="earnings-title">收益总览</text>
  109. </view>
  110. <view class="earnings-body">
  111. <view class="earning-item">
  112. <text class="earning-label">累计获取CF</text>
  113. <text class="earning-value orange" v-if="summary">{{ cfVal(summary.totalEarned) }}</text>
  114. <text class="earning-value orange" v-else>0</text>
  115. </view>
  116. <view class="earning-divider"></view>
  117. <view class="earning-item">
  118. <text class="earning-label">可用CF</text>
  119. <text class="earning-value blue" v-if="summary">{{ cfVal(summary.available) }}</text>
  120. <text class="earning-value blue" v-else>0</text>
  121. </view>
  122. <view class="earning-divider"></view>
  123. <view class="earning-item">
  124. <text class="earning-label">冻结CF</text>
  125. <text class="earning-value green" v-if="summary">{{ cfVal(summary.frozen) }}</text>
  126. <text class="earning-value green" v-else>0</text>
  127. </view>
  128. </view>
  129. </view>
  130. <!-- 功能入口 -->
  131. <view class="menu-grid">
  132. <view class="menu-item" @click="goCommission">
  133. <view class="menu-icon-wrap icon-commission">
  134. <text class="menu-icon-text">📋</text>
  135. </view>
  136. <text class="menu-text">佣金明细</text>
  137. </view>
  138. <!-- 立即提现(暂屏蔽) -->
  139. <!-- <view class="menu-item" @click="goWithdraw" v-if="!isChild">
  140. <view class="menu-icon-wrap icon-withdraw">
  141. <text class="menu-icon-text">💰</text>
  142. </view>
  143. <text class="menu-text">立即提现</text>
  144. </view> -->
  145. <view class="menu-item" @click="goLeaderboard">
  146. <view class="menu-icon-wrap icon-leaderboard">
  147. <text class="menu-icon-text">🏆</text>
  148. </view>
  149. <text class="menu-text">推广排行榜</text>
  150. </view>
  151. <view class="menu-item" @click="goRecords" v-if="isAdmin">
  152. <view class="menu-icon-wrap icon-records">
  153. <text class="menu-icon-text">📊</text>
  154. </view>
  155. <text class="menu-text">家庭流水</text>
  156. </view>
  157. </view>
  158. <!-- 底部安全区 -->
  159. <view style="height:40rpx"></view>
  160. </scroll-view>
  161. <!-- iOS 修复:position: fixed 不能嵌套在 scroll-view 内,会导致固定定位失效。已移至 scroll-view 后 -->
  162. <view class="sheet-mask" v-if="showDistributeSheet" @click="showDistributeSheet = false">
  163. <view class="sheet-content" @click.stop>
  164. <text class="sheet-title">分配收益</text>
  165. <text class="sheet-hint">选择成员并输入分配CF值</text>
  166. <picker class="sheet-picker" mode="selector" :range="memberOptions" :value="distributeMemberIdx" @change="onDistributeMemberChange">
  167. <text>{{ distributeMemberIdx >= 0 ? memberOptions[distributeMemberIdx] : '选择成员' }}</text>
  168. </picker>
  169. <input class="sheet-input" type="digit" v-model="distributeAmount" placeholder="输入分配CF值" />
  170. <view class="sheet-actions">
  171. <button class="sheet-cancel" @click="showDistributeSheet = false">取消</button>
  172. <button class="sheet-confirm" @click="doDistribute" :disabled="distributeMemberIdx < 0 || !distributeAmount || distributeAmount <= 0">确认分配</button>
  173. </view>
  174. </view>
  175. </view>
  176. </view>
  177. </template>
  178. <script>
  179. import { BrandColors } from '@/utils/brand-colors.js'
  180. import { getReferralSummary, getCfSummary, getFamilyEarningsSummary, getFamilyEarningsMembers, getFamilyEarningsRecords, distributeToMember, toggleMemberBalance, withdrawFamilyEarnings, getReferralCode, extractReferralCode } from '../../utils/api.js'
  181. import fontScaleMixin from '@/mixins/font-scale.js'
  182. export default {
  183. mixins: [fontScaleMixin],
  184. data() {
  185. return {
  186. primaryColor: BrandColors.primary,
  187. totalEarnings: '0.00',
  188. availableAmount: '0.00',
  189. summary: null,
  190. stats: {},
  191. funnelData: {},
  192. funnelSteps: [],
  193. // 家庭收益
  194. familySummary: null,
  195. members: [],
  196. membersExpanded: false,
  197. showAllRanks: false,
  198. // 弹窗
  199. showWithdrawSheet: false,
  200. showDistributeSheet: false,
  201. withdrawAmount: '',
  202. distributeAmount: '',
  203. distributeMemberIdx: -1,
  204. memberOptions: [],
  205. // 分享推广码(用于右上角菜单分享)
  206. shareReferralCode: ''
  207. }
  208. },
  209. computed: {
  210. isLoggedIn() {
  211. return !!uni.getStorageSync('token')
  212. },
  213. role() {
  214. return uni.getStorageSync('role') || ''
  215. },
  216. isAdmin() {
  217. // 管理员 = parent 或 teacher 角色
  218. var r = this.role
  219. return r === 'parent' || r === 'teacher'
  220. },
  221. isChild() {
  222. return this.role === 'child'
  223. },
  224. displayMembers() {
  225. if (this.membersExpanded || this.showAllRanks) {
  226. return this.members
  227. }
  228. return this.members.slice(0, 5)
  229. }
  230. },
  231. onLoad() {
  232. this.loadData()
  233. this.ensureShareCode()
  234. },
  235. onShow() {
  236. this.loadStats()
  237. this.loadFunnelData()
  238. this.loadFamilyData()
  239. },
  240. onShareAppMessage() {
  241. var path = '/pages/invite/join'
  242. if (this.shareReferralCode) {
  243. path = path + '?refCode=' + this.shareReferralCode
  244. }
  245. return {
  246. title: '我在浠艾福发现了好用的家庭成长工具,快来加入!',
  247. path: path,
  248. imageUrl: ''
  249. }
  250. },
  251. onShareTimeline() {
  252. var query = ''
  253. if (this.shareReferralCode) {
  254. query = 'refCode=' + this.shareReferralCode
  255. }
  256. return {
  257. title: '我在浠艾福发现了好用的家庭成长工具,快来加入!',
  258. query: query,
  259. imageUrl: ''
  260. }
  261. },
  262. methods: {
  263. async ensureShareCode() {
  264. if (this.shareReferralCode) return
  265. try {
  266. var codeRes = await getReferralCode()
  267. this.shareReferralCode = extractReferralCode(codeRes)
  268. } catch (e) {}
  269. },
  270. async loadData() {
  271. try {
  272. var summaryRes = await getReferralSummary()
  273. if (summaryRes.data) {
  274. this.totalEarnings = summaryRes.data.totalEarnings || '0.00'
  275. }
  276. } catch (e) {
  277. console.error('获取邀请统计失败', e)
  278. }
  279. try {
  280. var comRes = await getCfSummary()
  281. if (comRes.data) {
  282. this.summary = comRes.data
  283. this.availableAmount = comRes.data.available || '0.00'
  284. }
  285. } catch (e) {
  286. console.error('获取 CF 总览失败', e)
  287. }
  288. },
  289. async loadFamilyData() {
  290. if (this.isChild) {
  291. // 成员只读:仅加载概要,不加载管理员功能
  292. try {
  293. var sRes = await getFamilyEarningsSummary()
  294. if (sRes.data) {
  295. this.familySummary = sRes.data
  296. this.members = sRes.data.members || []
  297. }
  298. } catch (e) {
  299. console.error('获取家庭收益概览失败', e)
  300. }
  301. return
  302. }
  303. try {
  304. var sRes = await getFamilyEarningsSummary()
  305. if (sRes.data) {
  306. this.familySummary = sRes.data
  307. this.members = sRes.data.members || []
  308. // 构建picker选项
  309. var opts = []
  310. var arr = this.members
  311. for (var i = 0; i < arr.length; i++) {
  312. opts.push((arr[i].nickname || '用户' + arr[i].userId) + ' (余额:' + this.cfVal(arr[i].availableAmount) + ' CF)')
  313. }
  314. this.memberOptions = opts
  315. }
  316. } catch (e) {
  317. console.error('获取家庭收益概览失败', e)
  318. }
  319. },
  320. loadStats() {
  321. var self = this
  322. var token = uni.getStorageSync('token')
  323. var baseUrl = ''
  324. try {
  325. var config = require('../../config.js')
  326. baseUrl = config.default.baseUrl || config.baseUrl || ''
  327. } catch (e) {
  328. baseUrl = ''
  329. }
  330. uni.request({
  331. url: baseUrl + '/api/commission/stats',
  332. method: 'POST',
  333. header: { 'Authorization': 'Bearer ' + token },
  334. success: function(res) {
  335. if (res.data && res.data.code === 200) {
  336. self.stats = res.data.data || {}
  337. }
  338. }
  339. })
  340. },
  341. loadFunnelData() {
  342. var self = this
  343. var token = uni.getStorageSync('token')
  344. var baseUrl = ''
  345. try {
  346. var config = require('../../config.js')
  347. baseUrl = config.default.baseUrl || config.baseUrl || ''
  348. } catch (e) {
  349. baseUrl = ''
  350. }
  351. uni.request({
  352. url: baseUrl + '/api/commission/funnel',
  353. method: 'POST',
  354. header: { 'Authorization': 'Bearer ' + token },
  355. success: function(res) {
  356. if (res.data && res.data.code === 200) {
  357. self.funnelData = res.data.data || {}
  358. self.buildFunnelSteps()
  359. }
  360. }
  361. })
  362. },
  363. buildFunnelSteps() {
  364. var data = this.funnelData
  365. var max = Math.max(data.invites || 1, data.registered || 0, data.purchased || 0, data.repeatPurchased || 0, data.totalOrders || 0)
  366. if (max < 1) max = 1
  367. this.funnelSteps = [
  368. { label: '邀请', count: data.invites || 0, width: 100 },
  369. { label: '注册', count: data.registered || 0, width: Math.round(((data.registered || 0) / max) * 100) },
  370. { label: '首购', count: data.purchased || 0, width: Math.round(((data.purchased || 0) / max) * 100) },
  371. { label: '复购', count: data.repeatPurchased || 0, width: Math.round(((data.repeatPurchased || 0) / max) * 100) },
  372. { label: '订单', count: data.totalOrders || 0, width: Math.round(((data.totalOrders || 0) / max) * 100) }
  373. ]
  374. },
  375. cfVal(val) {
  376. if (val === null || val === undefined) return '0'
  377. var num = Number(val)
  378. if (isNaN(num)) return '0'
  379. return String(num)
  380. },
  381. // 管理员操作
  382. toggleMemberAccess(m) {
  383. var self = this
  384. var enabled = !m.canUseFamilyBalance
  385. uni.showLoading({ title: '操作中...' })
  386. toggleMemberBalance({ userId: m.userId, enabled: enabled }).then(function(res) {
  387. uni.hideLoading()
  388. if (res.code === 200) {
  389. m.canUseFamilyBalance = enabled
  390. uni.showToast({ title: '操作成功', icon: 'success' })
  391. } else {
  392. uni.showToast({ title: res.message || '操作失败', icon: 'none' })
  393. }
  394. }).catch(function(e) {
  395. uni.hideLoading()
  396. uni.showToast({ title: '操作失败', icon: 'none' })
  397. })
  398. },
  399. onDistributeMemberChange(e) {
  400. this.distributeMemberIdx = e.detail.value
  401. },
  402. doDistribute() {
  403. var idx = this.distributeMemberIdx
  404. if (idx < 0 || !this.members[idx]) {
  405. uni.showToast({ title: '请选择成员', icon: 'none' })
  406. return
  407. }
  408. var amount = Number(this.distributeAmount)
  409. if (!amount || amount <= 0) {
  410. uni.showToast({ title: '请输入有效金额', icon: 'none' })
  411. return
  412. }
  413. var self = this
  414. uni.showLoading({ title: '分配中...' })
  415. distributeToMember({ userId: this.members[idx].userId, amount: amount }).then(function(res) {
  416. uni.hideLoading()
  417. if (res.code === 200) {
  418. uni.showToast({ title: '分配成功', icon: 'success' })
  419. self.showDistributeSheet = false
  420. self.distributeAmount = ''
  421. self.distributeMemberIdx = -1
  422. self.loadFamilyData()
  423. } else {
  424. uni.showToast({ title: res.message || '分配失败', icon: 'none' })
  425. }
  426. }).catch(function(e) {
  427. uni.hideLoading()
  428. uni.showToast({ title: '分配失败', icon: 'none' })
  429. })
  430. },
  431. doWithdraw() {
  432. var amount = Number(this.withdrawAmount)
  433. if (!amount || amount <= 0) {
  434. uni.showToast({ title: '请输入有效金额', icon: 'none' })
  435. return
  436. }
  437. var self = this
  438. uni.showLoading({ title: '提现中...' })
  439. withdrawFamilyEarnings({ amount: amount }).then(function(res) {
  440. uni.hideLoading()
  441. if (res.code === 200) {
  442. uni.showToast({ title: '提现申请已提交', icon: 'success' })
  443. self.showWithdrawSheet = false
  444. self.withdrawAmount = ''
  445. self.loadFamilyData()
  446. } else {
  447. uni.showToast({ title: res.message || '提现失败', icon: 'none' })
  448. }
  449. }).catch(function(e) {
  450. uni.hideLoading()
  451. uni.showToast({ title: '提现失败', icon: 'none' })
  452. })
  453. },
  454. goRecords() {
  455. uni.navigateTo({ url: '/pages/promotion/records' })
  456. },
  457. goCommission() {
  458. uni.navigateTo({ url: '/pages/promotion/commission' })
  459. },
  460. goWithdraw() {
  461. uni.navigateTo({ url: '/pages/promotion/withdraw' })
  462. },
  463. goLeaderboard() {
  464. uni.navigateTo({ url: '/pages/promotion/leaderboard' })
  465. }
  466. }
  467. }
  468. </script>
  469. <style scoped lang="scss">
  470. .page-wrapper { min-height: 100vh; }
  471. .container {
  472. padding: $uni-space-page;
  473. min-height: 100vh;
  474. background: $uni-primary-pale;
  475. box-sizing: border-box;
  476. }
  477. .invite-card {
  478. background: linear-gradient(135deg, $brand-primary, $brand-primary-dark);
  479. border-radius: 24rpx;
  480. padding: 40rpx;
  481. color: $app-surface;
  482. margin-bottom: $uni-space-lg;
  483. }
  484. .code-section {
  485. margin-bottom: $uni-space-lg;
  486. }
  487. .code-label {
  488. font-size: calc(24rpx * var(--font-scale, 1));
  489. opacity: 0.85;
  490. }
  491. .code-value {
  492. display: flex;
  493. align-items: center;
  494. margin-top: 12rpx;
  495. }
  496. .code-text {
  497. font-size: calc(44rpx * var(--font-scale, 1));
  498. font-weight: bold;
  499. letter-spacing: 6rpx;
  500. }
  501. .copy-icon {
  502. font-size: calc(36rpx * var(--font-scale, 1));
  503. margin-left: 16rpx;
  504. opacity: 0.9;
  505. }
  506. .code-hint {
  507. font-size: calc(22rpx * var(--font-scale, 1));
  508. opacity: 0.7;
  509. margin-top: 8rpx;
  510. display: block;
  511. }
  512. .share-btn {
  513. background: rgba(255,255,255,0.2);
  514. color: $app-surface;
  515. font-size: calc(28rpx * var(--font-scale, 1));
  516. border-radius: 24rpx;
  517. height: 72rpx;
  518. line-height: 72rpx;
  519. border: 1rpx solid rgba(255,255,255,0.3);
  520. }
  521. .share-btn::after { border: none; }
  522. .share-btn:active { opacity: 0.8; }
  523. /* ===== 家庭公共收益卡 ===== */
  524. .family-earnings-card {
  525. background: $app-surface;
  526. border-radius: 24rpx;
  527. padding: $uni-space-lg;
  528. margin-bottom: $uni-space-lg;
  529. box-shadow: 0 2rpx 12rpx rgba(249,115,22,0.08);
  530. border-left: 6rpx solid $brand-primary;
  531. }
  532. .fe-header {
  533. margin-bottom: 24rpx;
  534. }
  535. .fe-title-row {
  536. display: flex;
  537. align-items: center;
  538. justify-content: space-between;
  539. }
  540. .fe-title {
  541. font-size: calc(30rpx * var(--font-scale, 1));
  542. font-weight: 600;
  543. color: $uni-text-color;
  544. }
  545. .fe-badge {
  546. font-size: calc(20rpx * var(--font-scale, 1));
  547. color: $brand-primary;
  548. background: $uni-primary-pale;
  549. padding: 4rpx 14rpx;
  550. border-radius: 24rpx;
  551. }
  552. .fe-subtitle {
  553. font-size: calc(22rpx * var(--font-scale, 1));
  554. color: $app-text-subtle;
  555. margin-top: 6rpx;
  556. display: block;
  557. }
  558. .fe-grid {
  559. display: flex;
  560. flex-wrap: wrap;
  561. margin-bottom: 20rpx;
  562. }
  563. .fe-item {
  564. width: 50%;
  565. text-align: center;
  566. padding: 16rpx 0;
  567. }
  568. .fe-value {
  569. font-size: calc(36rpx * var(--font-scale, 1));
  570. font-weight: bold;
  571. display: block;
  572. }
  573. .fe-value.orange { color: $brand-primary; }
  574. .fe-value.blue { color: $uni-info; }
  575. .fe-value.green { color: $status-success; }
  576. .fe-value.purple { color: $facade-violet; }
  577. .fe-label {
  578. font-size: calc(22rpx * var(--font-scale, 1));
  579. color: $app-text-subtle;
  580. margin-top: 6rpx;
  581. display: block;
  582. }
  583. .fe-actions {
  584. display: flex;
  585. gap: 20rpx;
  586. padding-top: 16rpx;
  587. border-top: 1rpx solid $brand-primary-light-2;
  588. }
  589. .fe-btn {
  590. flex: 1;
  591. height: 64rpx;
  592. line-height: 64rpx;
  593. font-size: calc(26rpx * var(--font-scale, 1));
  594. border-radius: 24rpx;
  595. text-align: center;
  596. }
  597. .fe-btn::after { border: none; }
  598. .fe-btn-withdraw {
  599. background: $brand-primary;
  600. color: $app-surface;
  601. }
  602. .fe-btn-distribute {
  603. background: $uni-primary-pale;
  604. color: $brand-primary;
  605. border: 1rpx solid $brand-primary-light-2;
  606. }
  607. /* ===== 成员贡献榜 ===== */
  608. .members-card {
  609. background: $app-surface;
  610. border-radius: 24rpx;
  611. padding: $uni-space-lg;
  612. margin-bottom: $uni-space-lg;
  613. box-shadow: 0 2rpx 12rpx rgba(249,115,22,0.08);
  614. }
  615. .members-header {
  616. display: flex;
  617. align-items: center;
  618. justify-content: space-between;
  619. margin-bottom: 20rpx;
  620. }
  621. .members-title {
  622. font-size: calc(30rpx * var(--font-scale, 1));
  623. font-weight: 600;
  624. color: $uni-text-color;
  625. }
  626. .members-toggle {
  627. font-size: calc(24rpx * var(--font-scale, 1));
  628. color: $brand-primary;
  629. }
  630. .member-list {
  631. display: flex;
  632. flex-direction: column;
  633. }
  634. .member-item {
  635. display: flex;
  636. align-items: center;
  637. padding: 16rpx 0;
  638. border-bottom: 1rpx solid $uni-primary-pale;
  639. }
  640. .member-item:last-child {
  641. border-bottom: none;
  642. }
  643. .member-rank {
  644. width: 48rpx;
  645. flex-shrink: 0;
  646. text-align: center;
  647. }
  648. .rank-num {
  649. font-size: calc(28rpx * var(--font-scale, 1));
  650. }
  651. .rank-plain {
  652. font-size: calc(24rpx * var(--font-scale, 1));
  653. color: $app-text-subtle;
  654. font-weight: 500;
  655. }
  656. .member-avatar {
  657. width: 56rpx;
  658. height: 56rpx;
  659. border-radius: 50%;
  660. margin-right: 16rpx;
  661. flex-shrink: 0;
  662. background: $status-warning-soft;
  663. }
  664. .member-avatar-placeholder {
  665. width: 56rpx;
  666. height: 56rpx;
  667. border-radius: 50%;
  668. margin-right: 16rpx;
  669. flex-shrink: 0;
  670. background: $status-warning-soft;
  671. display: flex;
  672. align-items: center;
  673. justify-content: center;
  674. font-size: calc(24rpx * var(--font-scale, 1));
  675. color: $brand-primary;
  676. text-align: center;
  677. line-height: 56rpx;
  678. }
  679. .member-info {
  680. flex: 1;
  681. min-width: 0;
  682. display: flex;
  683. flex-wrap: wrap;
  684. align-items: center;
  685. gap: 8rpx;
  686. }
  687. .member-name {
  688. font-size: calc(26rpx * var(--font-scale, 1));
  689. color: $uni-text-color;
  690. font-weight: 500;
  691. max-width: 140rpx;
  692. overflow: hidden;
  693. text-overflow: ellipsis;
  694. white-space: nowrap;
  695. }
  696. .member-role-tag {
  697. font-size: calc(18rpx * var(--font-scale, 1));
  698. color: $app-surface;
  699. background: $brand-primary;
  700. padding: 2rpx 10rpx;
  701. border-radius: 16rpx;
  702. }
  703. .member-balance-tag {
  704. font-size: calc(18rpx * var(--font-scale, 1));
  705. color: $status-success;
  706. background: $status-success-soft;
  707. padding: 2rpx 10rpx;
  708. border-radius: 16rpx;
  709. }
  710. .member-balance-tag.disabled-tag {
  711. color: $app-text-subtle;
  712. background: $facade-fill-slate;
  713. }
  714. .member-amounts {
  715. display: flex;
  716. flex-direction: column;
  717. align-items: flex-end;
  718. margin-right: 12rpx;
  719. flex-shrink: 0;
  720. }
  721. .member-amount {
  722. font-size: calc(20rpx * var(--font-scale, 1));
  723. line-height: 1.6;
  724. }
  725. .member-amount.allocated { color: $status-success; }
  726. .member-amount.consumed { color: $status-danger; }
  727. .member-amount.available { color: $brand-primary; font-weight: 600; }
  728. .member-switch {
  729. transform: scale(0.7);
  730. flex-shrink: 0;
  731. }
  732. /* ===== 弹窗 ===== */
  733. .sheet-mask {
  734. position: fixed;
  735. top: 0;
  736. left: 0;
  737. right: 0;
  738. bottom: 0;
  739. background: rgba(0,0,0,0.4);
  740. z-index: 999;
  741. display: flex;
  742. align-items: flex-end;
  743. justify-content: center;
  744. }
  745. .sheet-content {
  746. background: $app-surface;
  747. border-radius: 24rpx 24rpx 0 0;
  748. padding: 40rpx 32rpx;
  749. padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
  750. width: 100%;
  751. max-width: 750rpx;
  752. box-sizing: border-box;
  753. }
  754. .sheet-title {
  755. font-size: calc(32rpx * var(--font-scale, 1));
  756. font-weight: 600;
  757. color: $uni-text-color;
  758. display: block;
  759. margin-bottom: 12rpx;
  760. }
  761. .sheet-hint {
  762. font-size: calc(24rpx * var(--font-scale, 1));
  763. color: $app-text-subtle;
  764. display: block;
  765. margin-bottom: 24rpx;
  766. }
  767. .sheet-input {
  768. height: 80rpx;
  769. border: 1rpx solid $brand-primary-light-2;
  770. border-radius: 16rpx;
  771. padding: 0 24rpx;
  772. font-size: calc(28rpx * var(--font-scale, 1));
  773. color: $uni-text-color;
  774. margin-bottom: 24rpx;
  775. }
  776. .sheet-picker {
  777. height: 80rpx;
  778. border: 1rpx solid $brand-primary-light-2;
  779. border-radius: 16rpx;
  780. padding: 0 24rpx;
  781. font-size: calc(26rpx * var(--font-scale, 1));
  782. color: $uni-text-color;
  783. margin-bottom: 24rpx;
  784. display: flex;
  785. align-items: center;
  786. }
  787. .sheet-actions {
  788. display: flex;
  789. gap: 20rpx;
  790. }
  791. .sheet-cancel {
  792. flex: 1;
  793. height: 72rpx;
  794. line-height: 72rpx;
  795. background: $facade-fill-slate;
  796. color: $uni-text-color-secondary;
  797. font-size: calc(28rpx * var(--font-scale, 1));
  798. border-radius: 24rpx;
  799. }
  800. .sheet-cancel::after { border: none; }
  801. .sheet-confirm {
  802. flex: 1;
  803. height: 72rpx;
  804. line-height: 72rpx;
  805. background: $brand-primary;
  806. color: $app-surface;
  807. font-size: calc(28rpx * var(--font-scale, 1));
  808. border-radius: 24rpx;
  809. }
  810. .sheet-confirm::after { border: none; }
  811. .sheet-confirm[disabled] {
  812. opacity: 0.5;
  813. }
  814. /* ===== 统计卡片 ===== */
  815. .stats-cards {
  816. display: flex;
  817. justify-content: space-between;
  818. margin-bottom: $uni-space-lg;
  819. }
  820. .stat-card {
  821. flex: 1;
  822. margin: 0 10rpx;
  823. border-radius: 16rpx;
  824. padding: 24rpx 0;
  825. text-align: center;
  826. color: $app-surface;
  827. }
  828. .stat-card:first-child { margin-left: 0; }
  829. .stat-card:last-child { margin-right: 0; }
  830. .today-card { background: linear-gradient(135deg, $brand-primary, $brand-primary-light); }
  831. .month-card { background: linear-gradient(135deg, $uni-info, $status-info-light); }
  832. .total-card { background: linear-gradient(135deg, $status-success, $status-success-light-3); }
  833. .stat-value {
  834. font-size: calc(36rpx * var(--font-scale, 1));
  835. font-weight: bold;
  836. display: block;
  837. }
  838. .stat-label {
  839. font-size: calc(22rpx * var(--font-scale, 1));
  840. opacity: 0.9;
  841. margin-top: 8rpx;
  842. display: block;
  843. }
  844. /* ===== 转化漏斗 ===== */
  845. .funnel-section {
  846. background: $app-surface;
  847. border-radius: 24rpx;
  848. padding: $uni-space-lg;
  849. margin-bottom: $uni-space-lg;
  850. box-shadow: 0 2rpx 12rpx rgba(249,115,22,0.08);
  851. }
  852. .section-title {
  853. font-size: calc(28rpx * var(--font-scale, 1));
  854. font-weight: 600;
  855. color: $uni-text-color;
  856. margin-bottom: 20rpx;
  857. display: block;
  858. }
  859. .funnel {
  860. display: flex;
  861. flex-direction: column;
  862. align-items: center;
  863. }
  864. .funnel-step {
  865. background: linear-gradient(90deg, $brand-primary, $brand-primary-light);
  866. border-radius: 16rpx;
  867. padding: 20rpx 0;
  868. margin-bottom: 16rpx;
  869. display: flex;
  870. justify-content: space-between;
  871. align-items: center;
  872. padding-left: 24rpx;
  873. padding-right: 24rpx;
  874. min-width: 60%;
  875. transition: width 0.3s ease;
  876. }
  877. .funnel-label {
  878. font-size: calc(26rpx * var(--font-scale, 1));
  879. color: $app-surface;
  880. font-weight: 500;
  881. }
  882. .funnel-count {
  883. font-size: calc(28rpx * var(--font-scale, 1));
  884. color: $app-surface;
  885. font-weight: bold;
  886. }
  887. /* ===== 收益总览 ===== */
  888. .earnings-card {
  889. background: $app-surface;
  890. border-radius: 24rpx;
  891. margin-bottom: $uni-space-lg;
  892. box-shadow: 0 2rpx 12rpx rgba(249,115,22,0.08);
  893. overflow: hidden;
  894. }
  895. .earnings-header {
  896. padding: 24rpx 32rpx 0;
  897. }
  898. .earnings-title {
  899. font-size: calc(28rpx * var(--font-scale, 1));
  900. font-weight: 600;
  901. color: $uni-text-color;
  902. }
  903. .earnings-body {
  904. display: flex;
  905. align-items: center;
  906. padding: 24rpx 32rpx 32rpx;
  907. }
  908. .earning-item {
  909. flex: 1;
  910. text-align: center;
  911. }
  912. .earning-label {
  913. font-size: calc(22rpx * var(--font-scale, 1));
  914. color: $app-text-subtle;
  915. display: block;
  916. margin-bottom: 8rpx;
  917. }
  918. .earning-value {
  919. font-size: calc(36rpx * var(--font-scale, 1));
  920. font-weight: bold;
  921. }
  922. .earning-value.orange { color: $brand-primary; }
  923. .earning-value.blue { color: $uni-info; }
  924. .earning-value.green { color: $status-success; }
  925. .earning-divider {
  926. width: 1rpx;
  927. height: 64rpx;
  928. background: $brand-primary-light-2;
  929. }
  930. /* ===== 功能入口 ===== */
  931. .menu-grid {
  932. display: flex;
  933. flex-wrap: wrap;
  934. background: $app-surface;
  935. border-radius: 24rpx;
  936. padding: 24rpx 0;
  937. box-shadow: 0 2rpx 12rpx rgba(249,115,22,0.08);
  938. }
  939. .menu-item {
  940. width: 33.33%;
  941. display: flex;
  942. flex-direction: column;
  943. align-items: center;
  944. padding: 24rpx 0;
  945. box-sizing: border-box;
  946. }
  947. .menu-icon-wrap {
  948. width: 80rpx;
  949. height: 80rpx;
  950. border-radius: 24rpx;
  951. display: flex;
  952. align-items: center;
  953. justify-content: center;
  954. margin-bottom: 12rpx;
  955. }
  956. .icon-commission { background: $status-warning-soft; }
  957. .icon-withdraw { background: $status-info-soft; }
  958. .icon-invite { background: $status-success-soft; }
  959. .icon-share { background: $tint-sky-tint; }
  960. .icon-team { background: $accent-pink-tint; }
  961. .icon-leaderboard { background: #FFF3CD; }
  962. .icon-records { background: $violet-tint-100; }
  963. .menu-icon-text {
  964. font-size: calc(36rpx * var(--font-scale, 1));
  965. }
  966. .menu-text {
  967. font-size: calc(26rpx * var(--font-scale, 1));
  968. color: $uni-text-color;
  969. font-weight: 500;
  970. }
  971. </style>