RiderListPanel.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div class="panel-section fulfiller-mgmt">
  3. <div class="sec-header no-border">
  4. <span class="tit">履约者</span>
  5. <!-- Right Aligned Tabs -->
  6. <div class="header-right-tabs">
  7. <span class="h-tab-item" :class="{ active: currentTab === 'All' }" @click="currentTab = 'All'">
  8. <span class="txt">全部</span>
  9. <span class="num">12</span>
  10. </span>
  11. <span class="h-tab-item" :class="{ active: currentTab === 'Working' }" @click="currentTab = 'Working'">
  12. <span class="txt">接单中</span>
  13. <span class="num success">8</span>
  14. </span>
  15. <span class="h-tab-item" :class="{ active: currentTab === 'Resting' }" @click="currentTab = 'Resting'">
  16. <span class="txt">休息中</span>
  17. <span class="num info">3</span>
  18. </span>
  19. <span class="h-tab-item" :class="{ active: currentTab === 'Disabled' }" @click="currentTab = 'Disabled'">
  20. <span class="txt">禁用</span>
  21. <span class="num danger">1</span>
  22. </span>
  23. </div>
  24. </div>
  25. <!-- Rider List -->
  26. <div class="list-wrapper">
  27. <el-scrollbar>
  28. <div v-for="rider in riders" :key="rider.id" class="list-card rider-card" @click="$emit('focus', rider.lng, rider.lat)">
  29. <div class="card-left relative">
  30. <el-avatar :src="rider.avatar" :size="40" />
  31. <div class="dot" :class="rider.status"></div>
  32. </div>
  33. <div class="card-main">
  34. <!-- Box 1: Name + Phone + Status (Right) -->
  35. <div class="row-1" style="justify-content: space-between; align-items: flex-start">
  36. <div style="display: flex; align-items: baseline; gap: 8px">
  37. <span class="r-name">{{ rider.name }}</span>
  38. <span class="r-phone">{{ rider.maskPhone }}</span>
  39. </div>
  40. <div class="status-right">
  41. <span class="status-badge" :class="rider.status">{{ getRiderStatusText(rider.status) }}</span>
  42. </div>
  43. </div>
  44. <!-- Box 2: Categories -->
  45. <div class="row-2 categories-row" style="margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap">
  46. <span v-for="cat in rider.categories" :key="cat" class="cat-tag" :class="getCategoryClass(cat)">{{ cat }}</span>
  47. </div>
  48. <!-- Box 3: Last Service Time -->
  49. <div class="row-3 time-row" style="margin-top: 4px">
  50. <span class="last-time"
  51. >下一单: {{ rider.status === 'offline' || rider.status === 'disabled' ? '--' : rider.lastServiceTime }}</span
  52. >
  53. </div>
  54. </div>
  55. <div class="card-right-stats">
  56. <div class="stat-box">
  57. <span class="lbl">待接</span>
  58. <span class="val danger">{{ rider.pendingCount }}</span>
  59. </div>
  60. <div class="stat-box">
  61. <span class="lbl">待服</span>
  62. <span class="val warning">{{ rider.todoCount }}</span>
  63. </div>
  64. <el-button link type="primary" size="small" style="margin-top: 4px; padding: 0" @click.stop="$emit('view-orders', rider)"
  65. >查看订单</el-button
  66. >
  67. </div>
  68. </div>
  69. </el-scrollbar>
  70. </div>
  71. </div>
  72. </template>
  73. <script setup>
  74. import { computed } from 'vue';
  75. const props = defineProps({
  76. modelValue: { type: String, default: 'All' },
  77. riders: { type: Array, default: () => [] }
  78. });
  79. const emit = defineEmits(['update:modelValue', 'focus', 'view-orders']);
  80. const currentTab = computed({
  81. get: () => props.modelValue,
  82. set: (val) => emit('update:modelValue', val)
  83. });
  84. const getRiderStatusText = (status) => {
  85. const map = { 'online': '接单中', 'busy': '接单中', 'offline': '休息中', 'disabled': '禁用' };
  86. return map[status];
  87. };
  88. const getCategoryClass = (cat) => {
  89. const map = { '接送': 'cat-transport', '喂遛': 'cat-feeding', '洗护': 'cat-washing' };
  90. return map[cat] || '';
  91. };
  92. </script>
  93. <style scoped>
  94. .fulfiller-mgmt {
  95. flex: 1;
  96. display: flex;
  97. flex-direction: column;
  98. overflow: hidden;
  99. height: 50%;
  100. }
  101. .sec-header {
  102. height: 48px;
  103. padding: 0 16px;
  104. display: flex;
  105. align-items: center;
  106. justify-content: space-between;
  107. }
  108. .sec-header.no-border {
  109. border-bottom: none;
  110. height: 40px;
  111. }
  112. .sec-header .tit {
  113. font-weight: bold;
  114. font-size: 15px;
  115. color: #1f2f3d;
  116. }
  117. .header-right-tabs {
  118. display: flex;
  119. gap: 4px;
  120. }
  121. .h-tab-item {
  122. display: flex;
  123. flex-direction: row;
  124. align-items: center;
  125. justify-content: center;
  126. cursor: pointer;
  127. position: relative;
  128. padding: 6px 12px;
  129. gap: 6px;
  130. border-radius: 4px;
  131. transition: all 0.2s;
  132. color: #606266;
  133. }
  134. .h-tab-item:hover {
  135. background: #f5f7fa;
  136. }
  137. .h-tab-item.active {
  138. background: #ecf5ff;
  139. }
  140. .h-tab-item.active .txt {
  141. color: #409eff;
  142. font-weight: bold;
  143. }
  144. .h-tab-item .txt {
  145. font-size: 14px;
  146. }
  147. .h-tab-item .num {
  148. font-size: 14px;
  149. font-weight: bold;
  150. margin-bottom: 0;
  151. }
  152. .h-tab-item .num.danger {
  153. color: #f56c6c;
  154. }
  155. .h-tab-item .num.success {
  156. color: #67c23a;
  157. }
  158. .h-tab-item .num.info {
  159. color: #909399;
  160. }
  161. .list-wrapper {
  162. flex: 1;
  163. overflow: hidden;
  164. padding: 8px 12px;
  165. }
  166. .list-card {
  167. background: #fff;
  168. border: 1px solid #ebeef5;
  169. border-radius: 8px;
  170. padding: 12px;
  171. margin-bottom: 10px;
  172. display: flex;
  173. align-items: stretch;
  174. gap: 12px;
  175. transition: all 0.2s;
  176. cursor: pointer;
  177. }
  178. .list-card:hover {
  179. border-color: #c6e2ff;
  180. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  181. }
  182. .card-left {
  183. flex-shrink: 0;
  184. display: flex;
  185. align-items: center;
  186. }
  187. .rider-card .card-left .dot {
  188. position: absolute;
  189. bottom: 0;
  190. right: 0;
  191. width: 10px;
  192. height: 10px;
  193. border-radius: 50%;
  194. border: 2px solid #fff;
  195. }
  196. .dot.online {
  197. background: #67c23a;
  198. }
  199. .dot.busy {
  200. background: #409eff;
  201. }
  202. .dot.offline {
  203. background: #909399;
  204. }
  205. .card-main {
  206. flex: 1;
  207. overflow: hidden;
  208. display: flex;
  209. flex-direction: column;
  210. justify-content: flex-start;
  211. gap: 4px;
  212. }
  213. .row-1 {
  214. display: flex;
  215. align-items: center;
  216. }
  217. .r-name {
  218. font-weight: bold;
  219. font-size: 14px;
  220. color: #303133;
  221. }
  222. .r-phone {
  223. font-size: 12px;
  224. color: #909399;
  225. }
  226. .cat-tag {
  227. background: #f4f4f5;
  228. color: #909399;
  229. font-size: 10px;
  230. padding: 1px 4px;
  231. border-radius: 2px;
  232. }
  233. .cat-tag.cat-transport {
  234. background: #e6f7ff;
  235. color: #1890ff;
  236. border: 1px solid #91d5ff;
  237. }
  238. .cat-tag.cat-feeding {
  239. background: #f6ffed;
  240. color: #52c41a;
  241. border: 1px solid #b7eb8f;
  242. }
  243. .cat-tag.cat-washing {
  244. background: #fff0f6;
  245. color: #eb2f96;
  246. border: 1px solid #ffadd2;
  247. }
  248. .status-badge {
  249. font-size: 11px;
  250. padding: 2px 6px;
  251. border-radius: 4px;
  252. display: inline-block;
  253. font-weight: bold;
  254. }
  255. .status-badge.online {
  256. background: #f0f9eb;
  257. color: #67c23a;
  258. }
  259. .status-badge.busy {
  260. background: #ecf5ff;
  261. color: #409eff;
  262. }
  263. .status-badge.offline {
  264. background: #f4f4f5;
  265. color: #909399;
  266. }
  267. .status-badge.disabled {
  268. background: #fef0f0;
  269. color: #f56c6c;
  270. }
  271. .last-time {
  272. font-size: 11px;
  273. color: #999;
  274. }
  275. .card-right-stats {
  276. display: flex;
  277. flex-direction: column;
  278. align-items: flex-end;
  279. justify-content: center;
  280. gap: 6px;
  281. }
  282. .stat-box {
  283. font-size: 11px;
  284. color: #909399;
  285. display: flex;
  286. align-items: center;
  287. gap: 4px;
  288. }
  289. .stat-box .val {
  290. font-weight: bold;
  291. font-size: 13px;
  292. }
  293. .stat-box .val.danger {
  294. color: #f56c6c;
  295. }
  296. .stat-box .val.warning {
  297. color: #e6a23c;
  298. }
  299. </style>