
9 changed files with 1295 additions and 1258 deletions
After Width: | Height: | Size: 374 KiB |
@ -1,281 +1,299 @@ |
|||||
<template> |
<template> |
||||
<div> |
<div> |
||||
|
|
||||
<div class="tab-header webtop"> |
<div class="tab-header webtop"> |
||||
<!-- 标题 --> |
<!-- 标题 --> |
||||
<div>轮播图信息</div> |
<div>轮播图信息</div> |
||||
<!-- start 添加修改按钮 --> |
<!-- start 添加修改按钮 --> |
||||
<div> |
<div> |
||||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button> |
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button> |
||||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
||||
</div> |
</div> |
||||
<!-- end 添加修改按钮 --> |
<!-- end 添加修改按钮 --> |
||||
<!-- end 详情按钮 --> |
<!-- end 详情按钮 --> |
||||
</div> |
|
||||
|
|
||||
<div class="listconadd"> |
|
||||
|
|
||||
<el-card class="box-card"> |
|
||||
|
|
||||
<div class="item"> |
|
||||
<span class="item_text">标题:</span> |
|
||||
<el-input v-model="formobj.title" placeholder="" class="item_input" clearable /> |
|
||||
</div> |
</div> |
||||
|
|
||||
<div class="item" style="margin-bottom: 100px;margin-top: 100px;"> |
<div class="listconadd"> |
||||
<span class="item_text">轮播图图片:</span> |
|
||||
<upload |
<el-card class="box-card"> |
||||
ref="uploadImg2" |
|
||||
v-model="imgList" |
<div class="item"> |
||||
style="margin-top: 20px;" |
<span class="item_text">标题:</span> |
||||
class="item_input" |
<el-input v-model="formobj.title" placeholder="" class="item_input" clearable /> |
||||
:limit="1" |
</div> |
||||
bucket="map" |
|
||||
:class="{ hide: hideUploadBtn }" |
<div class="item" style="margin-bottom: 100px;margin-top: 100px;"> |
||||
:upload-data="{ type: '0001' }" |
<span class="item_text">轮播图图片:</span> |
||||
@change="backData" |
<upload ref="uploadImg2" v-model="imgList" style="margin-top: 20px;" class="item_input" :limit="1" |
||||
/> |
bucket="map" :class="{ hide: hideUploadBtn }" :upload-data="{ type: '0001' }" |
||||
</div> |
@change="backData" /> |
||||
<div class="item"> |
</div> |
||||
<span class="item_text">发布人:</span> |
|
||||
<el-input v-model="formobj.publisher" placeholder="" class="item_input" clearable /> |
<div class="item"> |
||||
</div> |
<span class="item_text">发布人:</span> |
||||
<div class="item"> |
<el-input v-model="formobj.publisher" placeholder="" class="item_input" clearable /> |
||||
<span class="item_text">发布日期:</span> |
</div> |
||||
<el-date-picker v-model="formobj.releaseTime" type="date" class="item_input" value-format="yyyy-MM-dd" placeholder="选择日期" /> |
<div class="item"> |
||||
</div> |
<span class="item_text">发布日期:</span> |
||||
<div class="item"> |
<el-date-picker v-model="formobj.releaseTime" type="date" class="item_input" |
||||
<span class="item_text">时效开始日期:</span> |
value-format="yyyy-MM-dd" placeholder="选择日期" /> |
||||
<el-date-picker v-model="formobj.startDate" type="date" class="item_input" value-format="yyyy-MM-dd" placeholder="选择日期" /> |
</div> |
||||
</div> |
<div class="item"> |
||||
<div class="item"> |
<span class="item_text">时效开始日期:</span> |
||||
<span class="item_text">时效结束日期:</span> |
<el-date-picker v-model="formobj.startDate" type="date" class="item_input" value-format="yyyy-MM-dd" |
||||
<el-date-picker v-model="formobj.endDate" type="date" class="item_input" value-format="yyyy-MM-dd" placeholder="选择日期" /> |
placeholder="选择日期" /> |
||||
</div> |
</div> |
||||
|
<div class="item"> |
||||
<!-- <div class="item2"> |
<span class="item_text">时效结束日期:</span> |
||||
|
<el-date-picker v-model="formobj.endDate" type="date" class="item_input" value-format="yyyy-MM-dd" |
||||
|
placeholder="选择日期" /> |
||||
|
</div> |
||||
|
|
||||
|
<!-- <div class="item2"> |
||||
<span class="item_text">内容:</span> |
<span class="item_text">内容:</span> |
||||
<el-input v-model="formobj.content" type="textarea" :rows="6" placeholder="商品简介" class="item_input" |
<el-input v-model="formobj.content" type="textarea" :rows="6" placeholder="商品简介" class="item_input" |
||||
clearable /> |
clearable /> |
||||
|
|
||||
</div> --> |
</div> --> |
||||
|
|
||||
<div class="item" style="margin-bottom: 100px;margin-top: 100px;"> |
<div class="item" style="margin-bottom: 100px;margin-top: 100px;"> |
||||
<span class="item_text">内容图片:</span> |
<span class="item_text">内容图片:</span> |
||||
<upload |
<upload ref="uploadImg3" v-model="imgListnr" style="margin-top: 20px;" class="item_input" :limit="1" |
||||
ref="uploadImg3" |
bucket="map" :class="{ hide: hideUploadBtnNr }" :upload-data="{ type: '0001' }" |
||||
v-model="imgListnr" |
@change="backDataNr" /> |
||||
style="margin-top: 20px;" |
</div> |
||||
class="item_input" |
<div class="item2"> |
||||
:limit="1" |
<span class="item_text">轮播图内容:</span> |
||||
bucket="map" |
<editor class="item_input" :height="300" :min-height="100" :value="formobj.content" |
||||
:class="{ hide: hideUploadBtnNr }" |
@input="editinput" /> |
||||
:upload-data="{ type: '0001' }" |
</div> |
||||
@change="backDataNr" |
|
||||
/> |
|
||||
</div> |
|
||||
<div class="item2"> |
|
||||
<span class="item_text">轮播图内容:</span> |
|
||||
<editor class="item_input" :height="300" :min-height="100" :value="formobj.content" @input="editinput" /> |
|
||||
</div> |
|
||||
|
|
||||
</el-card> |
</el-card> |
||||
|
|
||||
</div> |
</div> |
||||
|
|
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import req from '@/api/lpk/banner.js' |
import req from '@/api/lpk/banner.js' |
||||
import Editor from '@/components/Editor' |
import Editor from '@/components/Editor' |
||||
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue' |
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue' |
||||
|
|
||||
export default { |
export default { |
||||
components: { |
components: { |
||||
upload, |
upload, |
||||
Editor |
Editor |
||||
}, |
}, |
||||
data() { |
data() { |
||||
return { |
return { |
||||
imgList: [], |
imgList: [], |
||||
imgListnr: [], |
imgListnr: [], |
||||
hideUploadBtn: false, |
hideUploadBtn: true, |
||||
hideUploadBtnNr: false, |
hideUploadBtnNr: false, |
||||
submitdisabled: false, |
submitdisabled: false, |
||||
formobj: { |
formobj: { |
||||
sid: '', |
sid: '', |
||||
title: '', |
title: '', |
||||
publisher: '', |
publisher: '', |
||||
releaseTime: '', |
releaseTime: '', |
||||
startDate: '', |
startDate: '', |
||||
endDate: '', |
endDate: '', |
||||
content: '', |
content: '', |
||||
bannerUrl: '', |
bannerUrl: '', |
||||
bannerPath: '', |
bannerPath: '', |
||||
contentUrl: '' |
contentUrl: '' |
||||
} |
} |
||||
} |
|
||||
}, |
|
||||
methods: { |
|
||||
editinput(text) { |
|
||||
this.formobj.content = text |
|
||||
}, |
|
||||
saveOrUpdate() { |
|
||||
console.log('>>>>>>>>>saveOrUpdate', this.formobj) |
|
||||
req.saveNotice(this.formobj) |
|
||||
.then(resp => { |
|
||||
if (resp.success) { |
|
||||
this.$message({ |
|
||||
showClose: true, |
|
||||
type: 'success', |
|
||||
message: resp.msg |
|
||||
}) |
|
||||
this.handleReturn('true') |
|
||||
} else { |
|
||||
// 根据resp.code进行异常情况处理 |
|
||||
} |
} |
||||
}) |
}, |
||||
.catch(() => {}) |
methods: { |
||||
}, |
editinput(text) { |
||||
handleReturn(isreload) { |
this.formobj.content = text |
||||
if (isreload === 'true') this.$emit('reloadlist') |
}, |
||||
this.formobj = { |
saveOrUpdate() { |
||||
sid: '', |
console.log('>>>>>>>>>saveOrUpdate', this.formobj) |
||||
title: '', |
req.saveNotice(this.formobj) |
||||
publisher: '', |
.then(resp => { |
||||
releaseTime: '', |
if (resp.success) { |
||||
startDate: '', |
this.$message({ |
||||
endDate: '', |
showClose: true, |
||||
content: '', |
type: 'success', |
||||
bannerUrl: '', |
message: resp.msg |
||||
bannerPath: '', |
}) |
||||
contentUrl: '' |
this.handleReturn('true') |
||||
} |
} else { |
||||
this.$emit('doback') |
// 根据resp.code进行异常情况处理 |
||||
}, |
} |
||||
showAdd() {}, |
}) |
||||
showEdit(row) { |
.catch(() => {}) |
||||
req.noticeInit(row.sid) |
}, |
||||
.then(resp => { |
handleReturn(isreload) { |
||||
if (resp.success) { |
if (isreload === 'true') this.$emit('reloadlist') |
||||
this.formobj = resp.data |
this.imgList = [] |
||||
this.imgList[0].url = resp.data.bannerUrl |
this.imgListnr = [] |
||||
|
this.hideUploadBtn = true |
||||
|
this.hideUploadBtnNr = true |
||||
|
this.formobj = { |
||||
|
sid: '', |
||||
|
title: '', |
||||
|
publisher: '', |
||||
|
releaseTime: '', |
||||
|
startDate: '', |
||||
|
endDate: '', |
||||
|
content: '', |
||||
|
bannerUrl: '', |
||||
|
bannerPath: '', |
||||
|
contentUrl: '' |
||||
|
} |
||||
|
this.$emit('doback') |
||||
|
}, |
||||
|
showAdd() {}, |
||||
|
showEdit(row) { |
||||
|
req.noticeInit(row.sid) |
||||
|
.then(resp => { |
||||
|
if (resp.success) { |
||||
|
this.formobj = resp.data |
||||
|
|
||||
|
this.imgList = [] |
||||
|
if (resp.data.bannerUrl != '') { |
||||
|
this.imgList.push({ |
||||
|
url: resp.data.bannerUrl |
||||
|
}) |
||||
|
} |
||||
|
this.hideUploadBtn = this.imgList.length != 0 |
||||
|
|
||||
|
this.imgListnr = [] |
||||
|
if (resp.data.contentUrl != '') { |
||||
|
this.imgListnr.push({ |
||||
|
url: resp.data.contentUrl |
||||
|
}) |
||||
|
} |
||||
|
this.hideUploadBtnNr = this.imgListnr.length != 0 |
||||
|
|
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
.catch(e => { |
||||
|
this.formobj = row |
||||
|
this.imgList = [] |
||||
|
this.imgListnr = [] |
||||
|
}) |
||||
|
}, |
||||
|
backData(value) { |
||||
|
console.log('backData》》》》', value) |
||||
|
console.log('imgList', this.imgList) |
||||
|
|
||||
|
if (this.imgList.length > 0) { |
||||
|
this.formobj.bannerUrl = this.imgList[0].url |
||||
|
} else { |
||||
|
this.formobj.bannerUrl = '' |
||||
|
} |
||||
|
|
||||
|
this.hideUploadBtn = this.imgList.length != 0 |
||||
|
|
||||
|
}, |
||||
|
backDataNr(value) { |
||||
|
if (this.imgListnr.length > 0) { |
||||
|
this.formobj.contentUrl = this.imgListnr[0].url |
||||
|
} else { |
||||
|
this.formobj.contentUrl = '' |
||||
|
} |
||||
|
|
||||
|
this.hideUploadBtnNr = this.imgListnr.length !== 0 |
||||
} |
} |
||||
}) |
|
||||
.catch(e => { |
|
||||
this.formobj = row |
|
||||
}) |
|
||||
}, |
|
||||
backData(value) { |
|
||||
console.log('backData》》》》', value) |
|
||||
console.log('imgList', this.imgList) |
|
||||
|
|
||||
if (this.imgList.length > 0) { |
|
||||
this.formobj.bannerUrl = this.imgList[0].url |
|
||||
} else { |
|
||||
this.formobj.bannerUrl = '' |
|
||||
} |
|
||||
|
|
||||
this.hideUploadBtn = this.imgList.length !== 0 |
|
||||
console.log('this.hideUploadBtn', this.hideUploadBtn) |
|
||||
}, |
|
||||
backDataNr(value) { |
|
||||
if (this.imgListnr.length > 0) { |
|
||||
this.formobj.contentUrl = this.imgListnr[0].url |
|
||||
} else { |
|
||||
this.formobj.contentUrl = '' |
|
||||
} |
} |
||||
|
|
||||
this.hideUploadBtnNr = this.imgListnr.length !== 0 |
|
||||
} |
|
||||
} |
} |
||||
} |
|
||||
</script> |
</script> |
||||
<style lang="scss" scoped> |
<style lang="scss" scoped> |
||||
// 隐藏上传组件 |
// 隐藏上传组件 |
||||
|
|
||||
.box-card { |
::v-deep .hide { |
||||
margin-left: 60px; |
.el-upload--picture-card { |
||||
margin-right: 60px; |
display: none !important; |
||||
min-width: 70%; |
|
||||
margin-top: 20px; |
|
||||
height: auto; |
|
||||
|
|
||||
.item { |
|
||||
display: flex; |
|
||||
flex-direction: row; |
|
||||
align-items: center; |
|
||||
margin-top: 15px; |
|
||||
height: 40px; |
|
||||
line-height: 40px; |
|
||||
|
|
||||
.item_text { |
|
||||
flex: 0.8; |
|
||||
font-size: 18px; |
|
||||
text-align: right; |
|
||||
} |
|
||||
|
|
||||
.item_input { |
|
||||
flex: 4; |
|
||||
font-size: 16px; |
|
||||
margin-left: 10px; |
|
||||
margin-right: 80px; |
|
||||
} |
|
||||
|
|
||||
.item_left_input { |
|
||||
width: 20%; |
|
||||
} |
|
||||
|
|
||||
.item_left_text { |
|
||||
height: 30px; |
|
||||
margin-left: 20px; |
|
||||
line-height: 30px; |
|
||||
color: #018AD2; |
|
||||
padding: 0px 15px; |
|
||||
border: 1.5px solid #018AD2; |
|
||||
border-radius: 5px; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
.item_right { |
|
||||
flex: 1; |
|
||||
justify-items: center; |
|
||||
|
|
||||
.item_right_list_text { |
|
||||
font-size: 16px; |
|
||||
} |
} |
||||
|
} |
||||
|
|
||||
|
.box-card { |
||||
|
margin-left: 60px; |
||||
|
margin-right: 60px; |
||||
|
min-width: 70%; |
||||
|
margin-top: 20px; |
||||
|
height: auto; |
||||
|
|
||||
|
.item { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
margin-top: 15px; |
||||
|
height: 40px; |
||||
|
line-height: 40px; |
||||
|
|
||||
|
.item_text { |
||||
|
flex: 0.8; |
||||
|
font-size: 18px; |
||||
|
text-align: right; |
||||
|
} |
||||
|
|
||||
|
.item_input { |
||||
|
flex: 4; |
||||
|
font-size: 16px; |
||||
|
margin-left: 10px; |
||||
|
margin-right: 80px; |
||||
|
} |
||||
|
|
||||
|
.item_left_input { |
||||
|
width: 20%; |
||||
|
} |
||||
|
|
||||
|
.item_left_text { |
||||
|
height: 30px; |
||||
|
margin-left: 20px; |
||||
|
line-height: 30px; |
||||
|
color: #018AD2; |
||||
|
padding: 0px 15px; |
||||
|
border: 1.5px solid #018AD2; |
||||
|
border-radius: 5px; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.item_right { |
||||
|
flex: 1; |
||||
|
justify-items: center; |
||||
|
|
||||
|
.item_right_list_text { |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
.item_right_list_delect { |
||||
|
color: #5E94FF; |
||||
|
margin-left: 20px; |
||||
|
font-size: 16px; |
||||
|
text-decoration: underline; |
||||
|
} |
||||
|
} |
||||
|
|
||||
.item_right_list_delect { |
|
||||
color: #5E94FF; |
|
||||
margin-left: 20px; |
|
||||
font-size: 16px; |
|
||||
text-decoration: underline; |
|
||||
} |
} |
||||
} |
|
||||
|
|
||||
} |
.item2 { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
margin-top: 15px; |
||||
|
|
||||
|
.item_text { |
||||
|
flex: 0.8; |
||||
|
font-size: 18px; |
||||
|
text-align: right; |
||||
|
} |
||||
|
|
||||
.item2 { |
.item_input { |
||||
display: flex; |
flex: 4; |
||||
flex-direction: row; |
font-size: 16px; |
||||
align-items: center; |
margin-left: 10px; |
||||
margin-top: 15px; |
margin-right: 80px; |
||||
|
} |
||||
.item_text { |
|
||||
flex: 0.8; |
|
||||
font-size: 18px; |
|
||||
text-align: right; |
|
||||
} |
|
||||
|
|
||||
.item_input { |
|
||||
flex: 4; |
|
||||
font-size: 16px; |
|
||||
margin-left: 10px; |
|
||||
margin-right: 80px; |
|
||||
} |
|
||||
|
|
||||
} |
} |
||||
|
|
||||
} |
} |
||||
</style> |
</style> |
@ -1,171 +1,177 @@ |
|||||
<template> |
<template> |
||||
<div class="main-content"> |
<div class="main-content"> |
||||
<el-card class="form-container" shadow="never"> |
<el-card class="form-container" shadow="never"> |
||||
<el-form ref="brandFrom" :model="brand" :rules="rules" label-width="150px"> |
<el-form ref="brandFrom" :model="brand" :rules="rules" label-width="150px"> |
||||
<el-form-item label="品牌名称:" prop="name"> |
<el-form-item label="品牌名称:" prop="name"> |
||||
<el-input v-model="brand.name" /> |
<el-input v-model="brand.name" /> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="品牌首字母:"> |
<el-form-item label="品牌首字母:"> |
||||
<el-input v-model="brand.firstLetter" /> |
<el-input v-model="brand.firstLetter" /> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="品牌LOGO:" prop="logo"> |
<el-form-item label="品牌LOGO:" prop="logo"> |
||||
<single-upload v-model="brand.logo" /> |
<single-upload v-model="brand.logo" /> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="品牌专区大图:"> |
<el-form-item label="品牌专区大图:"> |
||||
<single-upload v-model="brand.bigPic" /> |
<single-upload v-model="brand.bigPic" /> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="品牌故事:"> |
<el-form-item label="品牌故事:"> |
||||
<el-input v-model="brand.brandStory" placeholder="请输入内容" type="textarea" :autosize="true" /> |
<el-input v-model="brand.brandStory" placeholder="请输入内容" type="textarea" :autosize="true" /> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="排序:" prop="sort"> |
<el-form-item label="排序:" prop="sort"> |
||||
<el-input v-model.number="brand.sort" /> |
<el-input v-model.number="brand.sort" /> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="是否显示:"> |
<el-form-item label="是否配送:"> |
||||
<el-radio-group v-model="brand.showStatus"> |
<el-radio-group v-model="brand.delivery"> |
||||
<el-radio :label="1">是</el-radio> |
<el-radio :label="'1'">配送</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
<el-radio :label="'0'">不配送</el-radio> |
||||
</el-radio-group> |
</el-radio-group> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="品牌制造商:"> |
<el-form-item label="是否显示:"> |
||||
<el-radio-group v-model="brand.factoryStatus"> |
<el-radio-group v-model="brand.showStatus"> |
||||
<el-radio :label="1">是</el-radio> |
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
</el-radio-group> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="起始销售数量:"> |
<!-- <el-form-item label="品牌制造商:"> |
||||
<el-input v-model="brand.qssl" /> |
<el-radio-group v-model="brand.factoryStatus"> |
||||
</el-form-item> |
<el-radio :label="1">是</el-radio> |
||||
<el-form-item label="订购协议:"> |
<el-radio :label="0">否</el-radio> |
||||
<el-input v-model="brand.dgxy" type="textarea" :rows="6" /> |
</el-radio-group> |
||||
<!-- <textarea v-model="brand.dgxy" style="width: 100%;" :rows="6"></textarea> --> |
</el-form-item> --> |
||||
</el-form-item> |
<el-form-item label="起始销售数量:"> |
||||
<el-form-item label="起订协议:"> |
<el-input v-model="brand.qssl" /> |
||||
<el-input v-model="brand.qdxy" type="textarea" :rows="6" /> |
</el-form-item> |
||||
<!-- <textarea v-model="brand.qdxy"></textarea> --> |
<el-form-item label="订购协议:"> |
||||
</el-form-item> |
<el-input v-model="brand.dgxy" type="textarea" :rows="6" /> |
||||
<el-form-item> |
<!-- <textarea v-model="brand.dgxy" style="width: 100%;" :rows="6"></textarea> --> |
||||
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button> |
</el-form-item> |
||||
<el-button type="primary" @click="onClose('brandFrom')">关闭</el-button> |
<el-form-item label="起订协议:"> |
||||
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button> |
<el-input v-model="brand.qdxy" type="textarea" :rows="6" /> |
||||
</el-form-item> |
<!-- <textarea v-model="brand.qdxy"></textarea> --> |
||||
</el-form> |
</el-form-item> |
||||
</el-card> |
<el-form-item> |
||||
</div> |
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button> |
||||
|
<el-button type="primary" @click="onClose('brandFrom')">关闭</el-button> |
||||
|
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</el-card> |
||||
|
</div> |
||||
</template> |
</template> |
||||
<script> |
<script> |
||||
import { |
import { |
||||
createBrand, |
createBrand, |
||||
getBrand, |
getBrand, |
||||
updateBrand |
updateBrand |
||||
} from '@/api/brand' |
} from '@/api/brand' |
||||
import SingleUpload from '@/components/Upload/singleUpload' |
import SingleUpload from '@/components/Upload/singleUpload' |
||||
const defaultBrand = { |
const defaultBrand = { |
||||
bigPic: '', |
bigPic: '', |
||||
brandStory: '', |
brandStory: '', |
||||
factoryStatus: 0, |
factoryStatus: 0, |
||||
firstLetter: '', |
firstLetter: '', |
||||
logo: '', |
logo: '', |
||||
name: '', |
name: '', |
||||
showStatus: 0, |
showStatus: 0, |
||||
sort: 0, |
sort: 0, |
||||
qssl: 0, |
qssl: 0, |
||||
dgxy: '' |
dgxy: '' |
||||
} |
} |
||||
export default { |
export default { |
||||
name: 'BrandDetail', |
name: 'BrandDetail', |
||||
components: { |
components: { |
||||
SingleUpload |
SingleUpload |
||||
}, |
}, |
||||
props: { |
props: { |
||||
isEdit: { |
isEdit: { |
||||
type: Boolean, |
type: Boolean, |
||||
default: false |
default: false |
||||
} |
|
||||
}, |
|
||||
data() { |
|
||||
return { |
|
||||
brand: Object.assign({}, defaultBrand), |
|
||||
rules: { |
|
||||
name: [{ |
|
||||
required: true, |
|
||||
message: '请输入品牌名称', |
|
||||
trigger: 'blur' |
|
||||
}, |
|
||||
{ |
|
||||
min: 2, |
|
||||
max: 140, |
|
||||
message: '长度在 2 到 140 个字符', |
|
||||
trigger: 'blur' |
|
||||
} |
} |
||||
], |
}, |
||||
|
data() { |
||||
|
return { |
||||
|
brand: Object.assign({}, defaultBrand), |
||||
|
rules: { |
||||
|
name: [{ |
||||
|
required: true, |
||||
|
message: '请输入品牌名称', |
||||
|
trigger: 'blur' |
||||
|
}, |
||||
|
{ |
||||
|
min: 2, |
||||
|
max: 140, |
||||
|
message: '长度在 2 到 140 个字符', |
||||
|
trigger: 'blur' |
||||
|
} |
||||
|
], |
||||
|
|
||||
sort: [{ |
sort: [{ |
||||
type: 'number', |
type: 'number', |
||||
message: '排序必须为数字' |
message: '排序必须为数字' |
||||
}] |
}] |
||||
} |
} |
||||
} |
} |
||||
}, |
}, |
||||
created() { |
created() { |
||||
if (this.isEdit) { |
if (this.isEdit) { |
||||
getBrand(this.$route.query.id).then(response => { |
getBrand(this.$route.query.id).then(response => { |
||||
this.brand = response.data |
this.brand = response.data |
||||
}) |
|
||||
} else { |
|
||||
this.brand = Object.assign({}, defaultBrand) |
|
||||
} |
|
||||
}, |
|
||||
methods: { |
|
||||
onSubmit(formName) { |
|
||||
this.$refs[formName].validate((valid) => { |
|
||||
if (valid) { |
|
||||
this.$confirm('是否提交数据', '提示', { |
|
||||
confirmButtonText: '确定', |
|
||||
cancelButtonText: '取消', |
|
||||
type: 'warning' |
|
||||
}).then(() => { |
|
||||
if (this.isEdit) { |
|
||||
updateBrand(this.$route.query.id, this.brand).then(response => { |
|
||||
this.$refs[formName].resetFields() |
|
||||
this.$message({ |
|
||||
message: '修改成功', |
|
||||
type: 'success', |
|
||||
duration: 1000 |
|
||||
}) |
|
||||
this.$router.back() |
|
||||
}) |
}) |
||||
} else { |
} else { |
||||
createBrand(this.brand).then(response => { |
this.brand = Object.assign({}, defaultBrand) |
||||
this.$refs[formName].resetFields() |
} |
||||
this.brand = Object.assign({}, defaultBrand) |
}, |
||||
this.$message({ |
methods: { |
||||
message: '提交成功', |
onSubmit(formName) { |
||||
type: 'success', |
this.$refs[formName].validate((valid) => { |
||||
duration: 1000 |
if (valid) { |
||||
}) |
this.$confirm('是否提交数据', '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(() => { |
||||
|
if (this.isEdit) { |
||||
|
updateBrand(this.$route.query.id, this.brand).then(response => { |
||||
|
this.$refs[formName].resetFields() |
||||
|
this.$message({ |
||||
|
message: '修改成功', |
||||
|
type: 'success', |
||||
|
duration: 1000 |
||||
|
}) |
||||
|
this.$router.back() |
||||
|
}) |
||||
|
} else { |
||||
|
createBrand(this.brand).then(response => { |
||||
|
this.$refs[formName].resetFields() |
||||
|
this.brand = Object.assign({}, defaultBrand) |
||||
|
this.$message({ |
||||
|
message: '提交成功', |
||||
|
type: 'success', |
||||
|
duration: 1000 |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.$message({ |
||||
|
message: '验证失败', |
||||
|
type: 'error', |
||||
|
duration: 1000 |
||||
|
}) |
||||
|
return false |
||||
|
} |
||||
}) |
}) |
||||
} |
}, |
||||
}) |
resetForm(formName) { |
||||
} else { |
this.$refs[formName].resetFields() |
||||
this.$message({ |
this.brand = Object.assign({}, defaultBrand) |
||||
message: '验证失败', |
}, |
||||
type: 'error', |
onClose() { |
||||
duration: 1000 |
this.$store.dispatch('tagsView/delView', this.$route) |
||||
}) |
this.$router.go(-1) |
||||
return false |
} |
||||
} |
} |
||||
}) |
|
||||
}, |
|
||||
resetForm(formName) { |
|
||||
this.$refs[formName].resetFields() |
|
||||
this.brand = Object.assign({}, defaultBrand) |
|
||||
}, |
|
||||
onClose(){ |
|
||||
this.$store.dispatch('tagsView/delView', this.$route) |
|
||||
this.$router.go(-1) |
|
||||
} |
|
||||
} |
} |
||||
} |
|
||||
</script> |
</script> |
||||
<style> |
<style> |
||||
</style> |
</style> |
Loading…
Reference in new issue