Commit 2602f1e9 by zhangquan

联调

1 parent 6174990f
...@@ -37,3 +37,31 @@ export function exportStatisticsList(data) { ...@@ -37,3 +37,31 @@ export function exportStatisticsList(data) {
data.method = `dj.api.customer.dynamic.record.page.export` data.method = `dj.api.customer.dynamic.record.page.export`
return request(data) return request(data)
} }
//新增内容
export function addContent(data) {
data.method = `${path}material.record.add`
return request(data)
}
//编辑内容
export function updateContent(data) {
data.method = `${path}material.record.update`
return request(data)
}
//获取会员权益/升级和积分商城 门店
export function getAllMerchantList(data) {
data.method = `dj.api.merchant.page`
return request(data, "POST")
}
//获取精品升级/次新车转化/售后众筹 门店
export function getMerchantListByScene(data) {
data.method = `dj.api.scenemerchantref.listShop4sByRef.page`
return request(data)
}
//获取品牌列表
export function getBrandList(data) {
data.method = `dj.api.smartcarlife.common.car.brand.list`
return request(data)
}
<template>
<d2-dialog
:isVisible="dialogVisible"
class="accountDailog"
title="选择品牌"
width="720px"
@confirmDialog="handleAddConfirm"
@closeDialog="handleClose"
>
<div class="tableBox">
<!-- <div style="padding: 10px 50px">
<el-input
v-model="realSearchForm.label"
placeholder="搜索品牌名称"
maxlength="20"
clearable
size="small"
style="width: 300px; margin-right: 12px"
/>
<el-button size="small" type="primary" @click="searchList">
查询
</el-button>
</div> -->
<d2-table
class="table"
ref="brandTable"
:table-params="tableParams"
:tableData="tableData"
:hasPage="false"
>
</d2-table>
</div>
</d2-dialog>
</template>
<script>
import {
getAllMerchantList,
getMerchantListByScene,
getBrandList
} from "@api/contentManager"
import { deepClone } from "@/common/util"
export default {
name: "SelectGoodsTypeDialog",
props: {
dialogVisible: {
type: Boolean,
default: false
},
selectedRecord: {
type: Array,
default: () => []
}
},
data() {
return {
realSearchForm: {
label: ""
},
tableData: [],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
mutiSelectUniqueKey: "id",
mutiSelectName: "brandIndex",
tableColumns: [
{
label: "品牌名称",
prop: "label"
}
]
}
}
},
mounted() {
this.getList()
},
methods: {
getList() {
getBrandList({ label: "奥迪" }).then((res) => {
console.log(res)
if (res?.length) {
this.sourceData = res
this.tableData = res
}
})
},
searchList() {
if (this.realSearchForm.label) {
this.tableData = this.sourceData.filter((item) => {
return item.label?.indexOf(this.realSearchForm.label) > -1
})
} else {
this.tableData = deepClone(this.sourceData)
}
},
changeEvent(e) {
console.log(e)
},
handleAddConfirm() {
const selectItemList =
this.$refs.brandTable?.mutiSelectArr?.[
this.tableParams.mutiSelectName
] || []
if (selectItemList.length) {
this.$emit("confirmDialogFn", selectItemList)
} else {
this.$message.error("请勾选品牌")
}
},
handleClose() {
this.$emit("closeDialogFn")
}
}
}
</script>
<style scoped lang="scss">
.table {
::v-deep .el-table__body-wrapper {
height: 400px;
overflow-y: auto;
}
}
</style>
<template> <template>
<baseDialog <d2-dialog
:is-show.sync="dialogVisible" :isVisible="dialogVisible"
class="accountDailog" class="accountDailog"
:dialogConfig="{ width: '720px' }" title="选择门店"
@handleClick="handleAddConfirm" width="720px"
@confirmDialog="handleAddConfirm"
@closeDialog="handleClose"
> >
<div class="tableBox"> <div class="tableBox">
<div style="padding: 10px 50px"> <div style="padding: 10px 50px">
...@@ -28,7 +30,7 @@ ...@@ -28,7 +30,7 @@
> >
</d2-table> </d2-table>
</div> </div>
</baseDialog> </d2-dialog>
</template> </template>
<script> <script>
...@@ -94,12 +96,15 @@ export default { ...@@ -94,12 +96,15 @@ export default {
const selectItemList = const selectItemList =
this.$refs.merchantTable?.mutiSelectArr?.[ this.$refs.merchantTable?.mutiSelectArr?.[
this.tableParams.mutiSelectName this.tableParams.mutiSelectName
] ] || []
if (selectItemList.length) { if (selectItemList.length) {
this.$emit("confirmDialogFn", selectItemList) this.$emit("confirmDialogFn", selectItemList)
} else { } else {
this.$message("请勾选门店") this.$message.error("请勾选门店")
} }
},
handleClose() {
this.$emit("closeDialogFn")
} }
} }
} }
......
...@@ -2,16 +2,28 @@ ...@@ -2,16 +2,28 @@
<div class="activity-img-box"> <div class="activity-img-box">
<template v-if="imageUrlArr && imageUrlArr.length > 0"> <template v-if="imageUrlArr && imageUrlArr.length > 0">
<div v-for="(item, index) in imageUrlArr" :key="index"> <div v-for="(item, index) in imageUrlArr" :key="index">
<div v-if="picOptions.type == 'video'">
<video
controls
class="pic-box"
:style="{ width: picOptions.width, height: picOptions.height }"
:src="item"
></video>
<div class="pic-pane-close" @click="handleEnlarge(item, 'video')">
<img :src="require('@/assets/view.png')" alt="" />
</div>
</div>
<div <div
class="pic-box" class="pic-box"
:style="{ width: picOptions.width, height: picOptions.height }" :style="{ width: picOptions.width, height: picOptions.height }"
v-else
> >
<img class="photo-activity" :src="item" alt="" /> <img class="photo-activity" :src="item" alt="" />
<div <div
class="mask" class="mask"
:style="{ width: picOptions.width, height: picOptions.height }" :style="{ width: picOptions.width, height: picOptions.height }"
> >
<div class="pic-pane-close" @click="handleEnlarge(item)"> <div class="pic-pane-close" @click="handleEnlarge(item, 'img')">
<img :src="require('@/assets/view.png')" alt="" /> <img :src="require('@/assets/view.png')" alt="" />
</div> </div>
<template v-if="picOptions.isClose"> <template v-if="picOptions.isClose">
...@@ -31,13 +43,15 @@ ...@@ -31,13 +43,15 @@
> >
<div class="upload-img"> <div class="upload-img">
<i class="el-icon-plus avatar-uploader-desc-icon"></i> <i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传照片</div> <div class="avatar-uploader-desc-word">
上传{{ picOptions.type == "video" ? "视频" : "图片" }}
</div>
<input <input
type="file" type="file"
ref="uploadImg" ref="uploadImg"
class="upload-img" class="upload-img"
style="opacity: 0" style="opacity: 0"
accept=".jpg, .jpeg, .png" :accept="picOptions.type == 'video' ? '.mp4' : '.jpg, .jpeg, .png,'"
@change="(e) => handleImgChange(e)" @change="(e) => handleImgChange(e)"
/> />
</div> </div>
...@@ -49,7 +63,7 @@ ...@@ -49,7 +63,7 @@
width="50%" width="50%"
> >
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" /> <img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<!-- <video width="100%" autoplay controls :src="dialogSrc" v-else></video> --> <video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
...@@ -91,7 +105,9 @@ export default { ...@@ -91,7 +105,9 @@ export default {
handleImgChange(e) { handleImgChange(e) {
this.$notify({ this.$notify({
title: "提示", title: "提示",
message: "图片上传中,请稍后" message: `${
this.picOptions.type == "video" ? "视频" : "图片"
}上传中,请稍后`
}) })
var file = e.srcElement.files[0] var file = e.srcElement.files[0]
var reader = new FileReader() var reader = new FileReader()
...@@ -99,11 +115,19 @@ export default { ...@@ -99,11 +115,19 @@ export default {
const limitSize = this.picOptions.limitSize || 10 const limitSize = this.picOptions.limitSize || 10
const isLt = file.size / 1024 / 1024 < limitSize const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) { if (!isLt) {
this.$message.error("上传图片大小不能超过" + limitSize + "MB!") this.$message.error(
`上传${
this.picOptions.type == "video" ? "视频" : "图片"
}大小不能超过${limitSize}MB!`
)
return true return true
} }
if (this.imageUrlArr.length > this.limit) { if (this.imageUrlArr.length > this.limit) {
this.$message.error("最多上传9张图片") this.$message.error(
`最多上传${this.limit}${
this.picOptions.type == "video" ? "个视频" : "张图片"
}`
)
return return
} }
this.$emit("beforeUpload") this.$emit("beforeUpload")
...@@ -113,7 +137,8 @@ export default { ...@@ -113,7 +137,8 @@ export default {
const arrBase64 = imgFile.split(",") const arrBase64 = imgFile.split(",")
const splitStr = file.name.split(".") const splitStr = file.name.split(".")
const fileUrl = splitStr[splitStr.length - 1] + "@" + arrBase64[1] const fileUrl = splitStr[splitStr.length - 1] + "@" + arrBase64[1]
uploadImg({ const _api = this.picOptions.type == "video" ? uploadVideo : uploadImg
_api({
file: fileUrl, file: fileUrl,
compress: this.picOptions.compress || 0 compress: this.picOptions.compress || 0
}) })
...@@ -121,7 +146,9 @@ export default { ...@@ -121,7 +146,9 @@ export default {
if (res) { if (res) {
this.$notify({ this.$notify({
title: "提示", title: "提示",
message: "图片上传成功", message: `${
this.picOptions.type == "video" ? "视频" : "图片"
}上传成功`,
type: "success" type: "success"
}) })
this.imageUrlArr.push(res) this.imageUrlArr.push(res)
...@@ -132,9 +159,9 @@ export default { ...@@ -132,9 +159,9 @@ export default {
}) })
} }
e.target.value = "" e.target.value = ""
this.$refs.uploadImg.value = ""
}) })
.finally((end) => { .finally((end) => {
this.$refs.uploadImg.value = ""
this.$emit("afterUpload", end) this.$emit("afterUpload", end)
}) })
} }
......
<template>
<div class="activity-img-box">
<div class="upload-img">
<el-button
class="avatar-uploader-desc-word"
size="small"
icon="el-icon-puls"
key="btn-i"
:disabled="imageUrlArr && imageUrlArr.length >= limit"
>上传文件</el-button
>
<input
type="file"
ref="uploadImg"
class="upload-img"
style="opacity: 0"
v-if="imageUrlArr && imageUrlArr.length < limit"
accept=".pdf"
@change="(e) => handleImgChange(e)"
/>
</div>
<template v-if="imageUrlArr && imageUrlArr.length > 0">
<div class="file-wrap" v-for="(item, index) in imageUrlArr" :key="index">
<div class="file-box">
<div class="info" v-if="item.imageName">
<img class="logo" :src="require('@/assets/pdf.png')" alt="" />
<span class="name">{{ item.imageName }}</span>
</div>
<div
class="process"
:style="{
width: item.image ? '432px' : (compress * 432) / 100 + 'px'
}"
></div>
</div>
<img
v-if="item.image"
class="del-btn"
:src="require('@/assets/icon-delete.png')"
alt=""
@click="delFile(index)"
/>
</div>
</template>
<el-dialog
class="image-dialog"
:visible.sync="dialogVisibleImg"
:append-to-body="true"
width="50%"
>
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<!-- <video width="100%" autoplay controls :src="dialogSrc" v-else></video> -->
</el-dialog>
</div>
</template>
<script>
import { uploadPDF } from "@/api/sys.base"
export default {
props: {
picOptions: {
type: Object,
default: () => {
return {
width: "104px",
height: "104px",
isClose: true,
limitSize: 10
}
}
},
imageUrlArr: {
type: Array,
default: () => [
{
name: "asdakf.pdf",
url: "sfdsfjskdf.pdf"
}
]
},
limit: {
type: String,
default: "1"
},
index: {
type: Number,
default: -1
}
},
data() {
return {
compress: 0,
dialogVisibleImg: false
}
},
methods: {
// 上传图片
handleImgChange(e) {
this.$notify({
title: "提示",
message: `pdf上传中,请稍后`
})
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = this.picOptions.limitSize || 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error(`上传pdf大小不能超过${limitSize}MB!`)
return true
}
if (this.imageUrlArr.length > this.limit) {
this.$message.error(`最多上传${this.limit}个pdf文件`)
return
}
this.$emit("beforeUpload")
const idx = this.imageUrlArr.length
this.$set(this.imageUrlArr, idx, { imageName: file.name, image: "" })
console.log(this.imageUrlArr, "this.imageUrlArr")
reader.readAsDataURL(file)
reader.onload = (e) => {
const imgFile = e.target.result
const arrBase64 = imgFile.split(",")
const splitStr = file.name.split(".")
const fileUrl = splitStr[splitStr.length - 1] + "@" + arrBase64[1]
uploadPDF({
file: fileUrl,
onProcess: (e) => {
// 上传进度
const { loaded, total } = e
const uploadPrecent = ((loaded / total) * 100) | 0
this.compress = uploadPrecent
}
})
.then((res) => {
if (res) {
this.$notify({
title: "提示",
message: `pdf上传成功`,
type: "success"
})
this.$set(this.imageUrlArr, idx, {
imageName: file.name,
image: res
})
console.log(this.imageUrlArr, "this.imageUrlArr")
this.$emit("change", {
arr: this.imageUrlArr,
key: this.picOptions.key,
index: this.index
})
}
e.target.value = ""
})
.finally((end) => {
this.$refs.uploadImg.value = ""
this.$emit("afterUpload", end)
})
}
},
// 预览图文
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : "img"
},
// 删除图片/视频
delFile(index) {
this.imageUrlArr.splice(index, 1)
this.$emit("change", {
arr: this.imageUrlArr,
key: this.picOptions.key,
id: 1,
index: this.index
})
}
}
}
</script>
<style scoped lang="scss">
.file-wrap {
display: flex;
align-items: center;
.file-box {
width: 432px;
height: 32px;
border-radius: 4px;
position: relative;
.info {
height: inherit;
display: flex;
align-items: center;
margin-left: 8px;
position: relative;
z-index: 1;
.logo {
margin-right: 8px;
}
.name {
color: #1d1d1d;
}
}
.process {
position: absolute;
height: 32px;
left: 0;
top: 0;
background: #f4f6f7;
}
}
.del-btn {
width: 16px;
height: 16px;
cursor: pointer;
margin-left: 10px;
}
}
.activity-img-box {
max-width: 600px;
.pic-box {
position: relative;
width: 104px;
height: 104px;
border-radius: 4px;
margin-right: 8px;
margin-bottom: 5px;
&:hover .mask {
opacity: 1;
}
.pic {
position: absolute;
object-fit: fill;
}
.photo-activity {
position: absolute;
width: 100%;
height: 100%;
}
.mask {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
background: rgba(0, 0, 0, 0.5);
color: #ffffff;
opacity: 0;
top: 0;
right: 0;
width: 104px;
height: 104px;
z-index: 999;
.pic-pane-close {
width: 16px;
height: 16px;
cursor: pointer;
margin-left: 24px;
&:first-child {
margin-left: 0;
}
img {
width: 100%;
display: block;
}
}
}
}
.upload-img {
position: relative;
display: inline-block;
input {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
}
}
.avatar-uploader-desc-word {
font-weight: 400;
font-size: 28rpx;
color: #666666;
margin-bottom: 8px;
}
.image-dialog {
::v-deep {
.el-dialog__header {
border-bottom: 0px;
padding: 0px;
}
}
}
}
</style>
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<div slot="merchantSlot" slot-scope="scope"> <div slot="merchantSlot" slot-scope="scope">
<div v-if="scope.scope.showMerchant == 0">全部门店</div> <div v-if="scope.scope.showMerchant == 0">全部门店</div>
<el-popover v-else placement="top" width="200" trigger="hover"> <el-popover v-else placement="top" width="200" trigger="hover">
<div class="merchant-wrap">
<div <div
class="merchant-name" class="merchant-name"
v-for="(item, index) in scope.scope.assignInfos || []" v-for="(item, index) in scope.scope.assignInfos || []"
...@@ -49,6 +50,7 @@ ...@@ -49,6 +50,7 @@
> >
{{ item.assignName }} {{ item.assignName }}
</div> </div>
</div>
<div slot="reference"> <div slot="reference">
<span class="merchant-num">{{ <span class="merchant-num">{{
scope.scope.assignInfos ? scope.scope.assignInfos.length : 0 scope.scope.assignInfos ? scope.scope.assignInfos.length : 0
...@@ -69,7 +71,7 @@ ...@@ -69,7 +71,7 @@
<el-button type="text" size="mini" @click="handleDetail(scope.scope)"> <el-button type="text" size="mini" @click="handleDetail(scope.scope)">
查看 查看
</el-button> </el-button>
<el-button type="text" size="mini" @click="handleDetail(scope.scope)"> <el-button type="text" size="mini" @click="handleAdd(scope.scope)">
编辑 编辑
</el-button> </el-button>
<el-button <el-button
...@@ -252,7 +254,10 @@ export default { ...@@ -252,7 +254,10 @@ export default {
{ {
label: "浏览次数", label: "浏览次数",
prop: "browseCount", prop: "browseCount",
width: "120px" width: "120px",
formatter: (cell) => {
return cell.browseCount || 0
}
}, },
{ {
label: "状态", label: "状态",
...@@ -323,12 +328,16 @@ export default { ...@@ -323,12 +328,16 @@ export default {
resolve() resolve()
}) })
}, },
handleAdd() { handleAdd(row) {
let params = {
addOrEdit: row?.id ? "edit" : "add"
}
if (row?.id) {
params.id = row.id
}
this.$router.push({ this.$router.push({
name: "contentAdd", name: "contentAdd",
params: { params
addOrEdit: "add"
}
}) })
}, },
handleDetail(row) { handleDetail(row) {
...@@ -432,4 +441,8 @@ export default { ...@@ -432,4 +441,8 @@ export default {
margin-right: 6px; margin-right: 6px;
vertical-align: middle; vertical-align: middle;
} }
.merchant-wrap {
max-height: 400px;
overflow-y: auto;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!