upgrade.vue 23 KB

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