const _Http = getApp().globalData.http;
Page({
    data: {
        sys_enterprise_financeid: 0,
        item: {},
        tabbarList: [{
            icon: "icon-bodadianhua",
            label: "呼叫",
            alias: "call"
        }, {
            icon: "icon-a-yingxiaowuliaofuzhi",
            label: "复制",
            alias: "copy"
        }, {
            icon: "icon-bianji",
            label: "编辑",
            alias: "edit"
        }, {
            icon: "icon-shanchu",
            label: "作废",
            alias: "delete"
        }]
    },
    onLoad(options) {
        if (options.sys_enterprise_financeid) {
            this.setData({
                sys_enterprise_financeid: options.sys_enterprise_financeid
            });
            this.getDetail();
        }
    },
    //获取详情
    getDetail() {
        _Http.basic({
            "id": 20221026105702,
            "content": {
                "sys_enterprise_financeid": this.data.sys_enterprise_financeid
            },
        }).then(res => {
            if (res.msg != '成功') return wx.showToast({
                title: res.data,
                icon: "none"
            })
            const item = res.data;
            this.setData({
                list: [{
                    label: "名称",
                    value: item.enterprisename
                }, {
                    label: "纳税人识别号",
                    value: item.taxno
                }, {
                    label: "地址",
                    value: item.address
                }, {
                    label: "开户行",
                    value: item.bank
                }, {
                    label: "账号",
                    value: item.bankcardno
                }, {
                    label: "联系人号码",
                    value: item.phonenumber
                }],
                item: res.data
            })
        })
    },
    //详情按钮回调
    tabbarOnClick({
        detail
    }) {
        let page = getCurrentPages().find(v => v.__route__ == "packageA/setclient/detail");
        if (page) page.selectComponent('#Financing').selectComponent('#List').handleItem({
            target: {
                dataset: {
                    name: detail.alias,
                    item: this.data.item
                }
            }
        });
    },
    //详情单元格单击复制
    clickItem({
        detail
    }) {
        wx.setClipboardData({
            data: detail.value,
            success: () => {
                wx.hideToast();
                wx.showToast({
                    title: `已复制${detail.label}`,
                    icon: "none"
                })
            }
        })
    },
})