index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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' }"
  21. @click="goToWorkStatus">
  22. <view class="status-dot-bg" :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' ? '正在休息' : '已禁用') }}</text>
  27. <text class="arrow-down">▼</text>
  28. </view>
  29. </view>
  30. <view class="bottom-row" @click="handleManualLocation">
  31. <text class="city-label">接单城市:{{ profile?.cityName || '暂无' }}</text>
  32. <text class="city-arrow">></text>
  33. </view>
  34. </view>
  35. <!-- <view class="notification-box">
  36. <image class="bell-img" src="/static/icons/bell.svg"></image>
  37. <view class="badge-count">2</view>
  38. </view> -->
  39. </view>
  40. <!-- 统计卡片 -->
  41. <view class="stats-card">
  42. <view class="stat-item">
  43. <text class="num">{{ orderStats.total }}</text>
  44. <text class="label">全部订单</text>
  45. </view>
  46. <view class="divider"></view>
  47. <view class="stat-item">
  48. <text class="num">{{ orderStats.reject }}</text>
  49. <text class="label">拒接订单</text>
  50. </view>
  51. <view class="divider"></view>
  52. <view class="stat-item">
  53. <text class="num">{{ orderStats.completed }}</text>
  54. <text class="label">完成订单</text>
  55. </view>
  56. <view class="divider"></view>
  57. <view class="stat-item">
  58. <text class="num">{{ (orderStats.price / 100).toFixed(2) }}</text>
  59. <text class="label">服务总得</text>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 任务大厅标题栏 (Sticky Container) -->
  64. <view class="task-header">
  65. <!-- 标题栏内容 (Inner) -->
  66. <view class="header-inner"
  67. :style="{ backgroundColor: (scrollTop > 300 || isFilterShow) ? '#fff' : 'transparent' }">
  68. <view class="left-title">
  69. <view class="orange-bar"></view>
  70. <text class="title">任务大厅</text>
  71. <text class="count">- ({{ taskList.length }}单)</text>
  72. </view>
  73. <view class="filter-options">
  74. <view class="dropdown" @click="showFilterDropdown">
  75. <text>筛选条件</text>
  76. <text class="arrow-down">﹀</text>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 筛选遮罩 (Absolute Child: Starts below header) -->
  81. <view class="filter-mask" v-if="isFilterShow" @click="closeFilter"></view>
  82. <!-- 筛选下拉面板 (Absolute Child) -->
  83. <view class="filter-panel" :class="{ show: isFilterShow }">
  84. <view class="filter-section">
  85. <text class="section-title">服务类型</text>
  86. <view class="options-grid">
  87. <view class="option-btn" :class="{ active: tempFilter.service === null }"
  88. @click="selectService(null)">全部</view>
  89. <view class="option-btn" v-for="item in serviceList" :key="item.id"
  90. :class="{ active: tempFilter.service === item.id }" @click="selectService(item.id)">{{
  91. item.name }}</view>
  92. </view>
  93. </view>
  94. <view class="filter-section">
  95. <text class="section-title">金额</text>
  96. <view class="options-grid">
  97. <view class="option-btn" :class="{ active: tempFilter.amount === '全部' }"
  98. @click="selectAmount('全部')">全部</view>
  99. <view class="option-btn" :class="{ active: tempFilter.amount === '100以下' }"
  100. @click="selectAmount('100以下')">100以下</view>
  101. <view class="option-btn" :class="{ active: tempFilter.amount === '100-200' }"
  102. @click="selectAmount('100-200')">100-200</view>
  103. <view class="option-btn" :class="{ active: tempFilter.amount === '200-500' }"
  104. @click="selectAmount('200-500')">200-500</view>
  105. <view class="option-btn" :class="{ active: tempFilter.amount === '500以上' }"
  106. @click="selectAmount('500以上')">500以上</view>
  107. </view>
  108. </view>
  109. <view class="filter-actions">
  110. <button class="action-btn reset" @click="resetFilter">重置</button>
  111. <button class="action-btn confirm" @click="confirmFilter">确认</button>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 列表容器 -->
  116. <view class="task-list-container">
  117. <!-- 任务列表 -->
  118. <view class="task-list">
  119. <view class="task-card" v-for="item in taskList" :key="item.id" @click="goToDetail(item)">
  120. <view class="card-header">
  121. <view class="type-badge">
  122. <image class="type-icon" :src="item.typeIcon"></image>
  123. <text class="type-text">{{ item.typeText }}</text>
  124. </view>
  125. <text class="price">¥{{ item.price }}</text>
  126. </view>
  127. <view class="card-body">
  128. <view class="time-row">
  129. <text class="label">{{ item.timeLabel }}:</text>
  130. <text class="value">{{ item.time }}</text>
  131. </view>
  132. <view class="pet-card">
  133. <image class="pet-avatar" :src="item.petAvatarUrl || item.petAvatar" mode="aspectFill"></image>
  134. <view class="pet-info">
  135. <text class="pet-name">{{ item.petName }}</text>
  136. <text class="pet-breed">品种: {{ item.petBreed }}</text>
  137. </view>
  138. </view>
  139. <view class="route-info">
  140. <template v-if="item.type === 1">
  141. <view class="route-item" @click.stop="openNavigation(item, 'start')">
  142. <view class="icon-circle start">起</view>
  143. <view class="route-line-vertical"></view>
  144. <view class="address-box">
  145. <text class="addr-title">{{ item.startLocation }}</text>
  146. <text class="addr-desc">{{ item.startAddress }}</text>
  147. </view>
  148. <image class="nav-arrow" src="/static/icons/nav_arrow.svg" style="flex-shrink: 0; align-self: center;"></image>
  149. </view>
  150. <view class="route-item" @click.stop="openNavigation(item, 'end')">
  151. <view class="icon-circle end">终</view>
  152. <view class="address-box">
  153. <text class="addr-title">{{ item.endLocation }}</text>
  154. <text class="addr-desc">{{ item.endAddress }}</text>
  155. </view>
  156. <image class="nav-arrow" src="/static/icons/nav_arrow.svg" style="flex-shrink: 0; align-self: center;"></image>
  157. </view>
  158. </template>
  159. <template v-else>
  160. <view class="route-item" @click.stop="openNavigation(item, 'end')">
  161. <view class="icon-circle service">服</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" style="flex-shrink: 0; align-self: center;"></image>
  167. </view>
  168. <view class="service-content" v-if="item.serviceContent">
  169. <text class="content-label">服务内容:</text>
  170. <text>{{ item.serviceContent }}</text>
  171. </view>
  172. </template>
  173. </view>
  174. <view class="remark-box" v-if="item.remark">
  175. <text>备注:{{ item.remark }}</text>
  176. </view>
  177. </view>
  178. <!-- action-btns class is in style.css but template used card-footer. style.css: .action-btns, index.vue: .card-footer -->
  179. <!-- Wait, style.css has .action-btns { display: flex; ... } and .btn.reject/accept -->
  180. <!-- I should use .action-btns instead of .card-footer -->
  181. <view class="action-btns">
  182. <button class="btn reject" @click.stop="openRejectModal(item)">拒绝</button>
  183. <button class="btn accept" @click.stop="openAcceptModal(item)">接单</button>
  184. </view>
  185. </view>
  186. <!-- Padding for safe area/tabbar -->
  187. <view style="height: 120rpx;"></view>
  188. </view>
  189. </view>
  190. <!-- 自定义确认弹窗 -->
  191. <view class="modal-mask" v-if="showConfirmModal">
  192. <view class="custom-modal">
  193. <text class="modal-title">提示</text>
  194. <text class="modal-content">是否确定结束休息,开始接单?</text>
  195. <view class="modal-btns">
  196. <button class="modal-btn cancel" @click="closeConfirmModal">取消</button>
  197. <button class="modal-btn confirm" @click="confirmStartWork">确定</button>
  198. </view>
  199. </view>
  200. </view>
  201. <!-- 宠物档案弹窗 -->
  202. <view class="pet-modal-mask" v-if="showPetModal" @click="closePetProfile">
  203. <view class="pet-modal-content" @click.stop>
  204. <view class="pet-modal-header">
  205. <text class="pet-modal-title">宠物档案</text>
  206. <view class="close-icon-btn" @click="closePetProfile">×</view>
  207. </view>
  208. <scroll-view scroll-y class="pet-modal-scroll">
  209. <!-- Basic Info -->
  210. <view class="pet-base-info">
  211. <image class="pm-avatar" :src="currentPetInfo.petAvatar" mode="aspectFill"></image>
  212. <view class="pm-info-text">
  213. <view class="pm-name-row">
  214. <text class="pm-name">{{ currentPetInfo.petName }}</text>
  215. <!-- Gender badge -->
  216. <view class="pm-gender" v-if="currentPetInfo.petGender === 'M'">
  217. <text class="gender-icon">♂</text>
  218. <text>公</text>
  219. </view>
  220. <view class="pm-gender female" v-else-if="currentPetInfo.petGender === 'F'">
  221. <text class="gender-icon">♀</text>
  222. <text>母</text>
  223. </view>
  224. </view>
  225. <text class="pm-breed">品种:{{ currentPetInfo.petBreed }}</text>
  226. </view>
  227. </view>
  228. <!-- Details Grid -->
  229. <view class="pm-detail-grid">
  230. <view class="pm-grid-item half">
  231. <text class="pm-label">年龄</text>
  232. <text class="pm-val">{{ currentPetInfo.petAge || '未知' }}</text>
  233. </view>
  234. <view class="pm-grid-item half">
  235. <text class="pm-label">体重</text>
  236. <text class="pm-val">{{ currentPetInfo.petWeight || '未知' }}</text>
  237. </view>
  238. <view class="pm-grid-item full">
  239. <text class="pm-label">性格</text>
  240. <text class="pm-val">{{ currentPetInfo.petPersonality || '无' }}</text>
  241. </view>
  242. <view class="pm-grid-item full">
  243. <text class="pm-label">爱好</text>
  244. <text class="pm-val">{{ currentPetInfo.petHobby || '无' }}</text>
  245. </view>
  246. <view class="pm-grid-item full">
  247. <text class="pm-label">备注</text>
  248. <text class="pm-val">{{ currentPetInfo.petRemark || '无特殊过敏史' }}</text>
  249. </view>
  250. </view>
  251. <!-- Tags -->
  252. <view class="pm-tags" v-if="currentPetInfo.petTags && currentPetInfo.petTags.length > 0">
  253. <view class="pm-tag" v-for="(tag, index) in currentPetInfo.petTags" :key="index">{{ tag }}
  254. </view>
  255. </view>
  256. <!-- Log Section -->
  257. <view class="pm-section-title">
  258. <view class="orange-bar"></view>
  259. <text>备注日志</text>
  260. </view>
  261. <view class="pm-log-list">
  262. <view class="pm-log-item" v-for="(log, lIndex) in currentPetInfo.petLogs" :key="lIndex">
  263. <text class="pm-log-date">{{ log.date }}</text>
  264. <text class="pm-log-text">{{ log.content }}</text>
  265. <text class="pm-log-recorder">{{ log.recorder === '系统记录' ? '' : '记录人: ' }}{{ log.recorder
  266. }}</text>
  267. </view>
  268. </view>
  269. <view style="height: 40rpx;"></view>
  270. <button class="pm-bottom-close" @click="closePetProfile">关闭</button>
  271. <view style="height: 20rpx;"></view>
  272. </scroll-view>
  273. </view>
  274. </view>
  275. </view>
  276. <!-- 拒绝接单弹窗 -->
  277. <view class="modal-mask" v-if="showRejectModal">
  278. <view class="custom-modal">
  279. <text class="modal-title">拒绝接单</text>
  280. <textarea class="reject-textarea" v-model="rejectReason" placeholder="请输入拒绝理由(必填)"
  281. maxlength="100"></textarea>
  282. <view class="modal-btns mt-30">
  283. <button class="modal-btn cancel" @click="closeRejectModal">取消</button>
  284. <button class="modal-btn confirm" @click="confirmReject">提交</button>
  285. </view>
  286. </view>
  287. </view>
  288. <!-- 确认接单弹窗 -->
  289. <view class="modal-mask" v-if="showAcceptConfirmModal">
  290. <view class="custom-modal">
  291. <text class="modal-title">接单确认</text>
  292. <view class="modal-content-box">
  293. <text class="modal-content-main">请确认是否接收此订单?</text>
  294. <text class="modal-content-sub">接单后请尽快通过电话联系用户</text>
  295. </view>
  296. <view class="modal-btns mt-30">
  297. <button class="modal-btn cancel" @click="closeAcceptModal">再想想</button>
  298. <button class="modal-btn confirm" @click="confirmAccept">确认接单</button>
  299. </view>
  300. </view>
  301. </view>
  302. <!-- 选择地图导航弹窗 -->
  303. <view class="nav-modal-mask" v-if="showNavModal" @click="closeNavModal">
  304. <view class="nav-action-sheet" @click.stop>
  305. <view class="nav-sheet-title">选择地图进行导航</view>
  306. <view class="nav-sheet-item" @click="chooseMap('高德')">高德地图</view>
  307. <view class="nav-sheet-item" @click="chooseMap('腾讯')">腾讯地图</view>
  308. <view class="nav-sheet-item" @click="chooseMap('百度')">百度地图</view>
  309. <view class="nav-sheet-gap"></view>
  310. <view class="nav-sheet-item cancel" @click="closeNavModal">取消</view>
  311. </view>
  312. </view>
  313. <custom-tabbar currentPath="pages/home/index"></custom-tabbar>
  314. </template>
  315. <script>
  316. import logic from './logic.js';
  317. export default {
  318. ...logic
  319. }
  320. </script>
  321. <style>
  322. @import './style.css';
  323. </style>