Commit 5d2f57a4 by huyue

动态获取门店地址

1 parent 172fcd2a
...@@ -172,5 +172,13 @@ module.exports = { ...@@ -172,5 +172,13 @@ module.exports = {
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) })
},
/** 查询附近地址 */
searchStoreAddress(data) {
return http.post({
method: 'dj.api.car.boutique.resident.coupon.address.search',
projectName: 'boutique',
...data
})
} }
} }
...@@ -150,8 +150,8 @@ ...@@ -150,8 +150,8 @@
<view class="store-info"> <view class="store-info">
<view class="sprite-icon icon-icon-store"></view> <view class="sprite-icon icon-icon-store"></view>
<p class="store-label">附近门店</p> <p class="store-label">附近门店</p>
<p class="store-address">{{ couponDetailInfo.merchantAddress }}</p> <p class="store-address">{{ storeAddress }}</p>
<view class="copy-btn" @click="copyText"><view class="sprite-icon icon-icon-copy copy"></view>复制</view> <view class="copy-btn" v-if="this.storeAddress" @click="copyText"><view class="sprite-icon icon-icon-copy copy"></view>复制</view>
</view> </view>
<view :class="['usage-notice', couponDetailInfo.couponState == 2 ? 'claimed-usage':'']"> <view :class="['usage-notice', couponDetailInfo.couponState == 2 ? 'claimed-usage':'']">
<view :class="[couponDetailInfo.couponState == 2 ? 'claimed-notice':'']"> <view :class="[couponDetailInfo.couponState == 2 ? 'claimed-notice':'']">
...@@ -233,7 +233,8 @@ export default { ...@@ -233,7 +233,8 @@ export default {
}, },
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 8 pageSize: 8,
storeAddress: ''
} }
}, },
props: { props: {
...@@ -252,6 +253,31 @@ export default { ...@@ -252,6 +253,31 @@ export default {
console.log('init'); console.log('init');
this.getGrantRecord() 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*/ /** 接口调用 uni.$api.pointApi*/
// 优惠券个数 // 优惠券个数
statisticsCount() { statisticsCount() {
...@@ -324,10 +350,12 @@ export default { ...@@ -324,10 +350,12 @@ export default {
// 使用优惠券 // 使用优惠券
this.showCouponPon = true this.showCouponPon = true
// this.couponDetailInfo = row // this.couponDetailInfo = row
this.getLocation(row.brandName)
break break
case 2: case 2:
this.showCouponPon = true this.showCouponPon = true
// this.couponDetailInfo = row // this.couponDetailInfo = row
this.getLocation(row.brandName)
break break
default: default:
return return
...@@ -335,6 +363,7 @@ export default { ...@@ -335,6 +363,7 @@ export default {
}, },
closePop() { closePop() {
this.showCouponPon = false this.showCouponPon = false
this.storeAddress = ''
}, },
// 领取使用按钮 // 领取使用按钮
handleUse() { handleUse() {
...@@ -363,7 +392,7 @@ export default { ...@@ -363,7 +392,7 @@ export default {
// 复制 // 复制
copyText() { copyText() {
uni.setClipboardData({ uni.setClipboardData({
data: this.couponDetailInfo.merchantAddress, data: this.storeAddress,
success: function() { success: function() {
uni.showToast({ uni.showToast({
title: '复制成功', title: '复制成功',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!