xuxy
2024-06-26 563a0f248d37b8820cdb3e46479d7c8c891b3386
sub_pages/farmer/farmer-info/farmer-info.vue
文件名从 pages/login/farmer-reg.vue 修改
@@ -21,15 +21,26 @@
            </view>
         </view>
         <view class="form-item before-line">
         <view class="form-item bottom-border-no">
            <view class="label required" style="width: 360rpx;">店铺头像(750*750px)</view>
            <view class="m-l-a m-r-0 flex m-t-20 m-b-20">
               <view class="component-button-upload" @click="uploadIcon('icon')"
                  :style="{'background-image':dto.icon&&`url('${dto.icon}')`||''}">
               <view class="component-button-upload" @click="uploadIcon('cover')" >
               </view>
            </view>
         </view>
         <view v-if="dto.cover">
            <view class="flex p20 form-item bottom-border-no" style="padding-top: 0rpx;padding-bottom: 10rpx" >
               <view class="m-r-10 ">
                  <image class="banner-img" :src="dto.cover" @click.stop="previewImg(dto.cover)">
                  </image>
                  <view class="t-red text-center" @click.stop="deleteImg('cover','')">删除</view>
               </view>
            </view>
         </view>
         <u-divider></u-divider>
         <view class="form-item before-line">
            <view class="label required">姓名</view>
            <view class="m-l-a m-r-0 flex">
@@ -87,10 +98,10 @@
         <view class="form-item before-line m-t-20">
            <view class="label required">选择审核方式</view>
            <view class="m-l-a m-r-0 flex">
               <u-radio-group v-model="dto.idcardType" placement="row">
                  <u-radio :customStyle="{'margin-bottom': '8px','margin-right': '8px','font-size':'28rpx'}" v-for="(item, index) in shTypeList" :key="index"
                     :label="item.name" :name="item.name">
                  <u-radio :customStyle="{'margin-bottom': '8px','margin-right': '8px','font-size':'28rpx'}"
                     v-for="(item, index) in shTypeList" :key="index" :label="item.name" :name="item.name">
                  </u-radio>
               </u-radio-group>
            </view>
@@ -98,27 +109,41 @@
         <view class="form-item before-line m-t-20 p-b-20" v-if="dto.idcardType=='身份证'">
            <view class="label required">身份证正反面</view>
            <view class="m-l-a m-r-0 flex">
               <view class="component-button-upload m-r-15" @click="uploadIcon('icon')"
                  :style="{'background-image':dto.icon&&`url('${dto.icon}')`||''}">
               <view class="component-button-upload m-r-15" @click="uploadIcon('idCards')">
               </view>
               <view class="component-button-upload" @click="uploadIcon('icon')"
                  :style="{'background-image':dto.icon&&`url('${dto.icon}')`||''}">
               <view class="component-button-upload" @click="uploadIcon('idCards')">
               </view>
            </view>
         </view>
         <view class="flex p20" style="padding-top: 0rpx;padding-bottom: 10rpx"
            v-if="dto.idCards&&dto.idCards.length>0">
            <view class="m-t-12 m-r-10 " v-for="(tBanner,index) of dto.idCards" :key="index">
               <image class="banner-img" :src="tBanner.url" @click.stop="previewImg(tBanner.url)">
               </image>
               <view class="t-red text-center" @click.stop="deleteImg('idCards',index)">删除</view>
            </view>
         </view>
         <view class="form-item before-line m-t-20 p-b-20" v-if="dto.idcardType=='营业执照'">
            <view class="label required">营业执照</view>
            <view class="m-l-a m-r-0 flex">
               <view class="component-button-upload m-r-15" @click="uploadIcon('icon')"
                  :style="{'background-image':dto.icon&&`url('${dto.icon}')`||''}">
               <view class="component-button-upload m-r-15" @click="uploadIcon('pictures')">
               </view>
            </view>
         </view>
         <view class="flex p20" style="padding-top: 0rpx;padding-bottom: 10rpx"
            v-if="dto.pictures&&dto.pictures.length>0">
            <view class="m-t-12 m-r-10 " v-for="(tBanner,index) of dto.pictures" :key="index">
               <image class="banner-img" :src="tBanner.url" @click.stop="previewImg(tBanner.url)">
               </image>
               <view class="t-red text-center" @click.stop="deleteImg('pictures',index)">删除</view>
            </view>
         </view>
@@ -128,7 +153,9 @@
      </view>
      <view style="min-height: 200rpx;">
         &nbsp;
      </view>
      <u-picker @confirm="select_type" keyName="label" @cancel="show_select_type=false" :show="show_select_type"
         :columns="columns_types"></u-picker>
