You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pifa/pages/news/caigou/notice2.vue

256 lines
6.5 KiB

5 months ago
<template>
<view class="notice">
<view class="notice-bd">
<view class="a">
<view class="title">请上传营业执照照片</view>
<view class="desc">营业执照照片仅用于相关监管要求的认证和备案使用不对外展示</view>
<image @click="uploadImage(1)" v-if="license_img_id" :src="license_img_url"></image>
<image @click="uploadImage(1)" v-else src="https://hys.royaum.com.cn/static/caigou/icon-01.png"></image>
</view>
<view class="a">
<view class="item">
<view class="l">公司名称</view>
<input type="text" v-model="company_name" placeholder="如识别不成功,请手动输入" />
</view>
<view class="item">
<view class="l">信用代码</view>
<input type="text" v-model="credit_code" placeholder="如识别不成功,请手动输入" />
</view>
</view>
<view class="a">
<view class="title">请上传门头照照片</view>
<view class="desc">门头照照片仅用于验证您的经营是实体店不对外展示</view>
<image @click="uploadImage(2)" v-if="door_img_id" :src="door_img_url"></image>
<image @click="uploadImage(2)" v-else src="https://hys.royaum.com.cn/static/caigou/icon-02.png"></image>
</view>
</view>
<view class="notice-fd">
<view class="btn" @click="openPage()">下一步</view>
</view>
<addShuiyin />
</view>
</template>
<script>
import Config from '@/core/config'
import * as newFunApi from '@/api/newFun'
export default {
data() {
return {
license_img_id: "",
license_img_url: "",
door_img_id: "",
door_img_url: "",
company_name: "",
credit_code: "",
};
},
onLoad() {
if(uni.getStorageSync("orcInfo")){
this.license_img_id = uni.getStorageSync("orcInfo").license_img_id
this.license_img_url = uni.getStorageSync("orcInfo").license_img_url
this.door_img_id = uni.getStorageSync("orcInfo").door_img_id
this.door_img_url = uni.getStorageSync("orcInfo").door_img_url
this.company_name = uni.getStorageSync("orcInfo").company_name
this.credit_code = uni.getStorageSync("orcInfo").credit_code
}
},
methods: {
//上传照片
uploadImage(index) {
const that = this
// 选择图片
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
console.log(res)
uni.uploadFile({
url: (Config.get('apiUrl')+'upload/image').replace("index.php?s=/",""), // 仅为示例,非真实的接口地址
filePath: res.tempFiles[0].path,
name: 'file',
header: {
'content-type': 'multipart/form-data',
'Storeid': uni.getStorageSync('Store').storeInfo.store_id,
'Access-Token': uni.getStorageSync('AccessToken'),
'platform': "MP-WEIXIN",
},
formData: {
'Storeid': uni.getStorageSync('Store').storeInfo.store_id,
'Access-Token': uni.getStorageSync('AccessToken'),
'platform': "MP-WEIXIN",
},
success: (res1) => {
const {status,data,message} = JSON.parse(res1.data);
setTimeout(()=>{
if(status == 200){
uni.showToast({
title: '上传成功',
})
if(index == 1){
that.license_img_url = data.fileInfo.external_url
that.license_img_id = data.fileInfo.file_id
that.ocrCheckLicense();
}else{
that.door_img_url = data.fileInfo.external_url
that.door_img_id = data.fileInfo.file_id
}
}else{
uni.showToast({
icon: 'none',
title: msg,
})
}
},1500)
},
fail: (err) => {
console.log(err)
}
});
}
});
},
//识别营业执照
async ocrCheckLicense() {
const { status, data, message } = await newFunApi.ocrCheckLicense({img_id: this.license_img_id});
if (status == 200) {
this.company_name = data.name
this.credit_code = data.credit_code
}else{
uni.showToast({
icon: "none",
title: message
})
}
},
openPage() {
if(!this.license_img_id){
uni.showToast({
icon: "none",
title: "请上传营业执照"
})
return ;
}
if(!this.company_name){
uni.showToast({
icon: "none",
title: "公司名称不能为空!"
})
return ;
}
if(!this.credit_code){
uni.showToast({
icon: "none",
title: "信用代码不能为空!"
})
return ;
}
if(!this.door_img_id){
uni.showToast({
icon: "none",
title: "请上传门头照照片"
})
return ;
}
let orcInfo = uni.getStorageSync("orcInfo")
orcInfo.license_img_id = this.license_img_id
orcInfo.license_img_url = this.license_img_url
orcInfo.door_img_id = this.door_img_id
orcInfo.door_img_url = this.door_img_url
orcInfo.company_name = this.company_name
orcInfo.credit_code = this.credit_code
uni.setStorageSync("orcInfo",orcInfo)
uni.navigateTo({
url: "/pages/news/caigou/notice3"
})
}
}
}
</script>
<style lang="scss" scoped>
.notice{
background-color: #fff;
padding-bottom: 150rpx;
&-bd{
width: 700rpx;
margin: 0 auto;
text-align: justify;
border-radius: 10rpx;
padding: 0 45rpx;
box-sizing: border-box;
.a{
padding: 20rpx 0;
.title{
font-size: 36rpx;
color: #222222;
text-align: center;
}
.desc{
width: 550rpx;
font-size: 28rpx;
color: #333333;
line-height: 48rpx;
text-align: center;
margin: 0 auto;
margin-top: 20rpx;
}
image{
width: 550rpx;
height: 340rpx;
display: block;
margin: 0 auto;
margin-top: 20rpx;
}
.item{
padding: 20rpx 0;
display: flex;
align-items: center;
border-bottom: 1px solid #E9E9E9;
.l{
font-size: 28rpx;
color: #222222;
height: 50rpx;
line-height: 50rpx;
width: 200rpx;
}
input{
flex: 1;
font-size: 28rpx;
color: #222222;
height: 50rpx;
line-height: 50rpx;
}
}
}
}
&-fd{
height: 140rpx;
width: 100%;
position: fixed;
left: 0;
bottom: 0;
z-index: 22;
background-color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
.btn{
width: 662rpx;
height: 90rpx;
line-height: 90rpx;
background: #F34A40;
border-radius: 90rpx;
text-align: center;
font-size: 32rpx;
color: #FFFFFF;
&-on{
background-color: #ccc;
}
}
}
}
</style>