// pages/xungengdetails/xungengdetails.js import http from '../../base/httputil' const app = getApp() Page({ /** * 页面的初始数据 */ data: { id: null, host: app.globalData.host, //店铺经纬度 latitude: 43.8691319, longitude: 125.3504459, businessName: null, busEnterpriseId: null, busPatrolstationId: null, busPatrolstationName: null, orgCode: null, remark:null, //标记点 markers: [{ id: 0, name: "编程小石头", address: "长春首佳科技有限公司", latitude: 43.8691319, longitude: 125.3504459, width: 35, height: 50 }] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.data.id=options.id }, onShow(){ this.getDetails() }, getDetails() { wx.showLoading() let obj = new Object(); obj.busPatrolstationCode = this.data.id http.post("/system/AppPatrolstationController/getPatrolstationDetail", obj, this.getDetailsSuccess) }, getDetailsSuccess(res) { console.log("!!!", res) wx.hideLoading() if (res.data.length == 0) { wx.showToast({ title: '暂无巡更点', icon: 'none' }) setTimeout(() => { wx.navigateBack() }, 2000); } else { this.setData({ businessName: res.data[0].busEnterpriseName, orgCode: res.data[0].busPatrolstationCode, busEnterpriseId: res.data[0].busEnterpriseId, busPatrolstationId: res.data[0].busPatrolstationId, busPatrolstationName: res.data[0].busPatrolstationName, latitude: res.data[0].latitude, longitude: res.data[0].longitude, remark:res.data[0].remarks, markers: [{ id: Number(res.data[0].busPatrolstationId), name: res.data[0].busPatrolstationName, latitude: res.data[0].latitude, longitude: res.data[0].longitude, width: 35, height: 50 }] }) } }, bindViewEdit() { console.log("@@@", this.data.busEnterpriseId) console.log("@@@", this.data.busPatrolstationId) wx.navigateTo({ url: '../update_patrol_point/update_patrol_point?enterpriseId=' + this.data.busEnterpriseId + "&code=" + this.data.orgCode, }) }, bindViewXungeng() { // this.data.lasttime=util.formatDate(new Date(e.data.zgtzs.lastTime),'yyyy年MM月dd日') ; wx.showLoading() let obj = new Object(); obj.busPatrolstationId = this.data.busPatrolstationId http.post("/system/AppXungengController/doXungeng", obj, this.getXunGengSuccess) }, getXunGengSuccess(res) { console.log("@@@", res) wx.hideLoading() wx.showToast({ title: res.msg, icon: 'none' }) setTimeout(() => { if (res.code == 200) { wx.navigateBack() } }, 1000); }, bindViewXunGengJiLu() { wx.navigateTo({ url: '../xungengjilu/xungengjilu?busPatrolstationId=' + this.data.busPatrolstationId, }) }, bindViewQiYeDelete() { let that = this wx.showModal({ title: "提示", content: "确定要弃用编号为" + this.data.orgCode + "的巡更点吗?", success: function (sm) { if (sm.confirm) { let obj = new Object() obj.busPatrolstationId = that.data.busPatrolstationId http.post("/system/AppPatrolstationController/deletePatrolstationList", obj, that.deleteSuccess) } } }) }, deleteSuccess(res) { console.log("@@", res) wx.showToast({ title: res.msg, icon: 'none' }) setTimeout(() => { if (res.code == 200) { wx.navigateBack() } }, 1000); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })