checkout.vue 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. <template>
  2. <view class="container">
  3. <view v-if="loading" class="loading-wrap">
  4. <text class="loading-text">加载中...</text>
  5. </view>
  6. <scroll-view v-else scroll-y class="content">
  7. <!-- Address Section -->
  8. <view class="section address-section" @click="openAddressPicker">
  9. <view v-if="selectedAddress" class="address-content">
  10. <view class="address-top">
  11. <text class="receiver-name">{{ selectedAddress.receiverName }}</text>
  12. <text class="receiver-phone">{{ formatPhone(selectedAddress.phone) }}</text>
  13. <text v-if="selectedAddress.isDefault === 1" class="default-badge">默认</text>
  14. </view>
  15. <text class="address-detail">
  16. {{ selectedAddress.province }}{{ selectedAddress.city }}{{ selectedAddress.district }}{{ selectedAddress.street }}
  17. </text>
  18. <text class="address-arrow">›</text>
  19. </view>
  20. <view v-else class="address-empty" @click.stop="goAddAddress">
  21. <text class="address-empty-icon">📍</text>
  22. <text class="address-empty-text">请选择收货地址</text>
  23. <text class="address-arrow">›</text>
  24. </view>
  25. </view>
  26. <!-- Purchase Info Section (when product requires it) -->
  27. <view class="section" v-if="requiredFields.length > 0">
  28. <text class="section-title">购买信息</text>
  29. <view
  30. v-for="field in requiredFields"
  31. :key="field.fieldKey"
  32. class="purchase-field-row"
  33. >
  34. <text class="purchase-field-label">
  35. {{ field.fieldName }}
  36. <text v-if="field.isRequired" class="required-mark">*</text>
  37. </text>
  38. <input
  39. v-model="purchaseForm[field.fieldKey]"
  40. class="purchase-field-input"
  41. :placeholder="'请输入' + field.fieldName + (field.isRequired ? '' : '(选填)')"
  42. :disabled="!!field.prefillValue"
  43. placeholder-style="color: #ccc; font-size: 26rpx;"
  44. />
  45. <text v-if="field.prefillValue" class="purchase-field-prefill">已填写</text>
  46. </view>
  47. </view>
  48. <!-- Order Items Section -->
  49. <view class="section">
  50. <text class="section-title">商品信息</text>
  51. <view
  52. v-for="item in items"
  53. :key="item.productId"
  54. class="order-item"
  55. >
  56. <image
  57. class="item-image"
  58. :src="item.coverImage || '/static/default-product.png'"
  59. mode="aspectFill"
  60. />
  61. <view class="item-info">
  62. <text class="item-name">{{ item.productName }}</text>
  63. <text v-if="item.specDesc" class="item-spec-desc">{{ item.specDesc }}</text>
  64. <text v-if="item.supplierName" class="item-supplier-name">供应商: {{ item.supplierName }}</text>
  65. <text class="item-qty">x{{ item.quantity }}</text>
  66. </view>
  67. <text class="item-price">{{ formatPriceWithSymbol(item.unitPrice) }}</text>
  68. </view>
  69. </view>
  70. <!-- Freight Section -->
  71. <view class="section">
  72. <view class="info-row">
  73. <text class="info-label">运费</text>
  74. <text class="info-value">{{ formatPriceWithSymbol(freight) }}</text>
  75. </view>
  76. </view>
  77. <!-- Member Upgrade Hint -->
  78. <view v-if="!isMember" class="section member-upgrade-section" @click="goUpgrade">
  79. <view class="member-upgrade-row">
  80. <text class="member-upgrade-icon">👑</text>
  81. <text class="member-upgrade-text">开通付费会员享全场商品会员专享价</text>
  82. <text class="member-upgrade-arrow">›</text>
  83. </view>
  84. </view>
  85. <!-- Coupon Section -->
  86. <view class="section coupon-section" @click="openCouponPicker">
  87. <view class="info-row">
  88. <text class="info-label">优惠券</text>
  89. <view class="coupon-selected" v-if="selectedCoupon">
  90. <text class="coupon-discount">-{{ formatPriceWithSymbol(selectedCoupon.value) }}</text>
  91. <text class="coupon-name-tag">{{ selectedCoupon.name }}</text>
  92. </view>
  93. <view class="coupon-placeholder" v-else>
  94. <text class="placeholder-text">选择优惠券</text>
  95. </view>
  96. <text class="address-arrow">›</text>
  97. </view>
  98. </view>
  99. <!-- Points Deduction Section -->
  100. <view class="section" v-if="userTotalPoints > 0">
  101. <view class="info-row">
  102. <text class="info-label">积分抵扣</text>
  103. <text class="points-balance">可用 {{ userTotalPoints }} 积分</text>
  104. </view>
  105. <view class="points-input-row">
  106. <input
  107. class="points-input"
  108. type="number"
  109. :value="pointsUsed"
  110. @input="onPointsInput"
  111. placeholder="输入使用积分"
  112. placeholder-style="color: #ccc; font-size: 26rpx;"
  113. />
  114. <text class="points-hint">≈ ¥{{ pointsYuanEquivalent }}</text>
  115. </view>
  116. <view class="points-tip">
  117. <text class="points-tip-text">1积分 = ¥0.01,最多使用 {{ maxPoints }} 积分</text>
  118. </view>
  119. </view>
  120. <!-- Remark Section -->
  121. <view class="section">
  122. <view class="info-row">
  123. <text class="info-label">备注</text>
  124. <input
  125. class="remark-input"
  126. v-model="remark"
  127. placeholder="选填,给商家留言"
  128. placeholder-style="color: #ccc; font-size: 26rpx;"
  129. />
  130. </view>
  131. </view>
  132. <view class="bottom-spacer"></view>
  133. <!-- Coupon Picker Bottom Sheet -->
  134. <view class="modal-mask" v-if="showCouponPicker" @click="closeCouponPicker">
  135. <view class="coupon-picker" @click.stop>
  136. <view class="picker-header">
  137. <text class="picker-title">选择优惠券</text>
  138. <text class="picker-close" @click="closeCouponPicker">关闭</text>
  139. </view>
  140. <scroll-view scroll-y class="picker-list">
  141. <view
  142. v-for="coupon in availableCoupons"
  143. :key="coupon.id"
  144. class="picker-item"
  145. :class="selectedCoupon && selectedCoupon.id === coupon.id ? 'picker-item-active' : ''"
  146. @click="selectCoupon(coupon)"
  147. >
  148. <view class="picker-item-left">
  149. <text class="picker-item-value">{{ formatPriceWithSymbol(coupon.value) }}</text>
  150. </view>
  151. <view class="picker-item-right">
  152. <text class="picker-item-name">{{ coupon.name }}</text>
  153. <text class="picker-item-condition">{{ getConditionText(coupon.minSpend) }}</text>
  154. </view>
  155. <view class="picker-item-check" v-if="selectedCoupon && selectedCoupon.id === coupon.id">
  156. <text class="check-icon">✓</text>
  157. </view>
  158. </view>
  159. <view class="picker-empty" v-if="availableCoupons.length === 0">
  160. <text>暂无可用优惠券</text>
  161. </view>
  162. </scroll-view>
  163. <view class="picker-footer" v-if="selectedCoupon">
  164. <button class="picker-btn-remove" @click="removeCoupon">不使用优惠券</button>
  165. </view>
  166. </view>
  167. </view>
  168. </scroll-view>
  169. <view class="bottom-bar">
  170. <view class="bottom-left">
  171. <text class="total-label">合计: </text>
  172. <text class="total-amount">{{ formatPriceWithSymbol(finalAmount) }}</text>
  173. <text v-if="selectedCoupon" class="total-original">{{ formatPriceWithSymbol(actualAmount + freight) }}</text>
  174. </view>
  175. <button
  176. :class="['submit-btn', submitting ? 'disabled' : '']"
  177. :disabled="submitting"
  178. @click="onSubmit"
  179. >提交订单</button>
  180. </view>
  181. </view>
  182. </template>
  183. <script>
  184. import config from '@/config.js'
  185. import { getCouponList, addressList, getProductRequiredFields, getMyMembership } from '../../../utils/api.js'
  186. export default {
  187. data() {
  188. return {
  189. items: [],
  190. selectedAddress: null,
  191. requiredFields: [], // 需要的购买信息字段
  192. purchaseForm: {}, // 用户填写的购买信息
  193. addressList: [],
  194. freight: 0,
  195. remark: '',
  196. loading: false,
  197. submitting: false,
  198. actualAmount: 0,
  199. coupons: [],
  200. selectedCoupon: null,
  201. showCouponPicker: false,
  202. pointsUsed: 0,
  203. userTotalPoints: 0,
  204. pointsLoading: false,
  205. isMember: false
  206. }
  207. },
  208. computed: {
  209. finalAmount() {
  210. var total = (this.actualAmount || 0) + (this.freight || 0)
  211. if (this.selectedCoupon) {
  212. total = total - this.selectedCoupon.value
  213. }
  214. total = total - (this.pointsUsed || 0)
  215. if (total < 0) total = 0
  216. return total
  217. },
  218. maxPoints() {
  219. var total = (this.actualAmount || 0) + (this.freight || 0)
  220. if (this.selectedCoupon) {
  221. total = total - this.selectedCoupon.value
  222. }
  223. if (total < 0) total = 0
  224. if (this.userTotalPoints < total) {
  225. return this.userTotalPoints
  226. }
  227. return total
  228. },
  229. pointsYuanEquivalent() {
  230. return (this.pointsUsed / 100).toFixed(2)
  231. },
  232. availableCoupons() {
  233. var self = this
  234. return this.coupons.filter(function(c) {
  235. if (c.status && c.status !== 'AVAILABLE') return false
  236. if (c.applicableTo && c.applicableTo !== 'ALL') return false
  237. if (c.minSpend && c.minSpend > self.actualAmount) return false
  238. return true
  239. })
  240. }
  241. },
  242. onLoad(options) {
  243. var that = this
  244. var stored = uni.getStorageSync('checkoutItems')
  245. if (stored && stored.length > 0) {
  246. this.items = stored
  247. this.calcAmount()
  248. } else if (options.productId) {
  249. // Load product directly from detail page
  250. var productData = {
  251. productId: parseInt(options.productId),
  252. productName: options.productName || '商品',
  253. coverImage: options.coverImage || '',
  254. unitPrice: parseInt(options.price) || 0,
  255. quantity: parseInt(options.quantity) || 1
  256. }
  257. if (options.skuId) {
  258. productData.skuId = parseInt(options.skuId)
  259. }
  260. this.items = [productData]
  261. this.calcAmount()
  262. }
  263. this.checkMemberStatus()
  264. this.loadDefaultAddress()
  265. this.loadRequiredFields()
  266. this.loadCoupons()
  267. this.loadUserPoints()
  268. },
  269. onShow() {
  270. // 从地址选择/编辑页返回后重新加载地址列表
  271. this.loadDefaultAddress()
  272. },
  273. methods: {
  274. calcAmount() {
  275. var total = 0
  276. for (var i = 0; i < this.items.length; i++) {
  277. total = total + (this.items[i].unitPrice * this.items[i].quantity)
  278. }
  279. this.actualAmount = total
  280. },
  281. async loadCoupons() {
  282. try {
  283. var res = await getCouponList()
  284. this.coupons = res.data || []
  285. } catch (e) {
  286. this.coupons = []
  287. }
  288. },
  289. openCouponPicker() {
  290. if (this.availableCoupons.length === 0 && !this.selectedCoupon) {
  291. uni.showToast({ title: '暂无可用优惠券', icon: 'none' })
  292. return
  293. }
  294. this.showCouponPicker = true
  295. },
  296. closeCouponPicker() {
  297. this.showCouponPicker = false
  298. },
  299. selectCoupon(coupon) {
  300. this.selectedCoupon = coupon
  301. this.showCouponPicker = false
  302. },
  303. removeCoupon() {
  304. this.selectedCoupon = null
  305. this.showCouponPicker = false
  306. },
  307. onPointsInput(e) {
  308. var val = parseInt(e.detail.value) || 0
  309. if (val < 0) val = 0
  310. var maxP = this.maxPoints
  311. if (val > maxP) {
  312. val = maxP
  313. uni.showToast({ title: '最多使用 ' + maxP + ' 积分', icon: 'none' })
  314. }
  315. this.pointsUsed = val
  316. },
  317. getConditionText(minSpend) {
  318. if (!minSpend || minSpend <= 0) return '无门槛'
  319. return '满' + (minSpend / 100).toFixed(2) + '元可用'
  320. },
  321. async loadDefaultAddress() {
  322. this.loading = true
  323. try {
  324. var res = await addressList()
  325. if (res.code === 200) {
  326. var list = res.data || []
  327. this.addressList = list
  328. // 如果当前已有选中地址,保持选中状态
  329. if (this.selectedAddress) {
  330. var stillExists = false
  331. for (var k = 0; k < list.length; k++) {
  332. if (list[k].id === this.selectedAddress.id) {
  333. stillExists = true
  334. break
  335. }
  336. }
  337. if (!stillExists) {
  338. this.selectedAddress = null
  339. }
  340. }
  341. if (!this.selectedAddress) {
  342. for (var i = 0; i < list.length; i++) {
  343. if (list[i].isDefault === 1) {
  344. this.selectedAddress = list[i]
  345. break
  346. }
  347. }
  348. if (!this.selectedAddress && list.length > 0) {
  349. this.selectedAddress = list[0]
  350. }
  351. }
  352. }
  353. } catch (e) {
  354. console.error(e)
  355. } finally {
  356. this.loading = false
  357. }
  358. },
  359. async loadRequiredFields() {
  360. if (this.items.length === 0) return
  361. var productId = this.items[0].productId
  362. try {
  363. var res = await getProductRequiredFields(productId)
  364. if (res.code === 200) {
  365. this.requiredFields = res.data || []
  366. this.autoFillPurchaseForm()
  367. }
  368. } catch (e) {
  369. console.error(e)
  370. }
  371. },
  372. autoFillPurchaseForm() {
  373. if (!this.selectedAddress || this.requiredFields.length === 0) return
  374. var form = {}
  375. for (var i = 0; i < this.requiredFields.length; i++) {
  376. var field = this.requiredFields[i]
  377. if (field.prefillValue) {
  378. form[field.fieldKey] = field.prefillValue
  379. } else {
  380. form[field.fieldKey] = ''
  381. }
  382. }
  383. this.purchaseForm = form
  384. },
  385. openAddressPicker() {
  386. if (this.addressList.length === 0) {
  387. uni.showToast({ title: '暂无地址,请先添加', icon: 'none' })
  388. return
  389. }
  390. uni.navigateTo({ url: '/pages/shop/address/address?selectMode=1' })
  391. },
  392. checkMemberStatus() {
  393. var that = this
  394. getMyMembership().then(function(res) {
  395. if (res.data && res.data.memberLevel) {
  396. that.isMember = res.data.memberLevel !== 'FREE'
  397. }
  398. }).catch(function() {})
  399. },
  400. goUpgrade() {
  401. uni.navigateTo({ url: '/pages/membership/upgrade' })
  402. },
  403. goAddAddress() {
  404. uni.navigateTo({ url: '/pages/shop/address-edit/address-edit' })
  405. },
  406. loadUserPoints() {
  407. var that = this
  408. uni.request({
  409. url: config.api('/api/user/info'),
  410. method: 'POST',
  411. data: {},
  412. header: {
  413. 'Content-Type': 'application/json',
  414. 'Authorization': 'Bearer ' + uni.getStorageSync('token')
  415. },
  416. success: function(res) {
  417. if (res.data && res.data.code === 200) {
  418. that.userTotalPoints = res.data.data.totalPoints || 0
  419. }
  420. }
  421. })
  422. },
  423. onSubmit() {
  424. if (!this.selectedAddress) {
  425. uni.showToast({ title: '请选择收货地址', icon: 'none' })
  426. return
  427. }
  428. if (this.items.length === 0) {
  429. uni.showToast({ title: '请选择商品', icon: 'none' })
  430. return
  431. }
  432. this.submitting = true
  433. var orderItems = []
  434. for (var i = 0; i < this.items.length; i++) {
  435. var itemData = {
  436. productId: this.items[i].productId,
  437. quantity: this.items[i].quantity
  438. }
  439. if (this.items[i].skuId) {
  440. itemData.skuId = this.items[i].skuId
  441. }
  442. orderItems.push(itemData)
  443. }
  444. var that = this
  445. uni.request({
  446. url: config.api('/api/product/order/create'),
  447. method: 'POST',
  448. data: {
  449. items: orderItems,
  450. remark: this.remark,
  451. addressId: that.selectedAddress.id,
  452. purchaseInfo: that.purchaseForm,
  453. pointsUsed: that.pointsUsed
  454. },
  455. header: {
  456. 'Content-Type': 'application/json',
  457. 'Authorization': 'Bearer ' + uni.getStorageSync('token')
  458. },
  459. success: function(res) {
  460. that.submitting = false
  461. if (res.data && res.data.code === 200) {
  462. var order = res.data.data
  463. uni.showToast({ title: '下单成功', icon: 'success' })
  464. uni.removeStorageSync('checkoutItems')
  465. var moneyAmount = order.moneyAmount != null ? order.moneyAmount : order.totalAmount
  466. var pointsUsed = order.pointsUsed || 0
  467. setTimeout(function() {
  468. uni.navigateTo({
  469. url: '/pages/shop/payment/payment?orderNo=' + order.orderNo + '&amount=' + moneyAmount + '&pointsUsed=' + pointsUsed
  470. })
  471. }, 1000)
  472. } else {
  473. uni.showToast({ title: res.data.message || '下单失败', icon: 'none' })
  474. }
  475. },
  476. fail: function() {
  477. that.submitting = false
  478. uni.showToast({ title: '网络请求失败', icon: 'none' })
  479. }
  480. })
  481. },
  482. formatPrice(price) {
  483. if (price === null || price === undefined) return '0.00'
  484. return (Number(price) / 100).toFixed(2)
  485. },
  486. formatPhone(phone) {
  487. if (!phone) return ''
  488. if (phone.length === 11) {
  489. return phone.substr(0, 3) + '****' + phone.substr(7)
  490. }
  491. return phone
  492. }
  493. }
  494. }
  495. </script>
  496. <style scoped>
  497. .container {
  498. min-height: 100vh;
  499. background: #f5f5f5;
  500. }
  501. .loading-wrap {
  502. display: flex;
  503. justify-content: center;
  504. padding-top: 200rpx;
  505. }
  506. .loading-text {
  507. font-size: 28rpx;
  508. color: #999;
  509. }
  510. .content {
  511. height: calc(100vh - 120rpx);
  512. }
  513. .section {
  514. background: #fff;
  515. margin: 20rpx;
  516. border-radius: 16rpx;
  517. padding: 24rpx;
  518. }
  519. .section-title {
  520. font-size: 28rpx;
  521. font-weight: bold;
  522. color: #333;
  523. margin-bottom: 20rpx;
  524. display: block;
  525. }
  526. .address-section {
  527. position: relative;
  528. }
  529. .address-content {
  530. position: relative;
  531. }
  532. .address-top {
  533. display: flex;
  534. align-items: center;
  535. margin-bottom: 10rpx;
  536. }
  537. .receiver-name {
  538. font-size: 30rpx;
  539. font-weight: bold;
  540. color: #333;
  541. margin-right: 20rpx;
  542. }
  543. .receiver-phone {
  544. font-size: 26rpx;
  545. color: #666;
  546. }
  547. .default-badge {
  548. font-size: 20rpx;
  549. color: #F97316;
  550. background: #fff7e6;
  551. padding: 2rpx 12rpx;
  552. border-radius: 20rpx;
  553. margin-left: 12rpx;
  554. }
  555. .address-detail {
  556. font-size: 26rpx;
  557. color: #999;
  558. line-height: 1.5;
  559. }
  560. .address-arrow {
  561. position: absolute;
  562. right: 0;
  563. top: 50%;
  564. font-size: 40rpx;
  565. color: #ccc;
  566. transform: translateY(-50%);
  567. }
  568. .address-empty {
  569. display: flex;
  570. align-items: center;
  571. justify-content: center;
  572. padding: 30rpx 0;
  573. position: relative;
  574. }
  575. .address-empty-icon {
  576. font-size: 40rpx;
  577. margin-right: 12rpx;
  578. }
  579. .address-empty-text {
  580. font-size: 28rpx;
  581. color: #999;
  582. }
  583. .order-item {
  584. display: flex;
  585. align-items: center;
  586. padding: 16rpx 0;
  587. border-bottom: 1rpx solid #f5f5f5;
  588. }
  589. .order-item:last-child {
  590. border-bottom: none;
  591. }
  592. .item-image {
  593. width: 80rpx;
  594. height: 80rpx;
  595. border-radius: 8rpx;
  596. background: #f0f0f0;
  597. margin-right: 16rpx;
  598. }
  599. .item-info {
  600. flex: 1;
  601. display: flex;
  602. flex-direction: column;
  603. min-width: 0;
  604. }
  605. .item-name {
  606. font-size: 26rpx;
  607. color: #333;
  608. overflow: hidden;
  609. text-overflow: ellipsis;
  610. white-space: nowrap;
  611. margin-bottom: 6rpx;
  612. }
  613. .item-spec-desc {
  614. font-size: 22rpx;
  615. color: #999;
  616. display: block;
  617. margin-top: 2rpx;
  618. }
  619. .item-supplier-name {
  620. font-size: 20rpx;
  621. color: #0EA5E9;
  622. display: block;
  623. margin-top: 2rpx;
  624. }
  625. .item-qty {
  626. font-size: 22rpx;
  627. color: #999;
  628. }
  629. .item-price {
  630. font-size: 26rpx;
  631. color: #F97316;
  632. font-weight: bold;
  633. margin-left: 16rpx;
  634. }
  635. .info-row {
  636. display: flex;
  637. justify-content: space-between;
  638. align-items: center;
  639. padding: 8rpx 0;
  640. }
  641. .info-label {
  642. font-size: 26rpx;
  643. color: #999;
  644. }
  645. .info-value {
  646. font-size: 26rpx;
  647. color: #333;
  648. }
  649. .remark-input {
  650. flex: 1;
  651. text-align: right;
  652. font-size: 26rpx;
  653. color: #333;
  654. }
  655. /* ===== Coupon Section ===== */
  656. .coupon-section {
  657. position: relative;
  658. }
  659. .coupon-section:active {
  660. background: #fafafa;
  661. }
  662. .coupon-selected {
  663. display: flex;
  664. align-items: center;
  665. flex: 1;
  666. justify-content: flex-end;
  667. margin-right: 30rpx;
  668. }
  669. .coupon-discount {
  670. font-size: 26rpx;
  671. color: #F97316;
  672. font-weight: 600;
  673. margin-right: 12rpx;
  674. }
  675. .coupon-name-tag {
  676. font-size: 22rpx;
  677. color: #fff;
  678. background: #F97316;
  679. padding: 2rpx 12rpx;
  680. border-radius: 6rpx;
  681. max-width: 200rpx;
  682. overflow: hidden;
  683. text-overflow: ellipsis;
  684. white-space: nowrap;
  685. }
  686. .coupon-placeholder {
  687. flex: 1;
  688. text-align: right;
  689. margin-right: 30rpx;
  690. }
  691. .placeholder-text {
  692. font-size: 26rpx;
  693. color: #ccc;
  694. }
  695. .total-original {
  696. font-size: 22rpx;
  697. color: #bbb;
  698. text-decoration: line-through;
  699. margin-left: 8rpx;
  700. }
  701. /* ===== Member Upgrade Hint ===== */
  702. .member-upgrade-section {
  703. position: relative;
  704. }
  705. .member-upgrade-row {
  706. display: flex;
  707. align-items: center;
  708. }
  709. .member-upgrade-icon {
  710. font-size: 32rpx;
  711. margin-right: 12rpx;
  712. }
  713. .member-upgrade-text {
  714. flex: 1;
  715. font-size: 26rpx;
  716. color: #F97316;
  717. font-weight: 500;
  718. }
  719. .member-upgrade-arrow {
  720. font-size: 32rpx;
  721. color: #F97316;
  722. }
  723. /* ===== Coupon Picker Modal ===== */
  724. .modal-mask {
  725. position: fixed;
  726. top: 0;
  727. left: 0;
  728. right: 0;
  729. bottom: 0;
  730. background: rgba(0,0,0,0.5);
  731. z-index: 999;
  732. display: flex;
  733. align-items: flex-end;
  734. }
  735. .coupon-picker {
  736. background: #fff;
  737. border-radius: 24rpx 24rpx 0 0;
  738. width: 100%;
  739. max-height: 70vh;
  740. display: flex;
  741. flex-direction: column;
  742. }
  743. .picker-header {
  744. display: flex;
  745. justify-content: space-between;
  746. align-items: center;
  747. padding: 30rpx;
  748. border-bottom: 1rpx solid #eee;
  749. }
  750. .picker-title {
  751. font-size: 30rpx;
  752. font-weight: 600;
  753. color: #333;
  754. }
  755. .picker-close {
  756. font-size: 26rpx;
  757. color: #999;
  758. }
  759. .picker-list {
  760. max-height: 50vh;
  761. padding: 0 20rpx;
  762. }
  763. .picker-item {
  764. display: flex;
  765. align-items: center;
  766. padding: 24rpx 16rpx;
  767. border-bottom: 1rpx solid #f5f5f5;
  768. }
  769. .picker-item:active {
  770. background: #fafafa;
  771. }
  772. .picker-item-active {
  773. background: #FFF7ED;
  774. }
  775. .picker-item-left {
  776. width: 120rpx;
  777. text-align: center;
  778. flex-shrink: 0;
  779. }
  780. .picker-item-value {
  781. font-size: 32rpx;
  782. font-weight: bold;
  783. color: #F97316;
  784. }
  785. .picker-item-right {
  786. flex: 1;
  787. margin: 0 16rpx;
  788. }
  789. .picker-item-name {
  790. font-size: 26rpx;
  791. color: #333;
  792. display: block;
  793. margin-bottom: 4rpx;
  794. }
  795. .picker-item-condition {
  796. font-size: 22rpx;
  797. color: #999;
  798. }
  799. .picker-item-check {
  800. width: 40rpx;
  801. height: 40rpx;
  802. background: #F97316;
  803. border-radius: 50%;
  804. display: flex;
  805. align-items: center;
  806. justify-content: center;
  807. flex-shrink: 0;
  808. }
  809. .check-icon {
  810. color: #fff;
  811. font-size: 24rpx;
  812. font-weight: bold;
  813. }
  814. .picker-empty {
  815. text-align: center;
  816. padding: 60rpx 0;
  817. font-size: 26rpx;
  818. color: #999;
  819. }
  820. .picker-footer {
  821. padding: 20rpx;
  822. border-top: 1rpx solid #eee;
  823. }
  824. .picker-btn-remove {
  825. background: #f5f5f5;
  826. color: #666;
  827. font-size: 26rpx;
  828. border-radius: 12rpx;
  829. border: none;
  830. }
  831. .picker-btn-remove::after {
  832. border: none;
  833. }
  834. .bottom-spacer {
  835. height: 140rpx;
  836. }
  837. .bottom-bar {
  838. position: fixed;
  839. bottom: 0;
  840. left: 0;
  841. right: 0;
  842. height: 100rpx;
  843. background: #fff;
  844. border-top: 1rpx solid #eee;
  845. display: flex;
  846. align-items: center;
  847. justify-content: space-between;
  848. padding: 0 30rpx;
  849. z-index: 100;
  850. }
  851. .bottom-left {
  852. display: flex;
  853. align-items: baseline;
  854. }
  855. .total-label {
  856. font-size: 26rpx;
  857. color: #666;
  858. }
  859. .total-amount {
  860. font-size: 36rpx;
  861. color: #F97316;
  862. font-weight: bold;
  863. }
  864. .submit-btn {
  865. background: linear-gradient(135deg, #F97316, #FB923C);
  866. color: #fff;
  867. font-size: 28rpx;
  868. font-weight: bold;
  869. padding: 0 60rpx;
  870. height: 72rpx;
  871. line-height: 72rpx;
  872. border-radius: 36rpx;
  873. border: none;
  874. }
  875. .submit-btn::after {
  876. border: none;
  877. }
  878. .submit-btn.disabled {
  879. background: #ddd;
  880. color: #999;
  881. }
  882. .points-balance {
  883. font-size: 24rpx;
  884. color: #F97316;
  885. }
  886. .points-input-row {
  887. display: flex;
  888. align-items: center;
  889. margin-top: 16rpx;
  890. padding: 12rpx 0;
  891. border-top: 1rpx solid #f5f5f5;
  892. }
  893. .points-input {
  894. flex: 1;
  895. height: 60rpx;
  896. font-size: 28rpx;
  897. color: #333;
  898. background: #f9f9f9;
  899. border-radius: 8rpx;
  900. padding: 0 16rpx;
  901. }
  902. .points-hint {
  903. font-size: 24rpx;
  904. color: #999;
  905. margin-left: 12rpx;
  906. min-width: 100rpx;
  907. text-align: right;
  908. }
  909. .points-tip {
  910. margin-top: 8rpx;
  911. }
  912. .points-tip-text {
  913. font-size: 22rpx;
  914. color: #bbb;
  915. }
  916. .total-original {
  917. font-size: 24rpx;
  918. color: #bbb;
  919. text-decoration: line-through;
  920. margin-left: 8rpx;
  921. }
  922. /* ===== Purchase Info Fields ===== */
  923. .purchase-field-row {
  924. display: flex;
  925. align-items: center;
  926. padding: 16rpx 0;
  927. border-bottom: 1rpx solid #f5f5f5;
  928. }
  929. .purchase-field-row:last-child {
  930. border-bottom: none;
  931. }
  932. .purchase-field-label {
  933. font-size: 26rpx;
  934. color: #333;
  935. width: 160rpx;
  936. flex-shrink: 0;
  937. }
  938. .required-mark {
  939. color: #f56c6c;
  940. }
  941. .purchase-field-input {
  942. flex: 1;
  943. font-size: 26rpx;
  944. color: #333;
  945. text-align: right;
  946. padding: 8rpx 0;
  947. }
  948. .purchase-field-input[disabled] {
  949. background: transparent;
  950. color: #999;
  951. }
  952. .purchase-field-prefill {
  953. font-size: 22rpx;
  954. color: #67c23a;
  955. margin-left: 8rpx;
  956. }
  957. </style>