const Parse = getApp().Parse;
const company = getApp().globalData.company
// const login = require('../../../utils/login')
Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        user: null,

    },
    ready: async function () {
        // this.getmy()
    },
    /**
     * 组件的方法列表
     */
    methods: {
        async getmy() {
            // let userLogin = wx.getStorageSync("userLogin");
            // if (userLogin == "") {
            //     login.loginNow();
            //     return;
            // }
            let uid = Parse.User.current().id
            console.log(uid);
            let ShopOrder = new Parse.Query('_User')
            let shopOrder = await ShopOrder.get(uid)
            this.setData({
                user: shopOrder.toJSON()
            })
            console.log(this.data.user);
        },
        goodsorder() {
            wx.navigateTo({

                url: `/nova-tourism/pages/my/shop-order/index?type=shop&themeColor=#46a9a4`
            });
        },
        myinformation() {
            wx.navigateTo({
                url: '/common-page/pages/info/index'
            });

        },
        refund() {
            wx.navigateTo({
                url: '/nova-tourism/pages/my/refund/refund-list/index'
            });
        },

        homestayorder() {
            wx.navigateTo({
                url: '/nova-tourism/pages/my/homestay-order/index'
            });

        },
        orderdetails() {
            wx.navigateTo({
                url: '/nova-tourism/pages/my/order-details/index'
            });

        },
        comments() {
            wx.navigateTo({
                url: '/nova-tourism/pages/my/comments/index'
            });

        },

        merchant() {
            let merchant = wx.getStorageSync('merchant');
            if (merchant) {
                wx.navigateTo({
                    url: '/nova-tourism/pages/my/merchant/merchant-home/index'
                });
            } else {
                wx.navigateTo({
                    url: '/nova-tourism/pages/my/merchant/login/index'
                });
            }

        },
        feedback() {
            wx.navigateTo({
                url: '/nova-tourism/pages/my/feedback/index'
            });
        },
        foodorder() {
            wx.navigateTo({
                url: '/nova-tourism/pages/my/eat/index'
            });
        }
    }
})