Commit a6e19629 by 王志慧

commit

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