优惠券的接口新增字段

v1.4.0
于肖磊 2025-06-20 16:54:00 +08:00
parent 99510fa0d7
commit a5d610ee3c
7 changed files with 78 additions and 33 deletions

View File

@ -224,6 +224,9 @@
<el-form-item label="重复领取">
<el-switch v-model="form.is_repeat_receive" active-value="1" inactive-value="0" />
</el-form-item>
<el-form-item label="公共显示">
<el-switch v-model="form.is_show" active-value="1" inactive-value="0" />
</el-form-item>
<template v-if="form.theme === '4'">
<el-form-item label="内容标题">
<el-input v-model="form.title" placeholder="请输入内容" clearable></el-input>

View File

@ -1,8 +1,8 @@
<template>
<div :class="props.direction == 'vertical' ? 'flex-col gap-x-18' : 'flex-row gap-y-20 jc-e'">
<div :class="props.direction == 'vertical' ? 'flex-col gap-x-18' : 'w flex-row gap-y-20 jc-e'">
<template v-for="(item, index) in props.filterData" :key="index">
<div v-if="!isEmpty(item.form_name) && !isEmpty(new_dataInterface) && !isEmpty(item.type)" class="filter-style flex-row gap-12">
<div v-if="!isEmpty(item.title)" :class="['title text-line-1', props.direction == 'vertical' ? '' : 'horizontal-title']" :style="`width: ${ Number(props.titleWidth) > 0 ? props.titleWidth + 'px;' : '100%' }`">{{ item.title }}</div>
<div v-if="!isEmpty(item.form_name) && !isEmpty(new_dataInterface) && !isEmpty(item.type)" class="filter-style flex-row gap-12 align-c">
<div v-if="!isEmpty(item.title)" :class="['title', props.direction == 'vertical' ? '' : 'horizontal-title']" :style="`width: ${ Number(props.titleWidth) > 0 ? props.titleWidth + 'px;' : '100%' }`">{{ item.title }}</div>
<div class="w h flex-1 vertical-style">
<div class="flex-row align-c gap-10 w h">
<template v-if="item.type == 'select'">
@ -189,6 +189,7 @@ const contains_value = (list: any[], config: any, result: any[], children?: stri
}
.horizontal-title {
flex-basis: max-content;
white-space: nowrap;
}
.title {
font-size: 1.2rem;

View File

@ -1,30 +1,46 @@
<template>
<!-- 优惠券 -->
<div class="container">
<div class="flex-row jc-e gap-20 mb-20 align-c">
<div class="filter-style flex-row gap-12">
<div class="title">类型</div>
<el-select v-model="type" class="search-w" placeholder="请选择" multiple collapse-tags filterable @change="handle_search">
<el-option v-for="item in coupon_type_list" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<div class="w container">
<div class="w vertical-filter mb-20">
<div class="flex-row jc-e gap-20 align-c">
<div class="filter-style flex-row gap-12">
<div class="title flex-1">类型</div>
<el-select v-model="type" class="search-w" placeholder="请选择" multiple collapse-tags filterable @change="handle_search">
<el-option v-for="item in coupon_type_list" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</div>
<div class="filter-style flex-row gap-12">
<div class="title flex-1">到期类型</div>
<el-select v-model="expire_type_ids" multiple collapse-tags filterable placeholder="请选择到期类型" @change="handle_search">
<el-option v-for="item in get_data_list(common_store.common.plugins, 'coupon.expire_type_list')" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</div>
<div class="filter-style flex-row gap-12">
<div class="title flex-1">使用限制</div>
<el-select v-model="use_limit_type_ids" multiple collapse-tags filterable placeholder="请选择使用限制" @change="handle_search">
<el-option v-for="item in get_data_list(common_store.common.plugins, 'coupon.use_limit_type_list')" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</div>
<div class="filter-style flex-row gap-12">
<div class="title flex-1">重复领取</div>
<el-select v-model="is_repeat_receive_text" multiple collapse-tags filterable placeholder="请选择是否可以重复领取" @change="handle_search">
<el-option label="否" :value="0" />
<el-option label="是" :value="1" />
</el-select>
</div>
<div class="filter-style flex-row gap-12">
<div class="title flex-1">公共显示</div>
<el-select v-model="is_show_text" multiple collapse-tags filterable placeholder="请选择是否公共显示" @change="handle_search">
<el-option label="否" :value="0" />
<el-option label="是" :value="1" />
</el-select>
</div>
<el-input v-model="search_value" placeholder="请输入搜索内容" class="search-w" @change="handle_search">
<template #suffix>
<icon name="search" size="16" color="9" class="c-pointer" @click="handle_search"></icon>
</template>
</el-input>
</div>
<div class="filter-style flex-row gap-12">
<div class="title">到期类型</div>
<el-select v-model="expire_type_ids" multiple collapse-tags filterable placeholder="请选择到期类型">
<el-option v-for="item in get_data_list(common_store.common.plugins, 'coupon.expire_type_list')" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</div>
<div class="filter-style flex-row gap-12">
<div class="title">使用限制</div>
<el-select v-model="use_limit_type_ids" multiple collapse-tags filterable placeholder="请选择使用限制">
<el-option v-for="item in get_data_list(common_store.common.plugins, 'coupon.use_limit_type_list')" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</div>
<el-input v-model="search_value" placeholder="请输入搜索内容" class="search-w" @change="handle_search">
<template #suffix>
<icon name="search" size="16" color="9" class="c-pointer" @click="handle_search"></icon>
</template>
</el-input>
</div>
<div class="content">
<el-table v-loading="loading" :data="tableData" class="w" :header-cell-style="{ background: '#f7f7f7' }" row-key="id" height="438" fixed @row-click="row_click" @select="handle_select" @select-all="handle_select">
@ -107,6 +123,8 @@ const handle_search = () => {
const type = ref([]);
const expire_type_ids = ref([]);
const use_limit_type_ids = ref([]);
const is_repeat_receive_text = ref([]);
const is_show_text = ref([]);
interface couponType {
value: string;
name: string;
@ -129,6 +147,8 @@ const get_list = (new_page: number) => {
type_ids: type.value.length > 0 ? type.value.join(',') : '',
expire_type_ids: expire_type_ids.value.length > 0 ? expire_type_ids.value.join(',') : '',
use_limit_type_ids: use_limit_type_ids.value.length > 0 ? use_limit_type_ids.value.join(',') : '',
is_repeat_receive: is_repeat_receive_text.value.length > 0? is_repeat_receive_text.value.join(',') : '',
is_show: is_show_text.value.length > 0? is_show_text.value.join(',') : '',
page_size: page_size.value,
};
loading.value = true;
@ -177,5 +197,15 @@ const handle_select = (selection: any) => {
text-align: right;
width: 100%;
color: #606266;
white-space: nowrap;
}
.vertical-filter {
display: flex;
align-items: center;
padding-bottom: 0.2rem;
overflow-x: auto;
:deep(.el-select) {
min-width: 20rem;
}
}
</style>

View File

@ -13,7 +13,7 @@
</el-menu-item>
</el-menu>
</div>
<div class="right-content flex-1">
<div class="right-content flex-1 w h">
<!-- 商城链接/插件 -->
<template v-if="link_select == 'shop' || link_select == 'plugins'">
<link-list :key="link_select" v-model="link_value" :type="link_select" :reset="reset_compontent"></link-list>
@ -262,6 +262,7 @@ const confirm_event = () => {
.url-value-content {
height: 57.3rem;
gap: 6rem;
overflow: hidden;
.left-content {
width: 22.5rem;
.el-menu-item {

View File

@ -217,7 +217,7 @@ onMounted(() => {
});
//
const get_coupon = () => {
const { number, type, keywords, expire_type_ids, use_limit_type_ids, order_by_type, order_by_rule, is_repeat_receive } = form.value;
const { number, type, keywords, expire_type_ids, use_limit_type_ids, order_by_type, order_by_rule, is_repeat_receive, is_show } = form.value;
const params = {
coupon_number: number,
coupon_type_ids: type.length > 0 ? type.join(',') : '',
@ -227,6 +227,7 @@ const get_coupon = () => {
coupon_order_by_type: order_by_type,
coupon_order_by_rule: order_by_rule,
coupon_is_repeat_receive: is_repeat_receive,
coupon_is_show: is_show,
};
//
CouponAPI.getCoupon(params).then((res: any) => {
@ -240,8 +241,8 @@ const get_coupon = () => {
};
//
const data_list_computer = computed(() => {
const { data_type, type, number, data_list, keywords, expire_type_ids, use_limit_type_ids, order_by_type, order_by_rule, is_repeat_receive } = form.value;
return { data_type, type, number, data_list, keywords, expire_type_ids, use_limit_type_ids, order_by_type, order_by_rule, is_repeat_receive };
const { data_type, type, number, data_list, keywords, expire_type_ids, use_limit_type_ids, order_by_type, order_by_rule, is_repeat_receive, is_show } = form.value;
return { data_type, type, number, data_list, keywords, expire_type_ids, use_limit_type_ids, order_by_type, order_by_rule, is_repeat_receive, is_show };
});
//
watch(

View File

@ -6,7 +6,9 @@
</div>
</template>
<div class="flex-col gap-20 w h pa-20 oh">
<filter-form v-if="dialogVisible && !isEmpty(config?.search_filter_form_config)" :filter-data="config.search_filter_form_config" direction="horizontal" :data-interface="default_data" @form-change="filter_form_change"></filter-form>
<div class="w h vertical-filter">
<filter-form v-if="dialogVisible && !isEmpty(config?.search_filter_form_config)" :filter-data="config.search_filter_form_config" direction="horizontal" :data-interface="default_data" @form-change="filter_form_change"></filter-form>
</div>
<!-- 表格头部如果传输了数据就渲染表格, 否则就不渲染 -->
<template v-if="!isEmpty(config?.header)">
<table-config v-loading="loading" :table-data="tableData" :multiple="multiple" :table-column-list="config.header" :table-row-class-list="tableRowClassList" @select="table_select"></table-config>
@ -194,5 +196,10 @@ watch(() => default_data.value, (val) => {
</script>
<style lang="scss" scoped>
.vertical-filter {
display: flex;
align-items: center;
overflow-x: auto;
padding-bottom: 0.2rem;
}
</style>

View File

@ -16,6 +16,7 @@ interface DefaultCoupon {
order_by_type: number,
order_by_rule: number,
is_repeat_receive: string,
is_show: string,
title: string;
desc: string;
data_list: object[];
@ -61,6 +62,7 @@ const defaultCoupoin: DefaultCoupon = {
order_by_type: 0,
order_by_rule: 0,
is_repeat_receive: '0',
is_show: '0',
// 只有主题4用到
title: '先领券 再购物',
// 只有主题4用到