Commit fad1579b authored by zhanglw's avatar zhanglw

资讯

parent 187ca533
...@@ -359,6 +359,36 @@ export const HttpReq = { ...@@ -359,6 +359,36 @@ export const HttpReq = {
return res return res
}) })
}, },
// 内容管理-修改资讯
updateNewsPage: function(data) {
return request({
url: '/api/bsw/newsPage/updateNewsPage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
// 内容管理-新增资讯
addNewsPage: function(data) {
return request({
url: '/api/bsw/newsPage/addNewsPage',
method: 'post',
data: data
}).then((res) => {
return res
})
},
// 内容管理-删除资讯
newsBatchDelete: function(data) {
return request({
url: '/api/bsw/newsPage/batchDelete',
method: 'delete',
data: data
}).then((res) => {
return res
})
},
xxx: null xxx: null
} }
} }
......
...@@ -203,7 +203,6 @@ ...@@ -203,7 +203,6 @@
<label class="el-upload-list__item-status-label"><i class="el-icon-upload-success el-icon-check" /></label> <label class="el-upload-list__item-status-label"><i class="el-icon-upload-success el-icon-check" /></label>
<span class="el-upload-list__item-actions"> <span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="dialogImgUrl=item;dialogImgVisible=true"><i class="el-icon-zoom-in" /></span> <span class="el-upload-list__item-preview" @click="dialogImgUrl=item;dialogImgVisible=true"><i class="el-icon-zoom-in" /></span>
<span class="el-upload-list__item-delete" @click="handleRemoveImg(item)"><i class="el-icon-delete" /></span>
</span> </span>
</li> </li>
</ul> </ul>
......
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
</el-form-item> </el-form-item>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="标题:" class="form-cell" prop="productName"> <el-form-item label="标题:" class="form-cell" prop="title">
<div class="cell-box"> <div class="cell-box">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" /> <el-input v-model="formData.title" placeholder="单行输入" class="cell-input" />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-show="formData.type>=4" label="链接:" class="form-cell" prop="productName"> <el-form-item v-show="formData.type>=4" label="链接:" class="form-cell" prop="url">
<div class="cell-box"> <div class="cell-box">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" /> <el-input v-model="formData.url" placeholder="单行输入" class="cell-input" />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-show="formData.type" label="照片:" class="form-cell" prop="productPic"> <el-form-item v-show="formData.type" label="照片:" class="form-cell" prop="productPic">
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
ref="uploadCom" ref="uploadCom"
action="/api/bsw/common/uploadPicture" action="/api/bsw/common/uploadPicture"
name="multipartFile" name="multipartFile"
:data="{mark:'logo'}" :data="{mark:'news'}"
list-type="picture-card" list-type="picture-card"
:headers="uploadHeaders" :headers="uploadHeaders"
:limit="1" :limit="1"
...@@ -57,22 +57,24 @@ ...@@ -57,22 +57,24 @@
<img width="100%" :src="dialogImageUrl"> <img width="100%" :src="dialogImageUrl">
</el-dialog> </el-dialog>
</div> </div>
<div style="display: block;clear: both">{{ formData.partnerLogo }}</div> <div style="display: block;clear: both">{{ formData.picture }}</div>
</el-form-item> </el-form-item>
<el-form-item v-show="formData.type<4" label="来源:" class="form-cell" prop="productName"> <el-form-item v-show="formData.type<4" label="来源:" class="form-cell" prop="source">
<div class="cell-box"> <div class="cell-box">
<el-input v-model="formData.productName" placeholder="单行输入" class="cell-input" /> <el-input v-model="formData.source" placeholder="单行输入" class="cell-input" />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-show="formData.type<4" label="内容:" class="form-cell" prop="productDescribe"> <el-form-item v-show="formData.type<4" label="内容:" class="form-cell" prop="content">
<div class="cell-box"> <div class="cell-box">
<div ref="editor" class="editor" /> <div ref="editor" class="editor" />
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="text" @click="cancelView">取消</el-button> <el-button @click="cancelView">关闭</el-button>
<!-- <el-button type="danger" @click="submitForm()">预览</el-button>-->
<el-button type="primary" @click="submitForm()">保存</el-button> <el-button type="primary" @click="submitForm()">保存</el-button>
<el-button v-if="formData.newsPageId" type="success" @click="submitForm(true)">发布</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
...@@ -98,34 +100,13 @@ export default { ...@@ -98,34 +100,13 @@ export default {
visible: false, visible: false,
title: '资讯信息内容设置', title: '资讯信息内容设置',
formData: { formData: {
productId: null, newsPageId: null,
customerId: null, // 供应商id title: '', // 标题
enterpriseName: '', // 供应商名称 type: '', // 类型
productName: '', // 产品名称 source: '', // 来源
productType: '1', // 产品大类 content: '', // 内容
productSubType: null, // 产品小类 picture: '', // 图片
minPrice: null, // 价格区间-小 url: '' // 链接
maxPrice: null, // 价格区间-大
productFeature: null, // 产品特点
productPic: '', // 产品图片
productDescribe: '', // 产品描述(富文本)
notes: null, // 其他说明
letterOfCommitment: false, // 交易保障承诺
attributeBrand: '', // 属性-品牌
attributeConsumptionCurrent: '', // 属性-消耗电流
attributeProductName: '', // 属性-产品名称
attributeRatedPower: '', // 属性-额定功率
attributeModel: '', // 属性-型号
attributeReactionTime: '', // 属性-反应时间
attributeWorkingVoltage: '', // 属性-工作电压
attributeEncapsulation: '', // 属性-封装
attributeQualityAssurance: '', // 属性-质量保证
attributeProducingArea: '', // 属性-产地
attributeNumber: '', // 属性-数量
attributeColor: '', // 属性-颜色
attributeApplicableScenarios: '', // 属性-品牌
attributeBatchNumber: '', // 属性-批号
rank: '1' // 产品品级
}, },
rules: {} rules: {}
} }
...@@ -146,7 +127,7 @@ export default { ...@@ -146,7 +127,7 @@ export default {
}) })
}, },
handlePushClick(event) { handlePushClick(event) {
if (this.formData.partnerLogo !== '') { if (this.formData.picture !== '') {
event.stopPropagation() event.stopPropagation()
this.$message({ this.$message({
message: '超出最大上传数量限制', message: '超出最大上传数量限制',
...@@ -154,9 +135,15 @@ export default { ...@@ -154,9 +135,15 @@ export default {
}) })
} }
}, },
handleRemoveImg(item) {
this.imgList.splice(this.imgList.indexOf(item), 1)
const arr = this.formData.picture.split(';')
arr.splice(arr.indexOf(item), 1)
this.formData.picture = arr.join(';')
},
handleRemove(file, fileList) { handleRemove(file, fileList) {
HttpReq.backstageApi.deleteProductPic({ HttpReq.backstageApi.deletePicture({
productPic: file.response.productPic multipartFile: file.response.pictures
}).then((res) => { }).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
...@@ -165,9 +152,9 @@ export default { ...@@ -165,9 +152,9 @@ export default {
}) })
const arr = [] const arr = []
fileList.forEach(item => { fileList.forEach(item => {
arr.push(item.response.productPic) arr.push(item.response.pictures)
}) })
this.formData.productPic = arr.join(';') this.formData.picture = arr.join(';')
}) })
}, },
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
...@@ -176,9 +163,9 @@ export default { ...@@ -176,9 +163,9 @@ export default {
}, },
handleImported(response, file, fileList) { handleImported(response, file, fileList) {
this.$nextTick(() => { this.$nextTick(() => {
const arr = this.formData.productPic ? this.formData.productPic.split(';') : [] const arr = this.formData.picture ? this.formData.picture.split(';') : []
arr.push(response.productPic) arr.push(response.pictures)
this.formData.productPic = arr.join(';') this.formData.picture = arr.join(';')
this.$notify({ this.$notify({
title: '上传成功!', title: '上传成功!',
type: 'success', type: 'success',
...@@ -198,12 +185,22 @@ export default { ...@@ -198,12 +185,22 @@ export default {
} }
this.$refs.formViewRef.resetFields() this.$refs.formViewRef.resetFields()
this.visible = false this.visible = false
this.imgList = []
this.formData = {
newsPageId: null,
title: '', // 标题
type: '', // 类型
source: '', // 来源
content: '', // 内容
picture: '', // 图片
url: '' // 链接
}
}, },
cancelView() { cancelView() {
this.hideView() this.hideView()
}, },
release() { release() {
HttpReq.backstageApi.releaseHomePage({ ids: [this.formData.homePageId] }).then((res) => { HttpReq.backstageApi.releaseNewsPage({ ids: [this.formData.newsPageId] }).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
type: res.code === 200 ? 'success' : 'error', type: res.code === 200 ? 'success' : 'error',
...@@ -218,8 +215,8 @@ export default { ...@@ -218,8 +215,8 @@ export default {
submitForm(isRelease) { submitForm(isRelease) {
this.$refs.formViewRef.validate((valid, obj) => { this.$refs.formViewRef.validate((valid, obj) => {
if (valid) { if (valid) {
if (this.formData.homePageId) { if (this.formData.newsPageId) {
HttpReq.backstageApi.updateHomePage(this.formData).then((res) => { HttpReq.backstageApi.updateNewsPage(this.formData).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
type: res.code === 200 ? 'success' : 'error' type: res.code === 200 ? 'success' : 'error'
...@@ -234,7 +231,7 @@ export default { ...@@ -234,7 +231,7 @@ export default {
} }
}) })
} else { } else {
HttpReq.backstageApi.addHomePage(this.formData).then((res) => { HttpReq.backstageApi.addNewsPage(this.formData).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
type: res.code === 200 ? 'success' : 'error' type: res.code === 200 ? 'success' : 'error'
...@@ -259,6 +256,7 @@ export default { ...@@ -259,6 +256,7 @@ export default {
}, },
loadData(newsPageId) { loadData(newsPageId) {
this.showView() this.showView()
this.$nextTick(() => {
if (!this.editor) { if (!this.editor) {
const _this = this const _this = this
const editor = new E(this.$refs.editor) const editor = new E(this.$refs.editor)
...@@ -273,18 +271,19 @@ export default { ...@@ -273,18 +271,19 @@ export default {
}) })
} }
editor.config.onchange = (html) => { editor.config.onchange = (html) => {
this.formData.productDescribe = html this.formData.content = html
} }
editor.create() editor.create()
this.editor = editor this.editor = editor
} }
if (newsPageId) { if (newsPageId) {
HttpReq.backstageApi.queryHomePageById({ newsPageId }).then((res) => { HttpReq.backstageApi.queryNewsPageById({ newsPageId }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.formData = Object.assign(this.formData, res.data) this.formData = Object.assign(this.formData, res.data)
if (this.formData.partnerLogo) { if (this.formData.picture) {
this.imgList = this.formData.partnerLogo.split(';') this.imgList = this.formData.picture.split(';')
} }
this.editor.txt.html(this.formData.content)
} else { } else {
this.$message({ this.$message({
message: res.msg, message: res.msg,
...@@ -293,6 +292,7 @@ export default { ...@@ -293,6 +292,7 @@ export default {
} }
}) })
} }
})
} }
} }
} }
......
...@@ -47,15 +47,17 @@ ...@@ -47,15 +47,17 @@
<el-pagination :total="total" :current-page="page" :page-size="pageSize" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" /> <el-pagination :total="total" :current-page="page" :page-size="pageSize" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" />
</div> </div>
<add-page ref="addPage" /> <add-page ref="addPage" />
<view-page ref="viewPage" />
</div> </div>
</template> </template>
<script> <script>
import { HttpReq } from '@/api/common' import { HttpReq } from '@/api/common'
import DateRangePicker from '@/components/DateRangePicker' import DateRangePicker from '@/components/DateRangePicker'
import addPage from './add' import addPage from './add'
import viewPage from './view'
export default { export default {
components: { DateRangePicker, addPage }, components: { DateRangePicker, addPage, viewPage },
dicts: ['issue_status', 'information_type'], dicts: ['issue_status', 'information_type'],
data() { data() {
return { return {
...@@ -121,10 +123,10 @@ export default { ...@@ -121,10 +123,10 @@ export default {
this.$refs.addPage.loadData(item.newsPageId) this.$refs.addPage.loadData(item.newsPageId)
}, },
toView(item) { toView(item) {
// this.$refs.viewPage.loadData(item.homePageId) this.$refs.viewPage.loadData(item.newsPageId)
}, },
toDelete(item) { toDelete(item) {
HttpReq.backstageApi.hpBatchDelete({ HttpReq.backstageApi.newsBatchDelete({
ids: [item.newsPageId] ids: [item.newsPageId]
}).then((res) => { }).then((res) => {
this.$notify({ this.$notify({
......
<template> <template>
<!-- 表单渲染 --> <!-- 表单渲染 -->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelView" :visible="visible" :title="title" width="1080px"> <el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelView" :visible="visible" :title="title" width="1080px">
<img v-if="stampImgSrc[0]" :src="stampImgSrc[0]" class="stamp-review">
<img v-if="stampImgSrc[1]" :src="stampImgSrc[1]" class="stamp-review" style="top:50%">
<el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="240px"> <el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="240px">
<el-form-item label="供应商名称:" class="form-cell" prop="enterpriseName"> <el-form-item label="资讯分类:" class="form-cell" style="margin: 0">
<div class="cell-box">
<el-autocomplete
v-model="formData.enterpriseName"
disabled
class="cell-input"
:fetch-suggestions="querySearch"
placeholder="请输入供应商名称"
:trigger-on-focus="false"
@select="handleSelect"
/>
</div>
</el-form-item>
<el-form-item label="品级标识设置:" class="form-cell" prop="rank">
<div class="cell-box">
<el-select v-model="formData.rank" disabled placeholder="产品小类" style="width: 160px">
<el-option v-for="item in dict.product_rank" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<el-form-item label="产品名称:" class="form-cell" prop="productName">
<div class="cell-box">
<el-input v-model="formData.productName" disabled placeholder="请输入产品名称" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="产品分类:" class="form-cell" style="margin: 0">
<div class="cell-box" style="display: flex"> <div class="cell-box" style="display: flex">
<el-form-item prop="productType"> <el-form-item prop="type">
<el-select v-model="formData.productType" disabled placeholder="产品大类" style="width: 120px" @change="changeProductType"> <el-select v-model="formData.type" disabled placeholder="请选择">
<el-option v-for="item in dict.product_type" :key="item.id" :label="item.label" :value="item.value" /> <el-option v-for="item in dict.information_type" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item prop="productSubType" style="margin-left: 5px">
<el-select v-model="formData.productSubType" disabled placeholder="产品小类" style="width: 160px">
<el-option v-for="item in productSubTypeOpts" :key="item.id" :label="item.label" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-if="formData.productType&&formData.productType<5" label="产品属性:" class="form-cell"> <el-form-item label="标题:" class="form-cell" prop="title">
<div class="cell-box" style="max-width: 600px"> <div class="cell-box">
<el-row> <el-input v-model="formData.title" disabled placeholder="单行输入" class="cell-input" />
<el-col :span="5" class="grid-content">
<div class="grid-label">品牌</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeBrand" disabled placeholder="品牌" />
</el-col>
<el-col :span="5" class="grid-content">
<div class="grid-label">消耗电流</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeConsumptionCurrent" disabled placeholder="消耗电流" />
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="grid-content">
<div class="grid-label">产品名</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeProductName" disabled placeholder="产品名" />
</el-col>
<el-col :span="5" class="grid-content">
<div class="grid-label">额定功率</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeRatedPower" disabled placeholder="额定功率" />
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="grid-content">
<div class="grid-label">型号</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeModel" disabled placeholder="型号" />
</el-col>
<el-col :span="5" class="grid-content">
<div class="grid-label">反应时间</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeReactionTime" disabled placeholder="反应时间" />
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="grid-content">
<div class="grid-label">工作电压</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeWorkingVoltage" disabled placeholder="工作电压" />
</el-col>
<el-col :span="5" class="grid-content">
<div class="grid-label">封装</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeEncapsulation" disabled placeholder="封装" />
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="grid-content">
<div class="grid-label">质量保证</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeQualityAssurance" disabled placeholder="质量保证" />
</el-col>
<el-col :span="5" class="grid-content">
<div class="grid-label">产地</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeProducingArea" disabled placeholder="产地" />
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="grid-content">
<div class="grid-label">数量</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeNumber" disabled placeholder="数量" />
</el-col>
<el-col :span="5" class="grid-content">
<div class="grid-label">颜色</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeColor" disabled placeholder="颜色" />
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="grid-content">
<div class="grid-label">适用场景</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeApplicableScenarios" disabled placeholder="适用场景" />
</el-col>
<el-col :span="5" class="grid-content">
<div class="grid-label">批号</div>
</el-col>
<el-col :span="7" class="grid-content">
<el-input v-model="formData.attributeBatchNumber" disabled placeholder="批号" />
</el-col>
</el-row>
</div>
</el-form-item>
<el-form-item label="产品价格区间(元):" class="form-cell" style="margin: 0">
<div class="cell-box" style="display: flex">
<div class="cell-textarea">{{ formData.minPrice }} ~ {{ formData.maxPrice }}</div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="产品特点:" class="form-cell" prop="productFeature"> <el-form-item v-show="formData.type>=4" label="链接:" class="form-cell" prop="url">
<div class="cell-box"> <div class="cell-box">
<el-tag <el-input v-model="formData.url" disabled placeholder="单行输入" class="cell-input" />
v-for="tag in productFeature"
:key="tag"
size="small"
:type="tagTypes[formData.productType||0]"
:disable-transitions="false"
@close="handleClose(tag)"
>
{{ tag }}
</el-tag>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="产品照片:" class="form-cell" prop="productPic"> <el-form-item v-show="formData.type" label="照片:" class="form-cell" prop="productPic">
<div class="cell-box"> <div class="cell-box">
<ul class="el-upload-list el-upload-list--picture-card" style="float: left"> <ul class="el-upload-list el-upload-list--picture-card" style="float: left">
<li v-for="(item, index) in imgList" :key="index" tabindex="0" class="el-upload-list__item is-success"> <li v-for="(item, index) in imgList" :key="index" tabindex="0" class="el-upload-list__item is-success">
<img :src="imgSrcStart+'/productPic/'+item" class="el-upload-list__item-thumbnail"> <img :src="imgSrcStart+item" class="el-upload-list__item-thumbnail">
<label class="el-upload-list__item-status-label"><i class="el-icon-upload-success el-icon-check" /></label> <label class="el-upload-list__item-status-label"><i class="el-icon-upload-success el-icon-check" /></label>
<span class="el-upload-list__item-actions"> <span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="dialogImgUrl=item;dialogImgVisible=true"><i class="el-icon-zoom-in" /></span> <span class="el-upload-list__item-preview" @click="dialogImgUrl=item;dialogImgVisible=true"><i class="el-icon-zoom-in" /></span>
...@@ -176,84 +33,42 @@ ...@@ -176,84 +33,42 @@
</li> </li>
</ul> </ul>
<el-dialog append-to-body :visible.sync="dialogImgVisible"> <el-dialog append-to-body :visible.sync="dialogImgVisible">
<img width="100%" :src="imgSrcStart+'/productPic/'+dialogImgUrl"> <img width="100%" :src="imgSrcStart+dialogImgUrl">
</el-dialog> </el-dialog>
</div> </div>
<div style="display: block;clear: both">{{ formData.picture }}</div>
</el-form-item> </el-form-item>
<el-form-item label="产品概述:" class="form-cell" prop="productDescribe"> <el-form-item v-show="formData.type<4" label="来源:" class="form-cell" prop="source">
<div class="cell-box"> <div class="cell-box">
<div v-html="formData.productDescribe" /> <el-input v-model="formData.source" disabled placeholder="单行输入" class="cell-input" />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="其他说明:" class="form-cell" prop="notes"> <el-form-item v-show="formData.type<4" label="内容:" class="form-cell" prop="content">
<div class="cell-box"> <div class="cell-box">
<div class="cell-textarea">{{ formData.notes }}</div> <div style="width: 600px" v-html="formData.content" />
</div>
</el-form-item>
<el-form-item label="交易保障承诺:" class="form-cell" prop="letterOfCommitment">
<div class="cell-box">
<el-checkbox v-model="formData.letterOfCommitment" disabled><em>卖家承诺履约合规诈骗包赔,保障产品交易安全</em></el-checkbox>
</div>
</el-form-item>
<el-form-item v-if="!isReview && formData.reviewComments" label="审核意见:" class="form-cell">
<div class="cell-box">
<div class="cell-textarea">{{ formData.reviewComments }}</div>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer" style="text-align: center"> <div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancelView">关闭</el-button> <el-button @click="cancelView">关闭</el-button>
<el-button v-if="isReview" type="primary" @click="submitForm(true)">通过</el-button> <!-- <el-button type="danger" @click="submitForm()">预览</el-button>-->
<el-button v-if="isReview" type="primary" @click="reviewVisible=true">驳回</el-button> <el-button type="primary" @click="submitForm()">保存</el-button>
</div> <el-button v-if="formData.newsPageId" type="success" @click="submitForm(true)">发布</el-button>
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelReview" :visible="reviewVisible" title="审核意见" width="600px">
<el-form ref="formReviewRef" :model="formReview" :rules="rules" :status-icon="true" label-width="120px">
<el-form-item label="审核意见:" class="form-cell" prop="reviewComments">
<div class="cell-box">
<el-input v-model="formReview.reviewComments" type="textarea" placeholder="请输入审核意见" maxlength="100" :autosize="{ minRows: 4, maxRows: 6}" show-word-limit resize="none" style="width: 300px" />
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="submitForm(false)">提交</el-button>
</div> </div>
</el-dialog> </el-dialog>
</el-dialog>
</template> </template>
<script> <script>
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { HttpReq } from '@/api/common' import { HttpReq } from '@/api/common'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import review_pass from '@/assets/images/review_pass.png' import { upload } from '@/utils/upload'
import review_await from '@/assets/images/review_await.png' import E from 'wangeditor'
import review_failed from '@/assets/images/review_failed.png'
import pd from '@/assets/images/pd.png'
import pu from '@/assets/images/pu.png'
export default { export default {
dicts: ['product_rank', 'product_type', 'product_type_1', 'product_type_2', 'product_type_3', 'product_type_4', 'product_type_5', 'product_type_6', 'product_type_7'], dicts: ['information_type'],
data() { data() {
const checkPrice = (rule, value, callback) => {
if (!value) {
return callback()
}
if (!Number.isInteger(value)) {
return callback(new Error('请输入数字值'))
}
setTimeout(() => {
if (this.formData.minPrice && value < this.formData.minPrice) {
return callback(new Error('区间值错误'))
}
if (this.formData.maxPrice && value > this.formData.maxPrice) {
return callback(new Error('区间值错误'))
}
return callback()
}, 500)
}
return { return {
uploadHeaders: { 'Authorization': getToken() }, uploadHeaders: { 'Authorization': getToken() },
stampImgSrc: ['', ''],
isReview: false,
imgSrcStart: process.env.VUE_APP_BASE_API, imgSrcStart: process.env.VUE_APP_BASE_API,
editor: false, // 富文本对象 editor: false, // 富文本对象
dialogImageUrl: '', dialogImageUrl: '',
...@@ -262,49 +77,17 @@ export default { ...@@ -262,49 +77,17 @@ export default {
dialogImgUrl: '', dialogImgUrl: '',
dialogImgVisible: false, dialogImgVisible: false,
visible: false, visible: false,
tagTypes: ['', 'primary', 'success', 'warning', 'danger', 'info', 'info', 'info'], title: '资讯信息内容设置',
title: '编辑产品信息详情',
productSubTypeOpts: [],
inputVisible: false,
inputValue: '',
productFeature: [], // 产品特点tag列表
formData: { formData: {
productId: null, newsPageId: null,
customerId: null, // 供应商id title: '', // 标题
enterpriseName: '', // 供应商名称 type: '', // 类型
productName: '', // 产品名称 source: '', // 来源
productType: '1', // 产品大类 content: '', // 内容
productSubType: null, // 产品小类 picture: '', // 图片
minPrice: null, // 价格区间-小 url: '' // 链接
maxPrice: null, // 价格区间-大
productFeature: null, // 产品特点
productPic: '', // 产品图片
productDescribe: '', // 产品描述(富文本)
notes: null, // 其他说明
letterOfCommitment: false, // 交易保障承诺
attributeBrand: '', // 属性-品牌
attributeConsumptionCurrent: '', // 属性-消耗电流
attributeProductName: '', // 属性-产品名称
attributeRatedPower: '', // 属性-额定功率
attributeModel: '', // 属性-型号
attributeReactionTime: '', // 属性-反应时间
attributeWorkingVoltage: '', // 属性-工作电压
attributeEncapsulation: '', // 属性-封装
attributeQualityAssurance: '', // 属性-质量保证
attributeProducingArea: '', // 属性-产地
attributeNumber: '', // 属性-数量
attributeColor: '', // 属性-颜色
attributeApplicableScenarios: '', // 属性-品牌
attributeBatchNumber: '', // 属性-批号
rank: '1' // 产品品级
},
reviewVisible: false,
formReview: {
reviewComments: ''
}, },
rules: { rules: {}
reviewComments: { required: true, message: '请填写审核意见', trigger: 'blur' }
}
} }
}, },
computed: { computed: {
...@@ -314,69 +97,32 @@ export default { ...@@ -314,69 +97,32 @@ export default {
]) ])
}, },
mounted() { mounted() {
this.productSubTypeOpts = this.dict['product_type_1']
}, },
methods: { methods: {
checkEnterpriseName(rule, value, callback) { handleExceed() {
this.$nextTick(_ => { this.$message({
HttpReq.backstageApi.checkEnterpriseName({ message: '超出最大上传数量限制',
name: value, id: this.formData.customerId type: 'info'
}).then((res) => {
if (res.data) {
callback()
} else {
callback(new Error(res.msg))
}
})
})
},
querySearch(queryString, cb) {
HttpReq.backstageApi.associateQueryEnterpriseName({
name: queryString
}).then((res) => {
cb(res.data)
})
},
handleSelect(item) {
this.formData.customerId = item.id
this.$refs.formViewRef.validateField('enterpriseName', valid => {
return valid
})
},
handleClose(tag) {
this.productFeature.splice(this.productFeature.indexOf(tag), 1)
this.formData.productFeature = this.productFeature.join(';')
},
showInput() {
this.inputVisible = true
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus()
}) })
}, },
handleInputConfirm() { handlePushClick(event) {
const inputValue = this.inputValue if (this.formData.picture !== '') {
if (inputValue && !this.productFeature.filter(item => { return item === inputValue }).length) { event.stopPropagation()
this.productFeature.push(inputValue)
this.formData.productFeature = this.productFeature.join(';')
}
this.inputValue = ''
this.inputVisible = false
},
handleExceed() {
this.$message({ this.$message({
message: '超出最大上传数量限制', message: '超出最大上传数量限制',
type: 'info' type: 'info'
}) })
}
}, },
handleRemoveImg(item) { handleRemoveImg(item) {
this.imgList.splice(this.imgList.indexOf(item), 1) this.imgList.splice(this.imgList.indexOf(item), 1)
const arr = this.formData.productPic.split(';') const arr = this.formData.picture.split(';')
arr.splice(arr.indexOf(item), 1) arr.splice(arr.indexOf(item), 1)
this.formData.productPic = arr.join(';') this.formData.picture = arr.join(';')
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
HttpReq.backstageApi.deleteProductPic({ HttpReq.backstageApi.deletePicture({
productPic: file.response.productPic multipartFile: file.response.pictures
}).then((res) => { }).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
...@@ -385,9 +131,9 @@ export default { ...@@ -385,9 +131,9 @@ export default {
}) })
const arr = [] const arr = []
fileList.forEach(item => { fileList.forEach(item => {
arr.push(item.response.productPic) arr.push(item.response.pictures)
}) })
this.formData.productPic = arr.join(';') this.formData.picture = arr.join(';')
}) })
}, },
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
...@@ -396,9 +142,9 @@ export default { ...@@ -396,9 +142,9 @@ export default {
}, },
handleImported(response, file, fileList) { handleImported(response, file, fileList) {
this.$nextTick(() => { this.$nextTick(() => {
const arr = this.formData.productPic ? this.formData.productPic.split(';') : [] const arr = this.formData.picture ? this.formData.picture.split(';') : []
arr.push(response.productPic) arr.push(response.pictures)
this.formData.productPic = arr.join(';') this.formData.picture = arr.join(';')
this.$notify({ this.$notify({
title: '上传成功!', title: '上传成功!',
type: 'success', type: 'success',
...@@ -410,34 +156,33 @@ export default { ...@@ -410,34 +156,33 @@ export default {
this.visible = true this.visible = true
}, },
hideView() { hideView() {
if (this.$refs.uploadCom) {
this.$refs.uploadCom.clearFiles()
}
if (this.editor) {
this.editor.txt.clear()
}
this.$refs.formViewRef.resetFields() this.$refs.formViewRef.resetFields()
this.productSubTypeOpts = this.dict['product_type_1']
this.productFeature = []
this.visible = false this.visible = false
this.imgList = []
this.formData = {
newsPageId: null,
title: '', // 标题
type: '', // 类型
source: '', // 来源
content: '', // 内容
picture: '', // 图片
url: '' // 链接
}
}, },
cancelView() { cancelView() {
this.cancelReview()
this.hideView() this.hideView()
this.stampImgSrc = ['', '']
},
cancelReview() {
if (this.$refs.formReviewRef) {
this.$refs.formReviewRef.resetFields()
}
this.formReview.reviewComments = ''
this.reviewVisible = false
}, },
submitForm(isPass) { release() {
if (isPass) { HttpReq.backstageApi.releaseNewsPage({ ids: [this.formData.newsPageId] }).then((res) => {
this.formReview.reviewComments = '审核通过'
HttpReq.backstageApi.reviewProduct({
productId: this.formData.productId,
reviewComments: this.formReview.reviewComments,
type: 1
}).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
type: 'success', type: res.code === 200 ? 'success' : 'error',
duration: 2500 duration: 2500
}) })
if (res.code === 200) { if (res.code === 200) {
...@@ -445,25 +190,41 @@ export default { ...@@ -445,25 +190,41 @@ export default {
this.$parent.loadData() this.$parent.loadData()
} }
}) })
return },
} submitForm(isRelease) {
this.$refs.formReviewRef.validate((valid, obj) => { this.$refs.formViewRef.validate((valid, obj) => {
if (valid) { if (valid) {
HttpReq.backstageApi.reviewProduct({ if (this.formData.newsPageId) {
productId: this.formData.productId, HttpReq.backstageApi.updateNewsPage(this.formData).then((res) => {
reviewComments: this.formReview.reviewComments,
type: 0
}).then((res) => {
this.$notify({ this.$notify({
title: res.msg, title: res.msg,
type: 'success', type: res.code === 200 ? 'success' : 'error'
duration: 2500 })
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
} else {
HttpReq.backstageApi.addNewsPage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error'
}) })
if (res.code === 200) { if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView() this.cancelView()
this.$parent.loadData() this.$parent.loadData()
} }
}
}) })
}
} else { } else {
this.$message({ this.$message({
message: '表单信息有误,请核对无误后提交!', message: '表单信息有误,请核对无误后提交!',
...@@ -472,47 +233,17 @@ export default { ...@@ -472,47 +233,17 @@ export default {
} }
}) })
}, },
changeProductType() { loadData(newsPageId) {
this.formData.productSubType = null
this.productSubTypeOpts = this.dict['product_type_' + this.formData.productType]
},
loadData(productId, isReview) {
this.isReview = isReview
this.title = `${isReview ? '审核' : '查看'}产品信息详情`
this.showView() this.showView()
this.$nextTick(() => { this.$nextTick(() => {
// 初始化数据 if (newsPageId) {
HttpReq.backstageApi.queryProductDetail({ productId }).then((res) => { HttpReq.backstageApi.queryNewsPageById({ newsPageId }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.formData = Object.assign(this.formData, res.data) this.formData = Object.assign(this.formData, res.data)
if (this.formData.productPic) { if (this.formData.picture) {
this.imgList = this.formData.productPic.split(';') this.imgList = this.formData.picture.split(';')
}
if (this.formData.productType) {
this.productSubTypeOpts = this.dict['product_type_' + this.formData.productType]
}
if (this.formData.productFeature) {
this.productFeature = this.formData.productFeature.split(';')
}
switch (this.formData.status) {
case '2': this.stampImgSrc[0] = review_failed
break
case '3': this.stampImgSrc[0] = review_await
break
case '4': this.stampImgSrc[0] = review_pass
break
case '5':
this.stampImgSrc[0] = review_pass
this.stampImgSrc[1] = pu
break
case '6':
this.stampImgSrc[0] = ''
this.stampImgSrc[1] = pd
break
default:
this.stampImgSrc[0] = ''
this.stampImgSrc[1] = ''
} }
this.editor.txt.html(this.formData.content)
} else { } else {
this.$message({ this.$message({
message: res.msg, message: res.msg,
...@@ -520,6 +251,7 @@ export default { ...@@ -520,6 +251,7 @@ export default {
}) })
} }
}) })
}
}) })
} }
} }
...@@ -527,13 +259,6 @@ export default { ...@@ -527,13 +259,6 @@ export default {
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.stamp-review {
border-style: none;
position: absolute;
right: 15%;
top: 40%;
z-index: 99;
}
.grid-content { .grid-content {
border: 1px solid rgba(100, 100, 100, 0.3); border: 1px solid rgba(100, 100, 100, 0.3);
padding: 0; padding: 0;
...@@ -546,15 +271,6 @@ export default { ...@@ -546,15 +271,6 @@ export default {
text-align:left; text-align:left;
width: 680px; width: 680px;
} }
.cell-textarea {
min-height: 50px;
color: #777;
font-style: oblique;
font-size: 14px;
text-decoration: underline; //下划线
text-underline-offset: 5px; //下划线和文字间距
text-decoration-color: rgba(100, 100, 100, 0.4);
}
::v-deep .w-e-text-container { ::v-deep .w-e-text-container {
height: 560px !important; height: 560px !important;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment