index.vue 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127
  1. <template>
  2. <view class="container">
  3. <!-- 自定义导航栏标题 -->
  4. <view class="custom-nav-bar" :style="{ backgroundColor: scrollTop > 20 ? '#fff' : 'transparent' }">
  5. <text class="nav-title">任务中心</text>
  6. </view>
  7. <!-- 顶部自定义导航栏背景 -->
  8. <!-- 顶部自定义导航栏背景 -->
  9. <view class="nav-bg">
  10. <view class="bg-circle-left"></view>
  11. <view class="bg-circle-right"></view>
  12. </view>
  13. <!-- 头部用户信息与统计 -->
  14. <view class="header-section">
  15. <view class="user-info">
  16. <image class="avatar" :src="profile?.avatarUrl || '/static/touxiang.png'" mode="aspectFill"></image>
  17. <view class="info-content">
  18. <view class="top-row">
  19. <text class="name">{{ profile?.name || '未登录' }}</text>
  20. <view class="status-pill" :class="{ 'resting': workStatus !== 'busy' }" @click="goToWorkStatus">
  21. <view class="status-dot-bg"
  22. :class="{ 'busy': workStatus === 'busy', 'disabled': workStatus === 'disabled' }">
  23. <text class="check-mark" v-if="workStatus === 'busy'">✔</text>
  24. <text class="check-mark" v-else style="font-size: 16rpx; line-height: 20rpx;">✕</text>
  25. </view>
  26. <text class="status-text">{{ workStatus === 'busy' ? '接单中' : (workStatus === 'resting' ?
  27. '正在休息' : '已禁用') }}</text>
  28. <text class="arrow-down">▼</text>
  29. </view>
  30. </view>
  31. <view class="bottom-row" @click="handleManualLocation">
  32. <text class="city-label">接单城市:{{ profile?.cityName || '暂无' }}</text>
  33. <text class="city-arrow">></text>
  34. </view>
  35. </view>
  36. <view class="notification-box" @click="navToMessage">
  37. <image class="bell-img" src="/static/icons/bell.svg"></image>
  38. <view class="badge-count" v-if="unreadCount > 0">{{ unreadCount > 99 ? '99+' : unreadCount }}</view>
  39. </view>
  40. </view>
  41. <!-- 统计卡片 -->
  42. <view class="stats-card">
  43. <view class="stat-item">
  44. <text class="num">{{ orderStats.total }}</text>
  45. <text class="label">全部订单</text>
  46. </view>
  47. <view class="divider"></view>
  48. <view class="stat-item">
  49. <text class="num">{{ orderStats.reject }}</text>
  50. <text class="label">拒接订单</text>
  51. </view>
  52. <view class="divider"></view>
  53. <view class="stat-item">
  54. <text class="num">{{ orderStats.completed }}</text>
  55. <text class="label">完成订单</text>
  56. </view>
  57. <view class="divider"></view>
  58. <view class="stat-item">
  59. <text class="num">{{ (orderStats.price / 100).toFixed(2) }}</text>
  60. <text class="label">服务总得</text>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 任务大厅标题栏 (Sticky Container) -->
  65. <view class="task-header">
  66. <!-- 标题栏内容 (Inner) -->
  67. <view class="header-inner"
  68. :style="{ backgroundColor: (scrollTop > 300 || isFilterShow) ? '#fff' : 'transparent' }">
  69. <view class="left-title">
  70. <view class="orange-bar"></view>
  71. <text class="title">任务大厅</text>
  72. <text class="count">- ({{ taskList.length }}单)</text>
  73. </view>
  74. <view class="filter-options">
  75. <view class="dropdown" @click="showFilterDropdown">
  76. <text>筛选条件</text>
  77. <text class="arrow-down">﹀</text>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 筛选遮罩 (Absolute Child: Starts below header) -->
  82. <view class="filter-mask" v-if="isFilterShow" @click="closeFilter"></view>
  83. <!-- 筛选下拉面板 (Absolute Child) -->
  84. <view class="filter-panel" :class="{ show: isFilterShow }">
  85. <view class="filter-section">
  86. <text class="section-title">服务类型</text>
  87. <view class="options-grid">
  88. <view class="option-btn" :class="{ active: tempFilter.service === null }"
  89. @click="selectService(null)">全部</view>
  90. <view class="option-btn" v-for="item in serviceList" :key="item.id"
  91. :class="{ active: tempFilter.service === item.id }" @click="selectService(item.id)">{{
  92. item.name }}</view>
  93. </view>
  94. </view>
  95. <view class="filter-section">
  96. <text class="section-title">金额</text>
  97. <view class="options-grid">
  98. <view class="option-btn" :class="{ active: tempFilter.amount === '全部' }"
  99. @click="selectAmount('全部')">全部</view>
  100. <view class="option-btn" :class="{ active: tempFilter.amount === '100以下' }"
  101. @click="selectAmount('100以下')">100以下</view>
  102. <view class="option-btn" :class="{ active: tempFilter.amount === '100-200' }"
  103. @click="selectAmount('100-200')">100-200</view>
  104. <view class="option-btn" :class="{ active: tempFilter.amount === '200-500' }"
  105. @click="selectAmount('200-500')">200-500</view>
  106. <view class="option-btn" :class="{ active: tempFilter.amount === '500以上' }"
  107. @click="selectAmount('500以上')">500以上</view>
  108. </view>
  109. </view>
  110. <view class="filter-actions">
  111. <button class="action-btn reset" @click="resetFilter">重置</button>
  112. <button class="action-btn confirm" @click="confirmFilter">确认</button>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- 列表容器 -->
  117. <view class="task-list-container">
  118. <!-- 任务列表 -->
  119. <view class="task-list">
  120. <view class="task-card" v-for="item in taskList" :key="item.id" @click="goToDetail(item)">
  121. <view class="card-header">
  122. <view class="type-badge">
  123. <image class="type-icon" :src="item.typeIcon"></image>
  124. <text class="type-text">{{ item.typeText }}</text>
  125. </view>
  126. <text class="price">¥{{ item.price }}</text>
  127. </view>
  128. <view class="card-body">
  129. <view class="time-row">
  130. <text class="label">{{ item.timeLabel }}:</text>
  131. <text class="value">{{ item.time }}</text>
  132. </view>
  133. <view class="pet-card">
  134. <image class="pet-avatar" :src="item.petAvatarUrl || item.petAvatar" mode="aspectFill">
  135. </image>
  136. <view class="pet-info">
  137. <text class="pet-name">{{ item.petName }}</text>
  138. <text class="pet-breed">品种: {{ item.petBreed }}</text>
  139. </view>
  140. </view>
  141. <view class="route-info">
  142. <template v-if="item.type === 1">
  143. <view class="route-item" @click.stop="openNavigation(item, 'start')">
  144. <view class="icon-circle start">起</view>
  145. <view class="route-line-vertical"></view>
  146. <view class="address-box">
  147. <text class="addr-title">{{ item.startLocation }}</text>
  148. <text class="addr-desc">{{ item.startAddress }}</text>
  149. </view>
  150. <image class="nav-arrow" src="/static/icons/nav_arrow.svg"
  151. style="flex-shrink: 0; align-self: center;"></image>
  152. </view>
  153. <view class="route-item" @click.stop="openNavigation(item, 'end')">
  154. <view class="icon-circle end">终</view>
  155. <view class="address-box">
  156. <text class="addr-title">{{ item.endLocation }}</text>
  157. <text class="addr-desc">{{ item.endAddress }}</text>
  158. </view>
  159. <image class="nav-arrow" src="/static/icons/nav_arrow.svg"
  160. style="flex-shrink: 0; align-self: center;"></image>
  161. </view>
  162. </template>
  163. <template v-else>
  164. <view class="route-item" @click.stop="openNavigation(item, 'end')">
  165. <view class="icon-circle service">服</view>
  166. <view class="address-box">
  167. <text class="addr-title">{{ item.endLocation }}</text>
  168. <text class="addr-desc">{{ item.endAddress }}</text>
  169. </view>
  170. <image class="nav-arrow" src="/static/icons/nav_arrow.svg"
  171. style="flex-shrink: 0; align-self: center;"></image>
  172. </view>
  173. <view class="service-content" v-if="item.serviceContent">
  174. <text class="content-label">服务内容:</text>
  175. <text>{{ item.serviceContent }}</text>
  176. </view>
  177. </template>
  178. </view>
  179. <view class="remark-box">
  180. <text>备注:{{ item.remark || '-' }}</text>
  181. </view>
  182. </view>
  183. <!-- action-btns class is in style.css but template used card-footer. style.css: .action-btns, index.vue: .card-footer -->
  184. <!-- Wait, style.css has .action-btns { display: flex; ... } and .btn.reject/accept -->
  185. <!-- I should use .action-btns instead of .card-footer -->
  186. <view class="action-btns">
  187. <button class="btn reject" @click.stop="openRejectModal(item)">拒绝</button>
  188. <button class="btn accept" @click.stop="openAcceptModal(item)">接单</button>
  189. </view>
  190. </view>
  191. <!-- Padding for safe area/tabbar -->
  192. <view style="height: 120rpx;"></view>
  193. </view>
  194. </view>
  195. <!-- 自定义确认弹窗 -->
  196. <view class="modal-mask" v-if="showConfirmModal">
  197. <view class="custom-modal">
  198. <text class="modal-title">提示</text>
  199. <text class="modal-content">是否确定结束休息,开始接单?</text>
  200. <view class="modal-btns">
  201. <button class="modal-btn cancel" @click="closeConfirmModal">取消</button>
  202. <button class="modal-btn confirm" @click="confirmStartWork">确定</button>
  203. </view>
  204. </view>
  205. </view>
  206. <!-- 宠物档案弹窗 -->
  207. <view class="pet-modal-mask" v-if="showPetModal" @click="closePetProfile">
  208. <view class="pet-modal-content" @click.stop>
  209. <view class="pet-modal-header">
  210. <text class="pet-modal-title">宠物档案</text>
  211. <view class="close-icon-btn" @click="closePetProfile">×</view>
  212. </view>
  213. <scroll-view scroll-y class="pet-modal-scroll">
  214. <!-- Basic Info -->
  215. <view class="pet-base-info">
  216. <image class="pm-avatar" :src="currentPetInfo.petAvatar" mode="aspectFill"></image>
  217. <view class="pm-info-text">
  218. <view class="pm-name-row">
  219. <text class="pm-name">{{ currentPetInfo.petName }}</text>
  220. <!-- Gender badge -->
  221. <view class="pm-gender" v-if="currentPetInfo.petGender === 'M'">
  222. <text class="gender-icon">♂</text>
  223. <text>公</text>
  224. </view>
  225. <view class="pm-gender female" v-else-if="currentPetInfo.petGender === 'F'">
  226. <text class="gender-icon">♀</text>
  227. <text>母</text>
  228. </view>
  229. </view>
  230. <text class="pm-breed">品种:{{ currentPetInfo.petBreed }}</text>
  231. </view>
  232. </view>
  233. <!-- Details Grid -->
  234. <view class="pm-detail-grid">
  235. <view class="pm-grid-item half">
  236. <text class="pm-label">年龄</text>
  237. <text class="pm-val">{{ currentPetInfo.petAge || '未知' }}</text>
  238. </view>
  239. <view class="pm-grid-item half">
  240. <text class="pm-label">体重</text>
  241. <text class="pm-val">{{ currentPetInfo.petWeight || '未知' }}</text>
  242. </view>
  243. <view class="pm-grid-item full">
  244. <text class="pm-label">性格</text>
  245. <text class="pm-val">{{ currentPetInfo.petPersonality || '无' }}</text>
  246. </view>
  247. <view class="pm-grid-item full">
  248. <text class="pm-label">爱好</text>
  249. <text class="pm-val">{{ currentPetInfo.petHobby || '无' }}</text>
  250. </view>
  251. <view class="pm-grid-item full">
  252. <text class="pm-label">备注</text>
  253. <text class="pm-val">{{ currentPetInfo.petRemark || '无特殊过敏史' }}</text>
  254. </view>
  255. </view>
  256. <!-- Tags -->
  257. <view class="pm-tags" v-if="currentPetInfo.petTags && currentPetInfo.petTags.length > 0">
  258. <view class="pm-tag" v-for="(tag, index) in currentPetInfo.petTags" :key="index">{{ tag }}
  259. </view>
  260. </view>
  261. <!-- Log Section -->
  262. <view class="pm-section-title">
  263. <view class="orange-bar"></view>
  264. <text>备注日志</text>
  265. </view>
  266. <view class="pm-log-list">
  267. <view class="pm-log-item" v-for="(log, lIndex) in currentPetInfo.petLogs" :key="lIndex">
  268. <text class="pm-log-date">{{ log.date }}</text>
  269. <text class="pm-log-text">{{ log.content }}</text>
  270. <text class="pm-log-recorder">{{ log.recorder === '系统记录' ? '' : '记录人: ' }}{{ log.recorder
  271. }}</text>
  272. </view>
  273. </view>
  274. <view style="height: 40rpx;"></view>
  275. <button class="pm-bottom-close" @click="closePetProfile">关闭</button>
  276. <view style="height: 20rpx;"></view>
  277. </scroll-view>
  278. </view>
  279. </view>
  280. </view>
  281. <!-- 拒绝接单弹窗 -->
  282. <view class="modal-mask" v-if="showRejectModal">
  283. <view class="custom-modal">
  284. <text class="modal-title">拒绝接单</text>
  285. <view class="textarea-container">
  286. <textarea class="reject-textarea" v-model="rejectReason" placeholder="请输入拒绝理由(必填)"
  287. maxlength="100"></textarea>
  288. <text class="char-count">{{ rejectReason.length }}/100</text>
  289. </view>
  290. <view class="modal-btns mt-30">
  291. <button class="modal-btn cancel" @click="closeRejectModal">取消</button>
  292. <button class="modal-btn confirm" :class="{ 'disabled': !rejectReason.trim() }"
  293. @click="confirmReject">提交</button>
  294. </view>
  295. </view>
  296. </view>
  297. <!-- 确认接单弹窗 -->
  298. <view class="modal-mask" v-if="showAcceptConfirmModal">
  299. <view class="custom-modal">
  300. <text class="modal-title">接单确认</text>
  301. <view class="modal-content-box">
  302. <text class="modal-content-main">请确认是否接收此订单?</text>
  303. <text class="modal-content-sub">接单后请尽快通过电话联系用户</text>
  304. </view>
  305. <view class="modal-btns mt-30">
  306. <button class="modal-btn cancel" @click="closeAcceptModal">再想想</button>
  307. <button class="modal-btn confirm" @click="confirmAccept">确认接单</button>
  308. </view>
  309. </view>
  310. </view>
  311. <!-- 选择地图导航弹窗 -->
  312. <view class="nav-modal-mask" v-if="showNavModal" @click="closeNavModal">
  313. <view class="nav-action-sheet" @click.stop>
  314. <view class="nav-sheet-title">选择地图进行导航</view>
  315. <view class="nav-sheet-item" @click="chooseMap('高德')">高德地图</view>
  316. <view class="nav-sheet-item" @click="chooseMap('腾讯')">腾讯地图</view>
  317. <view class="nav-sheet-item" @click="chooseMap('百度')">百度地图</view>
  318. <view class="nav-sheet-gap"></view>
  319. <view class="nav-sheet-item cancel" @click="closeNavModal">取消</view>
  320. </view>
  321. </view>
  322. <custom-tabbar currentPath="pages/home/index"></custom-tabbar>
  323. </template>
  324. <script>
  325. import { getMyProfile } from '@/api/fulfiller/fulfiller'
  326. import { getPendingOrders, acceptOrder, getOrderCount, rejectOrderApi } from '@/api/order/subOrder'
  327. import { listAllService } from '@/api/service/list'
  328. import { getAreaStationList } from '@/api/system/areaStation'
  329. import { isLoggedIn } from '@/utils/auth'
  330. import { reportGps } from '@/utils/gps'
  331. import { listMyNotice } from '@/api/system/notice'
  332. import customTabbar from '@/components/custom-tabbar/index.vue'
  333. export default {
  334. components: {
  335. customTabbar
  336. },
  337. data() {
  338. return {
  339. taskList: [],
  340. currentFilter: 'default', // default, distance, time
  341. filterCondition: '筛选条件',
  342. sortDistance: 'asc', // asc, desc
  343. sortTime: 'asc',
  344. scrollTop: 0, // Track scroll position
  345. isFilterShow: false,
  346. tempFilter: {
  347. service: null,
  348. distance: '全部',
  349. amount: '全部'
  350. },
  351. activeFilter: {
  352. service: null,
  353. distance: '全部',
  354. amount: '全部'
  355. },
  356. workStatus: 'resting', // resting | busy | disabled
  357. showConfirmModal: false,
  358. showPetModal: false,
  359. currentPetInfo: {},
  360. showRejectModal: false,
  361. rejectReason: '',
  362. currentOrder: null,
  363. showAcceptConfirmModal: false,
  364. showNavModal: false,
  365. navTargetItem: null,
  366. navTargetPointType: '',
  367. profile: null,
  368. profileLoading: false,
  369. serviceList: [],
  370. orderStats: {
  371. total: 0,
  372. reject: 0,
  373. completed: 0,
  374. price: 0
  375. },
  376. unreadCount: 0,
  377. noticeTimer: null
  378. }
  379. },
  380. onPageScroll(e) {
  381. this.scrollTop = e.scrollTop;
  382. },
  383. async onLoad() {
  384. // Initial load
  385. this.checkWorkStatus();
  386. await this.loadServiceList();
  387. this.loadTaskList();
  388. // 显式请求一次定位授权
  389. reportGps(true).catch(e => console.log('Init GPS check skipped', e));
  390. },
  391. onShow() {
  392. uni.hideTabBar()
  393. this.checkWorkStatus();
  394. if (isLoggedIn()) {
  395. // 每次进入页面强制刷新所有展示数据
  396. this.loadProfile()
  397. this.loadOrderStats()
  398. this.loadTaskList()
  399. this.loadServiceList() // 确保服务配置也是最新的
  400. this.fetchUnreadNotice() // 获取未读消息
  401. this.startNoticePolling() // 开始轮询
  402. }
  403. },
  404. onHide() {
  405. this.stopNoticePolling()
  406. },
  407. onUnload() {
  408. this.stopNoticePolling()
  409. },
  410. async onPullDownRefresh() {
  411. this.checkWorkStatus();
  412. try {
  413. await this.loadServiceList();
  414. const tasks = [
  415. this.loadTaskList()
  416. ];
  417. if (isLoggedIn()) {
  418. tasks.push(this.loadProfile());
  419. tasks.push(this.loadOrderStats());
  420. }
  421. await Promise.all(tasks);
  422. } catch (err) {
  423. console.error('刷新异常:', err);
  424. } finally {
  425. uni.stopPullDownRefresh();
  426. uni.showToast({ title: '刷新成功', icon: 'success' });
  427. }
  428. },
  429. methods: {
  430. async loadProfile() {
  431. if (this.profileLoading) return
  432. this.profileLoading = true
  433. try {
  434. const res = await getMyProfile()
  435. const data = res.data || null
  436. if (data) {
  437. // 以服务器返回的状态为准进行更新
  438. if (data.status) {
  439. this.workStatus = data.status;
  440. uni.setStorageSync('workStatus', data.status);
  441. }
  442. // 需求:头部的接单城市使用站点往上找到城市,而非直接显示站点
  443. if (data.stationId) {
  444. try {
  445. const stationRes = await getAreaStationList();
  446. const list = stationRes.data || [];
  447. const currentStation = list.find(i => i.id === data.stationId);
  448. if (currentStation) {
  449. // 向上溯源:直到找到 parentId 为 0 的节点(即顶层城市)
  450. let node = currentStation;
  451. while (node && node.parentId !== 0) {
  452. let parent = list.find(i => i.id === node.parentId);
  453. if (parent) {
  454. node = parent;
  455. } else {
  456. break;
  457. }
  458. }
  459. // 将溯源到的节点名称作为显示城市
  460. data.cityName = node.name;
  461. }
  462. } catch (e) {
  463. console.error('溯源城市失败:', e);
  464. }
  465. }
  466. }
  467. this.profile = data
  468. } catch (err) {
  469. console.error('获取个人信息失败:', err)
  470. } finally {
  471. this.profileLoading = false
  472. }
  473. },
  474. async loadServiceList() {
  475. try {
  476. const res = await listAllService()
  477. this.serviceList = res.data || []
  478. } catch (err) {
  479. console.error('获取服务类型失败:', err)
  480. }
  481. },
  482. async loadOrderStats() {
  483. try {
  484. const res = await getOrderCount()
  485. this.orderStats = res.data || { total: 0, reject: 0, completed: 0, price: 0 }
  486. } catch (err) {
  487. console.error('获取订单统计失败:', err)
  488. }
  489. },
  490. async fetchUnreadNotice() {
  491. if (!isLoggedIn()) return;
  492. try {
  493. const res = await listMyNotice({
  494. pageNum: 1,
  495. pageSize: 1,
  496. readFlag: false
  497. });
  498. this.unreadCount = Number(res.total) || 0;
  499. } catch (err) {
  500. console.error('获取未读消息失败:', err);
  501. }
  502. },
  503. startNoticePolling() {
  504. this.stopNoticePolling();
  505. // 每5秒轮询一次未读消息
  506. this.noticeTimer = setInterval(() => {
  507. this.fetchUnreadNotice();
  508. }, 5000);
  509. },
  510. stopNoticePolling() {
  511. if (this.noticeTimer) {
  512. clearInterval(this.noticeTimer);
  513. this.noticeTimer = null;
  514. }
  515. },
  516. navToMessage() {
  517. uni.navigateTo({
  518. url: '/pages/mine/message/index'
  519. });
  520. },
  521. checkWorkStatus() {
  522. const status = uni.getStorageSync('workStatus');
  523. if (status) {
  524. this.workStatus = status;
  525. } else {
  526. // 默认状态为休息
  527. this.workStatus = 'resting';
  528. uni.setStorageSync('workStatus', 'resting');
  529. }
  530. },
  531. toggleFilter() {
  532. if (this.workStatus === 'resting') return; // Disable filter when resting? Or keep it? User didn't specify, but usually disabled. Let's keep it enabled for now as they might look at filters before working.
  533. this.isFilterShow = !this.isFilterShow;
  534. },
  535. goToWorkStatus() {
  536. uni.navigateTo({
  537. url: '/pages/home/work-status/index'
  538. });
  539. },
  540. async handleManualLocation() {
  541. try {
  542. uni.showLoading({ title: '定位获取中...', mask: true });
  543. await reportGps(true);
  544. uni.showToast({ title: '位置已更新', icon: 'success' });
  545. } catch (e) {
  546. console.error('Manual location failed', e);
  547. } finally {
  548. uni.hideLoading();
  549. }
  550. },
  551. startWork() {
  552. this.showConfirmModal = true;
  553. },
  554. confirmStartWork() {
  555. this.workStatus = 'busy';
  556. uni.setStorageSync('workStatus', 'busy');
  557. this.loadTaskList();
  558. this.showConfirmModal = false;
  559. uni.showToast({ title: '已开始接单', icon: 'success' });
  560. },
  561. closeConfirmModal() {
  562. this.showConfirmModal = false;
  563. },
  564. showPetProfile(item) {
  565. this.currentPetInfo = item;
  566. this.showPetModal = true;
  567. },
  568. closePetProfile() {
  569. this.showPetModal = false;
  570. },
  571. openRejectModal(item) {
  572. this.currentOrder = item;
  573. this.rejectReason = '';
  574. this.showRejectModal = true;
  575. },
  576. closeRejectModal() {
  577. this.showRejectModal = false;
  578. this.currentOrder = null;
  579. },
  580. async confirmReject() {
  581. if (!this.rejectReason.trim()) {
  582. uni.showToast({ title: '请输入拒绝理由', icon: 'none' });
  583. return;
  584. }
  585. if (!this.currentOrder?.id) return
  586. try {
  587. uni.showLoading({ title: '提交中...', mask: true });
  588. await rejectOrderApi({
  589. orderId: this.currentOrder.id,
  590. rejectReason: this.rejectReason
  591. });
  592. uni.showToast({ title: '已拒绝接单', icon: 'success' });
  593. this.showRejectModal = false;
  594. this.currentOrder = null;
  595. this.loadTaskList();
  596. this.loadOrderStats();
  597. } catch (err) {
  598. console.error('拒绝接单失败:', err);
  599. uni.showToast({ title: err.message || err.msg || '拒绝接单失败', icon: 'none' });
  600. } finally {
  601. uni.hideLoading();
  602. }
  603. },
  604. openAcceptModal(item) {
  605. this.currentOrder = item;
  606. this.showAcceptConfirmModal = true;
  607. },
  608. closeAcceptModal() {
  609. this.showAcceptConfirmModal = false;
  610. this.currentOrder = null;
  611. },
  612. async confirmAccept() {
  613. if (!this.currentOrder?.id) return
  614. try {
  615. await acceptOrder(this.currentOrder.id)
  616. uni.showToast({ title: '接单成功', icon: 'success' })
  617. this.showAcceptConfirmModal = false
  618. this.currentOrder = null
  619. this.loadTaskList()
  620. this.loadProfile()
  621. this.loadOrderStats()
  622. } catch (err) {
  623. console.error('接单失败:', err)
  624. uni.showToast({ title: err.message || err.msg || '接单失败', icon: 'none' });
  625. }
  626. },
  627. openNavigation(item, pointType) {
  628. this.navTargetItem = item;
  629. this.navTargetPointType = pointType;
  630. this.showNavModal = true;
  631. },
  632. closeNavModal() {
  633. this.showNavModal = false;
  634. },
  635. chooseMap(mapType) {
  636. let item = this.navTargetItem;
  637. let pointType = this.navTargetPointType;
  638. // 起 -> fromAddress ; 终 -> toAddress
  639. let name = pointType === 'start' ? (item.fromAddress || '起点') : (item.toAddress || '终点');
  640. let address = pointType === 'start' ? (item.fromAddress || '起点地址') : (item.toAddress || '终点地址');
  641. let latitude = pointType === 'start' ? Number(item.fromLat) : Number(item.toLat);
  642. let longitude = pointType === 'start' ? Number(item.fromLng) : Number(item.toLng);
  643. this.showNavModal = false;
  644. // 统一定义打开地图的函数
  645. const navigateTo = (lat, lng, addrName, addrDesc) => {
  646. uni.openLocation({
  647. latitude: lat,
  648. longitude: lng,
  649. name: addrName,
  650. address: addrDesc || '无法获取详细地址',
  651. success: function () {
  652. console.log('打开导航成功: ' + mapType);
  653. },
  654. fail: function (err) {
  655. console.error('打开导航失败:', err);
  656. uni.showToast({ title: '打开地图失败', icon: 'none' });
  657. }
  658. });
  659. };
  660. // 如果有目标经纬度,直接打开
  661. if (latitude && longitude && !isNaN(latitude) && !isNaN(longitude)) {
  662. navigateTo(latitude, longitude, name, address);
  663. } else {
  664. // 如果没有经纬度,按照需求:使用自己当前的经纬度,然后搜索 fromAddress 或者 toAddress
  665. uni.showLoading({ title: '获取当前位置...', mask: true });
  666. reportGps(true).then(res => {
  667. uni.hideLoading();
  668. // 使用用户当前经纬度作为锚点打开地图,展示目标地址信息
  669. navigateTo(res.latitude, res.longitude, name, address);
  670. }).catch(err => {
  671. uni.hideLoading();
  672. console.error('获取地理位置失败:', err);
  673. // 具体的授权引导已在 reportGps 内部处理
  674. });
  675. }
  676. },
  677. selectService(type) {
  678. this.tempFilter.service = type;
  679. },
  680. selectDistance(type) {
  681. this.tempFilter.distance = type;
  682. },
  683. selectAmount(type) {
  684. this.tempFilter.amount = type;
  685. },
  686. resetFilter() {
  687. this.tempFilter = {
  688. service: null,
  689. distance: '全部',
  690. amount: '全部'
  691. };
  692. },
  693. confirmFilter() {
  694. this.activeFilter = { ...this.tempFilter };
  695. this.isFilterShow = false;
  696. this.loadTaskList();
  697. },
  698. closeFilter() {
  699. this.isFilterShow = false;
  700. },
  701. goToDetail(item) {
  702. console.log('Go to detail', item);
  703. },
  704. async loadTaskList() {
  705. try {
  706. const params = {
  707. service: this.activeFilter.service,
  708. minPrice: this.getMinPrice(),
  709. maxPrice: this.getMaxPrice(),
  710. pageNum: 1,
  711. pageSize: 20
  712. }
  713. const res = await getPendingOrders(params)
  714. this.taskList = (res.rows || []).map(item => this.transformOrder(item))
  715. } catch (err) {
  716. console.error('获取订单列表失败:', err)
  717. uni.showToast({ title: err.message || err.msg || '加载失败', icon: 'none' })
  718. this.taskList = []
  719. }
  720. },
  721. getMinPrice() {
  722. const amount = this.activeFilter.amount
  723. if (amount === '100以下') return 0
  724. if (amount === '100-200') return 10000
  725. if (amount === '200-500') return 20000
  726. if (amount === '500以上') return 50000
  727. return undefined
  728. },
  729. getMaxPrice() {
  730. const amount = this.activeFilter.amount
  731. if (amount === '100以下') return 10000
  732. if (amount === '100-200') return 20000
  733. if (amount === '200-500') return 50000
  734. return undefined
  735. },
  736. transformOrder(item) {
  737. const service = this.serviceList.find(s => s.id === item.service)
  738. const serviceText = service?.name || '未知'
  739. const serviceIcon = service?.iconUrl || ''
  740. const mode = service?.mode || 0
  741. const isRoundTrip = mode === 1
  742. return {
  743. id: item.id,
  744. type: isRoundTrip ? 1 : item.service,
  745. typeText: serviceText,
  746. typeIcon: serviceIcon,
  747. price: (item.price / 100).toFixed(2),
  748. timeLabel: '服务时间',
  749. time: item.serviceTime,
  750. petAvatar: item.petAvatar || '/static/dog.png',
  751. petAvatarUrl: item.petAvatarUrl || '',
  752. petName: item.petName,
  753. petBreed: item.breed,
  754. petGender: 'M',
  755. petAge: '',
  756. petWeight: '',
  757. petPersonality: '',
  758. petHobby: '',
  759. petRemark: '',
  760. petTags: [],
  761. petLogs: [],
  762. startLocation: item.fromAddress || '暂无起点',
  763. startAddress: item.fromAddress || '',
  764. fromAddress: item.fromAddress || '',
  765. fromLat: item.fromLat,
  766. fromLng: item.fromLng,
  767. startDistance: '0km',
  768. endLocation: (item.customerName || item.contact || '') + ' ' + (item.customerPhone || ''),
  769. endAddress: item.toAddress || '',
  770. toAddress: item.toAddress || '',
  771. toLat: item.toLat,
  772. toLng: item.toLng,
  773. endDistance: '0km',
  774. serviceContent: '',
  775. remark: item.remark || ''
  776. }
  777. },
  778. setFilter(type) {
  779. this.currentFilter = type;
  780. if (type === 'distance') {
  781. this.sortDistance = this.sortDistance === 'asc' ? 'desc' : 'asc';
  782. uni.showToast({ title: `按距离${this.sortDistance === 'asc' ? '升序' : '降序'}`, icon: 'none' });
  783. } else if (type === 'time') {
  784. this.sortTime = this.sortTime === 'asc' ? 'desc' : 'asc';
  785. uni.showToast({ title: `按时间${this.sortTime === 'asc' ? '升序' : '降序'}`, icon: 'none' });
  786. }
  787. },
  788. showFilterDropdown() {
  789. this.toggleFilter();
  790. }
  791. }
  792. }
  793. </script>
  794. <style>
  795. /* Global Box Sizing Fix */
  796. view,
  797. text,
  798. image,
  799. scroll-view,
  800. button {
  801. box-sizing: border-box;
  802. }
  803. /* 页面背景 */
  804. page {
  805. background-color: #F8F8F8;
  806. }
  807. .container {
  808. padding-bottom: 30rpx;
  809. }
  810. /* 顶部背景 */
  811. .nav-bg {
  812. position: absolute;
  813. top: 0;
  814. left: 0;
  815. width: 100%;
  816. height: 360rpx;
  817. /* Reduced by another 20rpx */
  818. background: linear-gradient(180deg, #FFE0B2 0%, #FFF3E0 100%);
  819. border-bottom-left-radius: 60rpx;
  820. border-bottom-right-radius: 60rpx;
  821. z-index: 1;
  822. overflow: hidden;
  823. }
  824. /* Custom Navigation Bar */
  825. .custom-nav-bar {
  826. position: fixed;
  827. top: 0;
  828. left: 0;
  829. width: 100%;
  830. z-index: 100;
  831. padding-top: var(--status-bar-height);
  832. height: 100rpx;
  833. display: flex;
  834. align-items: center;
  835. justify-content: center;
  836. }
  837. .nav-title {
  838. font-size: 34rpx;
  839. font-weight: bold;
  840. color: #333;
  841. }
  842. /* 头部区域 */
  843. .header-section {
  844. position: relative;
  845. z-index: 2;
  846. padding: 140rpx 30rpx 0;
  847. }
  848. /* 用户信息 */
  849. .user-info {
  850. display: flex;
  851. align-items: center;
  852. margin-bottom: 40rpx;
  853. }
  854. .avatar {
  855. width: 100rpx;
  856. height: 100rpx;
  857. border-radius: 50%;
  858. margin-right: 24rpx;
  859. border: 4rpx solid #fff;
  860. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);
  861. }
  862. .info-content {
  863. flex: 1;
  864. display: flex;
  865. flex-direction: column;
  866. }
  867. .top-row {
  868. display: flex;
  869. align-items: center;
  870. margin-bottom: 8rpx;
  871. }
  872. .name {
  873. font-size: 36rpx;
  874. font-weight: bold;
  875. color: #333;
  876. margin-right: 16rpx;
  877. }
  878. /* 状态胶囊 */
  879. .status-pill {
  880. background-color: #4E4E4E;
  881. border-radius: 24rpx;
  882. display: flex;
  883. align-items: center;
  884. padding: 2rpx 20rpx 2rpx 6rpx;
  885. /* Increased right/left padding to elongate */
  886. }
  887. .status-dot-bg {
  888. width: 24rpx;
  889. /* Smaller icon bg */
  890. height: 24rpx;
  891. background-color: #00E676;
  892. border-radius: 50%;
  893. display: flex;
  894. align-items: center;
  895. justify-content: center;
  896. margin-right: 6rpx;
  897. }
  898. .check-mark {
  899. color: #fff;
  900. font-size: 14rpx;
  901. /* Smaller check */
  902. font-weight: bold;
  903. }
  904. .status-text {
  905. color: #fff;
  906. font-size: 22rpx;
  907. /* Smaller font (11pt) */
  908. margin-right: 6rpx;
  909. font-weight: normal;
  910. }
  911. .status-pill .arrow-down {
  912. color: #fff;
  913. font-size: 10rpx;
  914. /* Half size */
  915. }
  916. .bottom-row {
  917. display: flex;
  918. align-items: center;
  919. font-size: 24rpx;
  920. color: #333;
  921. }
  922. .city-label {
  923. margin-right: 4rpx;
  924. }
  925. .city-arrow {
  926. font-family: monospace;
  927. }
  928. /* 通知铃铛 */
  929. .notification-box {
  930. position: relative;
  931. width: 60rpx;
  932. height: 60rpx;
  933. display: flex;
  934. align-items: center;
  935. justify-content: center;
  936. }
  937. .bell-img {
  938. width: 44rpx;
  939. height: 44rpx;
  940. }
  941. .badge-count {
  942. position: absolute;
  943. top: -4rpx;
  944. right: -4rpx;
  945. background-color: #FF5252;
  946. color: #fff;
  947. font-size: 20rpx;
  948. width: 32rpx;
  949. height: 32rpx;
  950. line-height: 32rpx;
  951. text-align: center;
  952. border-radius: 50%;
  953. border: 2rpx solid #fff;
  954. }
  955. /* 统计卡片 - 悬浮样式 */
  956. .stats-card {
  957. background-color: #fff;
  958. border-radius: 30rpx;
  959. padding: 30rpx 0;
  960. display: flex;
  961. justify-content: space-around;
  962. align-items: center;
  963. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.06);
  964. margin-bottom: 10rpx;
  965. /* 10rpx spacing to task header */
  966. margin-top: -10rpx;
  967. position: relative;
  968. width: 100%;
  969. }
  970. .stat-item {
  971. display: flex;
  972. flex-direction: column;
  973. align-items: center;
  974. flex: 1;
  975. }
  976. .num {
  977. font-size: 40rpx;
  978. /* Increased font size */
  979. font-weight: 800;
  980. color: #333;
  981. margin-bottom: 10rpx;
  982. font-family: Arial, sans-serif;
  983. }
  984. .label {
  985. font-size: 24rpx;
  986. color: #888;
  987. }
  988. .divider {
  989. width: 1px;
  990. height: 40rpx;
  991. background-color: #EEEEEE;
  992. }
  993. /* 任务大厅标题栏 - 吸顶容器 */
  994. .task-header {
  995. position: sticky;
  996. top: calc(100rpx + var(--status-bar-height));
  997. z-index: 90;
  998. margin-top: 0;
  999. margin-bottom: 10rpx;
  1000. width: 100%;
  1001. /* Flex removed, padding removed, handled by inner */
  1002. }
  1003. /* 标题栏内部内容 */
  1004. .header-inner {
  1005. position: relative;
  1006. z-index: 3;
  1007. /* Layer 3: Topmost */
  1008. display: flex;
  1009. justify-content: space-between;
  1010. align-items: center;
  1011. height: 94rpx;
  1012. padding: 0 30rpx;
  1013. background-color: transparent;
  1014. transition: background-color 0.2s;
  1015. }
  1016. .left-title {
  1017. display: flex;
  1018. align-items: center;
  1019. }
  1020. .orange-bar {
  1021. width: 8rpx;
  1022. height: 32rpx;
  1023. background-color: #FF5722;
  1024. border-radius: 4rpx;
  1025. margin-right: 15rpx;
  1026. }
  1027. .left-title .title {
  1028. font-size: 28rpx;
  1029. font-weight: bold;
  1030. color: #333;
  1031. }
  1032. .left-title .count {
  1033. font-size: 24rpx;
  1034. color: #999;
  1035. margin-left: 8rpx;
  1036. font-weight: normal;
  1037. }
  1038. .filter-options {
  1039. display: flex;
  1040. align-items: center;
  1041. font-size: 24rpx;
  1042. color: #666;
  1043. }
  1044. .filter-item {
  1045. margin-left: 30rpx;
  1046. transition: color 0.3s;
  1047. display: flex;
  1048. align-items: center;
  1049. }
  1050. .filter-item.active {
  1051. color: #FF5722;
  1052. font-weight: bold;
  1053. }
  1054. /* Sort Icon Design: Up and Down arrows */
  1055. .sort-icon {
  1056. display: flex;
  1057. flex-direction: column;
  1058. margin-left: 6rpx;
  1059. justify-content: center;
  1060. height: 20rpx;
  1061. }
  1062. .sort-icon .up {
  1063. width: 0;
  1064. height: 0;
  1065. border-left: 6rpx solid transparent;
  1066. border-right: 6rpx solid transparent;
  1067. border-bottom: 6rpx solid #ccc;
  1068. margin-bottom: 2rpx;
  1069. }
  1070. .sort-icon .down {
  1071. width: 0;
  1072. height: 0;
  1073. border-left: 6rpx solid transparent;
  1074. border-right: 6rpx solid transparent;
  1075. border-top: 6rpx solid #ccc;
  1076. }
  1077. .filter-item.active .sort-icon .up.active {
  1078. border-bottom-color: #FF5722;
  1079. }
  1080. .filter-item.active .sort-icon .down.active {
  1081. border-top-color: #FF5722;
  1082. }
  1083. .dropdown {
  1084. display: flex;
  1085. align-items: center;
  1086. margin-left: 30rpx;
  1087. background-color: transparent;
  1088. padding: 6rpx 20rpx;
  1089. border-radius: 30rpx;
  1090. border: none;
  1091. box-shadow: none;
  1092. }
  1093. .dropdown text {
  1094. margin-left: 0;
  1095. font-size: 24rpx;
  1096. color: #333;
  1097. }
  1098. .dropdown .arrow-down {
  1099. font-size: 18rpx;
  1100. margin-left: 6rpx;
  1101. color: #999;
  1102. }
  1103. /* 任务大厅列表 */
  1104. .task-list {
  1105. padding: 0 30rpx;
  1106. width: 100%;
  1107. }
  1108. /* 任务卡片优化 */
  1109. .task-card {
  1110. background-color: #fff;
  1111. border-radius: 24rpx;
  1112. padding: 20rpx 20rpx;
  1113. margin-bottom: 20rpx;
  1114. box-shadow: 0 5rpx 20rpx rgba(0, 0, 0, 0.04);
  1115. width: 100%;
  1116. }
  1117. .card-header {
  1118. display: flex;
  1119. justify-content: space-between;
  1120. align-items: center;
  1121. margin-bottom: 15rpx;
  1122. }
  1123. .type-badge {
  1124. display: flex;
  1125. align-items: center;
  1126. }
  1127. .type-icon {
  1128. width: 44rpx;
  1129. height: 44rpx;
  1130. margin-right: 15rpx;
  1131. background-color: #FFF3E0;
  1132. border-radius: 50%;
  1133. padding: 6rpx;
  1134. box-sizing: border-box;
  1135. }
  1136. .type-text {
  1137. font-size: 28rpx;
  1138. font-weight: bold;
  1139. color: #333;
  1140. }
  1141. .price {
  1142. font-size: 28rpx;
  1143. font-weight: bold;
  1144. color: #FF5252;
  1145. }
  1146. .time-row {
  1147. font-size: 26rpx;
  1148. color: #666;
  1149. margin-bottom: 20rpx;
  1150. }
  1151. .time-row .value {
  1152. color: #333;
  1153. margin-left: 10rpx;
  1154. }
  1155. /* 宠物卡片 */
  1156. .pet-card {
  1157. background-color: #FFF8F0;
  1158. border-radius: 16rpx;
  1159. padding: 15rpx 20rpx;
  1160. display: flex;
  1161. align-items: center;
  1162. margin-bottom: 30rpx;
  1163. }
  1164. .pet-avatar {
  1165. width: 80rpx;
  1166. height: 80rpx;
  1167. border-radius: 50%;
  1168. margin-right: 20rpx;
  1169. }
  1170. .pet-info {
  1171. flex: 1;
  1172. display: flex;
  1173. flex-direction: column;
  1174. }
  1175. .pet-name {
  1176. font-size: 28rpx;
  1177. font-weight: bold;
  1178. color: #333;
  1179. margin-bottom: 5rpx;
  1180. }
  1181. .pet-breed {
  1182. font-size: 24rpx;
  1183. color: #999;
  1184. }
  1185. .pet-profile-btn {
  1186. font-size: 24rpx;
  1187. color: #FF9800;
  1188. border: 1px solid #FF9800;
  1189. padding: 6rpx 20rpx;
  1190. border-radius: 50rpx;
  1191. background-color: #fff;
  1192. }
  1193. /* 路线信息 */
  1194. .route-info {
  1195. margin-bottom: 20rpx;
  1196. }
  1197. .route-item {
  1198. display: flex;
  1199. align-items: flex-start;
  1200. padding-bottom: 20rpx;
  1201. position: relative;
  1202. width: 100%;
  1203. }
  1204. /* 路线项底部的间隔 */
  1205. .route-item:not(:last-child) {
  1206. margin-bottom: 16rpx;
  1207. }
  1208. .route-item:last-child {
  1209. padding-bottom: 0;
  1210. margin-bottom: 0;
  1211. }
  1212. .route-line-vertical {
  1213. position: absolute;
  1214. left: 19rpx;
  1215. top: 46rpx;
  1216. bottom: -15rpx;
  1217. /* Adjusted to connect the now-closer nodes */
  1218. border-left: 2rpx dashed #E0E0E0;
  1219. width: 0;
  1220. z-index: 0;
  1221. }
  1222. .icon-circle {
  1223. width: 40rpx;
  1224. height: 40rpx;
  1225. border-radius: 50%;
  1226. color: #fff;
  1227. font-size: 22rpx;
  1228. display: flex;
  1229. align-items: center;
  1230. justify-content: center;
  1231. margin-right: 20rpx;
  1232. flex-shrink: 0;
  1233. font-weight: bold;
  1234. margin-top: 6rpx;
  1235. position: relative;
  1236. z-index: 1;
  1237. /* Above line */
  1238. }
  1239. .icon-circle.start {
  1240. background-color: #FFB74D;
  1241. }
  1242. .icon-circle.end {
  1243. background-color: #81C784;
  1244. }
  1245. .icon-circle.service {
  1246. background-color: #81C784;
  1247. }
  1248. .address-box {
  1249. flex: 1;
  1250. display: flex;
  1251. flex-direction: column;
  1252. padding-right: 20rpx;
  1253. width: 0;
  1254. }
  1255. .addr-title-row {
  1256. display: flex;
  1257. align-items: center;
  1258. justify-content: space-between;
  1259. }
  1260. .addr-title {
  1261. font-size: 28rpx;
  1262. font-weight: bold;
  1263. color: #333;
  1264. margin-bottom: 6rpx;
  1265. flex: 1;
  1266. }
  1267. .phone-call-btn {
  1268. width: 48rpx;
  1269. height: 48rpx;
  1270. display: flex;
  1271. align-items: center;
  1272. justify-content: center;
  1273. background-color: #E8F5E9;
  1274. border-radius: 50%;
  1275. margin-left: 10rpx;
  1276. transition: transform 0.1s;
  1277. }
  1278. .phone-call-btn:active {
  1279. transform: scale(0.9);
  1280. background-color: #C8E6C9;
  1281. }
  1282. .phone-icon-item {
  1283. width: 28rpx;
  1284. height: 28rpx;
  1285. }
  1286. .addr-desc {
  1287. font-size: 24rpx;
  1288. color: #999;
  1289. line-height: normal;
  1290. }
  1291. .distance-tag {
  1292. display: flex;
  1293. align-items: center;
  1294. background-color: #FFF3E0;
  1295. padding: 6rpx 6rpx 6rpx 12rpx;
  1296. border-radius: 30rpx;
  1297. flex-shrink: 0;
  1298. }
  1299. .distance-tag text {
  1300. font-size: 24rpx;
  1301. color: #FF5722;
  1302. margin-right: 5rpx;
  1303. font-weight: normal;
  1304. }
  1305. .nav-arrow {
  1306. width: 32rpx;
  1307. height: 32rpx;
  1308. }
  1309. .service-content {
  1310. margin-top: -10rpx;
  1311. /* Shifted up using negative margin for max compactness */
  1312. font-size: 24rpx;
  1313. /* 12pt */
  1314. color: #666;
  1315. padding-left: 60rpx;
  1316. }
  1317. .content-label {
  1318. color: #999;
  1319. margin-right: 10rpx;
  1320. }
  1321. /* 备注 */
  1322. .remark-box {
  1323. background-color: #F8F8F8;
  1324. padding: 15rpx 20rpx;
  1325. border-radius: 8rpx;
  1326. font-size: 24rpx;
  1327. color: #666;
  1328. margin-bottom: 20rpx;
  1329. }
  1330. /* 按钮组 */
  1331. .action-btns {
  1332. display: flex;
  1333. justify-content: space-between;
  1334. }
  1335. .btn {
  1336. height: 64rpx;
  1337. /* Increased height */
  1338. line-height: 64rpx;
  1339. border-radius: 32rpx;
  1340. /* Matches height/2 */
  1341. font-size: 28rpx;
  1342. /* Slightly larger */
  1343. font-weight: normal;
  1344. width: 48%;
  1345. }
  1346. .btn::after {
  1347. border: none;
  1348. }
  1349. .btn.reject {
  1350. background-color: #F5F5F5;
  1351. color: #999;
  1352. box-shadow: none;
  1353. }
  1354. .btn.accept {
  1355. background: linear-gradient(90deg, #FF9800 0%, #FF5722 100%);
  1356. color: #fff;
  1357. box-shadow: 0 5rpx 15rpx rgba(255, 87, 34, 0.3);
  1358. }
  1359. .bg-circle-right {
  1360. position: absolute;
  1361. top: -20rpx;
  1362. right: -20rpx;
  1363. width: 185rpx;
  1364. /* +20rpx */
  1365. height: 185rpx;
  1366. /* +20rpx */
  1367. border-radius: 50%;
  1368. background-color: rgba(255, 218, 185, 0.8);
  1369. /* 80% opacity */
  1370. }
  1371. /* 筛选面板 (Absolute Child) */
  1372. .filter-panel {
  1373. position: absolute;
  1374. /* Relative to .task-header */
  1375. top: 94rpx;
  1376. /* Start right below header */
  1377. left: 0;
  1378. width: 100%;
  1379. background-color: #fff;
  1380. z-index: 2;
  1381. /* Layer 2: Below inner(3), Above mask(1) */
  1382. padding: 30rpx 30rpx 40rpx;
  1383. border-bottom-left-radius: 30rpx;
  1384. border-bottom-right-radius: 30rpx;
  1385. box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.1);
  1386. transform: translateY(-20rpx);
  1387. /* Slightly tucked start */
  1388. opacity: 0;
  1389. transition: all 0.25s ease-out;
  1390. visibility: hidden;
  1391. }
  1392. .filter-panel.show {
  1393. transform: translateY(0);
  1394. opacity: 1;
  1395. visibility: visible;
  1396. }
  1397. /* 筛选遮罩 (Absolute Child) */
  1398. .filter-mask {
  1399. position: absolute;
  1400. top: 94rpx;
  1401. /* Start below header */
  1402. left: 0;
  1403. right: 0;
  1404. height: 100vh;
  1405. /* Cover visible area below */
  1406. background-color: rgba(0, 0, 0, 0.5);
  1407. z-index: 1;
  1408. /* Layer 1: Lowest in header */
  1409. }
  1410. .filter-section {
  1411. margin-bottom: 40rpx;
  1412. }
  1413. .section-title {
  1414. font-size: 28rpx;
  1415. font-weight: bold;
  1416. color: #333;
  1417. margin-bottom: 20rpx;
  1418. display: block;
  1419. }
  1420. .options-grid {
  1421. display: flex;
  1422. flex-wrap: wrap;
  1423. gap: 20rpx;
  1424. }
  1425. .option-btn {
  1426. width: calc(33.33% - 14rpx);
  1427. /* 3 cols with gap */
  1428. height: 64rpx;
  1429. line-height: 64rpx;
  1430. text-align: center;
  1431. border-radius: 32rpx;
  1432. font-size: 26rpx;
  1433. color: #666;
  1434. background-color: #fff;
  1435. border: 2rpx solid #E0E0E0;
  1436. margin-bottom: 10rpx;
  1437. }
  1438. .option-btn.active {
  1439. color: #FF5722;
  1440. background-color: #FFF3E0;
  1441. border-color: #FF5722;
  1442. font-weight: bold;
  1443. }
  1444. .filter-actions {
  1445. display: flex;
  1446. justify-content: space-between;
  1447. margin-top: 50rpx;
  1448. }
  1449. .action-btn {
  1450. width: 48%;
  1451. height: 64rpx;
  1452. /* Match .btn */
  1453. line-height: 64rpx;
  1454. border-radius: 32rpx;
  1455. /* Match .btn */
  1456. font-size: 28rpx;
  1457. /* Match .btn */
  1458. font-weight: normal;
  1459. /* Match .btn */
  1460. }
  1461. .action-btn::after {
  1462. border: none;
  1463. }
  1464. .action-btn.reset {
  1465. background-color: #F5F5F5;
  1466. color: #999;
  1467. /* Match light gray */
  1468. }
  1469. .action-btn.confirm {
  1470. background: linear-gradient(90deg, #FF9800 0%, #FF5722 100%);
  1471. color: #fff;
  1472. box-shadow: 0 5rpx 15rpx rgba(255, 87, 34, 0.3);
  1473. }
  1474. /* 状态胶囊 */
  1475. .status-pill {
  1476. display: flex;
  1477. align-items: center;
  1478. background-color: #333333;
  1479. /* Dark background */
  1480. border-radius: 20rpx;
  1481. padding: 4rpx 16rpx 4rpx 8rpx;
  1482. margin-left: 16rpx;
  1483. transition: background-color 0.3s;
  1484. }
  1485. .status-pill.resting {
  1486. background-color: #424242;
  1487. /* Slightly lighter dark */
  1488. }
  1489. .status-dot-bg {
  1490. width: 24rpx;
  1491. height: 24rpx;
  1492. background-color: #4CAF50;
  1493. border-radius: 50%;
  1494. margin-right: 6rpx;
  1495. display: flex;
  1496. justify-content: center;
  1497. align-items: center;
  1498. }
  1499. .check-mark {
  1500. color: #fff;
  1501. font-size: 14rpx;
  1502. font-weight: bold;
  1503. }
  1504. .status-pill.resting .status-dot-bg {
  1505. background-color: #FF5722;
  1506. /* Warning color for resting */
  1507. }
  1508. .status-icon {
  1509. width: 24rpx;
  1510. height: 24rpx;
  1511. margin-right: 6rpx;
  1512. }
  1513. .status-text {
  1514. font-size: 22rpx;
  1515. color: #fff;
  1516. margin-right: 6rpx;
  1517. }
  1518. .status-pill .arrow-down {
  1519. color: #fff;
  1520. font-size: 10rpx;
  1521. /* Reduced size */
  1522. margin-left: 4rpx;
  1523. /* Adjust spacing */
  1524. }
  1525. /* 空状态 - 休息中 */
  1526. .empty-state {
  1527. display: flex;
  1528. flex-direction: column;
  1529. align-items: center;
  1530. justify-content: center;
  1531. padding-top: 150rpx;
  1532. }
  1533. .empty-icon {
  1534. width: 200rpx;
  1535. height: 200rpx;
  1536. margin-bottom: 40rpx;
  1537. opacity: 0.5;
  1538. }
  1539. .empty-text {
  1540. font-size: 28rpx;
  1541. color: #666;
  1542. margin-bottom: 60rpx;
  1543. }
  1544. .start-work-btn {
  1545. width: 300rpx;
  1546. height: 80rpx;
  1547. line-height: 80rpx;
  1548. background: linear-gradient(90deg, #FF9800 0%, #FF5722 100%);
  1549. border-radius: 40rpx;
  1550. color: #fff;
  1551. font-size: 30rpx;
  1552. font-weight: bold;
  1553. box-shadow: 0 5rpx 15rpx rgba(255, 87, 34, 0.3);
  1554. }
  1555. /* 自定义确认弹窗 */
  1556. .modal-mask {
  1557. position: fixed;
  1558. top: 0;
  1559. left: 0;
  1560. right: 0;
  1561. bottom: 0;
  1562. background-color: rgba(0, 0, 0, 0.5);
  1563. z-index: 999;
  1564. display: flex;
  1565. align-items: center;
  1566. justify-content: center;
  1567. }
  1568. .custom-modal {
  1569. width: 600rpx;
  1570. background-color: #fff;
  1571. border-radius: 24rpx;
  1572. padding: 40rpx 50rpx;
  1573. display: flex;
  1574. flex-direction: column;
  1575. align-items: center;
  1576. }
  1577. .modal-title {
  1578. font-size: 36rpx;
  1579. font-weight: bold;
  1580. color: #333;
  1581. margin-bottom: 30rpx;
  1582. }
  1583. .modal-content {
  1584. font-size: 30rpx;
  1585. color: #666;
  1586. margin-bottom: 50rpx;
  1587. text-align: center;
  1588. }
  1589. .modal-btns {
  1590. width: 100%;
  1591. display: flex;
  1592. justify-content: space-between;
  1593. }
  1594. .modal-btn {
  1595. width: 45%;
  1596. height: 80rpx;
  1597. line-height: 80rpx;
  1598. border-radius: 40rpx;
  1599. font-size: 30rpx;
  1600. font-weight: bold;
  1601. margin: 0;
  1602. }
  1603. .modal-btn::after {
  1604. border: none;
  1605. }
  1606. .modal-btn.cancel {
  1607. background-color: #F5F5F5;
  1608. color: #999;
  1609. }
  1610. .modal-btn.confirm {
  1611. background: linear-gradient(90deg, #FF9800 0%, #FF5722 100%);
  1612. color: #fff;
  1613. box-shadow: 0 5rpx 15rpx rgba(255, 87, 34, 0.3);
  1614. }
  1615. /* 宠物档案弹窗 */
  1616. .pet-modal-mask {
  1617. position: fixed;
  1618. top: 0;
  1619. left: 0;
  1620. right: 0;
  1621. bottom: 0;
  1622. background-color: rgba(0, 0, 0, 0.4);
  1623. z-index: 1000;
  1624. display: flex;
  1625. align-items: center;
  1626. justify-content: center;
  1627. }
  1628. .pet-modal-content {
  1629. width: 680rpx;
  1630. height: 85vh;
  1631. background-color: #fff;
  1632. border-radius: 20rpx;
  1633. display: flex;
  1634. flex-direction: column;
  1635. overflow: hidden;
  1636. }
  1637. .pet-modal-header {
  1638. display: flex;
  1639. align-items: center;
  1640. justify-content: space-between;
  1641. padding: 30rpx;
  1642. border-bottom: 1rpx solid #F0F0F0;
  1643. }
  1644. .pet-modal-title {
  1645. font-size: 34rpx;
  1646. font-weight: bold;
  1647. color: #333;
  1648. }
  1649. .pet-modal-scroll {
  1650. flex: 1;
  1651. height: 0;
  1652. padding: 30rpx;
  1653. box-sizing: border-box;
  1654. }
  1655. .pet-base-info {
  1656. display: flex;
  1657. align-items: center;
  1658. margin-bottom: 40rpx;
  1659. }
  1660. .pm-avatar {
  1661. width: 120rpx;
  1662. height: 120rpx;
  1663. border-radius: 50%;
  1664. margin-right: 30rpx;
  1665. border: 2rpx solid #f5f5f5;
  1666. }
  1667. .pm-info-text {
  1668. flex: 1;
  1669. display: flex;
  1670. flex-direction: column;
  1671. }
  1672. .pm-name-row {
  1673. display: flex;
  1674. align-items: center;
  1675. margin-bottom: 15rpx;
  1676. }
  1677. .pm-name {
  1678. font-size: 36rpx;
  1679. font-weight: bold;
  1680. color: #333;
  1681. margin-right: 20rpx;
  1682. }
  1683. .pm-gender {
  1684. display: flex;
  1685. align-items: center;
  1686. background-color: #E3F2FD;
  1687. padding: 4rpx 12rpx;
  1688. border-radius: 20rpx;
  1689. }
  1690. .pm-gender text {
  1691. font-size: 22rpx;
  1692. color: #1E88E5;
  1693. }
  1694. .pm-gender .gender-icon {
  1695. font-weight: bold;
  1696. margin-right: 4rpx;
  1697. }
  1698. .pm-gender.female {
  1699. background-color: #FCE4EC;
  1700. }
  1701. .pm-gender.female text {
  1702. color: #D81B60;
  1703. }
  1704. .pm-breed {
  1705. font-size: 26rpx;
  1706. color: #999;
  1707. }
  1708. .pm-detail-grid {
  1709. display: flex;
  1710. flex-wrap: wrap;
  1711. justify-content: space-between;
  1712. }
  1713. .pm-grid-item {
  1714. background-color: #F8F8F8;
  1715. border-radius: 16rpx;
  1716. padding: 24rpx;
  1717. margin-bottom: 20rpx;
  1718. display: flex;
  1719. flex-direction: column;
  1720. }
  1721. .pm-grid-item.half {
  1722. width: 48%;
  1723. box-sizing: border-box;
  1724. }
  1725. .pm-grid-item.full {
  1726. width: 100%;
  1727. box-sizing: border-box;
  1728. }
  1729. .pm-label {
  1730. font-size: 24rpx;
  1731. color: #999;
  1732. margin-bottom: 10rpx;
  1733. }
  1734. .pm-val {
  1735. font-size: 28rpx;
  1736. color: #333;
  1737. font-weight: 500;
  1738. }
  1739. .pm-tags {
  1740. display: flex;
  1741. flex-wrap: wrap;
  1742. gap: 20rpx;
  1743. margin-bottom: 40rpx;
  1744. }
  1745. .pm-tag {
  1746. background-color: #FFF8EB;
  1747. border: 2rpx solid #FFCC80;
  1748. color: #FF9800;
  1749. font-size: 22rpx;
  1750. padding: 8rpx 24rpx;
  1751. border-radius: 30rpx;
  1752. }
  1753. .pm-section-title {
  1754. display: flex;
  1755. align-items: center;
  1756. margin-bottom: 30rpx;
  1757. padding-top: 30rpx;
  1758. border-top: 2rpx dashed #F0F0F0;
  1759. }
  1760. .pm-section-title .orange-bar {
  1761. width: 8rpx;
  1762. height: 32rpx;
  1763. background-color: #FF9800;
  1764. margin-right: 16rpx;
  1765. border-radius: 4rpx;
  1766. }
  1767. .pm-section-title text {
  1768. font-size: 30rpx;
  1769. font-weight: bold;
  1770. color: #333;
  1771. }
  1772. .pm-log-list {
  1773. display: flex;
  1774. flex-direction: column;
  1775. }
  1776. .pm-log-item {
  1777. display: flex;
  1778. flex-direction: column;
  1779. padding: 24rpx 0;
  1780. border-bottom: 1rpx solid #F0F0F0;
  1781. }
  1782. .pm-log-item:last-child {
  1783. border-bottom: none;
  1784. }
  1785. .pm-log-date {
  1786. font-size: 24rpx;
  1787. color: #999;
  1788. margin-bottom: 16rpx;
  1789. }
  1790. .pm-log-text {
  1791. font-size: 28rpx;
  1792. color: #333;
  1793. line-height: 1.6;
  1794. margin-bottom: 20rpx;
  1795. }
  1796. .pm-log-recorder {
  1797. font-size: 24rpx;
  1798. color: #FF9800;
  1799. align-self: flex-end;
  1800. }
  1801. /* 拒绝接单弹窗输入区域 */
  1802. .textarea-container {
  1803. padding: 0 4rpx;
  1804. width: 100%;
  1805. position: relative;
  1806. margin-bottom: 20rpx;
  1807. }
  1808. .reject-textarea {
  1809. width: 100%;
  1810. height: 240rpx;
  1811. background-color: #F9F9F9;
  1812. border: 1rpx solid #E0E0E0;
  1813. border-radius: 16rpx;
  1814. padding: 24rpx;
  1815. padding-bottom: 60rpx;
  1816. font-size: 28rpx;
  1817. line-height: 1.6;
  1818. box-sizing: border-box;
  1819. transition: all 0.3s;
  1820. }
  1821. .reject-textarea:focus {
  1822. border-color: #FF9800;
  1823. background-color: #fff;
  1824. }
  1825. .char-count {
  1826. position: absolute;
  1827. right: 44rpx;
  1828. bottom: 24rpx;
  1829. font-size: 22rpx;
  1830. color: #999;
  1831. }
  1832. .modal-btn.confirm.disabled {
  1833. background: #FFD180;
  1834. box-shadow: none;
  1835. opacity: 0.8;
  1836. }
  1837. .mt-30 {
  1838. margin-top: 30rpx;
  1839. }
  1840. /* 宠物档案底部关闭按钮 */
  1841. .pm-bottom-close {
  1842. width: 100%;
  1843. height: 80rpx;
  1844. line-height: 80rpx;
  1845. background-color: #F5F5F5;
  1846. color: #666;
  1847. border-radius: 40rpx;
  1848. font-size: 30rpx;
  1849. font-weight: bold;
  1850. margin: 0;
  1851. }
  1852. .pm-bottom-close::after {
  1853. border: none;
  1854. }
  1855. /* 宠物档案原生关闭图标 */
  1856. .close-icon-btn {
  1857. font-size: 48rpx;
  1858. color: #999;
  1859. line-height: 1;
  1860. padding: 0 10rpx;
  1861. }
  1862. /* 确认接单弹窗内容 */
  1863. .modal-content-box {
  1864. display: flex;
  1865. flex-direction: column;
  1866. align-items: center;
  1867. margin-bottom: 20rpx;
  1868. }
  1869. .modal-content-main {
  1870. font-size: 30rpx;
  1871. color: #333;
  1872. margin-bottom: 16rpx;
  1873. }
  1874. .modal-content-sub {
  1875. font-size: 24rpx;
  1876. color: #999;
  1877. }
  1878. /* 地图导航 Action Sheet */
  1879. .nav-modal-mask {
  1880. position: fixed;
  1881. top: 0;
  1882. left: 0;
  1883. right: 0;
  1884. bottom: 0;
  1885. background-color: rgba(0, 0, 0, 0.5);
  1886. z-index: 1000;
  1887. display: flex;
  1888. flex-direction: column;
  1889. justify-content: flex-end;
  1890. }
  1891. .nav-action-sheet {
  1892. background-color: #fff;
  1893. width: 100%;
  1894. border-top-left-radius: 24rpx;
  1895. border-top-right-radius: 24rpx;
  1896. overflow: hidden;
  1897. padding-bottom: constant(safe-area-inset-bottom);
  1898. padding-bottom: env(safe-area-inset-bottom);
  1899. }
  1900. .nav-sheet-title {
  1901. text-align: center;
  1902. padding: 30rpx 0;
  1903. font-size: 13px;
  1904. color: #999;
  1905. border-bottom: 1rpx solid #efefef;
  1906. }
  1907. .nav-sheet-item {
  1908. text-align: center;
  1909. padding: 30rpx 0;
  1910. font-size: 13px;
  1911. color: #333;
  1912. background-color: #fff;
  1913. border-bottom: 1rpx solid #efefef;
  1914. }
  1915. .nav-sheet-item.cancel {
  1916. border-bottom: none;
  1917. color: #666;
  1918. }
  1919. .nav-sheet-gap {
  1920. height: 16rpx;
  1921. background-color: #F8F8F8;
  1922. }
  1923. </style>