新增微信定位 修改部分问题
This commit is contained in:
parent
aa20aa964b
commit
604f9aff08
@ -49,9 +49,9 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init()
|
this.init()
|
||||||
this.$geo.getWebGeo().then(pos => {
|
// this.$geo.getWebGeo().then(pos => {
|
||||||
this.geo = pos
|
// this.geo = pos
|
||||||
})
|
// })
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateTitle(title) {
|
updateTitle(title) {
|
||||||
@ -96,7 +96,7 @@ export default {
|
|||||||
link: this.$getShareLink(),
|
link: this.$getShareLink(),
|
||||||
};
|
};
|
||||||
// alert(JSON.stringify(shareinfo))
|
// alert(JSON.stringify(shareinfo))
|
||||||
const jsApiList = data.jsApiList || ['onMenuShareTimeline', 'onMenuShareAppMessage', 'updateAppMessageShareData', 'updateTimelineShareData'];
|
const jsApiList = data.jsApiList || ['onMenuShareTimeline', 'onMenuShareAppMessage', 'updateAppMessageShareData', 'updateTimelineShareData', 'openLocation', 'getLocation'];
|
||||||
const openTagList = data.openTagList || ['wx-open-launch-weapp'];
|
const openTagList = data.openTagList || ['wx-open-launch-weapp'];
|
||||||
jsApiList.push('wx-open-launch-weapp');
|
jsApiList.push('wx-open-launch-weapp');
|
||||||
wx.config({
|
wx.config({
|
||||||
|
|||||||
@ -24,15 +24,15 @@
|
|||||||
<van-field v-model="formData.shopname" label="店铺名称" placeholder="请输入店铺名称" required />
|
<van-field v-model="formData.shopname" label="店铺名称" placeholder="请输入店铺名称" required />
|
||||||
<van-field v-model="formData.cellphone" label="联系电话" placeholder="请输入联系电话" type="tel" required />
|
<van-field v-model="formData.cellphone" label="联系电话" placeholder="请输入联系电话" type="tel" required />
|
||||||
<van-field v-model="formData.huili" label="惠利比例" type="number" readonly>
|
<van-field v-model="formData.huili" label="惠利比例" type="number" readonly>
|
||||||
<template #extra><span style="color:#666">%</span></template>
|
<template #extra><span style="color:#999">%</span></template>
|
||||||
</van-field>
|
</van-field>
|
||||||
<van-field v-model="formData.shopcatename" label="商家分类" readonly />
|
<van-field v-model="formData.shopcatename" label="商家分类" readonly />
|
||||||
<van-field v-model="formData.businesstime" label="营业时间" />
|
<van-field v-model="formData.businesstime" label="营业时间" />
|
||||||
|
|
||||||
<van-collapse v-model="activeNames">
|
<van-collapse v-model="activeNames">
|
||||||
<van-collapse-item title="经营地址" name="1" value="点击展开查看详情">
|
<van-collapse-item title="经营地址" name="1" value="点击展开查看详情">
|
||||||
<div style="color: #222;">{{ formData.shopaddress }}</div>
|
<div style="color: #999;">{{ formData.shopaddress }}</div>
|
||||||
修改请联系平台
|
<span class="readonly-text">修改请联系平台</span>
|
||||||
</van-collapse-item>
|
</van-collapse-item>
|
||||||
<van-collapse-item title="商家介绍" name="2" value="点击展开查看详情">
|
<van-collapse-item title="商家介绍" name="2" value="点击展开查看详情">
|
||||||
<div class="shop-intro-wrap">
|
<div class="shop-intro-wrap">
|
||||||
@ -384,11 +384,25 @@ export default {
|
|||||||
font-size: 3.73vw;
|
font-size: 3.73vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.van-field__control:disabled) {
|
:deep(.van-field__control:disabled),
|
||||||
|
:deep(.van-field__control[readonly]) {
|
||||||
color: #999;
|
color: #999;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.van-field--readonly) {
|
||||||
|
.van-field__value {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-intro-wrap {
|
||||||
|
.readonly-text {
|
||||||
|
color: #999;
|
||||||
|
font-size: 3.2vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.img-thumb {
|
.img-thumb {
|
||||||
width: 14vw;
|
width: 14vw;
|
||||||
height: 10vw;
|
height: 10vw;
|
||||||
|
|||||||
@ -123,13 +123,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="goods">
|
<div class="goods">
|
||||||
<van-tabs v-model:active="activeType" :ellipsis="false" @change="changeTab" line-height="2vw" line-width="10.67vw"
|
<div class="tabs-sticky">
|
||||||
color="#f48fa7" title-active-color="#000" title-inactive-color="#4e4e4e">
|
<van-tabs v-model:active="activeType" sticky :ellipsis="false" @change="changeTab" line-height="2vw"
|
||||||
|
line-width="10.67vw" color="#f48fa7" title-active-color="#000" title-inactive-color="#4e4e4e"
|
||||||
|
style="z-index: 999;">
|
||||||
<van-tab name="" title="新品">
|
<van-tab name="" title="新品">
|
||||||
</van-tab>
|
</van-tab>
|
||||||
<van-tab v-for="item in typeData" :name="item.id" :title="item.name">
|
<van-tab v-for="item in typeData" :name="item.id" :title="item.name">
|
||||||
</van-tab>
|
</van-tab>
|
||||||
</van-tabs>
|
</van-tabs>
|
||||||
|
</div>
|
||||||
|
|
||||||
<BaseList ref="BaseList" url="/v1/client/EProsClient" :params="searchParams" :parseData="res => res.data.items"
|
<BaseList ref="BaseList" url="/v1/client/EProsClient" :params="searchParams" :parseData="res => res.data.items"
|
||||||
class="goods_box">
|
class="goods_box">
|
||||||
@ -233,9 +236,9 @@ export default {
|
|||||||
this.$get('/v1/client/EProsClient?recommend=true').then(res => {
|
this.$get('/v1/client/EProsClient?recommend=true').then(res => {
|
||||||
this.hotData = res.data.items || []
|
this.hotData = res.data.items || []
|
||||||
}),
|
}),
|
||||||
this.$get('/v1/client/EProcatesClient/1').then(res => {
|
this.$get('/v1/client/EProcatesClient/3').then(res => {
|
||||||
const filtered = res.data.filter(i => i.homeshowed)
|
// const filtered = res.data.filter(i => i.homeshowed)
|
||||||
this.typeData = filtered
|
this.typeData = res.data
|
||||||
}),
|
}),
|
||||||
]).catch(err => {
|
]).catch(err => {
|
||||||
this.$showFailToast(err.message || '加载失败')
|
this.$showFailToast(err.message || '加载失败')
|
||||||
@ -280,4 +283,13 @@ export default {
|
|||||||
color: #999;
|
color: #999;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.goods {
|
||||||
|
.tabs-sticky {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 99;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
<div class="disc_box"><img src="/img/icon_disc.png" alt="">{{ item.feeratio }}%</div>
|
<div class="disc_box"><img src="/img/icon_disc.png" alt="">{{ item.feeratio }}%</div>
|
||||||
<div class="canpay_box"><img src="/img/icon_canpay.png" alt="">可到店消费</div>
|
<div class="canpay_box" v-if="item.enabled"><img src="/img/icon_canpay.png" alt="">可到店消费</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -85,10 +85,38 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
this.init();
|
||||||
|
|
||||||
|
if (wx && this.$isWechat()) {
|
||||||
|
this.$post('/v1/client/HWxinfoClient/share', JSON.stringify(location.href)).then(res => {
|
||||||
|
const data = res.data || {};
|
||||||
|
const jsApiList = data.jsApiList || ['onMenuShareTimeline', 'onMenuShareAppMessage', 'updateAppMessageShareData', 'updateTimelineShareData', 'openLocation', 'getLocation'];
|
||||||
|
const openTagList = data.openTagList || ['wx-open-launch-weapp'];
|
||||||
|
jsApiList.push('wx-open-launch-weapp');
|
||||||
|
wx.config({
|
||||||
|
debug: false,
|
||||||
|
appId: data.appid,
|
||||||
|
timestamp: Number(data.timestamp) || 0,
|
||||||
|
nonceStr: data.noncestr,
|
||||||
|
signature: data.signature,
|
||||||
|
jsApiList: jsApiList,
|
||||||
|
openTagList: openTagList
|
||||||
|
});
|
||||||
|
wx.ready(() => {
|
||||||
|
wx.getLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
success: (e) => {
|
||||||
|
this.searchparams.latitude = e.latitude;
|
||||||
|
this.searchparams.longitude = e.longitude;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
const res = await this.$geo.getWebGeo();
|
const res = await this.$geo.getWebGeo();
|
||||||
this.searchparams.latitude = res.lat;
|
this.searchparams.latitude = res.lat;
|
||||||
this.searchparams.longitude = res.lon;
|
this.searchparams.longitude = res.lon;
|
||||||
this.init();
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.checkScroll();
|
this.checkScroll();
|
||||||
const ro = new ResizeObserver(() => this.checkScroll());
|
const ro = new ResizeObserver(() => this.checkScroll());
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<BasePage>
|
<BasePage>
|
||||||
<div class="checkout" v-if="data.shop && data.shop.shopname">
|
<div class="checkout" v-if="data.shop && data.shop.shopname">
|
||||||
|
<!-- 商家停业提示 -->
|
||||||
|
<div v-if="!shopopen" class="closed-tip">
|
||||||
|
<van-empty description="该商家已停业,暂不支持买单" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
<div class="shopinfo">
|
<div class="shopinfo">
|
||||||
<img class="icon" :src="$file(data.shop.shopimg)" alt="">
|
<img class="icon" :src="$file(data.shop.shopimg)" alt="">
|
||||||
|
|
||||||
@ -32,7 +38,7 @@
|
|||||||
<span class="canuse" v-else-if="checked !== '1'">{{ data.user.xiaofeijifen?.toFixed(2) }}可用</span>
|
<span class="canuse" v-else-if="checked !== '1'">{{ data.user.xiaofeijifen?.toFixed(2) }}可用</span>
|
||||||
<span class="use" v-else>-{{ jifenDeduction.toFixed(2) }}</span>
|
<span class="use" v-else>-{{ jifenDeduction.toFixed(2) }}</span>
|
||||||
<van-radio name="1" @click="toggleDeduction('jifen')"
|
<van-radio name="1" @click="toggleDeduction('jifen')"
|
||||||
:disabled="!data.user.xiaofeijifen || data.user.xiaofeijifen <= 0" />
|
:disabled="!data.user.xiaofeijifen || data.user.xiaofeijifen <= 0" checked-color="#ca2904" />
|
||||||
</template>
|
</template>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
<van-cell title="会员卡抵扣" icon="/img/vip_icon.png">
|
<van-cell title="会员卡抵扣" icon="/img/vip_icon.png">
|
||||||
@ -41,7 +47,7 @@
|
|||||||
<span class="canuse" v-else-if="checked !== '2'">{{ data.user.xiaofeiquan?.toFixed(2) }}可用</span>
|
<span class="canuse" v-else-if="checked !== '2'">{{ data.user.xiaofeiquan?.toFixed(2) }}可用</span>
|
||||||
<span class="use" v-else>-{{ quanDeduction.toFixed(2) }}</span>
|
<span class="use" v-else>-{{ quanDeduction.toFixed(2) }}</span>
|
||||||
<van-radio name="2" @click="toggleDeduction('quan')"
|
<van-radio name="2" @click="toggleDeduction('quan')"
|
||||||
:disabled="!data.user.xiaofeiquan || data.user.xiaofeiquan <= 0" />
|
:disabled="!data.user.xiaofeiquan || data.user.xiaofeiquan <= 0" checked-color="#ca2904" />
|
||||||
</template>
|
</template>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
@ -59,6 +65,7 @@
|
|||||||
<button class="payfor" @click="toPay">
|
<button class="payfor" @click="toPay">
|
||||||
去支付
|
去支付
|
||||||
</button>
|
</button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</BasePage>
|
</BasePage>
|
||||||
</template>
|
</template>
|
||||||
@ -68,6 +75,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
checked: '',
|
checked: '',
|
||||||
|
shopopen: true,
|
||||||
id: this.$route.query.id,
|
id: this.$route.query.id,
|
||||||
data: {
|
data: {
|
||||||
user: {},
|
user: {},
|
||||||
@ -106,6 +114,7 @@ export default {
|
|||||||
this.$get(`/v1/client/DShopsClient/${this.id}`).then(res => {
|
this.$get(`/v1/client/DShopsClient/${this.id}`).then(res => {
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
this.data.shop = res.data;
|
this.data.shop = res.data;
|
||||||
|
this.shopopen = res.data.enabled;
|
||||||
this.req.shopuserid = res.data.userid;
|
this.req.shopuserid = res.data.userid;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<div class="shop_details">
|
<div class="shop_details">
|
||||||
<div class="shopi_box">
|
<div class="shopi_box">
|
||||||
<img :src="$file(shopInfo.shopimg) || '/img/avatar.png'" alt="">
|
<img :src="$file(shopInfo.shopimg) || '/img/avatar.png'" alt="" @click="previewImage(shopInfo.shopimg)">
|
||||||
<div class="info_box">
|
<div class="info_box">
|
||||||
<div class="name_box">
|
<div class="name_box">
|
||||||
<b>{{ shopInfo.shopname }}</b>
|
<b>{{ shopInfo.shopname }}</b>
|
||||||
@ -80,26 +80,81 @@ export default {
|
|||||||
init() {
|
init() {
|
||||||
this.$get('/v1/client/DShopsClient/list', { userid: this.$route.query.id }).then(res => {
|
this.$get('/v1/client/DShopsClient/list', { userid: this.$route.query.id }).then(res => {
|
||||||
this.shopInfo = res.data.items[0] || {}
|
this.shopInfo = res.data.items[0] || {}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
callPhone() {
|
callPhone() {
|
||||||
if (this.shopInfo.shopphone) {
|
if (this.shopInfo.shopphone) {
|
||||||
window.location.href = `tel:${this.shopInfo.shopphone}`
|
window.location.href = `tel:${this.shopInfo.shopphone}`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
previewImage(url) {
|
||||||
|
const imageUrl = this.$file(url);
|
||||||
|
if (imageUrl) {
|
||||||
|
this.$showImagePreview({ images: [imageUrl], startPosition: 0 });
|
||||||
|
}
|
||||||
|
},
|
||||||
openMap() {
|
openMap() {
|
||||||
if (this.shopInfo.shoplatitude && this.shopInfo.shoplongitude) {
|
if (this.shopInfo.shoplatitude && this.shopInfo.shoplongitude) {
|
||||||
const lat = this.shopInfo.shoplatitude;
|
const lat = this.shopInfo.shoplatitude;
|
||||||
const lon = this.shopInfo.shoplongitude;
|
const lon = this.shopInfo.shoplongitude;
|
||||||
const fullAddress = encodeURIComponent(
|
const fullAddress = (
|
||||||
(this.shopInfo.shopprovince || '') +
|
(this.shopInfo.shopprovince || '') +
|
||||||
(this.shopInfo.shopcity || '') +
|
(this.shopInfo.shopcity || '') +
|
||||||
(this.shopInfo.shopcounty || '') +
|
(this.shopInfo.shopcounty || '') +
|
||||||
(this.shopInfo.shopstreet || '') +
|
(this.shopInfo.shopstreet || '') +
|
||||||
(this.shopInfo.shopaddress || '')
|
(this.shopInfo.shopaddress || '')
|
||||||
);
|
);
|
||||||
|
if (wx && this.$isWechat()) {
|
||||||
|
this.$post('/v1/client/HWxinfoClient/share', JSON.stringify(location.href)).then(res => {
|
||||||
|
const data = res.data || {};
|
||||||
|
const jsApiList = data.jsApiList || ['onMenuShareTimeline', 'onMenuShareAppMessage', 'updateAppMessageShareData', 'updateTimelineShareData', 'openLocation', 'getLocation'];
|
||||||
|
const openTagList = data.openTagList || ['wx-open-launch-weapp'];
|
||||||
|
jsApiList.push('wx-open-launch-weapp');
|
||||||
|
wx.config({
|
||||||
|
debug: false,
|
||||||
|
appId: data.appid,
|
||||||
|
timestamp: Number(data.timestamp) || 0,
|
||||||
|
nonceStr: data.noncestr,
|
||||||
|
signature: data.signature,
|
||||||
|
jsApiList: jsApiList,
|
||||||
|
openTagList: openTagList
|
||||||
|
});
|
||||||
|
wx.ready(() => {
|
||||||
|
wx.getLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
success: (e) => {
|
||||||
|
this.searchparams.latitude = e.latitude;
|
||||||
|
this.searchparams.longitude = e.longitude;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
wx.openLocation({
|
||||||
|
latitude: Number(lat),
|
||||||
|
longitude: Number(lon),
|
||||||
|
name: this.shopInfo.shopname || '',
|
||||||
|
address: fullAddress,
|
||||||
|
scale: 15,
|
||||||
|
infoUrl: '',
|
||||||
|
success: () => {
|
||||||
|
console.log('wx.openLocation success');
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('wx.openLocation fail', err);
|
||||||
|
// window.open(`https://uri.amap.com/navigation?to=${lon},${lat},${fullAddress}&mode=car&src=shop`, '_blank');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
wx.error((err) => {
|
||||||
|
console.error('wx.error', err);
|
||||||
|
});
|
||||||
|
// wx.error((err) => {
|
||||||
|
// console.error('wx.openLocation error', err);
|
||||||
|
// window.open(`https://uri.amap.com/navigation?to=${lon},${lat},${fullAddress}&mode=car&src=shop`, '_blank');
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
window.open(`https://uri.amap.com/navigation?to=${lon},${lat},${fullAddress}&mode=car&src=shop`, '_blank');
|
window.open(`https://uri.amap.com/navigation?to=${lon},${lat},${fullAddress}&mode=car&src=shop`, '_blank');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user