checkout.vue 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  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="getImageUrl(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. getImageUrl: function(path) {
  494. return config.API_BASE_URL + path
  495. }
  496. }
  497. }
  498. </script>
  499. <style scoped>
  500. .container {
  501. min-height: 100vh;
  502. background: #f5f5f5;
  503. }
  504. .loading-wrap {
  505. display: flex;
  506. justify-content: center;
  507. padding-top: 200rpx;
  508. }
  509. .loading-text {
  510. font-size: 28rpx;
  511. color: #999;
  512. }
  513. .content {
  514. height: calc(100vh - 120rpx);
  515. }
  516. .section {
  517. background: #fff;
  518. margin: 20rpx;
  519. border-radius: 16rpx;
  520. padding: 24rpx;
  521. }
  522. .section-title {
  523. font-size: 28rpx;
  524. font-weight: bold;
  525. color: #333;
  526. margin-bottom: 20rpx;
  527. display: block;
  528. }
  529. .address-section {
  530. position: relative;
  531. }
  532. .address-content {
  533. position: relative;
  534. }
  535. .address-top {
  536. display: flex;
  537. align-items: center;
  538. margin-bottom: 10rpx;
  539. }
  540. .receiver-name {
  541. font-size: 30rpx;
  542. font-weight: bold;
  543. color: #333;
  544. margin-right: 20rpx;
  545. }
  546. .receiver-phone {
  547. font-size: 26rpx;
  548. color: #666;
  549. }
  550. .default-badge {
  551. font-size: 20rpx;
  552. color: #F97316;
  553. background: #fff7e6;
  554. padding: 2rpx 12rpx;
  555. border-radius: 20rpx;
  556. margin-left: 12rpx;
  557. }
  558. .address-detail {
  559. font-size: 26rpx;
  560. color: #999;
  561. line-height: 1.5;
  562. }
  563. .address-arrow {
  564. position: absolute;
  565. right: 0;
  566. top: 50%;
  567. font-size: 40rpx;
  568. color: #ccc;
  569. transform: translateY(-50%);
  570. }
  571. .address-empty {
  572. display: flex;
  573. align-items: center;
  574. justify-content: center;
  575. padding: 30rpx 0;
  576. position: relative;
  577. }
  578. .address-empty-icon {
  579. font-size: 40rpx;
  580. margin-right: 12rpx;
  581. }
  582. .address-empty-text {
  583. font-size: 28rpx;
  584. color: #999;
  585. }
  586. .order-item {
  587. display: flex;
  588. align-items: center;
  589. padding: 16rpx 0;
  590. border-bottom: 1rpx solid #f5f5f5;
  591. }
  592. .order-item:last-child {
  593. border-bottom: none;
  594. }
  595. .item-image {
  596. width: 80rpx;
  597. height: 80rpx;
  598. border-radius: 8rpx;
  599. background: #f0f0f0;
  600. margin-right: 16rpx;
  601. }
  602. .item-info {
  603. flex: 1;
  604. display: flex;
  605. flex-direction: column;
  606. min-width: 0;
  607. }
  608. .item-name {
  609. font-size: 26rpx;
  610. color: #333;
  611. overflow: hidden;
  612. text-overflow: ellipsis;
  613. white-space: nowrap;
  614. margin-bottom: 6rpx;
  615. }
  616. .item-spec-desc {
  617. font-size: 22rpx;
  618. color: #999;
  619. display: block;
  620. margin-top: 2rpx;
  621. }
  622. .item-supplier-name {
  623. font-size: 20rpx;
  624. color: #0EA5E9;
  625. display: block;
  626. margin-top: 2rpx;
  627. }
  628. .item-qty {
  629. font-size: 22rpx;
  630. color: #999;
  631. }
  632. .item-price {
  633. font-size: 26rpx;
  634. color: #F97316;
  635. font-weight: bold;
  636. margin-left: 16rpx;
  637. }
  638. .info-row {
  639. display: flex;
  640. justify-content: space-between;
  641. align-items: center;
  642. padding: 8rpx 0;
  643. }
  644. .info-label {
  645. font-size: 26rpx;
  646. color: #999;
  647. }
  648. .info-value {
  649. font-size: 26rpx;
  650. color: #333;
  651. }
  652. .remark-input {
  653. flex: 1;
  654. text-align: right;
  655. font-size: 26rpx;
  656. color: #333;
  657. }
  658. /* ===== Coupon Section ===== */
  659. .coupon-section {
  660. position: relative;
  661. }
  662. .coupon-section:active {
  663. background: #fafafa;
  664. }
  665. .coupon-selected {
  666. display: flex;
  667. align-items: center;
  668. flex: 1;
  669. justify-content: flex-end;
  670. margin-right: 30rpx;
  671. }
  672. .coupon-discount {
  673. font-size: 26rpx;
  674. color: #F97316;
  675. font-weight: 600;
  676. margin-right: 12rpx;
  677. }
  678. .coupon-name-tag {
  679. font-size: 22rpx;
  680. color: #fff;
  681. background: #F97316;
  682. padding: 2rpx 12rpx;
  683. border-radius: 6rpx;
  684. max-width: 200rpx;
  685. overflow: hidden;
  686. text-overflow: ellipsis;
  687. white-space: nowrap;
  688. }
  689. .coupon-placeholder {
  690. flex: 1;
  691. text-align: right;
  692. margin-right: 30rpx;
  693. }
  694. .placeholder-text {
  695. font-size: 26rpx;
  696. color: #ccc;
  697. }
  698. .total-original {
  699. font-size: 22rpx;
  700. color: #bbb;
  701. text-decoration: line-through;
  702. margin-left: 8rpx;
  703. }
  704. /* ===== Member Upgrade Hint ===== */
  705. .member-upgrade-section {
  706. position: relative;
  707. }
  708. .member-upgrade-row {
  709. display: flex;
  710. align-items: center;
  711. }
  712. .member-upgrade-icon {
  713. font-size: 32rpx;
  714. margin-right: 12rpx;
  715. }
  716. .member-upgrade-text {
  717. flex: 1;
  718. font-size: 26rpx;
  719. color: #F97316;
  720. font-weight: 500;
  721. }
  722. .member-upgrade-arrow {
  723. font-size: 32rpx;
  724. color: #F97316;
  725. }
  726. /* ===== Coupon Picker Modal ===== */
  727. .modal-mask {
  728. position: fixed;
  729. top: 0;
  730. left: 0;
  731. right: 0;
  732. bottom: 0;
  733. background: rgba(0,0,0,0.5);
  734. z-index: 999;
  735. display: flex;
  736. align-items: flex-end;
  737. }
  738. .coupon-picker {
  739. background: #fff;
  740. border-radius: 24rpx 24rpx 0 0;
  741. width: 100%;
  742. max-height: 70vh;
  743. display: flex;
  744. flex-direction: column;
  745. }
  746. .picker-header {
  747. display: flex;
  748. justify-content: space-between;
  749. align-items: center;
  750. padding: 30rpx;
  751. border-bottom: 1rpx solid #eee;
  752. }
  753. .picker-title {
  754. font-size: 30rpx;
  755. font-weight: 600;
  756. color: #333;
  757. }
  758. .picker-close {
  759. font-size: 26rpx;
  760. color: #999;
  761. }
  762. .picker-list {
  763. max-height: 50vh;
  764. padding: 0 20rpx;
  765. }
  766. .picker-item {
  767. display: flex;
  768. align-items: center;
  769. padding: 24rpx 16rpx;
  770. border-bottom: 1rpx solid #f5f5f5;
  771. }
  772. .picker-item:active {
  773. background: #fafafa;
  774. }
  775. .picker-item-active {
  776. background: #FFF7ED;
  777. }
  778. .picker-item-left {
  779. width: 120rpx;
  780. text-align: center;
  781. flex-shrink: 0;
  782. }
  783. .picker-item-value {
  784. font-size: 32rpx;
  785. font-weight: bold;
  786. color: #F97316;
  787. }
  788. .picker-item-right {
  789. flex: 1;
  790. margin: 0 16rpx;
  791. }
  792. .picker-item-name {
  793. font-size: 26rpx;
  794. color: #333;
  795. display: block;
  796. margin-bottom: 4rpx;
  797. }
  798. .picker-item-condition {
  799. font-size: 22rpx;
  800. color: #999;
  801. }
  802. .picker-item-check {
  803. width: 40rpx;
  804. height: 40rpx;
  805. background: #F97316;
  806. border-radius: 50%;
  807. display: flex;
  808. align-items: center;
  809. justify-content: center;
  810. flex-shrink: 0;
  811. }
  812. .check-icon {
  813. color: #fff;
  814. font-size: 24rpx;
  815. font-weight: bold;
  816. }
  817. .picker-empty {
  818. text-align: center;
  819. padding: 60rpx 0;
  820. font-size: 26rpx;
  821. color: #999;
  822. }
  823. .picker-footer {
  824. padding: 20rpx;
  825. border-top: 1rpx solid #eee;
  826. }
  827. .picker-btn-remove {
  828. background: #f5f5f5;
  829. color: #666;
  830. font-size: 26rpx;
  831. border-radius: 12rpx;
  832. border: none;
  833. }
  834. .picker-btn-remove::after {
  835. border: none;
  836. }
  837. .bottom-spacer {
  838. height: 140rpx;
  839. }
  840. .bottom-bar {
  841. position: fixed;
  842. bottom: 0;
  843. left: 0;
  844. right: 0;
  845. height: 100rpx;
  846. background: #fff;
  847. border-top: 1rpx solid #eee;
  848. display: flex;
  849. align-items: center;
  850. justify-content: space-between;
  851. padding: 0 30rpx;
  852. z-index: 100;
  853. }
  854. .bottom-left {
  855. display: flex;
  856. align-items: baseline;
  857. }
  858. .total-label {
  859. font-size: 26rpx;
  860. color: #666;
  861. }
  862. .total-amount {
  863. font-size: 36rpx;
  864. color: #F97316;
  865. font-weight: bold;
  866. }
  867. .submit-btn {
  868. background: linear-gradient(135deg, #F97316, #FB923C);
  869. color: #fff;
  870. font-size: 28rpx;
  871. font-weight: bold;
  872. padding: 0 60rpx;
  873. height: 72rpx;
  874. line-height: 72rpx;
  875. border-radius: 36rpx;
  876. border: none;
  877. }
  878. .submit-btn::after {
  879. border: none;
  880. }
  881. .submit-btn.disabled {
  882. background: #ddd;
  883. color: #999;
  884. }
  885. .points-balance {
  886. font-size: 24rpx;
  887. color: #F97316;
  888. }
  889. .points-input-row {
  890. display: flex;
  891. align-items: center;
  892. margin-top: 16rpx;
  893. padding: 12rpx 0;
  894. border-top: 1rpx solid #f5f5f5;
  895. }
  896. .points-input {
  897. flex: 1;
  898. height: 60rpx;
  899. font-size: 28rpx;
  900. color: #333;
  901. background: #f9f9f9;
  902. border-radius: 8rpx;
  903. padding: 0 16rpx;
  904. }
  905. .points-hint {
  906. font-size: 24rpx;
  907. color: #999;
  908. margin-left: 12rpx;
  909. min-width: 100rpx;
  910. text-align: right;
  911. }
  912. .points-tip {
  913. margin-top: 8rpx;
  914. }
  915. .points-tip-text {
  916. font-size: 22rpx;
  917. color: #bbb;
  918. }
  919. .total-original {
  920. font-size: 24rpx;
  921. color: #bbb;
  922. text-decoration: line-through;
  923. margin-left: 8rpx;
  924. }
  925. /* ===== Purchase Info Fields ===== */
  926. .purchase-field-row {
  927. display: flex;
  928. align-items: center;
  929. padding: 16rpx 0;
  930. border-bottom: 1rpx solid #f5f5f5;
  931. }
  932. .purchase-field-row:last-child {
  933. border-bottom: none;
  934. }
  935. .purchase-field-label {
  936. font-size: 26rpx;
  937. color: #333;
  938. width: 160rpx;
  939. flex-shrink: 0;
  940. }
  941. .required-mark {
  942. color: #f56c6c;
  943. }
  944. .purchase-field-input {
  945. flex: 1;
  946. font-size: 26rpx;
  947. color: #333;
  948. text-align: right;
  949. padding: 8rpx 0;
  950. }
  951. .purchase-field-input[disabled] {
  952. background: transparent;
  953. color: #999;
  954. }
  955. .purchase-field-prefill {
  956. font-size: 22rpx;
  957. color: #67c23a;
  958. margin-left: 8rpx;
  959. }
  960. </style>