const _Http = getApp().globalData.http;
Page({
    data: {

    },
    onLoad(options) {
        this.setData({
            content: JSON.parse(options.perams)
        })
        this.getList();
    },
    /* 开始搜索 */
    startSearch({
        detail
    }) {
        this.setData({
            "content.where.condition": detail
        });
        this.getList(true);
    },
    onClear() {
        this.setData({
            "content.where.condition": ""
        });
        this.getList(true);
    },
    /* 获取地址列表 */
    getList(init) {
        let content = this.data.content;
        if (init) content.pageNumber = 1;
        if (content.pageNumber > content.pageTotal) return;
        _Http.basic({
            "id": "20221022165503",
            content
        }).then(res => {
            console.log("地址列表", res)
            if (res.msg != '成功') return wx.showToast({
                title: res.data,
                icon: "none"
            })
            this.setData({
                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
                "content.pageNumber": res.pageNumber + 1,
                "content.pageSize": res.pageSize,
                "content.pageTotal": res.pageTotal,
                "content.total": res.total
            })
            setTimeout(() => {
                this.selectComponent("#List").initRadio();
            }, 300)
        })
    },
    onReachBottom() {
        this.getList();
    },
})