MergeTaskDetailsDialog.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <van-popup
  3. v-model:show="show"
  4. position="bottom"
  5. round
  6. :style="{ maxHeight: '70%' }"
  7. @close="onClose"
  8. >
  9. <div class="dialog-container">
  10. <div class="dialog-header">
  11. <span class="dialog-title">并库任务详情</span>
  12. <van-icon name="cross" @click="onClose" />
  13. </div>
  14. <div class="dialog-content">
  15. <div v-if="loading" class="loading-container">
  16. <van-loading size="24px">加载中...</van-loading>
  17. </div>
  18. <div v-else-if="taskList.length === 0" class="empty-container">
  19. <van-empty description="暂无并库任务" />
  20. </div>
  21. <div v-else class="task-list">
  22. <div
  23. v-for="(task, index) in taskList"
  24. :key="task.id"
  25. class="task-item"
  26. >
  27. <div class="task-header">
  28. <span class="task-index">#{{ index + 1 }}</span>
  29. <span class="task-sku">SKU: {{ task.sku }}</span>
  30. </div>
  31. <div class="task-details">
  32. <div class="detail-row">
  33. <span class="detail-label">推荐清空库位:</span>
  34. <span class="detail-value">{{ task.sourceLocation }}</span>
  35. </div>
  36. <div class="detail-row">
  37. <span class="detail-label">目标库位:</span>
  38. <span class="detail-value">{{ task.targetLocation }}</span>
  39. </div>
  40. <div class="detail-row">
  41. <span class="detail-label">推荐数量:</span>
  42. <span class="detail-value">{{ task.moveQty }}</span>
  43. </div>
  44. <div class="detail-row">
  45. <span class="detail-label">涉及料箱:</span>
  46. <span class="detail-value">{{ task.involveBox ? task.involveBox.join(', ') : '-' }}</span>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </van-popup>
  54. </template>
  55. <script setup lang="ts">
  56. import { ref } from 'vue'
  57. import { LocationMergeDetails } from '@/api/location/merge'
  58. import { getWorkingMergeTasks } from '@/api/location/merge'
  59. import { showToast } from 'vant'
  60. const taskList = ref<LocationMergeDetails[]>([])
  61. const loading = ref(false)
  62. const show = ref(false)
  63. // 显示弹窗并加载数据
  64. const showDialog = async (warehouse: string) => {
  65. show.value = true
  66. loading.value = true
  67. try {
  68. const res = await getWorkingMergeTasks(warehouse)
  69. taskList.value = res.data || []
  70. } catch (error: any) {
  71. showToast(error.message || '获取并库任务详情失败')
  72. show.value = false
  73. } finally {
  74. loading.value = false
  75. }
  76. }
  77. // 关闭弹窗
  78. const onClose = () => {
  79. show.value = false
  80. }
  81. // 暴露方法给父组件使用
  82. defineExpose({
  83. showDialog
  84. })
  85. </script>
  86. <style scoped lang="scss">
  87. .dialog-container {
  88. padding: 16px;
  89. }
  90. .dialog-header {
  91. display: flex;
  92. justify-content: space-between;
  93. align-items: center;
  94. padding-bottom: 12px;
  95. border-bottom: 1px solid #eee;
  96. .dialog-title {
  97. font-size: 16px;
  98. font-weight: 500;
  99. color: #333;
  100. }
  101. .van-icon {
  102. cursor: pointer;
  103. color: #999;
  104. }
  105. }
  106. .dialog-content {
  107. padding: 12px 0;
  108. max-height: 400px;
  109. overflow-y: auto;
  110. }
  111. .loading-container,
  112. .empty-container {
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. padding: 40px 0;
  117. }
  118. .task-list {
  119. display: flex;
  120. flex-direction: column;
  121. gap: 12px;
  122. }
  123. .task-item {
  124. background: #f9f9f9;
  125. border-radius: 8px;
  126. padding: 12px;
  127. border: 1px solid #e5e5e5;
  128. }
  129. .task-header {
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. margin-bottom: 8px;
  134. .task-index {
  135. font-size: 12px;
  136. color: #1989fa;
  137. font-weight: 500;
  138. }
  139. .task-sku {
  140. font-size: 14px;
  141. font-weight: 500;
  142. color: #333;
  143. }
  144. }
  145. .task-details {
  146. display: flex;
  147. flex-direction: column;
  148. gap: 4px;
  149. }
  150. .detail-row {
  151. display: flex;
  152. justify-content: space-between;
  153. align-items: center;
  154. .detail-label {
  155. font-size: 12px;
  156. color: #666;
  157. min-width: 80px;
  158. }
  159. .detail-value {
  160. font-size: 12px;
  161. color: #333;
  162. text-align: right;
  163. flex: 1;
  164. }
  165. }
  166. </style>