Commit a6e19629 by 王志慧

commit

1 parent 8f50f3bd
......@@ -56,10 +56,10 @@ export default {
label: '产品类型',
name: 'typeTxt'
},
{
label: '所属系列',
name: 'goodsCode'
},
// {
// label: '所属系列',
// name: 'goodsCode'
// },
{
label: '售价/元',
name: 'sellPrice',
......
......@@ -77,7 +77,8 @@ const editCommodityObj = {
optionLabel: 'goodsName',
optionsName: 'goodsSeriesList',
changeAttr: function(val, targetItem, that) {
let labeList = ['产品类型']
console.log(val, targetItem, that)
let labeList = ['产品类型','质保年限']
let txt = targetItem.optionList.find(k => k.goodsCode == val)?.goodsName || ''
that.changeFormAttr('editFormData', 'isHide', labeList, txt != '太阳膜')
if (val != '1') {
......@@ -127,7 +128,8 @@ const editCommodityObj = {
{
label: '质保年限',
name: 'warrantyPeriod',
type: 'input'
type: 'input',
isHide: true
}
],
......
......@@ -67,7 +67,7 @@ export default {
},
isEdit: true,
editRule: constData.editCommodityObj.editRule,
editFormData: constData.editCommodityObj.editFormData,
editFormData: this.$common.utils.deepClone(constData.editCommodityObj.editFormData),
merchantEditFormData: constData.editCommodityObj.merchantEditFormData,
// 选择门店
relateStoreVisible: false,
......@@ -146,14 +146,27 @@ export default {
let params = {
upgradeGoodsId: this.routeInfo.info.upgradeGoodsId
}
console.log(params)
this.$apis.commodity.getGoodsDetail(params).then(res => {
let changeProduct = this.validateProduct(res.goodsCodeName)
if (changeProduct) {
this.handleCheckChange(res.baseProductFlag, 'baseProductFlag')
this.handleCheckChange(res.upgradeProductFlag, 'upgradeProductFlag')
}
this.editForm = res
this.$nextTick(() => {
this.editStatus = false
})
})
},
validateProduct(goodsCode) {
let isFlag = goodsCode != '太阳膜'
let AttrList = isFlag ? ['售价/元', '最低售价/元', '产品成本/元'] : ['产品类型']
this.changeFormAttr('editFormData', 'isHide', AttrList, false)
if (!isFlag)
return (val, attr) => {
this.handleCheckChange(val, attr)
}
},
// 所属系列改变,清空值
// seriesClear() {
// this.editForm
......@@ -166,6 +179,7 @@ export default {
},
// 产品类型改变
handleCheckChange(val, attr) {
console.log(val, attr)
let baseAttrList = ['赠送成本/元']
let upAttrList = ['售价/元', '最低售价/元', '产品成本/元']
switch (attr) {
......@@ -176,10 +190,27 @@ export default {
this.changeFormAttr('editFormData', 'isHide', upAttrList, val != 'Y')
break
}
this.clearData()
},
clearData() {
this.editForm = {
...this.editForm,
sellPrice: '',
minSellPrice: '',
productCost: '',
warningValue: '',
giftCost:''
}
},
changeFormAttr(formName, attrName, labelList, attrValue) {
console.log(formName, attrName, labelList, attrValue)
console.log(this[formName])
labelList.forEach(item => {
let idx = this[formName].findIndex(k => k.label == item)
console.log(item)
let idx = this[formName]?.findIndex(k => {
console.log(k)
return k.label == item
})
this[formName][idx][attrName] = attrValue
})
},
......@@ -222,7 +253,7 @@ export default {
}
this.$apis.commodity.updateGoods(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
......@@ -247,7 +278,7 @@ export default {
.then(() => {
this.cancelJump()
})
.catch(() => { })
.catch(() => {})
} else {
this.cancelJump()
}
......
......@@ -93,7 +93,9 @@ export default {
prop: '',
formatter: cellValue => {
return cellValue.merchantList?.map(item => item.merchantName).join(',')
}
},
width: 200,
line: 1
},
{
label: '创建日期',
......@@ -243,9 +245,8 @@ export default {
goodsType: ''
}
this.handleSearch()
},
}
}
}
</script>
<style scoped>
</style>
<style scoped></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!