完成扫一扫功能
This commit is contained in:
parent
845e9bafce
commit
ed3a8f6e55
@ -1,32 +1,17 @@
|
||||
<template>
|
||||
<view class="foot-fixed">
|
||||
<view v-for="(item, index) in navList" :key="index">
|
||||
<view
|
||||
id="navIndex"
|
||||
:style="{ width: foot_width }"
|
||||
@click="jump"
|
||||
:data-idx="index"
|
||||
:data-url="item.url"
|
||||
:class="{ 'foot-item': true, 'scan-item': item.isScan }"
|
||||
>
|
||||
<view id="navIndex" :style="{ width: foot_width }" @click="jump" :data-idx="index" :data-url="item.url"
|
||||
:class="{ 'foot-item': true, 'scan-item': item.isScan }">
|
||||
<view class="foot-icon-box">
|
||||
<image
|
||||
class="foot-icon"
|
||||
:src="item.photo"
|
||||
mode="widthFix"
|
||||
v-if="current != index"
|
||||
:style="{
|
||||
width: item.photo.includes('footer_localLife.png')
|
||||
? '70rpx'
|
||||
: '',
|
||||
}"
|
||||
></image>
|
||||
<image class="foot-icon" :src="item.photo" mode="widthFix" v-if="current != index" :style="{
|
||||
width: item.photo.includes('footer_localLife.png')
|
||||
? '70rpx'
|
||||
: '',
|
||||
}"></image>
|
||||
<image
|
||||
:class="{ 'foot-icon3': item.photo.includes('footer_richScan.png'), 'foot-icon2': !item.photo.includes('footer_richScan.png') }"
|
||||
:src="item.photoAc"
|
||||
mode="widthFix"
|
||||
v-if="current == index"
|
||||
></image>
|
||||
:src="item.photoAc" mode="widthFix" v-if="current == index"></image>
|
||||
</view>
|
||||
|
||||
<text class="foot-label" id="navIndexLabel">{{ item.nav_name }}</text>
|
||||
@ -36,6 +21,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { NavgateTo } from "../../utils";
|
||||
|
||||
export default {
|
||||
name: "nav",
|
||||
props: {
|
||||
@ -163,15 +151,36 @@ export default {
|
||||
const url = e.currentTarget.dataset.url;
|
||||
const index = e.currentTarget.dataset.idx;
|
||||
const item = this.navList[index];
|
||||
|
||||
|
||||
// 检查是否为扫码功能
|
||||
if (item.isScan) {
|
||||
// 调用uni-app的扫码API
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
// 扫码成功后的处理逻辑
|
||||
console.log('扫码结果:', res.result);
|
||||
// 可以根据实际需求对扫码结果进行处理
|
||||
console.log('扫码结果:', res);
|
||||
|
||||
// 检查res中是否包含path字段
|
||||
if (res.path) {
|
||||
console.log('扫码结果中的path:', res.path);
|
||||
|
||||
// 解析path字段,提取scene参数的值
|
||||
const pathParts = res.path.split('?');
|
||||
if (pathParts.length > 1) {
|
||||
const queryParams = pathParts[1].split('&');
|
||||
for (const param of queryParams) {
|
||||
const [key, value] = param.split('=');
|
||||
if (key === 'scene') {
|
||||
const params = {
|
||||
id: value
|
||||
}
|
||||
uni.setStorageSync('merchantInfo', params);
|
||||
NavgateTo('/packages/localLife/detail/index')
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('扫码失败:', err);
|
||||
@ -179,7 +188,7 @@ export default {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 检查url是否存在且不为空
|
||||
if (!url || url.trim() === '') {
|
||||
this.NotOpen();
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="white_container">
|
||||
<swiper class="swiper" autoplay>
|
||||
<image class="pic" :src="picUrl + info.album_images" />
|
||||
<!-- <swiper class="swiper" autoplay>
|
||||
<swiper-item v-for="(item, pageIndex) in info.bigImg" :key="pageIndex">
|
||||
<image class="pic" :src="picUrl + item" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</swiper> -->
|
||||
|
||||
<view class="main">
|
||||
<view class="title">{{ info.merchant_name }}</view>
|
||||
@ -28,7 +29,7 @@
|
||||
</view>
|
||||
<view class="table">
|
||||
<view class="label">营业地址</view>
|
||||
<view class="desc">{{ info.comAddress }}</view>
|
||||
<view class="desc" v-if="info.ad">{{ info.ad.ad_name ? info.ad.ad_name.replace(/,/g, "") : "" }}{{ info.address }}</view>
|
||||
</view>
|
||||
<view class="table mb32">
|
||||
<view class="label">特色服务</view>
|
||||
@ -97,7 +98,7 @@
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/Index_add.png" mode="" />
|
||||
<view>导航</view>
|
||||
</view>
|
||||
<view class="left_label" @click="handlePhoneClick">
|
||||
<view class="left_label" @click="handlePhoneClick" v-if="info.phone">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/localLife_detail_Frame.png"
|
||||
mode="" />
|
||||
<view>电话</view>
|
||||
@ -136,14 +137,22 @@ export default {
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.info = uni.getStorageSync("merchantInfo")
|
||||
const params = {
|
||||
id: uni.getStorageSync("merchantInfo").id
|
||||
}
|
||||
request(apiArr.getMerchantInfo, "POST", params).then(res => {
|
||||
this.info = res
|
||||
|
||||
// 确保onLoad执行完后再执行这两个方法
|
||||
this.page_num = 1
|
||||
this.flag = false
|
||||
this.commentList = []
|
||||
this.getCommentList()
|
||||
this.getMerchantInfo()
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
this.page_num = 1
|
||||
this.flag = false
|
||||
this.commentList = []
|
||||
this.getCommentList()
|
||||
this.getMerchantInfo()
|
||||
// 已移至onLoad中执行,确保执行顺序
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.flag) {
|
||||
@ -169,7 +178,7 @@ export default {
|
||||
} else {
|
||||
this.flag = false;
|
||||
}
|
||||
this.isShow = res.rows[0].merchant_info.quick_purchase_enabled == 1
|
||||
this.isShow = res.rows[0]?.merchant_info.quick_purchase_enabled == 1
|
||||
const list = res.rows.filter((item) => {
|
||||
return item.status == 2;
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user