<template>
  <view class="sj-info-page">

    <view class="section">
      <view class="section-title">
        <view class="title-bar"></view>
        <text class="title-text">营业执照</text>
      </view>

      <view class="form-item-one box-cont">
        <text class="label required">资质照片</text>
        <text class="upload-desc">请保证照片上的文字清晰、无遮挡、证件边角可见</text>
        <view class="" @click="chooseImage('business_license')">
          <image v-if="formData.business_license" :src="formData.business_license" mode="aspectFill"
            class="upload-preview"></image>
          <view class="" v-else>
            <image
              src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/fa75ea1c-8f9d-4b2a-8d0c-b94de516afd0.png"
              mode="widthFix" class="upload-camera-img"></image>
          </view>
        </view>
        <text class="required placeholder1">请上传营业执照原件</text>
      </view>

      <view class="form-item-two box-cont">
        <text class="label required">商户类型</text>
        <input type="text" v-model="formData.household_type" placeholder="请输入商户类型" placeholder-class="placeholder"
          class="input" @input="saveFormDataToLocalDebounce" />
      </view>

      <view class="form-item-two box-cont">
        <text class="label required">证件号码</text>
        <view class="picker-content">
          <input type="text" v-model="formData.license_number" placeholder="请输入营业执照的证件号码"
            placeholder-class="placeholder" class="input" @input="saveFormDataToLocalDebounce" />
          <image class="label-icon"
            src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/25bd7f38-1a3e-4282-84ea-190d7f820108"
            mode="aspectFit" @click.stop="showTipPopup('license_number')"></image>
        </view>
      </view>

      <view class="form-item-two box-cont">
        <text class="label required">营业名称</text>
        <input type="text" v-model="formData.business_name" placeholder="请输入营业执照的企业名称" placeholder-class="placeholder"
          class="input" @input="saveFormDataToLocalDebounce" />
      </view>

      <view class="form-item-two box-cont" @click="showRegionPicker">
        <text class="label required">注册地区</text>
        <view class="picker-content">
          <text :class="formData.register_region ? 'picker-value' : 'placeholder1'">
            {{ formData.register_region || '请选择' }}
          </text>
          <image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/dccc4513-377c-4bfa-9fd2-a5cfdb9798f3"
            class="arrow-right" mode="aspectFit"></image>
        </view>
      </view>

      <view class="form-item-two box-cont">
        <text class="label required">注册详细地址</text>
        <view class="picker-content">
          <input type="text" v-model="formData.register_address" placeholder="请输入注册地址" placeholder-class="placeholder"
            class="input" @input="saveFormDataToLocalDebounce" />
        </view>
      </view>
	  <view class="form-item-column box-cont">
	    <text class="label required">营业执照有效期至：</text>
	    <view class="radio-group">
	      <view class="radio-item" @click="setIdcardExpiryType('permanent')">
	        <view class="radio" :class="{ checked: formData.legal_idcard_expiry_type === 'permanent' }">
	          <image v-if="formData.legal_idcard_expiry_type === 'permanent'"
	            src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/cb185ec8-9d30-4e53-b5dc-14b546013a60"
	            class="radio-icon-image" mode="aspectFit"></image>
	        </view>
	        <text class="radio-label">永久有效</text>
	      </view>
	      <view class="radio-item" @click="setIdcardExpiryType('date')">
	        <view class="radio" :class="{ checked: formData.legal_idcard_expiry_type === 'date' }">
	          <image v-if="formData.legal_idcard_expiry_type === 'date'"
	            src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/cb185ec8-9d30-4e53-b5dc-14b546013a60"
	            class="radio-icon-image" mode="aspectFit"></image>
	        </view>
	        <text class="radio-label">指定日期有效</text>
	      </view>
	    </view>
	  </view>
	  <view class="date-row box-cont">
	    <view class="date-col" @click="showDatePicker('start')">
	      <text class="date-label">开始日期</text>
	      <view class="date-input-box">
	        <text :class="formData.idcard_start_date ? 'date-value' : 'date-placeholder'">
	          {{ formData.idcard_start_date || '选择日期' }}
	        </text>
	        <image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5b01823b-7672-4e60-b6cc-a4de52294605.png"
	          class="date-icon" mode="aspectFit"></image>
	      </view>
	    </view>
	    <view class="date-col" @click="showDatePicker('end')">
	      <text class="date-label">结束日期</text>
	      <view class="date-input-box">
	        <text :class="formData.idcard_end_date ? 'date-value' : 'date-placeholder'">
	          {{ formData.idcard_end_date || '选择日期' }}
	        </text>
	        <image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5b01823b-7672-4e60-b6cc-a4de52294605.png"
	          class="date-icon" mode="aspectFit"></image>
	      </view>
	    </view>
	  </view>
    </view>

    <view class="section">
      <view class="section-title">
        <view class="title-bar"></view>
        <text class="title-text">法人信息</text>
      </view>

      <view class="form-item-one box-cont">
        <text class="label required">身份证照片</text>
        <text class="upload-desc">请保证照片上的文字清晰、无遮挡、证件边角可见</text>
        <view class="upload-area" @click="chooseImage('id_card_front')">
          <image v-if="formData.id_card_front" :src="formData.id_card_front" mode="aspectFill" class="upload-preview">
          </image>
          <view class="" v-else>
            <image
              src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/fa75ea1c-8f9d-4b2a-8d0c-b94de516afd0.png"
              mode="widthFix" class="upload-camera-img" style="margin-left: -30rpx;"></image>
          </view>
          <text class="placeholder1 required">请上传身份证正面(人像面)</text>
        </view>
        <view class="upload-area" @click="chooseImage('id_card_back')" style="margin-top: 48rpx;">
          <image v-if="formData.id_card_back" :src="formData.id_card_back" mode="aspectFill" class="upload-preview">
          </image>
          <view class="" v-else>
            <image
              src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/fa75ea1c-8f9d-4b2a-8d0c-b94de516afd0.png"
              mode="widthFix" class="upload-camera-img" style="margin-left: -30rpx;"></image>
          </view>
          <text class="placeholder1 required">请上传身份证反面(国徽面)</text>
        </view>
      </view>

      <view class="form-item-two box-cont">
        <text class="label required">法人代表</text>
        <input type="text" v-model="formData.legal_person" placeholder="请输入营业执照的法人代表" placeholder-class="placeholder"
          class="input" @input="saveFormDataToLocalDebounce" />
      </view>

      <view class="form-item-two box-cont">
        <text class="label required">法人联系方式</text>
        <input type="number" v-model="formData.legal_phone" placeholder="请输入法人的联系方式" placeholder-class="placeholder"
          class="input" @input="saveFormDataToLocalDebounce" />
      </view>

      <view class="form-item-two box-cont">
        <text class="label required">法人身份证号</text>
        <input type="text" v-model="formData.legal_id_number" placeholder="请输入法人的身份证号码" placeholder-class="placeholder"
          class="input" @input="saveFormDataToLocalDebounce" />
      </view>

      <view class="form-item-column box-cont">
        <text class="label required">营业执照有效期至：</text>
        <view class="radio-group">
          <view class="radio-item" @click="setIdcardExpiryType('permanent')">
            <view class="radio" :class="{ checked: formData.legal_idcard_expiry_type === 'permanent' }">
              <image v-if="formData.legal_idcard_expiry_type === 'permanent'"
                src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/cb185ec8-9d30-4e53-b5dc-14b546013a60"
                class="radio-icon-image" mode="aspectFit"></image>
            </view>
            <text class="radio-label">永久有效</text>
          </view>
          <view class="radio-item" @click="setIdcardExpiryType('date')">
            <view class="radio" :class="{ checked: formData.legal_idcard_expiry_type === 'date' }">
              <image v-if="formData.legal_idcard_expiry_type === 'date'"
                src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/cb185ec8-9d30-4e53-b5dc-14b546013a60"
                class="radio-icon-image" mode="aspectFit"></image>
            </view>
            <text class="radio-label">指定日期有效</text>
          </view>
        </view>
      </view>
      <view class="date-row box-cont">
        <view class="date-col" @click="showDatePicker('start')">
          <text class="date-label">开始日期</text>
          <view class="date-input-box">
            <text :class="formData.idcard_start_date ? 'date-value' : 'date-placeholder'">
              {{ formData.idcard_start_date || '选择日期' }}
            </text>
            <image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5b01823b-7672-4e60-b6cc-a4de52294605.png"
              class="date-icon" mode="aspectFit"></image>
          </view>
        </view>
        <view class="date-col" @click="showDatePicker('end')">
          <text class="date-label">结束日期</text>
          <view class="date-input-box">
            <text :class="formData.idcard_end_date ? 'date-value' : 'date-placeholder'">
              {{ formData.idcard_end_date || '选择日期' }}
            </text>
            <image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5b01823b-7672-4e60-b6cc-a4de52294605.png"
              class="date-icon" mode="aspectFit"></image>
          </view>
        </view>
      </view>

    </view>

    <view class="section">
      <view class="section-title">
        <view class="title-bar"></view>
        <text class="title-text">其他信息</text>
      </view>

      <view class="form-item-one box-cont">
        <text class="label required">行业资质</text>
        <view class="image-list">
          <view class="image-item" v-for="(img, index) in formData.industry_qualifications" :key="'industry-' + index">
            <image :src="img" mode="aspectFill" class="qualification-image"></image>
            <view class="image-delete" @click="removeImage('industry_qualifications', index)">×</view>
          </view>
          <view class="image-add" @click="chooseMultiImage('industry_qualifications')"
            v-if="formData.industry_qualifications.length < 9">
            <image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/0d4af728-c7bf-447d-85b2-e7c682471b86.png" mode="aspectFit" class="upload-icon-small"></image>
            <text class="add-text">添加照片</text>
          </view>
        </view>
		<text class="label" style="margin-top: 30rpx;">其他资质</text>
		  <view class="image-list">
		    <view class="image-item" v-for="(img, index) in formData.other_qualifications" :key="'other-' + index">
		      <image :src="img" mode="aspectFill" class="qualification-image"></image>
		      <view class="image-delete" @click="removeImage('other_qualifications', index)">×</view>
		    </view>
		    <view class="image-add" @click="chooseMultiImage('other_qualifications')"
		      v-if="formData.other_qualifications.length < 9">
		      <image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/0d4af728-c7bf-447d-85b2-e7c682471b86.png" mode="aspectFit" class="upload-icon-small"></image>
		      <text class="add-text">添加照片</text>
		    </view>
		  </view>
		</view>
      </view>

    <view class="popup" :class="{ show: showRegionPopupFlag }">
      <view class="popup-mask" @click="hideRegionPopup"></view>
      <view class="popup-content">
        <view class="popup-header">
          <text class="popup-title">选择注册地区</text>
          <text class="popup-close" @click="hideRegionPopup">×</text>
        </view>
        <view class="region-body">
          <picker-view @change="bindChangeRegion" class="picker-scroll" :indicator-style="indicatorStyle"
            :value="regionValue">
            <picker-view-column>
              <view class="picker-item" v-for="(item, index) in ChinaCitys" :key="index">
                {{ item.province }}
              </view>
            </picker-view-column>
            <picker-view-column>
              <view class="picker-item" v-for="(item, index) in regionCitys" :key="index">
                {{ item.city }}
              </view>
            </picker-view-column>
            <picker-view-column>
              <view class="picker-item" v-for="(item, index) in regionAreas" :key="index">
                {{ item.area }}
              </view>
            </picker-view-column>
          </picker-view>
        </view>
        <view class="popup-footer">
          <view class="popup-btn cancel" @click="hideRegionPopup">
            <text class="btn-text">取消</text>
          </view>
          <view class="popup-btn confirm" @click="confirmRegionSelect">
            <text class="btn-text">确定</text>
          </view>
        </view>
      </view>
    </view>

    <view class="popup" :class="{ show: showDatePickerFlag }">
      <view class="popup-mask" @click="hideDatePicker"></view>
      <view class="popup-content">
        <view class="popup-header">
          <text class="popup-title">{{ currentPickerType === 'start' ? '选择开始日期' : '选择结束日期' }}</text>
          <text class="popup-close" @click="hideDatePicker">×</text>
        </view>
        <view class="region-body">
          <picker-view :value="datePickerValue" @change="bindDateChange" class="picker-scroll"
            :indicator-style="indicatorStyle">
            <picker-view-column>
              <view class="picker-item" v-for="(year, index) in years" :key="index">
                {{ year }}年
              </view>
            </picker-view-column>
            <picker-view-column>
              <view class="picker-item" v-for="(month, index) in months" :key="index">
                {{ month }}月
              </view>
            </picker-view-column>
            <picker-view-column>
              <view class="picker-item" v-for="(day, index) in days" :key="index">
                {{ day }}日
              </view>
            </picker-view-column>
          </picker-view>
        </view>
        <view class="popup-footer">
          <view class="popup-btn cancel" @click="hideDatePicker">
            <text class="btn-text">取消</text>
          </view>
          <view class="popup-btn confirm" @click="confirmDateSelect">
            <text class="btn-text">确定</text>
          </view>
        </view>
      </view>
    </view>

  </view>
