info-card.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="info-card">
  3. <view class="row">
  4. <text class="label">快递单号:</text>
  5. <text class="value">{{ detail.waybillCode || '-' }}</text>
  6. </view>
  7. <view class="row" v-if="detail.orderId">
  8. <text class="label">订单号:</text>
  9. <text class="link" @tap="copy(detail.orderId)">{{ detail.orderId }}</text>
  10. </view>
  11. <view class="row">
  12. <text class="label">{{ type === 'mall' ? '任务类型:' : '任务类型:' }}</text>
  13. <text class="value">{{ detail.taskTypeName || detail.taskType || '-' }}</text>
  14. <text class="sub" v-if="detail.taskTypeExt">{{ detail.taskTypeExt }}</text>
  15. </view>
  16. <view class="row">
  17. <text class="label">{{ type === 'mall' ? '验货状态:' : '订单状态:' }}</text>
  18. <text class="value">{{ detail.verifyStatusName || detail.orderStatusName || '-' }}</text>
  19. </view>
  20. <view class="row">
  21. <text class="label">任务详情:</text>
  22. <text class="value">{{ detail.taskDetail || '-' }}</text>
  23. </view>
  24. <view class="row">
  25. <text class="label">创建人:</text>
  26. <text class="value">{{ detail.createUser || '-' }}</text>
  27. </view>
  28. <view class="row">
  29. <text class="label">创建时间:</text>
  30. <text class="value">{{ detail.createTime || '-' }}</text>
  31. </view>
  32. <view class="row" v-if="detail.taskStatusName">
  33. <text class="label">任务状态:</text>
  34. <text class="status" :class="{ danger: detail.taskStatusName === '待处理' }">{{ detail.taskStatusName }}</text>
  35. </view>
  36. <view class="image-wrap" v-if="imageList.length">
  37. <u-image v-for="(src, idx) in imageList" :key="idx" :src="src" width="150rpx" height="150rpx" radius="8" mode="aspectFill"
  38. @click="preview(idx)"></u-image>
  39. </view>
  40. </view>
  41. </template>
  42. <script setup>
  43. import { computed } from 'vue'
  44. const props = defineProps({
  45. detail: {
  46. type: Object,
  47. default: () => ({})
  48. },
  49. type: {
  50. type: String,
  51. default: 'recycle'
  52. }
  53. })
  54. const imageList = computed(() => {
  55. if (Array.isArray(props.detail.imageUrls) && props.detail.imageUrls.length) {
  56. return props.detail.imageUrls.filter(Boolean)
  57. }
  58. const info = props.detail.imgInfo
  59. if (info?.imgUrlList?.length) return info.imgUrlList.filter(Boolean)
  60. if (props.detail.imageUrl) return [props.detail.imageUrl]
  61. if (props.detail.imgPath) return [props.detail.imgPath]
  62. return []
  63. })
  64. const copy = (text) => {
  65. if (!text) return
  66. uni.setClipboardData({ data: String(text) })
  67. }
  68. const preview = (index = 0) => {
  69. if (imageList.value.length > 0) {
  70. uni.previewImage({
  71. urls: imageList.value,
  72. current: index
  73. })
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .info-card {
  79. background: #ffffff;
  80. border-radius: 12rpx;
  81. padding: 20rpx;
  82. }
  83. .row {
  84. display: flex;
  85. align-items: baseline;
  86. margin-bottom: 12rpx;
  87. }
  88. .label {
  89. font-size: 28rpx;
  90. color: #666666;
  91. }
  92. .value {
  93. font-size: 28rpx;
  94. color: #333333;
  95. }
  96. .link {
  97. font-size: 28rpx;
  98. color: #1b77f0;
  99. }
  100. .sub {
  101. margin-left: 16rpx;
  102. font-size: 26rpx;
  103. color: #22ac38;
  104. }
  105. .status {
  106. font-size: 28rpx;
  107. color: #22ac38;
  108. }
  109. .status.danger {
  110. color: #ff4d4f;
  111. }
  112. .image-wrap {
  113. margin: 16rpx 0;
  114. display: flex;
  115. flex-wrap: wrap;
  116. gap: 12rpx;
  117. }
  118. </style>