|
@@ -45,17 +45,7 @@
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
<a-form-model-item label="封面图片" prop="imageSet" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
|
<Upload
|
|
|
- v-if="pageType==='add'"
|
|
|
- class="upload"
|
|
|
- id="promotionEdit-imageSet"
|
|
|
- v-model="form.imageSet"
|
|
|
- ref="imageSet"
|
|
|
- :fileSize="10"
|
|
|
- :maxNums="10"
|
|
|
- @change="changeImage"
|
|
|
- listType="picture-card"></Upload>
|
|
|
- <Upload
|
|
|
- v-else-if="pageType==='edit'&&!isDisabled"
|
|
|
+ v-if="pageType==='add'||(pageType==='edit'&&!isDisabled)"
|
|
|
class="upload"
|
|
|
id="promotionEdit-imageSet"
|
|
|
v-model="form.imageSet"
|
|
@@ -92,24 +82,17 @@
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
<a-form-model-item label="内容" prop="content" v-show="form.contentType =='IMAGE_CONTENT'" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
|
<editor
|
|
|
- v-if="pageType === 'add'"
|
|
|
+ v-show="pageType === 'add'||(pageType === 'edit'&&!isDisabled)"
|
|
|
id="promotionEdit-editor"
|
|
|
ref="editor"
|
|
|
class="promotionEdit-editor"
|
|
|
@on-change="editorChange"
|
|
|
:cache="false"></editor>
|
|
|
- <editor
|
|
|
- v-if="pageType === 'edit'&&!isDisabled"
|
|
|
- id="promotionEdit-editor"
|
|
|
- ref="editor"
|
|
|
- class="promotionEdit-editor"
|
|
|
- @on-change="editorChange"
|
|
|
- :cache="false"></editor>
|
|
|
- <div v-show="pageType === 'edit'&&isDisabled" class="box" v-html="form.content"></div>
|
|
|
+ <div v-show="(pageType === 'edit'||pageType === 'see')&&isDisabled" class="box" v-html="form.content"></div>
|
|
|
</a-form-model-item>
|
|
|
- <a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'" :label-col="{span:3}" :wrapper-col="{span:18}">
|
|
|
+ <a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
|
<Upload
|
|
|
- v-if="pageType==='add'"
|
|
|
+ v-if="pageType==='add'||(pageType==='edit'&&!isDisabled)"
|
|
|
class="upload"
|
|
|
id="promotionEdit-imageSet"
|
|
|
v-model="form.content"
|
|
@@ -119,36 +102,35 @@
|
|
|
:maxNums="1"
|
|
|
@change="changeVideo"
|
|
|
></Upload>
|
|
|
- <Upload
|
|
|
- v-else-if="pageType==='edit'&&!isDisabled"
|
|
|
- class="upload"
|
|
|
- id="promotionEdit-imageSet"
|
|
|
- v-model="form.content"
|
|
|
- fileType="video/mp4"
|
|
|
- ref="videoSet"
|
|
|
- :fileSize="100"
|
|
|
- :maxNums="1"
|
|
|
- @change="changeVideo"
|
|
|
- ></Upload>
|
|
|
- <div v-if="pageType==='edit'&&isDisabled">
|
|
|
+ <div v-else>
|
|
|
<video width="230" height="150" controls loop controlsList="nodownload">
|
|
|
<source :src="form.content" type="video/mp4">
|
|
|
</video>
|
|
|
</div>
|
|
|
<span class="upload-desc">说明:文件最大100M;视频:mp4.avi.flv</span>
|
|
|
</a-form-model-item>
|
|
|
- <a-form-model-item label="跳转链接" prop="contentLink" v-if="form.contentType =='LINK'" :label-col="{span:3}" :wrapper-col="{span:18}">
|
|
|
+ <a-form-model-item label="跳转链接" prop="contentLink" v-if="form.contentType =='LINK'" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
|
<a-input
|
|
|
+ style="width:50%;"
|
|
|
:disabled="isDisabled"
|
|
|
id="promotionEdit-title"
|
|
|
:maxLength="100"
|
|
|
v-model.trim="form.contentLink"
|
|
|
placeholder="请输入跳转链接"
|
|
|
allowClear />
|
|
|
+ <a-select id="promotionEdit-title" default-value="货架促销" style="width: 120px;margin-left:10px;" v-model="form.linkType">
|
|
|
+ <a-select-option value="1">
|
|
|
+ 货架促销
|
|
|
+ </a-select-option>
|
|
|
+ <a-select-option value="2">
|
|
|
+ 其他
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
- <a-row style="width:83%;margin:0 auto 24px;">
|
|
|
+ <!-- 参数配置 -->
|
|
|
+ <a-row style="width:83%;margin:0 auto 24px;" v-if="form.contentType =='LINK'">
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
<a-checkbox @change="onChangeParams">参数配置</a-checkbox>
|
|
|
</a-col>
|
|
@@ -166,7 +148,7 @@
|
|
|
<a-row>
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
|
|
|
<a-form-model-item label="是否发布" prop="enabledFlag" :label-col="{span:3}" :wrapper-col="{span:18}">
|
|
|
- <a-radio-group button-style="solid" v-model="form.enabledFlag">
|
|
|
+ <a-radio-group button-style="solid" v-model="form.enabledFlag" :disabled="pageType==='see'">
|
|
|
<a-radio-button value="1">
|
|
|
是
|
|
|
</a-radio-button>
|
|
@@ -227,25 +209,6 @@ export default {
|
|
|
name: 'ProductBrandEditModal',
|
|
|
mixins: [commonMixin],
|
|
|
components: { VSelect, Upload, Editor, promotionShowModal, setPromotion, chooseProduct },
|
|
|
- props: {
|
|
|
- openModal: { // 弹框显示状态
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- },
|
|
|
- itemId: {
|
|
|
- type: [Number, String],
|
|
|
- default: ''
|
|
|
- },
|
|
|
- pageType: {
|
|
|
- type: String,
|
|
|
- default: 'add'
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- modalTit () {
|
|
|
- return this.pageType != 'add' ? '发布修改' : '促销发布'
|
|
|
- }
|
|
|
- },
|
|
|
data () {
|
|
|
return {
|
|
|
isShow: this.openModal, // 是否打开弹框
|
|
@@ -263,8 +226,10 @@ export default {
|
|
|
content: '',
|
|
|
enabledFlag: '0',
|
|
|
sort: undefined,
|
|
|
- contentLink: ''
|
|
|
+ contentLink: '',
|
|
|
+ linkType: '1'
|
|
|
},
|
|
|
+ pageType: undefined, // 页面类型
|
|
|
showProModal: false,
|
|
|
images: [],
|
|
|
isShowParams: false, // 是否显示参数配置内容
|
|
@@ -322,9 +287,14 @@ export default {
|
|
|
},
|
|
|
// 详情
|
|
|
getDetail () {
|
|
|
- promoTerminalDetail({ sn: this.itemId }).then(res => {
|
|
|
+ // 查看按钮时,所有按钮不能编辑 编辑按钮时,state 已发布,只能编辑是否发布;state已关闭,都可以编辑
|
|
|
+ promoTerminalDetail({ sn: this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- this.isDisabled = res.data.state === 'PUBLISH'
|
|
|
+ if (this.pageType === 'edit') {
|
|
|
+ this.isDisabled = res.data.state === 'PUBLISH'
|
|
|
+ } else {
|
|
|
+ this.isDisabled = true
|
|
|
+ }
|
|
|
this.form.promoActiveSn = res.data.promoActiveSn
|
|
|
this.form.title = res.data.title
|
|
|
this.form.contentType = res.data.contentType
|
|
@@ -393,44 +363,49 @@ export default {
|
|
|
// 文本编辑器
|
|
|
editorChange (html, text) {
|
|
|
this.form.content = html
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- // 父页面传过来的弹框状态
|
|
|
- openModal (newValue, oldValue) {
|
|
|
- this.isShow = newValue
|
|
|
},
|
|
|
- // 重定义的弹框状态
|
|
|
- isShow (newValue, oldValue) {
|
|
|
- if (!newValue) {
|
|
|
- this.$emit('close')
|
|
|
- if (this.pageType == 'add' || (this.pageType == 'edit' && !this.isDisabled)) {
|
|
|
- this.$refs.imageSet.setFileList('')
|
|
|
- this.$refs.videoSet.setFileList('')
|
|
|
- }
|
|
|
- if (this.$refs.editor) {
|
|
|
- this.$refs.editor.setHtml('')
|
|
|
- }
|
|
|
- this.form = {
|
|
|
- promoActiveSn: undefined,
|
|
|
- title: '',
|
|
|
- contentType: 'IMAGE_CONTENT',
|
|
|
- imageSet: '',
|
|
|
- showFlag: '0',
|
|
|
- content: '',
|
|
|
- enabledFlag: '0',
|
|
|
- sort: undefined
|
|
|
- }
|
|
|
- this.images = []
|
|
|
- this.isDisabled = false
|
|
|
- this.$refs.ruleForm.resetFields()
|
|
|
- this.$refs.formBox.scrollTop = 0
|
|
|
- } else {
|
|
|
- if (this.pageType == 'edit') {
|
|
|
- this.getDetail()
|
|
|
- }
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ if (this.pageType == 'add' || (this.pageType == 'edit' && !this.isDisabled)) {
|
|
|
+ this.$refs.imageSet.setFileList('')
|
|
|
+ this.$refs.videoSet.setFileList('')
|
|
|
+ }
|
|
|
+ if (this.$refs.editor) {
|
|
|
+ this.$refs.editor.setHtml('')
|
|
|
}
|
|
|
+ this.form = {
|
|
|
+ promoActiveSn: undefined,
|
|
|
+ title: '',
|
|
|
+ contentType: 'IMAGE_CONTENT',
|
|
|
+ imageSet: '',
|
|
|
+ showFlag: '0',
|
|
|
+ content: '',
|
|
|
+ enabledFlag: '0',
|
|
|
+ sort: undefined
|
|
|
+ }
|
|
|
+ this.images = []
|
|
|
+ this.isDisabled = false
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.$refs.formBox.scrollTop = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.pageType = this.$route.params.pageType
|
|
|
+ if (this.pageType == 'edit' || this.pageType == 'see') {
|
|
|
+ this.getDetail()
|
|
|
}
|
|
|
+ this.resetSearchForm()
|
|
|
+ },
|
|
|
+ activated () {
|
|
|
+ this.pageType = this.$route.params.pageType
|
|
|
+ // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
|
|
|
+ if (this.pageType == 'edit' || this.pageType == 'see') {
|
|
|
+ this.getDetail()
|
|
|
+ }
|
|
|
+ this.resetSearchForm()
|
|
|
+ },
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
+ next(vm => {})
|
|
|
}
|
|
|
}
|
|
|
</script>
|