RiderListPanel.vue 7.2 KB

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