const _Http = getApp().globalData.http;

Component({
    properties: {
        list: Array
    },
    methods: {
        toDetail(e) {
            const {
                id
            } = e.currentTarget.dataset;
            wx.redirectTo({
                url: `/packageA/offers/detail?sa_quotedpriceid=${id}`,
            })
        },
        copyItem(e) {
            const {
                billno,
                sa_quotedpriceid
            } = e.currentTarget.dataset.item;
            wx.showModal({
                title: '提示',
                content: `是否确认复制“${billno}”`,
                complete: ({
                    confirm
                }) => {
                    if (confirm) _Http.basic({
                        "id": 20221209094103,
                        "content": {
                            sa_quotedpriceid
                        },
                    }).then(res => {
                        wx.showToast({
                            title: res.msg == '成功' ? '复制成功' : res.msg,
                            icon: "none"
                        });
                        setTimeout(() => {
                            wx.redirectTo({
                                url: `/packageA/offers/detail?sa_quotedpriceid=${res.data.sa_quotedpriceid}`,
                            })
                            let page = getCurrentPages().find(v => v.__route__ == 'packageA/offers/index');
                            if (page) page.getList(true);
                        }, 300)
                    })
                }
            })
        },
    }
})