index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. <template>
  2. <view class="order-apply-page">
  3. <nav-bar title="下单预约"></nav-bar>
  4. <view class="apply-content">
  5. <!-- 01 服务类型 -->
  6. <text class="section-title">01 服务类型</text>
  7. <view class="card service-info-card">
  8. <view class="service-type-display">
  9. <view :class="['service-icon-box', activeService]">
  10. <uni-icons :type="serviceIcon" size="22" color="#fff"></uni-icons>
  11. </view>
  12. <view class="service-info-text">
  13. <text class="main-name">{{ currentServiceName }}</text>
  14. <text class="sub-desc">{{ serviceDesc }}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 02 基础信息 -->
  19. <text class="section-title">02 基础信息</text>
  20. <view class="card basic-info-card">
  21. <view class="field-row" @click="showShopPicker = true">
  22. <text class="field-label">服务门店</text>
  23. <text :class="['field-value', !formData.shopName ? 'placeholder' : '']">{{ formData.shopName ||
  24. '请选择商户门店' }}</text>
  25. <uni-icons type="right" size="14" color="#ccc"></uni-icons>
  26. </view>
  27. <view class="field-row" @click="showUserPopup = true">
  28. <text class="field-label">宠主用户</text>
  29. <view class="field-value-wrap">
  30. <template v-if="selectedUser">
  31. <text class="selected-name">{{ selectedUser.name }}</text>
  32. <text class="selected-phone">{{ selectedUser.phone }}</text>
  33. </template>
  34. <text v-else class="placeholder">搜索手机号/姓名</text>
  35. </view>
  36. </view>
  37. <view class="field-row">
  38. <text class="field-label">选择宠物</text>
  39. <text :class="['field-value', !formData.petName ? 'placeholder' : '']">{{ formData.petName ||
  40. '点击选择宠物档案' }}</text>
  41. </view>
  42. </view>
  43. <!-- 03 业务表单 - 宠物接送 -->
  44. <template v-if="activeService === 'transport'">
  45. <text class="section-title">03 填写接送路线与时间</text>
  46. <view class="card transport-card">
  47. <view class="field-row">
  48. <text class="field-label">团购套餐</text>
  49. <input class="field-input" v-model="formData.packageName" placeholder="请输入套餐名称(选填)" />
  50. </view>
  51. <text class="form-item-label">接送模式</text>
  52. <view class="mode-select">
  53. <view v-for="mode in transportModes" :key="mode.value"
  54. :class="['mode-btn', { active: formData.transportMode === mode.value }]"
  55. @click="formData.transportMode = mode.value">
  56. <text>{{ mode.label }}</text>
  57. </view>
  58. </view>
  59. <!-- 接宠路线 -->
  60. <view class="route-box" v-if="formData.transportMode !== 'return_home'">
  61. <view class="route-icon pick"><text>接</text></view>
  62. <view class="route-fields">
  63. <input class="route-input" v-model="formData.pickArea" placeholder="省/市/区" />
  64. <input class="route-input" v-model="formData.pickAddress" placeholder="详细地址" />
  65. <view class="contact-row">
  66. <input class="route-input half" v-model="formData.pickContact" placeholder="联系人" />
  67. <input class="route-input half" v-model="formData.pickPhone" placeholder="电话"
  68. type="tel" />
  69. </view>
  70. <input class="route-input" v-model="formData.pickTime" placeholder="选择接宠时间" />
  71. </view>
  72. </view>
  73. <view class="route-divider"><text class="divider-text">服务门店</text></view>
  74. <!-- 送宠路线 -->
  75. <view class="route-box" v-if="formData.transportMode !== 'pick_up'">
  76. <view class="route-icon send"><text>送</text></view>
  77. <view class="route-fields">
  78. <input class="route-input" v-model="formData.sendArea" placeholder="省/市/区" />
  79. <input class="route-input" v-model="formData.sendAddress" placeholder="详细地址" />
  80. <view class="contact-row">
  81. <input class="route-input half" v-model="formData.sendContact" placeholder="联系人" />
  82. <input class="route-input half" v-model="formData.sendPhone" placeholder="电话"
  83. type="tel" />
  84. </view>
  85. <input class="route-input" v-model="formData.sendTime" placeholder="预计送回时间(可选)" />
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <!-- 03 业务表单 - 上门喂遛/洗护 -->
  91. <template v-else>
  92. <text class="section-title">03 选择套餐与服务细则</text>
  93. <view class="card feed-card">
  94. <view class="field-row">
  95. <text class="field-label">团购套餐</text>
  96. <input class="field-input" v-model="formData.packageName" placeholder="请输入套餐名称(选填)" />
  97. </view>
  98. <text class="address-title">上门服务地址</text>
  99. <input class="full-input" v-model="formData.serviceArea" placeholder="省/市/区" />
  100. <input class="full-input" v-model="formData.serviceAddress" placeholder="详细地址 (街道/门牌号)" />
  101. <view class="booking-section">
  102. <view class="booking-header">
  103. <text class="label">预约服务时间</text>
  104. <text class="count-tag">共 {{ formData.feedTimes.length }} 次</text>
  105. </view>
  106. <view class="time-item-row" v-for="(time, index) in formData.feedTimes" :key="index">
  107. <text class="index">{{ index + 1 }}.</text>
  108. <input class="time-input" v-model="time.start" placeholder="开始时间" />
  109. <text class="to-line">~</text>
  110. <input class="time-input" v-model="time.end" placeholder="结束时间(可选)" />
  111. <view class="action-buttons">
  112. <view class="circle-btn add" v-if="index === formData.feedTimes.length - 1"
  113. @click="addFeedTime">
  114. <text>+</text>
  115. </view>
  116. <view class="circle-btn remove" v-if="formData.feedTimes.length > 1"
  117. @click="removeFeedTime(index)">
  118. <text>-</text>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <text class="remarks-title">备注信息</text>
  124. <textarea class="remarks-textarea" v-model="formData.otherNote" placeholder="其他注意事项"></textarea>
  125. </view>
  126. </template>
  127. <!-- 04 报价信息 -->
  128. <text class="section-title">04 报价信息</text>
  129. <view class="card quote-card">
  130. <view class="field-row">
  131. <text class="field-label">报价金额</text>
  132. <input class="field-input" v-model="formData.quoteAmount" type="digit" placeholder="请输入报价金额" />
  133. <text class="unit-text">元</text>
  134. </view>
  135. <text class="quote-tips">注:此报价为预估费用,最终费用以实际结算为准。</text>
  136. </view>
  137. </view>
  138. <!-- 底部操作栏 -->
  139. <view class="footer-bar safe-bottom">
  140. <view class="quotation-fulfillmentCommission-box">
  141. <text class="p-label">总计报价:</text>
  142. <text class="p-symbol">¥</text>
  143. <text class="p-amount">{{ totalFulfillmentCommission }}</text>
  144. </view>
  145. <button class="submit-btn" @click="onSubmit">立即下单</button>
  146. </view>
  147. <!-- 门店选择弹窗 -->
  148. <view class="popup-mask" v-if="showShopPicker" @click="showShopPicker = false">
  149. <view class="popup-content" @click.stop>
  150. <text class="popup-title">选择服务门店</text>
  151. <view class="popup-item" v-for="shop in shopList" :key="shop" @click="onShopSelect(shop)">
  152. <text>{{ shop }}</text>
  153. </view>
  154. </view>
  155. </view>
  156. <!-- 用户选择弹窗 -->
  157. <view class="popup-mask" v-if="showUserPopup" @click="showUserPopup = false">
  158. <view class="popup-content user-popup" @click.stop>
  159. <text class="popup-title">选择宠主</text>
  160. <view class="popup-item" v-for="user in userList" :key="user.id" @click="onUserSelect(user)">
  161. <text class="user-item-name">{{ user.name }}</text>
  162. <text class="user-item-phone">{{ user.phone }}</text>
  163. </view>
  164. </view>
  165. </view>
  166. </view>
  167. </template>
  168. <script setup>
  169. import { ref, reactive, computed } from 'vue'
  170. import { onLoad } from '@dcloudio/uni-app'
  171. import navBar from '@/components/nav-bar/index.vue'
  172. const activeService = ref('transport')
  173. const showShopPicker = ref(false)
  174. const showUserPopup = ref(false)
  175. const selectedUser = ref(null)
  176. const currentServiceName = computed(() => {
  177. const map = { transport: '宠物接送', feed: '上门喂遛', wash: '上门洗护' }
  178. return map[activeService.value]
  179. })
  180. const serviceIcon = computed(() => {
  181. const map = { transport: 'car', feed: 'shop', wash: 'color' }
  182. return map[activeService.value]
  183. })
  184. const serviceDesc = computed(() => {
  185. const map = { transport: '专车接送 · 全程监护', feed: '喂食添水 · 陪玩遛狗', wash: '专业设备 · 深度清洁' }
  186. return map[activeService.value]
  187. })
  188. onLoad((options) => {
  189. if (options.service) activeService.value = options.service
  190. })
  191. const formData = reactive({
  192. shopName: '', petName: '', packageName: '',
  193. transportMode: 'round_trip',
  194. pickArea: '', pickAddress: '', pickContact: '', pickPhone: '', pickTime: '',
  195. sendArea: '', sendAddress: '', sendContact: '', sendPhone: '', sendTime: '',
  196. serviceArea: '', serviceAddress: '',
  197. feedTimes: [{ start: '', end: '' }],
  198. otherNote: '',
  199. quoteAmount: ''
  200. })
  201. const totalFulfillmentCommission = computed(() => {
  202. if (formData.quoteAmount && !isNaN(parseFloat(formData.quoteAmount))) return parseFloat(formData.quoteAmount).toFixed(2)
  203. return '0.00'
  204. })
  205. const transportModes = [
  206. { label: '往返接送', value: 'round_trip' },
  207. { label: '单程接', value: 'pick_up' },
  208. { label: '单程送', value: 'return_home' }
  209. ]
  210. const shopList = ['爱宠生活馆 (三里屯店)', '爱宠生活馆 (国贸店)', '萌宠乐园 (朝阳大悦城店)']
  211. const userList = [
  212. { id: 1, name: '张先生', phone: '13800138000' },
  213. { id: 2, name: '李小姐', phone: '13900139000' },
  214. { id: 3, name: '王先生', phone: '13612345678' }
  215. ]
  216. const onShopSelect = (shop) => { formData.shopName = shop; showShopPicker.value = false }
  217. const onUserSelect = (user) => { selectedUser.value = user; showUserPopup.value = false }
  218. const addFeedTime = () => { formData.feedTimes.push({ start: '', end: '' }) }
  219. const removeFeedTime = (index) => { formData.feedTimes.splice(index, 1) }
  220. const onSubmit = () => {
  221. if (!selectedUser.value) { uni.showToast({ title: '请先选择宠主用户', icon: 'none' }); return }
  222. if (!formData.quoteAmount) { uni.showToast({ title: '请输入报价金额', icon: 'none' }); return }
  223. uni.showLoading({ title: '正在提交订单...' })
  224. setTimeout(() => {
  225. uni.hideLoading()
  226. uni.showToast({ title: '下单成功', icon: 'success' })
  227. setTimeout(() => {
  228. uni.reLaunch({ url: '/pages/order/list/index' })
  229. }, 1500)
  230. }, 1500)
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .order-apply-page {
  235. background: #f7f8fa;
  236. min-height: 100vh;
  237. padding-bottom: 200rpx;
  238. }
  239. .apply-content {
  240. padding: 0 32rpx;
  241. }
  242. .section-title {
  243. display: flex;
  244. align-items: center;
  245. font-size: 30rpx;
  246. font-weight: bold;
  247. color: #333;
  248. margin: 32rpx 0 20rpx;
  249. }
  250. .section-title::before {
  251. content: '';
  252. width: 8rpx;
  253. height: 28rpx;
  254. background: #f7ca3e;
  255. margin-right: 16rpx;
  256. border-radius: 4rpx;
  257. }
  258. .card {
  259. background: #fff;
  260. border-radius: 24rpx;
  261. padding: 24rpx;
  262. margin-bottom: 24rpx;
  263. }
  264. .service-type-display {
  265. display: flex;
  266. align-items: center;
  267. gap: 24rpx;
  268. }
  269. .service-icon-box {
  270. width: 88rpx;
  271. height: 88rpx;
  272. border-radius: 20rpx;
  273. display: flex;
  274. align-items: center;
  275. justify-content: center;
  276. }
  277. .service-icon-box.transport {
  278. background: linear-gradient(135deg, #64b5f6, #2196f3);
  279. }
  280. .service-icon-box.feed {
  281. background: linear-gradient(135deg, #ffb74d, #ff9800);
  282. }
  283. .service-icon-box.wash {
  284. background: linear-gradient(135deg, #81c784, #4caf50);
  285. }
  286. .main-name {
  287. display: block;
  288. font-size: 32rpx;
  289. font-weight: bold;
  290. color: #333;
  291. }
  292. .sub-desc {
  293. display: block;
  294. font-size: 24rpx;
  295. color: #999;
  296. margin-top: 4rpx;
  297. }
  298. .field-row {
  299. display: flex;
  300. align-items: center;
  301. padding: 24rpx 0;
  302. border-bottom: 1rpx solid #f5f5f5;
  303. }
  304. .field-row:last-child {
  305. border-bottom: none;
  306. }
  307. .field-label {
  308. width: 160rpx;
  309. font-size: 28rpx;
  310. color: #333;
  311. flex-shrink: 0;
  312. }
  313. .field-value {
  314. flex: 1;
  315. font-size: 28rpx;
  316. color: #333;
  317. text-align: right;
  318. }
  319. .field-value.placeholder {
  320. color: #ccc;
  321. }
  322. .field-value-wrap {
  323. flex: 1;
  324. display: flex;
  325. align-items: center;
  326. justify-content: flex-end;
  327. gap: 12rpx;
  328. }
  329. .selected-name {
  330. font-size: 28rpx;
  331. font-weight: bold;
  332. color: #333;
  333. }
  334. .selected-phone {
  335. font-size: 24rpx;
  336. color: #666;
  337. }
  338. .placeholder {
  339. color: #ccc;
  340. font-size: 28rpx;
  341. }
  342. .field-input {
  343. flex: 1;
  344. font-size: 28rpx;
  345. color: #333;
  346. text-align: right;
  347. }
  348. .unit-text {
  349. font-size: 28rpx;
  350. color: #999;
  351. margin-left: 8rpx;
  352. }
  353. .form-item-label {
  354. display: block;
  355. font-size: 28rpx;
  356. color: #333;
  357. margin: 24rpx 0 16rpx;
  358. font-weight: 500;
  359. }
  360. .mode-select {
  361. display: flex;
  362. gap: 16rpx;
  363. margin-bottom: 32rpx;
  364. }
  365. .mode-btn {
  366. flex: 1;
  367. height: 64rpx;
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. border: 1rpx solid #ddd;
  372. border-radius: 12rpx;
  373. font-size: 24rpx;
  374. color: #666;
  375. }
  376. .mode-btn.active {
  377. background: #fef8e5;
  378. border-color: #f7ca3e;
  379. color: #f7ca3e;
  380. font-weight: bold;
  381. }
  382. .route-box {
  383. display: flex;
  384. gap: 24rpx;
  385. margin-bottom: 24rpx;
  386. }
  387. .route-icon {
  388. width: 48rpx;
  389. height: 48rpx;
  390. border-radius: 8rpx;
  391. color: #fff;
  392. display: flex;
  393. align-items: center;
  394. justify-content: center;
  395. font-size: 24rpx;
  396. font-weight: bold;
  397. flex-shrink: 0;
  398. margin-top: 16rpx;
  399. }
  400. .route-icon.pick {
  401. background: #5bb7ff;
  402. }
  403. .route-icon.send {
  404. background: #64cf5c;
  405. }
  406. .route-fields {
  407. flex: 1;
  408. display: flex;
  409. flex-direction: column;
  410. gap: 8rpx;
  411. }
  412. .route-input {
  413. width: 100%;
  414. height: 72rpx;
  415. font-size: 26rpx;
  416. color: #333;
  417. border-bottom: 1rpx solid #f0f0f0;
  418. padding: 0 8rpx;
  419. }
  420. .contact-row {
  421. display: flex;
  422. gap: 16rpx;
  423. }
  424. .route-input.half {
  425. flex: 1;
  426. }
  427. .route-divider {
  428. display: flex;
  429. align-items: center;
  430. justify-content: center;
  431. padding: 16rpx 0;
  432. }
  433. .route-divider::before,
  434. .route-divider::after {
  435. content: '';
  436. flex: 1;
  437. height: 1rpx;
  438. background: #eee;
  439. }
  440. .divider-text {
  441. padding: 0 24rpx;
  442. font-size: 22rpx;
  443. color: #999;
  444. }
  445. .address-title {
  446. display: block;
  447. font-size: 28rpx;
  448. color: #333;
  449. font-weight: 500;
  450. margin: 24rpx 0 16rpx;
  451. }
  452. .full-input {
  453. width: 100%;
  454. height: 72rpx;
  455. font-size: 26rpx;
  456. color: #333;
  457. border-bottom: 1rpx solid #f0f0f0;
  458. padding: 0 8rpx;
  459. margin-bottom: 8rpx;
  460. }
  461. .booking-section {
  462. margin-top: 24rpx;
  463. }
  464. .booking-header {
  465. display: flex;
  466. justify-content: space-between;
  467. align-items: center;
  468. margin-bottom: 16rpx;
  469. }
  470. .booking-header .label {
  471. font-size: 28rpx;
  472. color: #333;
  473. font-weight: 500;
  474. }
  475. .count-tag {
  476. font-size: 22rpx;
  477. color: #ff9500;
  478. background: #fff3e0;
  479. padding: 4rpx 16rpx;
  480. border-radius: 8rpx;
  481. }
  482. .time-item-row {
  483. display: flex;
  484. align-items: center;
  485. gap: 12rpx;
  486. margin-bottom: 16rpx;
  487. }
  488. .index {
  489. font-size: 26rpx;
  490. color: #999;
  491. width: 40rpx;
  492. }
  493. .time-input {
  494. flex: 1;
  495. height: 64rpx;
  496. font-size: 24rpx;
  497. border: 1rpx solid #f0f0f0;
  498. border-radius: 12rpx;
  499. padding: 0 16rpx;
  500. }
  501. .to-line {
  502. color: #999;
  503. }
  504. .action-buttons {
  505. display: flex;
  506. gap: 8rpx;
  507. }
  508. .circle-btn {
  509. width: 48rpx;
  510. height: 48rpx;
  511. border-radius: 50%;
  512. display: flex;
  513. align-items: center;
  514. justify-content: center;
  515. font-size: 28rpx;
  516. font-weight: bold;
  517. }
  518. .circle-btn.add {
  519. background: #e3f2fd;
  520. color: #2196f3;
  521. }
  522. .circle-btn.remove {
  523. background: #fde2e2;
  524. color: #f56c6c;
  525. }
  526. .remarks-title {
  527. display: block;
  528. font-size: 28rpx;
  529. color: #333;
  530. font-weight: 500;
  531. margin: 24rpx 0 16rpx;
  532. }
  533. .remarks-textarea {
  534. width: 100%;
  535. height: 160rpx;
  536. font-size: 26rpx;
  537. color: #333;
  538. background: #f9f9f9;
  539. border-radius: 16rpx;
  540. padding: 20rpx;
  541. }
  542. .quote-tips {
  543. display: block;
  544. font-size: 22rpx;
  545. color: #999;
  546. margin-top: 12rpx;
  547. }
  548. .footer-bar {
  549. position: fixed;
  550. bottom: 0;
  551. left: 0;
  552. right: 0;
  553. background: #fff;
  554. padding: 20rpx 32rpx;
  555. display: flex;
  556. align-items: center;
  557. box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
  558. z-index: 100;
  559. }
  560. .quotation-fulfillmentCommission-box {
  561. flex: 1;
  562. display: flex;
  563. align-items: baseline;
  564. }
  565. .p-label {
  566. font-size: 26rpx;
  567. color: #333;
  568. }
  569. .p-symbol {
  570. font-size: 28rpx;
  571. color: #f44336;
  572. font-weight: bold;
  573. margin-left: 8rpx;
  574. }
  575. .p-amount {
  576. font-size: 44rpx;
  577. font-weight: 900;
  578. color: #f44336;
  579. }
  580. .submit-btn {
  581. width: 280rpx;
  582. height: 88rpx;
  583. background: linear-gradient(90deg, #ffd53f, #ff9500);
  584. color: #333;
  585. border: none;
  586. border-radius: 44rpx;
  587. font-size: 30rpx;
  588. font-weight: bold;
  589. line-height: 88rpx;
  590. }
  591. .popup-mask {
  592. position: fixed;
  593. top: 0;
  594. left: 0;
  595. right: 0;
  596. bottom: 0;
  597. background: rgba(0, 0, 0, 0.5);
  598. z-index: 999;
  599. display: flex;
  600. align-items: flex-end;
  601. }
  602. .popup-content {
  603. width: 100%;
  604. background: #fff;
  605. border-radius: 32rpx 32rpx 0 0;
  606. padding: 40rpx 32rpx;
  607. max-height: 70vh;
  608. }
  609. .popup-title {
  610. display: block;
  611. font-size: 32rpx;
  612. font-weight: bold;
  613. color: #333;
  614. margin-bottom: 24rpx;
  615. text-align: center;
  616. }
  617. .popup-item {
  618. padding: 28rpx 0;
  619. border-bottom: 1rpx solid #f5f5f5;
  620. font-size: 28rpx;
  621. color: #333;
  622. }
  623. .user-popup .popup-item {
  624. display: flex;
  625. justify-content: space-between;
  626. }
  627. .user-item-name {
  628. font-weight: bold;
  629. }
  630. .user-item-phone {
  631. color: #999;
  632. }
  633. </style>