const Http = require("../../../utils/HttpBasics"); const imgurl = require("../../../utils/imgurl"); const config = require("../../../config/config"); let app = getApp(); Page({ /** * 页面的初始数据 */ data: { teljpgUrl: imgurl.teljpg.url, page: 1, imglist:null, shopVoList:[], data:{}, id:null }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let that=this; if (options && options.id){ this.setData({ id: options.id }); that.getList(options.id); } }, /** * 拨打电话 */ phone: function (e) { let that = this; wx.makePhoneCall({ phoneNumber: e.target.dataset.merchantlinkphone }); }, /** * 获取商户详情 */ getList: function (id) { let that = this; let data; data = { pageNum: that.data.page, pageSize: 15, id:id } Http.get({ url: config.api.merchantList, data: data }).then(res => { that.setData({ data: res.data.list[0], shopVoList: res.data.list[0].shopVoList, imglist: JSON.parse(res.data.list[0].coverPicture) ? JSON.parse(res.data.list[0].coverPicture) : res.data.list[0].merchantImgUrl, }) }) .catch(err => { wx.showToast({ title: err.errMsg, icon: 'none', duration: 2000, mask: false }); }) }, /** * 获取多商铺列表 */ shopList:function(e){ wx.navigateTo({ url: `/pages/index/merchantList/index?id=${e.currentTarget.dataset.id}` }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, })