checkout.vue 47 KB

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