const _Http = getApp().globalData.http;
Component({
    properties: {
        disabled: Boolean
    },
    data: {
        list: [],
        sys_enterpriseid: "",
        "content": {
            "nocache": true,
            "pageNumber": 1,
            "pageTotal": 1,
            "total": null,
            "type": 1,
            "where": {
                "condition": ""
            }
        }
    },
    methods: {
        getList(id, init) {
            let content = this.data.content;
            content.sys_enterpriseid = id;
            if (init) content.pageNumber = 1
            _Http.basic({
                "id": "20221018102003",
                content
            }).then(res => {
                console.log("项目商机", res)
                if (res.msg != '成功') return wx.showToast({
                    title: res.data,
                    icon: "none"
                })

                res.data = res.data.map(v => {
                    v.progress = v.totalstage ? v.stage / v.totalstage * 100 : 0;
                    return v
                })

                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,
                    sys_enterpriseid: id
                });
            })
        }
    }
})