// pages/my/address/address.js
const app =getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        addressList:[]
    },
    onLoad:function(){
        this.address()
    },
    addSite(e){
        let {parmise} = e.currentTarget.dataset
        console.log(parmise);
        wx.navigateTo({
          url: './addSite/addSite?parmise='+parmise,
        })
    },
    editSite(e){
        let {parmise} = e.currentTarget.dataset
        console.log(parmise);
        wx.navigateTo({
          url: './addSite/addSite?parmise='+JSON.stringify(parmise),
        })
    },
    //获取地址列表
    address(){
        var that=this;
        app.api.useApi(app.globalData.baseAppUrl + "api/address/index", {
            network_id: 1,
        }, "get").then(function (res) {
            
            if (res.original.code != 200) {
                wx.showLoading({
                    title:res.original.message.msg,
                })
            } else {
              
                that.setData({
                    addressList: res.original.message.data.data
                })
            }

            setTimeout(function () {
                wx.hideLoading({
                  success: (res) => {},
                })
               }, 2000);

        }).catch(function (err) {
            console.log(222);
        })
    }

})