index.vue 16 KB

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