// pages/order/order.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        current:0,
        orderList:
            [
                {title:'温哥华+翡翠岛+路易斯湖五日游',time:'2018.4.28',name:'旦巴  在多伦多',state:1,},
                {title:'温哥华+翡翠岛+路易斯湖五日游',time:'2018.4.28',name:'旦巴  在多伦多',state:2,},
                {title:'温哥华+翡翠岛+路易斯湖五日游',time:'2018.4.28',name:'旦巴  在多伦多',state:3,},
                {title:'温哥华+翡翠岛+路易斯湖五日游',time:'2018.4.28',name:'旦巴  在多伦多',state:4,},
            ],
        tabcurrent: {tab: 3,bubble: ''},
        is_showAnswer: false,
        is_showUserInfo:false,
        is_answer: true,
    },
    //tab点击事件
    chargeTab(e) {
        this.setData({
            current: e.currentTarget.dataset.current
        })
    },
    disableScroll() {},
    handleBackground() {
        console.log('dianji');
        this.setData({is_showAnswer: false,is_showUserInfo:false,})
    },
    //首页-导航
    service(e) {
        var tindex = e.currentTarget.dataset.tindex;
        var tabcurrent = this.data.tabcurrent;
        if (tabcurrent == tindex) {
            return false
        } else {
            this.setData({
                tabcurrent: tindex
            })
            wx.redirectTo({
                url: '/pages/index/index',
            })
        }
    },


    //拼单-导航
    consult(e) {
        var tindex = e.currentTarget.dataset.tindex
        var tabcurrent = this.data.tabcurrent
        if (tabcurrent == tindex) {
            return false
        } else {
            this.setData({
                tabcurrent: tindex
            })
            // wx.showToast({
            //     title: '该功能正在开发中',
            //     icon: 'none'
            // })
            wx.redirectTo({
                url: '/pages/spell-list/spell-list',
            })
        }
    },
    //发布按钮
    release(e) {
        console.log('发布');
        const self = this;
        if(!self.data.is_answer) {
            self.setData({
                is_showAnswer: true
            });
        }else {
            self.setData({
                is_showUserInfo: true
            });
        }
    },
    //取消发布弹窗
    cancelPopup() {
        let that = this;
        that.setData({
            releasepopup: false
        })
    },
    //订单-导航
    wish(e) {
        var tindex = e.currentTarget.dataset.tindex
        var tabcurrent = this.data.tabcurrent
        if (tabcurrent == tindex) {
            return false
        } else {
            this.setData({
                tabcurrent: tindex
            })
            // wx.showToast({
            //     title: '该功能正在开发中',
            //     icon: 'none'
            // })
            wx.redirectTo({
                url: '/pages/order/order',
            })
        }
    },
    //我的-导航
    my(e) {
        var tindex = e.currentTarget.dataset.tindex
        var tabcurrent = this.data.tabcurrent
        if (tabcurrent == tindex) {
            return false
        } else {
            this.setData({
                tabcurrent: tindex
            })
            wx.redirectTo({
                url: '/pages/my/my',
            })
        }
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})