|
|
|
@ -2,6 +2,8 @@
|
|
|
|
import RPC from '@/utils/rpc'
|
|
|
|
import RPC from '@/utils/rpc'
|
|
|
|
import MapSelector from '@/components/MapSelector.vue'
|
|
|
|
import MapSelector from '@/components/MapSelector.vue'
|
|
|
|
import UploadFile from '@/components/UploadFile.vue'
|
|
|
|
import UploadFile from '@/components/UploadFile.vue'
|
|
|
|
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
|
const props = defineProps({
|
|
|
|
const props = defineProps({
|
|
|
|
type: {
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
@ -18,6 +20,10 @@ const emit = defineEmits(['closed', 'onSuccess'])
|
|
|
|
|
|
|
|
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const product_images_list = ref([])
|
|
|
|
|
|
|
|
const qualification_images_list = ref([])
|
|
|
|
|
|
|
|
const product_pdfs_list = ref([])
|
|
|
|
|
|
|
|
|
|
|
|
const isAdd = computed(() => props.type === 'add')
|
|
|
|
const isAdd = computed(() => props.type === 'add')
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
@ -43,8 +49,13 @@ const submitForm = async () => {
|
|
|
|
await formRef.value.validate()
|
|
|
|
await formRef.value.validate()
|
|
|
|
const api = isAdd.value ? '/store/create' : '/store/update'
|
|
|
|
const api = isAdd.value ? '/store/create' : '/store/update'
|
|
|
|
const params = {
|
|
|
|
const params = {
|
|
|
|
store: { ...formField.value },
|
|
|
|
store: {
|
|
|
|
category_ids: formField.value.category_ids,
|
|
|
|
...formField.value,
|
|
|
|
|
|
|
|
product_images: product_images_list.value.join(','),
|
|
|
|
|
|
|
|
qualification_images: qualification_images_list.value.join(','),
|
|
|
|
|
|
|
|
product_pdfs: JSON.stringify(product_pdfs_list.value),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// category_ids: formField.value.category_ids,
|
|
|
|
id: isAdd.value ? null : props.row.id,
|
|
|
|
id: isAdd.value ? null : props.row.id,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RPC.post(api, params)
|
|
|
|
RPC.post(api, params)
|
|
|
|
@ -59,7 +70,14 @@ const submitForm = async () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isAdd.value) {
|
|
|
|
if (!isAdd.value) {
|
|
|
|
formField.value = props.row
|
|
|
|
formField.value = {
|
|
|
|
|
|
|
|
...props.row,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
product_images_list.value = props.row.product_images ? props.row.product_images.split(',') : []
|
|
|
|
|
|
|
|
qualification_images_list.value = props.row.qualification_images
|
|
|
|
|
|
|
|
? props.row.qualification_images.split(',')
|
|
|
|
|
|
|
|
: []
|
|
|
|
|
|
|
|
product_pdfs_list.value = props.row.product_pdfs ? JSON.parse(props.row.product_pdfs) : []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const chooseCoordinates = () => {
|
|
|
|
const chooseCoordinates = () => {
|
|
|
|
@ -77,6 +95,35 @@ const set_main_image = (val) => {
|
|
|
|
console.log('val', val)
|
|
|
|
console.log('val', val)
|
|
|
|
formField.value.main_image = val.fullUrl
|
|
|
|
formField.value.main_image = val.fullUrl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const set_video = (val) => {
|
|
|
|
|
|
|
|
formField.value.video_intro = val.fullUrl
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const set_product_images = (val) => {
|
|
|
|
|
|
|
|
product_images_list.value.push(val.fullUrl)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const set_qualification_images = (val) => {
|
|
|
|
|
|
|
|
qualification_images_list.value.push(val.fullUrl)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const set_product_pdfs = (val, file) => {
|
|
|
|
|
|
|
|
console.log(val, file)
|
|
|
|
|
|
|
|
product_pdfs_list.value.push({
|
|
|
|
|
|
|
|
url: val.fullUrl,
|
|
|
|
|
|
|
|
name: file.name,
|
|
|
|
|
|
|
|
size: (file.size / 1024 / 1024).toFixed(2),
|
|
|
|
|
|
|
|
date: dayjs().format('YYYY-MM-DD HH:mm'),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const delImage = (arr, index) => {
|
|
|
|
|
|
|
|
arr.splice(index, 1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const openPdf = (item) => {
|
|
|
|
|
|
|
|
if (item.url) {
|
|
|
|
|
|
|
|
window.open(item.url)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
@ -100,12 +147,12 @@ const set_main_image = (val) => {
|
|
|
|
<el-form-item prop="store_name" label="门店名称">
|
|
|
|
<el-form-item prop="store_name" label="门店名称">
|
|
|
|
<el-input placeholder="请输入" v-model="formField.store_name" />
|
|
|
|
<el-input placeholder="请输入" v-model="formField.store_name" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="address" label="地址详情">
|
|
|
|
|
|
|
|
<el-input placeholder="请输入" v-model="formField.address" />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item prop="location" label="地区">
|
|
|
|
<el-form-item prop="location" label="地区">
|
|
|
|
<el-input placeholder="请输入" v-model="formField.location" />
|
|
|
|
<el-input placeholder="请输入" v-model="formField.location" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item prop="address" label="地址详情">
|
|
|
|
|
|
|
|
<el-input placeholder="请输入" v-model="formField.address" />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="business_hours" label="工作时间">
|
|
|
|
<el-form-item prop="business_hours" label="工作时间">
|
|
|
|
<el-input placeholder="请输入" v-model="formField.business_hours" />
|
|
|
|
<el-input placeholder="请输入" v-model="formField.business_hours" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
@ -115,7 +162,7 @@ const set_main_image = (val) => {
|
|
|
|
<el-form-item prop="tags" label="分类标签">
|
|
|
|
<el-form-item prop="tags" label="分类标签">
|
|
|
|
<el-input placeholder="请输入,多个以,分隔" v-model="formField.tags" />
|
|
|
|
<el-input placeholder="请输入,多个以,分隔" v-model="formField.tags" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="category_ids" label="分类">
|
|
|
|
<!-- <el-form-item prop="category_ids" label="分类">
|
|
|
|
<el-select
|
|
|
|
<el-select
|
|
|
|
clearable
|
|
|
|
clearable
|
|
|
|
default-first-option
|
|
|
|
default-first-option
|
|
|
|
@ -131,7 +178,7 @@ const set_main_image = (val) => {
|
|
|
|
:value="item.id"
|
|
|
|
:value="item.id"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item> -->
|
|
|
|
<el-form-item prop="main_image" label="门店主图">
|
|
|
|
<el-form-item prop="main_image" label="门店主图">
|
|
|
|
<div class="main_image_box" v-if="formField.main_image">
|
|
|
|
<div class="main_image_box" v-if="formField.main_image">
|
|
|
|
<!-- <img :src="formField.main_image" alt="" /> -->
|
|
|
|
<!-- <img :src="formField.main_image" alt="" /> -->
|
|
|
|
@ -168,6 +215,96 @@ const set_main_image = (val) => {
|
|
|
|
<el-form-item prop="" label="">
|
|
|
|
<el-form-item prop="" label="">
|
|
|
|
<el-button type="primary" @click="chooseCoordinates">选择坐标</el-button>
|
|
|
|
<el-button type="primary" @click="chooseCoordinates">选择坐标</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item prop="video_intro" label="视频">
|
|
|
|
|
|
|
|
<video
|
|
|
|
|
|
|
|
controls
|
|
|
|
|
|
|
|
muted
|
|
|
|
|
|
|
|
:src="formField.video_intro"
|
|
|
|
|
|
|
|
alt=""
|
|
|
|
|
|
|
|
class="video_box"
|
|
|
|
|
|
|
|
v-if="formField.video_intro"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<UploadFile v-else accept="video/*" @on-success="set_video"></UploadFile>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item prop="product_images" label="产品图片">
|
|
|
|
|
|
|
|
<VueDraggable ghost-class="ghost" target=".sort-target" v-model="product_images_list">
|
|
|
|
|
|
|
|
<TransitionGroup class="sort-target" name="list" tag="div">
|
|
|
|
|
|
|
|
<div class="imgBox" v-for="(item, index) in product_images_list" :key="item">
|
|
|
|
|
|
|
|
<el-image
|
|
|
|
|
|
|
|
ref="imageRef"
|
|
|
|
|
|
|
|
style="width: 100%; height: 100%"
|
|
|
|
|
|
|
|
:src="item"
|
|
|
|
|
|
|
|
show-progress
|
|
|
|
|
|
|
|
:preview-src-list="[item]"
|
|
|
|
|
|
|
|
fit="cover"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div class="closeBox" @click="delImage(product_images_list, index)">
|
|
|
|
|
|
|
|
<el-icon size="20"><CircleClose /></el-icon>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</TransitionGroup>
|
|
|
|
|
|
|
|
</VueDraggable>
|
|
|
|
|
|
|
|
<UploadFile @on-success="set_product_images"></UploadFile>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item prop="qualification_images" label="企业资质">
|
|
|
|
|
|
|
|
<VueDraggable
|
|
|
|
|
|
|
|
ghost-class="ghost"
|
|
|
|
|
|
|
|
target=".sort-target2"
|
|
|
|
|
|
|
|
v-model="qualification_images_list"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<TransitionGroup class="sort-target2" name="list" tag="div">
|
|
|
|
|
|
|
|
<div class="imgBox" v-for="(item, index) in qualification_images_list" :key="item">
|
|
|
|
|
|
|
|
<el-image
|
|
|
|
|
|
|
|
ref="imageRef"
|
|
|
|
|
|
|
|
style="width: 100%; height: 100%"
|
|
|
|
|
|
|
|
:src="item"
|
|
|
|
|
|
|
|
show-progress
|
|
|
|
|
|
|
|
:preview-src-list="[item]"
|
|
|
|
|
|
|
|
fit="cover"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div class="closeBox" @click="delImage(qualification_images_list, index)">
|
|
|
|
|
|
|
|
<el-icon size="20"><CircleClose /></el-icon>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</TransitionGroup>
|
|
|
|
|
|
|
|
</VueDraggable>
|
|
|
|
|
|
|
|
<UploadFile @on-success="set_qualification_images"></UploadFile>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item prop="product_pdfs" label="产品资料PDF">
|
|
|
|
|
|
|
|
<VueDraggable ghost-class="ghost" target=".sort-target-pdf" v-model="product_pdfs_list">
|
|
|
|
|
|
|
|
<TransitionGroup class="sort-target-pdf" name="list" tag="div">
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
|
|
class="pdfBox"
|
|
|
|
|
|
|
|
v-for="item in product_pdfs_list"
|
|
|
|
|
|
|
|
@click="openPdf(item)"
|
|
|
|
|
|
|
|
:key="item"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<div class="pdf_item">
|
|
|
|
|
|
|
|
<el-icon size="40"><Document /></el-icon>
|
|
|
|
|
|
|
|
<div class="name">{{ item.name }}</div>
|
|
|
|
|
|
|
|
<div class="info">
|
|
|
|
|
|
|
|
<div class="size">{{ item.size }}MB</div>
|
|
|
|
|
|
|
|
<div class="date">{{ item.date }}</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="closeBox">
|
|
|
|
|
|
|
|
<el-icon
|
|
|
|
|
|
|
|
size="20"
|
|
|
|
|
|
|
|
@click="
|
|
|
|
|
|
|
|
() =>
|
|
|
|
|
|
|
|
(product_pdfs_list = product_pdfs_list.filter((ele) => ele.url !== item.url))
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
><CircleClose
|
|
|
|
|
|
|
|
/></el-icon>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</TransitionGroup>
|
|
|
|
|
|
|
|
</VueDraggable>
|
|
|
|
|
|
|
|
<div class="pdfBox">
|
|
|
|
|
|
|
|
<UploadFile accept="pdf" @on-success="set_product_pdfs"></UploadFile>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
@ -203,4 +340,81 @@ const set_main_image = (val) => {
|
|
|
|
cursor: pointer;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.video_box {
|
|
|
|
|
|
|
|
width: 370px;
|
|
|
|
|
|
|
|
height: 130px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.sort-target,
|
|
|
|
|
|
|
|
.sort-target2,
|
|
|
|
|
|
|
|
.sort-target-pdf {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.imgBox {
|
|
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
|
|
height: 200px;
|
|
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
.closeBox {
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.list-enter-active,
|
|
|
|
|
|
|
|
.list-leave-active {
|
|
|
|
|
|
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.list-enter-from,
|
|
|
|
|
|
|
|
.list-leave-to {
|
|
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
|
|
transform: scale(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ghost {
|
|
|
|
|
|
|
|
opacity: 0.5;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.pdfBox {
|
|
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
|
|
height: 100px;
|
|
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
.closeBox {
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.pdf_item {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
height: 99%;
|
|
|
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
.name {
|
|
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.info {
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
|