MrShi
2024-03-08 cf1972fe1e1ec70717d3a9edd63d906090d33e09
h5/pages/visitorApplication/visitorApplication.vue
@@ -45,6 +45,7 @@
               <text>访问门禁</text>
               <text>*</text>
            </view>
             <!-- @click="show6 = true" -->
            <view class="list_item_content">
               <text :style="{color: form1.doorSelectName ? '#000000' : ''}">{{form1.doorSelectName ? form1.doorSelectName : '请选择'}}</text>
               <u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
@@ -64,8 +65,9 @@
               <text>随行车辆</text>
               <text></text>
            </view>
            <view class="list_item_content">
               <input type="text" placeholder="请输入车牌号" v-model="form1.carNos" maxlength="8" placeholder-style="color: #999999;" />
            <view class="list_item_content" @click="openInput(1)">
               <text :style="{color: form1.carNos ? '#000000' : ''}">{{form1.carNos ? form1.carNos : '请输入车牌号码'}}</text>
               <!-- <input type="text" placeholder="请输入车牌号" v-model="form1.carNos" maxlength="8" placeholder-style="color: #999999;" /> -->
            </view>
         </view>
      </view>
@@ -226,7 +228,7 @@
               <view class="adduser_list_item">
                  <view class="adduser_list_item_label">
                     <text>公司</text>
                     <text></text>
                     <text>*</text>
                  </view>
                  <view class="adduser_list_item_ipt">
                     <input type="text" v-model="withUserList.companyName" placeholder-style="color: #999999;font-size: 28rpx;" placeholder="请输入公司名称" />
@@ -237,8 +239,9 @@
                     <text>随行车辆</text>
                     <text></text>
                  </view>
                  <view class="adduser_list_item_ipt">
                     <input type="text" v-model="withUserList.carNos" placeholder-style="color: #999999;font-size: 28rpx;" placeholder="请输入车牌号" />
                  <view class="adduser_list_item_ipt" @click="openInput(2)">
                     <text :style="{color: withUserList.carNos ? '#000000' : ''}">{{withUserList.carNos ? withUserList.carNos : '请输入车牌号码'}}</text>
                     <!-- <input type="text" v-model="withUserList.carNos" disabled placeholder-style="color: #999999;font-size: 28rpx;" placeholder="请输入车牌号" /> -->
                  </view>
               </view>
               <view class="adduser_list_item">
@@ -278,13 +281,22 @@
         </view>
      </u-popup>
      <u-picker keyName="name" :show="show6" :columns="columns1" @confirm="seleIdcard" @cancel="show6 = false"></u-picker>
      <!-- <tly-picture-cut ref="tlyPictureCut" :pictureSrc="photoSrc" @createImg="uploadImg"></tly-picture-cut> -->
      <keyboardInput ref="keyboard" @export="setPlate" @close="closeInput" />
      <qf-image-cropper ref="cropper" :width="280" :height="280" :radius="30" @crop="uploadImg"></qf-image-cropper>
   </view>
</template>
<script>
   import tlyPictureCut from "@/components/tly-picture-cut/tlyPictureCut.vue";
   import keyboardInput from "@/components/keyboard-input/keyboard-input.vue";
   import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue';
   export default {
      data() {
         return {
            photoSrc: '',
            type: '',
            inputType: '',
            show: false,
            show1: false,
            show2: false,
@@ -292,6 +304,7 @@
            show4: false,
            show5: false,
            show6: false,
            show7: false,
            fileList: [],
            columns1: [[{name: '身份证', id: 0}, {name: '港澳证件', id: 1},{name: '护照', id: 2}]],
            columns: [],
@@ -328,13 +341,52 @@
            verify: ''
         };
      },
      components: { tlyPictureCut, keyboardInput, QfImageCropper },
      onLoad(options) {
         this.form = JSON.parse(options.data)
         if (options.data) {
            this.form = JSON.parse(options.data)
         }
         this.getvisit()
         this.getVisit1()
         this.getUserValid()
      },
      methods: {
         openInput(type) {
            this.inputType = type
            this.$refs.keyboard.open()
         },
         setPlate(e) {
            if (this.inputType === 1) {
               this.form1.carNos = e
            } else if (this.inputType === 2) {
               this.withUserList.carNos = e
            }
            this.$forceUpdate()
            this.closeInput()
         },
         closeInput() {
            this.$refs.keyboard.close()
         },
         uploadImg(file) {
            this.$refs.cropper.close()
            uni.showLoading({ title: '上传中', mask: true });
            uni.uploadFile({
               url: `${this.$baseUrl}public/api/uploadFtp.do`,
               filePath: file.tempFilePath,
               name: 'file',
               formData: {
                  folderCode: 'MEMBER_IMG'
               },
               success: (uploadFileRes) => {
                  let res = JSON.parse(uploadFileRes.data)
                  this.withUserList.faceImg = res.data.halfPath
                  this.withUserList.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
               },
               complete() {
                  uni.hideLoading();
               }
            });
         },
         closeMJ() {
            this.show = false
            this.columns.forEach(item => {
@@ -354,7 +406,7 @@
               title: '离场时间不能为空',
               icon: 'none'
            })
            if (!this.form1.doorSelectName) return uni.showToast({
            if (!this.form1.doorSelectName && this.accessControl == 1) return uni.showToast({
               title: '访问门禁不能为空',
               icon: 'none'
            })
@@ -374,7 +426,6 @@
               withUserList: this.personnel
            }).then(res => {
               if (res.code === 200) {
                  console.log(res)
                  uni.reLaunch({
                     url: `/pages/appointmentDetails/appointmentDetails?id=${res.data}`
                  })
@@ -424,6 +475,10 @@
                  icon: 'none'
               })
            }
            if (!this.withUserList.companyName) return uni.showToast({
               title: '公司不能为空',
               icon: 'none'
            })
            if (!this.withUserList.faceImg) return uni.showToast({
               title: '人脸照片不能为空',
               icon: 'none'
@@ -449,8 +504,18 @@
            this.withUserList.imgurlUrl = ''
         },
         upload(type) {
            this.type = type
            if (type === 'faceImg') {
               this.$refs.cropper.open()
               return
            }
            uni.chooseImage({
               success: (chooseImageRes) => {
                  // if (type === 'faceImg') {
                  //    this.photoSrc = chooseImageRes.tempFilePaths[0];
                  //    this.$refs.tlyPictureCut.showPop();
                  //    return
                  // }
                  uni.showLoading({ title: '上传中', mask: true });
                  for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
                     uni.uploadFile({
@@ -533,9 +598,6 @@
         },
         // 查询用户
         getUser() {
            console.log(this.verify)
            console.log(this.form1.phone1)
            console.log(this.form1.receptMemberName)
            if (this.verify === '0') {
               if (this.form1.phone1) {
                  this.$u.api.getVisitedMember({
@@ -568,7 +630,6 @@
               label: 'BEVISITED_USER_VALID'
            }).then(res => {
               if (res.code === 200) {
                  console.log(res)
                  this.verify = res.data.code
               }
            })