checkout.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504
  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. <!-- 配送方式选择 -->
  27. <view class="section" v-if="deliveryMethod > 1">
  28. <text class="section-title">{{ deliveryMethodLabel(deliveryMethod) }}</text>
  29. <!-- 自提/线上服务区域 -->
  30. <view v-if="deliveryMethod === 2 || deliveryMethod === 3">
  31. <view class="delivery-sub-label">自取地点</view>
  32. <view class="picker-row" @click="showPickupLocationPicker">
  33. <text class="picker-value" v-if="selectedPickupLocation">{{ selectedPickupLocation.name }}</text>
  34. <text class="picker-placeholder" v-else>请选择自取地点</text>
  35. <text class="picker-arrow">›</text>
  36. </view>
  37. <view v-if="selectedPickupLocation && selectedPickupLocation.timeSlots && selectedPickupLocation.timeSlots.length > 0" class="picker-row" @click="showTimeSlotPicker">
  38. <text class="picker-value" v-if="selectedTimeSlot">{{ selectedTimeSlot.startTime }} - {{ selectedTimeSlot.endTime }}</text>
  39. <text class="picker-placeholder" v-else>请选择取货时间</text>
  40. <text class="picker-arrow">›</text>
  41. </view>
  42. </view>
  43. <view v-if="deliveryMethod === 4">
  44. <view class="picker-row" @click="showServicePersonPicker">
  45. <text class="picker-value" v-if="selectedServicePerson">{{ selectedServicePerson.name }}({{ selectedServicePerson.title || '服务者' }})</text>
  46. <text class="picker-placeholder" v-else>请选择服务者</text>
  47. <text class="picker-arrow">›</text>
  48. </view>
  49. <view v-if="selectedServicePerson" class="picker-row" @click="showOnlineSlotPicker">
  50. <text class="picker-value" v-if="selectedTimeSlot">{{ formatOnlineTime(selectedTimeSlot.startTime) }} - {{ formatOnlineTime(selectedTimeSlot.endTime) }}</text>
  51. <text class="picker-placeholder" v-else>请选择服务时间</text>
  52. <text class="picker-arrow">›</text>
  53. </view>
  54. </view>
  55. <view v-if="deliveryMethod === 5">
  56. <view class="picker-row" @click="showOnlineSlotPicker">
  57. <text class="picker-value" v-if="selectedTimeSlot">{{ formatOnlineTime(selectedTimeSlot.startTime) }} - {{ formatOnlineTime(selectedTimeSlot.endTime) }}</text>
  58. <text class="picker-placeholder" v-else>请选择预约时段</text>
  59. <text class="picker-arrow">›</text>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 配送方式选择 -->
  64. <view class="section" v-if="deliveryMethod > 1">
  65. <text class="section-title">{{ deliveryMethodLabel(deliveryMethod) }}</text>
  66. <!-- 自提/线上服务区域 -->
  67. <view v-if="deliveryMethod === 2 || deliveryMethod === 3">
  68. <view class="delivery-sub-label">自取地点</view>
  69. <view class="picker-row" @click="showPickupLocationPicker">
  70. <text class="picker-value" v-if="selectedPickupLocation">{{ selectedPickupLocation.name }}</text>
  71. <text class="picker-placeholder" v-else>请选择自取地点</text>
  72. <text class="picker-arrow">›</text>
  73. </view>
  74. <view v-if="selectedPickupLocation && selectedPickupLocation.timeSlots && selectedPickupLocation.timeSlots.length > 0" class="picker-row" @click="showTimeSlotPicker">
  75. <text class="picker-value" v-if="selectedTimeSlot">{{ selectedTimeSlot.startTime }} - {{ selectedTimeSlot.endTime }}</text>
  76. <text class="picker-placeholder" v-else>请选择取货时间</text>
  77. <text class="picker-arrow">›</text>
  78. </view>
  79. </view>
  80. <view v-if="deliveryMethod === 4">
  81. <view class="picker-row" @click="showServicePersonPicker">
  82. <text class="picker-value" v-if="selectedServicePerson">{{ selectedServicePerson.name }}({{ selectedServicePerson.title || '服务者' }})</text>
  83. <text class="picker-placeholder" v-else>请选择服务者</text>
  84. <text class="picker-arrow">›</text>
  85. </view>
  86. <view v-if="selectedServicePerson" class="picker-row" @click="showOnlineSlotPicker">
  87. <text class="picker-value" v-if="selectedTimeSlot">{{ formatOnlineTime(selectedTimeSlot.startTime) }} - {{ formatOnlineTime(selectedTimeSlot.endTime) }}</text>
  88. <text class="picker-placeholder" v-else>请选择服务时间</text>
  89. <text class="picker-arrow">›</text>
  90. </view>
  91. </view>
  92. <view v-if="deliveryMethod === 5">
  93. <view class="picker-row" @click="showOnlineSlotPicker">
  94. <text class="picker-value" v-if="selectedTimeSlot">{{ formatOnlineTime(selectedTimeSlot.startTime) }} - {{ formatOnlineTime(selectedTimeSlot.endTime) }}</text>
  95. <text class="picker-placeholder" v-else>请选择预约时段</text>
  96. <text class="picker-arrow">›</text>
  97. </view>
  98. </view>
  99. </view>
  100. <!-- Purchase Info Section (when product requires it) -->
  101. <view class="section" v-if="requiredFields.length > 0">
  102. <text class="section-title">购买信息</text>
  103. <view
  104. v-for="field in requiredFields"
  105. :key="field.fieldKey"
  106. class="purchase-field-row"
  107. >
  108. <text class="purchase-field-label">
  109. {{ field.fieldName }}
  110. <text v-if="field.isRequired" class="required-mark">*</text>
  111. </text>
  112. <input
  113. v-model="purchaseForm[field.fieldKey]"
  114. class="purchase-field-input"
  115. :placeholder="'请输入' + field.fieldName + (field.isRequired ? '' : '(选填)')"
  116. :disabled="!!field.prefillValue"
  117. placeholder-style="color: #ccc; font-size: 26rpx;"
  118. />
  119. <text v-if="field.prefillValue" class="purchase-field-prefill">已填写</text>
  120. </view>
  121. </view>
  122. <!-- Order Items Section -->
  123. <view class="section">
  124. <text class="section-title">商品信息</text>
  125. <view
  126. v-for="item in items"
  127. :key="item.productId"
  128. class="order-item"
  129. >
  130. <image
  131. class="item-image"
  132. :src="getImageUrl(item.coverImage) || '/static/default-product.png'"
  133. mode="aspectFill"
  134. />
  135. <view class="item-info">
  136. <text class="item-name">{{ item.productName }}</text>
  137. <text v-if="item.specDesc" class="item-spec-desc">{{ item.specDesc }}</text>
  138. <text v-if="item.supplierName" class="item-supplier-name">供应商: {{ item.supplierName }}</text>
  139. <text class="item-qty">x{{ item.quantity }}</text>
  140. </view>
  141. <text class="item-price">{{ formatPriceWithSymbol(item.unitPrice) }}</text>
  142. </view>
  143. </view>
  144. <!-- Freight Section -->
  145. <view class="section">
  146. <view class="info-row">
  147. <text class="info-label">运费</text>
  148. <text class="info-value">{{ formatPriceWithSymbol(freight) }}</text>
  149. </view>
  150. </view>
  151. <!-- Member Upgrade Hint -->
  152. <view v-if="!isMember" class="section member-upgrade-section" @click="goUpgrade">
  153. <view class="member-upgrade-row">
  154. <text class="member-upgrade-icon">👑</text>
  155. <text class="member-upgrade-text">开通会员享全场商品专享价</text>
  156. <text class="member-upgrade-arrow">›</text>
  157. </view>
  158. </view>
  159. <!-- Coupon Section -->
  160. <view class="section coupon-section" @click="openCouponPicker">
  161. <view class="info-row">
  162. <text class="info-label">优惠券</text>
  163. <view class="coupon-selected" v-if="selectedCoupon">
  164. <text class="coupon-discount">-{{ formatPriceWithSymbol(selectedCoupon.value) }}</text>
  165. <text class="coupon-name-tag">{{ selectedCoupon.name }}</text>
  166. </view>
  167. <view class="coupon-placeholder" v-else>
  168. <text class="placeholder-text">选择优惠券</text>
  169. </view>
  170. <text class="address-arrow">›</text>
  171. </view>
  172. </view>
  173. <view v-if="!isMember" class="section member-coupon-hint">
  174. <view class="member-coupon-hint-content">
  175. <text class="hint-icon">👑</text>
  176. <text class="hint-text">加入会员可使用优惠券享更多优惠</text>
  177. </view>
  178. </view>
  179. <!-- Points Deduction Section -->
  180. <view class="section" v-if="userTotalPoints > 0">
  181. <view class="info-row">
  182. <text class="info-label">积分抵扣</text>
  183. <text class="points-balance">可用 {{ userTotalPoints }} 积分</text>
  184. </view>
  185. <view class="points-input-row">
  186. <input
  187. class="points-input"
  188. type="number"
  189. :value="pointsUsed"
  190. @input="onPointsInput"
  191. placeholder="输入使用积分"
  192. placeholder-style="color: #ccc; font-size: 26rpx;"
  193. />
  194. <text class="points-hint">≈ ¥{{ pointsYuanEquivalent }}</text>
  195. </view>
  196. <view class="points-tip">
  197. <text class="points-tip-text">1积分 = ¥0.01,最多使用 {{ maxPoints }} 积分</text>
  198. </view>
  199. </view>
  200. <!-- Remark Section -->
  201. <view class="section">
  202. <view class="info-row">
  203. <text class="info-label">备注</text>
  204. <input
  205. class="remark-input"
  206. v-model="remark"
  207. placeholder="选填,给商家留言"
  208. placeholder-style="color: #ccc; font-size: 26rpx;"
  209. />
  210. </view>
  211. </view>
  212. <view class="bottom-spacer"></view>
  213. </scroll-view>
  214. <!-- 优惠券选择器必须与 scroll-view 平级,否则 iOS 上 position: fixed 在 scroll-view 内不生效(优惠券弹窗不显示) -->
  215. <view class="modal-mask" v-if="showCouponPicker" @click="closeCouponPicker">
  216. <view class="coupon-picker" @click.stop>
  217. <view class="picker-header">
  218. <text class="picker-title">选择优惠券</text>
  219. <text class="picker-close" @click="closeCouponPicker">关闭</text>
  220. </view>
  221. <scroll-view scroll-y class="picker-list">
  222. <view
  223. v-for="coupon in availableCoupons"
  224. :key="coupon.id"
  225. class="picker-item"
  226. :class="selectedCoupon && selectedCoupon.id === coupon.id ? 'picker-item-active' : ''"
  227. @click="selectCoupon(coupon)"
  228. >
  229. <view class="picker-item-left">
  230. <text class="picker-item-value">{{ formatPriceWithSymbol(coupon.value) }}</text>
  231. </view>
  232. <view class="picker-item-right">
  233. <text class="picker-item-name">{{ coupon.name }}</text>
  234. <text class="picker-item-condition">{{ getConditionText(coupon.minSpend) }}</text>
  235. </view>
  236. <view class="picker-item-check" v-if="selectedCoupon && selectedCoupon.id === coupon.id">
  237. <text class="check-icon">✓</text>
  238. </view>
  239. </view>
  240. <view class="picker-empty" v-if="availableCoupons.length === 0">
  241. <text>暂无可用优惠券</text>
  242. </view>
  243. </scroll-view>
  244. <view class="picker-footer" v-if="selectedCoupon">
  245. <button class="picker-btn-remove" @click="removeCoupon">不使用优惠券</button>
  246. </view>
  247. </view>
  248. </view>
  249. <!-- 自取地点选择器 -->
  250. <view class="modal-mask" v-if="showPickupLocationModal" @click="showPickupLocationModal=false">
  251. <view class="picker-modal" @click.stop>
  252. <view class="picker-header">
  253. <text class="picker-title">选择自取地点</text>
  254. <text class="picker-close" @click="showPickupLocationModal=false">关闭</text>
  255. </view>
  256. <scroll-view scroll-y class="picker-list">
  257. <view
  258. v-for="(loc, idx) in pickupLocations"
  259. :key="loc.id"
  260. class="picker-item"
  261. :class="selectedPickupLocation && selectedPickupLocation.id === loc.id ? 'picker-item-active' : ''"
  262. @click="selectPickupLocation(loc)"
  263. >
  264. <view class="picker-item-left">
  265. <text class="picker-item-name">{{ loc.name }}</text>
  266. <text class="picker-item-addr">{{ loc.address }}</text>
  267. </view>
  268. <view class="picker-item-check" v-if="selectedPickupLocation && selectedPickupLocation.id === loc.id">
  269. <text class="check-icon">✓</text>
  270. </view>
  271. </view>
  272. </scroll-view>
  273. </view>
  274. </view>
  275. <!-- 时间段选择器 -->
  276. <view class="modal-mask" v-if="showTimeSlotModal" @click="showTimeSlotModal=false">
  277. <view class="picker-modal" @click.stop>
  278. <view class="picker-header">
  279. <text class="picker-title">选择取货时间</text>
  280. <text class="picker-close" @click="showTimeSlotModal=false">关闭</text>
  281. </view>
  282. <scroll-view scroll-y class="picker-list">
  283. <view
  284. v-for="(slot, idx) in (selectedPickupLocation && selectedPickupLocation.timeSlots) || []"
  285. :key="slot.id"
  286. class="picker-item"
  287. :class="selectedTimeSlot && selectedTimeSlot.id === slot.id ? 'picker-item-active' : ''"
  288. @click="selectTimeSlot(slot)"
  289. >
  290. <view class="picker-item-left">
  291. <text class="picker-item-name">{{ slot.startTime }} - {{ slot.endTime }}</text>
  292. </view>
  293. <view class="picker-item-check" v-if="selectedTimeSlot && selectedTimeSlot.id === slot.id">
  294. <text class="check-icon">✓</text>
  295. </view>
  296. </view>
  297. </scroll-view>
  298. </view>
  299. </view>
  300. <!-- 服务者选择器 -->
  301. <view class="modal-mask" v-if="showServicePersonModal" @click="showServicePersonModal=false">
  302. <view class="picker-modal" @click.stop>
  303. <view class="picker-header">
  304. <text class="picker-title">选择服务者</text>
  305. <text class="picker-close" @click="showServicePersonModal=false">关闭</text>
  306. </view>
  307. <scroll-view scroll-y class="picker-list">
  308. <view
  309. v-for="(person, idx) in servicePersons"
  310. :key="person.id"
  311. class="picker-item"
  312. :class="selectedServicePerson && selectedServicePerson.id === person.id ? 'picker-item-active' : ''"
  313. @click="selectServicePerson(person)"
  314. >
  315. <view class="picker-item-left">
  316. <text class="picker-item-name">{{ person.name }}</text>
  317. <text class="picker-item-desc">{{ person.title || '' }}</text>
  318. <text class="picker-item-price">{{ formatPriceWithSymbol(person.price) }}</text>
  319. </view>
  320. <view class="picker-item-check" v-if="selectedServicePerson && selectedServicePerson.id === person.id">
  321. <text class="check-icon">✓</text>
  322. </view>
  323. </view>
  324. </scroll-view>
  325. </view>
  326. </view>
  327. <!-- 线上时间段选择器 -->
  328. <view class="modal-mask" v-if="showOnlineSlotModal" @click="showOnlineSlotModal=false">
  329. <view class="picker-modal" @click.stop>
  330. <view class="picker-header">
  331. <text class="picker-title">选择服务时间</text>
  332. <text class="picker-close" @click="showOnlineSlotModal=false">关闭</text>
  333. </view>
  334. <scroll-view scroll-y class="picker-list">
  335. <view
  336. v-for="slot in onlineTimeSlots"
  337. :key="slot.id"
  338. class="picker-item"
  339. :class="selectedTimeSlot && selectedTimeSlot.id === slot.id ? 'picker-item-active' : ''"
  340. @click="selectOnlineSlot(slot)"
  341. >
  342. <view class="picker-item-left">
  343. <text class="picker-item-name">{{ formatOnlineTime(slot.startTime) }} - {{ formatOnlineTime(slot.endTime) }}</text>
  344. </view>
  345. <view class="picker-item-check" v-if="selectedTimeSlot && selectedTimeSlot.id === slot.id">
  346. <text class="check-icon">✓</text>
  347. </view>
  348. </view>
  349. </scroll-view>
  350. </view>
  351. </view>
  352. <view class="bottom-bar">
  353. <view class="bottom-left">
  354. <text class="total-label">合计: </text>
  355. <text class="total-amount">{{ formatPriceWithSymbol(finalAmount) }}</text>
  356. <text v-if="selectedCoupon" class="total-original">{{ formatPriceWithSymbol(actualAmount + freight) }}</text>
  357. </view>
  358. <button
  359. :class="['submit-btn', submitting ? 'disabled' : '']"
  360. :disabled="submitting"
  361. @click="onSubmit"
  362. >提交订单</button>
  363. </view>
  364. </view>
  365. </template>
  366. <script>
  367. import config from '@/config.js'
  368. import { getCouponList, addressList, getProductRequiredFields, getMyMembership, productDetail } from '../../../utils/api.js'
  369. import { parseDate } from '@/utils/format.js'
  370. export default {
  371. data() {
  372. return {
  373. items: [],
  374. selectedAddress: null,
  375. requiredFields: [], // 需要的购买信息字段
  376. purchaseForm: {}, // 用户填写的购买信息
  377. addressList: [],
  378. freight: 0,
  379. remark: '',
  380. loading: false,
  381. submitting: false,
  382. actualAmount: 0,
  383. coupons: [],
  384. selectedCoupon: null,
  385. showCouponPicker: false,
  386. pointsUsed: 0,
  387. userTotalPoints: 0,
  388. pointsLoading: false,
  389. isMember: false,
  390. // 配送配置
  391. deliveryMethod: 1,
  392. productDeliveryConfig: null,
  393. pickupLocations: [],
  394. selectedPickupLocation: null,
  395. selectedTimeSlot: null,
  396. servicePersons: [],
  397. selectedServicePerson: null,
  398. onlineSlots: [],
  399. // 弹窗控制
  400. showPickupLocationModal: false,
  401. showTimeSlotModal: false,
  402. showServicePersonModal: false,
  403. showOnlineSlotModal: false
  404. }
  405. },
  406. computed: {
  407. finalAmount() {
  408. var total = (this.actualAmount || 0) + (this.freight || 0)
  409. if (this.selectedCoupon) {
  410. total = total - this.selectedCoupon.value
  411. }
  412. total = total - (this.pointsUsed || 0)
  413. if (total < 0) total = 0
  414. return total
  415. },
  416. maxPoints() {
  417. var total = (this.actualAmount || 0) + (this.freight || 0)
  418. if (this.selectedCoupon) {
  419. total = total - this.selectedCoupon.value
  420. }
  421. if (total < 0) total = 0
  422. if (this.userTotalPoints < total) {
  423. return this.userTotalPoints
  424. }
  425. return total
  426. },
  427. pointsYuanEquivalent() {
  428. return (this.pointsUsed / 100).toFixed(2)
  429. },
  430. availableCoupons() {
  431. var self = this
  432. return this.coupons.filter(function(c) {
  433. if (c.status && c.status !== 'AVAILABLE') return false
  434. if (c.applicableTo && c.applicableTo !== 'ALL') return false
  435. if (c.minSpend && c.minSpend > self.actualAmount) return false
  436. return true
  437. })
  438. },
  439. onlineTimeSlots() {
  440. if (this.deliveryMethod === 4 && this.selectedServicePerson) {
  441. return this.selectedServicePerson.slots || []
  442. }
  443. if (this.deliveryMethod === 5) {
  444. return this.onlineSlots
  445. }
  446. return []
  447. }
  448. },
  449. onLoad(options) {
  450. var that = this
  451. var stored = uni.getStorageSync('checkoutItems')
  452. if (stored && stored.length > 0) {
  453. this.items = stored
  454. this.calcAmount()
  455. } else if (options.productId) {
  456. // Load product directly from detail page
  457. var productData = {
  458. productId: parseInt(options.productId),
  459. productName: options.productName || '商品',
  460. coverImage: options.coverImage || '',
  461. unitPrice: parseInt(options.price) || 0,
  462. quantity: parseInt(options.quantity) || 1
  463. }
  464. if (options.skuId) {
  465. productData.skuId = parseInt(options.skuId)
  466. }
  467. this.items = [productData]
  468. this.calcAmount()
  469. }
  470. this.checkMemberStatus()
  471. this.loadDefaultAddress()
  472. this.loadRequiredFields()
  473. this.loadCoupons()
  474. this.loadUserPoints()
  475. this.loadDeliveryConfig()
  476. },
  477. onShow() {
  478. // 从地址选择/编辑页返回后重新加载地址列表
  479. this.loadDefaultAddress()
  480. },
  481. methods: {
  482. calcAmount() {
  483. var total = 0
  484. for (var i = 0; i < this.items.length; i++) {
  485. total = total + (this.items[i].unitPrice * this.items[i].quantity)
  486. }
  487. this.actualAmount = total
  488. },
  489. async loadCoupons() {
  490. try {
  491. var res = await getCouponList()
  492. this.coupons = res.data || []
  493. } catch (e) {
  494. this.coupons = []
  495. }
  496. },
  497. openCouponPicker() {
  498. if (this.availableCoupons.length === 0 && !this.selectedCoupon) {
  499. uni.showToast({ title: '暂无可用优惠券', icon: 'none' })
  500. return
  501. }
  502. this.showCouponPicker = true
  503. },
  504. closeCouponPicker() {
  505. this.showCouponPicker = false
  506. },
  507. selectCoupon(coupon) {
  508. this.selectedCoupon = coupon
  509. this.showCouponPicker = false
  510. },
  511. removeCoupon() {
  512. this.selectedCoupon = null
  513. this.showCouponPicker = false
  514. },
  515. onPointsInput(e) {
  516. var val = parseInt(e.detail.value) || 0
  517. if (val < 0) val = 0
  518. var maxP = this.maxPoints
  519. if (val > maxP) {
  520. val = maxP
  521. uni.showToast({ title: '最多使用 ' + maxP + ' 积分', icon: 'none' })
  522. }
  523. this.pointsUsed = val
  524. },
  525. getConditionText(minSpend) {
  526. if (!minSpend || minSpend <= 0) return '无门槛'
  527. return '满' + (minSpend / 100).toFixed(2) + '元可用'
  528. },
  529. async loadDefaultAddress() {
  530. this.loading = true
  531. try {
  532. var res = await addressList()
  533. if (res.code === 200) {
  534. var list = res.data || []
  535. this.addressList = list
  536. // 如果当前已有选中地址,保持选中状态
  537. if (this.selectedAddress) {
  538. var stillExists = false
  539. for (var k = 0; k < list.length; k++) {
  540. if (list[k].id === this.selectedAddress.id) {
  541. stillExists = true
  542. break
  543. }
  544. }
  545. if (!stillExists) {
  546. this.selectedAddress = null
  547. }
  548. }
  549. if (!this.selectedAddress) {
  550. for (var i = 0; i < list.length; i++) {
  551. if (list[i].isDefault === 1) {
  552. this.selectedAddress = list[i]
  553. break
  554. }
  555. }
  556. if (!this.selectedAddress && list.length > 0) {
  557. this.selectedAddress = list[0]
  558. }
  559. }
  560. }
  561. } catch (e) {
  562. console.error(e)
  563. } finally {
  564. this.loading = false
  565. }
  566. },
  567. async loadRequiredFields() {
  568. if (this.items.length === 0) return
  569. var productId = this.items[0].productId
  570. try {
  571. var res = await getProductRequiredFields(productId)
  572. if (res.code === 200) {
  573. this.requiredFields = res.data || []
  574. this.autoFillPurchaseForm()
  575. }
  576. } catch (e) {
  577. console.error(e)
  578. }
  579. },
  580. autoFillPurchaseForm() {
  581. if (!this.selectedAddress || this.requiredFields.length === 0) return
  582. var form = {}
  583. for (var i = 0; i < this.requiredFields.length; i++) {
  584. var field = this.requiredFields[i]
  585. if (field.prefillValue) {
  586. form[field.fieldKey] = field.prefillValue
  587. } else {
  588. form[field.fieldKey] = ''
  589. }
  590. }
  591. this.purchaseForm = form
  592. },
  593. openAddressPicker() {
  594. if (this.addressList.length === 0) {
  595. uni.showToast({ title: '暂无地址,请先添加', icon: 'none' })
  596. return
  597. }
  598. uni.navigateTo({ url: '/pages/shop/address/address?selectMode=1' })
  599. },
  600. checkMemberStatus() {
  601. var that = this
  602. getMyMembership().then(function(res) {
  603. if (res.data && res.data.memberLevel) {
  604. that.isMember = res.data.memberLevel !== 'FREE'
  605. }
  606. }).catch(function() {})
  607. },
  608. goUpgrade() {
  609. uni.navigateTo({ url: '/pages/membership/upgrade' })
  610. },
  611. goAddAddress() {
  612. uni.navigateTo({ url: '/pages/shop/address-edit/address-edit' })
  613. },
  614. // ========== 配送方式相关 ==========
  615. loadDeliveryConfig() {
  616. if (this.items.length === 0) return
  617. var productId = this.items[0].productId
  618. if (!productId) return
  619. var stored = uni.getStorageSync('checkoutItems')
  620. var storageData = stored && stored.length > 0 ? stored[0] : {}
  621. var deliveryMethod = storageData.deliveryMethod
  622. if (!deliveryMethod || deliveryMethod <= 1) return
  623. this.deliveryMethod = deliveryMethod
  624. this.productDeliveryConfig = storageData.deliveryConfig || null
  625. // 如果来自产品详情,可能已有选中值
  626. if (storageData.pickupLocationId) {
  627. this.selectedPickupLocation = { id: storageData.pickupLocationId }
  628. }
  629. if (storageData.timeSlotId) {
  630. this.selectedTimeSlot = { id: storageData.timeSlotId }
  631. }
  632. if (storageData.servicePersonId) {
  633. this.selectedServicePerson = { id: storageData.servicePersonId }
  634. }
  635. // 加载完整配置
  636. var that = this
  637. productDetail({ id: productId }).then(function(res) {
  638. if (res.code === 200 && res.data && res.data.deliveryConfig) {
  639. that.productDeliveryConfig = res.data.deliveryConfig
  640. that.deliveryMethod = res.data.deliveryMethod || that.deliveryMethod
  641. that.pickupLocations = res.data.deliveryConfig.pickupLocations || []
  642. that.servicePersons = res.data.deliveryConfig.servicePersons || []
  643. that.onlineSlots = res.data.deliveryConfig.onlineSlots || []
  644. }
  645. }).catch(function() {})
  646. },
  647. onDeliveryMethodChange: function(e) {
  648. this.deliveryMethod = parseInt(e.detail.value)
  649. this.selectedPickupLocation = null
  650. this.selectedTimeSlot = null
  651. this.selectedServicePerson = null
  652. },
  653. onPickupLocationChange: function(e) {
  654. var idx = parseInt(e.detail.value)
  655. if (this.pickupLocations[idx]) {
  656. this.selectedPickupLocation = this.pickupLocations[idx]
  657. this.selectedTimeSlot = null
  658. }
  659. },
  660. onTimeSlotChange: function(e) {
  661. var idx = parseInt(e.detail.value)
  662. if (this.selectedPickupLocation && this.selectedPickupLocation.timeSlots && this.selectedPickupLocation.timeSlots[idx]) {
  663. this.selectedTimeSlot = this.selectedPickupLocation.timeSlots[idx]
  664. }
  665. },
  666. onServicePersonChange: function(e) {
  667. var idx = parseInt(e.detail.value)
  668. if (this.servicePersons[idx]) {
  669. this.selectedServicePerson = this.servicePersons[idx]
  670. this.selectedTimeSlot = null
  671. }
  672. },
  673. onOnlineSlotChange: function(e) {
  674. var idx = parseInt(e.detail.value)
  675. if (this.onlineSlots[idx]) {
  676. this.selectedTimeSlot = this.onlineSlots[idx]
  677. }
  678. },
  679. deliveryMethodLabel: function(method) {
  680. var map = { 1: '快递配送', 2: '到店自提', 3: '快递/自提', 4: '线上服务', 5: '线上预约' }
  681. return map[method] || '快递配送'
  682. },
  683. deliveryMethodHint: function(method) {
  684. var map = { 1: '', 2: '请选择自取地点和时间段', 3: '请选择配送方式', 4: '请选择服务者和时间', 5: '请选择预约时段' }
  685. return map[method] || ''
  686. },
  687. selectPickupLocation(loc) {
  688. this.selectedPickupLocation = loc
  689. this.selectedTimeSlot = null
  690. this.showPickupLocationModal = false
  691. },
  692. selectTimeSlot(slot) {
  693. this.selectedTimeSlot = slot
  694. this.showTimeSlotModal = false
  695. },
  696. selectServicePerson(person) {
  697. this.selectedServicePerson = person
  698. this.selectedTimeSlot = null
  699. this.showServicePersonModal = false
  700. },
  701. selectOnlineSlot(slot) {
  702. this.selectedTimeSlot = slot
  703. this.showOnlineSlotModal = false
  704. },
  705. loadUserPoints() {
  706. var that = this
  707. uni.request({
  708. url: config.api('/api/user/info'),
  709. method: 'POST',
  710. data: {},
  711. header: {
  712. 'Content-Type': 'application/json',
  713. 'Authorization': 'Bearer ' + uni.getStorageSync('token')
  714. },
  715. success: function(res) {
  716. if (res.data && res.data.code === 200) {
  717. that.userTotalPoints = res.data.data.totalPoints || 0
  718. }
  719. }
  720. })
  721. },
  722. onSubmit() {
  723. if (!this.selectedAddress) {
  724. uni.showToast({ title: '请选择收货地址', icon: 'none' })
  725. return
  726. }
  727. if (this.items.length === 0) {
  728. uni.showToast({ title: '请选择商品', icon: 'none' })
  729. return
  730. }
  731. this.submitting = true
  732. var orderItems = []
  733. for (var i = 0; i < this.items.length; i++) {
  734. var itemData = {
  735. productId: this.items[i].productId,
  736. quantity: this.items[i].quantity
  737. }
  738. if (this.items[i].skuId) {
  739. itemData.skuId = this.items[i].skuId
  740. }
  741. orderItems.push(itemData)
  742. }
  743. var that = this
  744. uni.request({
  745. url: config.api('/api/product/order/create'),
  746. method: 'POST',
  747. data: {
  748. items: orderItems,
  749. remark: this.remark,
  750. addressId: that.selectedAddress.id,
  751. purchaseInfo: that.purchaseForm,
  752. pointsUsed: that.pointsUsed,
  753. deliveryMethod: that.deliveryMethod,
  754. pickupLocationId: that.selectedPickupLocation ? that.selectedPickupLocation.id : null,
  755. timeSlotId: that.selectedTimeSlot ? that.selectedTimeSlot.id : null,
  756. servicePersonId: that.selectedServicePerson ? that.selectedServicePerson.id : null
  757. },
  758. header: {
  759. 'Content-Type': 'application/json',
  760. 'Authorization': 'Bearer ' + uni.getStorageSync('token')
  761. },
  762. success: function(res) {
  763. that.submitting = false
  764. if (res.data && res.data.code === 200) {
  765. var order = res.data.data
  766. uni.showToast({ title: '下单成功', icon: 'success' })
  767. uni.removeStorageSync('checkoutItems')
  768. var moneyAmount = order.moneyAmount != null ? order.moneyAmount : order.totalAmount
  769. var pointsUsed = order.pointsUsed || 0
  770. setTimeout(function() {
  771. uni.navigateTo({
  772. url: '/pages/shop/payment/payment?orderNo=' + order.orderNo + '&amount=' + moneyAmount + '&pointsUsed=' + pointsUsed
  773. })
  774. }, 1000)
  775. } else {
  776. uni.showToast({ title: res.data.message || '下单失败', icon: 'none' })
  777. }
  778. },
  779. fail: function() {
  780. that.submitting = false
  781. uni.showToast({ title: '网络请求失败', icon: 'none' })
  782. }
  783. })
  784. },
  785. formatPrice(price) {
  786. if (price === null || price === undefined) return '0.00'
  787. return (Number(price) / 100).toFixed(2)
  788. },
  789. formatPhone(phone) {
  790. if (!phone) return ''
  791. if (phone.length === 11) {
  792. return phone.substr(0, 3) + '****' + phone.substr(7)
  793. }
  794. return phone
  795. },
  796. selectServicePerson(person) {
  797. this.selectedServicePerson = person
  798. this.selectedTimeSlot = null
  799. this.showServicePersonModal = false
  800. },
  801. selectOnlineSlot(slot) {
  802. this.selectedTimeSlot = slot
  803. this.showOnlineSlotModal = false
  804. },
  805. formatOnlineTime: function(timeStr) {
  806. if (!timeStr) return ''
  807. try {
  808. var d = parseDate(timeStr)
  809. if (!d) return timeStr
  810. return (d.getMonth() + 1) + '月' + d.getDate() + '日 ' + String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0')
  811. } catch (e) {
  812. return timeStr
  813. }
  814. },
  815. showPickupLocationPicker: function() {
  816. this.showPickupLocationModal = true
  817. },
  818. showTimeSlotPicker: function() {
  819. if (!this.selectedPickupLocation) return
  820. this.showTimeSlotModal = true
  821. },
  822. showServicePersonPicker: function() {
  823. this.showServicePersonModal = true
  824. },
  825. showOnlineSlotPicker: function() {
  826. this.showOnlineSlotModal = true
  827. },
  828. selectPickupLocation: function(loc) {
  829. this.selectedPickupLocation = loc
  830. this.selectedTimeSlot = null
  831. this.showPickupLocationModal = false
  832. },
  833. selectTimeSlot: function(slot) {
  834. this.selectedTimeSlot = slot
  835. this.showTimeSlotModal = false
  836. },
  837. selectServicePerson: function(person) {
  838. this.selectedServicePerson = person
  839. this.showServicePersonModal = false
  840. },
  841. getImageUrl: function(path) {
  842. return config.API_BASE_URL + path
  843. }
  844. }
  845. }
  846. </script>
  847. <style scoped>
  848. .container {
  849. min-height: 100vh;
  850. background: #f5f5f5;
  851. }
  852. .loading-wrap {
  853. display: flex;
  854. justify-content: center;
  855. padding-top: 200rpx;
  856. }
  857. .loading-text {
  858. font-size: 28rpx;
  859. color: #999;
  860. }
  861. .content {
  862. height: calc(100vh - 120rpx);
  863. }
  864. .section {
  865. background: #fff;
  866. margin: 20rpx;
  867. border-radius: 16rpx;
  868. padding: 24rpx;
  869. }
  870. .section-title {
  871. font-size: 28rpx;
  872. font-weight: bold;
  873. color: #333;
  874. margin-bottom: 20rpx;
  875. display: block;
  876. }
  877. .address-section {
  878. position: relative;
  879. }
  880. .address-content {
  881. position: relative;
  882. }
  883. .address-top {
  884. display: flex;
  885. align-items: center;
  886. margin-bottom: 10rpx;
  887. }
  888. .receiver-name {
  889. font-size: 30rpx;
  890. font-weight: bold;
  891. color: #333;
  892. margin-right: 20rpx;
  893. }
  894. .receiver-phone {
  895. font-size: 26rpx;
  896. color: #666;
  897. }
  898. .default-badge {
  899. font-size: 20rpx;
  900. color: #F97316;
  901. background: #fff7e6;
  902. padding: 2rpx 12rpx;
  903. border-radius: 20rpx;
  904. margin-left: 12rpx;
  905. }
  906. .address-detail {
  907. font-size: 26rpx;
  908. color: #999;
  909. line-height: 1.5;
  910. }
  911. .address-arrow {
  912. position: absolute;
  913. right: 0;
  914. top: 50%;
  915. font-size: 40rpx;
  916. color: #ccc;
  917. transform: translateY(-50%);
  918. }
  919. .address-empty {
  920. display: flex;
  921. align-items: center;
  922. justify-content: center;
  923. padding: 30rpx 0;
  924. position: relative;
  925. }
  926. .address-empty-icon {
  927. font-size: 40rpx;
  928. margin-right: 12rpx;
  929. }
  930. .address-empty-text {
  931. font-size: 28rpx;
  932. color: #999;
  933. }
  934. .order-item {
  935. display: flex;
  936. align-items: center;
  937. padding: 16rpx 0;
  938. border-bottom: 1rpx solid #f5f5f5;
  939. }
  940. .order-item:last-child {
  941. border-bottom: none;
  942. }
  943. .item-image {
  944. width: 80rpx;
  945. height: 80rpx;
  946. border-radius: 8rpx;
  947. background: #f0f0f0;
  948. margin-right: 16rpx;
  949. }
  950. .item-info {
  951. flex: 1;
  952. display: flex;
  953. flex-direction: column;
  954. min-width: 0;
  955. }
  956. .item-name {
  957. font-size: 26rpx;
  958. color: #333;
  959. overflow: hidden;
  960. text-overflow: ellipsis;
  961. white-space: nowrap;
  962. margin-bottom: 6rpx;
  963. }
  964. .item-spec-desc {
  965. font-size: 22rpx;
  966. color: #999;
  967. display: block;
  968. margin-top: 2rpx;
  969. }
  970. .item-supplier-name {
  971. font-size: 20rpx;
  972. color: #0EA5E9;
  973. display: block;
  974. margin-top: 2rpx;
  975. }
  976. .item-qty {
  977. font-size: 22rpx;
  978. color: #999;
  979. }
  980. .item-price {
  981. font-size: 26rpx;
  982. color: #F97316;
  983. font-weight: bold;
  984. margin-left: 16rpx;
  985. }
  986. .info-row {
  987. display: flex;
  988. justify-content: space-between;
  989. align-items: center;
  990. padding: 8rpx 0;
  991. }
  992. .info-label {
  993. font-size: 26rpx;
  994. color: #999;
  995. }
  996. .info-value {
  997. font-size: 26rpx;
  998. color: #333;
  999. }
  1000. .remark-input {
  1001. flex: 1;
  1002. text-align: right;
  1003. font-size: 26rpx;
  1004. color: #333;
  1005. }
  1006. /* ===== Coupon Section ===== */
  1007. .coupon-section {
  1008. position: relative;
  1009. }
  1010. .coupon-section:active {
  1011. background: #fafafa;
  1012. }
  1013. .coupon-selected {
  1014. display: flex;
  1015. align-items: center;
  1016. flex: 1;
  1017. justify-content: flex-end;
  1018. margin-right: 30rpx;
  1019. }
  1020. .coupon-discount {
  1021. font-size: 26rpx;
  1022. color: #F97316;
  1023. font-weight: 600;
  1024. margin-right: 12rpx;
  1025. }
  1026. .coupon-name-tag {
  1027. font-size: 22rpx;
  1028. color: #fff;
  1029. background: #F97316;
  1030. padding: 2rpx 12rpx;
  1031. border-radius: 6rpx;
  1032. max-width: 200rpx;
  1033. overflow: hidden;
  1034. text-overflow: ellipsis;
  1035. white-space: nowrap;
  1036. }
  1037. .coupon-placeholder {
  1038. flex: 1;
  1039. text-align: right;
  1040. margin-right: 30rpx;
  1041. }
  1042. .placeholder-text {
  1043. font-size: 26rpx;
  1044. color: #ccc;
  1045. }
  1046. .total-original {
  1047. font-size: 22rpx;
  1048. color: #bbb;
  1049. text-decoration: line-through;
  1050. margin-left: 8rpx;
  1051. }
  1052. /* ===== Member Upgrade Hint ===== */
  1053. .member-upgrade-section {
  1054. position: relative;
  1055. }
  1056. .member-upgrade-row {
  1057. display: flex;
  1058. align-items: center;
  1059. }
  1060. .member-upgrade-icon {
  1061. font-size: 32rpx;
  1062. margin-right: 12rpx;
  1063. }
  1064. .member-upgrade-text {
  1065. flex: 1;
  1066. font-size: 26rpx;
  1067. color: #F97316;
  1068. font-weight: 500;
  1069. }
  1070. .member-upgrade-arrow {
  1071. font-size: 32rpx;
  1072. color: #F97316;
  1073. }
  1074. /* ===== Member Coupon Hint ===== */
  1075. .member-coupon-hint {
  1076. margin-top: -10rpx;
  1077. margin-bottom: 20rpx;
  1078. }
  1079. .member-coupon-hint-content {
  1080. display: flex;
  1081. align-items: center;
  1082. padding: 20rpx 24rpx;
  1083. background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
  1084. border-radius: 16rpx;
  1085. border: 1rpx solid #FED7AA;
  1086. }
  1087. .hint-icon {
  1088. font-size: 32rpx;
  1089. margin-right: 12rpx;
  1090. }
  1091. .hint-text {
  1092. font-size: 24rpx;
  1093. color: #C2410C;
  1094. font-weight: 500;
  1095. }
  1096. /* ===== Coupon Picker Modal ===== */
  1097. .modal-mask {
  1098. position: fixed;
  1099. top: 0;
  1100. left: 0;
  1101. right: 0;
  1102. bottom: 0;
  1103. background: rgba(0,0,0,0.5);
  1104. z-index: 999;
  1105. display: flex;
  1106. align-items: flex-end;
  1107. }
  1108. .coupon-picker {
  1109. background: #fff;
  1110. border-radius: 24rpx 24rpx 0 0;
  1111. width: 100%;
  1112. max-height: 70vh;
  1113. display: flex;
  1114. flex-direction: column;
  1115. }
  1116. .picker-header {
  1117. display: flex;
  1118. justify-content: space-between;
  1119. align-items: center;
  1120. padding: 30rpx;
  1121. border-bottom: 1rpx solid #eee;
  1122. }
  1123. .picker-title {
  1124. font-size: 30rpx;
  1125. font-weight: 600;
  1126. color: #333;
  1127. }
  1128. .picker-close {
  1129. font-size: 26rpx;
  1130. color: #999;
  1131. }
  1132. .picker-list {
  1133. max-height: 50vh;
  1134. padding: 0 20rpx;
  1135. }
  1136. .picker-item {
  1137. display: flex;
  1138. align-items: center;
  1139. padding: 24rpx 16rpx;
  1140. border-bottom: 1rpx solid #f5f5f5;
  1141. }
  1142. .picker-item:active {
  1143. background: #fafafa;
  1144. }
  1145. .picker-item-active {
  1146. background: #FFF7ED;
  1147. }
  1148. .picker-item-left {
  1149. width: 120rpx;
  1150. text-align: center;
  1151. flex-shrink: 0;
  1152. }
  1153. .picker-item-value {
  1154. font-size: 32rpx;
  1155. font-weight: bold;
  1156. color: #F97316;
  1157. }
  1158. .picker-item-right {
  1159. flex: 1;
  1160. margin: 0 16rpx;
  1161. }
  1162. .picker-item-name {
  1163. font-size: 26rpx;
  1164. color: #333;
  1165. display: block;
  1166. margin-bottom: 4rpx;
  1167. }
  1168. .picker-item-condition {
  1169. font-size: 22rpx;
  1170. color: #999;
  1171. }
  1172. .picker-item-check {
  1173. width: 40rpx;
  1174. height: 40rpx;
  1175. background: #F97316;
  1176. border-radius: 50%;
  1177. display: flex;
  1178. align-items: center;
  1179. justify-content: center;
  1180. flex-shrink: 0;
  1181. }
  1182. .check-icon {
  1183. color: #fff;
  1184. font-size: 24rpx;
  1185. font-weight: bold;
  1186. }
  1187. .picker-empty {
  1188. text-align: center;
  1189. padding: 60rpx 0;
  1190. font-size: 26rpx;
  1191. color: #999;
  1192. }
  1193. .picker-footer {
  1194. padding: 20rpx;
  1195. border-top: 1rpx solid #eee;
  1196. }
  1197. .picker-btn-remove {
  1198. background: #f5f5f5;
  1199. color: #666;
  1200. font-size: 26rpx;
  1201. border-radius: 12rpx;
  1202. border: none;
  1203. }
  1204. .picker-btn-remove::after {
  1205. border: none;
  1206. }
  1207. .bottom-spacer {
  1208. height: 140rpx;
  1209. }
  1210. .bottom-bar {
  1211. position: fixed;
  1212. bottom: 0;
  1213. left: 0;
  1214. right: 0;
  1215. height: 100rpx;
  1216. background: #fff;
  1217. border-top: 1rpx solid #eee;
  1218. display: flex;
  1219. align-items: center;
  1220. justify-content: space-between;
  1221. padding: 0 30rpx;
  1222. z-index: 100;
  1223. }
  1224. .bottom-left {
  1225. display: flex;
  1226. align-items: baseline;
  1227. }
  1228. .total-label {
  1229. font-size: 26rpx;
  1230. color: #666;
  1231. }
  1232. .total-amount {
  1233. font-size: 36rpx;
  1234. color: #F97316;
  1235. font-weight: bold;
  1236. }
  1237. .submit-btn {
  1238. background: linear-gradient(135deg, #F97316, #FB923C);
  1239. color: #fff;
  1240. font-size: 28rpx;
  1241. font-weight: bold;
  1242. padding: 0 60rpx;
  1243. height: 72rpx;
  1244. line-height: 72rpx;
  1245. border-radius: 36rpx;
  1246. border: none;
  1247. }
  1248. .submit-btn::after {
  1249. border: none;
  1250. }
  1251. .submit-btn.disabled {
  1252. background: #ddd;
  1253. color: #999;
  1254. }
  1255. .points-balance {
  1256. font-size: 24rpx;
  1257. color: #F97316;
  1258. }
  1259. .points-input-row {
  1260. display: flex;
  1261. align-items: center;
  1262. margin-top: 16rpx;
  1263. padding: 12rpx 0;
  1264. border-top: 1rpx solid #f5f5f5;
  1265. }
  1266. .points-input {
  1267. flex: 1;
  1268. height: 60rpx;
  1269. font-size: 28rpx;
  1270. color: #333;
  1271. background: #f9f9f9;
  1272. border-radius: 8rpx;
  1273. padding: 0 16rpx;
  1274. }
  1275. .points-hint {
  1276. font-size: 24rpx;
  1277. color: #999;
  1278. margin-left: 12rpx;
  1279. min-width: 100rpx;
  1280. text-align: right;
  1281. }
  1282. .points-tip {
  1283. margin-top: 8rpx;
  1284. }
  1285. .points-tip-text {
  1286. font-size: 22rpx;
  1287. color: #bbb;
  1288. }
  1289. .total-original {
  1290. font-size: 24rpx;
  1291. color: #bbb;
  1292. text-decoration: line-through;
  1293. margin-left: 8rpx;
  1294. }
  1295. /* ===== Purchase Info Fields ===== */
  1296. .purchase-field-row {
  1297. display: flex;
  1298. align-items: center;
  1299. padding: 16rpx 0;
  1300. border-bottom: 1rpx solid #f5f5f5;
  1301. }
  1302. .purchase-field-row:last-child {
  1303. border-bottom: none;
  1304. }
  1305. .purchase-field-label {
  1306. font-size: 26rpx;
  1307. color: #333;
  1308. width: 160rpx;
  1309. flex-shrink: 0;
  1310. }
  1311. .required-mark {
  1312. color: #f56c6c;
  1313. }
  1314. .purchase-field-input {
  1315. flex: 1;
  1316. font-size: 26rpx;
  1317. color: #333;
  1318. text-align: right;
  1319. padding: 8rpx 0;
  1320. }
  1321. .purchase-field-input[disabled] {
  1322. background: transparent;
  1323. color: #999;
  1324. }
  1325. .purchase-field-prefill {
  1326. font-size: 22rpx;
  1327. color: #67c23a;
  1328. margin-left: 8rpx;
  1329. }
  1330. /* 配送方式选择 */
  1331. .delivery-sub-label {
  1332. font-size: 24rpx;
  1333. color: #999;
  1334. margin-bottom: 12rpx;
  1335. margin-top: 16rpx;
  1336. }
  1337. .picker-row {
  1338. display: flex;
  1339. align-items: center;
  1340. justify-content: space-between;
  1341. padding: 20rpx 0;
  1342. border-bottom: 1rpx solid #f5f5f5;
  1343. }
  1344. .picker-row:last-child {
  1345. border-bottom: none;
  1346. }
  1347. .picker-value {
  1348. font-size: 28rpx;
  1349. color: #333;
  1350. flex: 1;
  1351. }
  1352. .picker-placeholder {
  1353. font-size: 28rpx;
  1354. color: #999;
  1355. flex: 1;
  1356. }
  1357. .picker-arrow {
  1358. font-size: 32rpx;
  1359. color: #ccc;
  1360. margin-left: 10rpx;
  1361. }
  1362. .modal-mask {
  1363. position: fixed;
  1364. top: 0;
  1365. left: 0;
  1366. right: 0;
  1367. bottom: 0;
  1368. background: rgba(0,0,0,0.5);
  1369. z-index: 999;
  1370. display: flex;
  1371. align-items: flex-end;
  1372. }
  1373. .picker-modal {
  1374. width: 100%;
  1375. background: #fff;
  1376. border-radius: 24rpx 24rpx 0 0;
  1377. max-height: 70vh;
  1378. display: flex;
  1379. flex-direction: column;
  1380. }
  1381. .picker-modal .picker-header {
  1382. display: flex;
  1383. justify-content: space-between;
  1384. align-items: center;
  1385. padding: 30rpx;
  1386. border-bottom: 1rpx solid #eee;
  1387. }
  1388. .picker-modal .picker-title {
  1389. font-size: 32rpx;
  1390. font-weight: bold;
  1391. color: #333;
  1392. }
  1393. .picker-modal .picker-close {
  1394. font-size: 28rpx;
  1395. color: #999;
  1396. }
  1397. .picker-modal .picker-list {
  1398. flex: 1;
  1399. max-height: 50vh;
  1400. padding: 20rpx 30rpx;
  1401. }
  1402. .picker-modal .picker-item {
  1403. display: flex;
  1404. align-items: center;
  1405. padding: 24rpx 0;
  1406. border-bottom: 1rpx solid #f5f5f5;
  1407. }
  1408. .picker-modal .picker-item:last-child {
  1409. border-bottom: none;
  1410. }
  1411. .picker-modal .picker-item-active {
  1412. background: #fff7e6;
  1413. border-radius: 12rpx;
  1414. padding: 24rpx 16rpx;
  1415. }
  1416. .picker-modal .picker-item-left {
  1417. flex: 1;
  1418. min-width: 0;
  1419. }
  1420. .picker-modal .picker-item-name {
  1421. font-size: 28rpx;
  1422. color: #333;
  1423. display: block;
  1424. }
  1425. .picker-modal .picker-item-addr {
  1426. font-size: 24rpx;
  1427. color: #999;
  1428. margin-top: 6rpx;
  1429. display: block;
  1430. }
  1431. .picker-modal .picker-item-desc {
  1432. font-size: 24rpx;
  1433. color: #999;
  1434. margin-top: 4rpx;
  1435. display: block;
  1436. }
  1437. .picker-modal .picker-item-price {
  1438. font-size: 26rpx;
  1439. color: #F97316;
  1440. font-weight: bold;
  1441. margin-top: 4rpx;
  1442. display: block;
  1443. }
  1444. .picker-modal .picker-item-check {
  1445. margin-left: 16rpx;
  1446. color: #F97316;
  1447. font-size: 32rpx;
  1448. }
  1449. </style>