detail.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="content">
  3. <!-- 第一个信息框 -->
  4. <view class="base-info-box">
  5. <info-item isFirst="true" label="业务时间" :value="baseInfo.ywsj" />
  6. <info-item
  7. label="粮食品种"
  8. :value="
  9. getDictLabelSync(DICT_TYPE.SYSTEM_LSPZ, baseInfo.lspzmc) || '--'
  10. "
  11. />
  12. <info-item
  13. label="粮食等级"
  14. :value="getDictLabelSync(DICT_TYPE.SYSTEM_LSDJ, baseInfo.lsdjbm)"
  15. />
  16. <info-item label="净重(吨)" :value="baseInfo.jz" />
  17. <!-- <info-item label="结算单价(元)" :value="baseInfo.kqmc" /> -->
  18. <info-item label="车船号" :value="baseInfo.cch" />
  19. <!-- <info-item
  20. isImage="true"
  21. :label="pageIndex == 0 ? '出库照片' : '入库照片'"
  22. :value="baseInfo.fileIds"
  23. /> -->
  24. <view class="info-item-component">
  25. <text class="label">
  26. {{ pageIndex == 0 ? "出库照片" : "入库照片" }}
  27. </text>
  28. <view class="images-container">
  29. <image
  30. @click="previewImage(src.url)"
  31. v-for="(src, index) in imageSources"
  32. :key="index"
  33. class="kqt-image"
  34. :src="src.url"
  35. />
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script setup>
  42. import { ref, onMounted, toRaw } from "vue";
  43. import { getDictOptions, DICT_TYPE, getDictLabelSync } from "@/utils/dict.js";
  44. import { onLoad } from "@dcloudio/uni-app";
  45. import InfoItem from "@/pages/components/InfoItem.vue";
  46. import { getImageInfo } from "@/api/task";
  47. const baseInfo = ref({});
  48. // 0是出库,1是入库
  49. const pageIndex = ref(0);
  50. const imageSources = ref([]);
  51. onLoad(async (options) => {
  52. if (options) {
  53. baseInfo.value = JSON.parse(decodeURIComponent(options.getData));
  54. pageIndex.value = options.pageIndex;
  55. console.log(baseInfo.value.fileIds, "baseInfo.value.fileIds ");
  56. if (baseInfo.value.fileIds instanceof Array) {
  57. imageSources.value = (
  58. await getImageInfo({ ids: baseInfo.value.fileIds })
  59. ).data;
  60. } else if (
  61. baseInfo.value.fileIds instanceof String &&
  62. JSON.parse(baseInfo.value.fileIds).length > 0
  63. ) {
  64. imageSources.value = (
  65. await getImageInfo({ ids: JSON.parse(baseInfo.value.fileIds) })
  66. ).data;
  67. }
  68. // imageSources.value = (
  69. // await getImageInfo({ ids: baseInfo.value.fileIds })
  70. // ).data;
  71. // console.log(imageSources.value, "imageSources.value");
  72. }
  73. });
  74. const previewImage = (url) => {
  75. uni.previewImage({
  76. urls: [url],
  77. });
  78. };
  79. </script>
  80. <style lang="scss" scoped>
  81. .content {
  82. padding: 20rpx;
  83. }
  84. .base-info-box {
  85. background: #ffffff;
  86. border-radius: 20rpx;
  87. margin-bottom: 40rpx;
  88. padding: 20rpx;
  89. }
  90. .info-item-component {
  91. display: flex;
  92. justify-content: space-between;
  93. align-items: center;
  94. padding: 30rpx 0;
  95. border-top: 1px solid #e5e9ed;
  96. }
  97. .base-info-box {
  98. background: #ffffff;
  99. border-radius: 20rpx;
  100. margin-bottom: 120rpx;
  101. padding: 20rpx;
  102. }
  103. .label {
  104. font-weight: bold;
  105. color: #777777;
  106. }
  107. .value {
  108. flex: 1;
  109. text-align: right;
  110. color: #0f2239;
  111. font-weight: 600;
  112. }
  113. .images-container {
  114. max-width: 50%;
  115. display: flex;
  116. flex-direction: column;
  117. align-items: center;
  118. .kqt-image {
  119. max-width: 100%;
  120. margin-bottom: 10rpx;
  121. }
  122. }
  123. </style>