From 9d7c8e379640775e4e1a65eda9a05bc72771b515 Mon Sep 17 00:00:00 2001 From: "DESKTOP-8FGKA8Q\\chunfen" Date: Wed, 31 Dec 2025 18:30:41 +0800 Subject: [PATCH] =?UTF-8?q?yyw=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/commodity/combination.vue | 45 ++++++++++++++++++++++++-- src/views/commodity/list.vue | 49 +++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 6 deletions(-) diff --git a/src/views/commodity/combination.vue b/src/views/commodity/combination.vue index 92ed870..cc60c6c 100644 --- a/src/views/commodity/combination.vue +++ b/src/views/commodity/combination.vue @@ -72,7 +72,8 @@ - +    + 修改编码 @@ -141,6 +142,20 @@ + + + + + + + + + @@ -168,7 +183,9 @@ export default { opa_loading: false, itemInfo: {}, goodsSkus: [], - skusList: [] + skusList: [], + showCode: false, + new_code: '' }) function handleSearch() { @@ -315,6 +332,26 @@ export default { return result.toFixed(2) } + function openCode() { + data.new_code = '' + data.showCode = true + } + + function commitCode() { + if(!data.new_code) { + return ElMessage.info('请输入编码') + } + let params = { + id: data.itemInfo.id, + code: data.new_code + } + post(`/api/combinationGoods/changeCode`, params).then((res) => { + data.itemInfo.combination_goods_code = data.new_code + data.showCode = false + ElMessage.success('修改成功') + }) + } + onMounted(() => { fetchData() getSkusList() @@ -333,7 +370,9 @@ export default { toAddSku, getSkusList, handleUpload, - computeCost + computeCost, + openCode, + commitCode } } } diff --git a/src/views/commodity/list.vue b/src/views/commodity/list.vue index a91f524..2dbd884 100644 --- a/src/views/commodity/list.vue +++ b/src/views/commodity/list.vue @@ -145,7 +145,8 @@ - +    + 修改编码 @@ -217,6 +218,20 @@ + + + + + + + + + @@ -252,7 +267,11 @@ export default { brandList: [], warehouseList: [], itemInfo: {}, - skusList: [] + skusList: [], + tempIndex: 0, + tempId: 0, + showCode: false, + new_code: '' }) function handleSearch() { @@ -446,6 +465,28 @@ export default { }) } + function openCode(row, i) { + data.tempIndex = i + data.tempId = row.id + data.new_code = '' + data.showCode = true + } + + function commitCode() { + if(!data.new_code) { + return ElMessage.info('请输入编码') + } + let params = { + skuId: data.tempId, + skuCode: data.new_code + } + post(`/api/goods/sku/changeCode`, params).then((res) => { + data.skusList[data.tempIndex].sku_code = data.new_code + data.showCode = false + ElMessage.success('修改成功') + }) + } + onMounted(() => { fetchData() getBrandList() @@ -472,7 +513,9 @@ export default { toAddSku, handleRemoveImg, getBrandList, - getWarehouseList + getWarehouseList, + openCode, + commitCode } } }