2
xuxy
2024-06-27 353b734a16dd753bef78105364f5a7ecbeac9712
sub_pages/farmer/farmer-info/farmer-info.vue
@@ -3,48 +3,53 @@
      <view>
         <view class="form-item">
            <view class="label required">店铺类型</view>
            <view class="m-l-a m-r-0 flex " :class="[!dto.applicationType?'desc-gray':'']" @click="()=>{
            <view class="m-l-a m-r-0 flex " :class="[!dto.typeId?'desc-gray':'']" @click="()=>{
               if(!id){
                  show_select_type=true
               }
            }">
               <view>{{dto.applicationTypeStr||dto.applicationType || '请选择'}}</view>
               <view>{{dto.typeName || '请选择'}}</view>
               <u-icon class="m-l-a" name="arrow-right"></u-icon>
            </view>
            <!--    <view class="m-l-a m-r-0 flex " :class="[!dto.typeId?'desc-gray':'']">
               <uni-data-picker @change="(e)=>{PickData('typeId','typeStr',e)}" placeholder="请选择"
                  :localdata="columns_types">
                  {{dto.typeStr || '请选择'}}
               </uni-data-picker>
               <u-icon class="m-l-a" name="arrow-right"></u-icon>
            </view> -->
         </view>
         <view class="form-item before-line">
            <view class="label required">店铺名称</view>
            <view class="m-l-a m-r-0 flex">
               <input v-model="dto.applicationTitle" placeholder="请输入店铺名称"
                  style="margin-top: 16px;text-align: right;"></input>
               <input v-model="dto.name" placeholder="请输入店铺名称" style="margin-top: 16px;text-align: right;"></input>
            </view>
         </view>
         <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('cover')" >
               <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="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="label required">联系人姓名</view>
            <view class="m-l-a m-r-0 flex">
               <input v-model="dto.applicationTitle" placeholder="请输入姓名"
               <input v-model="dto.contactTel" placeholder="请输入联系人姓名"
                  style="margin-top: 16px;text-align: right;"></input>
            </view>
@@ -52,31 +57,48 @@
         <view class="form-item before-line">
            <view class="label required">联系方式</view>
            <view class="m-l-a m-r-0 flex">
               <input v-model="dto.applicationTitle" placeholder="请输入联系方式"
               <input v-model="dto.contactTel" placeholder="请输入联系方式"
                  style="margin-top: 16px;text-align: right;"></input>
            </view>
         </view>
         <view class="form-item before-line">
            <view class="label required">集货站</view>
            <view class="m-l-a m-r-0 flex " :class="[!dto.applicationType?'desc-gray':'']" @click="()=>{
            <view class="m-l-a m-r-0 flex " :class="[!dto.stationId?'desc-gray':'']" @click="()=>{
               if(!id){
                  show_select_type=true
                  show_select_station=true
               }
            }">
               <view>{{dto.applicationTypeStr||dto.applicationType || '请选择'}}</view>
               <view>{{dto.stationName || '请选择'}}</view>
               <u-icon class="m-l-a" name="arrow-right"></u-icon>
            </view>
            <!--          <view class="m-l-a m-r-0 flex " :class="[!dto.stationId?'desc-gray':'']">
               <uni-data-picker @change="(e)=>{PickData('stationId','stationStr',e)}" placeholder="请选择"
                  :localdata="columns_station">
                  {{dto.typeStr || '请选择'}}
               </uni-data-picker>
               <u-icon class="m-l-a" name="arrow-right"></u-icon>
            </view> -->
         </view>
         <view class="form-item before-line">
            <view class="label required">地区</view>
            <view class="m-l-a m-r-0 flex " :class="[!dto.applicationType?'desc-gray':'']" @click="()=>{
            <!--          <view class="m-l-a m-r-0 flex " :class="[!dto.applicationType?'desc-gray':'']" @click="()=>{
               if(!id){
                  show_select_type=true
               }
            }">
               <view>{{dto.applicationTypeStr||dto.applicationType || '请选择'}}</view>
               <u-icon class="m-l-a" name="arrow-right"></u-icon>
            </view> -->
            <view class="m-l-a m-r-0 flex " :class="[!dto['province']?'desc-gray':'']">
               <uni-data-picker @change="(e)=>{PickArea(dto,e)}" placeholder="" :localdata="regionDataPlus">
                  {{ dto['province'] || '请选择' }}{{ dto['city'] && ('/' + dto['city']) || '' }}{{
                                          dto['region'] && ('/' + dto['region']) || ''
                                        }}
               </uni-data-picker>
               <u-icon class="m-l-a" name="arrow-right"></u-icon>
            </view>
