Commit 2a0a5ae1 authored by v-yuchenglong's avatar v-yuchenglong

update:商品添加图片bug

parent 5ab3a7a3
...@@ -367,14 +367,11 @@ export default { ...@@ -367,14 +367,11 @@ export default {
}, },
// 图片删除后 // 图片删除后
removeDetailFiles(file, fileList) { removeDetailFiles() {
for (let i = 0; i < fileList.length; i++) {
if (fileList[i].uid == file.uid) {
this.picUploadList.splice(i, 1);
}
}
this.picStr = ""; this.picStr = "";
this.hideUpload = this.picUploadList.length >= this.limitCount; this.picUrlList = [];
this.picUploadList = [];
// this.hideUpload = this.picUploadList.length >= this.limitCount;
}, },
// 获取商家 // 获取商家
...@@ -394,13 +391,13 @@ export default { ...@@ -394,13 +391,13 @@ export default {
// 查看商品详情 // 查看商品详情
async markGoodsInfoMet(goodSkuID) { async markGoodsInfoMet(goodSkuID) {
this.picUrlList = [];
let params = { goods_sku_id: goodSkuID, marketing_type: "4" }; let params = { goods_sku_id: goodSkuID, marketing_type: "4" };
const res = await markGoodsInfo(params); const res = await markGoodsInfo(params);
this.inventoryRest = res.result.goods_info.inventory_rest; this.inventoryRest = res.result.goods_info.inventory_rest;
this.inventoryTotal = res.result.goods_info.inventory_total; this.inventoryTotal = res.result.goods_info.inventory_total;
this.commodityForm = res.result.goods_info; this.commodityForm = res.result.goods_info;
this.commodityForm.business1 = res.result.goods_info.ota_id; this.commodityForm.business1 = res.result.goods_info.ota_id;
this.picUrlList = [];
for (var i in res.result.goods_info.desc_pic_url_list) { for (var i in res.result.goods_info.desc_pic_url_list) {
this.picUrlList.push({ this.picUrlList.push({
url: res.result.goods_info.desc_pic_url_list[i], url: res.result.goods_info.desc_pic_url_list[i],
...@@ -466,11 +463,13 @@ export default { ...@@ -466,11 +463,13 @@ export default {
// 添加修改商品 // 添加修改商品
async commodity(type, val) { async commodity(type, val) {
this.$refs.picUpload && this.$refs.picUpload.clearFiles && this.$refs.picUpload.clearFiles();
this.picUrlList = [];
this.addCommodityPopup = true; this.addCommodityPopup = true;
this.commodityForm = {}; this.commodityForm = {};
if (type == "add") { if (type == "add") {
this.hideUpload = false; this.hideUpload = false;
// this.picUrlList = [];
this.inventoryRest = 0; this.inventoryRest = 0;
this.commodityForm.total_amount_order = 0; this.commodityForm.total_amount_order = 0;
this.addCommodityTitle = "商品添加"; this.addCommodityTitle = "商品添加";
...@@ -487,7 +486,7 @@ export default { ...@@ -487,7 +486,7 @@ export default {
const res = await addGoods({ const res = await addGoods({
marketing_name: this.stepTwoTitle, marketing_name: this.stepTwoTitle,
goods_name: this.commodityForm.goods_name, goods_name: this.commodityForm.goods_name,
desc_pic_url: this.picUploadList.join(","), desc_pic_url: this.picStr,
desc: "", desc: "",
inventory: this.commodityForm.inventory_total, inventory: this.commodityForm.inventory_total,
original_price: this.commodityForm.original_price, original_price: this.commodityForm.original_price,
...@@ -502,7 +501,7 @@ export default { ...@@ -502,7 +501,7 @@ export default {
type: "success", type: "success",
}); });
this.comTableData.push(res.result.goods_info); this.comTableData.push(res.result.goods_info);
this.$refs.picUpload.clearFiles(); // this.$refs.picUpload.clearFiles();
this.addCommodityPopup = false; this.addCommodityPopup = false;
} else { } else {
ElMessage.error(res.reason); ElMessage.error(res.reason);
...@@ -592,6 +591,13 @@ export default { ...@@ -592,6 +591,13 @@ export default {
} }
this.comTableData = newVal; this.comTableData = newVal;
}, },
picUrlList: function () {
if(this.picUrlList.length >= this.limitCount) {
this.hideUpload = true
}else {
this.hideUpload = false
}
}
}, },
created() { created() {
this.getBusinessListMet(); this.getBusinessListMet();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment