pay.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. <template>
  2. <view class="pay-page" :style="{ '--font-scale': fontScale }">
  3. <scroll-view class="page" scroll-y>
  4. <!-- 商品明细卡 -->
  5. <view class="order-card">
  6. <view class="order-header">
  7. <text class="order-title">{{ levelName }} · {{ periodLabel }}</text>
  8. <text class="order-sub">{{ levelCode }}</text>
  9. </view>
  10. <view class="price-row" v-if="showOriginal">
  11. <text class="price-label">原价</text>
  12. <text class="price-original">¥{{ originalPriceText }}</text>
  13. </view>
  14. <view class="price-row">
  15. <text class="price-label">现价</text>
  16. <text class="price-now">¥{{ priceText }}</text>
  17. </view>
  18. <view class="coupon-row" @click="openCouponPicker">
  19. <text class="coupon-row-label">优惠券</text>
  20. <text v-if="selectedCoupon" class="coupon-row-discount">-¥{{ couponDiscountText }} {{ selectedCoupon.name }}</text>
  21. <text v-else class="coupon-row-placeholder">选择优惠券</text>
  22. <text class="coupon-row-arrow">›</text>
  23. </view>
  24. <view v-if="!isMember && hasMembershipCoupons" class="member-hint-row" @click="goToMembership">
  25. <text class="member-hint-icon">👑</text>
  26. <text class="member-hint-text">开通会员可使用会员专属优惠券</text>
  27. <text class="coupon-row-arrow">›</text>
  28. </view>
  29. <view class="divider"></view>
  30. <view class="total-row">
  31. <text class="total-label">实付</text>
  32. <text class="total-amount">¥{{ finalPriceText }}</text>
  33. </view>
  34. </view>
  35. <!-- 拆单提示卡 -->
  36. <view class="split-card" v-if="totalPeriods > 1">
  37. <text class="split-title">💡 本订单将分 {{ totalPeriods }} 期支付</text>
  38. <text class="split-desc">每期 ¥{{ splitAmountText }},全部支付完成后自动开通会员</text>
  39. </view>
  40. <!-- 支付进度(拆单逐期时显示) -->
  41. <view class="progress-card" v-if="paying && totalPeriods > 1">
  42. <text class="progress-text">第 {{ currentPeriod }} / {{ totalPeriods }} 期</text>
  43. </view>
  44. </scroll-view>
  45. <!-- 底部固定支付栏 -->
  46. <view class="pay-bar">
  47. <button class="btn-pay" :loading="paying" :disabled="paying" @click="handlePay">
  48. {{ paying ? '支付中…' : '立即支付 ¥' + finalPriceText }}
  49. </button>
  50. </view>
  51. <!-- Coupon Picker Bottom Sheet -->
  52. <view class="modal-mask" v-if="showCouponPicker" @click="showCouponPicker = false">
  53. <view class="coupon-picker" @click.stop>
  54. <view class="picker-header">
  55. <text class="picker-title">选择优惠券</text>
  56. <text class="picker-close" @click="showCouponPicker = false">关闭</text>
  57. </view>
  58. <scroll-view scroll-y class="picker-list">
  59. <view
  60. v-for="coupon in availableCoupons"
  61. :key="coupon.id"
  62. class="picker-item"
  63. :class="selectedCoupon && selectedCoupon.id === coupon.id ? 'picker-item-active' : ''"
  64. @click="selectCoupon(coupon)"
  65. >
  66. <view class="picker-item-left">
  67. <text class="picker-item-value">{{ formatPrice(coupon.value) }}</text>
  68. </view>
  69. <view class="picker-item-right">
  70. <text class="picker-item-name">{{ coupon.name }}</text>
  71. <text class="picker-item-condition">{{ getCouponCondition(coupon) }}</text>
  72. </view>
  73. <view class="picker-item-check" v-if="selectedCoupon && selectedCoupon.id === coupon.id">
  74. <text>✓</text>
  75. </view>
  76. </view>
  77. <view class="picker-empty" v-if="availableCoupons.length === 0">
  78. <text>暂无可用优惠券</text>
  79. </view>
  80. </scroll-view>
  81. <view class="picker-footer" v-if="selectedCoupon">
  82. <button class="picker-btn-remove" @click="removeCoupon">不使用优惠券</button>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import { getMembershipLevels, getMembershipPlans, getCouponList, createOrder, requestVirtualPayment, nextOrder } from '../../utils/api.js'
  90. import fontScaleMixin from '../../mixins/font-scale.js'
  91. export default {
  92. mixins: [fontScaleMixin],
  93. data() {
  94. return {
  95. levelCode: '',
  96. period: 'yearly',
  97. levelName: '',
  98. periodLabel: '年度',
  99. levels: [],
  100. coupons: [],
  101. selectedCoupon: null,
  102. showCouponPicker: false,
  103. originalPrice: null,
  104. price: 0,
  105. totalPeriods: 1,
  106. currentPeriod: 1,
  107. splitAmount: 0,
  108. orderNo: null,
  109. paying: false,
  110. isMember: false
  111. }
  112. },
  113. computed: {
  114. showOriginal: function() {
  115. return this.originalPrice != null && this.originalPrice > this.price
  116. },
  117. priceText: function() {
  118. return (this.price / 100).toFixed(2)
  119. },
  120. originalPriceText: function() {
  121. if (this.originalPrice == null) return '0.00'
  122. return (this.originalPrice / 100).toFixed(2)
  123. },
  124. couponDiscount: function() {
  125. if (!this.selectedCoupon) return 0
  126. if (this.selectedCoupon.type === 'DISCOUNT') {
  127. var rate = this.selectedCoupon.discountRate || 100
  128. return Math.round(this.price * (100 - rate) / 100)
  129. }
  130. return this.selectedCoupon.value || 0
  131. },
  132. couponDiscountText: function() {
  133. return (this.couponDiscount / 100).toFixed(2)
  134. },
  135. finalPrice: function() {
  136. return Math.max(0, this.price - this.couponDiscount)
  137. },
  138. finalPriceText: function() {
  139. return (this.finalPrice / 100).toFixed(2)
  140. },
  141. splitAmountText: function() {
  142. return (this.splitAmount / 100).toFixed(2)
  143. },
  144. availableCoupons: function() {
  145. var self = this
  146. return this.coupons.filter(function(c) {
  147. if (c.status && c.status !== 'AVAILABLE') return false
  148. if (c.applicableTo && c.applicableTo !== 'ALL' && c.applicableTo !== 'MEMBERSHIP') return false
  149. // 会员专属券:非会员不显示在可选列表中
  150. // 会员专属券(applicableTo=MEMBERSHIP)仅允许会员使用;手动发放券(grantType=MANUAL)例外,允许非会员购买时使用
  151. // 来自他人转赠的券(isGift=1)同样允许非会员用于购买会员
  152. if (c.applicableTo === 'MEMBERSHIP' && !self.isMember && c.grantType !== 'MANUAL' && !c.isGift) return false
  153. return true
  154. })
  155. },
  156. hasMembershipCoupons: function() {
  157. var self = this
  158. return this.coupons.some(function(c) {
  159. return c.applicableTo === 'MEMBERSHIP' && (!c.status || c.status === 'AVAILABLE')
  160. })
  161. }
  162. },
  163. onLoad: function(options) {
  164. this.levelCode = options.levelCode || ''
  165. this.period = options.period || 'yearly'
  166. this.periodLabel = this.getPeriodLabel(this.period)
  167. this.loadCoupons()
  168. this.checkMemberStatus()
  169. if (options.levelCode) {
  170. this.loadPlans()
  171. } else {
  172. this.loadDefaultLevel()
  173. }
  174. },
  175. methods: {
  176. // 推荐档优先;否则取价格>0 的最低付费等级。前端不再写死任何等级名/编码。
  177. loadDefaultLevel: function() {
  178. var self = this
  179. getMembershipLevels().then(function(res) {
  180. var list = (res && res.data) || []
  181. var target = null
  182. for (var i = 0; i < list.length; i++) {
  183. var lv = list[i]
  184. if (lv.levelCode === 'FREE') continue
  185. var price = lv.priceMonthly || lv.priceQuarterly || lv.priceYearly || 0
  186. if (price <= 0) continue
  187. if (lv.recommended) { target = lv; break }
  188. if (!target || (lv.levelOrder != null && lv.levelOrder < target.levelOrder)) {
  189. target = lv
  190. }
  191. }
  192. if (target) {
  193. self.levelCode = target.levelCode
  194. self.levelName = target.levelName || target.levelCode
  195. }
  196. self.loadPlans()
  197. }).catch(function(e) {
  198. console.error('加载等级列表失败', e)
  199. self.loadPlans()
  200. })
  201. },
  202. getPeriodLabel: function(period) {
  203. var map = { monthly: '月度', quarterly: '季度', yearly: '年度' }
  204. return map[period] || '年度'
  205. },
  206. loadPlans: function() {
  207. var self = this
  208. getMembershipPlans().then(function(res) {
  209. var levels = res.data || []
  210. for (var i = 0; i < levels.length; i++) {
  211. if (levels[i].levelCode === self.levelCode) {
  212. self.levelName = levels[i].levelName || self.levelName
  213. if (self.period === 'monthly') {
  214. self.price = levels[i].monthly || 0
  215. self.originalPrice = levels[i].originalMonthly || null
  216. } else if (self.period === 'quarterly') {
  217. self.price = levels[i].quarterly || 0
  218. self.originalPrice = levels[i].originalQuarterly || null
  219. } else {
  220. self.price = levels[i].yearly || 0
  221. self.originalPrice = levels[i].originalYearly || null
  222. }
  223. break
  224. }
  225. }
  226. }).catch(function(e) {
  227. uni.showToast({ title: '加载价格失败', icon: 'none' })
  228. console.error('加载价格失败', e)
  229. })
  230. },
  231. loadCoupons: function() {
  232. var self = this
  233. getCouponList().then(function(res) {
  234. self.coupons = res.data || []
  235. }).catch(function() {})
  236. },
  237. openCouponPicker: function() {
  238. if (this.availableCoupons.length === 0 && !this.selectedCoupon) {
  239. uni.showToast({ title: '暂无可用优惠券', icon: 'none' })
  240. return
  241. }
  242. this.showCouponPicker = true
  243. },
  244. selectCoupon: function(coupon) {
  245. this.selectedCoupon = coupon
  246. this.showCouponPicker = false
  247. },
  248. removeCoupon: function() {
  249. this.selectedCoupon = null
  250. this.showCouponPicker = false
  251. },
  252. checkMemberStatus: function() {
  253. var self = this
  254. uni.request({
  255. url: getApp().$config.baseUrl + '/api/membership/my',
  256. method: 'POST',
  257. header: { 'Authorization': 'Bearer ' + uni.getStorageSync('token') },
  258. success: function(res) {
  259. if (res.data && res.data.code === 200 && res.data.data) {
  260. var membership = res.data.data.membership
  261. self.isMember = membership && membership.isActive
  262. }
  263. }
  264. })
  265. },
  266. getCouponCondition: function(coupon) {
  267. if (!coupon) return '无门槛'
  268. // 会员专属券(applicableTo=MEMBERSHIP)仅允许会员使用;手动发放券(grantType=MANUAL)例外,允许非会员购买时使用
  269. // 来自他人转赠的券(isGift=1)同样允许非会员用于购买会员
  270. if (coupon.applicableTo === 'MEMBERSHIP' && !this.isMember && coupon.grantType !== 'MANUAL' && !coupon.isGift) {
  271. return '开通会员后可用'
  272. }
  273. if (!coupon.minSpend || coupon.minSpend <= 0) return '无门槛'
  274. return '满' + (coupon.minSpend / 100).toFixed(2) + '元可用'
  275. },
  276. formatPrice: function(value) {
  277. if (value == null) return '0.00'
  278. return (value / 100).toFixed(2)
  279. },
  280. handlePay: function() {
  281. var self = this
  282. if (this.paying) return
  283. this.paying = true
  284. var couponId = this.selectedCoupon ? this.selectedCoupon.id : null
  285. var openid = uni.getStorageSync('openid') || ''
  286. createOrder(this.levelCode, 'pay', this.period, couponId, openid).then(function(res) {
  287. var data = res.data || {}
  288. self.orderNo = data.orderNo
  289. var payType = data.payType || 'virtual'
  290. if (payType === 'virtual' && data.orderInfo && data.sign) {
  291. // 虚拟支付(现有逻辑不变)
  292. self.totalPeriods = data.totalPeriods || 1
  293. self.currentPeriod = data.currentPeriod || 1
  294. self.splitAmount = data.orderInfo.goodsPrice || (self.finalPrice / (self.totalPeriods || 1))
  295. self.payInstallments(data)
  296. } else if (payType === 'wechat' && data.wechatPayParams) {
  297. // 普通微信支付(新增分支)
  298. self.payWechat(data.wechatPayParams)
  299. } else {
  300. // testMode/trial:模拟支付成功
  301. uni.showToast({ title: '支付成功,开通中…', icon: 'none' })
  302. setTimeout(function() {
  303. self.paying = false
  304. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=success' })
  305. }, 800)
  306. }
  307. }).catch(function(e) {
  308. self.paying = false
  309. if (e.code === 46001) {
  310. uni.showToast({ title: '该商品暂未开放购买', icon: 'none' })
  311. } else {
  312. uni.showToast({ title: e.message || '下单失败', icon: 'none' })
  313. }
  314. })
  315. },
  316. payWechat: function(pp) {
  317. var self = this
  318. if (!pp || !pp.package) {
  319. self.paying = false
  320. uni.showToast({ title: '支付参数异常', icon: 'none' })
  321. return
  322. }
  323. uni.requestPayment({
  324. provider: 'wxpay',
  325. timeStamp: pp.timeStamp,
  326. nonceStr: pp.nonceStr,
  327. package: pp.package,
  328. signType: pp.signType || 'RSA',
  329. paySign: pp.paySign || pp.sign,
  330. success: function() {
  331. uni.showToast({ title: '支付成功,开通中…', icon: 'none' })
  332. setTimeout(function() {
  333. self.paying = false
  334. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=success' })
  335. }, 800)
  336. },
  337. fail: function(err) {
  338. self.paying = false
  339. var errCode = err && err.errCode
  340. var msg = '支付取消'
  341. if (errCode === -15007 || errCode === -15005) msg = '登录态已过期,请重新登录'
  342. else if (err && err.errMsg) msg = err.errMsg
  343. uni.showToast({ title: msg, icon: 'none' })
  344. setTimeout(function() {
  345. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=fail' })
  346. }, 800)
  347. }
  348. })
  349. },
  350. payInstallments: function(dto) {
  351. var self = this
  352. var current = dto.currentPeriod || 1
  353. var total = dto.totalPeriods || 1
  354. requestVirtualPayment(dto, {
  355. success: function() {
  356. if (current < total) {
  357. uni.showToast({ title: '第' + current + '期支付成功', icon: 'none' })
  358. nextOrder({ orderNo: dto.orderNo }).then(function(res) {
  359. var nd = res.data
  360. if (nd && nd.done) {
  361. self.finishPay()
  362. } else if (nd && nd.orderInfo && nd.sign) {
  363. self.currentPeriod = nd.currentPeriod || 1
  364. self.payInstallments(nd)
  365. } else {
  366. self.finishPay()
  367. }
  368. }).catch(function() {
  369. self.finishPay()
  370. })
  371. } else {
  372. self.finishPay()
  373. }
  374. },
  375. fail: function(err) {
  376. var errCode = err && err.errCode
  377. // 虚拟支付失败(道具价格不匹配/道具未发布/环境不支持等)→ 自动降级为普通微信支付(订单支付)
  378. // 用户主动取消(-2)与登录态失效(-15007/-15005)不降级,直接提示
  379. if (dto && dto.wechatPayParams && errCode !== -2 && errCode !== -15007 && errCode !== -15005) {
  380. uni.showToast({ title: '虚拟支付不可用,转微信支付', icon: 'none' })
  381. setTimeout(function() {
  382. self.payWechat(dto.wechatPayParams)
  383. }, 800)
  384. return
  385. }
  386. self.paying = false
  387. var msg = ''
  388. if (errCode === -15007 || errCode === -15005) msg = '登录态已过期,请重新登录后支付'
  389. else if (errCode === -15010) msg = '商品未发布,请联系客服'
  390. else if (errCode === -15013) msg = '商品价格异常'
  391. else if (errCode === -2) msg = '支付已取消'
  392. else if (err && err.errMsg) msg = err.errMsg
  393. var status = (errCode === -2 || errCode === -15007 || errCode === -15005) ? 'fail' : 'fail'
  394. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=' + status })
  395. }
  396. })
  397. },
  398. finishPay: function() {
  399. var self = this
  400. uni.showToast({ title: '支付成功,开通中…', icon: 'none' })
  401. setTimeout(function() {
  402. self.paying = false
  403. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=success' })
  404. }, 800)
  405. },
  406. goToMembership: function() {
  407. uni.navigateTo({ url: '/pages/membership/index' })
  408. }
  409. }
  410. }
  411. </script>
  412. <style scoped lang="scss">
  413. .pay-page {
  414. min-height: 100vh;
  415. background: $uni-primary-pale;
  416. padding-bottom: 160rpx;
  417. box-sizing: border-box;
  418. }
  419. .page {
  420. padding: $uni-space-page;
  421. }
  422. /* ===== 商品明细卡 ===== */
  423. .order-card {
  424. background: $app-surface;
  425. border-radius: 24rpx;
  426. padding: 40rpx;
  427. box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
  428. }
  429. .order-header {
  430. margin-bottom: 24rpx;
  431. }
  432. .order-title {
  433. font-size: calc(34rpx * var(--font-scale, 1));
  434. font-weight: bold;
  435. color: $uni-text-color;
  436. display: block;
  437. }
  438. .order-sub {
  439. font-size: calc(24rpx * var(--font-scale, 1));
  440. color: $app-text-subtle;
  441. margin-top: 6rpx;
  442. display: block;
  443. }
  444. .price-row {
  445. display: flex;
  446. justify-content: space-between;
  447. align-items: center;
  448. padding: 16rpx 0;
  449. }
  450. .price-label {
  451. font-size: calc(26rpx * var(--font-scale, 1));
  452. color: $uni-text-color-secondary;
  453. }
  454. .price-original {
  455. font-size: calc(28rpx * var(--font-scale, 1));
  456. color: $app-text-subtle;
  457. text-decoration: line-through;
  458. }
  459. .price-now {
  460. font-size: calc(36rpx * var(--font-scale, 1));
  461. font-weight: bold;
  462. color: $brand-primary;
  463. }
  464. .coupon-row {
  465. display: flex;
  466. align-items: center;
  467. padding: 24rpx 0;
  468. border-top: 1rpx solid $facade-fill-2;
  469. margin-top: 16rpx;
  470. }
  471. .coupon-row:active {
  472. opacity: 0.7;
  473. }
  474. .coupon-row-label {
  475. font-size: calc(26rpx * var(--font-scale, 1));
  476. color: $facade-text-body;
  477. margin-right: 16rpx;
  478. }
  479. .coupon-row-discount {
  480. flex: 1;
  481. font-size: calc(26rpx * var(--font-scale, 1));
  482. color: $brand-primary;
  483. font-weight: 600;
  484. text-align: right;
  485. }
  486. .coupon-row-placeholder {
  487. flex: 1;
  488. font-size: calc(26rpx * var(--font-scale, 1));
  489. color: $facade-text-ghost;
  490. text-align: right;
  491. }
  492. .coupon-row-arrow {
  493. font-size: calc(32rpx * var(--font-scale, 1));
  494. color: $facade-text-ghost;
  495. margin-left: 8rpx;
  496. }
  497. .member-hint-row {
  498. display: flex;
  499. align-items: center;
  500. padding: 20rpx 0;
  501. margin-top: 8rpx;
  502. background: $uni-primary-pale;
  503. border-radius: 16rpx;
  504. }
  505. .member-hint-row:active {
  506. opacity: 0.7;
  507. }
  508. .member-hint-icon {
  509. font-size: calc(28rpx * var(--font-scale, 1));
  510. margin-right: 12rpx;
  511. }
  512. .member-hint-text {
  513. flex: 1;
  514. font-size: calc(26rpx * var(--font-scale, 1));
  515. color: $brand-primary;
  516. font-weight: 500;
  517. }
  518. .divider {
  519. height: 1rpx;
  520. background: $facade-fill-slate;
  521. margin: 16rpx 0;
  522. }
  523. .total-row {
  524. display: flex;
  525. justify-content: space-between;
  526. align-items: center;
  527. }
  528. .total-label {
  529. font-size: calc(28rpx * var(--font-scale, 1));
  530. font-weight: 600;
  531. color: $uni-text-color;
  532. }
  533. .total-amount {
  534. font-size: calc(44rpx * var(--font-scale, 1));
  535. font-weight: bold;
  536. color: $brand-primary;
  537. }
  538. /* ===== 拆单提示 ===== */
  539. .split-card {
  540. background: $status-warning-soft;
  541. border-radius: 24rpx;
  542. padding: 24rpx;
  543. margin-top: $uni-space-lg;
  544. }
  545. .split-title {
  546. font-size: calc(28rpx * var(--font-scale, 1));
  547. font-weight: 600;
  548. color: $status-warning-strong;
  549. display: block;
  550. margin-bottom: 8rpx;
  551. }
  552. .split-desc {
  553. font-size: calc(24rpx * var(--font-scale, 1));
  554. color: $status-warning-strong-2;
  555. display: block;
  556. }
  557. /* ===== 支付进度 ===== */
  558. .progress-card {
  559. background: $app-surface;
  560. border-radius: 24rpx;
  561. padding: 20rpx;
  562. margin-top: 20rpx;
  563. text-align: center;
  564. }
  565. .progress-text {
  566. font-size: calc(26rpx * var(--font-scale, 1));
  567. color: $brand-primary;
  568. font-weight: 600;
  569. }
  570. /* ===== 底部支付栏 ===== */
  571. .pay-bar {
  572. position: fixed;
  573. bottom: 0;
  574. left: 0;
  575. right: 0;
  576. background: $app-surface;
  577. padding: 20rpx $uni-space-page calc(20rpx + env(safe-area-inset-bottom));
  578. box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
  579. }
  580. .btn-pay {
  581. width: 100%;
  582. height: 96rpx;
  583. line-height: 96rpx;
  584. background: linear-gradient(135deg, $brand-primary 0%, $brand-primary-dark 100%);
  585. color: $app-surface;
  586. font-size: calc(34rpx * var(--font-scale, 1));
  587. font-weight: 600;
  588. border-radius: 24rpx;
  589. border: none;
  590. }
  591. .btn-pay::after {
  592. border: none;
  593. }
  594. .btn-pay[disabled] {
  595. opacity: 0.7;
  596. color: $app-surface;
  597. }
  598. /* ===== Coupon Picker(复用 upgrade 样式) ===== */
  599. .modal-mask {
  600. position: fixed;
  601. top: 0;
  602. left: 0;
  603. right: 0;
  604. bottom: 0;
  605. background: rgba(0,0,0,0.5);
  606. z-index: 999;
  607. display: flex;
  608. align-items: flex-end;
  609. }
  610. .coupon-picker {
  611. background: $app-surface;
  612. border-radius: 24rpx 24rpx 0 0;
  613. width: 100%;
  614. max-height: 70vh;
  615. display: flex;
  616. flex-direction: column;
  617. }
  618. .picker-header {
  619. display: flex;
  620. justify-content: space-between;
  621. align-items: center;
  622. padding: $uni-space-page;
  623. border-bottom: 1rpx solid $facade-hairline-2;
  624. }
  625. .picker-title {
  626. font-size: calc(30rpx * var(--font-scale, 1));
  627. font-weight: 600;
  628. color: $facade-text-strong;
  629. }
  630. .picker-close {
  631. font-size: calc(26rpx * var(--font-scale, 1));
  632. color: $facade-text-muted;
  633. }
  634. .picker-list {
  635. max-height: 50vh;
  636. padding: 0 20rpx;
  637. }
  638. .picker-item {
  639. display: flex;
  640. align-items: center;
  641. padding: 24rpx 16rpx;
  642. border-bottom: 1rpx solid $facade-fill-2;
  643. }
  644. .picker-item:active {
  645. background: $facade-fill-ghost;
  646. }
  647. .picker-item-active {
  648. background: $uni-primary-pale;
  649. }
  650. .picker-item-left {
  651. width: 120rpx;
  652. text-align: center;
  653. flex-shrink: 0;
  654. }
  655. .picker-item-value {
  656. font-size: calc(32rpx * var(--font-scale, 1));
  657. font-weight: bold;
  658. color: $brand-primary;
  659. }
  660. .picker-item-right {
  661. flex: 1;
  662. margin: 0 16rpx;
  663. }
  664. .picker-item-name {
  665. font-size: calc(26rpx * var(--font-scale, 1));
  666. color: $facade-text-strong;
  667. display: block;
  668. margin-bottom: 4rpx;
  669. }
  670. .picker-item-condition {
  671. font-size: calc(22rpx * var(--font-scale, 1));
  672. color: $facade-text-muted;
  673. }
  674. .picker-item-check {
  675. width: 40rpx;
  676. height: 40rpx;
  677. background: $brand-primary;
  678. border-radius: 50%;
  679. display: flex;
  680. align-items: center;
  681. justify-content: center;
  682. flex-shrink: 0;
  683. color: $app-surface;
  684. font-size: calc(24rpx * var(--font-scale, 1));
  685. font-weight: bold;
  686. }
  687. .picker-empty {
  688. text-align: center;
  689. padding: 60rpx 0;
  690. font-size: calc(26rpx * var(--font-scale, 1));
  691. color: $facade-text-muted;
  692. }
  693. .picker-footer {
  694. padding: 20rpx;
  695. border-top: 1rpx solid $facade-hairline-2;
  696. }
  697. .picker-btn-remove {
  698. background: $facade-fill-2;
  699. color: $facade-text-body;
  700. font-size: calc(26rpx * var(--font-scale, 1));
  701. border-radius: 16rpx;
  702. border: none;
  703. }
  704. .picker-btn-remove::after {
  705. border: none;
  706. }
  707. </style>