import { Text, View } from '@tarojs/components'
import { useEffect, useState } from 'react'
import styles from './index.module.scss'
import IconFont from '@/components/iconfont/iconfont'
import AddressList from '@/components/AddressList'
import Popup from '@/components/popup'
import SelectAddress from '@/components/selectAddress'

interface Param {
  defaultValue: {
    address_title: string
    address_name: string
    address_phone: string
  }

}
export default (props: Param) => {
  const [data, setData] = useState({
    address_title: '',
    address_name: '',
    address_phone: '',
    address_mode: '物流',
  })
  useEffect(() => {
    if (props.defaultValue) {
      setData(e => ({
        ...e,
        address_title: props.defaultValue.address_title,
        address_name: props.defaultValue.address_name,
        address_phone: props.defaultValue.address_phone,
      }))
    }
  }, [props.defaultValue])
  return <>
    <View className={styles.address_con} >
      <IconFont name="icon-dingwei" size={50} />
      <View className={styles.message}>
        <View className={styles.info_address}>
          <View className={styles.address_name}>{data.address_title || '请选择收货地址'}</View>
        </View>
        <View className={styles.info_phone}>
          <Text>{`${data.address_name}  ${data.address_phone}`}</Text>
          <Text>{data.address_mode}</Text>
        </View>
      </View>
    </View>
  </>
}
