Commit ffb967cb by cwq0219

产品编辑,商品编辑

1 parent 5fd4a312
...@@ -67,4 +67,10 @@ $prefix: d2; ...@@ -67,4 +67,10 @@ $prefix: d2;
position: absolute; position: absolute;
bottom: 9%; bottom: 9%;
right: 20px; right: 20px;
}
.edit-title {
margin-left: 10px;
color: #333333;
font-weight: bold;
} }
\ No newline at end of file \ No newline at end of file
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
type: Object, type: Object,
default: null default: null
}, },
showBtnId: { showBtnName: {
type: Array, type: Array,
default: [] default: []
}, },
...@@ -54,7 +54,7 @@ export default { ...@@ -54,7 +54,7 @@ export default {
* mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名 * mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名
* label 当传入label 字段时 标识明确指定渲染该label 的按钮 * label 当传入label 字段时 标识明确指定渲染该label 的按钮
* size 按钮样式,默认mini * size 按钮样式,默认mini
* showBtnId 按需显示按钮 * showBtnName 按需显示按钮
*/ */
const { const {
category, category,
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
mapping, mapping,
label, label,
size, size,
showBtnId showBtnName
} = ctx.props } = ctx.props
let curBtns = [] let curBtns = []
/** /**
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
* 循环最终显示的按钮列表 * 循环最终显示的按钮列表
* 并渲染到页面 * 并渲染到页面
*/ */
curBtns = showBtnId.length ? curBtns.filter(item => showBtnId.includes(item.authId)) : curBtns curBtns = showBtnName.length ? curBtns.filter(item => showBtnName.includes(item.label)) : curBtns
curBtns.forEach(btn => { curBtns.forEach(btn => {
__aBtns.push(h('el-button', { __aBtns.push(h('el-button', {
props: { props: {
......
<!-- 表单 --> <!-- 表单 -->
<template> <template>
<d2-container class="d2-form"> <div class="d2-form">
<el-form <el-form
:model="formData" :model="formData"
:rules="rules" :rules="rules"
...@@ -332,15 +332,23 @@ ...@@ -332,15 +332,23 @@
v-show="item.unit" v-show="item.unit"
class="item-unit" class="item-unit"
>{{item.unit}}</span> >{{item.unit}}</span>
<span <div
v-show="item.tips" v-show="item.tips"
class="item-tips" class="item-tips"
>{{item.tips}}</span> >
<template v-if="Array.isArray(item.tips)">
<p v-for="(x, y) in item.tips" :key="y">{{x}}</p>
</template>
<span v-else>{{item.tips}}</span>
</div>
</div> </div>
<span v-if="headImg.isHas"><img <span v-if="headImg.isHas && formData[headImg.attr]">
<img
class="commodity-img" class="commodity-img"
:src="formData[headImg.attr]" :src="formData[headImg.attr]"
/></span> alt="图片"
/>
</span>
</div> </div>
<el-form-item> <el-form-item>
<el-button <el-button
...@@ -382,7 +390,7 @@ ...@@ -382,7 +390,7 @@
alt="图片" alt="图片"
> >
</el-dialog> </el-dialog>
</d2-container> </div>
</template> </template>
<script> <script>
...@@ -712,11 +720,36 @@ export default { ...@@ -712,11 +720,36 @@ export default {
</script> </script>
<style> <style>
.d2-form .title { /* .d2-form .title {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
padding-left: 20px; padding-left: 20px;
background-color: #e1e0e0; background-color: #e1e0e0;
} */
.d2-form .title {
height: 30px;
line-height: 30px;
font-size: 12px;
color: #cccccc;
text-align: center;
margin: 30px 0;
}
.d2-form .title::before {
content: '';
display: inline-block;
width: 40%;
height: 1px;
padding-bottom: -10px;
border-bottom: 0.5px dotted #cccccc;
margin: 0 20px 3px 0;
}
.d2-form .title::after {
content: '';
display: inline-block;
width: 42%;
height: 1px;
border-bottom: 0.5px dotted #cccccc;
margin: 0 0 3px 20px;
} }
.d2-form .dis-in-block { .d2-form .dis-in-block {
display: inline-block; display: inline-block;
...@@ -725,9 +758,11 @@ export default { ...@@ -725,9 +758,11 @@ export default {
margin-left: 10px; margin-left: 10px;
} }
.d2-form .item-tips { .d2-form .item-tips {
display: inline-block;
font-size: 12px; font-size: 12px;
color: #999999; color: #999999;
margin-left: 20px; margin-left: 10px;
vertical-align: top;
} }
.d2-form .icon-delete { .d2-form .icon-delete {
margin-left: 10px; margin-left: 10px;
...@@ -739,7 +774,7 @@ export default { ...@@ -739,7 +774,7 @@ export default {
margin: 0 6px; margin: 0 6px;
} }
.d2-form .photo-top-tips { .d2-form .photo-top-tips {
height: 36px; /* height: 36px; */
margin: 0 0; margin: 0 0;
color: #999999; color: #999999;
} }
...@@ -754,7 +789,7 @@ export default { ...@@ -754,7 +789,7 @@ export default {
color: #999999; color: #999999;
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
cursor: pointer; cursor: pointer;
margin-right: 10px; /* margin-right: 10px; */
} }
.d2-form .activity-Input { .d2-form .activity-Input {
...@@ -876,7 +911,7 @@ export default { ...@@ -876,7 +911,7 @@ export default {
height: 200px; height: 200px;
position: absolute; position: absolute;
right: 58px; right: 58px;
top: 80px; top: 118px;
} }
</style> </style>
...@@ -187,7 +187,7 @@ export const resources = { ...@@ -187,7 +187,7 @@ export const resources = {
name: 'editProduct', name: 'editProduct',
icon: 'document', icon: 'document',
meta: { meta: {
title: '产品编辑', title: '素材编辑',
authId: '90304', authId: '90304',
parentId: '90301', parentId: '90301',
cache: true, cache: true,
......
<!-- 客户预录 --> <!-- 客户预录 -->
<template> <template>
<d2-container> <d2-container>
<p><i class="el-icon-edit-outline"></i><span class="cus-title">预录客户</span></p> <p><i class="el-icon-edit-outline"></i><span class="edit-title">预录客户</span></p>
<el-form <el-form
ref="editCusFrom" ref="editCusFrom"
class="editCusFrom" class="editCusFrom"
...@@ -765,12 +765,6 @@ export default { ...@@ -765,12 +765,6 @@ export default {
height: 80px; height: 80px;
} }
.cus-title {
margin-left: 10px;
color: #333333;
font-weight: bold;
}
.editCusFrom .title { .editCusFrom .title {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<auth-button <auth-button
category="Button" category="Button"
style="{display: inline-block}" style="{display: inline-block}"
showBtnId="[9020201]" showBtnName="['预录客户']"
></auth-button> ></auth-button>
<span>已预录客户列表xx条记录。</span> <span>已预录客户列表xx条记录。</span>
</span> </span>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<span class="btn-tips"><i class="el-icon-warning"></i>所有号码已启用隐私号码保护功能!</span> <span class="btn-tips"><i class="el-icon-warning"></i>所有号码已启用隐私号码保护功能!</span>
<auth-button <auth-button
category="Button" category="Button"
showBtnId="[9020202]" showBtnName="['一键导入']"
></auth-button> ></auth-button>
</span> </span>
</d2-table-header> </d2-table-header>
......
...@@ -25,8 +25,17 @@ ...@@ -25,8 +25,17 @@
</div> </div>
</div> </div>
<d2-table-header> <d2-table-header>
<span slot="left">
<auth-button
category="Button"
style="{display: inline-block}"
showBtnName="['新增商品']"
></auth-button>
</span>
<auth-button <auth-button
category="Button" category="Button"
style="{display: inline-block}"
showBtnName="['导出']"
></auth-button> ></auth-button>
</d2-table-header> </d2-table-header>
<d2-table <d2-table
......
<!-- 商品编辑 --> <!-- 商品编辑 -->
<template> <template>
<d2-container class="edit-commodity"> <d2-container class="edit-commodity">
<p><i class="el-icon-edit-outline"></i><span class="edit-title">{{addOrEdit === 'add' ? '新增商品' : '编辑商品'}}</span></p>
<d2-form <d2-form
v-if="show" v-if="show"
ref="d2Form" ref="d2Form"
...@@ -218,13 +219,13 @@ export default { ...@@ -218,13 +219,13 @@ export default {
if (this.addOrEdit === 'edit') { if (this.addOrEdit === 'edit') {
params.id = data.id params.id = data.id
baseGoodsUpdate(params).then(res => { baseGoodsUpdate(params).then(res => {
console.log(res) // console.log(res)
this.notice.okTips() this.notice.okTips()
this.handleAddClose() this.handleAddClose()
}) })
} else { } else {
baseGoodsAdd(params).then(res => { baseGoodsAdd(params).then(res => {
console.log(res) // console.log(res)
this.notice.okTips() this.notice.okTips()
this.handleAddClose(true) this.handleAddClose(true)
}) })
......
<!-- 产品编辑 --> <!-- 产品编辑(素材管理) -->
<template> <template>
<d2-container class="edit-product"> <d2-container class="edit-product">
<p><i class="el-icon-edit-outline"></i><span class="edit-title">{{addOrEdit === 'add' ? '新增素材' : '编辑素材'}}</span></p>
<d2-form <d2-form
v-if="show" v-if="show"
ref="d2ProductForm" ref="d2ProductForm"
...@@ -28,7 +29,7 @@ export default { ...@@ -28,7 +29,7 @@ export default {
show: false, show: false,
addOrEdit: 'add', addOrEdit: 'add',
rules: { rules: {
goodsName: [{ required: true, message: '请输入产品名称', trigger: 'change' }], goodsName: [{ required: true, message: '请输入素材名称', trigger: 'change' }],
goodsType: [{ required: true, message: '请选择分类', trigger: 'change' }], goodsType: [{ required: true, message: '请选择分类', trigger: 'change' }],
// thumbUrl: [{ required: true, message: '请选择缩略图', trigger: 'change' }], // thumbUrl: [{ required: true, message: '请选择缩略图', trigger: 'change' }],
thumbUrlList: [{ required: true, message: '请选择缩略图', trigger: 'blur' }], thumbUrlList: [{ required: true, message: '请选择缩略图', trigger: 'blur' }],
...@@ -52,10 +53,10 @@ export default { ...@@ -52,10 +53,10 @@ export default {
}, },
proFormRef: 'pro', proFormRef: 'pro',
editForm: [{ editForm: [{
title: '产品基本信息', title: '素材基本信息',
formBlock: [{ formBlock: [{
name: 'goodsName', name: 'goodsName',
label: '产品名称', label: '素材名称',
type: 'input', type: 'input',
maxlength: 32 maxlength: 32
}, { }, {
...@@ -87,13 +88,13 @@ export default { ...@@ -87,13 +88,13 @@ export default {
name: 'thumbUrlList', name: 'thumbUrlList',
label: '缩略图', label: '缩略图',
type: 'photo', type: 'photo',
topTips: '用于在小程序主页的商品列表展示', tips: ['注:用于小程序主页商品列表配图展示', '请上传2M以内的jpg、jpeg、png图片,建议图片尺寸256*256'],
maxPhotoNum: 1 maxPhotoNum: 1
}, { }, {
name: 'goodsImgList', name: 'goodsImgList',
label: '产品主图', label: '产品主图',
type: 'photo', type: 'photo',
topTips: '用于在小程序商品详情页的顶部展示', tips: ['注:用于在小程序商品详情页的顶部展示'],
maxPhotoNum: 10 maxPhotoNum: 10
}, { }, {
name: 'goodsDescList', name: 'goodsDescList',
......
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
<auth-button <auth-button
category="Button" category="Button"
style="{display: inline-block}" style="{display: inline-block}"
showBtnId="[9030101]" showBtnName="['新增素材']"
></auth-button> ></auth-button>
</span> </span>
<auth-button <auth-button
category="Button" category="Button"
style="{display: inline-block}" style="{display: inline-block}"
showBtnId="[9030103]" showBtnName="['导出']"
></auth-button> ></auth-button>
</d2-table-header> </d2-table-header>
<d2-table <d2-table
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!