@@ -84,7 +106,7 @@
         <view class="form-item before-line">
            <view class="label required">地址</view>
            <view class="m-l-a m-r-0 flex">
               <input v-model="dto.applicationTitle" placeholder="请输入地址"
               <input v-model="dto.address" placeholder="请输入地址"
                  style="margin-top: 16px;text-align: right;"></input>
            </view>
@@ -93,7 +115,7 @@
            <view class="label required">店铺简介</view>
         </view>
         <view class="flex">
            <u--textarea v-model="dto.ps" placeholder="请输入店铺简介"></u--textarea>
            <u--textarea v-model="dto.description" placeholder="请输入店铺简介"></u--textarea>
         </view>
         <view class="form-item before-line m-t-20">
            <view class="label required">选择审核方式</view>
@@ -109,7 +131,7 @@
         <view class="form-item bottom-border-no 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('idCards')">
               <!--                <view class="component-button-upload m-r-15" @click="uploadIcon('idCards')">
               </view> -->
               <view class="component-button-upload" @click="uploadIcon('idCards')">
@@ -156,11 +178,11 @@
      <view style="min-height: 200rpx;">
         &nbsp;
      </view>
      <u-picker @confirm="select_type" keyName="label" @cancel="show_select_type=false" :show="show_select_type"
      <u-picker @confirm="select_type" keyName="name" @cancel="show_select_type=false" :show="show_select_type"
         :columns="columns_types"></u-picker>
      <u-picker @confirm="select_user" keyName="label" @cancel="show_select_user=false" :show="show_select_user"
         :columns="userListCols"></u-picker>
      <u-picker @confirm="select_station" keyName="name" @cancel="show_select_station=false"
         :show="show_select_station" :columns="columns_station"></u-picker>
   </view>
