const imgurl = require("../../utils/imgurl"); Component({ properties: { mallList: { value: [], type: Array } }, data: { telJpgUrl: imgurl.teljpg.url, list: [], // 广场、商户列表 mallNum: 0, // 适用商户数量 }, methods: { // 跳转详情页 gotoDetail(e) { console.log(e); tt.navigateTo({ url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}&mallTenantId=${e.currentTarget.dataset.tenantid}` }) }, // 跳转资质页面 goCertification(e) { tt.navigateTo({ url: `/pages/shopCertification/shopCertification?id=${e.currentTarget.dataset.id}` }) }, //跳转地图页面 goMap(e) { let { latitude, longitude } = e.currentTarget.dataset.item console.log(latitude, longitude); tt.openLocation({ latitude: Number(latitude), longitude: Number(longitude), scale: 18, success() { console.log("打开地图成功"); }, fail(err) { console.log("打开地图失败:", err.errMsg); }, }); }, goFitShop() { const arr = [] this.data.list.forEach(item => { item.merchantVoList.forEach(el => { arr.push(el) }) }) tt.navigateTo({ url: `/pages/fitShop/fitShop?list=${JSON.stringify(arr)}`, success: (res) => {}, fail: (res) => {}, }); }, expandList(e) { const index = e.currentTarget.dataset.index const arr = this.data.list arr[index].expand = !arr[index].expand this.setData({ list: arr }) }, phone(e) { tt.makePhoneCall({ phoneNumber: e.target.dataset.merchantlinkphone }); }, }, ready() { this.setData({ list: JSON.parse(JSON.stringify(this.properties.mallList)) }) console.log(this.data.mallList, 'mallList'); let mallNum = 0 this.data.list.forEach(item => { mallNum += item.merchantVoList.length }) this.setData({ mallNum: mallNum }) }, created() { } })