reviewOrderItem.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="review-order-card" :class="{ overdue: isOverdue }">
  3. <!-- 订单信息 -->
  4. <view class="order-info">
  5. <view class="info-row">
  6. <text class="label">订单号:</text>
  7. <text class="value">{{ item.orderId }}</text>
  8. </view>
  9. <view class="info-row">
  10. <text class="label">仓库:</text>
  11. <text class="value">{{ item.godownName }}</text>
  12. </view>
  13. <view class="info-row">
  14. <text class="label">不良数量:</text>
  15. <text class="value">{{ item.reviewNum || 0 }}</text>
  16. </view>
  17. <view class="info-row">
  18. <text class="label">是否入库:</text>
  19. <text class="value">{{ stockStatusText }}</text>
  20. <text v-if="item.positionCode" class="position-code">{{ item.positionCode }}</text>
  21. </view>
  22. <view class="info-row">
  23. <text class="label">申请复审时间:</text>
  24. <text class="value">{{ item.applyTime }}</text>
  25. </view>
  26. <view class="info-row">
  27. <text class="label">已用时长:</text>
  28. <TimeClock :initialSeconds="item.waitingTime" />
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script setup>
  34. import { computed } from "vue";
  35. import TimeClock from "./time-clock.vue";
  36. const props = defineProps({
  37. item: {
  38. type: Object,
  39. default: () => { },
  40. },
  41. });
  42. // 库存状态文本
  43. const stockStatusText = computed(() => {
  44. if (props.item.stockStatus === 1) {
  45. return "已入库";
  46. } else if (props.item.stockStatus === 0) {
  47. return "未入库";
  48. }
  49. return "-";
  50. });
  51. // 库存状态颜色
  52. const stockStatusColor = computed(() => {
  53. if (props.item.stockStatus === 1) {
  54. return "#FF4D4F"; // 红色 - 已入库
  55. } else if (props.item.stockStatus === 0) {
  56. return "#333333"; // 黑色 - 未入库
  57. }
  58. return "#999999";
  59. });
  60. // 格式化等待时长(毫秒转为时:分:秒)
  61. const formatWaitingTime = (milliseconds) => {
  62. if (!milliseconds) return "00:00:00";
  63. const totalSeconds = Math.floor(milliseconds / 1000);
  64. const hours = Math.floor(totalSeconds / 3600);
  65. const minutes = Math.floor((totalSeconds % 3600) / 60);
  66. const seconds = totalSeconds % 60;
  67. const pad = (num) => String(num).padStart(2, '0');
  68. return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
  69. };
  70. // 超时未入库:申请复审后等待时间 >= 24 小时 且 未入库
  71. const isOverdue = computed(() => {
  72. const waitingMs = Number(props.item?.waitingTime) || 0;
  73. const notStocked = props.item?.stockStatus === 0;
  74. const twentyFourHours = 24 * 60 * 60 * 1000;
  75. return notStocked && waitingMs >= twentyFourHours;
  76. });
  77. </script>
  78. <style lang="scss" scoped>
  79. .review-order-card {
  80. background: #ffffff;
  81. border-radius: 8rpx;
  82. padding: 24rpx;
  83. margin-bottom: 20rpx;
  84. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  85. &.overdue {
  86. background: #fff2f0; // 轻红色背景,提升可读性
  87. }
  88. .order-info {
  89. .info-row {
  90. display: flex;
  91. align-items: center;
  92. margin-bottom: 16rpx;
  93. font-size: 28rpx;
  94. line-height: 40rpx;
  95. &:last-child {
  96. margin-bottom: 0;
  97. }
  98. .label {
  99. color: #333333;
  100. font-weight: 400;
  101. }
  102. .value {
  103. color: #333333;
  104. flex: 1;
  105. &.time-duration {
  106. color: #FF4D4F;
  107. font-weight: 500;
  108. }
  109. }
  110. .position-code {
  111. color: #E87A20FF;
  112. margin-left: 16rpx;
  113. font-weight: 500;
  114. }
  115. }
  116. }
  117. }
  118. </style>