平板端快衣店
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.
 
 
 
 
 

391 lines
9.4 KiB

<template>
<view class="page1">
<view style="width: 100%;background: #fff;position: fixed;top: 0;z-index: 99;height: 70px;display: flex;line-height: 30px;padding-top: 30px;">
<view style="padding:0 20px;">
<uni-icons type="left" size='10' @tap="backPage"></uni-icons>
</view>
</view>
<view class="content" style="margin-top: 80px;">
<view style="height: 40px;line-height: 40px;font-size: 18px;font-weight: bold;padding-left: 20px;position: relative;">
<view style="float: left;width:60%;">入库列表</view>
<view style="font-size: 14px;float: left;width:40%;height: 30px;line-height: 30px;color: #fff;">
<view @tap="goAiPicture('pai')" style="padding:0 10px;float:right;background: #6ad3fe;margin-top: 5px;border-radius: 10px;">
AI图片识别
</view>
</view>
</view>
<view class="content-list" v-for="(item,index) in aiList" :key="index">
<view class="image-box">
<view class="image">AI</view>
</view>
<view class="content-text">
<view class="text" style="font-weight: bold;color: #000">
{{item.createTime}}
</view>
<view class="text">总数:{{item.count}} (成功:{{item.ocrCount}})</view>
</view>
<view class="content-btn">
<text class="blink" v-if="item.inStorageStatus==2">识别中...</text>
<text class="blink" v-if="item.inStorageStatus == 3 || (item.inStorageStatus == 4 && item.ocrCount > 0)">识别完成</text>
<text class="blink" v-if="item.ocrCount == 0 && item.inStorageStatus == 4">识别失败</text>
<view class="btn" v-if="item.inStorageStatus != 2 && item.ocrCount > 0" @tap="montageData(item.id)">去入库</view>
<view @tap="delItem(item.id)" class="btn" style="background:linear-gradient(90deg, #FF9797, #FFC1E0);position: absolute;bottom: 5px;" :style="{right:item.ocrCount == 0 && item.inStorageStatus == 4?'15px':'95px'}">
删除
</view>
</view>
</view>
</view>
<u-loadmore :status="status" />
</view>
</template>
<script>
export default {
components: {},
data() {
return {
aiList:[],
carList1:[],
purchaseDetails:[],
shopName:'',
status: 'loadmore',
pageNum:1,
pages:1,
categoryList:{}
}
},
onPullDownRefresh(){
this.pageNum = 1
this.aiList = []
this.getList()
},
onReachBottom() {
if (this.pageNum >= this.pages) return;
this.status = 'loading';
this.pageNum ++;
this.getList();
},
onShow() {
this.pageNum = 1
this.aiList = []
this.carList1 = []
this.getList()
this.getDefaultCategory()
},
onLoad() {
this.shopName = uni.getStorageSync('shopName')
},
methods: {
getList(){
this.tui.request("/app/purchase/getPurchaseList", "POST", {
pageNum: this.pageNum,
pageSize: 10,
isAiList: 1,
fromWhere:0
}, false, false).then((res) => {
this.status = 'nomore';
if (this.pages == 1) {
this.aiList = res.result.records
} else {
this.aiList = [...this.aiList, ...res.result.records]
}
this.pages = res.result.pages
}).catch((res) => {})
setTimeout(function () {
uni.stopPullDownRefresh();
}, 500);
},
backPage(){
uni.navigateBack({
delta: 1
})
},
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
},
backPage(){
uni.navigateBack()
},
//店铺默认分类
getDefaultCategory(){
this.tui.request("/app/productCategory/getDefaultCategory", "POST", {}, false, true).then((res) => {
if (res.code == 200) {
this.categoryList = res.result
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
async montageData(id){
await this.tui.request("/app/purchase/getPurchaseAllDataOfAi?id=" + id, "POST", {}, false, false)
.then((res) => {
this.purchaseDetails = res.result.purchaseDetails
uni.setStorageSync('AiInventoryId', res.result.purchase.id)
for(let i=0;i<this.purchaseDetails.length;i++){
let data = {
id: this.purchaseDetails[i].id,
price: this.purchaseDetails[i].price,
productCount: 0,
categoryId:this.purchaseDetails[i].categoryId || this.categoryList.categoryId,
categoryName:this.purchaseDetails[i].categoryName || this.categoryList.categoryName,
wholesalePrice: this.purchaseDetails[i].wholesalePrice,
purchasePrice:this.purchaseDetails[i].purchasePrice,
isNew: this.purchaseDetails[i].productId==null?true:false,
productId:this.purchaseDetails[i].productId,
productName: this.purchaseDetails[i].productName,
productSn: this.purchaseDetails[i].productSn,
productPicture: this.purchaseDetails[i].productPicture,
supplierName: this.purchaseDetails[i].supplierName,
saleDetailQueryDTO: []
}
for(let m=0;m<this.purchaseDetails[i].stockLogList1.length;m++){
let list = {
attributeList: this.getAttribute(this.purchaseDetails[i].stockLogList1[m].attributeList),
productCount:this.purchaseDetails[i].stockLogList1[m].productCount || this.purchaseDetails[i].stockLogList1[m].productCounts,
productNum:'',
name: this.sliceMsg(this.getAttribute(this.purchaseDetails[i].stockLogList1[m].attributeList)),
price: this.purchaseDetails[i].stockLogList1[m].purchasePrice
}
data.productCount += this.purchaseDetails[i].stockLogList1[m].productCount
data.saleDetailQueryDTO.push(list)
}
this.carList1.push(data)
}
}).catch((res) => {})
await setTimeout(res => {
this.goInventory()
}, 300)
},
getAttribute(str){
str = str.replace(/"色"(?![^{]*": *"色")/g, '"均色"');
str = str.replace(/"码"(?![^{]*": *"码")/g, '"均码"');
return str
},
goInventory(){
uni.setStorageSync('carList1', JSON.stringify(this.carList1))
uni.navigateTo({
url: '/package1/AI/voiceInventoryHeng'
})
},
goAiPicture(type){
if(type == 'pai'){
uni.navigateTo({
url: '/package1/AI/AIPicture'
})
}else{
uni.removeStorageSync('AiInventoryId')
uni.navigateTo({
url: '/package1/AI/waitStorageHeng?inStorageStatus=1'
})
}
},
//删除单条入库单
delItem(id){
let that = this;
uni.showModal({
title: "提示",
content: "确定要删除此条AI识别记录吗?",
success: function(res2) {
if (res2.confirm) {
that.tui.request("/app/purchase/delById", "POST", {
id:id
}, false, true).then((res) => {
if(res.code == 500 && res.message == '删除成功!'){
that.pageNum = 1
that.aiList = []
that.getList()
setTimeout(res => {
that.tui.toast("删除成功")
}, 500)
}else{
that.tui.toast(res.message)
}
}).catch((res) => {
that.tui.toast(res.message)
})
}
}
})
}
}
}
</script>
<style lang="scss">
page,
.page1 {
background: #FAF7F7;
font-size: 14px;
}
.content-list {
width: 95%;
height: 70px;
background: #fff;
border-radius: 10px;
margin: 0 auto 20px;
display: flex;
}
.image-box {
width: 50px;
height: 50px;
display: block;
overflow: hidden;
float: left;
margin: 10px;
}
.image {
width: 50px;
height: 50px;
font-size: 14px;
background: #8470FF;
border-radius: 50%;
text-align: center;
line-height: 50px;
color: #fff;
}
.content-text {
flex: 1;
height: 70px;
float: left;
line-height: 35px;
padding-left: 20px;
}
.text {
color: #747474;
font-size: 14px;
}
.content-btn {
position: relative;
width: 20%;
height: 70px;
float: left;
}
.btn {
position: absolute;
width: 60px;
height: 30px;
background: linear-gradient(90deg, #6691fb 0%, #6ad3fe 100%);
color: #fff;
border-radius: 6px;
text-align: center;
line-height: 30px;
bottom: 6px;
right: 20px;
}
.btn1 {
position: absolute;
width: 250rpx;
height: 50rpx;
background: linear-gradient(90deg, #6691fb 0%, #6ad3fe 100%);
color: #fff;
border-radius: 6px;
text-align: center;
line-height: 60rpx;
bottom: 20rpx;
right: 20rpx;
}
@keyframes blinking {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.blink {
position: absolute;
top: 7px;
right: 20px;
animation: blinking 1s infinite;
}
.bottom {
position: fixed;
bottom: 100rpx;
right: 50rpx;
background: linear-gradient(90deg, #6691fb 0%, #6ad3fe 100%);
width: 120rpx;
height: 120rpx;
border-radius: 50%;
}
.btn-x {
width: 2px;
height: 40rpx;
background: #fff;
border-radius: 2rpx;
position: absolute;
top: 40rpx;
left: 59rpx;
}
.btn-y {
width: 40rpx;
height: 2px;
background: #fff;
border-radius: 2rpx;
position: absolute;
top: 59rpx;
left: 40rpx;
}
.bottom-box {
width: 40px;
height: 40px;
border-radius: 10px;
margin: 10px;
position: relative;
color: #fff;
font-weight: 800;
text-align: center;
line-height: 40px;
background: #fff;
overflow: hidden;
float: left;
img {
width: 100%;
height: 100%;
border-radius: 10px;
animation: jump 1.5s infinite;
}
@keyframes jump {
0% {
margin-top: 0;
}
50% {
margin-top: -15px;
}
100% {
margin-top: 0;
}
}
}
</style>