// pages/my/address/addSite/addSite.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        type: false,
        resultInfo: {
            name: '',
            phone: '',
            address: '',
            checked: false
        },
        name: '',
        phone: '',
        address: '',

        checked4: false

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.setData({
            type: options.parmise == '添加' ? true : false
        })
        console.log(options);

        if (this.data.type) {
            wx.setNavigationBarTitle({
                title: '添加新地址',
            })
        } else {
            wx.setNavigationBarTitle({
                title: '编辑地址',
            })
        }
    },
    onChange(e) {
        console.log(e);
        this.setData({
            checked4: e.detail
        })
        this.data.resultInfo.checked = this.data.checked4
    },
    input1(e) {
        console.log(this.data.resultInfo.name);
        this.setData({
            name: e.detail
        })
        this.data.resultInfo.name = this.data.name
        if (this.data.resultInfo.name != '') {
            this.setData({
                checked1: true
            })
        } else {
            this.setData({
                checked1: false
            })
        }
    },
    input2(e) {
        this.setData({
            phone: e.detail
        })
        this.data.resultInfo.phone = this.data.phone
        if (this.data.resultInfo.phone != '') {
            this.setData({
                checked2: true
            })
        } else {
            this.setData({
                checked2: false
            })
        }
    },
    input3(e) {
        this.setData({
            address: e.detail
        })
        this.data.resultInfo.address = this.data.address
        if (this.data.resultInfo.address != '') {
            this.setData({
                checked3: true
            })
        } else {
            this.setData({
                checked3: false
            })
        }

        console.log(this.data.checked1, this.data.checked2, this.data.checked3);
    },



})