upgrade.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  1. <template>
  2. <view class="upgrade-page-wrapper" :style="{ '--font-scale': fontScale }">
  3. <scroll-view class="page" scroll-y>
  4. <!-- 当前会员状态条 -->
  5. <view class="status-card">
  6. <view class="status-top">
  7. <view class="status-badge" :class="isFree ? 'badge-free' : 'badge-family'">
  8. <text class="badge-icon">{{ isFree ? '○' : '●' }}</text>
  9. <text class="badge-text">{{ currentLevelName }}</text>
  10. </view>
  11. <text class="free-hint" v-if="isFree">开通会员解锁全部特权</text>
  12. <text class="expiry-value" v-else-if="membership && membership.memberLevel !== 'FREE'">
  13. {{ formatDate(membership.endDate) }} 到期
  14. </text>
  15. </view>
  16. <view class="status-body" v-if="membership && membership.memberLevel !== 'FREE'">
  17. <view class="days-remaining" v-if="membership.isActive">
  18. <text class="days-num">{{ membership.daysRemaining || 0 }}</text>
  19. <text class="days-unit">天剩余</text>
  20. </view>
  21. <view class="expired-msg" v-else>
  22. <text class="expired-text">会员已过期,续费恢复权益</text>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 等级切换 tabs -->
  27. <view class="level-tabs" v-if="buyableLevels.length > 0">
  28. <view class="level-tab" v-for="lv in buyableLevels" :key="lv.levelCode"
  29. :class="selectedLevel === lv.levelCode ? 'level-tab-active' : ''"
  30. @click="selectLevel(lv.levelCode)">
  31. <text class="level-tab-name">{{ lv.levelName }}</text>
  32. </view>
  33. </view>
  34. <!-- 开通/升级/续费卡片(标题统一为所选等级名) -->
  35. <view class="upgrade-card">
  36. <view class="upgrade-header">
  37. <text class="upgrade-title">{{ getSelectedLevelName() }}</text>
  38. </view>
  39. <!-- 档位选择 -->
  40. <view class="period-tabs">
  41. <view
  42. class="period-tab"
  43. v-for="p in visiblePeriods"
  44. :key="p.key"
  45. :class="selectedPeriod === p.key ? 'period-tab-active' : ''"
  46. @click="selectPeriod(p.key)"
  47. >
  48. <text class="period-tab-label">{{ p.label }}</text>
  49. <text class="period-tab-price">¥{{ getPriceForPeriod(p.key) }}</text>
  50. <text class="period-original" v-if="showOriginalPrice(p.key)">¥{{ getOriginalPriceForPeriod(p.key) / 100 }}</text>
  51. </view>
  52. </view>
  53. <button class="btn-upgrade" @click="goNext">{{ isRenew ? '续费' : '下一步' }}</button>
  54. </view>
  55. <!-- 权益对比表 -->
  56. <view class="compare-section">
  57. <text class="section-title">权益对比</text>
  58. <view class="compare-table">
  59. <view class="compare-row header-row">
  60. <text class="compare-cell cell-feature">权益项</text>
  61. <text class="compare-cell" v-for="(col, cidx) in compareColumns" :key="cidx" :class="col.levelCode === selectedLevel ? 'active' : ''">{{ col.levelName || col.levelCode }}</text>
  62. </view>
  63. <view class="compare-row" v-for="(item, idx) in compareData" :key="idx">
  64. <text class="compare-cell cell-feature">{{ item.benefitName || item.name }}</text>
  65. <text class="compare-cell" v-for="(col, cidx) in compareColumns" :key="cidx" :class="col.levelCode === selectedLevel ? 'active' : ''">{{ getCompareCell(item, col.levelCode) }}</text>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 开通赠券规则 -->
  70. <view class="join-rules-section" v-if="joinRules.length > 0">
  71. <text class="section-title">开通赠券</text>
  72. <view class="join-rule-item" v-for="(rule, idx) in joinRules" :key="getJoinRuleKey(rule, idx)">
  73. <text class="join-rule-text">加入{{ getLevelName(rule.grantLevelCode) }}会员,赠送{{ rule.grantQuantity || 1 }}张「{{ rule.name }}」</text>
  74. <text class="join-rule-desc">{{ getCouponDesc(rule) }}</text>
  75. </view>
  76. </view>
  77. <!-- 升级记录 -->
  78. <view class="records-section" v-if="records.length > 0">
  79. <text class="section-title">升级记录</text>
  80. <view class="record-item" v-for="record in records" :key="record.id">
  81. <view class="record-left">
  82. <text class="record-level">{{ record.levelName }}</text>
  83. <text class="record-time">{{ formatDate(record.createdAt) }}</text>
  84. </view>
  85. <text class="record-amount">{{ formatPriceWithSymbol(record.amount) }}</text>
  86. </view>
  87. </view>
  88. </scroll-view>
  89. </view>
  90. </template>
  91. <script>
  92. import { getMyMembership, getMembershipPlans, getUpgradeRecords, getJoinCouponRules, getMembershipCompare } from '../../utils/api.js'
  93. import { parseDate } from '../../utils/format.js'
  94. import fontScaleMixin from '@/mixins/font-scale.js'
  95. export default {
  96. mixins: [fontScaleMixin],
  97. data() {
  98. return {
  99. membership: null,
  100. levels: [],
  101. records: [],
  102. isFree: true,
  103. currentLevelName: '免费用户',
  104. compareData: [],
  105. periods: [
  106. { key: 'monthly', label: '月度', unit: '/月' },
  107. { key: 'quarterly', label: '季度', unit: '/季' },
  108. { key: 'yearly', label: '年度', unit: '/年' }
  109. ],
  110. selectedPeriod: 'yearly',
  111. selectedLevel: '',
  112. joinRules: [],
  113. compareColumns: [],
  114. }
  115. },
  116. computed: {
  117. buyableLevels() {
  118. var self = this
  119. return this.levels.filter(function(lv) {
  120. return lv.levelCode !== 'FREE' && lv.levelCode !== 'LIFETIME' && lv.levelCode !== 'PROVIDER'
  121. })
  122. },
  123. isRenew() {
  124. var current = this.membership && this.membership.memberLevel
  125. if (current && current !== 'FREE' && this.selectedLevel === current) return true
  126. return false
  127. },
  128. visiblePeriods() {
  129. var self = this
  130. return this.periods.filter(function(p) {
  131. var plan = null
  132. for (var i = 0; i < self.levels.length; i++) {
  133. if (self.levels[i].levelCode === self.selectedLevel) {
  134. plan = self.levels[i]
  135. break
  136. }
  137. }
  138. if (!plan) return false
  139. var price
  140. if (p.key === 'monthly') price = plan.monthly
  141. else if (p.key === 'quarterly') price = plan.quarterly
  142. else price = plan.yearly
  143. return price != null && price > 0
  144. })
  145. }
  146. },
  147. onLoad() {
  148. this.loadData()
  149. this.loadJoinRules()
  150. },
  151. methods: {
  152. loadJoinRules() {
  153. var that = this
  154. getJoinCouponRules().then(function(res) {
  155. if (res.code === 200) {
  156. that.joinRules = res.data || []
  157. }
  158. }).catch(function(e) {
  159. console.error('加载开通赠券规则失败', e)
  160. })
  161. },
  162. getLevelName(code) {
  163. if (!code) return ''
  164. for (var i = 0; i < this.levels.length; i++) {
  165. if (this.levels[i].levelCode === code) {
  166. return this.levels[i].levelName || code
  167. }
  168. }
  169. return code || ''
  170. },
  171. getSelectedLevelName() {
  172. var name = ''
  173. for (var i = 0; i < this.levels.length; i++) {
  174. if (this.levels[i].levelCode === this.selectedLevel) {
  175. name = this.levels[i].levelName
  176. break
  177. }
  178. }
  179. return name || this.getLevelName(this.selectedLevel)
  180. },
  181. getJoinRuleKey(rule, idx) {
  182. return rule.id + '-' + idx
  183. },
  184. getCouponDesc(item) {
  185. if (!item) return ''
  186. if (item.type === 'DISCOUNT' || item.type === 'PERCENT') {
  187. return '折扣券 ' + (item.discountRate / 100).toFixed(1) + '折'
  188. }
  189. return '立减 ' + (item.value / 100).toFixed(2) + '元'
  190. },
  191. async loadData() {
  192. try {
  193. const membershipRes = await getMyMembership()
  194. this.membership = membershipRes.data
  195. if (this.membership && this.membership.memberLevel && this.membership.memberLevel !== 'FREE') {
  196. this.isFree = false
  197. this.currentLevelName = this.membership.levelName || this.getLevelName(this.membership.memberLevel)
  198. } else {
  199. this.isFree = true
  200. this.currentLevelName = (this.membership && this.membership.levelName) || ''
  201. }
  202. } catch (e) {
  203. console.error('加载会员信息失败', e)
  204. }
  205. try {
  206. const levelsRes = await getMembershipPlans()
  207. this.levels = levelsRes.data || []
  208. this.applyDefaultLevel()
  209. // 等级名改从接口返回的 levelName 读取(含免费用户),前端不再维护等级名映射
  210. var lvCode = (this.membership && this.membership.memberLevel) ? this.membership.memberLevel : 'FREE'
  211. this.currentLevelName = (this.membership && this.membership.levelName) || this.getLevelName(lvCode)
  212. } catch (e) {
  213. console.error('加载会员等级失败', e)
  214. }
  215. try {
  216. const recordsRes = await getUpgradeRecords()
  217. if (recordsRes.data && recordsRes.data.records) {
  218. this.records = recordsRes.data.records
  219. }
  220. } catch (e) {
  221. console.error('加载升级记录失败', e)
  222. }
  223. this.loadCompare()
  224. },
  225. loadCompare() {
  226. var self = this
  227. getMembershipCompare().then(function(res) {
  228. if (res.code === 200 && res.data) {
  229. self.compareColumns = res.data.columns || []
  230. self.compareData = res.data.rows || []
  231. }
  232. }).catch(function(e) {
  233. console.error('加载权益对比表失败', e)
  234. })
  235. },
  236. getCompareCell(item, levelCode) {
  237. if (!item || !item.cells) return ''
  238. var cell = item.cells[levelCode]
  239. if (!cell) return ''
  240. if (cell.value != null && cell.value !== '') return cell.value
  241. return cell.included ? '✓' : '—'
  242. },
  243. selectLevel: function(code) {
  244. this.selectedLevel = code
  245. // 选中第一个有价格的周期,避免切换到无价格的周期导致空档
  246. var plan = null
  247. for (var i = 0; i < this.levels.length; i++) {
  248. if (this.levels[i].levelCode === code) { plan = this.levels[i]; break }
  249. }
  250. if (plan) {
  251. if (plan.monthly && plan.monthly > 0) this.selectedPeriod = 'monthly'
  252. else if (plan.quarterly && plan.quarterly > 0) this.selectedPeriod = 'quarterly'
  253. else if (plan.yearly && plan.yearly > 0) this.selectedPeriod = 'yearly'
  254. } else {
  255. this.selectedPeriod = 'yearly'
  256. }
  257. },
  258. selectPeriod: function(key) {
  259. this.selectedPeriod = key
  260. },
  261. getLevelOrder(code) {
  262. // 等级高低改由接口返回的 levelOrder 比较,前端不再维护任何等级排序映射
  263. for (var i = 0; i < this.levels.length; i++) {
  264. if (this.levels[i].levelCode === code) {
  265. var o = this.levels[i].levelOrder
  266. return (o != null) ? o : 0
  267. }
  268. }
  269. return 0
  270. },
  271. applyDefaultLevel: function() {
  272. var current = this.membership && this.membership.memberLevel ? this.membership.memberLevel : 'FREE'
  273. var currentOrder = this.getLevelOrder(current)
  274. var target = null
  275. for (var i = 0; i < this.buyableLevels.length; i++) {
  276. var r = this.getLevelOrder(this.buyableLevels[i].levelCode)
  277. if (r > currentOrder) { target = this.buyableLevels[i].levelCode; break }
  278. }
  279. this.selectedLevel = target || current
  280. },
  281. getPriceForPeriod: function(periodKey) {
  282. var plan = null
  283. for (var i = 0; i < this.levels.length; i++) {
  284. if (this.levels[i].levelCode === this.selectedLevel) {
  285. plan = this.levels[i]
  286. break
  287. }
  288. }
  289. if (!plan) return '0'
  290. if (periodKey === 'monthly') return plan.monthly ? (plan.monthly / 100).toFixed(1) : '0'
  291. if (periodKey === 'quarterly') return plan.quarterly ? (plan.quarterly / 100).toFixed(1) : '0'
  292. if (periodKey === 'yearly') return plan.yearly ? (plan.yearly / 100).toFixed(1) : '0'
  293. return '0'
  294. },
  295. goNext: function() {
  296. var levelCode = this.selectedLevel
  297. var period = this.selectedPeriod
  298. uni.navigateTo({ url: '/pages/membership/pay?levelCode=' + levelCode + '&period=' + period })
  299. },
  300. getOriginalPriceForPeriod: function(periodKey) {
  301. var plan = null
  302. for (var i = 0; i < this.levels.length; i++) {
  303. if (this.levels[i].levelCode === this.selectedLevel) {
  304. plan = this.levels[i]
  305. break
  306. }
  307. }
  308. if (!plan) return null
  309. if (periodKey === 'monthly') return plan.originalMonthly || null
  310. if (periodKey === 'quarterly') return plan.originalQuarterly || null
  311. if (periodKey === 'yearly') return plan.originalYearly || null
  312. return null
  313. },
  314. showOriginalPrice: function(periodKey) {
  315. var original = this.getOriginalPriceForPeriod(periodKey)
  316. var current = this.getPriceForPeriod(periodKey)
  317. if (!original || !current) return false
  318. return original > current * 100
  319. },
  320. formatDate(date) {
  321. if (!date) return ''
  322. var d = parseDate(date)
  323. if (!d) return ''
  324. return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0')
  325. }
  326. }
  327. }
  328. </script>
  329. <style scoped lang="scss">
  330. .page {
  331. min-height: 100vh;
  332. background: $uni-primary-pale;
  333. padding: $uni-space-page;
  334. box-sizing: border-box;
  335. }
  336. /* ===== 状态卡片 ===== */
  337. .status-card {
  338. background: linear-gradient(135deg, $brand-primary 0%, $brand-primary-dark 100%);
  339. border-radius: 24rpx;
  340. padding: 26rpx $uni-space-page;
  341. margin-bottom: 24rpx;
  342. }
  343. .status-top {
  344. display: flex;
  345. align-items: center;
  346. justify-content: space-between;
  347. }
  348. .status-badge {
  349. display: inline-flex;
  350. align-items: center;
  351. padding: 10rpx 24rpx;
  352. border-radius: 999rpx;
  353. font-size: calc(24rpx * var(--font-scale, 1));
  354. }
  355. .badge-free {
  356. background: rgba(255,255,255,0.2);
  357. color: $app-surface;
  358. }
  359. .badge-family {
  360. background: rgba(255,255,255,0.3);
  361. color: $app-surface;
  362. }
  363. .badge-lifetime {
  364. background: linear-gradient(135deg, $facade-violet 0%, $facade-violet-light-2 100%);
  365. color: $app-surface;
  366. }
  367. .badge-icon {
  368. font-size: calc(20rpx * var(--font-scale, 1));
  369. margin-right: 8rpx;
  370. }
  371. .badge-text {
  372. font-weight: 600;
  373. }
  374. .status-body {
  375. margin-top: 18rpx;
  376. }
  377. .expiry-value {
  378. font-size: calc(26rpx * var(--font-scale, 1));
  379. color: $app-surface;
  380. font-weight: 500;
  381. flex-shrink: 0;
  382. }
  383. .days-remaining {
  384. display: flex;
  385. align-items: baseline;
  386. justify-content: center;
  387. margin-top: 14rpx;
  388. }
  389. .days-num {
  390. font-size: calc(44rpx * var(--font-scale, 1));
  391. font-weight: bold;
  392. color: $status-warning-soft;
  393. }
  394. .days-unit {
  395. font-size: calc(24rpx * var(--font-scale, 1));
  396. color: rgba(255,255,255,0.7);
  397. margin-left: 8rpx;
  398. }
  399. .expired-msg {
  400. text-align: center;
  401. margin-top: 12rpx;
  402. }
  403. .expired-text {
  404. font-size: calc(24rpx * var(--font-scale, 1));
  405. color: $status-warning-soft;
  406. }
  407. .free-hint {
  408. font-size: calc(24rpx * var(--font-scale, 1));
  409. color: rgba(255,255,255,0.85);
  410. flex-shrink: 0;
  411. }
  412. .lifetime-hint {
  413. font-size: calc(26rpx * var(--font-scale, 1));
  414. color: $status-warning-soft;
  415. text-align: center;
  416. display: block;
  417. font-weight: 500;
  418. }
  419. /* ===== 升级/续费卡片 ===== */
  420. .upgrade-card {
  421. background: $app-surface;
  422. border-radius: 24rpx;
  423. padding: 40rpx;
  424. margin-bottom: $uni-space-lg;
  425. box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
  426. }
  427. .upgrade-header {
  428. text-align: center;
  429. margin-bottom: 20rpx;
  430. }
  431. .upgrade-title {
  432. font-size: calc(36rpx * var(--font-scale, 1));
  433. font-weight: bold;
  434. color: $uni-text-color;
  435. display: block;
  436. }
  437. .btn-upgrade {
  438. width: 100%;
  439. height: 88rpx;
  440. line-height: 88rpx;
  441. background: linear-gradient(135deg, $brand-primary 0%, $brand-primary-dark 100%);
  442. color: $app-surface;
  443. font-size: calc(32rpx * var(--font-scale, 1));
  444. font-weight: 600;
  445. border-radius: 24rpx;
  446. margin-top: 20rpx;
  447. border: none;
  448. }
  449. .btn-upgrade::after {
  450. border: none;
  451. }
  452. .btn-upgrade:active {
  453. opacity: 0.9;
  454. }
  455. /* ===== 权益对比 ===== */
  456. .compare-section {
  457. background: $app-surface;
  458. border-radius: 24rpx;
  459. padding: $uni-space-lg;
  460. margin-bottom: $uni-space-lg;
  461. box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
  462. }
  463. .section-title {
  464. font-size: calc(32rpx * var(--font-scale, 1));
  465. font-weight: bold;
  466. color: $uni-text-color;
  467. display: block;
  468. margin-bottom: 24rpx;
  469. }
  470. .compare-table {
  471. border-radius: 16rpx;
  472. overflow: hidden;
  473. border: 1rpx solid $brand-primary-light-2;
  474. }
  475. .compare-row {
  476. display: flex;
  477. border-bottom: 1rpx solid $brand-primary-light-2;
  478. }
  479. .compare-row:last-child {
  480. border-bottom: none;
  481. }
  482. .header-row {
  483. background: $uni-primary-pale;
  484. }
  485. .compare-cell {
  486. flex: 1;
  487. padding: 20rpx 16rpx;
  488. font-size: calc(26rpx * var(--font-scale, 1));
  489. text-align: center;
  490. display: flex;
  491. align-items: center;
  492. justify-content: center;
  493. }
  494. .cell-feature {
  495. flex: 1.5;
  496. color: $uni-text-color;
  497. font-weight: 500;
  498. justify-content: flex-start;
  499. }
  500. .cell-free {
  501. color: $app-text-subtle;
  502. }
  503. .cell-family.active {
  504. background: $facade-brand-tint-2;
  505. color: $brand-primary;
  506. font-weight: 600;
  507. }
  508. .cell-premium.active {
  509. background: $violet-tint-100;
  510. color: $facade-violet;
  511. font-weight: 600;
  512. }
  513. .cell-lifetime {
  514. background: $facade-fill-2;
  515. color: $facade-text-muted;
  516. }
  517. .cell-lifetime.disabled {
  518. color: $facade-text-muted;
  519. }
  520. .header-row .cell-lifetime {
  521. background: $facade-fill-2;
  522. color: $facade-text-muted;
  523. font-weight: 600;
  524. }
  525. .header-row .compare-cell {
  526. font-size: calc(24rpx * var(--font-scale, 1));
  527. font-weight: 600;
  528. color: $uni-text-color-secondary;
  529. }
  530. .header-row .cell-family.active {
  531. background: $facade-brand-tint-2;
  532. color: $brand-primary;
  533. }
  534. .header-row .cell-premium.active {
  535. background: $violet-tint-100;
  536. color: $facade-violet;
  537. }
  538. .compare-cell.active {
  539. background: $facade-brand-tint-2;
  540. color: $brand-primary;
  541. font-weight: 600;
  542. }
  543. /* ===== 等级切换 Tabs ===== */
  544. .level-tabs {
  545. display: flex;
  546. margin-bottom: $uni-space-lg;
  547. border-radius: 16rpx;
  548. overflow: hidden;
  549. border: 2rpx solid $brand-primary-light-2;
  550. }
  551. .level-tab {
  552. flex: 1;
  553. padding: 24rpx;
  554. text-align: center;
  555. background: $uni-primary-pale;
  556. cursor: pointer;
  557. }
  558. .level-tab-active {
  559. background: $app-surface;
  560. border-bottom: 4rpx solid $brand-primary;
  561. }
  562. .level-tab-name {
  563. font-size: calc(28rpx * var(--font-scale, 1));
  564. font-weight: 600;
  565. color: $uni-text-color;
  566. display: block;
  567. }
  568. .level-tab-active .level-tab-name {
  569. color: $brand-primary;
  570. }
  571. /* ===== 开通赠券 ===== */
  572. .join-rules-section {
  573. background: $app-surface;
  574. border-radius: 24rpx;
  575. padding: $uni-space-lg;
  576. margin-bottom: $uni-space-lg;
  577. box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
  578. }
  579. .join-rule-item {
  580. display: flex;
  581. align-items: center;
  582. padding: 16rpx 0;
  583. border-bottom: 1rpx solid $brand-primary-light-2;
  584. }
  585. .join-rule-item:last-child {
  586. border-bottom: none;
  587. }
  588. .join-rule-text {
  589. flex: 1;
  590. font-size: calc(26rpx * var(--font-scale, 1));
  591. color: $uni-text-color;
  592. }
  593. .join-rule-desc {
  594. font-size: calc(24rpx * var(--font-scale, 1));
  595. color: $brand-primary;
  596. font-weight: 600;
  597. }
  598. /* ===== 升级记录 ===== */
  599. .records-section {
  600. background: $app-surface;
  601. border-radius: 24rpx;
  602. padding: $uni-space-lg;
  603. margin-bottom: $uni-space-lg;
  604. box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
  605. }
  606. .record-item {
  607. display: flex;
  608. justify-content: space-between;
  609. align-items: center;
  610. padding: 20rpx 0;
  611. border-bottom: 1rpx solid $brand-primary-light-2;
  612. }
  613. .record-item:last-child {
  614. border-bottom: none;
  615. }
  616. .record-left {
  617. flex: 1;
  618. }
  619. .record-level {
  620. font-size: calc(28rpx * var(--font-scale, 1));
  621. color: $uni-text-color;
  622. display: block;
  623. }
  624. .record-time {
  625. font-size: calc(22rpx * var(--font-scale, 1));
  626. color: $app-text-subtle;
  627. margin-top: 4rpx;
  628. display: block;
  629. }
  630. .record-amount {
  631. font-size: calc(30rpx * var(--font-scale, 1));
  632. font-weight: bold;
  633. color: $brand-primary;
  634. }
  635. /* ===== Coupon Row ===== */
  636. .coupon-row {
  637. display: flex;
  638. align-items: center;
  639. padding: 24rpx 0;
  640. border-top: 1rpx solid $facade-fill-2;
  641. margin-top: 16rpx;
  642. }
  643. .coupon-row:active {
  644. opacity: 0.7;
  645. }
  646. .coupon-row-label {
  647. font-size: calc(26rpx * var(--font-scale, 1));
  648. color: $facade-text-body;
  649. margin-right: 16rpx;
  650. }
  651. .coupon-row-discount {
  652. flex: 1;
  653. font-size: calc(26rpx * var(--font-scale, 1));
  654. color: $brand-primary;
  655. font-weight: 600;
  656. text-align: right;
  657. }
  658. .coupon-row-placeholder {
  659. flex: 1;
  660. font-size: calc(26rpx * var(--font-scale, 1));
  661. color: $facade-text-ghost;
  662. text-align: right;
  663. }
  664. .coupon-row-arrow {
  665. font-size: calc(32rpx * var(--font-scale, 1));
  666. color: $facade-text-ghost;
  667. margin-left: 8rpx;
  668. }
  669. /* ===== Coupon Picker Modal ===== */
  670. .modal-mask {
  671. position: fixed;
  672. top: 0;
  673. left: 0;
  674. right: 0;
  675. bottom: 0;
  676. background: rgba(0,0,0,0.5);
  677. z-index: 999;
  678. display: flex;
  679. align-items: flex-end;
  680. }
  681. .coupon-picker {
  682. background: $app-surface;
  683. border-radius: 24rpx 24rpx 0 0;
  684. width: 100%;
  685. max-height: 70vh;
  686. display: flex;
  687. flex-direction: column;
  688. }
  689. .picker-header {
  690. display: flex;
  691. justify-content: space-between;
  692. align-items: center;
  693. padding: $uni-space-page;
  694. border-bottom: 1rpx solid $facade-hairline-2;
  695. }
  696. .picker-title {
  697. font-size: calc(30rpx * var(--font-scale, 1));
  698. font-weight: 600;
  699. color: $facade-text-strong;
  700. }
  701. .picker-close {
  702. font-size: calc(26rpx * var(--font-scale, 1));
  703. color: $facade-text-muted;
  704. }
  705. .picker-list {
  706. max-height: 50vh;
  707. padding: 0 20rpx;
  708. }
  709. .picker-item {
  710. display: flex;
  711. align-items: center;
  712. padding: 24rpx 16rpx;
  713. border-bottom: 1rpx solid $facade-fill-2;
  714. }
  715. .picker-item:active {
  716. background: $facade-fill-ghost;
  717. }
  718. .picker-item-active {
  719. background: $uni-primary-pale;
  720. }
  721. .picker-item-left {
  722. width: 120rpx;
  723. text-align: center;
  724. flex-shrink: 0;
  725. }
  726. .picker-item-value {
  727. font-size: calc(32rpx * var(--font-scale, 1));
  728. font-weight: bold;
  729. color: $brand-primary;
  730. }
  731. .picker-item-right {
  732. flex: 1;
  733. margin: 0 16rpx;
  734. }
  735. .picker-item-name {
  736. font-size: calc(26rpx * var(--font-scale, 1));
  737. color: $facade-text-strong;
  738. display: block;
  739. margin-bottom: 4rpx;
  740. }
  741. .picker-item-condition {
  742. font-size: calc(22rpx * var(--font-scale, 1));
  743. color: $facade-text-muted;
  744. }
  745. .picker-item-check {
  746. width: 40rpx;
  747. height: 40rpx;
  748. background: $brand-primary;
  749. border-radius: 50%;
  750. display: flex;
  751. align-items: center;
  752. justify-content: center;
  753. flex-shrink: 0;
  754. color: $app-surface;
  755. font-size: calc(24rpx * var(--font-scale, 1));
  756. font-weight: bold;
  757. }
  758. .picker-empty {
  759. text-align: center;
  760. padding: 60rpx 0;
  761. font-size: calc(26rpx * var(--font-scale, 1));
  762. color: $facade-text-muted;
  763. }
  764. .picker-footer {
  765. padding: 20rpx;
  766. border-top: 1rpx solid $facade-hairline-2;
  767. }
  768. .picker-btn-remove {
  769. background: $facade-fill-2;
  770. color: $facade-text-body;
  771. font-size: calc(26rpx * var(--font-scale, 1));
  772. border-radius: 16rpx;
  773. border: none;
  774. }
  775. .picker-btn-remove::after {
  776. border: none;
  777. }
  778. /* ===== 档位选择 ===== */
  779. .period-tabs {
  780. display: flex;
  781. justify-content: space-between;
  782. margin: 24rpx 0;
  783. gap: 16rpx;
  784. }
  785. .period-tab {
  786. flex: 1;
  787. display: flex;
  788. flex-direction: column;
  789. align-items: center;
  790. padding: 20rpx 0;
  791. border: 2rpx solid $brand-primary-light-2;
  792. border-radius: 16rpx;
  793. background: #FFFBF5;
  794. }
  795. .period-tab-active {
  796. border-color: $brand-primary;
  797. background: $uni-primary-pale;
  798. }
  799. .period-tab-label {
  800. font-size: calc(26rpx * var(--font-scale, 1));
  801. color: $uni-text-color-secondary;
  802. font-weight: 500;
  803. }
  804. .period-tab-active .period-tab-label {
  805. color: $brand-primary;
  806. font-weight: 600;
  807. }
  808. .period-tab-price {
  809. font-size: calc(28rpx * var(--font-scale, 1));
  810. font-weight: bold;
  811. color: $brand-primary;
  812. margin-top: 8rpx;
  813. }
  814. /* ===== 划线原价 ===== */
  815. .period-original {
  816. font-size: calc(20rpx * var(--font-scale, 1));
  817. color: $app-text-subtle;
  818. text-decoration: line-through;
  819. margin-top: 2rpx;
  820. }
  821. </style>