</template>

<script>
import request from '../../utils/request';
import ChinaCitys from '../../static/data/ChinaCitys.json';
import {
  debounce
} from '@/utils/debounce.js';

export default {
  data() {
    const loadedData = this.loadFormDataFromLocal();

    return {
      formData: loadedData || {
        business_license: '',
        household_type: '',
        license_number: '',
        business_name: '',
        register_region: '',
        register_address: '',
        register_province: '',
        register_city: '',
        register_area: '',
        id_card_front: '',
        id_card_back: '',
        legal_person: '',
        legal_phone: '',
        legal_id_number: '',
        legal_idcard_expiry_type: 'permanent',
        idcard_start_date: '',
        idcard_end_date: '',
        industry_qualifications: [],
        other_qualifications: []
      },
      ChinaCitys: ChinaCitys,
      regionCitys: [],
      regionAreas: [],
      regionValue: [0, 0, 0],
      showRegionPopupFlag: false,
      showDatePickerFlag: false,
      currentPickerType: 'start',
      datePickerValue: [0, 0, 0],
      indicatorStyle: 'height: 68rpx;',
      userId: null,
      identity: 3
    }
  },

  computed: {
    years() {
      return Array.from({
        length: 50
      }, (_, i) => 2020 + i);
    },
    months() {
      return Array.from({
        length: 12
      }, (_, i) => i + 1);
    },
    days() {
      return Array.from({
        length: 31
      }, (_, i) => i + 1);
    }
  },

  async mounted() {
    await this.getUserInfo();
    this.regionCitys = this.ChinaCitys[0].citys;
    this.regionAreas = this.regionCitys[0].areas;
  },

  methods: {
    getUserInfo() {
      return request.post('/sj/User/getUser').then(result => {
        this.userId = result.data.id;
      }).catch(err => {
        console.error('获取用户信息失败:', err);
      });
    },

    loadFormDataFromLocal() {
      try {
        const stored = uni.getStorageSync('sj_info_form_data');
        if (stored) return stored;
      } catch (e) { }
      return null;
    },

    saveFormDataToLocal() {
      try {
        uni.setStorageSync('sj_info_form_data', this.formData);
      } catch (e) { }
    },

    saveFormDataToLocalDebounce() {
      if (!this._saveDebounce) {
        this._saveDebounce = debounce(() => {
          this.saveFormDataToLocal();
        }, 500);
      }
      this._saveDebounce();
    },

    chooseImage(type) {
      uni.chooseImage({
        count: 1,
        sizeType: ['compressed'],
        sourceType: ['album', 'camera'],
        success: async (res) => {
          if (!res.tempFilePaths || res.tempFilePaths.length === 0) return;
          const tempFilePath = res.tempFilePaths[0];
          const file = {
            path: tempFilePath,
            size: 0
          };
          const url = await this.directUpload(file, this.userId, 3);
          if (url) {
            this.$set(this.formData, type, url);
            this.saveFormDataToLocal();
          }
        }
      });
    },

    chooseMultiImage(type) {
      const current = this.formData[type] || [];
      const remaining = 9 - current.length;
      if (remaining <= 0) {
        uni.showToast({
          title: '最多上传9张图片',
          icon: 'none'
        });
        return;
      }
      uni.chooseImage({
        count: remaining,
        sizeType: ['compressed'],
        sourceType: ['album', 'camera'],
        success: async (res) => {
          if (!res.tempFilePaths || res.tempFilePaths.length === 0) return;
          uni.showLoading({
            title: '上传中...'
          });
          for (const tempFilePath of res.tempFilePaths) {
            const file = {
              path: tempFilePath,
              size: 0
            };
            try {
              const url = await this.directUpload(file, this.userId, 3);
              if (url) {
                current.push(url);
              }
            } catch (e) {
              console.error('上传失败:', e);
            }
          }
          this.$set(this.formData, type, current);
          this.saveFormDataToLocal();
          uni.hideLoading();
        }
      });
    },

    removeImage(type, index) {
      const list = [...this.formData[type]];
      list.splice(index, 1);
      this.$set(this.formData, type, list);
      this.saveFormDataToLocal();
    },

    async directUpload(file, userId, type) {
      try {
        let date = new Date().getTime();
        let artisan = type == 1 ? 'yh' : type == 2 ? 'syr' : type == 3 ? 'sj' : '';
        let fileExtension = 'jpg';
        if (file.path.includes('.')) {
          let parts = file.path.split('.');
          let ext = parts[parts.length - 1].toLowerCase();
          if (ext && ext.length <= 4) fileExtension = ext;
        }
        let name = `${userId}_${artisan}_${date}.${fileExtension}`;
        const ossConfig = await request.post('/user/getalioss', {
          type: type,
          kind: 1
        });
        return await new Promise((resolve, reject) => {
          uni.uploadFile({
            url: ossConfig.host,
            filePath: file.path,
            name: 'file',
            formData: {
              key: ossConfig.dir + name,
              policy: ossConfig.policy,
              OSSAccessKeyId: ossConfig.ossAccessKeyId,
              success_action_status: '200',
              signature: ossConfig.signature
            },
            success: (res) => {
              if (res.statusCode === 200) {
                resolve(`${ossConfig.host}/${ossConfig.dir}${name}`);
              } else {
                reject(new Error('上传失败'));
              }
            },
            fail: reject
          });
        });
      } catch (error) {
        console.error('上传失败:', error);
        throw error;
      }
    },

    showRegionPicker() {
      this.showRegionPopupFlag = true;
    },

    hideRegionPopup() {
      this.showRegionPopupFlag = false;
    },

    bindChangeRegion(e) {
      this.regionValue = e.detail.value;
      let index1 = e.detail.value[0] || 0;
      let index2 = e.detail.value[1] || 0;
      this.regionCitys = this.ChinaCitys[index1].citys;
      this.regionAreas = this.regionCitys[index2].areas;
    },

    confirmRegionSelect() {
      let valueArr = this.regionValue;
      let index1 = valueArr[0] || 0;
      let index2 = valueArr[1] || 0;
      let index3 = valueArr[2] || 0;
      let province = this.ChinaCitys[index1].province;
      let city = this.regionCitys[index2].city;
      let area = this.regionAreas[index3].area;
      this.formData.register_region = province + '-' + city + '-' + area;
      this.formData.register_province = this.ChinaCitys[index1].code ? this.ChinaCitys[index1].code.toString()
        .substring(0, 6) : '';
      this.formData.register_city = this.regionCitys[index2].code ? this.regionCitys[index2].code.toString()
        .substring(0, 6) : '';
      this.formData.register_area = this.regionAreas[index3].code ? this.regionAreas[index3].code.toString()
        .substring(0, 6) : '';
      this.saveFormDataToLocal();
      this.hideRegionPopup();
    },

    showHouseholdTypePicker() {
      this.showRegionPopupFlag = true;
    },

    hideRegionPopup() {
      this.showRegionPopupFlag = false;
    },

    setIdcardExpiryType(type) {
      this.$set(this.formData, 'legal_idcard_expiry_type', type);
      if (type === 'permanent') {
        this.formData.idcard_end_date = '长久有效';
      } else {
        if (this.formData.idcard_end_date === '长久有效') {
          this.formData.idcard_end_date = '';
        }
      }
      this.saveFormDataToLocal();
    },

    showDatePicker(type) {
      this.currentPickerType = type;
      this.showDatePickerFlag = true;
    },

    hideDatePicker() {
      this.showDatePickerFlag = false;
    },

    bindDateChange(e) {
      this.datePickerValue = e.detail.value;
    },

    confirmDateSelect() {
      const year = this.years[this.datePickerValue[0]];
      const month = this.months[this.datePickerValue[1]];
      const day = this.days[this.datePickerValue[2]];
      const dateStr = `${year}年${month < 10 ? '0' + month : month}月${day < 10 ? '0' + day : day}日`;
      if (this.currentPickerType === 'start') {
        this.formData.idcard_start_date = dateStr;
      } else {
        this.formData.idcard_end_date = dateStr;
      }
      this.saveFormDataToLocal();
      this.hideDatePicker();
    },

    showTipPopup(field) { },

    getFormData() {
      return this.formData;
    },

    saveFormData() {
      if (!this.formData.business_license) {
        uni.showToast({
          title: '请上传营业执照',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.household_type) {
        uni.showToast({
          title: '请选择户主类型',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.license_number) {
        uni.showToast({
          title: '请输入证件号码',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.business_name) {
        uni.showToast({
          title: '请输入营业名称',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.register_region) {
        uni.showToast({
          title: '请选择注册地区',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.register_address) {
        uni.showToast({
          title: '请输入注册详细地址',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.id_card_front) {
        uni.showToast({
          title: '请上传法人身份证正面',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.id_card_back) {
        uni.showToast({
          title: '请上传法人身份证反面',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.legal_person) {
        uni.showToast({
          title: '请输入法人代表',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.legal_phone) {
        uni.showToast({
          title: '请输入法人联系方式',
          icon: 'none'
        });
        return false;
      }
      if (!/^1[3-9]\d{9}$/.test(this.formData.legal_phone)) {
        uni.showToast({
          title: '请输入正确的手机号码',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.legal_id_number) {
        uni.showToast({
          title: '请输入法人身份证号',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.idcard_start_date) {
        uni.showToast({
          title: '请选择开始日期',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.idcard_end_date) {
        uni.showToast({
          title: '请选择结束日期',
          icon: 'none'
        });
        return false;
      }
      if (!this.formData.industry_qualifications || this.formData.industry_qualifications.length === 0) {
        uni.showToast({
          title: '请上传行业资质',
          icon: 'none'
        });
        return false;
      }
      this.saveFormDataToLocal();
      return true;
    }
  }
}
</script>

<style scoped>
.sj-info-page {}

.section {
  margin-bottom: 30rpx;
}

.section-title {
  display: flex;
  align-items: center;
  padding-bottom: 20rpx;
  padding-top: 16rpx;
}

.title-bar {
  width: 8rpx;
  height: 32rpx;
  background-color: #E8101E;
  border-radius: 4rpx;
  margin-right: 12rpx;
}

.title-text {
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  font-size: 32rpx;
  color: #1D2129;
}

.box-cont {
  background: #FFFFFF;
  border-radius: 20rpx;
  margin-bottom: 24rpx;
  margin-left: 8rpx;
  margin-right: 8rpx;
  box-shadow: none;
}

.form-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24rpx;
}

.form-item-one {
  display: flex;
  flex-direction: column;
  padding: 24rpx;
}

.form-item-two {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24rpx;
}

.form-item-column {
  display: flex;
  flex-direction: column;
  padding: 24rpx;
}

.form-item-column .label {
  margin-bottom: 24rpx;
}

.date-row {
  display: flex;
  padding: 24rpx;
}

.date-col {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.date-col:first-child {
  margin-right: 24rpx;
}

.date-label {
  font-size: 28rpx;
  color: #333333;
  font-weight: 500;
  margin-bottom: 16rpx;
}

.date-input-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2rpx solid #E8E8E8;
  border-radius: 12rpx;
  padding: 0 20rpx;
  height: 76rpx;
}

.date-value {
  font-size: 28rpx;
  color: #333333;
}

.date-placeholder {
  font-size: 28rpx;
  color: #CCCCCC;
}

.date-icon {
  width: 36rpx;
  height: 36rpx;
  flex-shrink: 0;
}

.label-wrapper {
  display: inline-flex;
  align-items: center;
}

.label {
  font-size: 28rpx;
  color: #333333;
  font-weight: 500;
  line-height: 1;
}

.label-icon {
  width: 26rpx;
  height: 26rpx;
  margin-left: 8rpx;
}

.label.required::before {
  content: '*';
  color: #E8101E;
  margin-right: 4rpx;
}

.input {
  font-size: 28rpx;
  color: #333333;
  text-align: right;
  flex: 1;
}

.placeholder {
  font-size: 28rpx;
  color: #CCCCCC;
  margin-left: -20rpx;
}

.placeholder1 {
  text-align: center;
  font-size: 28rpx;
  color: #333333;
}

.placeholder1.required::before {
  content: '*';
  color: #E8101E;
  margin-right: 4rpx;
}

.picker-content {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.picker-value {
  font-size: 28rpx;
  color: #333333;
  margin-right: 8rpx;
}

.arrow-right {
  width: 24rpx;
  height: 24rpx;
  flex-shrink: 0;
}

.radio-group {
  display: flex;
  align-items: center;
}

.radio-item {
  display: flex;
  align-items: center;
  margin-right: 130rpx;
}

.radio {
  width: 30rpx;
  height: 30rpx;
  border: 2rpx solid #DDDDDD;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16rpx;
}

.radio.checked {
  background-color: #E8101E;
  border-color: #E8101E;
}

.radio-icon-image {
  width: 32rpx;
  height: 32rpx;
}

.radio-label {
  font-size: 28rpx;
  color: #333333;
}

.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.upload-preview {
  width: 100%;
  height: 300rpx;
  border-radius: 12rpx;
  margin-bottom: 16rpx;
}

.upload-placeholder {
  width: 100%;
  height: 300rpx;
  background: #F7F8FA;
  border-radius: 12rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16rpx;
  border: 2rpx dashed #DDDDDD;
}

.upload-icon {
  width: 80rpx;
  height: 80rpx;
}

.upload-hint {
  font-size: 24rpx;
  /* color: #E8101E; */
  text-align: center;
}

.upload-desc {
  font-size: 24rpx;
  color: #999999;
  margin-bottom: 20rpx;
  margin-top: 12rpx;
}

.upload-dashed {
  width: 100%;
  border: 2rpx dashed #DDDDDD;
  border-radius: 16rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30rpx;
  margin-bottom: 16rpx;
  background: #FAFBFC;
}

.upload-camera-img {
  width: 446rpx;
  height: 298rpx;
  margin-left: 100rpx;
}

.image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16rpx;
  margin-top: 16rpx;
}

.image-item {
  position: relative;
  width: 200rpx;
  height: 200rpx;
}

.qualification-image {
  width: 200rpx;
  height: 200rpx;
  border-radius: 12rpx;
}

.image-delete {
  position: absolute;
  top: -10rpx;
  right: -10rpx;
  width: 36rpx;
  height: 36rpx;
  background: #E8101E;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 28rpx;
}

.image-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2rpx dashed #DDDDDD;
  width: 214rpx;
  height: 214rpx;
  background: #F5F5F5;
  border-radius: 20rpx;
}

.upload-icon-small {
  width: 48rpx;
  height: 48rpx;
  margin-bottom: 8rpx;
}

.add-text {
  font-size: 22rpx;
  color: #999999;
}

.popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  visibility: hidden;
  transition: visibility 0.3s;
}

.popup.show {
  visibility: visible;
}

.popup-mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.popup-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #FFFFFF;
  border-radius: 24rpx 24rpx 0 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24rpx 30rpx;
  border-bottom: 1rpx solid #F0F0F0;
}

.popup-title {
  font-size: 32rpx;
  font-weight: 600;
  color: #333333;
}

.popup-close {
  font-size: 40rpx;
  color: #999999;
}

.region-body {
  height: 500rpx;
}

.picker-scroll {
  width: 100%;
  height: 100%;
}

.picker-item {
  line-height: 68rpx;
  text-align: center;
  font-size: 28rpx;
  color: #333333;
}

.popup-footer {
  display: flex;
  padding: 20rpx 30rpx;
  gap: 20rpx;
}

.popup-btn {
  flex: 1;
  height: 80rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12rpx;
}

.popup-btn.cancel {
  background: #F5F5F5;
}

.popup-btn.confirm {
  background: #E8101E;
}

.popup-btn .btn-text {
  font-size: 28rpx;
}

.popup-btn.cancel .btn-text {
  color: #666666;
}

.popup-btn.confirm .btn-text {
  color: #FFFFFF;
}

.picker-list {
  padding: 20rpx 0;
}

.picker-item-row {
  padding: 24rpx 30rpx;
  font-size: 28rpx;
  color: #333333;
  text-align: center;
}

.picker-item-row text.active {
  color: #E8101E;
}
</style>