Commit 5d2f57a4 by huyue

动态获取门店地址

1 parent 172fcd2a
......@@ -172,5 +172,13 @@ module.exports = {
projectName: 'boutique',
...data
})
},
/** 查询附近地址 */
searchStoreAddress(data) {
return http.post({
method: 'dj.api.car.boutique.resident.coupon.address.search',
projectName: 'boutique',
...data
})
}
}
......@@ -150,8 +150,8 @@
<view class="store-info">
<view class="sprite-icon icon-icon-store"></view>
<p class="store-label">附近门店</p>
<p class="store-address">{{ couponDetailInfo.merchantAddress }}</p>
<view class="copy-btn" @click="copyText"><view class="sprite-icon icon-icon-copy copy"></view>复制</view>
<p class="store-address">{{ storeAddress }}</p>
<view class="copy-btn" v-if="this.storeAddress" @click="copyText"><view class="sprite-icon icon-icon-copy copy"></view>复制</view>
</view>
<view :class="['usage-notice', couponDetailInfo.couponState == 2 ? 'claimed-usage':'']">
<view :class="[couponDetailInfo.couponState == 2 ? 'claimed-notice':'']">
......@@ -233,7 +233,8 @@ export default {
},
total: 0,
pageNum: 1,
pageSize: 8
pageSize: 8,
storeAddress: ''
}
},
props: {
......@@ -252,6 +253,31 @@ export default {
console.log('init');
this.getGrantRecord()
},
getLocation(brandName) {
uni.getLocation({
type: 'gcj02',
geocode: true, // 设置为 true 可直接获取经纬度及城市信息
success: function (res) {
console.log(res, '===='); // 打印位置信息
// 处理位置数据
const params = {
brandName,
lat: res.latitude,
lng: res.longitude
}
uni.$api.pointApi.searchStoreAddress(params).then(res => {
console.log(res, '======');
this.storeAddress = res
})
},
fail: function () {
uni.showToast({
title: '获取地址失败,将导致部分功能不可用',
icon: 'none'
});
}
});
},
/** 接口调用 uni.$api.pointApi*/
// 优惠券个数
statisticsCount() {
......@@ -324,10 +350,12 @@ export default {
// 使用优惠券
this.showCouponPon = true
// this.couponDetailInfo = row
this.getLocation(row.brandName)
break
case 2:
this.showCouponPon = true
// this.couponDetailInfo = row
this.getLocation(row.brandName)
break
default:
return
......@@ -335,6 +363,7 @@ export default {
},
closePop() {
this.showCouponPon = false
this.storeAddress = ''
},
// 领取使用按钮
handleUse() {
......@@ -363,7 +392,7 @@ export default {
// 复制
copyText() {
uni.setClipboardData({
data: this.couponDetailInfo.merchantAddress,
data: this.storeAddress,
success: function() {
uni.showToast({
title: '复制成功',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!