3 changed files with 345 additions and 334 deletions
@ -1,354 +1,365 @@ |
|||||
<template> |
<template> |
||||
<div class="home app_content"> |
<div class="home app_content"> |
||||
<!-- 导航栏 --> |
<!-- 导航栏 --> |
||||
<div class="header_body"> |
<div class="header_body"> |
||||
<!-- <header-nav :leftArrow="false" titelText="扫码入企"></header-nav> --> |
<!-- <header-nav :leftArrow="false" titelText="扫码入企"></header-nav> --> |
||||
<header-nav |
<header-nav |
||||
:slefBack="true" |
:slefBack="true" |
||||
@goBack="goBack" |
@goBack="goBack" |
||||
:titelText="`扫码入企`" |
:titelText="`扫码入企`" |
||||
> |
> |
||||
</header-nav> |
</header-nav> |
||||
</div> |
</div> |
||||
|
|
||||
<!-- 中间 --> |
<!-- 中间 --> |
||||
<div class="warp_body"> |
<div class="warp_body"> |
||||
<!-- <refresh-list v-model:freshMap="freshMap" @refresh="onRefresh" @onLoad="onLoad"> --> |
<!-- <refresh-list v-model:freshMap="freshMap" @refresh="onRefresh" @onLoad="onLoad"> --> |
||||
<div class="white-body"> |
<div class="white-body"> |
||||
<div class="carousel_box"> |
<div class="carousel_box"> |
||||
<div class="box-scan-one"> |
<div class="box-scan-one"> |
||||
<span class="box-scan-text">扫一扫<br />企业二维码</span> |
<span class="box-scan-text">扫一扫<br/>企业二维码</span> |
||||
|
</div> |
||||
|
<div class="box-scan-two"> |
||||
|
<span class="box-scan-text">即可查看<br/>企业信息</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="boutique_box"> |
||||
|
<!-- <van-cell :border="false" title="精品" /> --> |
||||
|
<div class="boutique_body"> |
||||
|
<!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> --> |
||||
|
<div class="box-qr-code" @click="toScanPageView"> |
||||
|
<!-- <img src="../../assets/images/scan.png" /> |
||||
|
<span class="box-qr-code-text">执法监督码</span>--> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="nocode" @click="toNoScanView">没有企业码?手动输入关键词查询 >></div> |
||||
|
</div> |
||||
</div> |
</div> |
||||
<div class="box-scan-two"> |
<!-- <div class="recommend_box"> |
||||
<span class="box-scan-text">即可查看<br />企业信息</span> |
<van-cell :border="false" title="推荐" /> |
||||
</div> |
<div class="recommend_body"> |
||||
</div> |
<goodsCard :goodsList="recommend"></goodsCard> |
||||
<div class="boutique_box"> |
</div> |
||||
<!-- <van-cell :border="false" title="精品" /> --> |
</div> --> |
||||
<div class="boutique_body"> |
<!-- </refresh-list> --> |
||||
<!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> --> |
</div> |
||||
<div class="box-qr-code" @click="toScanPageView"> |
|
||||
<!-- <img src="../../assets/images/scan.png" /> |
|
||||
<span class="box-qr-code-text">执法监督码</span>--> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="nocode" @click="toNoScanView">没有企业码?手动输入关键词查询 >></div> |
|
||||
</div> |
|
||||
</div> |
|
||||
<!-- <div class="recommend_box"> |
|
||||
<van-cell :border="false" title="推荐" /> |
|
||||
<div class="recommend_body"> |
|
||||
<goodsCard :goodsList="recommend"></goodsCard> |
|
||||
</div> |
|
||||
</div> --> |
|
||||
<!-- </refresh-list> --> |
|
||||
</div> |
|
||||
|
|
||||
<!-- 底部 --> |
<!-- 底部 --> |
||||
<!-- <div class="footer_body"> |
<!-- <div class="footer_body"> |
||||
<footer-nav></footer-nav> |
<footer-nav></footer-nav> |
||||
</div> --> |
</div> --> |
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup name="Home"> |
<script setup name="Home"> |
||||
// import Vconsole from "vconsole"; |
// import Vconsole from "vconsole"; |
||||
import { showFailToast } from 'vant'; |
import {showFailToast} from 'vant'; |
||||
import {getEnterpriseMerchantAuthorization} from '@/api/Home'; |
import {getEnterpriseMerchantAuthorization} from '@/api/Home'; |
||||
import {checkIsExists} from '@/api/enterprise'; |
import {checkIsExists} from '@/api/enterprise'; |
||||
import {szyptGetToken} from "../../api/Home"; |
import {szyptGetToken} from "../../api/Home"; |
||||
import wx from "weixin-js-sdk"; |
import wx from "weixin-js-sdk"; |
||||
const { useCommon } = $globalStore; |
|
||||
const router = useRouter(); |
|
||||
let carouselList = reactive([]); // 轮播列表 |
|
||||
let boutique = reactive([]); // 精品数据 |
|
||||
let recommend = reactive([]); // 推荐 |
|
||||
let freshMap = reactive({ |
|
||||
refreshLoad: false, // 是否刷新 |
|
||||
listLoading: false, // 是否加载中 |
|
||||
listFinished: false, // 是否加载完成标识 |
|
||||
}); |
|
||||
const data = reactive({}); |
|
||||
const boutiqueAttr = reactive({ |
|
||||
columnNum: 4, |
|
||||
itemClass: "boutique_item", |
|
||||
goodsCradclass: "boutique-crad", |
|
||||
}); // 商品卡片展示 |
|
||||
|
|
||||
//获取轮播 |
const {useCommon} = $globalStore; |
||||
const getCarousel = async () => { |
const router = useRouter(); |
||||
// const res = await useHome.getCarousel(); |
let carouselList = reactive([]); // 轮播列表 |
||||
// if (res?.code === 20000) { |
let boutique = reactive([]); // 精品数据 |
||||
// carouselList = res?.data; |
let recommend = reactive([]); // 推荐 |
||||
// } |
let freshMap = reactive({ |
||||
}; |
refreshLoad: false, // 是否刷新 |
||||
|
listLoading: false, // 是否加载中 |
||||
|
listFinished: false, // 是否加载完成标识 |
||||
|
}); |
||||
|
const data = reactive({}); |
||||
|
const boutiqueAttr = reactive({ |
||||
|
columnNum: 4, |
||||
|
itemClass: "boutique_item", |
||||
|
goodsCradclass: "boutique-crad", |
||||
|
}); // 商品卡片展示 |
||||
|
|
||||
//精品 |
//获取轮播 |
||||
const boutiqueGoods = async () => { |
const getCarousel = async () => { |
||||
// const res = await useHome.boutiqueGoods(); |
// const res = await useHome.getCarousel(); |
||||
// if (res?.code === 20000) { |
// if (res?.code === 20000) { |
||||
// boutique = res?.data; |
// carouselList = res?.data; |
||||
// } |
// } |
||||
}; |
}; |
||||
|
|
||||
const openScan = () => { |
//精品 |
||||
let fullUrl = window.location.href; |
const boutiqueGoods = async () => { |
||||
let code = fullUrl.substring(fullUrl.indexOf('code=')+5, fullUrl.indexOf('&state=')); |
// const res = await useHome.boutiqueGoods(); |
||||
let paramUrl = window.location.href.split("#")[0]; |
// if (res?.code === 20000) { |
||||
let param = { code: code, url: paramUrl }; |
// boutique = res?.data; |
||||
szyptGetToken(param,success =>{ |
// } |
||||
let resMsg = success.data; |
}; |
||||
console.log(resMsg); |
|
||||
wx.config({ |
|
||||
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 |
|
||||
debug: false, |
|
||||
// 必填,公众号的唯一标识 |
|
||||
appId: resMsg.corpid, |
|
||||
// 必填,生成签名的时间戳 |
|
||||
timestamp: resMsg.timestamp, |
|
||||
// 必填,生成签名的随机串 |
|
||||
nonceStr: resMsg.nonceStr, |
|
||||
// 必填,签名,见附录1 |
|
||||
signature: resMsg.signature, |
|
||||
// 必填,需要使用的JS接口列表,所有JS接口列表见附录2 |
|
||||
jsApiList: ["scanQRCode"], |
|
||||
}); |
|
||||
wx.ready(() => { |
|
||||
//微信扫一扫请求操作 |
|
||||
ClickScan() |
|
||||
}); |
|
||||
wx.error((res) => { |
|
||||
console.log("获取失败"); |
|
||||
}); |
|
||||
},error =>{}); |
|
||||
}; |
|
||||
const ClickScan = () => { |
|
||||
wx.scanQRCode({ |
|
||||
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, |
|
||||
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有 |
|
||||
success: (res) => { |
|
||||
// 页面跳转 |
|
||||
console.log("=========== 扫码返回 ===========") |
|
||||
console.log(res) |
|
||||
checkIsExists(res,success=>{ |
|
||||
console.log(success.data) |
|
||||
if(success.data){ |
|
||||
router.push({ |
|
||||
path:"/enterpriseScanPreview", |
|
||||
query:{ |
|
||||
enterpriseNumber: res.resultStr |
|
||||
} |
|
||||
}) |
|
||||
}else{ |
|
||||
showFailToast('企业信息不存在,请确认二维码是否正确!'); |
|
||||
router.push({ |
|
||||
path:"/enforce/scanQrCode", |
|
||||
}) |
|
||||
} |
|
||||
},error =>{ |
|
||||
|
|
||||
}) |
|
||||
// router.push({ |
|
||||
// path: "/enterpriseScanPreview", |
|
||||
// query: { |
|
||||
// enterpriseNumber: res.resultStr |
|
||||
// } |
|
||||
// }); |
|
||||
}, |
|
||||
cancel: (res) => { |
|
||||
console.log('err', res); |
|
||||
}, |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const toScanPageView = async() =>{ |
const openScan = () => { |
||||
openScan(); |
let fullUrl = window.location.href; |
||||
// router.push({ |
let code = fullUrl.substring(fullUrl.indexOf('code=') + 5, fullUrl.indexOf('&state=')); |
||||
// path: "/enforce/scanPage_szy", |
let paramUrl = window.location.href.split("#")[0]; |
||||
// query: {} |
let param = {code: code, url: paramUrl}; |
||||
// }); |
szyptGetToken(param, success => { |
||||
}; |
let resMsg = success.data; |
||||
|
console.log(resMsg); |
||||
|
wx.config({ |
||||
|
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 |
||||
|
debug: false, |
||||
|
// 必填,公众号的唯一标识 |
||||
|
appId: resMsg.corpid, |
||||
|
// 必填,生成签名的时间戳 |
||||
|
timestamp: resMsg.timestamp, |
||||
|
// 必填,生成签名的随机串 |
||||
|
nonceStr: resMsg.nonceStr, |
||||
|
// 必填,签名,见附录1 |
||||
|
signature: resMsg.signature, |
||||
|
// 必填,需要使用的JS接口列表,所有JS接口列表见附录2 |
||||
|
jsApiList: ["scanQRCode"], |
||||
|
}); |
||||
|
wx.ready(() => { |
||||
|
//微信扫一扫请求操作 |
||||
|
ClickScan() |
||||
|
}); |
||||
|
wx.error((res) => { |
||||
|
console.log("获取失败"); |
||||
|
}); |
||||
|
}, error => { |
||||
|
}); |
||||
|
}; |
||||
|
const ClickScan = () => { |
||||
|
wx.scanQRCode({ |
||||
|
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, |
||||
|
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有 |
||||
|
success: (res) => { |
||||
|
// 页面跳转 |
||||
|
console.log("=========== 扫码返回 ===========") |
||||
|
console.log(res) |
||||
|
// checkIsExists(res, success => { |
||||
|
// console.log(success.data) |
||||
|
// if (success.data) { |
||||
|
router.push({ |
||||
|
path: "/enterpriseScanPreview", |
||||
|
query: { |
||||
|
enterpriseNumber: res.resultStr |
||||
|
} |
||||
|
}) |
||||
|
// } else { |
||||
|
// showFailToast('企业信息不存在,请确认二维码是否正确!'); |
||||
|
// router.push({ |
||||
|
// path: "/enforce/scanQrCode", |
||||
|
// }) |
||||
|
// } |
||||
|
// }, error => { |
||||
|
// |
||||
|
// }) |
||||
|
// router.push({ |
||||
|
// path: "/enterpriseScanPreview", |
||||
|
// query: { |
||||
|
// enterpriseNumber: res.resultStr |
||||
|
// } |
||||
|
// }); |
||||
|
}, |
||||
|
cancel: (res) => { |
||||
|
console.log('err', res); |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
const toNoScanView = async() =>{ |
const toScanPageView = async () => { |
||||
router.push({ |
openScan(); |
||||
path: "/enforce/noScan", |
// router.push({ |
||||
query: {} |
// path: "/enforce/scanPage_szy", |
||||
}); |
// query: {} |
||||
}; |
// }); |
||||
|
}; |
||||
|
|
||||
const toRegistrationListView = async() =>{ |
const toNoScanView = async () => { |
||||
router.push({ |
router.push({ |
||||
path: "/enterprise/registrationList", |
path: "/enforce/noScan", |
||||
}); |
query: {} |
||||
} |
}); |
||||
const toComplaintView = async() =>{ |
}; |
||||
router.push({ |
|
||||
path: "/enterprise/complaint", |
const toRegistrationListView = async () => { |
||||
}); |
router.push({ |
||||
} |
path: "/enterprise/registrationList", |
||||
|
}); |
||||
|
} |
||||
|
const toComplaintView = async () => { |
||||
|
router.push({ |
||||
|
path: "/enterprise/complaint", |
||||
|
}); |
||||
|
} |
||||
|
|
||||
//下拉刷新 |
//下拉刷新 |
||||
const onRefresh = () => { |
const onRefresh = () => { |
||||
freshMap.listFinished = false; |
freshMap.listFinished = false; |
||||
freshMap.listLoading = true; |
freshMap.listLoading = true; |
||||
freshMap.refreshLoad = true; |
freshMap.refreshLoad = true; |
||||
// Promise.all([getCarousel(), boutiqueGoods(), recommendGoods()]).then(() => { |
// Promise.all([getCarousel(), boutiqueGoods(), recommendGoods()]).then(() => { |
||||
// freshMap.refreshLoad = false; |
// freshMap.refreshLoad = false; |
||||
// }); |
// }); |
||||
}; |
}; |
||||
|
|
||||
// 触底加载 |
// 触底加载 |
||||
const onLoad = () => { |
const onLoad = () => { |
||||
// recommendGoods(true); |
// recommendGoods(true); |
||||
}; |
}; |
||||
|
|
||||
onMounted(() => { |
onMounted(() => { |
||||
// new Vconsole(); |
// new Vconsole(); |
||||
getEnterpriseMerchantAuthorization({merchantTel: useCommon.phonenumber},success =>{ |
getEnterpriseMerchantAuthorization({merchantTel: useCommon.phonenumber}, success => { |
||||
if(!(success.data == null && success.data.length == 0)){ |
if (!(success.data == null && success.data.length == 0)) { |
||||
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber); |
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber); |
||||
} |
} |
||||
},error =>{ |
}, error => { |
||||
}) |
}) |
||||
}) |
}) |
||||
// 返回 |
// 返回 |
||||
const goBack = () => { |
const goBack = () => { |
||||
router.go(-1); |
router.go(-1); |
||||
}; |
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style lang="less" scoped> |
<style lang="less" scoped> |
||||
.home { |
.home { |
||||
display: flex; |
display: flex; |
||||
flex-direction: column; |
flex-direction: column; |
||||
height: 100%; |
height: 100%; |
||||
overflow: hidden; |
overflow: hidden; |
||||
background-color: #ebf3fb; |
background-color: #ebf3fb; |
||||
|
|
||||
|
.warp_body { |
||||
|
background-image: linear-gradient(to bottom, #ebf3fb, transparent); |
||||
|
background-size: cover; |
||||
|
position: relative; |
||||
|
|
||||
.warp_body { |
.carousel_box { |
||||
background-image: linear-gradient(to bottom, #ebf3fb, transparent); |
position: relative; |
||||
background-size: cover; |
top: 2%; |
||||
position: relative; |
height: 150px; |
||||
.carousel_box { |
width: 100%; |
||||
position: relative; |
background: url("/src/assets/images/scan-mean.jpg") no-repeat center center; |
||||
top: 2%; |
background-size: 60%; |
||||
height: 150px; |
opacity: 0.75; |
||||
width: 100%; |
|
||||
background: url("/src/assets/images/scan-mean.jpg") no-repeat center center; |
.box-scan-one, .box-scan-two { |
||||
background-size: 60%; |
position: absolute; |
||||
opacity: 0.75; |
top: 30%; |
||||
|
left: 15%; |
||||
|
height: 100px; |
||||
|
width: 30%; |
||||
|
font-size: 0.4rem; |
||||
|
color: #999; |
||||
|
|
||||
|
.box-scan-text { |
||||
|
margin-top: 70%; |
||||
|
display: block; |
||||
|
width: 100%; |
||||
|
text-align: center |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.box-scan-two { |
||||
|
left: auto; |
||||
|
right: 12.5%; |
||||
|
} |
||||
|
} |
||||
|
|
||||
.box-scan-one , .box-scan-two{ |
|
||||
position: absolute; |
|
||||
top: 30%; |
|
||||
left: 15%; |
|
||||
height: 100px; |
|
||||
width: 30%; |
|
||||
font-size: 0.4rem; |
|
||||
color: #999; |
|
||||
.box-scan-text{ |
|
||||
margin-top: 70%; |
|
||||
display: block; |
|
||||
width: 100%; |
|
||||
text-align: center |
|
||||
} |
} |
||||
} |
|
||||
.box-scan-two{ |
|
||||
left: auto; |
|
||||
right: 12.5%; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
.boutique_box { |
.boutique_box { |
||||
position: relative; |
position: relative; |
||||
top: 10%; |
top: 10%; |
||||
z-index: 100; |
z-index: 100; |
||||
width: 100%; |
width: 100%; |
||||
|
|
||||
.boutique_body { |
.boutique_body { |
||||
padding: 0px 0px 10px 0px; |
padding: 0px 0px 10px 0px; |
||||
display: flex; |
display: flex; |
||||
justify-content: center; |
justify-content: center; |
||||
}; |
} |
||||
.box-qr-code{ |
; |
||||
width: 52%; |
|
||||
text-align: right; |
.box-qr-code { |
||||
height: 7rem; |
width: 52%; |
||||
//background-color: var(--van-primary-color); |
text-align: right; |
||||
background: url("../../assets/images/scan-btn.jpg") no-repeat center center; |
height: 7rem; |
||||
background-size: 100%; |
//background-color: var(--van-primary-color); |
||||
// border-radius: 0.26667rem; |
background: url("../../assets/images/scan-btn.jpg") no-repeat center center; |
||||
// background-size: cover; |
background-size: 100%; |
||||
// border-radius: 50%; |
// border-radius: 0.26667rem; |
||||
// background-image: url("@/assets/images/scan.png"); |
// background-size: cover; |
||||
.box-qr-code-text{ |
// border-radius: 50%; |
||||
margin-right: 25%; |
// background-image: url("@/assets/images/scan.png"); |
||||
margin-top: 70%; |
.box-qr-code-text { |
||||
display: block; |
margin-right: 25%; |
||||
font-size: 0.45333rem; |
margin-top: 70%; |
||||
} |
display: block; |
||||
img{ |
font-size: 0.45333rem; |
||||
position: absolute; |
} |
||||
top: 0%; |
|
||||
left: 34%; |
|
||||
} |
|
||||
} |
|
||||
.box-info{ |
|
||||
width: 52%; |
|
||||
text-align: right; |
|
||||
height: 3.66667rem; |
|
||||
background-color: #ff976a; |
|
||||
border-radius: 10px; |
|
||||
background: url("@/assets/images/item_check.png"); |
|
||||
background-size: cover; |
|
||||
|
|
||||
.box-info-text{ |
|
||||
margin-right: 3%; |
|
||||
margin-top: 2%; |
|
||||
display: block; |
|
||||
font-size: 17px |
|
||||
} |
|
||||
} |
|
||||
.box-complaint{ |
|
||||
width: 36%; |
|
||||
text-align: right; |
|
||||
height: 3.66667rem; |
|
||||
background-color: #ff976a; |
|
||||
border-radius: 10px; |
|
||||
margin-left: 2%; |
|
||||
background: url("@/assets/images/item_complain.png"); |
|
||||
background-size: cover; |
|
||||
.box-complaint-text{ |
|
||||
margin-right: 5%; |
|
||||
margin-top: 3%; |
|
||||
display: block; |
|
||||
font-size: 17px |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.recommend_box { |
img { |
||||
.recommend_body { |
position: absolute; |
||||
width: 100%; |
top: 0%; |
||||
} |
left: 34%; |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
.white-body { |
.box-info { |
||||
margin: 0 4%; |
width: 52%; |
||||
width: 92%; |
text-align: right; |
||||
height: 96%; |
height: 3.66667rem; |
||||
background-color: #fff; |
background-color: #ff976a; |
||||
border-radius: 0.25remnpm; |
border-radius: 10px; |
||||
} |
background: url("@/assets/images/item_check.png"); |
||||
|
background-size: cover; |
||||
|
|
||||
.nocode { |
.box-info-text { |
||||
width: 100%; |
margin-right: 3%; |
||||
color: #fb7905; |
margin-top: 2%; |
||||
font-size: 0.45rem; |
display: block; |
||||
text-align: center; |
font-size: 17px |
||||
line-height: 3; |
} |
||||
} |
} |
||||
|
|
||||
|
.box-complaint { |
||||
|
width: 36%; |
||||
|
text-align: right; |
||||
|
height: 3.66667rem; |
||||
|
background-color: #ff976a; |
||||
|
border-radius: 10px; |
||||
|
margin-left: 2%; |
||||
|
background: url("@/assets/images/item_complain.png"); |
||||
|
background-size: cover; |
||||
|
|
||||
|
.box-complaint-text { |
||||
|
margin-right: 5%; |
||||
|
margin-top: 3%; |
||||
|
display: block; |
||||
|
font-size: 17px |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.recommend_box { |
||||
|
.recommend_body { |
||||
|
width: 100%; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.white-body { |
||||
|
margin: 0 4%; |
||||
|
width: 92%; |
||||
|
height: 96%; |
||||
|
background-color: #fff; |
||||
|
border-radius: 0.25 remnpm; |
||||
|
} |
||||
|
|
||||
|
.nocode { |
||||
|
width: 100%; |
||||
|
color: #fb7905; |
||||
|
font-size: 0.45rem; |
||||
|
text-align: center; |
||||
|
line-height: 3; |
||||
|
} |
||||
</style> |
</style> |
||||
|
|||||
Loading…
Reference in new issue