CheckPacking.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <van-dialog v-model:show="packingTrueFalseBy"
  3. title="装箱"
  4. close-on-click-overlay
  5. :keyboard-enabled="false"
  6. show-cancel-button
  7. :beforeClose="beforeClose">
  8. <div class="packing-list">
  9. <table class="task-table">
  10. <thead>
  11. <tr>
  12. <th>条码</th>
  13. <th>名称</th>
  14. <th style="width: 60px">数量</th>
  15. </tr>
  16. </thead>
  17. <tbody>
  18. <tr v-for="(item, index) in packingList" :key="index" v-if="packingList.length>0">
  19. <td>{{ item.barcode }}</td>
  20. <td><van-text-ellipsis :content="item.skuName" /></td>
  21. <td>{{ item.quantity }}</td>
  22. </tr>
  23. <tr v-else>
  24. <td colspan="3">
  25. <div>暂无数据</div>
  26. </td>
  27. </tr>
  28. </tbody>
  29. </table>
  30. </div>
  31. </van-dialog>
  32. </template>
  33. <script setup>
  34. import { ref } from 'vue'
  35. import { packingReview } from '@/api/check/index'
  36. import { closeLoading, showLoading } from '@/utils/loading'
  37. import { showNotify } from 'vant'
  38. import { scanError, scanSuccess } from '@/utils/android'
  39. const packingTrueFalseBy = ref(false)
  40. const packingList = ref([])
  41. const orderDetail=ref({})
  42. const show = (list,detail) => {
  43. packingList.value=list.filter(item => item.isPacking && item.status=='60' )
  44. orderDetail.value=detail
  45. packingTrueFalseBy.value = true
  46. }
  47. const beforeClose = (action) =>
  48. new Promise(async (resolve) => {
  49. if (action === 'confirm') {
  50. setPacking()
  51. resolve(true)
  52. }
  53. resolve(true)
  54. })
  55. const emit = defineEmits(['print','cancelOrder','resetPackingStatus','getOrderPacking'])
  56. const setPacking = () => {
  57. const groupDetailList = packingList.value.map(items => {
  58. return {
  59. lotNum: items.lotNum,
  60. qty: items.quantity,
  61. };
  62. });
  63. const data = {
  64. warehouse: orderDetail.value.warehouseId,
  65. workStation:orderDetail.value.warehouseId,
  66. code: orderDetail.value.orderNo,
  67. packingReviewMode:true,
  68. groupDetailList,
  69. };
  70. showLoading()
  71. packingReview(data).then(res => {
  72. if(res.data=='0000'){
  73. // 订单取消
  74. emit('cancelOrder',orderDetail.value,'erp')
  75. }else if(res.data=='1111'){
  76. // 冻结
  77. emit('cancelOrder',orderDetail.value,'release')
  78. }else {
  79. showNotify({ type: 'success', duration: 3000, message: res.data + '装箱成功'})
  80. scanSuccess()
  81. emit('resetPackingStatus')
  82. const qty=groupDetailList.reduce((sum, item) => sum + Number(item.qty), 0)
  83. const packingItem={ orderNo:orderDetail.value.orderNo, traceId:res.data, qty }
  84. orderDetail.value.orderPacking.unshift(packingItem)
  85. emit('getOrderPacking',orderDetail.value.orderNo)
  86. // 是否需要打印面单
  87. if (res.data.includes('#') ) {
  88. showNotify({ type: 'success', duration: 3000, message: res.data + '已设置不获取新面单'})
  89. } else if(res.data==orderDetail.value.deliveryNo ){
  90. showNotify({ type: 'success', duration: 3000, message: res.data + '本单为初始单号,不打印面单'})
  91. } else {
  92. emit('print','PRINT_WAYBILL',res.data)
  93. }
  94. }
  95. }).catch(err=>{
  96. scanError()
  97. }).finally(f=>{
  98. closeLoading()
  99. })
  100. }
  101. defineExpose({ show })
  102. </script>
  103. <style scoped lang="sass">
  104. .packing-list
  105. width: 100%
  106. overflow-y: auto
  107. max-height: 60vh
  108. padding: 10px 0
  109. .task-table, .task-table-bin, .task-table-box
  110. width: 100%
  111. table-layout: fixed
  112. border-collapse: collapse
  113. font-size: 15px
  114. .task-table th, .task-table-bin th, .task-table td, .task-table-bin td, .task-table-box th, .task-table-box td
  115. text-align: center
  116. border: 1px solid #ccc
  117. word-wrap: break-word
  118. word-break: break-all
  119. .task-table thead, .task-table-bin thead, .task-table-box thead
  120. background-color: #3f8dff
  121. position: sticky
  122. top: 0
  123. color: white
  124. font-size: 15px
  125. .task-table-bin thead
  126. background-color: #3f8dff
  127. .task-table-bin tbody
  128. background: #cde7ff
  129. </style>