FileInfo.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="file-info bg-white">
  3. <view class="file-info-container">
  4. <cy-upload v-model:filename="form.imgInfo" :limit="3" />
  5. <u-textarea v-model="form.remark" placeholder="上传说明..." autoHeight style="min-height: 60px;"></u-textarea>
  6. <view class="flex flex-a-c flex-j-c">
  7. <u-button class="mt-24" type="primary" @click="handleUpload">上传(最多上传3张)</u-button>
  8. </view>
  9. </view>
  10. <view class="file-info-list">
  11. <view class="file-info-list-title text-center">已上传记录</view>
  12. <view class="file-info-list-content mt-24 mb-24 text-center" v-if="!fileList?.length">还没有上传记录</view>
  13. <view class="file-info-item" v-for="item in fileList" :key="item.id" v-else>
  14. <view class="file-info-item-img flex flex-a-c">
  15. <u-image v-for="img in item.imgInfo" :src="img" width="90" height="90" style="margin-right: 10px;"></u-image>
  16. </view>
  17. <view class="file-info-item-info mt-10 font-14">
  18. <view class="file-info-item-info-name">上传说明:{{ item.remark }}</view>
  19. <view class="file-info-item-info-name mt-10">
  20. <text>{{ item.createTime }} </text>
  21. <text class="ml-20">{{ item.createName }}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script setup>
  29. import { ref } from 'vue';
  30. import cyUpload from '@/components/cy-upload/index.vue';
  31. const form = ref({
  32. imgInfo: [],
  33. remark: ''
  34. })
  35. const props = defineProps({
  36. orderId: {
  37. type: String,
  38. default: ''
  39. },
  40. annexType: {
  41. type: Number,
  42. default: 1
  43. },
  44. isbn: {
  45. type: String,
  46. default: ''
  47. }
  48. })
  49. //获取附件信息
  50. const fileList = ref([])
  51. function getFileList() {
  52. uni.$u.http.get('/app/orderinfo/getOrderAnnexList', {
  53. params: {
  54. orderId: props.orderId,
  55. annexType: props.annexType,
  56. isbn: props.isbn
  57. }
  58. }).then(res => {
  59. if (res.code == 200) {
  60. fileList.value = res.data
  61. }
  62. })
  63. }
  64. getFileList()
  65. const handleUpload = () => {
  66. console.log(form.value)
  67. let data = {
  68. orderId: props.orderId,
  69. annexType: props.annexType,
  70. isbn: props.isbn,
  71. ...form.value
  72. }
  73. uni.$u.http.post('/app/orderinfo/setOrderAnnex', data).then(res => {
  74. if (res.code == 200) {
  75. uni.$u.toast('上传成功')
  76. form.value.imgInfo = []
  77. form.value.remark = ''
  78. getFileList()
  79. } else {
  80. uni.$u.toast(res.msg)
  81. }
  82. })
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .file-info-container {
  87. padding: 20rpx 30rpx;
  88. box-sizing: border-box;
  89. }
  90. .file-info-item {
  91. padding: 20rpx;
  92. border-bottom: 1px solid #e5e5e5;
  93. }
  94. .file-info-list-title {
  95. background-color: #e5e5e5;
  96. padding: 10rpx 0;
  97. margin-top: 20px;
  98. }
  99. .file-info-list-content {
  100. color: #999;
  101. min-height: 100px;
  102. }
  103. </style>