index.vue 59 KB

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