Bladeren bron

图片地址替换公共方法

yxb
DESKTOP-2IO5MST\huting 1 jaar geleden
bovenliggende
commit
a2c943b8bc

+ 11
- 16
subpackage/after-sale/ETC-log-off/upload-card.vue Bestand weergeven

@@ -52,6 +52,7 @@
stringToJson
} from "@/utils/network/encryption.js";
const bluetoothUtil = require("../../../static/etcUtil/index.js");
import { getItem } from "@/utils/storage";
// 表单数据
const form = reactive({
obuId: '',
@@ -60,20 +61,7 @@
ReasonCancellation: "",
equipmentState: ''
});
const list = reactive([{
//原因
value: "原因1",
label: "原因1",
},
{
value: "原因1",
label: "原因1",
},
{
value: "原因1",
label: "原因1",
},
]);
const list = reactive([]);

// 验证提示类型(toast要版本为1.3.5才支持)
const errorType = ["border-bottom", "toast"];
@@ -84,13 +72,20 @@
onReady(() => {

});

onLoad((option) => {
form.obuId = option.obuId;
form.cardId = option.cardId;
form.orderId = option.orderId
form.equipmentState = option.equipmentState
console.log("option.orderId", option)
console.log("option.orderId", option, getItem('key')['LOGOFF'])
// 获取注销原因
for (var k = 0; k < getItem('key')['LOGOFF'].length; k++) {
var obj = {};
obj['value'] = getItem('key')['LOGOFF'][k]['name']
obj['label'] = getItem('key')['LOGOFF'][k]['name']
list.push(obj)
}
console.log("list", list)
/*监听蓝牙回调*/
uni.$on('bluetoothLink', function (status) {
queryCardSignCancellation(1, 1, 1).then((item : any) => {

+ 127
- 114
subpackage/after-sale/account-recharge/open-account.vue Bestand weergeven

@@ -32,35 +32,35 @@
</view>
<view class='up_img_wrap message'>
<u-form :model="form" ref="form1" label-width=210 border-bottom=false>
<u-form-item label="对公用户登录名 " border-bottom=true >
<u-input placeholder='请输入7-16位字母加数字组成的账号' type="text" v-model="state.form.name"/>
<u-form-item label="对公用户登录名 " border-bottom=true>
<u-input placeholder='请输入7-16位字母加数字组成的账号' type="text" v-model="state.form.name" />
</u-form-item>
<u-form-item label="对公用户密码" >
<u-input placeholder='请输入对公用户密码' type="text" v-model="state.form.password"/>
<u-form-item label="对公用户密码">
<u-input placeholder='请输入对公用户密码' type="text" v-model="state.form.password" />
</u-form-item>
<u-form-item label="支付密码" >
<u-input placeholder='请输入支付密码' type="text" v-model="state.form.consumePassword"/>
<u-form-item label="支付密码">
<u-input placeholder='请输入支付密码' type="text" v-model="state.form.consumePassword" />
</u-form-item>
<!-- <u-form-item label="公司证件类型 ">
<u-input v-model="state.form.type" type="select" :select-open="state.showType" @click="state.showType = true" placeholder='请选择'/>
</u-form-item> -->
<u-form-item label="公司证件编码 " >
<u-input placeholder='请输入公司证件编码' type="text" v-model="state.form.code"/>
<u-form-item label="公司证件编码 ">
<u-input placeholder='请输入公司证件编码' type="text" v-model="state.form.code" />
</u-form-item>
<u-form-item label="公司名称" >
<u-input placeholder='请输入公司名称' type="text" v-model="state.form.companyName"/>
<u-form-item label="公司名称">
<u-input placeholder='请输入公司名称' type="text" v-model="state.form.companyName" />
</u-form-item>
<u-form-item label="经办人姓名" >
<u-input placeholder='请输入经办人姓名' type="text" v-model="state.form.handlerName"/>
<u-form-item label="经办人姓名">
<u-input placeholder='请输入经办人姓名' type="text" v-model="state.form.handlerName" />
</u-form-item>
<u-form-item label="经办人手机号" >
<u-input placeholder='请输入经办人手机号' type="text" v-model="state.form.handlerPhone"/>
<u-form-item label="经办人手机号">
<u-input placeholder='请输入经办人手机号' type="text" v-model="state.form.handlerPhone" />
</u-form-item>
<u-form-item label="银行卡号" >
<u-input placeholder='请输入银行卡号' type="text" v-model="state.form.bankCardId"/>
<u-form-item label="银行卡号">
<u-input placeholder='请输入银行卡号' type="text" v-model="state.form.bankCardId" />
</u-form-item>
<u-form-item label="开户行" >
<u-input placeholder='请输入开户行' type="text" v-model="state.form.bankAddress"/>
<u-form-item label="开户行">
<u-input placeholder='请输入开户行' type="text" v-model="state.form.bankAddress" />
</u-form-item>
</u-form>
<!-- <view class='pay_msg'>付款银行账户信息</view>
@@ -85,32 +85,32 @@
</template>

<script setup lang="ts">
import {reactive} from "vue";
import {etcOcrCard,envs,ocrAllQuery,fileUpload,openRecharge} from "@/utils/network/api.js";
import {pathToBase64} from "@/utils/image-tools/index.js";
import { reactive } from "vue";
import { etcOcrCard, envs, ocrAllQuery, fileUpload, openRecharge } from "@/utils/network/api.js";
import { pathToBase64 } from "@/utils/image-tools/index.js";
import { navTo } from "@/utils/utils";
import {request} from "@/utils/network/request.js";
import {stringToJson} from "@/utils/network/encryption.js";
import { msg,checkStr } from "@/utils/utils";
import { request } from "@/utils/network/request.js";
import { stringToJson } from "@/utils/network/encryption.js";
import { msg, checkStr, strReplace } from "@/utils/utils";
const state = reactive({
isBusinessLicense:false, //是否上传公司营业执照
form:{
url1:'', //公司营业执照
url2:'', //
url3:'', //
url4:'', //
name:'',//对公用户登录名
password:'',//对公用户登录密码
consumePassword:'', //支付密码
isBusinessLicense: false, //是否上传公司营业执照
form: {
url1: '', //公司营业执照
url2: '', //
url3: '', //
url4: '', //
name: '',//对公用户登录名
password: '',//对公用户登录密码
consumePassword: '', //支付密码
// type:'',//公司证件类型
code:'', //公司证件编码
companyName:'',
handlerName:'',
handlerPhone:'',
bankAddress:"", //开户行
bankCardId:"", //充值银行卡号
code: '', //公司证件编码
companyName: '',
handlerName: '',
handlerPhone: '',
bankAddress: "", //开户行
bankCardId: "", //充值银行卡号
},
showType:false, //公司证件类型下拉
showType: false, //公司证件类型下拉
// typeList:['营业执照','统一社会信用代码证','组织结构代码证'],
})
const cardDbImageOcr = (val : any) => {
@@ -129,7 +129,7 @@
fileName: res.tempFilePaths[0],
imageBase64: path,
};
const options = {
type: 2,
data: data,
@@ -139,17 +139,17 @@
console.log("cdfdf")
request(etcOcrCard, options).then((res) => {
const data = stringToJson(res.bizContent);
console.log("图片信息",data)
if (val === "2"){
console.log("图片信息", data)
if (val === "2") {
state.form.url2 = data.imageUrl;
}else if (val === "3"){
} else if (val === "3") {
state.form.url3 = data.imageUrl;
}else if (val === "4"){
} else if (val === "4") {
state.form.url4 = data.imageUrl;
}
});
})
.catch((error) => { console.log('输出内容',error) });
.catch((error) => { console.log('输出内容', error) });
},
});
};
@@ -158,15 +158,15 @@
// state.form.type=state.typeList[e]
// }
//替换图片地址
const strReplace = (str : string) => {
return str.replace('192.168.101.145:9000', envs[process.env.NODE_ENV].baseUrl)
}
const goBankCard=()=>{
// const strReplace = (str : string) => {
// return str.replace('192.168.101.145:9000', envs[process.env.NODE_ENV].baseUrl)
// }
const goBankCard = () => {
navTo(`/subpackage/personal-center/setting/bank-card/bank-card`);
}
const open=()=>{
for(var i in state.form){
if(!state.form[i]){
const open = () => {
for (var i in state.form) {
if (!state.form[i]) {
msg('请把信息填写完整!')
return;
}
@@ -178,19 +178,19 @@
const options = {
type: 2,
data: {
'accountId':state.form.name, //账户编号
'corporateIdNum':state.form.code, //公司营业执照统一社会信用代码
'corporateName':state.form.companyName, //对公名称
'photoUrl':state.form.url1, //营业执照图片路径
'authBookUrl':state.form.url2, //授权书图片路径
'agentName':state.form.handlerName, //经办人姓名
'agentTel':state.form.handlerPhone, //经办人手机号
'idCardImageUrl':state.form.url3, //经办人身份证正面
'idCardBackImageUrl':state.form.url4, //经办人身份证反面
'bankAddress':state.form.bankAddress, //开户行
'bankCardId':state.form.bankCardId, //充值银行卡号
'password':state.form.password, //密码
'consumePassword':state.form.consumePassword,//支付密码
'accountId': state.form.name, //账户编号
'corporateIdNum': state.form.code, //公司营业执照统一社会信用代码
'corporateName': state.form.companyName, //对公名称
'photoUrl': state.form.url1, //营业执照图片路径
'authBookUrl': state.form.url2, //授权书图片路径
'agentName': state.form.handlerName, //经办人姓名
'agentTel': state.form.handlerPhone, //经办人手机号
'idCardImageUrl': state.form.url3, //经办人身份证正面
'idCardBackImageUrl': state.form.url4, //经办人身份证反面
'bankAddress': state.form.bankAddress, //开户行
'bankCardId': state.form.bankCardId, //充值银行卡号
'password': state.form.password, //密码
'consumePassword': state.form.consumePassword,//支付密码
},
method: "POST",
showLoading: true,
@@ -198,8 +198,8 @@
request(openRecharge, options)
.then((res) => {
let data = stringToJson(res.bizContent)
console.log("开户成功",data.status)
if(data.status==1){
console.log("开户成功", data.status)
if (data.status == 1) {
navTo(`/subpackage/after-sale/account-recharge/login`)
}
})
@@ -213,7 +213,7 @@
count: 1, //只能选取一张照片
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["camera", "album"], //从相册选择
success: function(res) {
success: function (res) {
pathToBase64(res.tempFilePaths[0])
.then((path) => {
var data = {
@@ -228,26 +228,26 @@
};
request(ocrAllQuery, options).then((res) => {
const data = stringToJson(res.bizContent);
console.log("营业执照",data)
console.log("营业执照", data)
if (data.result) {
state.form.url2 = '';
state.form.companyName = stringToJson(data.result
.businessLicense)[
'名称'];
'名称'];
state.form.code = stringToJson(data.result
.businessLicense)[
'统一社会信用代码'];
cardFileImageUpdateyy(path)
}
});
})
.catch((error) => {});
.catch((error) => { });
},
});
};
//委托书获取图片给后端
const cardFileImageUpdateyy = (val: any) => {
const cardFileImageUpdateyy = (val : any) => {
var data = {
fileBase64: val,
};
@@ -262,76 +262,89 @@
state.form.url1 = data.data.url;
});
};
const shiqu=()=>{
console.log("state.form.handlerPhone",state.form.handlerPhone)
const shiqu = () => {
console.log("state.form.handlerPhone", state.form.handlerPhone)
}
</script>

<style scoped>
.content{
background-color:rgb(246,246,246);
font-size:30rpx;
.content {
background-color: rgb(246, 246, 246);
font-size: 30rpx;
padding-bottom: 30rpx;
}
.up_img_wrap{
background-color:white;
padding:0 20rpx;

.up_img_wrap {
background-color: white;
padding: 0 20rpx;
}
.title{
margin:0 0 20rpx 0;

.title {
margin: 0 0 20rpx 0;
}
.tips{
color:red;
font-size:30rpx;

.tips {
color: red;
font-size: 30rpx;
}
.item_wrap{

.item_wrap {
display: flex;
flex-shrink: 1;
flex-wrap: wrap;
justify-content: space-between;
padding:10rpx 0 20rpx 0;
padding: 10rpx 0 20rpx 0;
}
.item{
width:45%;
height:250rpx;
margin-top:20rpx;

.item {
width: 45%;
height: 250rpx;
margin-top: 20rpx;
}
.item image{
width:100%;
height:80%;

.item image {
width: 100%;
height: 80%;
}
.item view{
text-align:center;

.item view {
text-align: center;
}
.message{
margin-top:30rpx;

.message {
margin-top: 30rpx;
}
.pay_msg{
border-bottom: 2px dotted rgb(75,217,97);
padding:30rpx 0;

.pay_msg {
border-bottom: 2px dotted rgb(75, 217, 97);
padding: 30rpx 0;
}
.company{

.company {
padding: 20rpx 50rpx 20rpx 6rpx;
display:flex;
display: flex;
align-items: center;
justify-content: space-between;
}
.phone{
margin-top:20rpx;

.phone {
margin-top: 20rpx;
}
.attention{
background-color:rgb(246,246,246);
color:red;
font-size:30rpx;
padding:30rpx 20rpx 20rpx 20rpx;

.attention {
background-color: rgb(246, 246, 246);
color: red;
font-size: 30rpx;
padding: 30rpx 20rpx 20rpx 20rpx;
}
.open{

.open {
height: 80rpx;
background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
border-radius: 40rpx;
font-size: 32rpx;
font-weight: 400;
color: #ffffff;
margin:0 30rpx;
margin: 0 30rpx;
}
</style>

+ 6
- 6
subpackage/after-sale/card-Renewal/renewal-confirm.vue Bestand weergeven

@@ -62,7 +62,7 @@
</view>
</view>
</view>
<!-- <view class="title"> 注意事项 </view>
<!-- <view class="title"> 注意事项 </view>
<view class="remark">
<view> 1.xxxxxxxx </view>
<view> 2.xxxxxxxx </view>
@@ -76,7 +76,7 @@
<view class="top">
<image class="icon-close" :src="`${$imgUrl}common/icon-close.png`" @click="cancel"></image>
</view>
<image class="icon-success" :src="`${$imgUrl}bluetooth/device-active-success.png`"></image>
<image class="icon-success" :src="`${$imgUrl}bluetooth/card-success.png`"></image>
<view class="title">卡签续期成功!</view>
</view>
</view>
@@ -87,7 +87,7 @@
import {
getCodeName
} from "@/datas/queryKey.js";
import {
reactive
} from "vue";
@@ -206,7 +206,7 @@
tools.hideLoadingAlert();
let status = res[cmdArray.length - 1].substring(res[cmdArray.length - 1].length -
4, res[cmdArray.length - 1].length);
if (status == "9000") {
if (status == "9000") {
getCommandBack(result.command, result.cosRecordId, res.toString());
}
})
@@ -233,7 +233,7 @@
method: "POST", //提交方式(默认POST)
showLoading: true, //是否显示加载中(默认显示)
};
//调用方式
request(writeCardBack, options)
.then((res) => {
@@ -525,4 +525,4 @@
line-height: 80rpx;
}
}
</style>
</style>

+ 1
- 1
subpackage/after-sale/card-deactivation-activation/deactivation-activation-confirm.vue Bestand weergeven

@@ -75,7 +75,7 @@
<view class="top">
<image class="icon-close" :src="`${$imgUrl}common/icon-close.png`" @click="cancel"></image>
</view>
<image class="icon-success" :src="`${$imgUrl}bluetooth/device-active-success.png`"></image>
<image class="icon-success" :src="`${$imgUrl}bluetooth/card-success.png`"></image>
<view class="title">{{orderInfos.cardStatus ==1?'卡签停用':'卡签启用'}}成功!</view>
</view>
</view>

+ 2
- 2
subpackage/after-sale/equipment-upgrade/upgrade-confirm.vue Bestand weergeven

@@ -70,7 +70,7 @@
<view class="top">
<image class="icon-close" :src="`${$imgUrl}common/icon-close.png`" @click="cancel"></image>
</view>
<image class="icon-success" :src="`${$imgUrl}bluetooth/device-active-success.png`"></image>
<image class="icon-success" :src="`${$imgUrl}bluetooth/card-success.png`"></image>
<view class="title">设备升级成功!</view>
</view>
</view>
@@ -482,4 +482,4 @@
color: #333;
}
}
</style>
</style>

+ 8
- 10
subpackage/after-sale/rescind-carId/rescind-carId-select.vue Bestand weergeven

@@ -245,10 +245,8 @@
import navBar from "@/components/nav-bar/nav-bar2.vue";

import {
navTo
navTo, strReplace
} from "@/utils/utils";


// ########
const show1 = ref(false)
const state = reactive({
@@ -605,13 +603,13 @@
};

//替换图片地址
const strReplace = (str : string) => {
console.log(str)
let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
console.log(imgUrl)
return imgUrl;
}
// const strReplace = (str : string) => {
// console.log(str)
// let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
// imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
// console.log(imgUrl)
// return imgUrl;
// }
</script>

<style lang="scss" scoped>

+ 1
- 1
subpackage/orders/addAddress.vue Bestand weergeven

@@ -1,6 +1,6 @@
<template>
<view class="form">
<u-form label-width="120rpx" :model="state.formData" ref="uForm">
<u-form label-width="122rpx" :model="state.formData" ref="uForm">
<u-form-item label="收货人">
<u-input placeholder="名字" :customStyle="btnGetCode" v-model="state.formData.consignee" maxlength="20" />
</u-form-item>

+ 7
- 7
subpackage/orders/car-release.vue Bestand weergeven

@@ -230,8 +230,8 @@

import { getEtcCardStatus } from "@/datas/etcCardStatus.js";
import { getItem, StorageKeys } from "@/utils/storage";
import { hasLogin } from "@/utils/utils.ts";
import { msg } from "@/utils/utils";
// import { hasLogin } from "@/utils/utils.ts";
import { msg, strReplace, hasLogin } from "@/utils/utils";
import {
getCodeName
} from "@/datas/queryKey.js";
@@ -606,11 +606,11 @@
};

//替换图片地址
const strReplace = (str : string) => {
let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
return imgUrl;
};
// const strReplace = (str : string) => {
// let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
// imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
// return imgUrl;
// };
const getGlobalParam = () => {
const data = getItem('globalParam')
console.log("全局配置数据", getCodeName('IS_ENABLE', data.applyChangeOCRCarInfo))

+ 4
- 2
subpackage/orders/essential-information.vue Bestand weergeven

@@ -159,7 +159,8 @@
checked: false,
agreeURL: "",
orderId: "",
totalAmount: ""
totalAmount: "",
equityId: ""
});
const globalParam = () => {
const options = {
@@ -401,6 +402,7 @@
state.isValueCard = option.isValueCard
state.data.cardType = option.isValueCard
state.totalAmount = option.totalAmount;
state.equityId = option.equityId;
console.log("订单选择推广发行产品接口", option)
getInfo();
uni.getLocation({
@@ -505,7 +507,7 @@
data: {
orderId: state.orderId, //订单编号
openId: getItem(StorageKeys.OpenId), //操作人 id
equityId: state.data.promoteId, //权益Id
equityId: state.equityId, //权益Id
totalAmount: state.totalAmount, //总金额
isRepeatPurchase: 0
},

+ 2
- 1
subpackage/orders/interestsList.vue Bestand weergeven

@@ -88,9 +88,10 @@
console.log("option", option)
})
const addInterestsList = (item) => {
console.log("item", item)
state.totalAmount = Number(state.totalAmount) + Number(item.discountPrice)
uni.redirectTo({
url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isValueCard=${state.isValueCard}&totalAmount=${state.totalAmount}`,
url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isValueCard=${state.isValueCard}&totalAmount=${state.totalAmount}&equityId=${item.equityId}`,
});
return;
state.choiceValueComplete = [];

+ 8
- 7
subpackage/orders/opening-account-people.vue Bestand weergeven

@@ -250,7 +250,8 @@
} from "vue";
import {
msg,
checkStr
checkStr,
strReplace
} from "@/utils/utils";
import {
onLoad,
@@ -606,12 +607,12 @@
// });
// };
//替换图片地址
const strReplace = (str : string) => {
let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
console.log(imgUrl)
return imgUrl;
}
// const strReplace = (str : string) => {
// let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
// imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
// console.log(imgUrl)
// return imgUrl;
// }
const getGlobalParam = () => {
const data = getItem('globalParam')
console.log("全局配置数据", getCodeName('IS_ENABLE', data.miniSupportOther), getCodeName('IS_ENABLE', data.otherUploadProxy), getCodeName('IS_ENABLE', data.miniInfoShow), getCodeName('IS_ENABLE', data.changeOCRData))

+ 7
- 6
subpackage/orders/opening-account-unit.vue Bestand weergeven

@@ -143,7 +143,8 @@
} from "@/utils/storage";
import {
msg,
checkStr
checkStr,
strReplace
} from "@/utils/utils";

const scrollTop = ref(0);//滚动距离
@@ -427,11 +428,11 @@
};

//替换图片地址
const strReplace = (str : string) => {
let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
return imgUrl;
}
// const strReplace = (str : string) => {
// let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
// imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
// return imgUrl;
// }
const takePhotoMode = (index) => {
console.log("index", index)
state.isTakePhotoModeShow = true

+ 0
- 1
subpackage/orders/order_payment.vue Bestand weergeven

@@ -130,7 +130,6 @@
request(PAYMENTORDERAPPLY, optionsali).then((res) => {
const data = stringToJson(res.bizContent);
console.log('支付下单返回:', data)
return;
my.tradePay({
// 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no
tradeNO: data.tranPackage,

+ 3
- 4
subpackage/orders/product-detail.vue Bestand weergeven

@@ -496,10 +496,9 @@
// PRESTORE("预存金",3){},
// EQUITY("权益费",4){},
for (let i = 0; i < state.dataArray.length; i++) {
// if (state.dataArray[i].payType === 'HANDLE') {
// state.dataArray[i].payName = '办理费'
// } else
if (state.dataArray[i].payType === 'MARGIN') {
if (state.dataArray[i].payType === 'HANDLE') {
state.dataArray[i].payName = '权益金'
} else if (state.dataArray[i].payType === 'MARGIN') {
state.dataArray[i].payName = '保证金'
} else if (state.dataArray[i].payType === 'PRESTORE') {
state.dataArray[i].payName = '预存金'

+ 90
- 88
subpackage/personal-center/setting/car-information/car-change.vue Bestand weergeven

@@ -19,7 +19,7 @@
<image v-else class="icon" :src="strReplace(state.form.vehPosImgUrl)"></image>
</view>
</view>
<view class="picture-wrapper" @click="cardImageOcr('2')">
<view class="picture-wrapper" @click="cardImageOcr('2')">
<view class="bg">
<view class="">
<view class="name"> 行驶证副页 </view>
@@ -61,7 +61,7 @@
<u-form-item label="车辆类型">
<u-input inputAlign="right" v-model="state.form.vehicleType" />
</u-form-item>
<!-- <u-form-item label="使用性质">
<!-- <u-form-item label="使用性质">
<u-input inputAlign="right" v-model="state.form.useCharacter" />
</u-form-item> -->
<u-form-item label="车辆识别代号">
@@ -89,7 +89,7 @@
<u-form-item label="总质量">
<u-input inputAlign="right" v-model="state.form.totalMass" />
</u-form-item>
<!-- <u-form-item label="车牌颜色">
<!-- <u-form-item label="车牌颜色">
<u-input inputAlign="right"
v-model="state.showCaridCorlor" type="select" disabled="ture" />
</u-form-item> -->
@@ -139,17 +139,19 @@
onLoad,
onShow
} from "@dcloudio/uni-app";


let cacachCarid=''
const strReplace = (str : string) => {
let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
return imgUrl;
};
// 修改
import {
strReplace
} from "@/utils/utils";

let cacachCarid = ''
// const strReplace = (str : string) => {
// let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
// imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
// return imgUrl;
// };
// 修改
const savaHandle = () => {
state.form.vehicleId=cacachCarid
state.form.vehicleId = cacachCarid
var data = state.form;
console.log(data, "##########");
const options = {
@@ -170,7 +172,7 @@ const strReplace = (str : string) => {
});
};

const selectConfirm = (item: any) => {
const selectConfirm = (item : any) => {
// item.map((val, index) => {
// state.form.useUserType = val.value;
// state.form.useUserTypeName = val.label;
@@ -178,8 +180,8 @@ const strReplace = (str : string) => {
console.log(item);

if (state.form.vehicleId) {
state.showCaridCorlor=item[0].label
state.carIdcorlorCode= item[0].value
state.showCaridCorlor = item[0].label
state.carIdcorlorCode = item[0].value
console.log(state.form);
} else {
uni.showToast({
@@ -194,7 +196,7 @@ const strReplace = (str : string) => {
count: 1, //只能选取一张照片
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["camera", "album"], //从相册选择
success: function(res) {
success: function (res) {
pathToBase64(res.tempFilePaths[0])
.then((path) => {
var data = {
@@ -213,7 +215,7 @@ const strReplace = (str : string) => {
state.form.vehBodyUrl = data.data.url;
});
})
.catch((error) => {});
.catch((error) => { });
},
});
};
@@ -221,47 +223,47 @@ const strReplace = (str : string) => {
const state = reactive({
actionSheetShow: false,
actionSheetList: [{
label: "蓝色",
value: 0,
}, {
label: "黄色",
value: 1,
},
{
label: "黑色",
value: 2,
},
{
label: "白色",
value: 3,
},
{
label: "渐变绿色",
value: 4,
},
{
label: "黄绿双拼色",
value: 5,
},
{
label: "蓝白渐变色",
value: 6,
},
{
label: "未确定",
value: 9,
},
{
label: "绿色",
value: 11,
},
{
label: "红色",
value: 12,
},
label: "蓝色",
value: 0,
}, {
label: "黄色",
value: 1,
},
{
label: "黑色",
value: 2,
},
{
label: "白色",
value: 3,
},
{
label: "渐变绿色",
value: 4,
},
{
label: "黄绿双拼色",
value: 5,
},
{
label: "蓝白渐变色",
value: 6,
},
{
label: "未确定",
value: 9,
},
{
label: "绿色",
value: 11,
},
{
label: "红色",
value: 12,
},
],
showCaridCorlor: '',
carIdcorlorCode:'',
carIdcorlorCode: '',
form: {
openId: getItem('openId'), //用户标识.
// man: "", //所有人
@@ -308,49 +310,49 @@ const strReplace = (str : string) => {
testRecord: '', //检验记录
fileNum: '', //档案编号
useCharacter: '', //车辆使用性质
registerDate: '' ,//注册日期
status:""//车辆信息状态
registerDate: '',//注册日期
status: ""//车辆信息状态
},
orderId: "",
isMyPeopple: true,
});
onLoad((option: any) => {
onLoad((option : any) => {
// state.form.orderId = option.orderId;
console.log(JSON.parse(option.data),"RRRRRRRRRRRRRRRRRRR");
let data=JSON.parse(option.data)
cacachCarid=data.vehicleId
state.form.vehPosImgUrl=data.vehPosImgUrl
state.form.vehNegImgUrl=data.vehNegImgUrl
state.form.vehBodyUrl=data.vehBodyUrl
state.form.vehicleId=data.vehiclePlate
state.form.vehicleType=data.vehicleType
console.log(JSON.parse(option.data), "RRRRRRRRRRRRRRRRRRR");
let data = JSON.parse(option.data)
cacachCarid = data.vehicleId
state.form.vehPosImgUrl = data.vehPosImgUrl
state.form.vehNegImgUrl = data.vehNegImgUrl
state.form.vehBodyUrl = data.vehBodyUrl
state.form.vehicleId = data.vehiclePlate
state.form.vehicleType = data.vehicleType
// state.form.useCharacter=data.useCharacter
state.form.vin=data.vin
state.form.ownerName=data.ownerName
state.form.engineNum=data.engineNum
state.form.registerDate=data.registerDate
state.form.issueDate=data.issueDate
state.form.approvedCount=data.approvedCount
state.form.maintenaceMass=data.maintenaceMass
state.form.vehicleDimensions=data.vehicleDimensions
state.form.totalMass=data.totalMass
state.form.status=data.status
if(data.status=='使用'){
state.form.status=1
}else if(data.status=='未使用'){
state.form.status=2
}else{
state.form.status=3
state.form.vin = data.vin
state.form.ownerName = data.ownerName
state.form.engineNum = data.engineNum
state.form.registerDate = data.registerDate
state.form.issueDate = data.issueDate
state.form.approvedCount = data.approvedCount
state.form.maintenaceMass = data.maintenaceMass
state.form.vehicleDimensions = data.vehicleDimensions
state.form.totalMass = data.totalMass
state.form.status = data.status
if (data.status == '使用') {
state.form.status = 1
} else if (data.status == '未使用') {
state.form.status = 2
} else {
state.form.status = 3
}
});
//orc接口调用
const cardImageOcr = (val: any) => {
const cardImageOcr = (val : any) => {
var imageType = val;
uni.chooseImage({
count: 1, //只能选取一张照片
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["camera", "album"], //从相册选择
success: function(res) {
success: function (res) {
pathToBase64(res.tempFilePaths[0])
.then((path) => {
var data = {
@@ -390,7 +392,7 @@ const strReplace = (str : string) => {
}
});
})
.catch((error) => {});
.catch((error) => { });
},
});
};
@@ -549,4 +551,4 @@ const strReplace = (str : string) => {
margin-bottom: 60rpx;
}
}
</style>
</style>

+ 258
- 90
subpackage/personal-center/setting/car-information/car-create.vue Bestand weergeven

@@ -4,7 +4,7 @@
<view class="title"> 上传后请核对识别信息 </view>
<view class="tip"> 如有错误请及时手动修改 </view>
</view>
<view class="picture-wrapper" @click="cardImageOcr('1')">
<view class="picture-wrapper" @click="takePhotoMode('1')">
<view class="bg">
<view class="">
<view class="name"> 行驶证主页 </view>
@@ -19,7 +19,7 @@
<image v-else class="icon" :src="strReplace(state.form.vehPosImgUrl)"></image>
</view>
</view>
<view class="picture-wrapper" @click="cardImageOcr('2')">
<view class="picture-wrapper" @click="takePhotoMode('2')">
<view class="bg">
<view class="">
<view class="name"> 行驶证副页 </view>
@@ -61,7 +61,7 @@
<u-form-item label="车辆类型">
<u-input inputAlign="right" v-model="state.form.vehicleType" />
</u-form-item>
<!-- <u-form-item label="使用性质">
<!-- <u-form-item label="使用性质">
<u-input inputAlign="right" v-model="state.form.useCharacter" />
</u-form-item> -->
<u-form-item label="车辆识别代号">
@@ -107,6 +107,14 @@
</view>
<u-select v-model="state.actionSheetShow" :list="state.actionSheetList" @confirm="selectConfirm"></u-select>
</view>
<view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
<view class="choice-takePhoto">
<view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
<view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
<view @click.stop="cancle">取消</view>
</view>
</view>
<viewfinderCar v-if="state.phoneType" :phoneType="state.phoneType" @confirmReturn="confirmReturn"></viewfinderCar>
</template>

<script setup lang="ts">
@@ -118,6 +126,7 @@
import {
pathToBase64
} from "@/utils/util/imageTool.js";
import viewfinderCar from "../../../../components/viewfinderCar.vue";
import {
getItem
} from "@/utils/storage.ts"
@@ -139,49 +148,51 @@
onLoad,
onShow
} from "@dcloudio/uni-app";

import {
strReplace
} from "@/utils/utils";
const savaHandle = () => {
if(state.showCaridCorlor){
state.form.vehicleId=state.form.vehicleId+'_'+state.carIdcorlorCode
var data = state.form;
console.log(data, "##########");
const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
request(createCarInfo, options).then((res) => {
const data = stringToJson(res.bizContent);
console.log(data)
if (data.info == '成功.') {
uni.reLaunch({
url: "/subpackage/personal-center/setting/car-information/car-manage"
})
}
}).catch(err=>{
console.log(err,"在这里");
console.log(state.form.vehicleId.split('_'));
state.form.vehicleId=state.form.vehicleId.split('_')[0]
})
}else{
if (state.showCaridCorlor) {
state.form.vehicleId = state.form.vehicleId + '_' + state.carIdcorlorCode
var data = state.form;
console.log(data, "##########");
const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
request(createCarInfo, options).then((res) => {
const data = stringToJson(res.bizContent);
console.log(data)
if (data.info == '成功.') {
uni.reLaunch({
url: "/subpackage/personal-center/setting/car-information/car-manage"
})
}
}).catch(err => {
console.log(err, "在这里");
console.log(state.form.vehicleId.split('_'));
state.form.vehicleId = state.form.vehicleId.split('_')[0]
})
} else {
uni.showToast({
title:"请选择车牌颜色",
icon:"none"
title: "请选择车牌颜色",
icon: "none"
})
}
};

const selectConfirm = (item: any) => {
const selectConfirm = (item : any) => {
// item.map((val, index) => {
// state.form.useUserType = val.value;
// state.form.useUserTypeName = val.label;
// });
console.log(item);
if (state.form.vehicleId) {
state.showCaridCorlor=item[0].label
state.carIdcorlorCode= item[0].value
state.showCaridCorlor = item[0].label
state.carIdcorlorCode = item[0].value
console.log(state.form);
} else {
uni.showToast({
@@ -196,7 +207,7 @@
count: 1, //只能选取一张照片
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["camera", "album"], //从相册选择
success: function(res) {
success: function (res) {
pathToBase64(res.tempFilePaths[0])
.then((path) => {
var data = {
@@ -215,60 +226,63 @@
state.form.vehBodyUrl = data.data.url;
});
})
.catch((error) => {});
.catch((error) => { });
},
});
};
const strReplace = (str : string) => {
let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
return imgUrl;
};
// const strReplace = (str : string) => {
// let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
// imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
// return imgUrl;
// };

const state = reactive({
phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
choiceIndex: 1, // 1 身份证正面 2 身份证反面
isTakePhotoModeShow: false, //选择拍照方式是否出来
actionSheetShow: false,
actionSheetList: [{
label: "蓝色",
value: 0,
}, {
label: "黄色",
value: 1,
},
{
label: "黑色",
value: 2,
},
{
label: "白色",
value: 3,
},
{
label: "渐变绿色",
value: 4,
},
{
label: "黄绿双拼色",
value: 5,
},
{
label: "蓝白渐变色",
value: 6,
},
{
label: "未确定",
value: 9,
},
{
label: "绿色",
value: 11,
},
{
label: "红色",
value: 12,
},
label: "蓝色",
value: 0,
}, {
label: "黄色",
value: 1,
},
{
label: "黑色",
value: 2,
},
{
label: "白色",
value: 3,
},
{
label: "渐变绿色",
value: 4,
},
{
label: "黄绿双拼色",
value: 5,
},
{
label: "蓝白渐变色",
value: 6,
},
{
label: "未确定",
value: 9,
},
{
label: "绿色",
value: 11,
},
{
label: "红色",
value: 12,
},
],
showCaridCorlor: '',
carIdcorlorCode:'',
carIdcorlorCode: '',
form: {
openId: getItem('openId'), //用户标识.
// man: "", //所有人
@@ -320,17 +334,69 @@ const strReplace = (str : string) => {
orderId: "",
isMyPeopple: true,
});
onLoad((option: any) => {
onLoad((option : any) => {
state.form.orderId = option.orderId;
});
//orc接口调用
const cardImageOcr = (val: any) => {
// const cardImageOcr = (val : any) => {
// var imageType = val;
// uni.chooseImage({
// count: 1, //只能选取一张照片
// sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
// sourceType: ["camera", "album"], //从相册选择
// success: function (res) {
// pathToBase64(res.tempFilePaths[0])
// .then((path) => {
// var data = {
// source: "1",
// agencyId: "52010106004",
// imageType: imageType,
// fileName: res.tempFilePaths[0],
// imageBase64: path,
// };

// const options = {
// type: 2,
// data: data,
// method: "POST",
// showLoading: true,
// };
// request(etcCarOcrCard, options).then((res) => {
// const data = stringToJson(res.bizContent);
// console.log(data);
// if (val === "1") {
// state.form.vehicleId = data.plate_a;
// state.form.ownerName = data.man;
// state.form.vehicleType = data.vehicle;
// // state.form.useCharacter = data.character;
// state.form.vin = data.vin;
// state.form.engineNum = data.engine;
// state.form.registerDate = data.register;
// state.form.issueDate = data.issue;
// state.form.vehPosImgUrl = data.imageUrl;
// state.form.vehicleModel = data.model;
// } else {
// state.form.approvedCount = parseFloat(data.apc);
// state.form.maintenaceMass = parseFloat(data.unladen);
// state.form.vehicleDimensions = data.overall;
// state.form.totalMass = parseFloat(data.gross);
// state.form.vehNegImgUrl = data.imageUrl;
// }
// });
// })
// .catch((error) => { });
// },
// });
// };
const xiangce = (val) => {
console.log("val", val)
var imageType = val;
uni.chooseImage({
count: 1, //只能选取一张照片
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["camera", "album"], //从相册选择
success: function(res) {
sourceType: ["album"], //从相册选择
success: function (res) {
console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
pathToBase64(res.tempFilePaths[0])
.then((path) => {
var data = {
@@ -349,8 +415,7 @@ const strReplace = (str : string) => {
};
request(etcCarOcrCard, options).then((res) => {
const data = stringToJson(res.bizContent);
console.log(data);
if (val === "1") {
if (state.choiceIndex === "1") {
state.form.vehicleId = data.plate_a;
state.form.ownerName = data.man;
state.form.vehicleType = data.vehicle;
@@ -368,12 +433,74 @@ const strReplace = (str : string) => {
state.form.totalMass = parseFloat(data.gross);
state.form.vehNegImgUrl = data.imageUrl;
}
state.isTakePhotoModeShow = false
});
})
.catch((error) => {});
.catch((error) => { });
},
});
};
})
}
const takePhoto = (val) => {
console.log("拍照", val)
// uni.navigateTo({
// url: `/subpackage/orders/takePhoto?phoneType=${val}`
// })
state.phoneType = val;
}
const confirmReturn = (val) => {
state.phoneType = 0
state.isTakePhotoModeShow = false
var imageType = state.choiceIndex;
console.log("图片地址val", val.tempImagePath)
pathToBase64(val.tempImagePath)
.then((path) => {
var data = {
source: "1",
agencyId: "52010106004",
imageType: imageType,
fileName: val.tempImagePath,
imageBase64: path,
};

const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
request(etcCarOcrCard, options).then((res) => {
const data = stringToJson(res.bizContent);
if (state.choiceIndex === "1") {
state.form.vehicleId = data.plate_a;
state.form.ownerName = data.man;
state.form.vehicleType = data.vehicle;
// state.form.useCharacter = data.character;
state.form.vin = data.vin;
state.form.engineNum = data.engine;
state.form.registerDate = data.register;
state.form.issueDate = data.issue;
state.form.vehPosImgUrl = data.imageUrl;
state.form.vehicleModel = data.model;
} else {
state.form.approvedCount = parseFloat(data.apc);
state.form.maintenaceMass = parseFloat(data.unladen);
state.form.vehicleDimensions = data.overall;
state.form.totalMass = parseFloat(data.gross);
state.form.vehNegImgUrl = data.imageUrl;
}
state.isTakePhotoModeShow = false
});
})
.catch((error) => { });
}
const takePhotoMode = (index) => {
console.log("index", index)
state.isTakePhotoModeShow = true
state.choiceIndex = index
}
const cancle = () => {
state.isTakePhotoModeShow = false
}
</script>

<style lang="scss" scoped>
@@ -529,4 +656,45 @@ const strReplace = (str : string) => {
margin-bottom: 60rpx;
}
}
</style>

.choice-takePhoto {
position: absolute;
bottom: 0;
background-color: white;
width: 100%;
border-radius: 20rpx 20rpx 0 0;
}

.choice-takePhoto>view:first-child {
text-align: center;
height: 80rpx;
line-height: 80rpx;
border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
background-color: white;
}

.choice-takePhoto>view:last-child {
text-align: center;
height: 80rpx;
line-height: 80rpx;
border-top: 6rpx solid rgba(127, 127, 127, 0.1);
background-color: white;
}

.choice-takePhoto>view {
text-align: center;
height: 80rpx;
line-height: 80rpx;
background-color: white;
}

.choice-takePhoto-wrap {
width: 100%;
height: 100vh;
background-color: rgba(127, 127, 127, 0.2);
position: fixed;
left: 0;
top: 0;
z-index: 11111;
}
</style>

+ 199
- 51
subpackage/personal-center/setting/personal-information/user-card.vue Bestand weergeven

@@ -5,7 +5,7 @@
<view class="title"> 上传后请核对识别信息 </view>
<view class="tip"> 如有错误请及时手动修改 </view>
</view>
<view class="picture-wrapper" @click="cardImageOcr('1')">
<view class="picture-wrapper" @click="takePhotoMode('1')">
<view class="bg">
<view class="">
<view class="name"> 人像面 </view>
@@ -19,7 +19,7 @@
<image v-else class="icon" :src="strReplace(state.form.userPosImgUrl)"></image>
</view>
</view>
<view class="picture-wrapper" @click="cardImageOcr('2')">
<view class="picture-wrapper" @click="takePhotoMode('2')">
<view class="bg">
<view class="">
<view class="name"> 国徽面 </view>
@@ -76,6 +76,14 @@
</view>
</view>
</view>
<view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
<view class="choice-takePhoto">
<view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
<view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
<view @click.stop="cancle">取消</view>
</view>
</view>
<viewfinder v-if="state.phoneType" :phoneType="state.phoneType" @confirmReturn="confirmReturn"></viewfinder>
</template>

<script lang="ts" setup>
@@ -91,7 +99,8 @@
} from "vue";
import {
msg,
checkStr
checkStr,
strReplace
} from "@/utils/utils";
import {
onLoad,
@@ -114,6 +123,7 @@
import {
fileURL
} from "@/datas/fileURL.js";
import viewfinder from "../../../../components/viewfinder.vue"
const height = uni.getSystemInfoSync().windowHeight
const defHeadstockImg = `${fileURL}image/applyCard/renxiang.png`;
const defInstallImg = `${fileURL}image/applyCard/guohui.png`;
@@ -123,6 +133,9 @@
// installImg: null,
// });
const state = reactive({
phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
choiceIndex: 1, // 1 身份证正面 2 身份证反面
isTakePhotoModeShow: false, //选择拍照方式是否出来
genderList: [{
value: '男',
label: '男'
@@ -162,11 +175,11 @@
// agentIdVld: '',
}
})
const strReplace = (str : string) => {
let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
return imgUrl;
};
// const strReplace = (str : string) => {
// let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
// imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
// return imgUrl;
// };

const getCode = () => {
console.log(123);
@@ -222,49 +235,49 @@

//选择图片
//orc接口调用
const cardImageOcr = (val : any) => {
console.log("点击了");
var imageType = val;
uni.chooseImage({
count: 1, //只能选取一张照片
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["camera", "album"], //从相册选择
success: function (res) {
pathToBase64(res.tempFilePaths[0])
.then((path) => {
console.log(path);
console.log("哈哈哈");
var data = {
source: "1",
agencyId: "52010106004",
imageType: imageType,
fileName: res.tempFilePaths[0],
imageBase64: path,
};
const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
request(etcOcrCard, options).then((res) => {
// const data = stringToJson(res.bizContent);
const data = JSON.parse(res.bizContent)
if (val === "1") {
state.form.customerName = data.name;
state.form.userPosImgUrl = data.imageUrl;
state.form.address = data.address;
} else {
state.form.customerIdVld = data.enddate;
state.form.userNegImgUrl = data.imageUrl;
}
});
})
.catch((error) => { });
},
});
};
// const cardImageOcr = (val : any) => {
// console.log("点击了");
// var imageType = val;
// uni.chooseImage({
// count: 1, //只能选取一张照片
// sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
// sourceType: ["camera", "album"], //从相册选择
// success: function (res) {
// pathToBase64(res.tempFilePaths[0])
// .then((path) => {
// console.log(path);
// console.log("哈哈哈");
// var data = {
// source: "1",
// agencyId: "52010106004",
// imageType: imageType,
// fileName: res.tempFilePaths[0],
// imageBase64: path,
// };
// const options = {
// type: 2,
// data: data,
// method: "POST",
// showLoading: true,
// };
// request(etcOcrCard, options).then((res) => {
// // const data = stringToJson(res.bizContent);
// const data = JSON.parse(res.bizContent)
// if (val === "1") {
// state.form.customerName = data.name;
// state.form.userPosImgUrl = data.imageUrl;
// state.form.address = data.address;
// } else {
// state.form.customerIdVld = data.enddate;
// state.form.userNegImgUrl = data.imageUrl;
// }
// });
// })
// .catch((error) => { });
// },
// });
// };

//下一步
const savaHandle = () => {
@@ -314,6 +327,100 @@
console.log(options.customerId);
state.form.customerId = options.customerId
})
const takePhotoMode = (index) => {
console.log("index", index)
state.isTakePhotoModeShow = true
state.choiceIndex = index
}
const xiangce = (val) => {
console.log("val", val)
var imageType = val;
uni.chooseImage({
count: 1, //只能选取一张照片
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["album"], //从相册选择
success: function (res) {
console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
pathToBase64(res.tempFilePaths[0])
.then((path) => {
var data = {
source: "1",
agencyId: "52010106004",
imageType: imageType,
fileName: res.tempFilePaths[0],
imageBase64: path,
};

const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
request(etcOcrCard, options).then((res) => {
const data = stringToJson(res.bizContent);
if (state.choiceIndex === "1") {
state.form.customerName = data.name;
state.form.userPosImgUrl = data.imageUrl;
state.form.address = data.address;
} else {
state.form.customerIdVld = data.enddate;
state.form.userNegImgUrl = data.imageUrl;
}
state.isTakePhotoModeShow = false
});
})
.catch((error) => { });
},
})
}
const takePhoto = (val) => {
console.log("拍照", val)
// uni.navigateTo({
// url: `/subpackage/orders/takePhoto?phoneType=${val}`
// })
state.phoneType = val;
}
const confirmReturn = (val) => {
state.phoneType = 0
state.isTakePhotoModeShow = false
var imageType = state.choiceIndex;
console.log("图片地址val", val.tempImagePath)
pathToBase64(val.tempImagePath)
.then((path) => {
var data = {
source: "1",
agencyId: "52010106004",
imageType: imageType,
fileName: val.tempImagePath,
imageBase64: path,
};

const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
request(etcOcrCard, options).then((res) => {
const data = stringToJson(res.bizContent);
if (state.choiceIndex === "1") {
state.form.customerName = data.name;
state.form.userPosImgUrl = data.imageUrl;
state.form.address = data.address;
} else {
state.form.customerIdVld = data.enddate;
state.form.userNegImgUrl = data.imageUrl;
}
state.isTakePhotoModeShow = false

});
})
.catch((error) => { });
}
const cancle = () => {
state.isTakePhotoModeShow = false
}
</script>

<style>
@@ -475,4 +582,45 @@
}
}
}

.choice-takePhoto {
position: absolute;
bottom: 0;
background-color: white;
width: 100%;
border-radius: 20rpx 20rpx 0 0;
}

.choice-takePhoto>view:first-child {
text-align: center;
height: 80rpx;
line-height: 80rpx;
border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
background-color: white;
}

.choice-takePhoto>view:last-child {
text-align: center;
height: 80rpx;
line-height: 80rpx;
border-top: 6rpx solid rgba(127, 127, 127, 0.1);
background-color: white;
}

.choice-takePhoto>view {
text-align: center;
height: 80rpx;
line-height: 80rpx;
background-color: white;
}

.choice-takePhoto-wrap {
width: 100%;
height: 100vh;
background-color: rgba(127, 127, 127, 0.2);
position: fixed;
left: 0;
top: 0;
z-index: 11111;
}
</style>

+ 7
- 1
utils/utils.ts Bestand weergeven

@@ -1,5 +1,6 @@
import { getItem, StorageKeys } from "./storage";
import { OrderStatus, OrderTypes } from "@/datas/enum.ts";
import { envs } from "@/utils/network/api.js";

//toast
export const msg = (title : string = "", param : any = {}) => {
@@ -338,7 +339,12 @@ export const getOrderTime = (time) => {
if (!time) return '';
return getFormatDate(new Date(time));
}

//替换图片路径
export const strReplace = (str : string) => {
let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl);
imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl);
return imgUrl;
}
//查看大图
export const checkBigImg = (current, urls) => {
uni.previewImage({

Laden…
Annuleren
Opslaan