wangfukang 3 years ago
parent
commit
db0ee4c8d5
  1. 78
      package1/AI/AIPicture.vue
  2. 6
      package1/AI/AiChat.vue

78
package1/AI/AIPicture.vue

@ -22,8 +22,9 @@
<text>1.每张图片建议您裁剪到20个规格或以下</text>
<text>2.确保最后一款商品规格截取完整</text>
<text>3.每张图片输入对应的规格数量</text>
<text>4.如果拍照后找不到所拍照片,打开微信的设置-通用-照片、视频里面的照片,点击开启后重启微信即可</text>
<text>5.点击可查看<text @tap="goTutorial" style="color: blue;">使用教程</text></text>
<text>4.图片越清晰角度越正识别准确率越高,建议使用原相机拍照并在相册内截图后上传</text>
<text>5.如果拍照后找不到所拍照片,打开微信的设置-通用-照片、视频里面的照片,点击开启后重启微信即可</text>
<text>6.点击可查看<text @tap="goTutorial" style="color: blue;">使用教程</text></text>
</view>
<view class="prompt-title-img">
<view class="img" v-for="(item,index) in imgList" :key="index">
@ -46,7 +47,7 @@
<view class="del-icon" @tap="delImage(index)">
<uni-icons type="trash" color="#00BFFF" size="20"></uni-icons>
</view>
<image show-menu-by-longpress :src="item.ocrPicture" @tap="showImage(item.ocrPicture)"></image>
<image show-menu-by-longpress :src="item.ocrPicture" @load='loadImg' @tap="showImage(item.ocrPicture)"></image>
<uni-easyinput type='number' prefixIcon="compose" v-model='item.count'
placeholder="请输入规格数量"></uni-easyinput>
</view>
@ -55,7 +56,7 @@
<view class="del-icon" @tap="delSonImage(index,indexs)">
<uni-icons type="trash" color="#00BFFF" size="20"></uni-icons>
</view>
<image show-menu-by-longpress :src="items.ocrPicture" @tap="showImage(items.ocrPicture)"
<image show-menu-by-longpress :src="items.ocrPicture" @load='loadImg' @tap="showImage(items.ocrPicture)"
style="width: 200rpx;height: 200rpx;padding: 5px;"></image>
<uni-easyinput type='number' v-model='items.count' placeholder="子图规格数量"></uni-easyinput>
</view>
@ -75,7 +76,8 @@
</view>
<!-- 弹出层 -->
<uni-popup ref="popup" background-color="#fff">
<view style="height:340rpx;">
<view style="height:430rpx;">
<view class="popup-photo" style="font-size: 28rpx;font-weight: 400;">提示:建议使用原相机拍照并在相册内截图后上传</view>
<view @tap="upLoadImg('pai')" class="popup-photo">拍照</view>
<view @tap="upLoadImg('xuan')" class="popup-photo">从相册选择</view>
<view @tap="$refs.popup.close()" class="popup-photo" style="border-bottom:0;border-top:10px solid #eee;">取消</view>
@ -142,24 +144,18 @@
</uni-popup>
<!-- -->
<uni-popup ref="tanDialog" background-color="#fff">
<view class="popup-pay-content" style="width: 500rpx;height: 850rpx;">
<view class="popup-pay-content" style="width: 100%;height: 400rpx;">
<view style="z-index: 99;background: #fff;border-top: 1px solid #eee;">
<view class="popup-pay-title" style="margin-top: 50rpx;">
<text>请输入{{name=='productSn'?'货号':name=='productName'?'商品名称':name=='price'?'价格':name=='productCount'?'数量':name=='color'?'颜色':name=='size'?'尺码':''}}</text>
</view>
<view style="width: 90%;margin: 40rpx auto 40rpx;line-height: 50rpx;color: #777;">
温馨提示:
</view>
<view style="width: 90%;margin: 40rpx auto 40rpx;line-height: 50rpx;color: #777;">
需要您在上方图片中选择一款商品,拿出其中一种规格的的货号、名称、价格、数量、颜色、尺码输入到下方的输入框中,要保证规格值属于同一种商品,这样就能准确的识别市面上大部分的小票(包括手写单)
</view>
<view style="height: 100rpx;">
<view style="padding-left: 40rpx;display: flex;height: 80rpx;width: 90%;line-height: 80rpx;margin-top: 20rpx;float: left;">
<view style="padding-left: 40rpx;display: flex;height: 80rpx;width: 90%;line-height: 80rpx;margin: 20rpx auto;">
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
{{name=='productSn'?'货号':name=='productName'?'商品名称':name=='price'?'价格':name=='productCount'?'数量':name=='color'?'颜色':name=='size'?'尺码':''}}
</text>
<input v-model="nameText" ref="inputText" :focus="focus" type="text" placeholder="请输入" style="display: flex;height: 80rpx;width: 70%;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
<input v-model="nameText" ref="inputText" :focus="focus" type="text" placeholder="请输入" style="display: flex;height: 80rpx;width: 75%;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
</view>
</view>
@ -184,7 +180,7 @@
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/44e7ccc2fae74db593bd1a10f538e2de.jpg',
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/2a55142e562b4ea480ce553c8b84d092.jpg'
],
focus:true,
focus:false,
purchaseOcrPictureList: [],
parentPicturePath: '',
parentId: '',
@ -222,7 +218,7 @@
return str.split('/')[3].split('.')[0]
},
clickAiBtn(){
console.log()
console.log(this.purchaseOcrPictureList)
this.newSubmit = []
if (this.purchaseOcrPictureList.length == 0) {
this.tui.toast("请选择要上传的图片")
@ -236,7 +232,8 @@
let data = {
ocrPicture: this.purchaseOcrPictureList[i].ocrPicture,
count: this.purchaseOcrPictureList[i].count,
parentPicturePath: ''
parentPicturePath: '',
ocrPictureOrder:i == 0 ? "" : i + 1
}
this.newSubmit.push(data)
if (this.purchaseOcrPictureList[i].children.length > 0) {
@ -249,7 +246,8 @@
let data = {
ocrPicture: this.purchaseOcrPictureList[i].children[m].ocrPicture,
count: this.purchaseOcrPictureList[i].children[m].count,
parentPicturePath: this.purchaseOcrPictureList[i].ocrPicture
parentPicturePath: this.purchaseOcrPictureList[i].ocrPicture,
ocrPictureOrder:i == 0 ? "" : (i + 1) + '-' + (m+1)
}
this.newSubmit.push(data)
}
@ -262,9 +260,27 @@
},
clickInput(name){
this.name = name
this.$refs.tanDialog.open();
if(this.name == 'productSn'){
this.nameText = this.productSn
}else if(this.name == 'productName'){
this.nameText = this.productName
}else if(this.name == 'price'){
this.nameText = this.price
}else if(this.name == 'productCount'){
this.nameText = this.productCount
}else if(this.name == 'color'){
this.nameText = this.color
}else if(this.name == 'size'){
this.nameText = this.size
}
this.$refs.tanDialog.open('bottom');
this.$refs.inputText.focus();
this.focus = false
this.$nextTick(() => {
this.focus = true
})
// this.focus = true
// this.$refs.inputText.focus();
},
shurukuang(){
if(this.name == 'productSn'){
@ -283,6 +299,9 @@
this.name = ""
this.nameText = ""
this.$refs.tanDialog.close()
},
loadImg(){
uni.hideLoading();
},
identify() {
let num = 0
@ -360,7 +379,8 @@
},
upLoadImg(type) {
uni.showLoading({
title: '加载中...'
title: '加载中...',
mask:true
})
let that = this;
if(type == 'ios'){
@ -371,6 +391,8 @@
camera: 'back',
success(res) {
that.upLoadFile(res.tempFiles[0].tempFilePath)
},fail(){
uni.hideLoading();
}
})
}else if(type == 'pai'){
@ -392,6 +414,8 @@
}
})
},1000)
},fail(){
uni.hideLoading();
}
})
}else if(type == 'xuan'){
@ -401,16 +425,19 @@
sourceType: ['album'],
success(res1) {
that.upLoadFile(res1.tempFiles[0].tempFilePath)
},fail(){
uni.hideLoading();
}
})
}
this.$refs.popup.close()
uni.hideLoading();
// uni.hideLoading();
},
async upLoadFile(path){
let that = this;
uni.showLoading({
title: '加载中...'
title: '加载中...',
mask:true
})
let hiver_token = uni.getStorageSync("hiver_token")
await uni.uploadFile({
@ -452,6 +479,7 @@
},
fail: (err) => {
uni.hideLoading();
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
@ -460,8 +488,8 @@
});
await setTimeout(res=>{
that.parentId = ''
uni.hideLoading();
},500)
// uni.hideLoading();
},1000)
},
delImage(index) {
let that = this;

6
package1/AI/AiChat.vue

@ -141,9 +141,11 @@
const chineseNumToArabic = {
'零': 0, '一': 1, '二': 2, '两': 2, '三': 3,
'四': 4, '五': 5, '六': 6, '七': 7, '八': 8,
'九': 9,'杠':'-','刚':'-','军色':'均色','叉':'X','金色':'均色','井':'#'
'九': 9,'杠':'-','刚':'-','军色':'均色','叉':'X','金色':'均色','井':'#',
'时间':'10件','事件':'10件','世间':'10件','实践':'10件','实件':'10件',
'景':'#','警':'#','颈':'#',
};
const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|金色|井)/g;
const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|金色|井|时间|事件|世间|实践|实件|景|警|颈)/g;
return str.replace(regex, match => chineseNumToArabic[match]);
},
inputSaveText(){

Loading…
Cancel
Save