checkout.vue 47 KB

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