import agentApi from '../../apis/agent' const app = getApp(); Page({ /** * 页面的初始数据 */ data: { agent_user:{}, clientInfo:[ { key:'客户编号', id:'user_id', val:'50643540' }, { key:'委托时间', id:'createTime', val:'2020.04.14' }, { key:'维护进度', id:'', val:'暂无' } ], demand:[ { key:'购房预算', id:'first_budget', val:'首付预算60-80万元' }, { key:'购房位置', id:'buy_house_address', val:'香洲区-唐家湾镇' }, { key:'面积', short:true, id:'ideal_area', val:'80-120m²' }, { key:'居室', short:true, id:'rooms', val:'3居' }, { key:'置业目的', short:true, id:'purpose', val:'刚需' }, { key:'物业类型', short:true, id:'property_type', val:'待完善' } ] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { app.wxshowloading('拼命加载中...'); let {agency_user_id,user_id} = options this.user_id = user_id this.agency_user_id = agency_user_id }, getClientDetail (agency_user_id,user_id) { agentApi.fetchCustomerDetail({agency_user_id,user_id}).then(res => { if (res.data) { this.setData({ agent_user: res.data }) } }).finally(data=>{ wx.hideLoading() }) }, makePhoneCall(){ app.makePhoneCall(this.data.agent_user.user_phone); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getClientDetail(this.agency_user_id, this.user_id) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, toChat () { wx.navigateTo({ url: `/pages/chat/chat?toId=${this.data.agent_user.user_id}&toName=${this.data.agent_user.user_name}`, }) }, toEdit () { wx.navigateTo({ url: `/pages/add-client/add-client?customer_id=${this.user_id}&agency_user_id=${this.agency_user_id}`, }) } })