<script>
var util = require('./utils/util.js');
var api = require('./config/api.js');
var user = require('./utils/user.js');
export default {
    data() {
        return {};
    },
    onLaunch: function () {
        const updateManager = uni.getUpdateManager();
        uni.getUpdateManager().onUpdateReady(function () {
            uni.showModal({
                title: '更新提示',
                content: '新版本已经准备好，是否重启应用？',
                success: function (res) {
                    if (res.confirm) {
                        // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
                        updateManager.applyUpdate();
                    }
                }
            });
        });
       },
    onShow: function (options) {
        /*是否授权登录*/
        user.checkLogin()
            .then((res) => {
                this.globalData.hasLogin = true;
                if (this.globalData.checkLoginReadyCallback) {
                    this.globalData.checkLoginReadyCallback();
                }
            })
            .catch(() => {
                this.globalData.hasLogin = false;
            });

        //购物车数据显示
        //user.cartcount();
        //获取其他小程序传过来的参数
        console.info(options);
        let query = options.query || {};
        if (query.orderId) {
            uni.navigateTo({
                url: 'pages/ucenter/serviceDetail/serviceDetail?orderId=' + query.orderId
            });
        }
    },
    globalData: {
        shopId: '',
        hasLogin: false,

        //是否授权登录
        isMember: false,

        //是否是会员
        userInfo: {},

        r_userid: 0,

        //推荐人id
        iscert: false,

        //是否注册过
        mapKey: 'JA2BZ-XGOEU-UNZVD-46G64-S6MYJ-6BBF4',

        currentLocationName: '位置获取中',
        rId: '',

        //引荐人ID
        shareImage: '',

        recommend: {
            //引荐人信息
            userName: '',
            avatarUrl: '',
            bCode: '',
            phone: '',
            unionId: '',
            openId: '',
            sessionKey: ''
        },

        infoGoods: {
            picUrl: '',
            name: '',
            brief: '',
            type: '0'
        },

        //信息收集,
        infoAddress: {
            addressId: '',
            addressDetail: ''
        },

        memberUserInfo: {
            nickName: '',
            avatarUrl: '/static/images/new/icon-user.png'
        },

        checkLoginReadyCallback: function () {
            //是否登录
            this.hasLogin = true;
        }
    }
};

//购物车隐藏
// {
//   "pagePath": "pages/tabBar/cart/cart",
//   "iconPath": "static/images/cart.png",
//   "selectedIconPath": "static/images/cart@selected.png",
//   "text": "购物车"
// },
</script>
<style>
/**app.wxss**/

.container {
    box-sizing: border-box;
    background-color: #f5f5f5;
    /* font-family: PingFangSC-Light, helvetica, 'Heiti SC'; */
	font-family: AlibabaPuHuiTi_2_55_Regular;
}

view,
image,
text,
navigator {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}
page {
    color: #2a2a2a; /*主要颜色*/
    font-size: 28rpx;
    background: #f5f5f5;
}
text,
view {
    /* font-family: PingFangSC-Light, helvetica, 'Heiti SC'; */
	font-family: AlibabaPuHuiTi_2_55_Regular;
    /* font-weight: 500; */
}
.sub-color {
    color: #85868a;
}
.jz-color {
    color: #09afff; /*鲸致色号00AFFF*/
}
.van-tab > view.van-ellipsis {
    color: #888;
}
.van-tab--active.van-tab > view.van-ellipsis {
    color: #09afff;
}

van-dialog .van-button {
    color: #09afff !important;
}
.van-dialog__message-text {
    color: #666;
}
.van-button--info {
    background: #09afff !important;
    border: none !important;
}
.bottom-fixed-btn-wrapper {
    position: fixed;
    bottom: 146rpx;
    left: 0;
    right: 28rpx;
    left: 28rpx;
}
.bottom-fixed-btn-wrapper .van-button {
    height: 74rpx;
    border: none;
}

.common-btn-wrapper {
    margin: 0 28rpx 0;
}
.common-btn-wrapper .van-button {
    height: 74rpx;
    margin: 0 0 48rpx 0;
}
</style>
