import popup, {PopupExportComponent} from "$utils/tool/popup";
import giveGift from "$utils/control/giveGift";

export default <LibMixins>{

    data(){
        return {
            number:1,
            giftSelect:0
        }
    },

    methods:{

        setNumber(item){
            if (this.number !== item) {
                this.number = item;
            }
        },

        // 充值
        recharge(){
            return popup.$open(PopupExportComponent.recharge);
        },

        // 赠送礼物
        changeGiftSelect(index){
            if (this.giftSelect !== index) {
                this.giftSelect = index;
            }
        },

        // 点击赠送触发
        giveGift(){
            let gift = this.giftData[this.giftSelect];

            if (gift) {
                giveGift.giveGift(gift,this.number,this.userInfo);
            }
        }

    }

}