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
}
}
}