let Parse = getApp().Parse;
const company = getApp().globalData.company
const dateF = require('../../../../../../../utils/date')
Page({

    /**
     * 页面的初始数据
     */
    data: {
        order: null,
        id: null,
        time: null
    },
    async getShopOrder() {
        let ShopOrder = new Parse.Query('RoomOrder')
        ShopOrder.include('shopStore')
        ShopOrder.include('user')
        let Store = await ShopOrder.get(this.data.id)
        let order = Store.toJSON()
        let time = dateF.formatTime("YYYY-mm-dd HH:MM:SS", order.createdAt)
        console.log(order);
        this.setData({ order: order, time: time })
    },
    phone() {
        let phone = this.data.order.user.mobile
        console.log(phone);
        wx.makePhoneCall({
            phoneNumber: phone
        })
    },

    copywxtap: function() {
        wx.showToast({
            title: '复制成功',
        })
        wx.setClipboardData({
            data: this.data.order.orderNum,
            success: function(res) {
                wx.getClipboardData({
                    //这个api是把拿到的数据放到电脑系统中的
                    success: function(res) {
                        console.log(res.data) // data
                    }
                })
            }
        })
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        let id = options.id
        console.log(id);
        this.setData({ id: id })
        this.getShopOrder()
    },

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

    },

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

    },

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

    },

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

    },

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

    },

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

    },

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

    }
})