完成扫一扫功能

This commit is contained in:
赵毅 2025-09-22 15:16:24 +08:00
parent 845e9bafce
commit ed3a8f6e55
2 changed files with 56 additions and 38 deletions

View File

@ -1,32 +1,17 @@
<template> <template>
<view class="foot-fixed"> <view class="foot-fixed">
<view v-for="(item, index) in navList" :key="index"> <view v-for="(item, index) in navList" :key="index">
<view <view id="navIndex" :style="{ width: foot_width }" @click="jump" :data-idx="index" :data-url="item.url"
id="navIndex" :class="{ 'foot-item': true, 'scan-item': item.isScan }">
: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"> <view class="foot-icon-box">
<image <image class="foot-icon" :src="item.photo" mode="widthFix" v-if="current != index" :style="{
class="foot-icon" width: item.photo.includes('footer_localLife.png')
:src="item.photo" ? '70rpx'
mode="widthFix" : '',
v-if="current != index" }"></image>
:style="{
width: item.photo.includes('footer_localLife.png')
? '70rpx'
: '',
}"
></image>
<image <image
:class="{ 'foot-icon3': item.photo.includes('footer_richScan.png'), 'foot-icon2': !item.photo.includes('footer_richScan.png') }" :class="{ 'foot-icon3': item.photo.includes('footer_richScan.png'), 'foot-icon2': !item.photo.includes('footer_richScan.png') }"
:src="item.photoAc" :src="item.photoAc" mode="widthFix" v-if="current == index"></image>
mode="widthFix"
v-if="current == index"
></image>
</view> </view>
<text class="foot-label" id="navIndexLabel">{{ item.nav_name }}</text> <text class="foot-label" id="navIndexLabel">{{ item.nav_name }}</text>
@ -36,6 +21,9 @@
</template> </template>
<script> <script>
import { NavgateTo } from "../../utils";
export default { export default {
name: "nav", name: "nav",
props: { props: {
@ -170,8 +158,29 @@ export default {
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {
// //
console.log('扫码结果:', res.result); console.log('扫码结果:', res);
//
// respath
if (res.path) {
console.log('扫码结果中的path:', res.path);
// pathscene
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) => { fail: (err) => {
console.log('扫码失败:', err); console.log('扫码失败:', err);

View File

@ -1,11 +1,12 @@
<template> <template>
<view class="container"> <view class="container">
<view class="white_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"> <swiper-item v-for="(item, pageIndex) in info.bigImg" :key="pageIndex">
<image class="pic" :src="picUrl + item" /> <image class="pic" :src="picUrl + item" />
</swiper-item> </swiper-item>
</swiper> </swiper> -->
<view class="main"> <view class="main">
<view class="title">{{ info.merchant_name }}</view> <view class="title">{{ info.merchant_name }}</view>
@ -28,7 +29,7 @@
</view> </view>
<view class="table"> <view class="table">
<view class="label">营业地址</view> <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>
<view class="table mb32"> <view class="table mb32">
<view class="label">特色服务</view> <view class="label">特色服务</view>
@ -97,7 +98,7 @@
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/Index_add.png" mode="" /> <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/Index_add.png" mode="" />
<view>导航</view> <view>导航</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" <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/localLife_detail_Frame.png"
mode="" /> mode="" />
<view>电话</view> <view>电话</view>
@ -136,14 +137,22 @@ export default {
}; };
}, },
onLoad(options) { 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() { onShow() {
this.page_num = 1 // onLoad
this.flag = false
this.commentList = []
this.getCommentList()
this.getMerchantInfo()
}, },
onReachBottom() { onReachBottom() {
if (this.flag) { if (this.flag) {
@ -169,7 +178,7 @@ export default {
} else { } else {
this.flag = false; 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) => { const list = res.rows.filter((item) => {
return item.status == 2; return item.status == 2;
}); });