Commit 434d1c8e by wangql
2 parents 64e569e9 b4bc6e89
......@@ -83,7 +83,7 @@ html {
}
.marketing .wechat-container {
width: 375px;
width: 290px;
margin-left: 32px;
background: #ffffff;
position: relative;
......@@ -94,7 +94,7 @@ html {
}
.marketing .wechat-container .wechat-box {
width: 375px;
width: 290px;
border: 1px solid #cecece;
// width: 100%;
border-radius: 2px;
......@@ -181,6 +181,10 @@ html {
z-index: 999;
}
.marketing .flex-default {
display: flex;
}
.marketing .flex {
display: flex;
justify-content: space-between;
......
......@@ -11,26 +11,26 @@
<el-button type="text" @click="handleImgDown(editForm[scope.scope.name])">下载</el-button>
</template>
<template slot="bannerBtn">
<el-button type="primary" @click="handleBannerAdd">新增banner</el-button>
<el-button type="primary" :size="size" @click="handleBannerAdd">新增banner</el-button>
</template>
<div :style="{ 'margin-left': labelWidth }" slot="bannerList" slot-scope="scope">
<div v-for="(subItem, subIndex) in editForm[scope.scope.name]" :key="subIndex" class="flex">
<!-- 上传图片 -->
<div class="banner-upload-box">
<div class="p-t-12">
<div class="">
<div class="flex">
<div v-show="!subItem.bannerImg" class="activity-img img-w-h" style="margin-bottom: 11px;">
<div v-show="!subItem.bannerImg" class="activity-img home-img-w-h" style="margin-bottom: 11px;">
<div class="add">+</div>
<span class="number">上传</span>
<input type="file" style="opacity: 0;" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleImgChange(e, subIndex)" />
<input type="file" style="opacity: 0;" ref="file" class="activity-img home-img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleImgChange(e, subIndex)" />
</div>
<div v-show="!subItem.bannerImg">
<el-button type="text" class="el-icon-delete" @click="handleBannerDelete(subIndex)"></el-button>
</div>
</div>
<span v-show="subItem.bannerImg" class="muti-imgs">
<img class="img-w-h" :src="subItem.bannerImg" />
<span class="img-btns">
<img class="home-img-w-h" :src="subItem.bannerImg" />
<span class="img-btns home-img-w-h">
<span class="btn-item">
<i class="el-icon-delete" @click="handleImgDelete(scope.scope.name, subIndex)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.bannerImg)"></i>
......@@ -38,25 +38,71 @@
</span>
</span>
</div>
<p class="edit-tips">支持上传10MB以内的jpg,png,jpeg图片</p>
</div>
<!-- 选择商品 -->
<div v-show="subItem.bannerImg" class="flex-grow">
<div>
<span>商品链接:</span>
<el-button v-show="!subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">选择</el-button>
<el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">更换</el-button>
<el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleProDelete(subIndex)">删除</el-button>
</div>
<div class="show-pro-box flex" v-if="subItem.goodsId">
<img class="img-60" :src="subItem.goods.goodsImage" />
<p class="pro-txt flex-grow one-line-ellipsis">{{ subItem.goods.goodsName }}</p>
<div v-if="subItem.bannerImg" class="flex-grow">
<div class="flex-default">
<span>banner链接</span>
<div class="banner-link">
<el-radio-group v-model="subItem.bannerType">
<el-radio v-for="(m, n) in bannerRadioList" :key="n" :label="m.confId">{{m.confName}}</el-radio>
</el-radio-group>
<div v-show="subItem.bannerType != '0'" class="link-block">
<div v-show="(subItem.bannerType == '1' && !subItem.goodsId) || (subItem.bannerType == '2' && !subItem.imgLinkUrl) || (subItem.bannerType == '3' && !subItem.videoLinkUrl)">
<el-button class="banner-btn" type="primary" :size="size" @click="handleBnnerLinkClick(scope.scope, subIndex)">选择
<input v-if="subItem.bannerType == '2'" type="file" ref="file" class="upload-btn" accept="image/png, image/jpeg, image/jpg" @change="e => handleUploadChange(e, item)" />
<input v-if="subItem.bannerType == '3'" type="file" ref="file" class="upload-btn" accept="video/mp4" @change="e => handleUploadVideoChange(e, item)" />
</el-button>
<p class="banner-tips-txt">点击banner后跳转{{subItem.bannerType == '1' ? '商品' : (subItem.bannerType == '2' ? '图文介绍' : '视频介绍')}}</p>
</div>
<!-- 选择商品 -->
<div v-show="subItem.bannerType == '1' && subItem.goodsId" class="flex-grow">
<div class="show-pro-box flex" v-if="subItem.goodsId">
<img class="img-56" :src="subItem.goods.goodsImage" />
<div class="flex-grow pro-txt">
<p class="one-line-ellipsis" :title="subItem.goods.goodsName">{{ subItem.goods.goodsName }}</p>
<div>
<!-- <span>商品链接:</span> -->
<!-- <el-button v-show="!subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">选择</el-button> -->
<el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleSinglePro(scope.scope, subIndex)">更换</el-button>
<el-button v-show="subItem.goodsId" type="text" class="btn-link" @click="handleProDelete(subIndex)">删除</el-button>
</div>
</div>
</div>
</div>
<!-- 图文介绍 -->
<div v-show="subItem.bannerType == '2' && subItem.imgLinkUrl" class="m-t-8">
<span class="muti-imgs">
<img class="img-56" :src="subItem.imgLinkUrl" />
<span class="img-btns img-56">
<span class="btn-item">
<i class="el-icon-delete" @click="handleBannerItemDelete(subIndex, 'imgLinkUrl')"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.imgLinkUrl)"></i>
</span>
</span>
</span>
</div>
<!-- 视频介绍 -->
<div v-show="subItem.bannerType == '3' && subItem.videoLinkUrl" class="m-t-8">
<span class="muti-imgs">
<video class="img-56 activity-img" :src="subItem.videoLinkUrl"></video>
<span class="img-btns img-56">
<span class="btn-item">
<i class="el-icon-delete" @click="handleBannerItemDelete(subIndex, 'videoLinkUrl')"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.videoLinkUrl, 'video')"></i>
</span>
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="edit-tips">最多支持4张banner,图片格式仅支持JPG,PNG格式</p>
<p class="edit-tips">建议尺寸660*270px,大小10M以内</p>
</div>
<template slot="onlineService">
<el-button type="primary">请选择</el-button>
<el-button :size="size">+选择客服</el-button>
</template>
</glsx-combi-form>
</div>
......@@ -72,8 +118,11 @@
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
<select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose"></select-single-pro-dialog>
<el-dialog :visible.sync="isImgVisible">
<img class="dialog-img" width="100%" :src="dialogImageUrl" alt="" />
<el-dialog v-if="isImgVisible" :visible.sync="isImgVisible" class="dialog-look">
<video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls>
<source :src="dialogObj.url" type="video/mp4">
</video>
<img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" />
</el-dialog>
</div>
</template>
......@@ -85,9 +134,14 @@ export default {
return {
footerLeft: '0',
footerWidth: '0',
size: 'small',
// 查看大图
isImgVisible: false,
dialogImageUrl: '',
dialogObj: {
url: '',
uploadType: 'img'
},
// dialogImageUrl: '',
// 商品选择
isSingleSelectVisible: false,
curBanner: {
......@@ -99,17 +153,27 @@ export default {
editForm: {
merchantQrcode: '',
noticeContent: '',
preferentialPolicy: '',
bannerList: []
},
bannerItem: {
bannerImg: '',
goodsId: '',
bannerType: '0',
linkUrl: '',
videoLinkUrl: '',
imgLinkUrl: '',
goods: {
id: '',
goodsName: '',
goodsImage: ''
}
},
bannerRadioList: [
{ confId: '1', confName: '商品' },
{ confId: '2', confName: '图文介绍' },
{ confId: '3', confName: '视频介绍' }
],
labelWidth: '110px',
externalFormList: [
{
......@@ -145,33 +209,34 @@ export default {
label: '门店公告',
name: 'noticeContent',
type: 'input',
rows: '4',
inputType: 'textarea',
maxlength: '50'
}
]
},
{
title: '新车优惠政策',
editFormData: [
{
label: '优惠政策',
name: 'preferentialPolicy',
type: 'input',
rows: '4',
inputType: 'textarea',
maxlength: '300'
}
]
},
{
title: '在线客服',
editFormData: [
{
label: '',
addHtml: 'onlineService'
}
]
}
// {
// title: '新车优惠政策',
// editFormData: [
// {
// label: '优惠政策',
// name: 'police',
// type: 'input',
// inputType: 'textarea',
// width: '320px',
// maxlength: '300'
// }
// ]
// },
// {
// title: '在线客服',
// editFormData: [
// {
// label: '',
// addHtml: 'onlineService'
// }
// ]
// }
]
}
},
......@@ -185,6 +250,7 @@ export default {
methods: {
getInfo() {
this.$apis.homeSet.getHomeInfoListApi({}).then(res => {
console.log(res)
this.editForm.bannerList = []
this.editForm.noticeContent = res.noticeContent
this.editForm.merchantQrcode = res.merchantQrcode
......@@ -192,7 +258,17 @@ export default {
res.bannerList.forEach(item => {
var params = {
bannerImg: item.bannerImg,
goodsId: item.goods ? item.goods.id : ''
goodsId: item.goods ? item.goods.id : '',
bannerType: item.bannerType + '',
linkUrl: item.linkUrl,
imgLinkUrl: '',
videoLinkUrl: ''
}
if(item.bannerType == '2') {
params.imgLinkUrl = item.linkUrl
}
if(item.bannerType == '3') {
params.videoLinkUrl = item.linkUrl
}
if (item.goods) {
params.goods = {
......@@ -223,9 +299,13 @@ export default {
})
},
// 图片查看
handleImgLook(src) {
handleImgLook(src, uploadType) {
this.isImgVisible = true
this.dialogImageUrl = src
// this.dialogImageUrl = src
this.dialogObj = {
url: src,
uploadType: uploadType || 'img'
}
},
handleBannerAdd() {
if (this.editForm.bannerList.length >= 4) {
......@@ -242,6 +322,7 @@ export default {
},
handleProDelete(idx) {
this.editForm.bannerList[idx].goodsId = ''
this.editForm.bannerList[idx].bannerType = '0'
this.editForm.bannerList[idx].goods = {}
},
handleImgChange(e, idx) {
......@@ -266,11 +347,80 @@ export default {
})
}
},
// 商品选择
handleSinglePro(targetItem, idx) {
handleBnnerLinkClick(targetItem, idx) {
this.curBanner.idx = idx
this.curBanner.targetItem = targetItem
this.selectedProInfo = this.editForm.bannerList[idx].goods ? this.$common.utils.deepClone(this.editForm.bannerList[idx].goods) : {}
switch(this.editForm.bannerList[idx].bannerType) {
case '1':
this.handleSinglePro()
break;
case '2':
break;
case '3':
console.log('视频介绍')
break;
}
},
// banner - 图片上传
handleUploadChange(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
var uploadType = 'img'
// 默认1MB
const limitSize = 30
const isLt = file.size / 1024 / 1024 < limitSize
const isType = ['image/jpeg', 'image/png', 'image/jpg'].includes(file.type)
if (!isType) {
this.$message.error('上传图片不是jpg、jpeg或png的格式!')
return true
}
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm.bannerList[this.curBanner.idx].imgLinkUrl = res
})
}
},
// 视频上传
handleUploadVideoChange(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
// 默认1MB
const limitSize = 200
const isLt = file.size / 1024 / 1024 < limitSize
const isType = ['video/mp4'].includes(file.type)
if (!isType) {
this.$message.error('上传视频不是MP4的格式!')
return true
}
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadVideoApi({ file: base64 }).then(res => {
this.editForm.bannerList[this.curBanner.idx].videoLinkUrl = res
})
}
},
handleBannerItemDelete(idx, linkName) {
this.editForm.bannerList[idx][linkName] = ''
this.editForm.bannerList[idx].bannerType = '0'
},
// 商品选择-start
handleSinglePro() {
// this.curBanner.idx = idx
// this.curBanner.targetItem = targetItem
this.selectedProInfo = this.editForm.bannerList[this.curBanner.idx].goods ? this.$common.utils.deepClone(this.editForm.bannerList[this.curBanner.idx].goods) : {}
// this.editForm[targetItem.name][idx].goods ? (this.selectedProInfo = this.$common.utils.deepClone(this.editForm[targetItem.name][idx].goods)) : ''
this.handleSingleSelectClose()
},
......@@ -283,12 +433,42 @@ export default {
handleSingleSelectClose() {
this.isSingleSelectVisible = !this.isSingleSelectVisible
},
// 商品选择-end
handleConfirm() {
this.$apis.homeSet.updateHomeApi(this.editForm).then(res => {
var params = this.$common.utils.deepClone(this.editForm)
params.bannerList = []
this.editForm.bannerList.forEach((item, idx) => {
params.bannerList.push({
bannerImg: item.bannerImg,
goodsId: '',
bannerType: +item.bannerType,
linkUrl: '',
goods: {}
})
if(item.bannerType == '1' && item.goodsId) {
params.bannerList[idx].goodsId = item.goodsId
params.bannerList[idx].goods = {
id: item.goods.id,
goodsName: item.goods.goodsName,
goodsImage: item.goods.goodsImage
}
}
if(item.bannerType == '2' && item.imgLinkUrl) {
params.bannerList[idx].linkUrl = item.imgLinkUrl
}
if(item.bannerType == '3' && item.videoLinkUrl) {
params.bannerList[idx].linkUrl = item.videoLinkUrl
}
if((item.bannerType == '1' && !item.goodsId) || (item.bannerType == '2' && !item.imgLinkUrl) || (item.bannerType == '3' && !item.videoLinkUrl)) {
params.bannerList[idx].bannerType = 0
}
})
this.$apis.homeSet.updateHomeApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
this.getInfo()
})
}
}
......@@ -298,6 +478,10 @@ export default {
.home-set .container {
padding: 30px;
}
.home-set .home-img-w-h {
width: 264px;
height: 108px;
}
/* .wechat-container {
width: 375px;
margin-right: 45px;
......@@ -313,20 +497,66 @@ export default {
border-radius: 2px;
} */
.home-set .banner-upload-box {
width: 140px;
margin-bottom: 10px;
width: 264px;
/* margin: 0 10px 10px 0; */
margin-right: 10px;
}
.home-set .edit-tips {
line-height: 18px;
font-size: 13px;
color: #666666;
width: 240px;
width: 300px;
}
.home-set .show-pro-box {
padding: 8px 12px;
}
.home-set .img-56 {
width: 56px;
height: 56px;
/* margin-right: 12px; */
}
.home-set .m-t-8 {
margin-top: 8px;
}
.home-set .show-pro-box .pro-txt {
margin-left: 20px;
width: 200px;
width: 154px;
text-align: left;
margin-left: 12px;
}
.home-set .p-t-12 {
padding-top: 12px;
}
.home-set .banner-link {
width: 246px;
margin-left: 20px;
}
.home-set .banner-link .el-radio {
margin-right: 17px;
}
.home-set .banner-link .el-radio:last-child {
margin-right: 0;
}
.home-set .link-block {
width: 100%;
height: 72px;
text-align: center;
background-color: #F7F7F7;
border: 1px solid #DCDFE6;
}
.home-set .link-block .banner-btn {
position: relative;
margin-top: 12px;
}
.home-set .link-block .upload-btn {
position: absolute;
width: 62px;
height: 32px;
left: 0;
top: 0;
opacity: 0;
cursor: pointer;
}
.home-set .link-block .banner-tips-txt {
color: #999999;
}
</style>
......@@ -114,6 +114,7 @@ export default {
{
label: '浏览量(次)',
name: 'goodsStatistics',
width: '180',
formatter: cellValue => {
return cellValue.goodsStatistics ? cellValue.goodsStatistics.viewAmount || '0' : '0'
}
......@@ -128,6 +129,7 @@ export default {
{
label: '零售价(元)',
name: 'retailPrice',
width: '180',
formatter: cellValue => {
return (cellValue.retailPrice / 100).toFixed(2)
}
......
......@@ -118,6 +118,7 @@ export default {
{
label: '浏览量(次)',
name: 'goodsStatistics',
width: '180',
formatter: cellValue => {
return cellValue.goodsStatistics ? cellValue.goodsStatistics.viewAmount || '0' : '0'
}
......@@ -132,6 +133,7 @@ export default {
{
label: '零售价(元)',
name: 'retailPrice',
width: '180',
formatter: cellValue => {
return (cellValue.retailPrice / 100).toFixed(2)
}
......
......@@ -19,9 +19,6 @@
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleEdit(2, scope.scope)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
<!-- <el-button type="text" @click="handleDelete(scope.scope)">隐藏</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">显示</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">置顶</el-button> -->
</div>
</GLTable>
<!-- 表格区域 end -->
......@@ -75,10 +72,6 @@ export default {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
}
// {
// label: '专区来源',
// prop: ''
// }
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!