<template>
  <view class="page-container">
    <scroll-view class="page-body" scroll-y>
      <view class="form-section">
        <view class="form-group">
          <view class="form-item">
            <text class="form-label">企业名称</text>
            <text class="form-value">{{ enterpriseName || '-' }}</text>
          </view>
          <view class="form-item">
            <text class="form-label">企业代码</text>
            <text class="form-value">{{ enterpriseId || '-' }}</text>
          </view>
          <view class="form-item">
            <text class="form-label">详细地址</text>
            <text class="form-value">{{ address || '-' }}</text>
          </view>
        </view>
        <view class="form-group">
          <view class="form-item">
            <text class="form-label">联系人</text>
            <text class="form-value">{{ contact || '-' }}</text>
          </view>
          <view class="form-item">
            <text class="form-label">联系电话</text>
            <text class="form-value">{{ phone || '-' }}</text>
          </view>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  computed: {
    ...mapGetters('user', ['enterpriseInfo'])
  },
  data() {
    return {
        enterpriseName: '',
        enterpriseId: '',
        address: '',
        contact: '',
        phone: ''
    }
  },
  onLoad() {
    this.loadEnterpriseInfo()
  },
  methods: {
    async loadEnterpriseInfo() {
      const enterpriseInfo = await this.$store.dispatch('user/getEnterpriseInfo')
      if (enterpriseInfo) {
        this.enterpriseName = enterpriseInfo.fullEnterpriseName || enterpriseInfo.enterpriseName || ''
        this.enterpriseId = enterpriseInfo.enterpriseId
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.form-section {
  padding: $spacing-base $spacing-md;
}
</style>
