var app = getApp(); var netUtil = require("../../../utils/requestUtil.js"); //require引入 Page({ /** * 页面的初始数据 */ data: { id: '', data: null, StatusBar: app.globalData.StatusBar, CustomBar: app.globalData.CustomBar, index: null, multiIndex: [0, 0, 0], time: '12:01', startTime: '2018-12-25', endTime: '2019-12-25', region: ['安徽省', '合肥市', '高新区'], imgList: [], modalName: null, textareaAValue: '', textareaBValue: '', tenantUrl: '/pages/tenant/view/index', rent_type: { 1: "押一付一", 3: "押一付三", 6: "押一付六", 12: "押一付十二" } }, addTenant: function(e) { }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { this.setData({ id: options.id }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { this.getDetail(); }, //获取数据详情 getDetail: function() { var self = this; var url = app.globalData.requestUrl + 'index/house/viewRoom/' + this.data.id; netUtil.sendGet(url) .then((res) => { console.log(res) this.setData({ data: res.data.data }) }) }, //删除房间 delRoom: function(e) { var self = this wx.showModal({ title: '删除确认', content: '请再次确认是否删除数据?', success(obj) { if (obj.confirm) { var url = app.globalData.requestUrl + 'index/house/delRoom/' + self.data.id; netUtil.sendGet(url) .then((res) => { console.log(res) if (res.statusCode == 200 && res.data.code == 200) { wx.showToast({ title: '数据删除成功', icon: 'success', duration: 2000, success: function() { setTimeout(function() { wx.navigateBack({ delta: 1 }) }, 2000) } }) } else { wx.showToast({ title: res.data.msg, icon: 'none', duration: 3000 }) } }) } else if (obj.cancel) { console.log(2) } } }) }, //拨打电话 phoneCall: function(e) { var phone = e.currentTarget.dataset.phone; wx.makePhoneCall({ phoneNumber: phone, }) }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { return { title: '房租支付页面', path: '/pages/tenant/pay' } }, })