// pages/DetailPerson/index.js const $$ = require('../../utils/util'); // 详情接口 function getByIdApi(param) { return $$.request({ url: 'casePerson/getById', type: 'get', submitData: param || {}, service: 'mediate' }) } function getByIdAgentApi(param) { return $$.request({ url: 'caseAgent/getById', type: 'get', submitData: param || {}, service: 'mediate' }) } Page({ /** * 页面的初始数据 */ data: { data: {} }, //获取申请人详情 async getById(id) { $$.showLoading(); const res = await getByIdApi({ id }); $$.hideLoading(); if (res.type) { let data = res.data || {}; this.setData({ data }); } }, //获取被申请人详情 async getagenById(id) { $$.showLoading(); const res = await getByIdAgentApi({ id }); $$.hideLoading(); if (res.type) { let data = res.data || {}; this.setData({ data }); } }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let id = options.id; let perType = options.perType; // 15_020008-1申请方 24_00006-1 申请方代理人 15_020008-2被申请方 24_00006-2 被申请方代理人 if (perType === '15_020008-1' || perType === '15_020008-2') { this.getById(id) } if (perType === '24_00006-1' || perType === '24_00006-2') { this.getagenById(id) } }, })