index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class="container">
  3. <!-- 吸顶固定层:状态tab + 搜索 + 筛选 -->
  4. <view class="sticky-header">
  5. <!-- 顶部 Tab (待接送/服务中...) -->
  6. <view class="status-tabs">
  7. <view class="tab-item" v-for="(tab, index) in tabs" :key="index"
  8. :class="{ active: currentTab === index }" @click="currentTab = index">
  9. <text>{{ tab }}</text>
  10. <view class="indicator" v-if="currentTab === index"></view>
  11. </view>
  12. </view>
  13. <!-- 搜索栏 -->
  14. <view class="search-bar">
  15. <view class="search-input-box">
  16. <input class="search-input" v-model="searchContent" placeholder="搜索地址/电话/姓名" placeholder-class="ph-style" />
  17. </view>
  18. </view>
  19. <!-- 筛选栏 (支持自定义下拉) -->
  20. <view class="filter-wrapper">
  21. <view class="filter-bar">
  22. <!-- 订单类型下拉视图 -->
  23. <view class="filter-item" :class="{ 'active': activeDropdown === 1 }" @click="toggleDropdown(1)">
  24. <text :class="{ 'active-text': activeDropdown === 1 || currentTypeFilterIdx > 0 }">
  25. {{ currentTypeFilterIdx > 0 ? typeFilterOptions[currentTypeFilterIdx] : '全部类型' }}
  26. </text>
  27. <view class="triangle" :class="activeDropdown === 1 ? 'up' : 'down'"></view>
  28. </view>
  29. <!-- 服务时间下拉视图 -->
  30. <view class="filter-item" :class="{ 'active': activeDropdown === 2 }" @click="toggleDropdown(2)">
  31. <text :class="{ 'active-text': activeDropdown === 2 || hasTimeFilter }">服务时间</text>
  32. <view class="triangle" :class="activeDropdown === 2 ? 'up' : 'down'"></view>
  33. </view>
  34. </view>
  35. <!-- 下拉内容面板与遮罩 -->
  36. <view class="dropdown-mask" v-if="activeDropdown !== 0" @click="closeDropdown"></view>
  37. <view class="dropdown-panel" v-if="activeDropdown === 1">
  38. <view class="type-option" v-for="(item, index) in typeFilterOptions" :key="index"
  39. :class="{ 'selected': currentTypeFilterIdx === index }" @click="selectType(index)">
  40. <text>{{ item }}</text>
  41. </view>
  42. </view>
  43. <view class="dropdown-panel calendar-panel" v-if="activeDropdown === 2">
  44. <view class="custom-calendar-container">
  45. <!-- 头部 -->
  46. <view class="cal-header">
  47. <text class="cal-nav-btn" @click="prevMonth">‹</text>
  48. <text class="cal-title">{{ currentMonth }}</text>
  49. <text class="cal-nav-btn" @click="nextMonth">›</text>
  50. </view>
  51. <!-- 星期条 -->
  52. <view class="cal-weekdays">
  53. <text v-for="(wk, idx) in weekDays" :key="idx" class="wk-item">{{ wk }}</text>
  54. </view>
  55. <!-- 日期网格 -->
  56. <view class="cal-body">
  57. <!-- Feb 2026 starts on Sunday (index 0), so no empty padding needed for first row -->
  58. <view v-for="(day, idx) in calendarDays" :key="idx" class="cal-day-box"
  59. :class="getDateClass(day)" @click="selectDateItem(day)">
  60. <view class="cal-day-text">{{ day }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="calendar-actions">
  65. <button class="cal-btn reset" @click="resetTimeFilter">重置</button>
  66. <button class="cal-btn confirm" @click="confirmTimeFilter">确定</button>
  67. </view>
  68. </view>
  69. </view><!-- end filter-wrapper -->
  70. </view><!-- end sticky-header -->
  71. <!-- 订单列表 -->
  72. <view class="order-list">
  73. <view class="order-card" v-for="(item, index) in orderList" :key="index" @click="goToDetail(item)">
  74. <view class="card-header">
  75. <view class="type-badge">
  76. <image class="type-icon" :src="item.typeIcon"></image>
  77. <text class="type-text">{{ item.typeText }}</text>
  78. </view>
  79. <text class="status-badge" :class="getStatusClass(item)">{{ getDisplayStatus(item) }}</text>
  80. </view>
  81. <view class="card-body">
  82. <view class="time-row">
  83. <view class="time-col">
  84. <text class="label">{{ item.timeLabel }}:</text>
  85. <text class="value">{{ item.time }}</text>
  86. </view>
  87. <text class="price">¥{{ item.price }}</text>
  88. </view>
  89. <!-- 宠物信息 -->
  90. <view class="pet-card">
  91. <image class="pet-avatar" :src="item.petAvatarUrl || item.petAvatar" mode="aspectFill"></image>
  92. <view class="pet-info">
  93. <text class="pet-name">{{ item.petName }}</text>
  94. <text class="pet-breed">品种: {{ item.petBreed }}</text>
  95. </view>
  96. </view>
  97. <!-- 路线信息 (完全复用 Home 样式) -->
  98. <view class="route-info">
  99. <template v-if="item.type === 1">
  100. <view class="route-item" @click.stop="openNavigation(item, 'start')">
  101. <view class="icon-circle start">起</view>
  102. <view class="route-line-vertical"></view>
  103. <view class="address-box">
  104. <text class="addr-title">{{ item.startLocation }}</text>
  105. <text class="addr-desc">{{ item.startAddress }}</text>
  106. </view>
  107. <image class="nav-arrow" src="/static/icons/nav_arrow.svg" style="flex-shrink: 0; align-self: center;"></image>
  108. </view>
  109. <view class="route-item" @click.stop="openNavigation(item, 'end')">
  110. <view class="icon-circle end">终</view>
  111. <view class="address-box">
  112. <text class="addr-title">{{ item.endLocation }}</text>
  113. <text class="addr-desc">{{ item.endAddress }}</text>
  114. </view>
  115. <image class="nav-arrow" src="/static/icons/nav_arrow.svg" style="flex-shrink: 0; align-self: center;"></image>
  116. </view>
  117. </template>
  118. <template v-else>
  119. <view class="route-item" @click.stop="openNavigation(item, 'end')">
  120. <view class="icon-circle service">服</view>
  121. <view class="address-box">
  122. <text class="addr-title">{{ item.endLocation }}</text>
  123. <text class="addr-desc">{{ item.endAddress }}</text>
  124. </view>
  125. <image class="nav-arrow" src="/static/icons/nav_arrow.svg" style="flex-shrink: 0; align-self: center;"></image>
  126. </view>
  127. <view class="service-content" v-if="item.serviceContent">
  128. <text class="content-label">服务内容:</text>
  129. <text>{{ item.serviceContent }}</text>
  130. </view>
  131. </template>
  132. </view>
  133. <!-- 备注 -->
  134. <view class="remark-box" v-if="item.remark">
  135. <text>备注:{{ item.remark }}</text>
  136. </view>
  137. </view><!-- End of card-body -->
  138. <!-- 按钮组 -->
  139. <view class="action-btns" v-if="['接单', '到达', '出发', '开始', '送达', '结束'].includes(item.statusText)">
  140. <view class="action-left">
  141. <button class="btn normal" @click.stop="doCall('customer', item)">拨号</button>
  142. </view>
  143. <view class="action-right">
  144. <button class="btn normal danger" v-if="item.status === 2" @click.stop="handleCancelOrder(item)">取消</button>
  145. <button class="btn normal" @click.stop="reportAbnormal(item)">异常上报</button>
  146. <button class="btn primary" @click.stop="mainAction(item)">打卡</button>
  147. </view>
  148. </view>
  149. </view>
  150. <!-- 已加载完提示文字 -->
  151. <view class="loading-text">已加载完</view>
  152. <view style="height: 160rpx;"></view>
  153. </view>
  154. <view class="call-mask" v-if="activeCallItem" @click="closeCallMenu"></view>
  155. </view>
  156. <!-- 宠物档案弹窗 (复用Home) -->
  157. <view class="pet-modal-mask" v-if="showPetModal" @click="closePetProfile">
  158. <view class="pet-modal-content" @click.stop>
  159. <view class="pet-modal-header">
  160. <text class="pet-modal-title">宠物档案</text>
  161. <view class="pm-header-actions">
  162. <view class="pm-remark-btn" @click="openRemarkInput">备注</view>
  163. <view class="close-icon-btn" @click="closePetProfile">×</view>
  164. </view>
  165. </view>
  166. <scroll-view scroll-y class="pet-modal-scroll">
  167. <!-- Basic Info -->
  168. <view class="pet-base-info">
  169. <image class="pm-avatar" :src="currentPetInfo.petAvatar" mode="aspectFill"></image>
  170. <view class="pm-info-text">
  171. <view class="pm-name-row">
  172. <text class="pm-name">{{ currentPetInfo.petName }}</text>
  173. <view class="pm-gender" v-if="currentPetInfo.petGender === 'M'">
  174. <text class="gender-icon">♂</text>
  175. <text>公</text>
  176. </view>
  177. <view class="pm-gender female" v-else-if="currentPetInfo.petGender === 'F'">
  178. <text class="gender-icon">♀</text>
  179. <text>母</text>
  180. </view>
  181. </view>
  182. <text class="pm-breed">品种:{{ currentPetInfo.petBreed }}</text>
  183. </view>
  184. </view>
  185. <!-- Details Grid -->
  186. <view class="pm-detail-grid">
  187. <view class="pm-grid-item half">
  188. <text class="pm-label">年龄</text>
  189. <text class="pm-val">{{ currentPetInfo.petAge || '未知' }}</text>
  190. </view>
  191. <view class="pm-grid-item half">
  192. <text class="pm-label">体重</text>
  193. <text class="pm-val">{{ currentPetInfo.petWeight || '未知' }}</text>
  194. </view>
  195. <view class="pm-grid-item full">
  196. <text class="pm-label">性格</text>
  197. <text class="pm-val">{{ currentPetInfo.petPersonality || '无' }}</text>
  198. </view>
  199. <view class="pm-grid-item full">
  200. <text class="pm-label">爱好</text>
  201. <text class="pm-val">{{ currentPetInfo.petHobby || '无' }}</text>
  202. </view>
  203. <view class="pm-grid-item full">
  204. <text class="pm-label">备注</text>
  205. <text class="pm-val">{{ currentPetInfo.petRemark || '无特殊过敏史' }}</text>
  206. </view>
  207. </view>
  208. <!-- Tags -->
  209. <view class="pm-tags" v-if="currentPetInfo.petTags && currentPetInfo.petTags.length > 0">
  210. <view class="pm-tag" v-for="(tag, index) in currentPetInfo.petTags" :key="index">{{ tag }}</view>
  211. </view>
  212. <!-- Log Section -->
  213. <view class="pm-section-title">
  214. <view class="orange-bar"></view>
  215. <text>备注日志</text>
  216. </view>
  217. <view class="pm-log-list">
  218. <view class="pm-log-item" v-for="(log, lIndex) in currentPetInfo.petLogs" :key="lIndex">
  219. <text class="pm-log-date">{{ log.date }}</text>
  220. <text class="pm-log-text">{{ log.content }}</text>
  221. <text class="pm-log-recorder">{{ log.recorder === '系统记录' ? '' : '记录人: ' }}{{ log.recorder
  222. }}</text>
  223. </view>
  224. </view>
  225. <view style="height: 30rpx;"></view>
  226. </scroll-view>
  227. </view>
  228. </view>
  229. <!-- 备注输入弹窗 -->
  230. <view class="remark-mask" v-if="showRemarkInput" @click="closeRemarkInput">
  231. <view class="remark-sheet" @click.stop>
  232. <view class="remark-sheet-header">
  233. <text class="remark-sheet-title">添加备注</text>
  234. <view class="close-icon-btn" @click="closeRemarkInput">×</view>
  235. </view>
  236. <textarea class="remark-textarea" v-model="remarkText" placeholder="请输入备注内容..." maxlength="500"
  237. auto-height />
  238. <view class="remark-submit-btn" @click="submitRemark">提交备注</view>
  239. </view>
  240. </view>
  241. <!-- 选择地图导航弹窗 (复用Home) -->
  242. <view class="nav-modal-mask" v-if="showNavModal" @click="closeNavModal">
  243. <view class="nav-action-sheet" @click.stop>
  244. <view class="nav-sheet-title">选择地图进行导航</view>
  245. <view class="nav-sheet-item" @click="chooseMap('高德')">高德地图</view>
  246. <view class="nav-sheet-item" @click="chooseMap('腾讯')">腾讯地图</view>
  247. <view class="nav-sheet-item" @click="chooseMap('百度')">百度地图</view>
  248. <view class="nav-sheet-gap"></view>
  249. <view class="nav-sheet-item cancel" @click="closeNavModal">取消</view>
  250. </view>
  251. </view>
  252. <custom-tabbar currentPath="pages/orders/index"></custom-tabbar>
  253. </template>
  254. <script>
  255. import logic from './logic.js';
  256. export default {
  257. ...logic
  258. }
  259. </script>
  260. <style>
  261. @import './style.css';
  262. </style>