checkout.vue 47 KB

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