@@ -158,7 +185,9 @@
            api: '',
            dto: {
               id: '',
               applicationType: '',
               pictures: [],
               idCards: [],
               cover:''
            },
            show_select_type: false,
            show_select_user: false,
@@ -187,31 +216,6 @@
            this.id = options.id
            this.getDetail()
         } else {
            // this.$http.request('get', '/api/personnel/employee/list', {
            //    params: {
            //       size: 4000,
            //       current: 1
            //    }
            // }).then(res => {
            //    this.userListAll = (res.data && res.data.records || []).map(item => {
            //       item.label = item.label || item.name || item.nickName || item.loginName || '-'
            //       return item
            //    })
            //    var index = 0
            //    this.userList = this.userListAll.map(item => {
            //       index += 1
            //       return `${index}.` + item.label + (item.tel ? `(${item.tel})` : '')
            //    })
            //    var arr = this.userListAll.map(item => {
            //       return {
            //          label: item.label + (item.tel ? `(${item.tel})` : ''),
            //          value: item.id
            //       }
            //    })
            //    this.userListCols = [arr]
            // })
            this.$http.request('get', '/api/code/value', {
               params: {
@@ -249,16 +253,18 @@
            const {
               code,
               data
            } = await this.$http.request('get', "/api/app/application/get/" + this.id, {})
            } = await this.$http.request('get', "/api/supplier/addOrUpdate/detail/" + this.id, {})
            if (code == 0) {
               this.dto = {
                  ...data,
               }
               if (this.dto.applicationDate) {
                  this.dto.applicationDate = this.$util.toDate(new Date(this.dto.applicationDate))
               if (!this.dto.pictures) {
                  this.dto.pictures = []
               }
               // console.log('this.dto', this.dto)
               if (!this.dto.idCards) {
                  this.dto.idCards = []
               }
            }
@@ -266,29 +272,15 @@
         },
         async submit() {
            if (!this.dto.applicationType) {
               this.$message.showToast('未选择类型')
               return
            }
            if (!this.dto.applicationTitle) {
               this.$message.showToast('未填写申请主题')
               return
            }
            if (!this.dto.auditPersonId) {
               this.$message.showToast('未选择审批人')
               return
            }
            await this.$message.confirm(`是否确定提交申请${this.auditPersonName?(",审批人为:"+this.auditPersonName):""}`)
            // this.$message.showToast('1')
            // return
            await this.$message.confirm(`是否确定提交/修改店铺信息`)
            var dto = {
               ...this.dto,
               applicationDate: this.$util.toDate(new Date()),
               applicantId: this.currentInfo.id
            }
            this.$message.showLoading()
            const re = await this.$http.request('post', '/api/app/application/create', {
            const re = await this.$http.request('post', '/api/supplier/addOrUpdate', {
               data: dto
            })
            this.$message.hideLoading()
@@ -300,28 +292,14 @@
               this.backpage()
            }
         },
         async submitAudit() {
            var url = ''
            if (this.audit_result) {
               url = '/api/app/application/audit/pass'
            } else {
               url = '/api/app/application/audit/reject'
            }
            var dto = {
               id: this.id,
               auditRemarks: this.audit_remarks
            }
            this.show_audit = false
            this.$message.showLoading()
            const re = await this.$http.request('post', url, {
               data: dto
            })
            this.$message.hideLoading()
            if (re.code == 2000 || re.code == 0) {
               this.$message.showToast('操作成功')
               this.$store.dispatch('sign_add', 'application');
               this.getDetail()
         async deleteImg(key, index) {
            await this.$message.confirm('是否确认删除此图片')
            if(Array.isArray(this.dto[key])){
               this.dto[key].splice(index, 1)
            }else{
               this.dto[key] = ''
            }
         },
         uploadIcon(key) {
@@ -339,10 +317,15 @@
                     that.$message.showLoading()
                     that.$http.upload(tempFiles[0].path).then(async res => {
                        var pic = res.data && res.data.length > 0 && res.data[
                              0]
                           .url || ''
                           0] || {}
                        that.$message.hideLoading()
                        that.dto[key] = pic || ''
                        if(Array.isArray(that.dto[key])){
                           that.dto[key].push(pic || '')
                        }else{
                           that.dto[key] = (pic || {}).url || ''
                        }
                        that.$forceUpdate()
                     }).catch(res => {
                        that.$message.hideLoading()
@@ -357,12 +340,18 @@
      computed: {
         ...mapState(['currentInfo'])
      },
      components: {
      }
      components: {}
   }
</script>
<style lang="scss" scoped>
   .banner-img {
      width: 96rpx;
      height: 96rpx;
      border-radius: 4rpx;
      border: 2rpx dashed #CECECE;
   }
   .form-item {
      // padding: 40rpx;
      border-bottom: 2rpx solid #F3F3F3;