新增微信定位 修改部分问题
This commit is contained in:
parent
aa20aa964b
commit
604f9aff08
@ -49,9 +49,9 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
this.$geo.getWebGeo().then(pos => {
|
||||
this.geo = pos
|
||||
})
|
||||
// this.$geo.getWebGeo().then(pos => {
|
||||
// this.geo = pos
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
updateTitle(title) {
|
||||
@ -96,7 +96,7 @@ export default {
|
||||
link: this.$getShareLink(),
|
||||
};
|
||||
// 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'];
|
||||
jsApiList.push('wx-open-launch-weapp');
|
||||
wx.config({
|
||||
|
||||
@ -24,15 +24,15 @@
|
||||
<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.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 v-model="formData.shopcatename" label="商家分类" readonly />
|
||||
<van-field v-model="formData.businesstime" label="营业时间" />
|
||||
|
||||
<van-collapse v-model="activeNames">
|
||||
<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 title="商家介绍" name="2" value="点击展开查看详情">
|
||||
<div class="shop-intro-wrap">
|
||||
@ -384,11 +384,25 @@ export default {
|
||||
font-size: 3.73vw;
|
||||
}
|
||||
|
||||
:deep(.van-field__control:disabled) {
|
||||
:deep(.van-field__control:disabled),
|
||||
:deep(.van-field__control[readonly]) {
|
||||
color: #999;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
:deep(.van-field--readonly) {
|
||||
.van-field__value {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.shop-intro-wrap {
|
||||
.readonly-text {
|
||||
color: #999;
|
||||
font-size: 3.2vw;
|
||||
}
|
||||
}
|
||||
|
||||
.img-thumb {
|
||||
width: 14vw;
|
||||
height: 10vw;
|
||||
|
||||
@ -123,13 +123,16 @@
|
||||
</div>
|
||||
|
||||
<div class="goods">
|
||||
<van-tabs v-model:active="activeType" :ellipsis="false" @change="changeTab" line-height="2vw" line-width="10.67vw"
|
||||
color="#f48fa7" title-active-color="#000" title-inactive-color="#4e4e4e">
|
||||
<van-tab name="" title="新品">
|
||||
</van-tab>
|
||||
<van-tab v-for="item in typeData" :name="item.id" :title="item.name">
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
<div class="tabs-sticky">
|
||||
<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>
|
||||
<van-tab v-for="item in typeData" :name="item.id" :title="item.name">
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</div>
|
||||
|
||||
<BaseList ref="BaseList" url="/v1/client/EProsClient" :params="searchParams" :parseData="res => res.data.items"
|
||||
class="goods_box">
|
||||
@ -233,9 +236,9 @@ export default {
|
||||
this.$get('/v1/client/EProsClient?recommend=true').then(res => {
|
||||
this.hotData = res.data.items || []
|
||||
}),
|
||||
this.$get('/v1/client/EProcatesClient/1').then(res => {
|
||||
const filtered = res.data.filter(i => i.homeshowed)
|
||||
this.typeData = filtered
|
||||
this.$get('/v1/client/EProcatesClient/3').then(res => {
|
||||
// const filtered = res.data.filter(i => i.homeshowed)
|
||||
this.typeData = res.data
|
||||
}),
|
||||
]).catch(err => {
|
||||
this.$showFailToast(err.message || '加载失败')
|
||||
@ -280,4 +283,13 @@ export default {
|
||||
color: #999;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.goods {
|
||||
.tabs-sticky {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 99;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
</div>
|
||||
<div class="tags">
|
||||
<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>
|
||||
@ -55,7 +55,7 @@
|
||||
{{ item.shopprovince + item.shopcity + item.shopcounty }}{{ item.shopstreet }}{{ item.shopaddress }}
|
||||
</span>
|
||||
<span class="distance"><img src="/img/addr_r.png" alt="">{{ (item.distance / 1000)?.toFixed(2)
|
||||
}}km</span>
|
||||
}}km</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -85,10 +85,38 @@ export default {
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
const res = await this.$geo.getWebGeo();
|
||||
this.searchparams.latitude = res.lat;
|
||||
this.searchparams.longitude = res.lon;
|
||||
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();
|
||||
this.searchparams.latitude = res.lat;
|
||||
this.searchparams.longitude = res.lon;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.checkScroll();
|
||||
const ro = new ResizeObserver(() => this.checkScroll());
|
||||
|
||||
@ -1,64 +1,71 @@
|
||||
<template>
|
||||
<BasePage>
|
||||
<div class="checkout" v-if="data.shop && data.shop.shopname">
|
||||
<div class="shopinfo">
|
||||
<img class="icon" :src="$file(data.shop.shopimg)" alt="">
|
||||
<!-- 商家停业提示 -->
|
||||
<div v-if="!shopopen" class="closed-tip">
|
||||
<van-empty description="该商家已停业,暂不支持买单" />
|
||||
</div>
|
||||
|
||||
<div class="inf">
|
||||
<b>{{ data.shop.shopname }}</b>
|
||||
<div class="hl">
|
||||
<img src="/img/buybill.png" alt="">
|
||||
<span>{{ data.shop.feeratio }}%</span>
|
||||
<template v-else>
|
||||
<div class="shopinfo">
|
||||
<img class="icon" :src="$file(data.shop.shopimg)" alt="">
|
||||
|
||||
<div class="inf">
|
||||
<b>{{ data.shop.shopname }}</b>
|
||||
<div class="hl">
|
||||
<img src="/img/buybill.png" alt="">
|
||||
<span>{{ data.shop.feeratio }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="paynums_box">
|
||||
<b class="tit">
|
||||
买单金额
|
||||
</b>
|
||||
<div class="paynums_box">
|
||||
<b class="tit">
|
||||
买单金额
|
||||
</b>
|
||||
|
||||
<div class="input_box">
|
||||
¥<input type="number" v-model="req.ordermoney" placeholder="请输入买单金额" @input="calcDeduction">
|
||||
<div class="input_box">
|
||||
¥<input type="number" v-model="req.ordermoney" placeholder="请输入买单金额" @input="calcDeduction">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="deduction_box">
|
||||
<van-radio-group v-model="checked">
|
||||
<van-cell-group inset center>
|
||||
<van-cell center title="积分抵扣" icon="/img/point_icon.png">
|
||||
<template #right-icon>
|
||||
<span class="cantuse" v-if="!data.user.xiaofeijifen || data.user.xiaofeijifen <= 0">暂无可用</span>
|
||||
<span class="canuse" v-else-if="checked !== '1'">{{ data.user.xiaofeijifen?.toFixed(2) }}可用</span>
|
||||
<span class="use" v-else>-{{ jifenDeduction.toFixed(2) }}</span>
|
||||
<van-radio name="1" @click="toggleDeduction('jifen')"
|
||||
:disabled="!data.user.xiaofeijifen || data.user.xiaofeijifen <= 0" />
|
||||
</template>
|
||||
</van-cell>
|
||||
<van-cell title="会员卡抵扣" icon="/img/vip_icon.png">
|
||||
<template #right-icon>
|
||||
<span class="cantuse" v-if="!data.user.xiaofeiquan || data.user.xiaofeiquan <= 0">暂无可用</span>
|
||||
<span class="canuse" v-else-if="checked !== '2'">{{ data.user.xiaofeiquan?.toFixed(2) }}可用</span>
|
||||
<span class="use" v-else>-{{ quanDeduction.toFixed(2) }}</span>
|
||||
<van-radio name="2" @click="toggleDeduction('quan')"
|
||||
:disabled="!data.user.xiaofeiquan || data.user.xiaofeiquan <= 0" />
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-radio-group>
|
||||
<div class="deduction_box">
|
||||
<van-radio-group v-model="checked">
|
||||
<van-cell-group inset center>
|
||||
<van-cell center title="积分抵扣" icon="/img/point_icon.png">
|
||||
<template #right-icon>
|
||||
<span class="cantuse" v-if="!data.user.xiaofeijifen || data.user.xiaofeijifen <= 0">暂无可用</span>
|
||||
<span class="canuse" v-else-if="checked !== '1'">{{ data.user.xiaofeijifen?.toFixed(2) }}可用</span>
|
||||
<span class="use" v-else>-{{ jifenDeduction.toFixed(2) }}</span>
|
||||
<van-radio name="1" @click="toggleDeduction('jifen')"
|
||||
:disabled="!data.user.xiaofeijifen || data.user.xiaofeijifen <= 0" checked-color="#ca2904" />
|
||||
</template>
|
||||
</van-cell>
|
||||
<van-cell title="会员卡抵扣" icon="/img/vip_icon.png">
|
||||
<template #right-icon>
|
||||
<span class="cantuse" v-if="!data.user.xiaofeiquan || data.user.xiaofeiquan <= 0">暂无可用</span>
|
||||
<span class="canuse" v-else-if="checked !== '2'">{{ data.user.xiaofeiquan?.toFixed(2) }}可用</span>
|
||||
<span class="use" v-else>-{{ quanDeduction.toFixed(2) }}</span>
|
||||
<van-radio name="2" @click="toggleDeduction('quan')"
|
||||
:disabled="!data.user.xiaofeiquan || data.user.xiaofeiquan <= 0" checked-color="#ca2904" />
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-radio-group>
|
||||
|
||||
|
||||
<div class="price">
|
||||
<p>
|
||||
实付
|
||||
</p>
|
||||
<span>¥<b>{{ actualPay.toFixed(2) }}</b></span>
|
||||
<div class="price">
|
||||
<p>
|
||||
实付
|
||||
</p>
|
||||
<span>¥<b>{{ actualPay.toFixed(2) }}</b></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="payfor" @click="toPay">
|
||||
去支付
|
||||
</button>
|
||||
<button class="payfor" @click="toPay">
|
||||
去支付
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</BasePage>
|
||||
</template>
|
||||
@ -68,6 +75,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
checked: '',
|
||||
shopopen: true,
|
||||
id: this.$route.query.id,
|
||||
data: {
|
||||
user: {},
|
||||
@ -106,6 +114,7 @@ export default {
|
||||
this.$get(`/v1/client/DShopsClient/${this.id}`).then(res => {
|
||||
// console.log(res);
|
||||
this.data.shop = res.data;
|
||||
this.shopopen = res.data.enabled;
|
||||
this.req.shopuserid = res.data.userid;
|
||||
})
|
||||
},
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
<div class="shop_details">
|
||||
<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="name_box">
|
||||
<b>{{ shopInfo.shopname }}</b>
|
||||
@ -80,25 +80,80 @@ export default {
|
||||
init() {
|
||||
this.$get('/v1/client/DShopsClient/list', { userid: this.$route.query.id }).then(res => {
|
||||
this.shopInfo = res.data.items[0] || {}
|
||||
})
|
||||
});
|
||||
},
|
||||
callPhone() {
|
||||
if (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() {
|
||||
if (this.shopInfo.shoplatitude && this.shopInfo.shoplongitude) {
|
||||
const lat = this.shopInfo.shoplatitude;
|
||||
const lon = this.shopInfo.shoplongitude;
|
||||
const fullAddress = encodeURIComponent(
|
||||
const fullAddress = (
|
||||
(this.shopInfo.shopprovince || '') +
|
||||
(this.shopInfo.shopcity || '') +
|
||||
(this.shopInfo.shopcounty || '') +
|
||||
(this.shopInfo.shopstreet || '') +
|
||||
(this.shopInfo.shopaddress || '')
|
||||
);
|
||||
window.open(`https://uri.amap.com/navigation?to=${lon},${lat},${fullAddress}&mode=car&src=shop`, '_blank');
|
||||
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');
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user