fix(owner-vue): owner vue item 등록 수정 픽스

- owner vue item 등록 수정 픽스
This commit is contained in:
hoon7566
2022-03-22 17:41:12 +09:00
parent 5d3a77e794
commit 9ea7e82842
5 changed files with 61 additions and 12 deletions

View File

@@ -64,7 +64,7 @@ export default {
addItemOption : function () {
if(!this.data) return;
this.dialog = false
this.dialog = !this.dialog
this.$emit('addItemOption',this.data,this.optionType)
}
}

View File

@@ -38,6 +38,7 @@
md="12"
>
<v-text-field
type="number"
v-model="modalData.itemPrice"
:rules="[() => !!modalData.itemPrice || 'This field is required']"
label="가격*"
@@ -65,7 +66,7 @@
>
<v-select
v-model="modalData.requiredOption"
:items="modalData.requiredOption"
:items="modalData.requiredOptionItems"
item-text="name"
item-value="id"
label="필수 옵션*"
@@ -87,7 +88,7 @@
>
<v-select
v-model="modalData.otherOption"
:items="modalData.otherOption"
:items="modalData.otherOptionItems"
item-text="name"
item-value="id"
label="기타 옵션"

View File

@@ -162,7 +162,9 @@ export default {
categoryId: 0,
categoryList : [],
requiredOption : [],
otherOption : []
requiredOptionItems : [],
otherOption : [],
otherOptionItems : []
}
store.getCategoryList()
@@ -184,10 +186,14 @@ export default {
vm.modalData.itemPrice = item.price;
vm.modalData.categoryId = item.categoryId;
item.itemOptions.forEach(function(ele){
if(ele.optionType === "REQUIRED")
if(ele.optionType === "REQUIRED"){
vm.modalData.requiredOption.push(ele)
else
vm.modalData.requiredOptionItems.push(ele)
}
else{
vm.modalData.otherOption.push(ele)
vm.modalData.otherOptionItems.push(ele)
}
})
});
},
@@ -198,17 +204,46 @@ export default {
method='put'
else
method='post'
store.saveItem(method,itemData);
var requiredOption = []
for (const ele of this.modalData.requiredOption) {
if(isNaN(ele)) {
requiredOption.push(ele)
}else{
const option = this.modalData.requiredOptionItems.find(value => value.id == ele)
requiredOption.push(option)
}
}
var otherOption = []
for (const ele of this.modalData.otherOption) {
if(isNaN(ele)) {
otherOption.push(ele)
}else{
const option = this.modalData.otherOptionItems.find(value => value.id == ele)
otherOption.push(option)
}
}
this.modalData.requiredOption = requiredOption
this.modalData.otherOption = otherOption
store.saveItem(method,itemData)
},
addItemOption:function (itemOptionValue,type){
var item = {
name:itemOptionValue,
optionType:type
}
if(type ==='REQUIRED')
if(type ==='REQUIRED'){
this.modalData.requiredOption.push(item)
else
this.modalData.requiredOptionItems.push(item)
}
else{
this.modalData.otherOption.push(item)
this.modalData.otherOptionItems.push(item)
}
}
},