MrShi
2024-04-07 9a819fa35464df79a1a8a56e132b3463fac520a7
wx/pages/new_report/new_report.vue
@@ -11,9 +11,13 @@
         <view class="box_list">
            <view class="box_list_Label">基本信息</view>
            <view class="box_list_from">
               <u-form-item label="出险人:" prop="memberName" borderBottom required @click="show4 = true" v-if="!id">
                  <u--input v-model="model.memberName" disabled disabledColor="#ffffff" placeholder="请选择出险人" border="none"></u--input>
                  <u-icon slot="right" name="arrow-right"></u-icon>
               <u-form-item label="出险人:" prop="memberName" borderBottom required v-if="!id">
                  <u--input v-model="model.memberName" placeholder="请选择出险人" @input="changeSearch" border="none"></u--input>
                  <scroll-view scroll-y class="box_list_data" v-if="model.memberName && columns2.length > 0">
                     <view class="box_list_data_item" v-for="(item, index) in columns2" :key="index" @click="clickItem(item)">
                        {{item.name}} - {{item.idcardNo}}
                     </view>
                  </scroll-view>
               </u-form-item>
               <u-form-item label="保险方案:" prop="solutionName" borderBottom required @click="openFA" v-if="!id">
                  <u--input v-model="model.solutionName" disabled disabledColor="#ffffff" placeholder="请选择保险方案" border="none"></u--input>
@@ -23,7 +27,7 @@
                  <u--input v-model="model.informantName" placeholder="请输入报案人姓名" border="none"></u--input>
               </u-form-item>
               <u-form-item label="报案人联系方式:" prop="informantPhone" required>
                  <u--input v-model="model.informantPhone" placeholder="请输入报案人联系方式" border="none"></u--input>
                  <u--input v-model="model.informantPhone" maxlength="11" placeholder="请输入报案人联系方式" border="none"></u--input>
               </u-form-item>
            </view>
         </view>
@@ -62,14 +66,28 @@
               </u-form-item>
               <u-form-item label="事故视频/图片:" prop="name" v-if="!id">
                  <view style="width: 100%; height: 15rpx;"></view>
                  <u-upload
                  <!-- <u-upload
                     :fileList="fileList"
                     @afterRead="afterRead"
                     @delete="deletePic"
                     multiple
                     :maxCount="10"
                     accept="media"
                  ></u-upload>
                  ></u-upload> -->
                  <view class="meade">
                     <view class="meade_content" v-for="(item,index) in model.reportFileList" :key="index">
                        <image class="dele" src="@/static/icon/ic_delete@2x.png" mode="widthFix" @click="deletePic(index)"></image>
                        <image class="image" :src="item.url" mode="widthFix" v-if="item.type === 0"></image>
                        <video class="video" :src="item.url" controls v-if="item.type === 1"></video>
                     </view>
                     <view class="meade_upload" @click="upload">
                        <u-icon name="plus" color="#999999" size="20"></u-icon>
                        <text>点击上传</text>
                     </view>
                     <view class="meade_zw"></view>
                     <view class="meade_zw"></view>
                     <view class="meade_zw"></view>
                  </view>
               </u-form-item>
            </view>
         </view>
@@ -96,7 +114,7 @@
      data() {
         return {
            id: null,
            show: true,
            show: false,
            show1: false,
            show2: false,
            show3: false,
@@ -188,11 +206,31 @@
         this.id = option.id
         if (this.id) {
            this.getDetails()
            this.getArea()
            this.getUser()
            return
         }
         this.show = true
         this.getArea()
         this.getUser()
      },
      methods: {
         clickItem(item) {
            this.model.memberName = item.name
            this.model.memberId = item.id
            this.columns2 = []
         },
         // 搜索
         changeSearch(name) {
            this.columns2 = []
            this.$u.api.memberFindListByDTO({
               name
            }).then(res => {
               if (res.code === 200) {
                  this.columns2 = res.data
               }
            })
         },
         getDetails() {
            this.$u.api.settleClaimsById(this.id)
               .then(res => {
@@ -308,6 +346,50 @@
                  }
               })
         },
         upload() {
            var that = this
            uni.chooseMedia({
               count: 9,
               mediaType: ['image','video'],
               sourceType: ['album', 'camera'],
               camera: 'back',
               success(res) {
                  uni.showLoading({
                     title: '上传中',
                     mask: true
                  });
                  for (let i = 0; i < res.tempFiles.length; i++) {
                     uni.uploadFile({
                        url: `${that.$baseUrl}public/upload`,
                        filePath: res.tempFiles[i].tempFilePath,
                        name: 'file',
                        header: {
                           'doumee-auth-token': that.$store.state.cookies
                        },
                        formData: {
                           folder: 'settle'
                        },
                        success: (uploadFileRes) => {
                           let res = JSON.parse(uploadFileRes.data)
                           console.log(res)
                           that.fileList.push({ ...res.data })
                           that.model.reportFileList.push({
                              fileurl: res.data.imgaddr,
                              name: res.data.originname,
                              type: res.data.type,
                              url: res.data.url
                           })
                        },
                        complete() {
                           if (i === res.tempFiles.length - 1) {
                              uni.hideLoading();
                           }
                        }
                     });
                  }
               }
            })
         },
         afterRead(e) {
            uni.showLoading({
               title: '上传中',
@@ -326,7 +408,6 @@
                  },
                  success: (uploadFileRes) => {
                     let res = JSON.parse(uploadFileRes.data)
                     this.fileList.push({ ...res.data })
                     this.model.reportFileList.push({
                        fileurl: res.data.imgaddr,
                        name: res.data.originname,
@@ -341,9 +422,8 @@
               });
            }
         },
         deletePic(e) {
            this.model.reportFileList.splice(e.index, 1)
            this.fileList.splice(e.index, 1)
         deletePic(index) {
            this.model.reportFileList.splice(index, 1)
         },
         getTreeName(list, id){
            let _this = this
@@ -439,6 +519,74 @@
            .u-textarea {
               padding: 9px 0 !important;
            }
            .box_list_data {
               width: 100%;
               max-height: 400rpx;
               margin-top: 10rpx;
               .box_list_data_item {
                  width: 100%;
                  height: 80rpx;
                  padding: 0 20rpx;
                  box-sizing: border-box;
                  line-height: 80rpx;
                  border-bottom: 1px solid #dfdfdf;
                  &:last-child {
                     border: none;
                  }
               }
            }
            .meade {
               width: 100%;
               display: flex;
               align-items: center;
               justify-content: space-around;
               flex-wrap: wrap;
               .meade_zw {
                  width: 140rpx;
                  height: 0;
               }
               .meade_content {
                  width: 140rpx;
                  height: 140rpx;
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  overflow: hidden;
                  position: relative;
                  .video {
                     width: 100%;
                  }
                  .dele {
                     width: 50rpx;
                     height: 50rpx;
                     position: absolute;
                     top: 0;
                     right: 0;
                     z-index: 9;
                  }
                  .image {
                     width: 100%;
                  }
               }
               .meade_upload {
                  width: 140rpx;
                  height: 140rpx;
                  background: #FFFFFF;
                  border-radius: 8rpx;
                  border: 1rpx solid #E5E5E5;
                  display: flex;
                  flex-direction: column;
                  align-items: center;
                  justify-content: center;
                  text {
                     font-weight: 400;
                     font-size: 24rpx;
                     color: #666666;
                     font-style: normal;
                     margin-top: 5rpx;
                  }
               }
            }
            .list {
               width: 100%;
               display: flex;