130 lines
3.1 KiB
JavaScript

let util = require('../../../utils/util')
let apiArr = require('../../../api/water_filter')
// packages/master/masterIndex/index.js
Page({
/**
* 页面的初始数据
*/
data: {
funcList: [
{
text: "新装工单",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon3.png?1",
url: "../order/index?type=0",
},
{
text: "维修工单",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon4.png?1",
url: "../order/index?type=1",
},
{
text: "拆除工单",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/removeIcon.png",
url: "../order/index?type=3",
},
{
text: "滤芯更换工单",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/partsIcon.png",
url: "../order/index?type=2",
},
{
text: "设备管理",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon2.png?1",
url: "../../WaterPurifier/pages/device/deviceList/deviceList",
}
],
serverInfo: {}
},
callPhone() {
let that = this
wx.makePhoneCall({
phoneNumber: that.data.serverInfo.customer_phone,
})
},
jump(e) {
wx.navigateTo({
url: e.currentTarget.dataset.url,
})
},
getMasterInfo() {
let that = this
util.postUrl(apiArr.masterInfo, {
user_id: wx.getStorageSync('userId')
}, res => {
that.setData({
info_id: res.info_id
})
wx.setStorageSync('info_id', res.info_id)
})
},
getServerInfo() {
let that = this
util.postUrl(apiArr.getServerInfo, '', res => {
res.qr_code = res.qr_code.startsWith('http') ? res.qr_code : util.img_url + res.qr_code
console.log(res.qr_code);
that.setData({
serverInfo: res
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getMasterInfo()
this.getServerInfo()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})