|
|
|
@ -72,11 +72,13 @@ |
|
|
|
</view> |
|
|
|
<view class="content" style="height:150rpx;"> |
|
|
|
<view class="name-box">图片上传</view> |
|
|
|
<view class="upload-img" @tap="pictureAdd" style="background: #eee;text-align: center;line-height: 160rpx;"> |
|
|
|
<view class="upload-img" @tap="pictureAdd" |
|
|
|
style="background: #eee;text-align: center;line-height: 160rpx;"> |
|
|
|
<uni-icons type="camera" size="28" color="#777"></uni-icons> |
|
|
|
</view> |
|
|
|
<view style="overflow-x: scroll;display: flex;width: 350rpx;"> |
|
|
|
<view v-if="productPicture !=''" v-for="(item,index) in productPicture" :key="index" style="width: 160rpx;height: 160rpx;margin-left: 20rpx;"> |
|
|
|
<view v-if="productPicture !=''" v-for="(item,index) in productPicture" :key="index" |
|
|
|
style="width: 160rpx;height: 160rpx;margin-left: 20rpx;"> |
|
|
|
<img :src="item" alt="" class="upload-img"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -121,10 +123,12 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="bottom-btn"> |
|
|
|
<view @tap="toggle" style="background: linear-gradient(90deg, #FF9797, #FFC1E0);margin: 10rpx auto;height: 80rpx;width: 45%;border-radius: 10px;text-align: center;line-height: 80rpx;"> |
|
|
|
<view @tap="toggle" |
|
|
|
style="background: linear-gradient(90deg, #FF9797, #FFC1E0);margin: 10rpx auto;height: 80rpx;width: 45%;border-radius: 10px;text-align: center;line-height: 80rpx;"> |
|
|
|
语音录入 |
|
|
|
</view> |
|
|
|
<view style="background: linear-gradient(90deg, #60F3FF, #088FEB);margin: 10rpx auto;height: 80rpx;width: 45%;border-radius: 10px;text-align: center;line-height: 80rpx;"> |
|
|
|
<view |
|
|
|
style="background: linear-gradient(90deg, #60F3FF, #088FEB);margin: 10rpx auto;height: 80rpx;width: 45%;border-radius: 10px;text-align: center;line-height: 80rpx;"> |
|
|
|
确定 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -139,21 +143,25 @@ |
|
|
|
<view style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;"> |
|
|
|
示例: |
|
|
|
</view> |
|
|
|
<view style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;display: flex;text-align: center;"> |
|
|
|
<view |
|
|
|
style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;display: flex;text-align: center;"> |
|
|
|
<view style="flex: 1;">发货人:</view> |
|
|
|
<view style="flex: 1;">发货电话:</view> |
|
|
|
</view> |
|
|
|
<view style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;display: flex;text-align: center;"> |
|
|
|
|
|
|
|
<view |
|
|
|
style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;display: flex;text-align: center;"> |
|
|
|
|
|
|
|
<view style="flex: 1;">收货人:</view> |
|
|
|
<view style="flex: 1;">收货电话:</view> |
|
|
|
</view> |
|
|
|
<view style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;display: flex;text-align: center;"> |
|
|
|
<view |
|
|
|
style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;display: flex;text-align: center;"> |
|
|
|
<view style="flex: 1;">重量:</view> |
|
|
|
<view style="flex: 1;">数量:</view> |
|
|
|
</view> |
|
|
|
<view style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;display: flex;text-align: center;"> |
|
|
|
|
|
|
|
<view |
|
|
|
style="width: 100%;line-height: 40rpx;font-size: 11px;color: #777;display: flex;text-align: center;"> |
|
|
|
|
|
|
|
<view style="flex: 1;">小费:</view> |
|
|
|
<view style="flex: 1;">到达站:</view> |
|
|
|
</view> |
|
|
|
@ -187,25 +195,26 @@ |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
voiceText:'', |
|
|
|
voiceText: '', |
|
|
|
isVoice: false, |
|
|
|
voiceData:{}, |
|
|
|
voiceData: {}, |
|
|
|
recordState: false, |
|
|
|
productPicture: [], |
|
|
|
messages:['消息1', '消息2', '消息3'] |
|
|
|
} |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
uni.authorize({ |
|
|
|
scope: 'scope.record', |
|
|
|
success() { |
|
|
|
|
|
|
|
},fail(){ |
|
|
|
scope: 'scope.record', |
|
|
|
success() { |
|
|
|
|
|
|
|
}, |
|
|
|
fail() { |
|
|
|
this.tui.toast("您未授权,语音功能可能会出现错误") |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//按住语音识别,开始 |
|
|
|
@ -225,197 +234,63 @@ |
|
|
|
manager.stop() |
|
|
|
}, |
|
|
|
extractInfo(str) { |
|
|
|
const info = {}; |
|
|
|
const regexes = [ |
|
|
|
{ name: 'senderName', regex: /发货人:(.*?),/ }, |
|
|
|
{ name: 'senderPhone', regex: /发货电话:(.*?),/ }, |
|
|
|
{ name: 'receiverName', regex: /收货人:(.*?),/ }, |
|
|
|
{ name: 'receiverPhone', regex: /收货电话:(.*?),/ }, |
|
|
|
{ name: 'weight', regex: /重量:(.*?),/ }, |
|
|
|
{ name: 'count', regex: /数量:(.*?),/ }, |
|
|
|
{ name: 'methodOfSettlement', regex: /结算方式:(.*?),/ }, |
|
|
|
{ name: 'tips', regex: /小费:(.*?),/ }, |
|
|
|
{ name: 'arrivalStation', regex: /到达站:(.*)/ } |
|
|
|
]; |
|
|
|
|
|
|
|
regexes.forEach(({name, regex}) => { |
|
|
|
const match = str.match(regex); |
|
|
|
if (match && match[1]) { |
|
|
|
// 去除可能的前后空格 |
|
|
|
info[name] = match[1].trim(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return info; |
|
|
|
const info = {}; |
|
|
|
const regexes = [{ |
|
|
|
name: 'senderName', |
|
|
|
regex: /发货人:(.*?),/ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'senderPhone', |
|
|
|
regex: /发货电话:(.*?),/ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'receiverName', |
|
|
|
regex: /收货人:(.*?),/ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'receiverPhone', |
|
|
|
regex: /收货电话:(.*?),/ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'weight', |
|
|
|
regex: /重量:(.*?),/ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'count', |
|
|
|
regex: /数量:(.*?),/ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'methodOfSettlement', |
|
|
|
regex: /结算方式:(.*?),/ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'tips', |
|
|
|
regex: /小费:(.*?),/ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'arrivalStation', |
|
|
|
regex: /到达站:(.*)/ |
|
|
|
} |
|
|
|
]; |
|
|
|
|
|
|
|
regexes.forEach(({ |
|
|
|
name, |
|
|
|
regex |
|
|
|
}) => { |
|
|
|
const match = str.match(regex); |
|
|
|
if (match && match[1]) { |
|
|
|
// 去除可能的前后空格 |
|
|
|
info[name] = match[1].trim(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return info; |
|
|
|
}, |
|
|
|
yuyinChange(){ |
|
|
|
yuyinChange() { |
|
|
|
console.log("yuyin") |
|
|
|
this.isVoice = false |
|
|
|
}, |
|
|
|
getVoiceData(){ |
|
|
|
let that = this; |
|
|
|
if (this.voiceText == '') { |
|
|
|
this.tui.toast('识别内容不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
let convertedStr = this.voiceText; |
|
|
|
if (convertedStr.indexOf(',发货人') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,发货人/g, '发货人') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('发货人,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/发货人,/g, '发货人') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('发货人::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/发货人::/g, '发货人') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('发货人:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/发货人:/g, '发货人') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('发货人') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/发货人/g, '发货人:') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf(',发货电话') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,发货电话/g, '发货电话') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('发货电话,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/发货电话,/g, '发货电话') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('发货电话::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/发货电话::/g, '发货电话') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('发货电话:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/发货电话:/g, '发货电话') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('发货电话') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/发货电话/g, ',发货电话:') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf(',收货人') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,收货人/g, '收货人') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('收货人,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/收货人,/g, '收货人') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('收货人::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/收货人::/g, '收货人') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('收货人:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/收货人:/g, '收货人') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('收货人') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/收货人/g, ',收货人:') |
|
|
|
} |
|
|
|
|
|
|
|
if (convertedStr.indexOf(',收货电话') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,收货电话/g, '收货电话') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('收货电话,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/收货电话,/g, '收货电话') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('收货电话::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/收货电话::/g, '收货电话') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('收货电话:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/收货电话:/g, '收货电话') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('收货电话') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/收货电话/g, ',收货电话:') |
|
|
|
} |
|
|
|
|
|
|
|
if (convertedStr.indexOf(',到达站') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,到达站/g, '到达站') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('到达站,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/到达站,/g, '到达站') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('到达站::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/到达站::/g, '到达站') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('到达站:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/到达站:/g, '到达站') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('到达站') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/到达站/g, ',到达站:') |
|
|
|
} |
|
|
|
|
|
|
|
if (convertedStr.indexOf(',重量') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,重量/g, '重量') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('重量,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/重量,/g, '重量') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('重量::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/重量::/g, '重量') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('重量:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/重量:/g, '重量') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('重量') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/重量/g, ',重量:') |
|
|
|
} |
|
|
|
|
|
|
|
if (convertedStr.indexOf(',数量') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,数量/g, '数量') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('数量,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/数量,/g, '数量') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('数量::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/数量::/g, '数量') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('数量:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/数量:/g, '数量') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('数量') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/数量/g, ',数量:') |
|
|
|
} |
|
|
|
|
|
|
|
if (convertedStr.indexOf(',结算方式') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,结算方式/g, '结算方式') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('结算方式,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/结算方式,/g, '结算方式') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('结算方式::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/结算方式::/g, '结算方式') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('结算方式:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/结算方式:/g, '结算方式') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('结算方式') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/结算方式/g, ',结算方式:') |
|
|
|
} |
|
|
|
|
|
|
|
if (convertedStr.indexOf(',小费') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/,小费/g, '小费') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('小费,') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/小费,/g, '小费') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('小费::') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/小费::/g, '小费') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('小费:') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/小费:/g, '小费') |
|
|
|
} |
|
|
|
if (convertedStr.indexOf('小费') != -1) { |
|
|
|
convertedStr = convertedStr.replace(/小费/g, ',小费:') |
|
|
|
} |
|
|
|
convertedStr = this.spliceMsg(convertedStr) |
|
|
|
this.voiceData = this.extractInfo(convertedStr); |
|
|
|
if(this.voiceData.weight){ |
|
|
|
this.voiceData.weight = this.voiceData.weight.replace(/[^0-9]/g, ""); |
|
|
|
} |
|
|
|
if(this.voiceData.count){ |
|
|
|
this.voiceData.count = this.voiceData.count.replace(/[^0-9]/g, ""); |
|
|
|
} |
|
|
|
|
|
|
|
this.voiceData.freight = this.voiceData.weight * this.voiceData.count |
|
|
|
if(this.voiceData.arrivalStation.indexOf('。') != -1){ |
|
|
|
|
|
|
|
this.voiceData.arrivalStation = this.voiceData.arrivalStation.replace(/\。/g, '') |
|
|
|
|
|
|
|
} |
|
|
|
this.$forceUpdate() |
|
|
|
getVoiceData() { |
|
|
|
this.$refs.popup.close() |
|
|
|
}, |
|
|
|
spliceMsg(res) { |
|
|
|
@ -440,7 +315,7 @@ |
|
|
|
manager.onStop = (res) => { |
|
|
|
that.voiceText = res.result |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 识别错误事件 |
|
|
|
manager.onError = (res) => { |
|
|
|
if (res.retcode == '-30011') { |
|
|
|
@ -472,16 +347,16 @@ |
|
|
|
success(res) { |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中...', |
|
|
|
mask:true |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
for(let i=0;i<res.tempFiles.length;i++){ |
|
|
|
for (let i = 0; i < res.tempFiles.length; i++) { |
|
|
|
that.upLoadFile(res.tempFiles[i].tempFilePath) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
async upLoadFile(path){ |
|
|
|
async upLoadFile(path) { |
|
|
|
let that = this; |
|
|
|
let hiver_token = uni.getStorageSync("hiver_token") |
|
|
|
await uni.uploadFile({ |
|
|
|
@ -506,9 +381,9 @@ |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
await setTimeout(res=>{ |
|
|
|
await setTimeout(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
},1000) |
|
|
|
}, 1000) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
@ -538,9 +413,10 @@ |
|
|
|
font-size: 36rpx; |
|
|
|
color: #fff; |
|
|
|
display: flex; |
|
|
|
z-index:99 |
|
|
|
z-index: 99 |
|
|
|
} |
|
|
|
.circle{ |
|
|
|
|
|
|
|
.circle { |
|
|
|
width: 40rpx; |
|
|
|
height: 40rpx; |
|
|
|
text-align: center; |
|
|
|
@ -551,12 +427,14 @@ |
|
|
|
font-size: 22rpx; |
|
|
|
margin-top: 20rpx; |
|
|
|
} |
|
|
|
.content{ |
|
|
|
|
|
|
|
.content { |
|
|
|
display: flex; |
|
|
|
height: 80rpx; |
|
|
|
line-height: 80rpx; |
|
|
|
} |
|
|
|
.input-box{ |
|
|
|
|
|
|
|
.input-box { |
|
|
|
width: 100%; |
|
|
|
height: 60rpx; |
|
|
|
line-height: 60rpx; |
|
|
|
@ -565,9 +443,11 @@ |
|
|
|
border-bottom: 1px solid #eee; |
|
|
|
padding-left: 10px; |
|
|
|
} |
|
|
|
.name-box{ |
|
|
|
|
|
|
|
.name-box { |
|
|
|
width: 20%; |
|
|
|
} |
|
|
|
|
|
|
|
.voice-popup-content { |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
@ -577,18 +457,18 @@ |
|
|
|
height: 720rpx; |
|
|
|
background-color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.voice-popup-title { |
|
|
|
font-size: 36rpx; |
|
|
|
font-weight: bold; |
|
|
|
text-align: center; |
|
|
|
position: relative; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.voice-popup-container { |
|
|
|
margin-top: 20rpx; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.voice-popup-bottom { |
|
|
|
display: flex; |
|
|
|
height: 80rpx; |
|
|
|
@ -596,17 +476,17 @@ |
|
|
|
line-height: 80rpx; |
|
|
|
margin-top: 30rpx; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.voice-popup-btn { |
|
|
|
flex: 1; |
|
|
|
text-align: center; |
|
|
|
background: linear-gradient(90deg, #FF9797, #FFC1E0); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.voice-popup-btn:last-child { |
|
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.voice-model { |
|
|
|
width: 300rpx; |
|
|
|
height: 300rpx; |
|
|
|
@ -623,13 +503,13 @@ |
|
|
|
margin-left: -150rpx; |
|
|
|
z-index: 999; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.voice-model img { |
|
|
|
width: 200rpx; |
|
|
|
height: 200rpx; |
|
|
|
margin: 0 auto; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.voice-btn { |
|
|
|
position: absolute; |
|
|
|
bottom: -250rpx; |
|
|
|
@ -639,6 +519,7 @@ |
|
|
|
background: #eee; |
|
|
|
border-radius: 50%; |
|
|
|
} |
|
|
|
|
|
|
|
.mask-model { |
|
|
|
width: 60%; |
|
|
|
height: 100rpx; |
|
|
|
@ -655,7 +536,8 @@ |
|
|
|
border-radius: 5px; |
|
|
|
z-index: 99; |
|
|
|
} |
|
|
|
.upload-img{ |
|
|
|
|
|
|
|
.upload-img { |
|
|
|
width: 160rpx; |
|
|
|
height: 160rpx; |
|
|
|
} |
|
|
|
|