Component({
    properties: {
        confirm: {
            type: Function
        },
        type: {
            type: String,
            value: "明细"
        }
    },
    data: {
        radio: "",
        show: false,
        loading: false
    },
    lifetimes: {
        attached: function () {
            getApp().globalData.Language.getLanguagePackage(this)
        }
    },
    methods: {
        changeRadio(e) {
            this.setData({
                radio: e.currentTarget.dataset.name
            })
        },
        onCancel() {
            this.setData({
                show: false,
                loading: false
            })
        },
        onOpen() {
            this.setData({
                show: true
            })
        },
        onConfirm() {
            if (!this.data.radio.length) return wx.showToast({
                title: getApp().globalData.Language.getMapText('还未选择同步方式'),
                icon: "none"
            })
            this.setData({
                loading: true
            })
            this.triggerEvent("confirm", this.data.radio)
        }
    }
})