|
|
|
@ -37,21 +37,32 @@ |
|
|
|
<uni-icons type="cloud-upload" color="#00BFFF" size="30"></uni-icons> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="content-list"> |
|
|
|
<view class="content-list-img" v-for="(item,index) in purchaseOcrPictureList" :key="index"> |
|
|
|
<view v-for="(item,index) in purchaseOcrPictureList" :key="index" style="display: flex;width: 100%;overflow: scroll;"> |
|
|
|
<view class="content-list-img"> |
|
|
|
<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> |
|
|
|
<uni-easyinput type='number' prefixIcon="compose" v-model='item.count' |
|
|
|
placeholder="请输入规格数量"></uni-easyinput> |
|
|
|
</view> |
|
|
|
<view v-for="(items,indexs) in item.children" :key="indexs" style="width: 200rpx;height: 280rpx;position: relative;background: #fff;margin-left: 20rpx;border-radius: 10px;"> |
|
|
|
<view class="del-icon" @tap="delImage(index)"> |
|
|
|
<uni-icons type="trash" color="#00BFFF" size="20"></uni-icons> |
|
|
|
</view> |
|
|
|
<image show-menu-by-longpress :src="items.ocrPicture" @tap="showImage(items.ocrPicture)" style="width: 200rpx;height: 200rpx;padding: 5px;"></image> |
|
|
|
<uni-easyinput type='number' v-model='items.count' placeholder="子图规格数量"></uni-easyinput> |
|
|
|
</view> |
|
|
|
<view @tap="addSonImg(item.id)" style="width: 200rpx;height: 219rpx;background: rgba(255,255,255,0.4);margin: 0 20rpx;border-radius: 10px;font-size: 24rpx;color: #777;text-align: center;"> |
|
|
|
<uni-icons type="plusempty" color="#777" size="80"></uni-icons> |
|
|
|
<view style="height: 30rpx;line-height: 30rpx;">点击添加子图</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="bottom" @tap="identify"> |
|
|
|
<view class="run-line"></view> |
|
|
|
<img class="bottom-img" |
|
|
|
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/0db7dd480e4644af871ce7bf97f4f775.jpg" alt="" /> |
|
|
|
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/27e2655fe19f454d93970f968d91fbef.png" alt="" /> |
|
|
|
<view class="bottom-btn">Ai识别</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -68,25 +79,54 @@ |
|
|
|
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/44e7ccc2fae74db593bd1a10f538e2de.jpg', |
|
|
|
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/2a55142e562b4ea480ce553c8b84d092.jpg' |
|
|
|
], |
|
|
|
purchaseOcrPictureList: [] |
|
|
|
purchaseOcrPictureList: [], |
|
|
|
parentPicturePath:'', |
|
|
|
parentId:'', |
|
|
|
newSubmit:[] |
|
|
|
} |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
if (this.uploadUrl && this.uploadNum == 1) { |
|
|
|
let data = { |
|
|
|
ocrPicture: this.uploadUrl, |
|
|
|
count: '' |
|
|
|
if (this.uploadUrl && this.uploadNum == 1) { |
|
|
|
if(this.parentId !=''){ |
|
|
|
for(let i=0;i<this.purchaseOcrPictureList.length;i++){ |
|
|
|
if(this.purchaseOcrPictureList[i].id == this.parentId){ |
|
|
|
let data = { |
|
|
|
ocrPicture: this.uploadUrl, |
|
|
|
count: '', |
|
|
|
} |
|
|
|
this.purchaseOcrPictureList[i].children.push(data) |
|
|
|
} |
|
|
|
} |
|
|
|
this.parentId = '' |
|
|
|
}else{ |
|
|
|
let data = { |
|
|
|
ocrPicture: this.uploadUrl, |
|
|
|
count: '', |
|
|
|
id:this.splitData(this.uploadUrl), |
|
|
|
children:[] |
|
|
|
} |
|
|
|
this.purchaseOcrPictureList.push(data) |
|
|
|
} |
|
|
|
this.purchaseOcrPictureList.push(data) |
|
|
|
|
|
|
|
console.log('查看图片',this.purchaseOcrPictureList) |
|
|
|
this.uploadUrl = '' |
|
|
|
this.uploadNum = '' |
|
|
|
this.uploadNum = '' |
|
|
|
this.parentPicturePath = '' |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
addSonImg(id){ |
|
|
|
this.parentId = id |
|
|
|
this.upLoadImg() |
|
|
|
}, |
|
|
|
splitData(str){ |
|
|
|
return str.split('/')[3].split('.')[0] |
|
|
|
}, |
|
|
|
identify() { |
|
|
|
this.newSubmit = [] |
|
|
|
if(this.purchaseOcrPictureList.length == 0){ |
|
|
|
this.tui.toast("请选择要上传的图片") |
|
|
|
return |
|
|
|
@ -96,29 +136,47 @@ |
|
|
|
this.tui.toast("请输入数量") |
|
|
|
return |
|
|
|
}else{ |
|
|
|
if(i+1 == this.purchaseOcrPictureList.length){ |
|
|
|
this.tui.request("/purchaseOcrPicture/batchSave", "POST", { |
|
|
|
orderId: "", |
|
|
|
purchaseOcrPictureList: this.purchaseOcrPictureList |
|
|
|
|
|
|
|
}, false, false).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.tui.toast("识别中,请等待...") |
|
|
|
setTimeout(res => { |
|
|
|
uni.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
}, 2000) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.tui.toast(res.message) |
|
|
|
let data = { |
|
|
|
ocrPicture: this.purchaseOcrPictureList[i].ocrPicture, |
|
|
|
count: this.purchaseOcrPictureList[i].count, |
|
|
|
parentPicturePath:'' |
|
|
|
} |
|
|
|
this.newSubmit.push(data) |
|
|
|
if(this.purchaseOcrPictureList[i].children.length > 0){ |
|
|
|
for(let m=0;m<this.purchaseOcrPictureList[i].children.length;m++){ |
|
|
|
if(this.purchaseOcrPictureList[i].children[m].count == 0 || this.purchaseOcrPictureList[i].children[m].count == ''){ |
|
|
|
this.tui.toast("请输入子图片的规格数量") |
|
|
|
return |
|
|
|
}else{ |
|
|
|
let data = { |
|
|
|
ocrPicture: this.purchaseOcrPictureList[i].children[m].ocrPicture, |
|
|
|
count: this.purchaseOcrPictureList[i].children[m].count, |
|
|
|
parentPicturePath:this.purchaseOcrPictureList[i].ocrPicture |
|
|
|
} |
|
|
|
this.newSubmit.push(data) |
|
|
|
} |
|
|
|
}).catch((res) => {}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
console.log(this.newSubmit) |
|
|
|
this.tui.request("/purchaseOcrPicture/batchSave", "POST", { |
|
|
|
orderId: "", |
|
|
|
purchaseOcrPictureList: this.newSubmit |
|
|
|
|
|
|
|
}, false, false).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.tui.toast("识别中,请等待...") |
|
|
|
setTimeout(res => { |
|
|
|
uni.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
}, 2000) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.tui.toast(res.message) |
|
|
|
} |
|
|
|
}).catch((res) => {}) |
|
|
|
}, |
|
|
|
backPage() { |
|
|
|
uni.navigateBack({ |
|
|
|
@ -221,15 +279,6 @@ |
|
|
|
background: linear-gradient(180deg, #6585fa 0%, #6ad5fe 100%); |
|
|
|
} |
|
|
|
|
|
|
|
.content-list { |
|
|
|
width: 95%; |
|
|
|
height: auto; |
|
|
|
border-radius: 10px; |
|
|
|
margin: 0 auto 20rpx; |
|
|
|
overflow: hidden; |
|
|
|
display: block; |
|
|
|
} |
|
|
|
|
|
|
|
.image-box { |
|
|
|
width: 120rpx; |
|
|
|
height: 170rpx; |
|
|
|
@ -400,48 +449,40 @@ |
|
|
|
|
|
|
|
.content-list-img { |
|
|
|
position: relative; |
|
|
|
width: 48%; |
|
|
|
width: 360rpx; |
|
|
|
margin-left: 1.5%; |
|
|
|
height: 400rpx; |
|
|
|
border: 1px solid #eee; |
|
|
|
float: left; |
|
|
|
background: #fff; |
|
|
|
border-top-left-radius: 10px; |
|
|
|
border-top-right-radius: 10px; |
|
|
|
margin-bottom: 40rpx; |
|
|
|
|
|
|
|
image { |
|
|
|
width: 100%; |
|
|
|
width: 360rpx; |
|
|
|
height: 80%; |
|
|
|
padding: 10px; |
|
|
|
} |
|
|
|
|
|
|
|
.uni-easyinput { |
|
|
|
width: 100%; |
|
|
|
height: 20%; |
|
|
|
font-size: 36rpx; |
|
|
|
line-height: 40rpx; |
|
|
|
background: #F8FAFF; |
|
|
|
text-align: center; |
|
|
|
display: block; |
|
|
|
border-bottom-left-radius: 10px; |
|
|
|
border-bottom-right-radius: 10px; |
|
|
|
} |
|
|
|
|
|
|
|
.is-input-border { |
|
|
|
border: none; |
|
|
|
background: #F8FAFF !important; |
|
|
|
} |
|
|
|
|
|
|
|
.del-icon { |
|
|
|
width: 50rpx; |
|
|
|
height: 50rpx; |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
right: 0; |
|
|
|
} |
|
|
|
} |
|
|
|
.uni-easyinput { |
|
|
|
width: 100%; |
|
|
|
height: 20%; |
|
|
|
font-size: 36rpx; |
|
|
|
line-height: 40rpx; |
|
|
|
background: #F8FAFF; |
|
|
|
text-align: center; |
|
|
|
display: block; |
|
|
|
border:none; |
|
|
|
border-bottom-left-radius: 10px; |
|
|
|
border-bottom-right-radius: 10px; |
|
|
|
} |
|
|
|
.del-icon { |
|
|
|
width: 50rpx; |
|
|
|
height: 50rpx; |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
right: 0; |
|
|
|
} |
|
|
|
|
|
|
|
.icon-upload { |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
|