You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.0 KiB
Vue

<script>
import {postDataByParams} from "../../http/service";
export default {
name: "index",
data(){
return {
url:'',
list:[]
}
},
methods:{
scanOrder() {
uni.scanCode({
onlyFromCamera: false,
success: res => {
this.url=res.result
this.getDetailUrl()
}
})
},
completeScan(){
uni.navigateTo({
url:'/pages/consignment-painting/index?type=scan'
})
},
async getDetailUrl() {
const data = {
url: this.url
}
const res = await postDataByParams('/api/warehouse/ocr', data)
if (res.code === 200) {
const scanArr=uni.getStorageSync('scanlist')
if (Array.isArray(scanArr)&&scanArr.length>0){
for (const item of scanArr) {
if (item.artworkNum===res.data.artworkNum){
uni.showToast({
title: '该艺术品已扫描',
icon: 'none'
})
return
}
}
uni.setStorageSync('scanlist', [...scanArr,res.data])
}else {
uni.setStorageSync('scanlist', [res.data])
}
this.list=uni.getStorageSync('scanlist')
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
},
},
mounted(){
if (this.$mp.query.url){
this.url=this.$mp.query.url
this.getDetailUrl()
}
}
}
</script>
<template>
<div class="container">
<div class="content1">
<div class="wrap1">
<img src="https://cdns.fontree.cn/fonchain-main/prod/image/default/approval/500b8411-c3ab-485a-af51-28d877c7524d.png" alt="">
</div>
<div class="wrap2">扫描成功-{{list.length}}</div>
<div class="wrap3">
<div class="wrap3_1" @click="scanOrder"></div>
<div class="wrap3_2" @click="completeScan"></div>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.container{
height: 100vh;
width: 100vw;
background-color: grey;
display: flex;
justify-content: center;
align-items: center;
.content1{
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
padding-left: 42rpx;
padding-right: 42rpx;
border-radius: 40rpx;
background-color: #fff;
width: 640rpx;
height: 438rpx;
.wrap3{
margin-top: 96rpx;
display: flex;
justify-content: space-between;
.wrap3_2{
margin-left: 18rpx;
border-radius: 40rpx;
display: flex;
justify-content: center;
align-items: center;
color:#fff ;
width: 270rpx;
height: 64rpx;
background-color: rgba(118, 196, 88, 1);
}
.wrap3_1{
border-radius: 40rpx;
display: flex;
justify-content: center;
align-items: center;
color:rgba(118, 196, 88, 1) ;
width: 270rpx;
height: 64rpx;
border: 1rpx solid rgba(118, 196, 88, 1);
}
}
.wrap2{
font-size: 36rpx;
color: #000;
margin-top: 56rpx;
}
.wrap1{
margin-top: 38rpx;
img{
width: 80rpx;
height: 80rpx;
}
}
}
}
</style>