Commit 1150b952 by cwq0219

编辑商品-图

1 parent 79d4df9d
......@@ -270,6 +270,10 @@
class="item-tips"
>{{item.tips}}</span>
</div>
<span v-if="headImg.isHas"><img
class="commodity-img"
:src="formData[headImg.attr]"
/></span>
</div>
</el-form>
<div slot="footer">
......@@ -331,6 +335,15 @@ export default {
type: String,
default: 'add'
},
headImg: {
type: Object,
default: () => {
return {
isHas: false,
attr: ''
}
}
},
formItemWidth: {
type: String,
default: '100%'
......@@ -378,7 +391,7 @@ export default {
if (targetItem.name === 'goodsCode') {
var tempVal = targetItem.optionList.find(item => item.goodsCode === value)
this.formData.goodsTypeName = tempVal.goodsTypeName
this.formData.goodsTypeName = tempVal.goodsTypeName
this.formData.thumbUrl = tempVal.thumbUrl
this.formData.sapCode = tempVal.sapCode
}
// if (item.attrName) {
......@@ -636,5 +649,13 @@ export default {
.d2-form .error {
color: red;
}
.d2-form .commodity-img {
width: 200px;
height: 200px;
position: absolute;
right: 58px;
top: 80px;
}
</style>
......@@ -10,9 +10,11 @@
:addOrEdit="addOrEdit"
:originData="editData"
:formList="editForm"
:headImg="headImg"
@handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose"
></d2-form>
</d2-container>
</template>
......@@ -29,6 +31,7 @@ export default {
goodsCode: '',
goodsName: '',
goodsTypeName: '',
thumbUrl: '',
spsx: '基础商品',
retailPrice: '',
maxRetailDiscount: '',
......@@ -41,6 +44,10 @@ export default {
shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }],
linkMerchantIds: [{ required: true, message: '请选择关联门店', trigger: 'change' }]
},
headImg: {
isHas: true,
attr: 'thumbUrl'
},
editForm: [{
title: '商品基本信息',
formBlock: [{
......@@ -126,12 +133,16 @@ export default {
id: res.id,
goodsCode: res.goodsCode,
goodsName: res.goodsInfo.goodsName,
thumbUrl: res.goodsInfo.thumbUrl,
goodsTypeName: res.goodsInfo.goodsTypeName,
spsx: '基础商品',
retailPrice: res.retailPrice,
shopPrice: res.shopPrice,
maxRetailDiscount: res.maxRetailDiscount,
upgradeGoods: res.upgradeGoodsList,
upgradeGoods: res.upgradeGoodsList.map(item => {
item['thumbUrl'] = item.goodsInfo.thumbUrl
return item
}),
linkMerchantIds: res.merchantRefList.length ? res.merchantRefList.map(item => Object.assign(item, item.merchantInfo)) : []
}
console.log(this.editData)
......@@ -203,5 +214,6 @@ export default {
<style>
.edit-commodity {
margin: 0 20px;
position: relative;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!