Commit 1150b952 by cwq0219

编辑商品-图

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