新增商品魔方
parent
f2b19e2065
commit
baa8d654bf
|
|
@ -0,0 +1,13 @@
|
|||
import request from '@/utils/request';
|
||||
|
||||
class CustomAPI {
|
||||
/** 分类品牌查询接口*/
|
||||
static getGoodsmagicinit() {
|
||||
return request({
|
||||
url: `diyapi/goodsmagicinit`,
|
||||
method: 'post',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default CustomAPI;
|
||||
|
|
@ -247,15 +247,18 @@ const getCustominit = () => {
|
|||
const { data_source } = res.data;
|
||||
options.value = data_source;
|
||||
data_source_store.set_data_source(data_source);
|
||||
data_source_store.set_is_data_source_api(true);
|
||||
// 数据处理
|
||||
processing_data(form.value.data_source);
|
||||
data_processing();
|
||||
}).catch((err) => {
|
||||
data_source_store.set_is_data_source_api(false);
|
||||
});
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
// 如果没有数据源,那么就请求一次数据源
|
||||
if (!data_source_store.is_data_source_api) {
|
||||
data_source_store.set_is_data_source_api(true);
|
||||
getCustominit();
|
||||
} else {
|
||||
options.value = data_source_store.data_source_list;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,10 @@
|
|||
<template v-else-if="item.key == 'custom'">
|
||||
<model-custom :key="item.com_data" :value="item.com_data" :outer-container-padding="outerContainerPadding"></model-custom>
|
||||
</template>
|
||||
<!-- 商品魔方 -->
|
||||
<template v-else-if="item.key == 'goods-magic'">
|
||||
<model-goods-magic :key="item.com_data" :value="item.com_data"></model-goods-magic>
|
||||
</template>
|
||||
<!-- 营销组件 -->
|
||||
<!-- 优惠券 -->
|
||||
<template v-else-if="item.key == 'coupon'">
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@
|
|||
<card-container class="card-container">
|
||||
<div class="mb-12">数据设置</div>
|
||||
<div class="flex-col">
|
||||
<el-form-item label="读取方式">
|
||||
<!-- 筛选数据只有一条的时候,并且显示为true的时候才显示,否则的话不显示数据 -->
|
||||
<el-form-item v-if="(default_type_data.data_type.length == 1 && default_type_data.is_type_show) || default_type_data.data_type.length > 1" label="读取方式">
|
||||
<el-radio-group v-model="form.data_source_content.data_type">
|
||||
<el-radio v-for="(item, index) in default_type_data.data_type" :key="index" :value="item">{{ +item === 0 ? '指定数据' : '筛选数据' }}</el-radio>
|
||||
</el-radio-group>
|
||||
|
|
@ -227,6 +228,7 @@ interface custom_config {
|
|||
show_type: string[],
|
||||
show_number: number[],
|
||||
data_type: string[],
|
||||
is_type_show: boolean,
|
||||
filter_config: object,
|
||||
appoint_config: object,
|
||||
}
|
||||
|
|
@ -249,15 +251,20 @@ const getCustominit = () => {
|
|||
const { data_source } = res.data;
|
||||
options.value = data_source;
|
||||
data_source_store.set_data_source(data_source);
|
||||
// 接口成功之后设置true
|
||||
data_source_store.set_is_data_source_api(true);
|
||||
// 数据处理
|
||||
processing_data(form.value.data_source);
|
||||
data_processing();
|
||||
}).catch((err) => {
|
||||
// 接口成功之后设置为false,下次仍旧获取数据
|
||||
data_source_store.set_is_data_source_api(false);
|
||||
});
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
// 如果没有数据源,那么就请求一次接口, 获取数据源
|
||||
if (!data_source_store.is_data_source_api) {
|
||||
data_source_store.set_is_data_source_api(true);
|
||||
getCustominit();
|
||||
} else {
|
||||
options.value = data_source_store.data_source_list;
|
||||
|
|
@ -280,6 +287,7 @@ const data_processing = () => {
|
|||
show_type: custom_config?.show_type || ['vertical', 'vertical-scroll', 'horizontal'],
|
||||
show_number: custom_config?.show_number || [1, 2, 3, 4],
|
||||
data_type: custom_config?.data_type || [0, 1],
|
||||
is_type_show: custom_config?.is_type_show || true,
|
||||
};
|
||||
filter_data_handling('old');
|
||||
default_data();
|
||||
|
|
@ -337,7 +345,7 @@ const filter_data_handling = (type: string = 'old') => {
|
|||
data_type: type == 'old'? (form.value.data_source_content?.data_type ?? data_type) : data_type,
|
||||
};
|
||||
let new_data_field = {};
|
||||
// 根据不同的数据初始化不同的内容
|
||||
// 根据不同的数据初始化不同的内容, 两个处理看似一样,实际上是后边的覆盖前面的内容,避免老数据没有更新
|
||||
if (staging_data.data_type === 0) {
|
||||
// 如果是手动模式,就取手动模式的数据为默认数据,避免两者重复导致数据冲突
|
||||
new_data_field = {
|
||||
|
|
@ -378,6 +386,7 @@ const url_value_dialog_visible = ref(false);
|
|||
const default_type_data = ref<any>({})
|
||||
const url_value_multiple_bool = ref(true);
|
||||
const emits = defineEmits(['data_source_change']);
|
||||
// 动态数据切换时触发的逻辑
|
||||
const changeDataSource = (key: string) => {
|
||||
form.value.is_custom_data = '0';
|
||||
const type_data = options.value.filter((item) => item.type == key);
|
||||
|
|
@ -409,6 +418,7 @@ const changeDataSource = (key: string) => {
|
|||
show_type: custom_config?.show_type || ['vertical', 'vertical-scroll', 'horizontal'],
|
||||
show_number: custom_config?.show_number || [1, 2, 3, 4],
|
||||
data_type: custom_config?.data_type || [0, 1],
|
||||
is_type_show: custom_config?.is_type_show || true,
|
||||
};
|
||||
// 默认数据处理
|
||||
default_data();
|
||||
|
|
@ -478,6 +488,7 @@ const url_value_dialog_call_back = (item: any[]) => {
|
|||
}
|
||||
data_list_index_update();
|
||||
};
|
||||
// 更新索引, 避免添加多条时,索引不连续
|
||||
const data_list_index_update = () => {
|
||||
if (form.value.data_source_content.data_list.length > 0) {
|
||||
form.value.data_source_content.data_list.forEach((item: any, index: number) => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,554 @@
|
|||
<template>
|
||||
<div class="oh" :style="style_container">
|
||||
<div :style="style_img_container">
|
||||
<div :class="outer_class" :style="onter_style">
|
||||
<template v-if="!['5'].includes(theme)">
|
||||
<div v-for="(item, index) in data_source_content_list" :key="index" class="re oh" :class="layout_type" :style="layout_style">
|
||||
<div :class="['oh w h', ['0', '4'].includes(theme) ? 'flex-row' : 'flex-col' ]" :style="layout_img_style">
|
||||
<template v-if="theme == '6'">
|
||||
<div :class="['flex-row align-c jc-sb ptb-15 mlr-10 gap-20', { 'br-b-e': index != list.length - 1 }]">
|
||||
<div v-if="is_show('title')" :class="text_line" :style="trends_config('title', 'title')">{{ item.title }}</div>
|
||||
<div v-if="is_show('price') && !isEmpty(item.min_price)" class="num nowrap" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span class="identifying">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" class="identifying">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="!isEmpty(item)">
|
||||
<div class="oh re" :class="`flex-img${theme}`">
|
||||
<template v-if="!isEmpty(item.new_cover)">
|
||||
<image-empty v-model="item.new_cover[0]" :class="`flex-img${theme}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.images" :class="`flex-img${theme}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<!-- 角标 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="is_show('title') || is_show('simple_desc') || is_show('price') || is_show('original_price') || is_show('sales_count') || is_show('plugins_view_icon') || form.is_shop_show == '1'" class="flex-col flex-1 jc-sb content gap-10" :style="content_style">
|
||||
<div class="flex-col gap-10 top-title">
|
||||
<div v-if="is_show('title') || (['0', '1', '2', '3', '5'].includes(theme) && is_show('simple_desc'))" class="flex-col" :style="`gap: ${ new_style.title_simple_desc_spacing }px;`">
|
||||
<div v-if="is_show('title')" :class="text_line" :style="trends_config('title', 'title')">{{ item.title }}</div>
|
||||
<div v-if="['0', '1', '2', '3', '5'].includes(theme) && is_show('simple_desc')" :class="form.simple_desc_row == '2' ? 'text-line-2' : 'text-line-1'" :style="trends_config('simple_desc', 'desc')">{{ item.simple_desc }}</div>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('plugins_view_icon') && !isEmpty(item.plugins_view_icon_data)" class="flex-row gap-5 align-c">
|
||||
<div v-for="(icon_data, icon_index) in item.plugins_view_icon_data" :key="icon_index" class="radius-sm size-9 pl-3 pr-3" :style="icon_style(icon_data)">{{ icon_data.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!['3', '4', '5'].includes(form.theme)" class="flex-col gap-5 oh">
|
||||
<div :class="[form.is_price_solo == '1' ? 'flex-row align-c nowrap' : 'flex-col gap-5']">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-10 flex">
|
||||
<!-- <img class="original-price-left" :src="form.static_img[0].url" /> -->
|
||||
<span :class="['original-price text-line-1', { 'flex-1': form.is_price_solo == '1' }]" :style="trends_config('original_price')">{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-row jc-sb align-e">
|
||||
<div>
|
||||
<div v-if="show_content" class="flex-row align-c size-10">
|
||||
<div v-if="is_show('sales_count')" class="pr-5" :style="trends_config('sold_number')">已售{{ item.sales_count }}件</div>
|
||||
<!-- <div v-if="is_show('sales_count')" :class="['pr-5', {'br-r-e': is_show('sales_count') && is_show('4')}]" :style="trends_config('sold_number')">已售{{ item.sales_count }}件</div> -->
|
||||
<!-- <div v-if="is_show('4')" class="pl-5" :style="trends_config('score')">评分0</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="(form.is_shop_show == '1' && form.shop_button_effect == '1' && item.is_error == 0) || (form.is_shop_show == '1' && form.shop_button_effect == '0')">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="flex-row align-c jc-sb">
|
||||
<div class="flex-row align-c nowrap">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-10 flex">
|
||||
<!-- <img class="original-price-left" :src="form.static_img[0].url" /> -->
|
||||
<span :class="['original-price text-line-1', { 'flex-1': form.is_price_solo == '1' }]" :style="trends_config('original_price')">{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="(form.is_shop_show == '1' && form.shop_button_effect == '1' && item.is_error == 0) || (form.is_shop_show == '1' && form.shop_button_effect == '0')">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<swiper :key="carouselKey" class="w flex" direction="horizontal" :loop="true" :autoplay="autoplay" :slides-per-view="form.carousel_col" :slides-per-group="slides_per_group" :allow-touch-move="false" :space-between="content_outer_spacing" :pause-on-mouse-enter="true" :modules="modules">
|
||||
<swiper-slide v-for="(item, index) in data_source_content_list" :key="index">
|
||||
<div :class="layout_type" :style="layout_style">
|
||||
<div :class="['oh w h', ['0', '4'].includes(theme) ? 'flex-row' : 'flex-col' ]" :style="layout_img_style">
|
||||
<template v-if="!isEmpty(item)">
|
||||
<div class="oh re" :class="`flex-img${theme}`">
|
||||
<template v-if="!isEmpty(item.new_cover)">
|
||||
<image-empty v-model="item.new_cover[0]" :class="`flex-img${theme}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.images" :class="`flex-img${theme}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<!-- 角标 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="is_show('title') || is_show('simple_desc') || is_show('price') || form.is_shop_show == '1'" class="flex-col flex-1 jc-sb content gap-10" :style="content_style">
|
||||
<div class="flex-col gap-10 top-title">
|
||||
<div v-if="is_show('title') || (['0', '1', '2', '3', '5'].includes(theme) && is_show('simple_desc'))" class="flex-col" :style="`gap: ${ new_style.title_simple_desc_spacing }px;`">
|
||||
<div v-if="is_show('title')" :class="text_line" :style="trends_config('title', 'title')">{{ item.title }}</div>
|
||||
<div v-if="['0', '1', '2', '3', '5'].includes(theme) && is_show('simple_desc')" :class="form.simple_desc_row == '2' ? 'text-line-2' : 'text-line-1'" :style="trends_config('simple_desc', 'desc')">{{ item.simple_desc }}</div>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('plugins_view_icon') && !isEmpty(item.plugins_view_icon_data)" class="flex-row gap-5 align-c">
|
||||
<div v-for="(icon_data, icon_index) in item.plugins_view_icon_data" :key="icon_index" class="radius-sm size-9 pl-3 pr-3" :style="icon_style(icon_data)">{{ icon_data.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-row align-c jc-sb">
|
||||
<div class="flex-row align-c nowrap">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-10 flex">
|
||||
<!-- <img class="original-price-left" :src="form.static_img[0].url" /> -->
|
||||
<span :class="['original-price text-line-1', { 'flex-1': form.is_price_solo == '1' }]" :style="trends_config('original_price')">{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="(form.is_shop_show == '1' && form.shop_button_effect == '1' && item.is_error == 0) || (form.is_shop_show == '1' && form.shop_button_effect == '0')">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
</swiper>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { common_img_computer, common_styles_computer, get_math, gradient_handle, padding_computer, radius_computer, background_computer, border_computer, box_shadow_computer, margin_computer } from '@/utils';
|
||||
import { old_margin } from "@/utils/common";
|
||||
import { isEmpty, cloneDeep } from 'lodash';
|
||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||
import { Autoplay } from 'swiper/modules';
|
||||
const modules = [Autoplay];
|
||||
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
newList: {
|
||||
type: Array as PropType<data_list[]>,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
isUseAuto: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isCommonStyle: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const form = computed(() => props.value?.content || {});
|
||||
const new_style = computed(() => props.value?.style || {});
|
||||
|
||||
type plugins_icon_data = {
|
||||
name: string;
|
||||
bg_color: string;
|
||||
br_color: string;
|
||||
color: string;
|
||||
url: string;
|
||||
}
|
||||
type data_list = {
|
||||
title: string;
|
||||
images: string;
|
||||
new_cover: string[];
|
||||
min_original_price: string;
|
||||
show_original_price_symbol: string;
|
||||
show_original_price_unit: string;
|
||||
simple_desc: string;
|
||||
min_price: string;
|
||||
title_simple_desc_spacing: string;
|
||||
show_price_symbol: string;
|
||||
show_price_unit: string;
|
||||
sales_count: string;
|
||||
is_error: number;
|
||||
plugins_view_icon_data: plugins_icon_data[];
|
||||
}
|
||||
const default_list = {
|
||||
title: '测试商品标题',
|
||||
min_original_price: '41.2',
|
||||
show_original_price_symbol: '¥',
|
||||
show_original_price_unit: '/ 台',
|
||||
min_price: '51',
|
||||
show_price_symbol: '¥',
|
||||
show_price_unit: '/ 台',
|
||||
sales_count: '1000',
|
||||
images: '',
|
||||
new_cover: [],
|
||||
is_error: 0,
|
||||
plugins_view_icon_data: [
|
||||
{
|
||||
name: '满减活动',
|
||||
bg_color: '#EA3323',
|
||||
br_color: '',
|
||||
color: '#fff',
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
name: '包邮',
|
||||
bg_color: '',
|
||||
br_color: '#EA3323',
|
||||
color: '#EA3323',
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
name: '领劵',
|
||||
bg_color: '',
|
||||
br_color: '#EA9223',
|
||||
color: '#EA9223',
|
||||
url: '',
|
||||
},
|
||||
],
|
||||
};
|
||||
//#region 列表数据
|
||||
const list = ref<data_list[]>([]);
|
||||
|
||||
// 数据来源的内容
|
||||
const data_source_content_list = computed(() => {
|
||||
// 是自定义数据类型的时候,显示自定义数据,否则显示数据来源的数据
|
||||
if (Number(form.value.data_source_content.data_type) === 0 && !isEmpty(form.value.data_source_content.data_list)) {
|
||||
const list = form.value.data_source_content?.data_list || [];
|
||||
return list.map((item: any) => ({
|
||||
...item.data,
|
||||
title: !isEmpty(item.new_title) ? item.new_title : item.data.title,
|
||||
new_cover: item.new_cover,
|
||||
}));;
|
||||
} else if (!isEmpty(form.value.data_source_content.data_auto_list)) {
|
||||
return form.value.data_source_content.data_auto_list;
|
||||
} else {
|
||||
return Array(4).fill(default_list);
|
||||
}
|
||||
})
|
||||
// 圆角设置
|
||||
const content_radius = computed(() => radius_computer(new_style.value.shop_radius));
|
||||
// 图片圆角设置
|
||||
const content_img_radius = computed(() => radius_computer(new_style.value.shop_img_radius));
|
||||
// 内边距设置
|
||||
const content_padding = computed(() => padding_computer(new_style.value.shop_padding));
|
||||
// 选择的风格
|
||||
const theme = computed(() => form.value.theme);
|
||||
// 商品间距
|
||||
const content_outer_spacing = computed(() => new_style.value.content_outer_spacing);
|
||||
const shop_left_right_width_margin = computed(() => {
|
||||
const { shop_margin = old_margin } = new_style.value;
|
||||
return shop_margin.margin_left + shop_margin.margin_right;
|
||||
});
|
||||
// 两列风格
|
||||
const two_columns = computed(() => content_outer_spacing.value + shop_left_right_width_margin.value * 2 + 'px' );
|
||||
// 三列风格
|
||||
const three_columns = computed(() => (content_outer_spacing.value * 2) + (shop_left_right_width_margin.value * 3) + 'px');
|
||||
|
||||
// 最外层不同风格下的显示
|
||||
const outer_class = computed(() => {
|
||||
const flex = ['0', '2', '6'].includes(theme.value) ? 'flex-col ' : 'flex-row ';
|
||||
const wrap = theme.value == '5' ? '' : 'flex-wrap ';
|
||||
const background = ['6'].includes(theme.value) ? 'bg-f ' : '';
|
||||
return flex + wrap + background + 'oh';
|
||||
});
|
||||
const onter_style = computed(() => {
|
||||
const radius = theme.value == '6' ? content_radius.value : `gap: ${new_style.value.content_outer_spacing + 'px'};`;
|
||||
return `${radius}`;
|
||||
});
|
||||
// 不同风格下的样式
|
||||
const layout_type = computed(() => {
|
||||
let class_type = '';
|
||||
switch (theme.value) {
|
||||
case '0':
|
||||
class_type = `oh`;
|
||||
break;
|
||||
case '1':
|
||||
class_type = `two-columns oh`;
|
||||
break;
|
||||
case '2':
|
||||
class_type = `oh`;
|
||||
break;
|
||||
case '3':
|
||||
class_type = `three-columns oh`;
|
||||
break;
|
||||
case '4':
|
||||
class_type = `two-columns oh`;
|
||||
break;
|
||||
case '5':
|
||||
class_type = `multicolumn-columns oh`;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return class_type;
|
||||
});
|
||||
// 容器样式
|
||||
const layout_style = computed(() => {
|
||||
const radius = theme.value == '6' ? '' : content_radius.value;
|
||||
const width = theme.value == '0' ? `width: calc(100% - ${ shop_left_right_width_margin.value }px);` : '';
|
||||
const gradient = theme.value != '6' ? gradient_handle(new_style.value.shop_color_list, new_style.value.shop_direction) + margin_computer(new_style.value.shop_margin) + border_computer(new_style.value) + box_shadow_computer(new_style.value) : '';
|
||||
return `${radius} ${ gradient } ${ width }`;
|
||||
});
|
||||
|
||||
// 容器图片样式
|
||||
const layout_img_style = computed(() => {
|
||||
const padding = ['0', '4'].includes(theme.value) ? content_padding.value : '';
|
||||
const data = {
|
||||
background_img_style: new_style.value.shop_background_img_style,
|
||||
background_img: new_style.value.shop_background_img,
|
||||
}
|
||||
const background = theme.value != '6' ? background_computer(data) : '';
|
||||
return padding + background;
|
||||
});
|
||||
|
||||
// 内容区域的样式
|
||||
const content_style = computed(() => {
|
||||
const spacing_value = new_style.value.content_spacing;
|
||||
let spacing = '';
|
||||
if (['0', '4'].includes(theme.value)) {
|
||||
spacing = `margin-left: ${spacing_value}px;`;
|
||||
} else {
|
||||
spacing = content_padding.value;
|
||||
}
|
||||
if (['4'].includes(theme.value)) {
|
||||
spacing += `width: 0;`;
|
||||
}
|
||||
return `${spacing}`;
|
||||
});
|
||||
// 显示除标题外的其他区域
|
||||
const show_content = computed(() => ['0', '1', '2'].includes(theme.value));
|
||||
// 超过多少行隐藏
|
||||
const text_line = computed(() => {
|
||||
let line = '';
|
||||
if (['1', '6'].includes(theme.value)) {
|
||||
line = 'text-line-1';
|
||||
} else if (['0', '2', '3', '4', '5'].includes(theme.value)) {
|
||||
line = 'text-line-2';
|
||||
}
|
||||
return line;
|
||||
});
|
||||
// 判断是否显示对应的内容
|
||||
const is_show = (index: string) => {
|
||||
return form.value.is_show.includes(index);
|
||||
};
|
||||
// 根据传递的参数,从对象中取值
|
||||
const trends_config = (key: string, type?: string) => {
|
||||
return style_config(new_style.value[`shop_${key}_typeface`], new_style.value[`shop_${key}_size`], new_style.value[`shop_${key}_color`], type);
|
||||
};
|
||||
// 根据传递的值,显示不同的内容
|
||||
const style_config = (typeface: string, size: number, color: string | object, type?: string) => {
|
||||
let style = `font-weight:${typeface}; font-size: ${size}px;`;
|
||||
if (type == 'gradient') {
|
||||
style += button_gradient();
|
||||
} else if (type == 'title') {
|
||||
if (['1', '6'].includes(theme.value)) {
|
||||
style += `line-height: ${size}px;height: ${size}px;color: ${color};`;
|
||||
} else if (['0', '2', '3', '4', '5'].includes(theme.value)) {
|
||||
style += `line-height: ${size > 0 ? size + 3 : 0}px;height: ${size > 0 ? (size + 3) * 2 : 0}px;color: ${color};`;
|
||||
}
|
||||
} else if (type == 'desc') {
|
||||
if (form.value.simple_desc_row == '2') {
|
||||
style += `line-height: ${size > 0 ? size + 3 : 0}px;height: ${size > 0 ? (size + 3) * 2 : 0}px;color: ${color};`;
|
||||
} else {
|
||||
style += `line-height: ${size}px;height: ${size}px;color: ${color};`;
|
||||
}
|
||||
} else {
|
||||
style += `color: ${color};`;
|
||||
}
|
||||
return style;
|
||||
};
|
||||
// 按钮渐变色处理
|
||||
const button_gradient = () => {
|
||||
return gradient_handle(new_style.value.shop_button_color, '180deg');
|
||||
};
|
||||
// icon标志显示样式
|
||||
const icon_style = (item: { bg_color: string; color: string; br_color: string }) => {
|
||||
let style = `background: ${item.bg_color};color: ${item.color};`;
|
||||
if (!isEmpty(item.br_color)) {
|
||||
style += `border: 1px solid ${item.br_color};`;
|
||||
} else {
|
||||
style += `border: 1px solid ${item.bg_color};`;
|
||||
}
|
||||
return style;
|
||||
};
|
||||
// 公共样式
|
||||
const style_container = computed(() => props.isCommonStyle ? common_styles_computer(new_style.value.common_style) : '');
|
||||
const style_img_container = computed(() => props.isCommonStyle ? common_img_computer(new_style.value.common_style) : '');
|
||||
// 不换行显示
|
||||
const multicolumn_columns_width = computed(() => {
|
||||
const { carousel_col } = toRefs(form.value);
|
||||
// 计算间隔的空间。(gap * gap数量) / 模块数量
|
||||
let gap = ((content_outer_spacing.value * (carousel_col.value - 1)) + (shop_left_right_width_margin.value * carousel_col.value) / carousel_col.value);
|
||||
return `calc(${100 / carousel_col.value}% - ${gap}px)`;
|
||||
});
|
||||
const content_outer_height = computed(() => new_style.value.content_outer_height + 'px');
|
||||
const product_style_list = [
|
||||
{ name: '单列展示', value: '0', width: 110, height: 120 },
|
||||
{ name: '大图展示', value: '2', width: 166, height: 166 },
|
||||
{ name: '无图模式', value: '6', width: 0, height: 0 },
|
||||
{ name: '两列展示(纵向)', value: '1', width: 180, height: 180 },
|
||||
{ name: '两列展示(横向)', value: '4', width: 70, height: 70 },
|
||||
{ name: '三列展示', value: '3', width: 116, height: 114 },
|
||||
{ name: '左右滑动展示', value: '5', width: 0, height: 0 },
|
||||
]
|
||||
// 宽度和高度为空的时候,修改默认值
|
||||
const goods_img_width = computed(() => {
|
||||
if (typeof new_style.value.content_img_width == 'number') {
|
||||
return new_style.value.content_img_width + 'px';
|
||||
} else {
|
||||
const list = product_style_list.filter(item => item.value == form.value.theme);
|
||||
if (list.length > 0) {
|
||||
return list[0].width + 'px';
|
||||
} else {
|
||||
return 'auto';
|
||||
}
|
||||
}
|
||||
});
|
||||
// 宽度和高度为空的时候,修改默认值
|
||||
const goods_img_height = computed(() => {
|
||||
if (typeof new_style.value.content_img_height == 'number') {
|
||||
return new_style.value.content_img_height + 'px';
|
||||
} else {
|
||||
const list = product_style_list.filter(item => item.value == form.value.theme);
|
||||
if (list.length > 0) {
|
||||
return list[0].height + 'px';
|
||||
} else {
|
||||
return 'auto';
|
||||
}
|
||||
}
|
||||
});
|
||||
//#region 轮播设置
|
||||
// 轮播图key值
|
||||
const carouselKey = ref('0');
|
||||
const autoplay = ref<boolean | object>(false);
|
||||
const slides_per_group = ref(1);
|
||||
// 内容参数的集合
|
||||
watchEffect(() => {
|
||||
// 是否滚动
|
||||
if (new_style.value.is_roll == '1' && list.value.length > 0) {
|
||||
autoplay.value = {
|
||||
delay: (new_style.value.interval_time || 2) * 1000,
|
||||
pauseOnMouseEnter: true,
|
||||
};
|
||||
} else {
|
||||
autoplay.value = false;
|
||||
}
|
||||
// 判断是平移还是整屏滚动
|
||||
slides_per_group.value = new_style.value.rolling_fashion == 'translation' ? 1 : form.value.carousel_col;
|
||||
// 更新轮播图的key,确保更换时能重新更新轮播图
|
||||
carouselKey.value = get_math();
|
||||
});
|
||||
//#endregion
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-image) {
|
||||
background-color: #fff;
|
||||
.image-slot img {
|
||||
width: 5rem;
|
||||
height: 5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.identifying {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
// .original-price-left {
|
||||
// width: 1rem;
|
||||
// }
|
||||
.original-price {
|
||||
// background-color: #ede2c5;
|
||||
text-decoration: line-through;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
.two-columns {
|
||||
width: calc((100% - v-bind(two_columns)) / 2);
|
||||
}
|
||||
.three-columns {
|
||||
width: calc((100% - v-bind(three_columns)) / 3);
|
||||
}
|
||||
.multicolumn-columns {
|
||||
height: v-bind(content_outer_height);
|
||||
}
|
||||
.flex-img0 {
|
||||
height: v-bind(goods_img_height);
|
||||
width: v-bind(goods_img_width);
|
||||
}
|
||||
.flex-img1 {
|
||||
width: 100%;
|
||||
height: v-bind(goods_img_height);
|
||||
}
|
||||
.flex-img2 {
|
||||
width: 100%;
|
||||
height: v-bind(goods_img_height);
|
||||
}
|
||||
.flex-img3 {
|
||||
width: 100%;
|
||||
height: v-bind(goods_img_height);
|
||||
}
|
||||
.flex-img4 {
|
||||
height: v-bind(goods_img_height);
|
||||
width: v-bind(goods_img_width);
|
||||
}
|
||||
.flex-img5 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// min-height: 10.4rem;
|
||||
}
|
||||
:deep(.el-carousel) {
|
||||
width: 100%;
|
||||
.el-carousel__container {
|
||||
min-width: v-bind(multicolumn_columns_width);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,417 @@
|
|||
<template>
|
||||
<div class="content">
|
||||
<el-form :model="form" label-width="70" class="m-h">
|
||||
<common-content-top :value="form.content_top"></common-content-top>
|
||||
<div class="divider-line"></div>
|
||||
<card-container>
|
||||
<div class="mb-12">列表设置</div>
|
||||
<el-form-item label="动态数据">
|
||||
<el-select v-model="form.data_source" value-key="id" placeholder="请选择数据源" filterable clearable @change="changeDataSource">
|
||||
<el-option v-for="item in options" :key="item.type" :label="item.name" :value="item.type" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择风格">
|
||||
<el-radio-group v-model="form.theme" @change="change_style">
|
||||
<el-radio v-for="item in base_list.product_style_list" :key="item.value" :value="item.value">{{ item.name }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.theme == '5'" label="轮播列数">
|
||||
<el-radio-group v-model="form.carousel_col">
|
||||
<el-radio :value="1">单列展示</el-radio>
|
||||
<el-radio :value="2">两列展示</el-radio>
|
||||
<el-radio :value="3">三列展示</el-radio>
|
||||
<el-radio :value="4">四列展示</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</card-container>
|
||||
<template v-if="!isEmpty(default_type_data)">
|
||||
<template v-if="default_type_data.data_type.length > 0">
|
||||
<div class="divider-line"></div>
|
||||
<card-container class="card-container">
|
||||
<div class="mb-12">商品设置</div>
|
||||
<div class="flex-col">
|
||||
<!-- 筛选数据只有一条的时候,并且显示为true的时候才显示,否则的话不显示数据 -->
|
||||
<el-form-item v-if="(default_type_data.data_type.length == 1 && default_type_data.is_type_show) || default_type_data.data_type.length > 1" label="读取方式">
|
||||
<el-radio-group v-model="form.data_source_content.data_type">
|
||||
<el-radio v-for="(item, index) in default_type_data.data_type" :key="index" :value="item">{{ +item === 0 ? '指定数据' : '筛选数据' }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<template v-if="Number(form.data_source_content.data_type) === 0">
|
||||
<div class="nav-list flex-col gap-20">
|
||||
<filter-form v-if="!isEmpty(default_type_data?.appoint_config?.filter_form_config || {})" :filter-data="default_type_data?.appoint_config?.filter_form_config || {}" direction="vertical" :title-width="58" :data-interface="form.data_source_content" @form-change="filter_form_change"></filter-form>
|
||||
<drag-group v-if="!isEmpty(form.data_source_content.data_list)" :list="form.data_source_content.data_list" :img-params="form.show_data?.data_logo || ''" :title-params="form.show_data?.data_name || 'name'" type="custom" @onsort="goods_list_sort" @remove="goods_list_remove" @replace="data_list_replace"></drag-group>
|
||||
<el-button class="w" @click="add">+添加</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<filter-form :filter-data="default_type_data?.filter_config?.filter_form_config || {}" direction="vertical" :title-width="58" :data-interface="form.data_source_content" @form-change="filter_form_change"></filter-form>
|
||||
</template>
|
||||
</div>
|
||||
</card-container>
|
||||
</template>
|
||||
</template>
|
||||
<div class="divider-line"></div>
|
||||
<!-- 商品显示的配置信息 -->
|
||||
<product-show-config :value="form" @change_shop_type="change_shop_type"></product-show-config>
|
||||
<div class="divider-line"></div>
|
||||
<card-container>
|
||||
<div class="mb-12">角标设置</div>
|
||||
<!-- 角标设置 -->
|
||||
<subscript-content :value="form"></subscript-content>
|
||||
</card-container>
|
||||
<!-- 手动筛选数据弹出框 -->
|
||||
<custom-dialog v-model:dialog-visible="url_value_dialog_visible" :data-list-key="form.show_data?.data_key || 'id'" :config="default_type_data.appoint_config" :extra-search-data="form.data_source_content" :multiple="url_value_multiple_bool" @confirm_event="url_value_dialog_call_back"></custom-dialog>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { cloneDeep, isEmpty, pick } from "lodash";
|
||||
import { get_math, interface_field_processing } from '@/utils';
|
||||
import { DataSourceStore } from '@/store';
|
||||
import GoodsMagicAPI from '@/api/goods-magic';
|
||||
import request from "@/utils/request";
|
||||
const goods_source_store = DataSourceStore();
|
||||
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
defaultConfig: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
// 图片不同风格下的圆角
|
||||
img_radius_0: 4,
|
||||
img_radius_1: 0,
|
||||
}),
|
||||
},
|
||||
});
|
||||
const state = reactive({
|
||||
form: props.value,
|
||||
data: props.styles,
|
||||
});
|
||||
// 如果需要解构,确保使用toRefs
|
||||
const { form, data } = toRefs(state);
|
||||
// 默认商品数据
|
||||
const default_type_data = ref<any>({});
|
||||
|
||||
const base_list = reactive({
|
||||
product_style_list: [
|
||||
{ name: '单列展示', value: '0', width: 110, height: 120 },
|
||||
{ name: '大图展示', value: '2', width: 166, height: 166 },
|
||||
{ name: '无图模式', value: '6', width: 0, height: 0 },
|
||||
{ name: '两列展示(纵向)', value: '1', width: 180, height: 180 },
|
||||
{ name: '两列展示(横向)', value: '4', width: 70, height: 70 },
|
||||
{ name: '三列展示', value: '3', width: 116, height: 114 },
|
||||
{ name: '左右滑动展示', value: '5', width: 0, height: 0 },
|
||||
],
|
||||
product_list: [
|
||||
{ name: '指定商品', value: '0' },
|
||||
{ name: '筛选商品', value: '1' },
|
||||
],
|
||||
});
|
||||
// #region 动态数据处理逻辑
|
||||
interface custom_config {
|
||||
show_type: string[],
|
||||
show_number: number[],
|
||||
data_type: string[],
|
||||
is_type_show: boolean,
|
||||
filter_config: object,
|
||||
appoint_config: object,
|
||||
}
|
||||
interface data_list {
|
||||
name: string;
|
||||
field: string;
|
||||
type: string;
|
||||
}
|
||||
interface options_item {
|
||||
custom_config?: custom_config;
|
||||
appoint_data?: object;
|
||||
name: string;
|
||||
data: data_list[];
|
||||
type: string;
|
||||
}
|
||||
const options = ref<options_item[]>([]);
|
||||
//#region 初始化数据处理
|
||||
const getGoodsmagicinit = () => {
|
||||
GoodsMagicAPI.getGoodsmagicinit().then((res) => {
|
||||
const { data_source } = res.data;
|
||||
options.value = data_source;
|
||||
goods_source_store.set_data_source(data_source);
|
||||
// 接口成功之后设置true
|
||||
goods_source_store.set_is_goods_source_api(true);
|
||||
data_processing();
|
||||
}).catch((err) => {
|
||||
// 接口成功之后设置为false,下次仍旧获取数据
|
||||
goods_source_store.set_is_goods_source_api(false);
|
||||
});
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
if (!goods_source_store.is_goods_source_api) {
|
||||
getGoodsmagicinit();
|
||||
} else {
|
||||
options.value = goods_source_store.goods_source_list;
|
||||
data_processing();
|
||||
}
|
||||
});
|
||||
// 回显数据处理
|
||||
const data_processing = () => {
|
||||
// 如果有历史的值,那么就需要根据历史的值来处理一下数据
|
||||
const type_data = options.value.filter((item) => item.type == form.value.data_source);
|
||||
if (type_data.length > 0 && !isEmpty(type_data[0].custom_config)) {
|
||||
const custom_config = type_data[0].custom_config;
|
||||
// 将数据赋值给默认数据,不存在时需要显示全部
|
||||
default_type_data.value = {
|
||||
...custom_config,
|
||||
show_type: custom_config?.show_type || ['vertical', 'vertical-scroll', 'horizontal'],
|
||||
show_number: custom_config?.show_number || [1, 2, 3, 4],
|
||||
data_type: custom_config?.data_type || [0, 1],
|
||||
is_type_show: custom_config?.is_type_show || true,
|
||||
};
|
||||
filter_data_handling('old');
|
||||
default_data();
|
||||
}
|
||||
};
|
||||
// data_source_content 中的数据处理,历史数据有可能不存在当前的某些字段,所以每次都会进行判断,需要处理一下数据 type old 代表历史数据, new 新数据
|
||||
const filter_data_handling = (type: string = 'old') => {
|
||||
// 处理之后的读取方式
|
||||
const data_type = default_type_data.value.data_type.length > 0 ? default_type_data.value.data_type[0] : 0;
|
||||
// 处理数据
|
||||
const staging_data : any = {
|
||||
// 存放手动输入的id
|
||||
data_ids: type == 'old' ? form.value.data_source_content?.data_ids ?? [] : [],
|
||||
// 手动输入
|
||||
data_list: type == 'old' ? form.value.data_source_content?.data_list ?? [] : [],
|
||||
// 自动
|
||||
data_auto_list: type == 'old' ? form.value.data_source_content?.data_auto_list ?? [] : [],
|
||||
// 类型 历史的如果不存在,就使用第一个,否则的话,使用第一个
|
||||
data_type: type == 'old'? (form.value.data_source_content?.data_type ?? data_type) : data_type,
|
||||
};
|
||||
let new_data_field = {};
|
||||
// 根据不同的数据初始化不同的内容, 两个处理看似一样,实际上是后边的覆盖前面的内容,避免老数据没有更新
|
||||
if (staging_data.data_type === 0) {
|
||||
// 如果是手动模式,就取手动模式的数据为默认数据,避免两者重复导致数据冲突
|
||||
new_data_field = {
|
||||
...interface_field_processing(default_type_data.value?.filter_config?.filter_form_config, type, form.value?.data_source_content || {}),
|
||||
...interface_field_processing(default_type_data.value?.appoint_config?.filter_form_config, type, form.value?.data_source_content || {}),
|
||||
}
|
||||
} else {
|
||||
// 如果是自动模式,就取自动模式的数据为默认数据,避免两者重复导致数据冲突
|
||||
new_data_field = {
|
||||
...interface_field_processing(default_type_data.value?.appoint_config?.filter_form_config, type, form.value?.data_source_content || {}),
|
||||
...interface_field_processing(default_type_data.value?.filter_config?.filter_form_config, type, form.value?.data_source_content || {}),
|
||||
}
|
||||
}
|
||||
// 循环完之后赋值,避免多次赋值,传递给子组件出现多次调用和回调问题
|
||||
form.value.data_source_content = {
|
||||
...staging_data,
|
||||
...new_data_field,
|
||||
};
|
||||
};
|
||||
// 默认数据处理
|
||||
const default_data = () => {
|
||||
const { data_type = [] } = default_type_data.value;
|
||||
const { data_source_content } = form.value;
|
||||
// 如果存在默认数据类型的时候, 并且跟当前的不一致时,默认选中第一个
|
||||
if (!isEmpty(data_type)) {
|
||||
if (isEmpty(data_source_content.data_type) && !data_type.includes(Number(data_source_content.data_type))) {
|
||||
form.value.data_source_content.data_type = data_type[0];
|
||||
}
|
||||
} else if (!isEmpty(data_source_content.data_type) && typeof data_source_content.data_type == 'string') { // 老数据使用的是字符串类型,需要转换一下
|
||||
form.value.data_source_content.data_type = Number(form.value.data_source_content.data_type);
|
||||
} else {
|
||||
// data_type 是空数组时,设置为默认值
|
||||
form.value.data_source_content.data_type = 0;
|
||||
}
|
||||
// 如果不存在的时候,默认取id
|
||||
form.value.show_data = default_type_data.value?.appoint_config?.show_data || { data_key: 'id', data_name: 'name' };
|
||||
}
|
||||
const emits = defineEmits(['data_source_change']);
|
||||
// 动态数据切换时触发的逻辑
|
||||
const changeDataSource = (key: string) => {
|
||||
const type_data = options.value.filter((item) => item.type == key);
|
||||
// 默认数据类型
|
||||
form.value.data_source_content = {
|
||||
// 存放手动输入的id
|
||||
data_ids: [],
|
||||
data_list: [],
|
||||
// 自动
|
||||
data_auto_list: [],
|
||||
}
|
||||
// 默认数据, 避免不选报错
|
||||
default_type_data.value = {};
|
||||
if (type_data.length > 0 && !isEmpty(type_data[0].custom_config)) {
|
||||
emits('data_source_change', type_data[0].name);
|
||||
// 自定义数据取值
|
||||
const custom_config = type_data[0].custom_config
|
||||
// 将数据赋值给默认数据
|
||||
default_type_data.value = {
|
||||
...custom_config,
|
||||
show_type: custom_config?.show_type || ['vertical', 'vertical-scroll', 'horizontal'],
|
||||
show_number: custom_config?.show_number || [1, 2, 3, 4],
|
||||
data_type: custom_config?.data_type || [0, 1],
|
||||
is_type_show: custom_config?.is_type_show || true,
|
||||
};
|
||||
// 默认数据处理
|
||||
default_data();
|
||||
// 筛选数据处理
|
||||
filter_data_handling('new');
|
||||
} else {
|
||||
emits('data_source_change', '')
|
||||
}
|
||||
};
|
||||
// #endregion
|
||||
|
||||
// 获取商品自动数据
|
||||
const get_auto_data = () => {
|
||||
if (isEmpty(default_type_data.value) || isEmpty(default_type_data.value.filter_config)) {
|
||||
ElMessage.error('请先配置数据源内容(filter_config)');
|
||||
} else if (isEmpty(default_type_data.value.filter_config.data_url)) {
|
||||
ElMessage.error('请先配置请求地址(data_url)');
|
||||
} else {
|
||||
// 取出自动模式所有的字段
|
||||
const filter_data = interface_field_processing(default_type_data.value?.filter_config?.filter_form_config, 'new', {}) || {};
|
||||
// 取出所有字段的key
|
||||
const filter_key = Object.keys(filter_data);
|
||||
// 取出对应key的数据
|
||||
const data = pick(cloneDeep(form.value.data_source_content), filter_key);
|
||||
request({
|
||||
url: default_type_data.value.filter_config.data_url, // 请求地址
|
||||
method: 'post', // 请求方式
|
||||
data // 请求数据
|
||||
}).then((res) => {
|
||||
if (res.data) {
|
||||
form.value.data_source_content.data_auto_list = res.data;
|
||||
} else {
|
||||
// 清空数据, 避免接口报错等显示的还是老数据
|
||||
form.value.data_source_content.data_auto_list = [];
|
||||
}
|
||||
}).catch((err) => {
|
||||
// 清空数据, 避免接口报错等显示的还是老数据
|
||||
form.value.data_source_content.data_auto_list = [];
|
||||
});
|
||||
}
|
||||
};
|
||||
// 将不需要监听的数据移除,只监听需要监听的数据
|
||||
const data_source_content_value = computed(() => {
|
||||
// 从对象中移除不需要监听的 'data_ids', 'data_list', 'data_auto_list'三个值
|
||||
const data: any = {};
|
||||
for (const key in form.value.data_source_content) {
|
||||
if (!['data_ids', 'data_list', 'data_auto_list'].includes(key)) {
|
||||
data[key] = form.value.data_source_content[key];
|
||||
}
|
||||
}
|
||||
return data;
|
||||
})
|
||||
// 数据发生变化时,调用接口获取数据
|
||||
watch(() => data_source_content_value.value, (new_val, old_val) => {
|
||||
// 数据发生变化时,如果是自动获取数据,则调用接口获取数据
|
||||
if (JSON.stringify(new_val) != JSON.stringify(old_val) && Number(new_val?.data_type || 0) !== 0) {
|
||||
get_auto_data();
|
||||
}
|
||||
},{ deep: true });
|
||||
//#endregion
|
||||
const goods_list_remove = (index: number) => {
|
||||
form.value.data_list.splice(index, 1);
|
||||
};
|
||||
const url_value_multiple_bool = ref(true);
|
||||
const data_list_replace_index = ref(0);
|
||||
const data_list_replace = (index: number) => {
|
||||
data_list_replace_index.value = index;
|
||||
url_value_multiple_bool.value = false;
|
||||
url_value_dialog_visible.value = true;
|
||||
};
|
||||
const add = () => {
|
||||
url_value_multiple_bool.value = true;
|
||||
url_value_dialog_visible.value = true;
|
||||
};
|
||||
// 打开弹出框
|
||||
const url_value_dialog_visible = ref(false);
|
||||
// 弹出框选择的内容
|
||||
const url_value_dialog_call_back = (item: any[]) => {
|
||||
if (url_value_multiple_bool.value) {
|
||||
item.forEach((item: any) => {
|
||||
form.value.data_source_content.data_list.push({
|
||||
id: get_math(),
|
||||
new_cover: [],
|
||||
new_title: '',
|
||||
data: item,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
form.value.data_source_content.data_list[data_list_replace_index.value] = {
|
||||
id: get_math(),
|
||||
new_cover: form.value.data_source_content.data_list[data_list_replace_index.value]?.new_cover || [],
|
||||
new_title: '',
|
||||
data: item[0],
|
||||
};
|
||||
}
|
||||
};
|
||||
// 拖拽更新之后,更新数据
|
||||
const goods_list_sort = (new_list: any) => {
|
||||
form.value.data_list = new_list;
|
||||
};
|
||||
const filter_form_change = (val: any) => {
|
||||
form.value.data_source_content = val;
|
||||
}
|
||||
// 选择某些风格时, 切换到对应的按钮
|
||||
const change_style = (val: string | number | boolean | undefined): void => {
|
||||
if (typeof val !== 'string') return;
|
||||
form.value.theme = val;
|
||||
if (!is_revise.value) {
|
||||
if (['3', '4', '5'].includes(val) && form.value.shop_type == 'text') {
|
||||
form.value.shop_type = 'icon';
|
||||
} else if (['0', '1', '2'].includes(val) && form.value.shop_type == 'icon') {
|
||||
form.value.shop_type = 'text';
|
||||
}
|
||||
}
|
||||
if (['0', '4'].includes(val)) {
|
||||
if (data.value.shop_img_radius.radius == props.defaultConfig.img_radius_0 || (data.value.shop_img_radius.radius_bottom_left == props.defaultConfig.img_radius_1 && data.value.shop_img_radius.radius_bottom_right == props.defaultConfig.img_radius_1 && data.value.shop_img_radius.radius_top_left == props.defaultConfig.img_radius_1 && data.value.shop_img_radius.radius_top_right == props.defaultConfig.img_radius_1)) {
|
||||
data.value.shop_img_radius.radius = props.defaultConfig.img_radius_0;
|
||||
data.value.shop_img_radius.radius_bottom_left = props.defaultConfig.img_radius_0;
|
||||
data.value.shop_img_radius.radius_bottom_right = props.defaultConfig.img_radius_0;
|
||||
data.value.shop_img_radius.radius_top_left = props.defaultConfig.img_radius_0;
|
||||
data.value.shop_img_radius.radius_top_right = props.defaultConfig.img_radius_0;
|
||||
}
|
||||
} else {
|
||||
if (data.value.shop_img_radius.radius == props.defaultConfig.img_radius_0 || (data.value.shop_img_radius.radius_bottom_left == props.defaultConfig.img_radius_1 && data.value.shop_img_radius.radius_bottom_right == props.defaultConfig.img_radius_1 && data.value.shop_img_radius.radius_top_left == props.defaultConfig.img_radius_1 && data.value.shop_img_radius.radius_top_right == props.defaultConfig.img_radius_1)) {
|
||||
data.value.shop_img_radius.radius = props.defaultConfig.img_radius_1;
|
||||
data.value.shop_img_radius.radius_bottom_left = props.defaultConfig.img_radius_1;
|
||||
data.value.shop_img_radius.radius_bottom_right = props.defaultConfig.img_radius_1;
|
||||
data.value.shop_img_radius.radius_top_left = props.defaultConfig.img_radius_1;
|
||||
data.value.shop_img_radius.radius_top_right = props.defaultConfig.img_radius_1;
|
||||
}
|
||||
}
|
||||
// 切换风格时,将对应图片的默认值宽度和高度赋值
|
||||
const list = base_list.product_style_list.filter(item => item.value == form.value.theme);
|
||||
if (list.length > 0) {
|
||||
// emits('theme_change', list[0].width, list[0].height);
|
||||
data.value.content_img_width = list[0].width;
|
||||
data.value.content_img_height = list[0].height;
|
||||
}
|
||||
};
|
||||
const is_revise = ref(false);
|
||||
const change_shop_type = () => {
|
||||
is_revise.value = true;
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
width: 100%;
|
||||
.content-height {
|
||||
min-height: calc(100vh - 31.8rem);
|
||||
.card-container-br {
|
||||
border-bottom: 0.8rem solid #f0f2f5;
|
||||
}
|
||||
}
|
||||
}
|
||||
.img {
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<template>
|
||||
<div class="auxiliary-line-setting">
|
||||
<template v-if="type == '1'">
|
||||
<model-goods-magic-content :value="form.content" :styles="form.style" :default-config="data_config" @data_source_change="data_source_change"></model-goods-magic-content>
|
||||
</template>
|
||||
<template v-if="type == '2'">
|
||||
<model-goods-magic-styles :value="form.style" :content="form.content" :default-config="data_config"></model-goods-magic-styles>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { isEmpty } from 'lodash';
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
default: '1',
|
||||
},
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
allValue: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
const data_config = reactive({
|
||||
// 图片不同风格下的圆角
|
||||
img_radius_0: 4,
|
||||
img_radius_1: 0,
|
||||
});
|
||||
const form = ref(props.value);
|
||||
const all_content = ref(props.allValue);
|
||||
const data_source_change = (name: string) => {
|
||||
// 改变所有内容的名称
|
||||
if (!isEmpty(name)) {
|
||||
all_content.value.mark_name = name;
|
||||
} else {
|
||||
all_content.value.mark_name = '';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.auxiliary-line-setting {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
<template>
|
||||
<div class="w">
|
||||
<el-form :model="form" label-width="70">
|
||||
<card-container class="card-container">
|
||||
<div class="mb-12">商品样式</div>
|
||||
<el-form-item v-if="theme != '6'" label="商品背景">
|
||||
<background-common v-model:color_list="form.shop_color_list" v-model:direction="form.shop_direction" v-model:img_style="form.shop_background_img_style" v-model:img="form.shop_background_img" @mult_color_picker_event="mult_color_picker_event" />
|
||||
</el-form-item>
|
||||
<template v-if="data.is_show.includes('title')">
|
||||
<el-form-item label="商品名称">
|
||||
<color-text-size-group v-model:color="form.shop_title_color" v-model:typeface="form.shop_title_typeface" v-model:size="form.shop_title_size" default-color="#000000"></color-text-size-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-if="data.is_show.includes('simple_desc') && ['0', '1', '2', '3', '5'].includes(theme)">
|
||||
<el-form-item label="商品简述">
|
||||
<color-text-size-group v-model:color="form.shop_simple_desc_color" v-model:size="form.shop_simple_desc_size" default-color="#999" :type-list="['color', 'size']">
|
||||
<el-form-item label="间距" label-width="40" class="mb-0 w form-item-child-label">
|
||||
<slider v-model="form.title_simple_desc_spacing" :max="100"></slider>
|
||||
</el-form-item>
|
||||
</color-text-size-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-if="data.is_show.includes('price')">
|
||||
<el-form-item label="商品价格">
|
||||
<color-text-size-group v-model:color="form.shop_price_color" v-model:typeface="form.shop_price_typeface" v-model:size="form.shop_price_size" default-color="#000000"></color-text-size-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="售价符号">
|
||||
<color-text-size-group v-model:color="form.shop_price_symbol_color" v-model:size="form.shop_price_symbol_size" default-color="#EA3323" :type-list="['color', 'size']"></color-text-size-group>
|
||||
</el-form-item>
|
||||
<template v-if="data.is_show.includes('price_unit')">
|
||||
<el-form-item label="售价单位">
|
||||
<color-text-size-group v-model:color="form.shop_price_unit_color" v-model:size="form.shop_price_unit_size" default-color="#EA3323" :type-list="['color', 'size']"></color-text-size-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="data.is_show.includes('original_price') && ['0', '1', '2'].includes(theme)">
|
||||
<el-form-item label="商品原价">
|
||||
<color-text-size-group v-model:color="form.shop_original_price_color" v-model:size="form.shop_original_price_size" default-color="#999" :type-list="['color', 'size']"></color-text-size-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-if="data.is_show.includes('sales_count') && ['0', '1', '2'].includes(theme) ">
|
||||
<el-form-item label="已售数量">
|
||||
<color-text-size-group v-model:color="form.shop_sold_number_color" v-model:typeface="form.shop_sold_number_typeface" v-model:size="form.shop_sold_number_size" slider-name="大小" default-color="#000000"></color-text-size-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<!-- <el-form-item label="评分">
|
||||
<text-size-group v-model:typeface="form.shop_score_typeface" v-model:size="form.shop_score_size"></text-size-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="评分颜色">
|
||||
<color-picker v-model="form.shop_score_color" default-color="#000000"></color-picker>
|
||||
</el-form-item> -->
|
||||
<template v-if="theme != '6'">
|
||||
<el-form-item label="外间距">
|
||||
<margin :value="form.shop_margin"></margin>
|
||||
</el-form-item>
|
||||
<el-form-item label="内间距">
|
||||
<padding :value="form.shop_padding"></padding>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="['0', '4'].includes(theme)" label="内容间距">
|
||||
<slider v-model="form.content_spacing" :max="100"></slider>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品间距">
|
||||
<slider v-model="form.content_outer_spacing" :max="100"></slider>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="内容圆角">
|
||||
<radius :value="form.shop_radius"></radius>
|
||||
</el-form-item>
|
||||
<template v-if="theme != '6'">
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.border_is_show" v-model:color="form.border_color" v-model:style="form.border_style" v-model:size="form.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form"></shadow-config>
|
||||
<template v-if="theme == '5'">
|
||||
<el-form-item label="内容高度">
|
||||
<slider v-model="form.content_outer_height" :max="1000"></slider>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="图片圆角">
|
||||
<radius :value="form.shop_img_radius"></radius>
|
||||
</el-form-item>
|
||||
<template v-if="!['5', '6'].includes(theme)">
|
||||
<el-form-item v-if="['0', '4'].includes(theme)" label="图片宽度">
|
||||
<slider v-model="form.content_img_width" :max="1000"></slider>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片高度">
|
||||
<slider v-model="form.content_img_height" :max="1000"></slider>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</template>
|
||||
</card-container>
|
||||
<template v-if="theme == '5'">
|
||||
<div class="divider-line data-tabs-line"></div>
|
||||
<card-container class="card-container">
|
||||
<div class="mb-12">轮播设置</div>
|
||||
<el-form-item label="自动轮播">
|
||||
<el-switch v-model="form.is_roll" active-value="1" inactive-value="0" />
|
||||
</el-form-item>
|
||||
<template v-if="form.is_roll == '1'">
|
||||
<el-form-item label="间隔时间">
|
||||
<slider v-model="form.interval_time" :min="1" :max="100"></slider>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="滚动方式">
|
||||
<el-radio-group v-model="form.rolling_fashion">
|
||||
<el-radio value="translation">平移</el-radio>
|
||||
<el-radio value="cut-screen">切屏</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</card-container>
|
||||
</template>
|
||||
<!-- 秒杀角标 -->
|
||||
<template v-if="data.seckill_subscript_show == '1'">
|
||||
<div class="divider-line data-tabs-line"></div>
|
||||
<subscript-styles :value="form.subscript_style" :data="data"></subscript-styles>
|
||||
</template>
|
||||
<template v-if="data.is_shop_show == '1'">
|
||||
<div class="divider-line data-tabs-line"></div>
|
||||
<card-container class="card-container">
|
||||
<div class="mb-12">购物车按钮</div>
|
||||
<el-form-item label="按钮颜色" class="topic">
|
||||
<flex-gradients-create :color-list="form.shop_button_color" default-color="#FF3D53"></flex-gradients-create>
|
||||
</el-form-item>
|
||||
<template v-if="data.shop_type == 'text'">
|
||||
<el-form-item label="文字设置">
|
||||
<color-text-size-group v-model:color="form.shop_button_text_color" v-model:typeface="form.shop_button_typeface" v-model:size="form.shop_button_size" default-color="#fff"></color-text-size-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-form-item label="图标设置">
|
||||
<color-text-size-group v-model:color="form.shop_icon_color" v-model:size="form.shop_icon_size" slider-name="大小" default-color="#fff" :type-list="['color', 'size']"></color-text-size-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</card-container>
|
||||
</template>
|
||||
</el-form>
|
||||
<template v-if="isCommonStyle">
|
||||
<div class="divider-line data-tabs-line"></div>
|
||||
<common-styles :value="form.common_style" @update:value="common_style_update" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
content: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
isCommonStyle: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
defaultConfig: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
// 图片不同风格下的圆角
|
||||
img_radius_0: 4,
|
||||
img_radius_1: 0,
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
// 默认值
|
||||
const state = reactive({
|
||||
form: props.value,
|
||||
data: props.content,
|
||||
});
|
||||
// 如果需要解构,确保使用toRefs
|
||||
const { form, data } = toRefs(state);
|
||||
|
||||
const theme = computed(() => data.value.theme);
|
||||
if (['0', '4'].includes(theme.value)) {
|
||||
if (form.value.shop_img_radius.radius == props.defaultConfig.img_radius_0 || (form.value.shop_img_radius.radius_bottom_left == props.defaultConfig.img_radius_1 && form.value.shop_img_radius.radius_bottom_right == props.defaultConfig.img_radius_1 && form.value.shop_img_radius.radius_top_left == props.defaultConfig.img_radius_1 && form.value.shop_img_radius.radius_top_right == props.defaultConfig.img_radius_1)) {
|
||||
form.value.shop_img_radius.radius = props.defaultConfig.img_radius_0;
|
||||
form.value.shop_img_radius.radius_bottom_left = props.defaultConfig.img_radius_0;
|
||||
form.value.shop_img_radius.radius_bottom_right = props.defaultConfig.img_radius_0;
|
||||
form.value.shop_img_radius.radius_top_left = props.defaultConfig.img_radius_0;
|
||||
form.value.shop_img_radius.radius_top_right = props.defaultConfig.img_radius_0;
|
||||
}
|
||||
} else {
|
||||
if (form.value.shop_img_radius.radius == props.defaultConfig.img_radius_0 || (form.value.shop_img_radius.radius_bottom_left == props.defaultConfig.img_radius_1 && form.value.shop_img_radius.radius_bottom_right == props.defaultConfig.img_radius_1 && form.value.shop_img_radius.radius_top_left == props.defaultConfig.img_radius_1 && form.value.shop_img_radius.radius_top_right == props.defaultConfig.img_radius_1)) {
|
||||
form.value.shop_img_radius.radius = props.defaultConfig.img_radius_1;
|
||||
form.value.shop_img_radius.radius_bottom_left = props.defaultConfig.img_radius_1;
|
||||
form.value.shop_img_radius.radius_bottom_right = props.defaultConfig.img_radius_1;
|
||||
form.value.shop_img_radius.radius_top_left = props.defaultConfig.img_radius_1;
|
||||
form.value.shop_img_radius.radius_top_right = props.defaultConfig.img_radius_1;
|
||||
}
|
||||
}
|
||||
const common_style_update = (value: any) => {
|
||||
form.value.common_style = value;
|
||||
};
|
||||
|
||||
// 商品背景渐变设置
|
||||
const mult_color_picker_event = (arry: color_list[], type: number) => {
|
||||
form.value.shop_color_list = arry;
|
||||
form.value.shop_direction = type.toString();
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.topic {
|
||||
:deep(.el-form-item__content) {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,243 @@
|
|||
import defaultCommon from './index';
|
||||
import defaultSetting from '../setting/index';
|
||||
import subscriptStyle from './subscript-style';
|
||||
import commonTop from './common-top';
|
||||
import { online_url } from '@/utils';
|
||||
const new_url = await online_url('/static/app/common/').then((res) => res);
|
||||
interface content {
|
||||
data_ids: Array<string>;
|
||||
data_list: Array<object>;
|
||||
data_auto_list: Array<object>;
|
||||
}
|
||||
interface DefaultProductMagic {
|
||||
content: {
|
||||
content_top: object;
|
||||
theme: string;
|
||||
carousel_col: number;
|
||||
is_custom_data: string;
|
||||
data_source_content: content;
|
||||
is_price_solo: string;
|
||||
is_show: string[];
|
||||
simple_desc_row: string;
|
||||
static_img: uploadList[];
|
||||
is_shop_show: string;
|
||||
shop_type: string;
|
||||
shop_button_text: string;
|
||||
shop_button_icon_class: string;
|
||||
shop_button_effect: string;
|
||||
seckill_subscript_show: string;
|
||||
subscript_type: string;
|
||||
subscript_img_src: uploadList[];
|
||||
subscript_icon_class: string;
|
||||
subscript_text: string;
|
||||
};
|
||||
style: {
|
||||
shop_direction: string;
|
||||
shop_color_list: color_list[];
|
||||
shop_background_img_style: string;
|
||||
shop_background_img: uploadList[];
|
||||
shop_padding: paddingStyle;
|
||||
shop_margin: marginStyle;
|
||||
border_is_show: string;
|
||||
border_color: string;
|
||||
border_style: string;
|
||||
border_size: paddingStyle;
|
||||
// 阴影
|
||||
box_shadow_color: string;
|
||||
box_shadow_x: number;
|
||||
box_shadow_y: number;
|
||||
box_shadow_blur: number;
|
||||
box_shadow_spread: number;
|
||||
shop_img_radius: radiusStyle;
|
||||
shop_radius: radiusStyle;
|
||||
content_outer_spacing: number;
|
||||
content_outer_height: number;
|
||||
content_img_width: number | undefined;
|
||||
content_img_height: number | undefined;
|
||||
is_roll: string;
|
||||
interval_time: number;
|
||||
rolling_fashion: string;
|
||||
content_spacing: number;
|
||||
shop_title_typeface: string;
|
||||
shop_title_size: number;
|
||||
shop_title_color: string;
|
||||
shop_simple_desc_typeface: string;
|
||||
shop_simple_desc_size: number;
|
||||
shop_simple_desc_color: string;
|
||||
title_simple_desc_spacing: number;
|
||||
shop_price_typeface: string;
|
||||
shop_price_size: number;
|
||||
shop_price_color: string;
|
||||
shop_price_symbol_color: string;
|
||||
shop_price_symbol_size: number;
|
||||
shop_price_unit_color: string;
|
||||
shop_price_unit_size: number;
|
||||
shop_original_price_color: string;
|
||||
shop_original_price_size: number;
|
||||
shop_sold_number_typeface: string;
|
||||
shop_sold_number_size: number;
|
||||
shop_sold_number_color: string;
|
||||
shop_score_typeface: string;
|
||||
shop_score_size: number;
|
||||
shop_score_color: string;
|
||||
shop_button_typeface:string;
|
||||
shop_button_size: number;
|
||||
shop_button_color: color_list[];
|
||||
shop_button_text_color: string;
|
||||
shop_icon_size: number;
|
||||
shop_icon_color: string;
|
||||
subscript_style: object;
|
||||
common_style: object;
|
||||
};
|
||||
}
|
||||
const DefaultProductMagic: DefaultProductMagic = {
|
||||
content: {
|
||||
content_top: {
|
||||
...commonTop,
|
||||
},
|
||||
carousel_col: 3,
|
||||
// 商品风格
|
||||
theme: '0',
|
||||
is_custom_data: '1',// 是否自定义数据源
|
||||
// 数据源内容
|
||||
data_source_content: {
|
||||
// 存放手动输入的id
|
||||
data_ids: [],
|
||||
// 手动输入
|
||||
data_list: [],
|
||||
// 自动
|
||||
data_auto_list: [],
|
||||
},
|
||||
// 价格是否独行
|
||||
is_price_solo: '1',
|
||||
// 显示内容
|
||||
is_show: ['title', 'plugins_view_icon', 'price', 'sales_count', 'original_price'],
|
||||
simple_desc_row: '1',
|
||||
// 价格图标地址
|
||||
static_img: [{ id: 2, url: new_url + 'price.png', original: '角标', title: '角标', ext: '.png', type: 'img' }],
|
||||
// 是否显示购买按钮
|
||||
is_shop_show: '1',
|
||||
// 购买按钮类型
|
||||
shop_type: 'text',
|
||||
shop_button_text: '购买',
|
||||
shop_button_icon_class: 'cart',
|
||||
// 点击购买按钮的操作处理
|
||||
shop_button_effect: '0',
|
||||
// 角标配置
|
||||
seckill_subscript_show: '0',
|
||||
subscript_type: 'text',
|
||||
subscript_img_src: [],
|
||||
subscript_icon_class: '',
|
||||
subscript_text: '',
|
||||
},
|
||||
style: {
|
||||
shop_direction: '90deg',
|
||||
shop_color_list: [{ color: '#fff', color_percentage: undefined }],
|
||||
shop_background_img_style: '0',
|
||||
shop_background_img: [],
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
// 商品内边距
|
||||
shop_padding: {
|
||||
padding: 10,
|
||||
padding_top: 10,
|
||||
padding_bottom: 10,
|
||||
padding_left: 10,
|
||||
padding_right: 10,
|
||||
},
|
||||
shop_margin: {
|
||||
margin: 0,
|
||||
margin_top: 0,
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
},
|
||||
// 图标圆角
|
||||
shop_img_radius: {
|
||||
radius: 4,
|
||||
radius_top_left: 4,
|
||||
radius_top_right: 4,
|
||||
radius_bottom_left: 4,
|
||||
radius_bottom_right: 4,
|
||||
},
|
||||
// 商品圆角
|
||||
shop_radius: {
|
||||
radius: 8,
|
||||
radius_top_left: 8,
|
||||
radius_top_right: 8,
|
||||
radius_bottom_left: 8,
|
||||
radius_bottom_right: 8,
|
||||
},
|
||||
content_outer_spacing: 10, // 商品外间距
|
||||
// 商品内间距
|
||||
content_spacing: 10,
|
||||
// 商品高度
|
||||
content_outer_height: 232,
|
||||
content_img_width: 110,
|
||||
content_img_height: 120,
|
||||
// 是否滚动
|
||||
is_roll: '1',
|
||||
interval_time: 3,
|
||||
rolling_fashion: 'translation', // 滚动方式 translation 平移 cut-screen 切屏
|
||||
// 商品内容大小和颜色设置
|
||||
shop_title_typeface: 'bold',
|
||||
shop_title_size: 14,
|
||||
shop_title_color: "#333333",
|
||||
shop_simple_desc_typeface: '400',
|
||||
shop_simple_desc_size: 12,
|
||||
shop_simple_desc_color: "#999",
|
||||
title_simple_desc_spacing: 4,
|
||||
shop_price_typeface: 'bold',
|
||||
shop_price_size: 18,
|
||||
shop_price_color: "#EA3323;",
|
||||
shop_price_symbol_color: '#EA3323',
|
||||
shop_price_symbol_size: 9,
|
||||
shop_price_unit_color: '#EA3323',
|
||||
shop_price_unit_size: 9,
|
||||
shop_original_price_color: '#999',
|
||||
shop_original_price_size: 12,
|
||||
shop_sold_number_typeface: '400',
|
||||
shop_sold_number_size: 10,
|
||||
shop_sold_number_color: "#999999",
|
||||
shop_score_typeface: '400',
|
||||
shop_score_size: 10,
|
||||
shop_score_color: "#999999",
|
||||
shop_button_typeface:'400',
|
||||
shop_button_size: 12,
|
||||
// 购买按钮渐变颜色
|
||||
shop_button_color: [
|
||||
{
|
||||
color: '#FF3D53',
|
||||
color_percentage: undefined
|
||||
},
|
||||
{
|
||||
color: '#D73A3A',
|
||||
color_percentage: undefined
|
||||
}
|
||||
],
|
||||
// 购买按钮文字颜色
|
||||
shop_button_text_color: '#fff',
|
||||
// 购买按钮图标颜色和大小
|
||||
shop_icon_size: 10,
|
||||
shop_icon_color: "#fff",
|
||||
subscript_style: subscriptStyle,
|
||||
common_style: { ...defaultCommon, padding: 10, padding_top: 10, padding_bottom: 10, padding_left: 10, padding_right: 10 },
|
||||
},
|
||||
};
|
||||
|
||||
export default DefaultProductMagic;
|
||||
|
|
@ -14,22 +14,35 @@ export const DataSourceStore = defineStore('dataSource', () => {
|
|||
type: string;
|
||||
};
|
||||
const is_children_custom = ref(false);
|
||||
// 上传是否需要调接口判断
|
||||
// 自定义是否需要调接口判断
|
||||
const is_data_source_api = ref(false);
|
||||
// 数据源
|
||||
const data_source_list = ref<data_source_content[]>([]);
|
||||
// 自定义是否需要调接口判断
|
||||
const is_goods_source_api = ref(false);
|
||||
// 数据源
|
||||
const goods_source_list = ref<data_source_content[]>([]);
|
||||
// 自定义历史记录
|
||||
const custom_records_index = ref<number>(-1);
|
||||
const custom_records = ref<any[]>([]);
|
||||
// 自定义组历史记录
|
||||
const custom_group_records_index = ref<number>(-1);
|
||||
const custom_group_records = ref<any[]>([]);
|
||||
// 存储上传分类列表
|
||||
// 存储自定义分类列表
|
||||
const set_data_source = (data_source_content: data_source_content[]) => {
|
||||
data_source_list.value = data_source_content;
|
||||
is_data_source_api.value = true;
|
||||
};
|
||||
// 如果为false 则转为true
|
||||
const set_is_goods_source_api = (bool: boolean) => {
|
||||
is_goods_source_api.value = bool;
|
||||
};
|
||||
// 存储自定义分类列表
|
||||
const set_goods_source = (data_source_content: data_source_content[]) => {
|
||||
goods_source_list.value = data_source_content;
|
||||
is_goods_source_api.value = true;
|
||||
};
|
||||
// 如果为false 则转为true
|
||||
const set_is_data_source_api = (bool: boolean) => {
|
||||
is_data_source_api.value = bool;
|
||||
};
|
||||
|
|
@ -59,8 +72,12 @@ export const DataSourceStore = defineStore('dataSource', () => {
|
|||
is_children_custom,
|
||||
data_source_list,
|
||||
is_data_source_api,
|
||||
goods_source_list,
|
||||
is_goods_source_api,
|
||||
set_data_source,
|
||||
set_is_data_source_api,
|
||||
set_goods_source,
|
||||
set_is_goods_source_api,
|
||||
set_is_children_custom,
|
||||
set_custom_records,
|
||||
set_custom_records_index,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import defaultSalerecords from '@/config/const/salerecords';
|
|||
import defaultAsk from '@/config/const/ask';
|
||||
import defaultAskTabs from '@/config/const/ask-tabs';
|
||||
import defaultActivity from '@/config/const/activity';
|
||||
import defaultGoodsMagic from '@/config/const/goods-magic';
|
||||
|
||||
// 系统设置
|
||||
interface DefaultSettings {
|
||||
|
|
@ -71,6 +72,7 @@ interface DefaultSettings {
|
|||
ask: object;
|
||||
ask_tabs: object;
|
||||
activity: object;
|
||||
goods_magic: object;
|
||||
}
|
||||
|
||||
const defaultSettings: DefaultSettings = {
|
||||
|
|
@ -109,6 +111,7 @@ const defaultSettings: DefaultSettings = {
|
|||
ask: defaultAsk,
|
||||
ask_tabs: defaultAskTabs,
|
||||
activity: defaultActivity,
|
||||
goods_magic: defaultGoodsMagic,
|
||||
};
|
||||
|
||||
export default defaultSettings;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,10 @@
|
|||
<template v-else-if="value.key == 'custom'">
|
||||
<model-custom-setting :type="radio" :value="value.com_data" :all-value="value"></model-custom-setting>
|
||||
</template>
|
||||
<!-- 商品魔方 -->
|
||||
<template v-else-if="value.key == 'goods-magic'">
|
||||
<model-goods-magic-setting :type="radio" :value="value.com_data" :all-value="value"></model-goods-magic-setting>
|
||||
</template>
|
||||
<!-- 底部导航 -->
|
||||
<template v-else-if="value.key == 'footer-nav'">
|
||||
<footer-nav-setting :type="radio" :value="value.com_data"></footer-nav-setting>
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ const save_formmat_form_data = (data: diy_data_item, close: boolean = false, is_
|
|||
// 层级更深
|
||||
const new_array_4 = ['data-magic'];
|
||||
// 自定义数据
|
||||
const new_array_5 = ['custom'];
|
||||
const new_array_5 = ['custom', 'goods-magic'];
|
||||
// 导航组
|
||||
const new_array_6 = ['nav-group'];
|
||||
clone_form.diy_data = clone_form.diy_data.map((item: any) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue