checkout.vue 25 KB

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