@@ -178,24 +200,33 @@
      data() {
         return {
            id: '',
            orderId: '',
            show_addlog: false,
            log_remarks: '',
            refresh: false,
            api: '',
            dto: {
               id: '',
               pictures: [],
               idCards: [],
               cover:''
               cover: '',
               idcardType: '身份证',
               description: '',
               address: '',
               stationId: '',
               stationName: '',
               id: '',
               userId: '',
               name: '',
               typeId: '',
               typeName: '',
               contactName: '',
               contactTel: '',
               province: '',
               city: '',
               region: '',
            },
            show_select_type: false,
            show_select_user: false,
            show_select_station: false,
            columns_types: [],
            audit_remarks: '',
            audit_result: false,
            show_audit: false,
            columns_station: [],
            //审核方式
            shTypeList: [{
@@ -207,8 +238,7 @@
                  disabled: false
               }
            ],
            radiovalue1: '身份证',
            regionDataPlus: [],
         }
      },
      onLoad(options) {
@@ -216,38 +246,117 @@
            this.id = options.id
            this.getDetail()
         } else {
            this.$http.request('get', '/api/code/value', {
               params: {
                  type: 'APPLICATION_TYPE'
               }
            this.getCurrentInfo()
            //类型和集火站
            this.$http.request('get', '/api/station/list', {
               params: {}
            }).then(res => {
               var data = res.data
               this.columns_station = [data || []]
               // this.columns_station = (data || []).map(item => {
               //    return {
               //       ...item,
               //       code: item.id,
               //       text: item.name,
               //    }
               // })
            })
            //类型和集火站
            this.$http.request('get', '/api/supplier/type/list', {
               params: {}
            }).then(res => {
               var data = res.data
               this.columns_types = [data || []]
               this.columns_types[0].unshift({
                  label: '全部',
                  value: ''
               })
               // this.columns_types = (data || []).map(item => {
               //    return {
               //       ...item,
               //       code: item.id,
               //       text: item.name,
               //    }
               // })
               // console.log('columns_types', this.columns_types)
            })
            this.init_area()
         }
      },
      methods: {
         PickArea(item, e) {
            // console.log('PickArea', item, e)
            if (e.detail.value) {
               if (!!e.detail.value[0])
                  this.dto.province = e.detail.value[0].value
               if (!!e.detail.value[1])
                  this.dto.city = e.detail.value[1].value
               if (!!e.detail.value[2])
                  this.dto.region = e.detail.value[2].value
               this.$forceUpdate()
            }
         },
         PickData(valueKey, nameKey, e) {
            // console.log('PickArea', item, e)
            if (e.detail.value) {
               if (!!e.detail.value[0])
                  this.dto[valueKey] = e.detail.value[0].value || e.detail.value[0].id
               if (nameKey) {
                  this.dto[nameKey] = e.detail.value[0].label || e.detail.value[0].name || e.detail.value[0].value
               }
               this.$forceUpdate()
            }
         },
         async init_area() {
            const res = await this.$http.request('get', '/api/pub/china/area/json')
            // console.log('area', JSON.parse(res.data))
            this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll('name',
               'text')) || []
         },
         select_type(e) {
            this.show_select_type = false
            this.dto.applicationTypeStr = e.value[0].label
            this.dto.applicationType = e.value[0].value
            this.dto.typeName = e.value[0].name
            this.dto.typeId = e.value[0].id
         },
         select_user(e) {
            this.show_select_user = false
            this.dto.auditPersonStr = e.value[0].label
            this.dto.auditPersonId = e.value[0].value
         select_station(e) {
            this.show_select_station = false
            this.dto.stationName = e.value[0].name
            this.dto.stationId = e.value[0].id
         },
         async getCurrentInfo() {
            this.$message.showLoading()
            const {
               code,
               data
            } = await this.$http.request('get', "/api/current/supplier", {})
            if (code == 0) {
               this.dto = {
                  ...data,
               }
               if (!this.dto.pictures) {
                  this.dto.pictures = []
               }else if(typeof this.dto.pictures == 'string'){
                  this.dto.pictures = JSON.parse(this.dto.pictures)
               }
               if (!this.dto.idCards) {
                  this.dto.idCards = []
               }else if(typeof this.dto.idCards == 'string'){
                  this.dto.idCards = JSON.parse(this.dto.idCards)
               }
               // if (this.dto.idCards.length > 0) {
               //    this.dto.idcardType = '身份证'
               // }
               this.dto.userId = this.currentInfo.id
            }
            this.$message.hideLoading()
         },
         async getDetail() {
            this.$message.showLoading()
            const {
@@ -261,11 +370,17 @@
               }
               if (!this.dto.pictures) {
                  this.dto.pictures = []
               }else if(typeof this.dto.pictures == 'string'){
                  this.dto.pictures = JSON.parse(this.dto.pictures)
               }
               if (!this.dto.idCards) {
                  this.dto.idCards = []
               }else if(typeof this.dto.idCards == 'string'){
                  this.dto.idCards = JSON.parse(this.dto.idCards)
               }
               if (this.dto.idCards.length > 0) {
                  this.dto.idcardType = '身份证'
               }
            }
            this.$message.hideLoading()
@@ -295,10 +410,10 @@
         async deleteImg(key, index) {
            await this.$message.confirm('是否确认删除此图片')
            if(Array.isArray(this.dto[key])){
            if (Array.isArray(this.dto[key])) {
               this.dto[key].splice(index, 1)
            }else{
            } else {
               this.dto[key] = ''
            }
         },
@@ -319,12 +434,12 @@
                        var pic = res.data && res.data.length > 0 && res.data[
                           0] || {}
                        that.$message.hideLoading()
                        if(Array.isArray(that.dto[key])){
                        if (Array.isArray(that.dto[key])) {
                           that.dto[key].push(pic || '')
                        }else{
                        } else {
                           that.dto[key] = (pic || {}).url || ''
                        }
                        that.$forceUpdate()
                     }).catch(res => {