Merge branch 'dev-yxl' into dev-sws
commit
25536df285
|
|
@ -3,9 +3,11 @@
|
|||
<div :class="outer_class" :style="onter_style">
|
||||
<div v-for="(item, index) in list" :key="index" class="re" :class="layout_type" :style="layout_style">
|
||||
<template v-if="product_style == '6'">
|
||||
<div :class="['flex-row jc-sb ptb-15 mlr-10 gap-20', { 'br-b-e': index != list.length -1 }]">
|
||||
<div :class="['flex-row jc-sb ptb-15 mlr-10 gap-20', { 'br-b-e': index != list.length - 1 }]">
|
||||
<div v-if="is_show('0')" :class="text_line" :style="trends_config('title')">{{ item.title }}</div>
|
||||
<div v-if="is_show('2')" class="num" :style="`color: ${ new_style.shop_price_color }`"><span class="identifying">¥</span><span :style="trends_config('price')">{{ item.min_price }}</span></div>
|
||||
<div v-if="is_show('2')" class="num" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span class="identifying">¥</span><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
|
@ -29,57 +31,69 @@
|
|||
<div class="one3 radius-sm size-9 pl-3 pr-3">{{ '领劵' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!['3','4','5'].includes(form.product_style)" class="flex-col gap-5 oh">
|
||||
<div :class="[form.is_price_solo ? 'flex-row align-c nowrap': 'flex-col gap-5']">
|
||||
<div v-if="is_show('2')" class="num" :style="`color: ${ new_style.shop_price_color }`"><span class="identifying">{{ item.show_price_symbol }}</span><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<div v-if="!['3', '4', '5'].includes(form.product_style)" class="flex-col gap-5 oh">
|
||||
<div :class="[form.is_price_solo ? 'flex-row align-c nowrap' : 'flex-col gap-5']">
|
||||
<div v-if="is_show('2')" class="num" :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('6')" class="identifying">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('5')" class="size-10 flex"><span class="original-price-left"></span><span class="original-price flex-1 text-line-1">{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('7')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span></div>
|
||||
<div v-if="show_content && is_show('5')" class="size-10 flex">
|
||||
<span class="original-price-left"></span
|
||||
><span class="original-price flex-1 text-line-1"
|
||||
>{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('7')">
|
||||
{{ 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('3')" :class="['pr-5', {'br-r-e': is_show('3') && is_show('4')}]" :style="trends_config('sold_number')">已售{{ item.sales_count }}件</div>
|
||||
<div v-if="is_show('3')" :class="['pr-5', { 'br-r-e': is_show('3') && 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">
|
||||
<template v-if="form.shop_type == '0'">
|
||||
<div class="pl-13 pr-13 round cr-f shopping_button" :style="trends_config('button','gradient')">购买</div>
|
||||
<div class="pl-13 pr-13 round cr-f shopping_button" :style="trends_config('button', 'gradient')">购买</div>
|
||||
</template>
|
||||
<template v-else-if="form.shop_type == '1'">
|
||||
<div class="pl-11 pr-11 round cr-f shopping_button" :style="trends_config('button','gradient')">立即购买</div>
|
||||
<div class="pl-11 pr-11 round cr-f shopping_button" :style="trends_config('button', 'gradient')">立即购买</div>
|
||||
</template>
|
||||
<template v-else-if="form.shop_type == '2'">
|
||||
<icon :class="['shopping_button round', {'pl-6 pr-6': shop_icon_size != '8', 'pl-5 pr-5' : shop_icon_size == '8' }] " name="add" color="f" :size="shop_icon_size" :styles="button_gradient()"></icon>
|
||||
<icon :class="['shopping_button round', { 'pl-6 pr-6': shop_icon_size != '8', 'pl-5 pr-5': shop_icon_size == '8' }]" name="add" color="f" :size="shop_icon_size" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon :class="['shopping_button round', {'pl-6 pr-6': shop_icon_size != '8', 'pl-5 pr-5' : shop_icon_size == '8' }]" name="cart" color="f" :size="shop_icon_size" :styles="button_gradient()"></icon>
|
||||
<icon :class="['shopping_button round', { 'pl-6 pr-6': shop_icon_size != '8', 'pl-5 pr-5': shop_icon_size == '8' }]" name="cart" color="f" :size="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('2')" class="num" :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 class="identifying">{{ item.show_price_unit }}</span></div>
|
||||
<div v-if="show_content && is_show('5')" class="size-10 flex"><span class="original-price-left"></span><span class="original-price flex-1 text-line-1">{{ item.show_original_price_symbol }}{{ item.min_original_price }}{{ item.show_original_price_unit }}</span></div>
|
||||
<div v-if="is_show('2')" class="num" :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 class="identifying">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('5')" class="size-10 flex">
|
||||
<span class="original-price-left"></span><span class="original-price flex-1 text-line-1">{{ item.show_original_price_symbol }}{{ item.min_original_price }}{{ item.show_original_price_unit }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="form.is_shop_show">
|
||||
<template v-if="form.shop_type == '0'">
|
||||
<div class="pl-13 pr-13 round cr-f shopping_button" :style="trends_config('button','gradient')">购买</div>
|
||||
<div class="pl-13 pr-13 round cr-f shopping_button" :style="trends_config('button', 'gradient')">购买</div>
|
||||
</template>
|
||||
<template v-else-if="form.shop_type == '1'">
|
||||
<div class="pl-11 pr-11 round cr-f shopping_button" :style="trends_config('button','gradient')">立即购买</div>
|
||||
<div class="pl-11 pr-11 round cr-f shopping_button" :style="trends_config('button', 'gradient')">立即购买</div>
|
||||
</template>
|
||||
<template v-else-if="form.shop_type == '2'">
|
||||
<icon :class="['shopping_button round', {'pl-6 pr-6': shop_icon_size != '8', 'pl-5 pr-5' : shop_icon_size == '8' }] " name="add" color="f" :size="shop_icon_size" :styles="button_gradient()"></icon>
|
||||
<icon :class="['shopping_button round', { 'pl-6 pr-6': shop_icon_size != '8', 'pl-5 pr-5': shop_icon_size == '8' }]" name="add" color="f" :size="shop_icon_size" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon :class="['shopping_button round', {'pl-6 pr-6': shop_icon_size != '8', 'pl-5 pr-5' : shop_icon_size == '8' }]" name="cart" color="f" :size="shop_icon_size" :styles="button_gradient()"></icon>
|
||||
<icon :class="['shopping_button round', { 'pl-6 pr-6': shop_icon_size != '8', 'pl-5 pr-5': shop_icon_size == '8' }]" name="cart" color="f" :size="shop_icon_size" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -104,7 +118,7 @@ const props = defineProps({
|
|||
isCommonStyle: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
// 用于页面判断显示
|
||||
const state = reactive({
|
||||
|
|
@ -130,14 +144,14 @@ interface product_list {
|
|||
const default_list = {
|
||||
title: '华为荣耀畅享平板换屏服务 屏幕换外屏',
|
||||
min_original_price: '41.2',
|
||||
show_original_price_symbol: "¥",
|
||||
show_original_price_symbol: '¥',
|
||||
min_price: '51',
|
||||
show_price_symbol: "¥",
|
||||
show_price_unit: "",
|
||||
sales_count: "1000",
|
||||
show_price_symbol: '¥',
|
||||
show_price_unit: '',
|
||||
sales_count: '1000',
|
||||
images: '',
|
||||
new_url: []
|
||||
}
|
||||
new_url: [],
|
||||
};
|
||||
const list = ref<product_list[]>([]);
|
||||
|
||||
const get_products = () => {
|
||||
|
|
@ -148,8 +162,8 @@ const get_products = () => {
|
|||
goods_brand_ids: goods_brand_ids,
|
||||
goods_order_by_type: sort,
|
||||
goods_order_by_rule: sort_rules,
|
||||
goods_number: number
|
||||
}
|
||||
goods_number: number,
|
||||
};
|
||||
// 获取商品列表
|
||||
ShopAPI.getShopLists(params).then((res: any) => {
|
||||
if (!isEmpty(res.data)) {
|
||||
|
|
@ -185,11 +199,11 @@ const content_padding = computed(() => padding_computer(new_style.value.shop_pad
|
|||
// 选择的风格
|
||||
const product_style = computed(() => form.value.product_style);
|
||||
// 商品间距
|
||||
const content_outer_spacing = computed(() => new_style.value.content_outer_spacing );
|
||||
const content_outer_spacing = computed(() => new_style.value.content_outer_spacing);
|
||||
// 两列风格
|
||||
const two_columns = computed(() => (content_outer_spacing.value) + 'px' );
|
||||
const two_columns = computed(() => content_outer_spacing.value + 'px');
|
||||
// 三列风格
|
||||
const three_columns = computed(() => (content_outer_spacing.value * 2) + 'px');
|
||||
const three_columns = computed(() => content_outer_spacing.value * 2 + 'px');
|
||||
// 不换行显示
|
||||
const multicolumn_columns = computed(() => new_style.value.content_outer_width + 'px');
|
||||
|
||||
|
|
@ -202,9 +216,9 @@ const outer_class = computed(() => {
|
|||
});
|
||||
const onter_style = computed(() => {
|
||||
const radius = product_style.value == '6' ? content_radius.value : '';
|
||||
const gap = `gap: ${ new_style.value.content_outer_spacing + 'px'};`;
|
||||
return `${ radius } ${ gap }`;
|
||||
})
|
||||
const gap = `gap: ${new_style.value.content_outer_spacing + 'px'};`;
|
||||
return `${radius} ${gap}`;
|
||||
});
|
||||
|
||||
// 不同风格下的样式
|
||||
const layout_type = computed(() => {
|
||||
|
|
@ -232,41 +246,41 @@ const layout_type = computed(() => {
|
|||
break;
|
||||
}
|
||||
return class_type;
|
||||
})
|
||||
});
|
||||
|
||||
const layout_style = computed(() => {
|
||||
const radius = product_style.value == '6' ? '' : content_radius.value;
|
||||
const padding = ['0', '4'].includes(product_style.value) ? content_padding.value : '';
|
||||
return `${ radius } ${ padding }`;
|
||||
})
|
||||
return `${radius} ${padding}`;
|
||||
});
|
||||
// 内容区域的样式
|
||||
const content_style = computed(() => {
|
||||
const content_style = computed(() => {
|
||||
const spacing_value = new_style.value.content_spacing;
|
||||
let spacing = '';
|
||||
if (['0', '4'] .includes(product_style.value)) {
|
||||
spacing = `margin-left: ${ spacing_value }px;`
|
||||
let spacing = '';
|
||||
if (['0', '4'].includes(product_style.value)) {
|
||||
spacing = `margin-left: ${spacing_value}px;`;
|
||||
} else {
|
||||
spacing = content_padding.value;
|
||||
}
|
||||
|
||||
return `${ spacing }`;
|
||||
})
|
||||
|
||||
return `${spacing}`;
|
||||
});
|
||||
// 显示除标题外的其他区域
|
||||
const show_content = computed(() => ['0', '1', '2'].includes(product_style.value));
|
||||
// 超过多少行隐藏
|
||||
const text_line = computed(() => {
|
||||
let line = '';
|
||||
if (['1', '6'].includes(product_style.value)) {
|
||||
line = 'text-line-1'
|
||||
line = 'text-line-1';
|
||||
} else if (['0', '2', '3', '4', '5'].includes(product_style.value)) {
|
||||
line = 'text-line-2'
|
||||
line = 'text-line-2';
|
||||
}
|
||||
return line;
|
||||
})
|
||||
});
|
||||
// 判断是否显示对应的内容
|
||||
const is_show = (index: string) => {
|
||||
return form.value.is_show.includes(index);
|
||||
}
|
||||
};
|
||||
// 按钮大小设置
|
||||
const button_size = computed(() => {
|
||||
let button_size = '22px';
|
||||
|
|
@ -276,35 +290,35 @@ const button_size = computed(() => {
|
|||
button_size = '18px';
|
||||
}
|
||||
return button_size;
|
||||
})
|
||||
});
|
||||
// 不同大小下的icon显示
|
||||
const shop_icon_size = computed(() => {
|
||||
let size = '8';
|
||||
if (form.value.shop_button_size == '0') {
|
||||
size = '15';
|
||||
size = '15';
|
||||
} else if (form.value.shop_button_size == '1') {
|
||||
size = '10';
|
||||
}
|
||||
return size;
|
||||
})
|
||||
});
|
||||
// 根据传递的参数,从对象中取值
|
||||
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;`;
|
||||
let style = `font-weight:${typeface}; font-size: ${size}px;`;
|
||||
if (type == 'gradient') {
|
||||
style += button_gradient();
|
||||
} else {
|
||||
style += `color: ${ color };`;
|
||||
style += `color: ${color};`;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
};
|
||||
// 按钮渐变色处理
|
||||
const button_gradient = () => {
|
||||
return gradient_handle(new_style.value.shop_button_color, '90deg');
|
||||
}
|
||||
};
|
||||
// 公共样式
|
||||
const style_container = computed(() => {
|
||||
if (props.isCommonStyle) {
|
||||
|
|
@ -319,7 +333,7 @@ const style_container = computed(() => {
|
|||
background-color: #fff;
|
||||
.image-slot img {
|
||||
width: 5rem;
|
||||
height: 5rem
|
||||
height: 5rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +347,7 @@ const style_container = computed(() => {
|
|||
background-repeat: no-repeat;
|
||||
}
|
||||
.original-price {
|
||||
background-color: #EDE2C5;
|
||||
background-color: #ede2c5;
|
||||
border-radius: 0;
|
||||
border-bottom-right-radius: 1rem;
|
||||
border-top-right-radius: 1rem;
|
||||
|
|
@ -344,17 +358,17 @@ const style_container = computed(() => {
|
|||
line-height: v-bind(button_size);
|
||||
}
|
||||
.one1 {
|
||||
border: 1px solid #EA3323;
|
||||
background: #EA3323;
|
||||
border: 1px solid #ea3323;
|
||||
background: #ea3323;
|
||||
color: #fff;
|
||||
}
|
||||
.one2 {
|
||||
border: 1px solid #EA3323;
|
||||
color: #EA3323;
|
||||
border: 1px solid #ea3323;
|
||||
color: #ea3323;
|
||||
}
|
||||
.one3 {
|
||||
border: 1px solid #FFC300;
|
||||
color: #FFC300;
|
||||
border: 1px solid #ffc300;
|
||||
color: #ffc300;
|
||||
}
|
||||
|
||||
.two-columns {
|
||||
|
|
@ -370,11 +384,11 @@ const style_container = computed(() => {
|
|||
height: auto;
|
||||
max-height: 12rem;
|
||||
width: 11rem;
|
||||
}
|
||||
}
|
||||
.flex-img1 {
|
||||
width: 100%;
|
||||
height: 18rem;
|
||||
}
|
||||
}
|
||||
.flex-img2 {
|
||||
width: 100%;
|
||||
height: 16.6rem;
|
||||
|
|
|
|||
Loading…
Reference in New Issue