checkout.vue 43 KB

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