From ddbff3fe9696b4d7434d812d4b885626e58d8d6c Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Wed, 5 Jul 2023 17:56:12 +0800 Subject: [PATCH] upload --- pages2/shopSelect/shopSelect.js | 45 ++++++++++++++++++++++++++++--- pages2/shopSelect/shopSelect.less | 12 ++++++++- pages2/shopSelect/shopSelect.ttml | 3 +++ pages2/shopSelect/shopSelect.ttss | 11 +++++++- 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/pages2/shopSelect/shopSelect.js b/pages2/shopSelect/shopSelect.js index 4bc0ffc..fa07fb2 100644 --- a/pages2/shopSelect/shopSelect.js +++ b/pages2/shopSelect/shopSelect.js @@ -79,7 +79,7 @@ Page({ }).then(res => { const keys = Object.keys(res.data) if (keys.length > 0) { - const mallList = [] + const list = [] let i = 0 keys.forEach(item => { const arr = item.split('|') @@ -92,11 +92,20 @@ Page({ if (i == 0) { obj.expand = true } - mallList.push(obj) + list.push(obj) i++ }) + + const mallList = [] + // 过滤商管商户 + list[0].merchantVoList.forEach(item => { + if (!item.isAdmin) { + mallList.push(item) + } + }) + that.setData({ - mallList: mallList[0].merchantVoList + mallList }) console.log(that.data.mallList, 'mallList'); @@ -115,6 +124,9 @@ Page({ // 获取适用门店所在的城市list getCityList(couponChannelId) { + tt.showLoading({ + title: '加载中...', + }) const that = this Http.get({ url: config.api.couponMerchantCity, @@ -140,6 +152,7 @@ Page({ }) console.log(tagArr, 'tagArr'); console.log(cityArr, 'cityArr'); + tt.hideLoading(); }).catch(err => { console.log(err, 'err'); }) @@ -320,12 +333,38 @@ Page({ }, goSetShop(e) { + if (e.target.id == "goMap") return const item = e.currentTarget.dataset.item console.log(item, 'item'); app.globalData.shopItem = item tt.navigateBack(); }, + + //跳转地图页面 + goMap(e) { + const item = e.currentTarget.dataset.item + const latitude = Number(item.latitude) + const longitude = Number(item.longitude) + if (!latitude && !latitude) { + tt.showToast({ + title: '抱歉,该门店暂不支持!', + }); + return + } + tt.openLocation({ + latitude, + longitude, + scale: 18, + success() { + console.log("打开地图成功"); + }, + fail(err) { + console.log("打开地图失败:", err.errMsg); + }, + }); + }, + goFindShop(e) { const name = e.currentTarget.dataset.name this.setData({ diff --git a/pages2/shopSelect/shopSelect.less b/pages2/shopSelect/shopSelect.less index 652de6f..dd9b899 100644 --- a/pages2/shopSelect/shopSelect.less +++ b/pages2/shopSelect/shopSelect.less @@ -34,13 +34,14 @@ page { margin: auto; .item { + position: relative; display: flex; justify-content: space-between; width: 95%; margin: auto; color: #ffffff; margin-bottom: 30rpx; - padding: 20rpx 25rpx; + padding: 20rpx 25rpx 50rpx 25rpx; box-sizing: border-box !important; background-image: linear-gradient(to top, #48c6ef 0%, #6f86d6 100%); border-radius: 12rpx; @@ -88,6 +89,15 @@ page { text-overflow: ellipsis; } } + + .mapBtn { + position: absolute; + bottom: 15rpx; + right: 15rpx; + padding: 7rpx 12rpx; + border-radius: 15rpx; + background-color: #f76767; + } } .takeingPlace { diff --git a/pages2/shopSelect/shopSelect.ttml b/pages2/shopSelect/shopSelect.ttml index b1ac699..0ca3cf3 100644 --- a/pages2/shopSelect/shopSelect.ttml +++ b/pages2/shopSelect/shopSelect.ttml @@ -21,6 +21,9 @@ {{ item.merchantName }} 地址:{{ item.addr }} + + 去这里 + diff --git a/pages2/shopSelect/shopSelect.ttss b/pages2/shopSelect/shopSelect.ttss index 5692d77..6e195d5 100644 --- a/pages2/shopSelect/shopSelect.ttss +++ b/pages2/shopSelect/shopSelect.ttss @@ -31,13 +31,14 @@ page .continer .selectShop .shopList { margin: auto; } page .continer .selectShop .shopList .item { + position: relative; display: flex; justify-content: space-between; width: 95%; margin: auto; color: #ffffff; margin-bottom: 30rpx; - padding: 20rpx 25rpx; + padding: 20rpx 25rpx 50rpx 25rpx; box-sizing: border-box !important; background-image: linear-gradient(to top, #48c6ef 0%, #6f86d6 100%); border-radius: 12rpx; @@ -80,6 +81,14 @@ page .continer .selectShop .shopList .item .infoBox2 .infoItem { overflow: hidden; text-overflow: ellipsis; } +page .continer .selectShop .shopList .item .mapBtn { + position: absolute; + bottom: 15rpx; + right: 15rpx; + padding: 7rpx 12rpx; + border-radius: 15rpx; + background-color: #f76767; +} page .continer .selectShop .shopList .takeingPlace { text-align: center; margin-top: 30rpx;