导入优化

This commit is contained in:
THK3121 2023-06-10 18:04:28 +08:00
parent 4bd50eb5c9
commit 02ab3cdea7

View File

@ -122,19 +122,22 @@
addGoodsopen() { addGoodsopen() {
if (this.item) { if (this.item) {
post_product_import(this.item.product_id).then(e => { post_product_import(this.item.product_id).then(e => {
console.log(res);
if (e.status == 200) { if (e.status == 200) {
Toast(e.data.msg) Toast(e.data.msg)
this.addGoodsShow = false this.addGoodsShow = false
if (e.status == 400) { } else {
console.log(e);
Toast(e.message) Toast(e.message)
this.addGoodsShow = false this.addGoodsShow = false
} }
}
}).catch(err => { }).catch(err => {
console.log(err);
if (err == "已经导入过该商品了") { if (err == "已经导入过该商品了") {
Toast('已经导入过该商品了') Toast('已经导入过该商品了')
this.addGoodsShow = false this.addGoodsShow = false
}else{
Toast('导入出错')
this.addGoodsShow = false
} }
}) })
} }
@ -218,14 +221,13 @@
mer_id: this.mer_id mer_id: this.mer_id
}).then(res=>{ }).then(res=>{
if(!res.data){ if(!res.data){
// Toast(res.message)
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
duration: 3000, duration: 3000,
icon:'none', icon:'none',
}); });
}else{ }else{
if (data.list.length < 1) { if (res.data.list.length < 1) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/addGoods/index?mer_id=${this.mer_id}&code=${code}` url: `/pages/product/addGoods/index?mer_id=${this.mer_id}&code=${code}`
}) })
@ -234,7 +236,6 @@
this.goods = data.list this.goods = data.list
} }
}) })
console.log(data);
}, },