pay.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  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, getMyMembership, 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. getMyMembership().then(function(res) {
  255. if (res && res.code === 200 && res.data) {
  256. var membership = res.data.membership
  257. self.isMember = membership && membership.isActive
  258. }
  259. }).catch(function() {})
  260. },
  261. getCouponCondition: function(coupon) {
  262. if (!coupon) return '无门槛'
  263. // 会员专属券(applicableTo=MEMBERSHIP)仅允许会员使用;手动发放券(grantType=MANUAL)例外,允许非会员购买时使用
  264. // 来自他人转赠的券(isGift=1)同样允许非会员用于购买会员
  265. if (coupon.applicableTo === 'MEMBERSHIP' && !this.isMember && coupon.grantType !== 'MANUAL' && !coupon.isGift) {
  266. return '开通会员后可用'
  267. }
  268. if (!coupon.minSpend || coupon.minSpend <= 0) return '无门槛'
  269. return '满' + (coupon.minSpend / 100).toFixed(2) + '元可用'
  270. },
  271. formatPrice: function(value) {
  272. if (value == null) return '0.00'
  273. return (value / 100).toFixed(2)
  274. },
  275. handlePay: function() {
  276. var self = this
  277. if (this.paying) return
  278. this.paying = true
  279. var couponId = this.selectedCoupon ? this.selectedCoupon.id : null
  280. var openid = uni.getStorageSync('openid') || ''
  281. createOrder(this.levelCode, 'pay', this.period, couponId, openid).then(function(res) {
  282. var data = res.data || {}
  283. self.orderNo = data.orderNo
  284. var payType = data.payType || 'virtual'
  285. if (payType === 'virtual' && data.orderInfo && data.sign) {
  286. // 虚拟支付(现有逻辑不变)
  287. self.totalPeriods = data.totalPeriods || 1
  288. self.currentPeriod = data.currentPeriod || 1
  289. self.splitAmount = data.orderInfo.goodsPrice || (self.finalPrice / (self.totalPeriods || 1))
  290. self.payInstallments(data)
  291. } else if (payType === 'wechat' && data.wechatPayParams) {
  292. // 普通微信支付(新增分支)
  293. self.payWechat(data.wechatPayParams)
  294. } else {
  295. // testMode/trial:模拟支付成功
  296. uni.showToast({ title: '支付成功,开通中…', icon: 'none' })
  297. setTimeout(function() {
  298. self.paying = false
  299. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=success' })
  300. }, 800)
  301. }
  302. }).catch(function(e) {
  303. self.paying = false
  304. if (e.code === 46001) {
  305. uni.showToast({ title: '该商品暂未开放购买', icon: 'none' })
  306. } else {
  307. uni.showToast({ title: e.message || '下单失败', icon: 'none' })
  308. }
  309. })
  310. },
  311. payWechat: function(pp) {
  312. var self = this
  313. if (!pp || !pp.package) {
  314. self.paying = false
  315. uni.showToast({ title: '支付参数异常', icon: 'none' })
  316. return
  317. }
  318. uni.requestPayment({
  319. provider: 'wxpay',
  320. timeStamp: pp.timeStamp,
  321. nonceStr: pp.nonceStr,
  322. package: pp.package,
  323. signType: pp.signType || 'RSA',
  324. paySign: pp.paySign || pp.sign,
  325. success: function() {
  326. uni.showToast({ title: '支付成功,开通中…', icon: 'none' })
  327. setTimeout(function() {
  328. self.paying = false
  329. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=success' })
  330. }, 800)
  331. },
  332. fail: function(err) {
  333. self.paying = false
  334. var errCode = err && err.errCode
  335. var msg = '支付取消'
  336. if (errCode === -15007 || errCode === -15005) msg = '登录态已过期,请重新登录'
  337. else if (err && err.errMsg) msg = err.errMsg
  338. uni.showToast({ title: msg, icon: 'none' })
  339. setTimeout(function() {
  340. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=fail' })
  341. }, 800)
  342. }
  343. })
  344. },
  345. payInstallments: function(dto) {
  346. var self = this
  347. var current = dto.currentPeriod || 1
  348. var total = dto.totalPeriods || 1
  349. requestVirtualPayment(dto, {
  350. success: function() {
  351. if (current < total) {
  352. uni.showToast({ title: '第' + current + '期支付成功', icon: 'none' })
  353. nextOrder({ orderNo: dto.orderNo }).then(function(res) {
  354. var nd = res.data
  355. if (nd && nd.done) {
  356. self.finishPay()
  357. } else if (nd && nd.orderInfo && nd.sign) {
  358. self.currentPeriod = nd.currentPeriod || 1
  359. self.payInstallments(nd)
  360. } else {
  361. self.finishPay()
  362. }
  363. }).catch(function() {
  364. self.finishPay()
  365. })
  366. } else {
  367. self.finishPay()
  368. }
  369. },
  370. fail: function(err) {
  371. var errCode = err && err.errCode
  372. // 虚拟支付失败(道具价格不匹配/道具未发布/环境不支持等)→ 自动降级为普通微信支付(订单支付)
  373. // 用户主动取消(-2)与登录态失效(-15007/-15005)不降级,直接提示
  374. if (dto && dto.wechatPayParams && errCode !== -2 && errCode !== -15007 && errCode !== -15005) {
  375. uni.showToast({ title: '虚拟支付不可用,转微信支付', icon: 'none' })
  376. setTimeout(function() {
  377. self.payWechat(dto.wechatPayParams)
  378. }, 800)
  379. return
  380. }
  381. self.paying = false
  382. var msg = ''
  383. if (errCode === -15007 || errCode === -15005) msg = '登录态已过期,请重新登录后支付'
  384. else if (errCode === -15010) msg = '商品未发布,请联系客服'
  385. else if (errCode === -15013) msg = '商品价格异常'
  386. else if (errCode === -2) msg = '支付已取消'
  387. else if (err && err.errMsg) msg = err.errMsg
  388. var status = (errCode === -2 || errCode === -15007 || errCode === -15005) ? 'fail' : 'fail'
  389. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=' + status })
  390. }
  391. })
  392. },
  393. finishPay: function() {
  394. var self = this
  395. uni.showToast({ title: '支付成功,开通中…', icon: 'none' })
  396. setTimeout(function() {
  397. self.paying = false
  398. uni.redirectTo({ url: '/pages/membership/result?orderNo=' + (self.orderNo || '') + '&status=success' })
  399. }, 800)
  400. },
  401. goToMembership: function() {
  402. uni.navigateTo({ url: '/pages/membership/index' })
  403. }
  404. }
  405. }
  406. </script>
  407. <style scoped lang="scss">
  408. .pay-page {
  409. min-height: 100vh;
  410. background: $uni-primary-pale;
  411. padding-bottom: 160rpx;
  412. box-sizing: border-box;
  413. }
  414. .page {
  415. padding: $uni-space-page;
  416. }
  417. /* ===== 商品明细卡 ===== */
  418. .order-card {
  419. background: $app-surface;
  420. border-radius: 24rpx;
  421. padding: 40rpx;
  422. box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
  423. }
  424. .order-header {
  425. margin-bottom: 24rpx;
  426. }
  427. .order-title {
  428. font-size: calc(34rpx * var(--font-scale, 1));
  429. font-weight: bold;
  430. color: $uni-text-color;
  431. display: block;
  432. }
  433. .order-sub {
  434. font-size: calc(24rpx * var(--font-scale, 1));
  435. color: $app-text-subtle;
  436. margin-top: 6rpx;
  437. display: block;
  438. }
  439. .price-row {
  440. display: flex;
  441. justify-content: space-between;
  442. align-items: center;
  443. padding: 16rpx 0;
  444. }
  445. .price-label {
  446. font-size: calc(26rpx * var(--font-scale, 1));
  447. color: $uni-text-color-secondary;
  448. }
  449. .price-original {
  450. font-size: calc(28rpx * var(--font-scale, 1));
  451. color: $app-text-subtle;
  452. text-decoration: line-through;
  453. }
  454. .price-now {
  455. font-size: calc(36rpx * var(--font-scale, 1));
  456. font-weight: bold;
  457. color: $brand-primary;
  458. }
  459. .coupon-row {
  460. display: flex;
  461. align-items: center;
  462. padding: 24rpx 0;
  463. border-top: 1rpx solid $facade-fill-2;
  464. margin-top: 16rpx;
  465. }
  466. .coupon-row:active {
  467. opacity: 0.7;
  468. }
  469. .coupon-row-label {
  470. font-size: calc(26rpx * var(--font-scale, 1));
  471. color: $facade-text-body;
  472. margin-right: 16rpx;
  473. }
  474. .coupon-row-discount {
  475. flex: 1;
  476. font-size: calc(26rpx * var(--font-scale, 1));
  477. color: $brand-primary;
  478. font-weight: 600;
  479. text-align: right;
  480. }
  481. .coupon-row-placeholder {
  482. flex: 1;
  483. font-size: calc(26rpx * var(--font-scale, 1));
  484. color: $facade-text-ghost;
  485. text-align: right;
  486. }
  487. .coupon-row-arrow {
  488. font-size: calc(32rpx * var(--font-scale, 1));
  489. color: $facade-text-ghost;
  490. margin-left: 8rpx;
  491. }
  492. .member-hint-row {
  493. display: flex;
  494. align-items: center;
  495. padding: 20rpx 0;
  496. margin-top: 8rpx;
  497. background: $uni-primary-pale;
  498. border-radius: 16rpx;
  499. }
  500. .member-hint-row:active {
  501. opacity: 0.7;
  502. }
  503. .member-hint-icon {
  504. font-size: calc(28rpx * var(--font-scale, 1));
  505. margin-right: 12rpx;
  506. }
  507. .member-hint-text {
  508. flex: 1;
  509. font-size: calc(26rpx * var(--font-scale, 1));
  510. color: $brand-primary;
  511. font-weight: 500;
  512. }
  513. .divider {
  514. height: 1rpx;
  515. background: $facade-fill-slate;
  516. margin: 16rpx 0;
  517. }
  518. .total-row {
  519. display: flex;
  520. justify-content: space-between;
  521. align-items: center;
  522. }
  523. .total-label {
  524. font-size: calc(28rpx * var(--font-scale, 1));
  525. font-weight: 600;
  526. color: $uni-text-color;
  527. }
  528. .total-amount {
  529. font-size: calc(44rpx * var(--font-scale, 1));
  530. font-weight: bold;
  531. color: $brand-primary;
  532. }
  533. /* ===== 拆单提示 ===== */
  534. .split-card {
  535. background: $status-warning-soft;
  536. border-radius: 24rpx;
  537. padding: 24rpx;
  538. margin-top: $uni-space-lg;
  539. }
  540. .split-title {
  541. font-size: calc(28rpx * var(--font-scale, 1));
  542. font-weight: 600;
  543. color: $status-warning-strong;
  544. display: block;
  545. margin-bottom: 8rpx;
  546. }
  547. .split-desc {
  548. font-size: calc(24rpx * var(--font-scale, 1));
  549. color: $status-warning-strong-2;
  550. display: block;
  551. }
  552. /* ===== 支付进度 ===== */
  553. .progress-card {
  554. background: $app-surface;
  555. border-radius: 24rpx;
  556. padding: 20rpx;
  557. margin-top: 20rpx;
  558. text-align: center;
  559. }
  560. .progress-text {
  561. font-size: calc(26rpx * var(--font-scale, 1));
  562. color: $brand-primary;
  563. font-weight: 600;
  564. }
  565. /* ===== 底部支付栏 ===== */
  566. .pay-bar {
  567. position: fixed;
  568. bottom: 0;
  569. left: 0;
  570. right: 0;
  571. background: $app-surface;
  572. padding: 20rpx $uni-space-page calc(20rpx + env(safe-area-inset-bottom));
  573. box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
  574. }
  575. .btn-pay {
  576. width: 100%;
  577. height: 96rpx;
  578. line-height: 96rpx;
  579. background: linear-gradient(135deg, $brand-primary 0%, $brand-primary-dark 100%);
  580. color: $app-surface;
  581. font-size: calc(34rpx * var(--font-scale, 1));
  582. font-weight: 600;
  583. border-radius: 24rpx;
  584. border: none;
  585. }
  586. .btn-pay::after {
  587. border: none;
  588. }
  589. .btn-pay[disabled] {
  590. opacity: 0.7;
  591. color: $app-surface;
  592. }
  593. /* ===== Coupon Picker(复用 upgrade 样式) ===== */
  594. .modal-mask {
  595. position: fixed;
  596. top: 0;
  597. left: 0;
  598. right: 0;
  599. bottom: 0;
  600. background: rgba(0,0,0,0.5);
  601. z-index: 999;
  602. display: flex;
  603. align-items: flex-end;
  604. }
  605. .coupon-picker {
  606. background: $app-surface;
  607. border-radius: 24rpx 24rpx 0 0;
  608. width: 100%;
  609. max-height: 70vh;
  610. display: flex;
  611. flex-direction: column;
  612. }
  613. .picker-header {
  614. display: flex;
  615. justify-content: space-between;
  616. align-items: center;
  617. padding: $uni-space-page;
  618. border-bottom: 1rpx solid $facade-hairline-2;
  619. }
  620. .picker-title {
  621. font-size: calc(30rpx * var(--font-scale, 1));
  622. font-weight: 600;
  623. color: $facade-text-strong;
  624. }
  625. .picker-close {
  626. font-size: calc(26rpx * var(--font-scale, 1));
  627. color: $facade-text-muted;
  628. }
  629. .picker-list {
  630. max-height: 50vh;
  631. padding: 0 20rpx;
  632. }
  633. .picker-item {
  634. display: flex;
  635. align-items: center;
  636. padding: 24rpx 16rpx;
  637. border-bottom: 1rpx solid $facade-fill-2;
  638. }
  639. .picker-item:active {
  640. background: $facade-fill-ghost;
  641. }
  642. .picker-item-active {
  643. background: $uni-primary-pale;
  644. }
  645. .picker-item-left {
  646. width: 120rpx;
  647. text-align: center;
  648. flex-shrink: 0;
  649. }
  650. .picker-item-value {
  651. font-size: calc(32rpx * var(--font-scale, 1));
  652. font-weight: bold;
  653. color: $brand-primary;
  654. }
  655. .picker-item-right {
  656. flex: 1;
  657. margin: 0 16rpx;
  658. }
  659. .picker-item-name {
  660. font-size: calc(26rpx * var(--font-scale, 1));
  661. color: $facade-text-strong;
  662. display: block;
  663. margin-bottom: 4rpx;
  664. }
  665. .picker-item-condition {
  666. font-size: calc(22rpx * var(--font-scale, 1));
  667. color: $facade-text-muted;
  668. }
  669. .picker-item-check {
  670. width: 40rpx;
  671. height: 40rpx;
  672. background: $brand-primary;
  673. border-radius: 50%;
  674. display: flex;
  675. align-items: center;
  676. justify-content: center;
  677. flex-shrink: 0;
  678. color: $app-surface;
  679. font-size: calc(24rpx * var(--font-scale, 1));
  680. font-weight: bold;
  681. }
  682. .picker-empty {
  683. text-align: center;
  684. padding: 60rpx 0;
  685. font-size: calc(26rpx * var(--font-scale, 1));
  686. color: $facade-text-muted;
  687. }
  688. .picker-footer {
  689. padding: 20rpx;
  690. border-top: 1rpx solid $facade-hairline-2;
  691. }
  692. .picker-btn-remove {
  693. background: $facade-fill-2;
  694. color: $facade-text-body;
  695. font-size: calc(26rpx * var(--font-scale, 1));
  696. border-radius: 16rpx;
  697. border: none;
  698. }
  699. .picker-btn-remove::after {
  700. border: none;
  701. }
  702. </style>