let util = require('../../utils/util')
let apiArr = require('../../api/water_filter')

const __staticUrl = require('../../config/env.js').static_url
Page({
    data: {
        id: "",
        newOrderDesc: {},
        msg: "",
        imgList: [],
        imgList2: [],
        deviceInfo:{},
        deviceCode:"",
    },
    // 新装///////////////////////////////
    getNewOrderDesc() {
        let that = this
        util.postUrl(apiArr.newOrderDesc, { install_id: Number(that.data.id) }, res => {
            res.product_icon2 = util.img_url + res.product_icon
            res.qrcode2 =  util.img_url + res.qrcode

            that.setData({
                newOrderDesc: res,
            })

            if (res.status == 3) {
                let imgList2 = res.install_imgs.split(',')
                let imgList = []
                imgList2.forEach((item, index) => {
                    imgList.push(util.img_url + item)
                })
                that.setData({
                    msg: res.install_desc,
                    imgList2,
                    imgList,
                    dis1: true
                })
            }

        })
    },

    call(){
        let that= this
        wx.makePhoneCall({
          phoneNumber: that.data.newOrderDesc.cus_service_phone,
        })
    },



    onLoad(options) {
        let that = this
        // 这里可以根据options.id来设置不同的假数据
        const id = options.id;
        this.setData({
            id,
        });
        that.getNewOrderDesc()
        wx.showShareMenu({
            withShareTicket: true,
            menus: ['shareAppMessage', 'shareTimeline']
        })
    },

    onShareAppMessage(){
        return {
            title: '人人爱净水',  // 分享卡片标题（必填）
            path: '/pages/water_filter/water_filter',  // 用户点击后跳转的路径（可选，默认当前页）
            imageUrl: (__staticUrl + '/share.png')  // 自定义图片（可选，比例建议 5:4）
          }
    },
    onShareTimeline() {
        return {
            title: '人人爱净水', // 自定义标题
            query: '', // 自定义页面路径中的参数
            imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
        }
    },


});