Commit bd572eb2 by yancanhua

fix: 优惠券功能开发

1 parent cfd08467
<template>
<a-card class="tabs-card" :bordered="false">
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm"
@onSearch="handlePageReload" @onReset="handleReset" :simpleFieldNum="4"></m-pagination-query-render>
<!--查询栏end-->
<div class="table-operations" style="margin-bottom: 16px;width: 100%;float: left;">
<div class="flex justify-end" style="float: right;">
<a-button type="primary" @click="handleAdd({})">创建活动</a-button>
</div>
</div>
<a-table :columns="columns" :data-source="pagination.content" :loading="loading" :bordered="false"
@change="pageRefresh" @resizeColumn="this.$filters.tableResizeColumn" size="small" :pagination="pageState"
:row-key="record => record.id" :scroll="{ y: 'calc(100vh - 350px)' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'activityType'">
{{activityTypeList.find(item => item.value === record.activityType)?.label || '-'}}
</template>
<template v-if="column.key === 'status'">
{{statusList.find(item => item.value === record.status)?.label || '-'}}
</template>
</template>
</a-table>
</a-card>
</template>
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { message, TableColumnsType } from "ant-design-vue";
import { Operator, Order } from "lib/src/core/page/Pagination";
import { PaginationComponent } from "@/components/PaginationComponent";
import { Vehicle } from "lib/src/entity/vehicle/entity/Vehicle";
import { DetectionController } from "@/api/DetectionController";
@Component({
components: {}
})
export default class DiscountActivityPage extends PaginationComponent<Vehicle> {
activityTypeList = [
{ label: '自动触发发放', value: 1 },
{ label: '直接发放', value: 2 },
];
statusList = [
{ label: '待启动', value: 1 },
{ label: '进行中', value: 2 },
{ label: '已结束', value: 3 },
{ label: '已停用', value: 4 },
];
/**
* 表格列配置
*/
columns: TableColumnsType = [
{
title: '序号', key: 'index', width: 70, align: 'center', sorter: false,
customRender: ({ index }) => {
return (this.getPagination().pageIndex - 1) * this.getPagination().pageSize + index + 1;
},
},
{ title: '活动名称/ID', dataIndex: 'activityName', key: 'activityName', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '活动有效期', dataIndex: 'templateName', key: 'templateName', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '发放策略', dataIndex: 'activityType', key: 'activityType', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '关联优惠券', dataIndex: 'couponIds', key: 'couponIds', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '面额/最高抵扣(元)', dataIndex: 'faceAmount', key: 'faceAmount', align: 'center', width: 240, resizable: true, ellipsis: true },
{ title: '关联活动数', dataIndex: ['vehicle', 'baseInfo', "licensePlate"], key: 'licensePlate', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '生效人群', dataIndex: 'totalQuantity', key: 'totalQuantity', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '发放/使用数量(张)', dataIndex: 'scoreLevel', key: 'scoreLevel', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '核销率', dataIndex: 'scoreLevel', key: 'scoreLevel', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '创建时间', dataIndex: 'updateTime', key: 'updateTime', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '状态', dataIndex: 'status', key: 'status', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '操作', key: 'action', width: 170, align: 'center', fixed: 'right' },
];
getPagination() {
return this.pagination;
}
/**
* 初始化配置
*/
created(): void {
this.init(this.axios, DetectionController.PAGE_INSPECTOR_REPORT);
this.buildQueryForm({
keyword: [null, { label: '活动名称/ID', field: 'keyword', placeholder: '请输入活动名称/ID', operator: Operator.like }],
status: [null, { label: '活动状态', field: 'status', type: 'select', allowClear: true, optionItems: this.statusList, operator: Operator.eq }],
activityType: [null, { label: '发放策略', type: 'select', optionItems: this.activityTypeList, allowClear: true, field: 'activityType', operator: Operator.eq }],
createTime: [null, { label: '创建时间', field: 'createTime', operator: Operator.dateBetween, type: 'date-range' }],
});
this.pagination.setDefaultSort('createTime', Order.desc);
this.pageLoad();
}
//查询
handlePageReload() {
this.pageReload();
}
//重置查询条件
handleReset() {
this.pageReset();
}
}
</script>
<style scoped lang="less"></style>
<template>
<div>
</div>
</template>
\ No newline at end of file \ No newline at end of file
<template>
<a-card class="tabs-card" :bordered="false">
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm"
@onSearch="handlePageReload" @onReset="handleReset" :simpleFieldNum="4"></m-pagination-query-render>
<!--查询栏end-->
<div class="table-operations" style="margin-bottom: 16px;width: 100%;float: left;">
<div class="flex justify-end" style="float: right;">
<a-button type="primary" @click="handleAdd({ pageState: 'ADD' })">
<template #icon>
<PlusOutlined class="mr-5" />
</template>
创建优惠券
</a-button>
</div>
</div>
<a-table :columns="columns" :data-source="pagination.content" :loading="loading" :bordered="false"
@change="pageRefresh" @resizeColumn="this.$filters.tableResizeColumn" size="small" :pagination="pageState"
:row-key="record => record.id" :scroll="{ y: 'calc(100vh - 350px)' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'couponType'">
{{couponTypeList.find(item => item.value === record.couponType)?.label || '-'}}
</template>
<template v-if="column.key === 'deductionType'">
{{deductionTypeList.find(item => item.value === record.deductionType)?.label || '-'}}
</template>
<template v-if="column.key === 'status'">
{{statusList.find(item => item.value === record.status)?.label || '-'}}
</template>
</template>
</a-table>
<CouponAddForm ref="couponAddFormRef" @emitOk="handlePageReload" />
</a-card>
</template>
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { message, TableColumnsType } from "ant-design-vue";
import { Operator, Order } from "lib/src/core/page/Pagination";
import { PaginationComponent } from "@/components/PaginationComponent";
import { Vehicle } from "lib/src/entity/vehicle/entity/Vehicle";
import { DetectionController } from "@/api/DetectionController";
import CouponAddForm from "@/views/discount/coupon/components/CouponAddForm.vue";
import { PlusOutlined } from '@ant-design/icons-vue';
@Component({
components: { PlusOutlined, CouponAddForm }
})
export default class DiscountCouponPage extends PaginationComponent<Vehicle> {
couponTypeList = [
{ label: '固定面额券', value: 1 },
{ label: '阶梯满减券', value: 2 },
];
deductionTypeList = [
{ label: '抵扣车款', value: 1 },
{ label: '抵扣佣金', value: 2 },
];
statusList = [
{ label: '启用中', value: 1 },
{ label: '已停用', value: 2 },
];
/**
* 表格列配置
*/
columns: TableColumnsType = [
{
title: '序号', key: 'index', width: 70, align: 'center', sorter: false,
customRender: ({ index }) => {
return (this.getPagination().pageIndex - 1) * this.getPagination().pageSize + index + 1;
},
},
{ title: '优惠券ID', dataIndex: 'templateId', key: 'templateId', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '优惠券名称', dataIndex: 'templateName', key: 'templateName', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '优惠券有效期', dataIndex: "woId", key: 'woId', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '抵扣类型', dataIndex: 'deductionType', key: 'deductionType', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '面额/最高抵扣(元)', dataIndex: 'faceAmount', key: 'faceAmount', align: 'center', width: 240, resizable: true, ellipsis: true },
{ title: '关联活动数', dataIndex: ['vehicle', 'baseInfo', "licensePlate"], key: 'licensePlate', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '发放总量', dataIndex: 'totalQuantity', key: 'totalQuantity', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '优惠券说明', dataIndex: 'scoreLevel', key: 'scoreLevel', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '状态', dataIndex: 'status', key: 'status', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '创建/更新时间', dataIndex: 'updateTime', key: 'updateTime', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '操作', key: 'action', width: 170, align: 'center', fixed: 'right' },
];
getPagination() {
return this.pagination;
}
/**
* 初始化配置
*/
created(): void {
this.init(this.axios, DetectionController.PAGE_INSPECTOR_REPORT);
this.buildQueryForm({
templateName: [null, { label: '优惠券名称', field: 'templateName', placeholder: '请输入优惠券名称', operator: Operator.like }],
templateId: [null, { label: '优惠券ID', field: 'templateId', placeholder: '请输入优惠券ID', operator: Operator.like }],
couponType: [null, { label: '优惠券类型', field: 'couponType', type: 'select', allowClear: true, optionItems: this.couponTypeList, operator: Operator.eq }],
deductionType: [null, { label: '抵扣类型', type: 'select', optionItems: this.deductionTypeList, allowClear: true, field: 'deductionType', operator: Operator.eq }],
status: [null, { label: '状态', field: 'status', type: 'select', allowClear: true, optionItems: this.statusList, operator: Operator.eq }],
createTime: [null, { label: '创建时间', field: 'createTime', operator: Operator.dateBetween, type: 'date-range' }],
});
this.pagination.setDefaultSort('createTime', Order.desc);
this.pageLoad();
}
//查询
handlePageReload() {
this.pageReload();
}
//重置查询条件
handleReset() {
this.pageReset();
}
handleAdd(data) {
this.$refs.couponAddFormRef.init(data);
}
}
</script>
<style scoped lang="less"></style>
<template>
<div>
</div>
</template>
\ No newline at end of file \ No newline at end of file
<template>
<div>
<a-drawer width="680" :title="titleVisible" placement="right" :open="dialogVisible" @close="onClose">
<template #extra>
<a-space>
<a-button @click="onClose">取消</a-button>
<a-button type="primary" @click="handleOk()">保存</a-button>
</a-space>
</template>
<a-spin :spinning="submitted" style="margin-top: 16px;">
<a-form layout="vertical" :model="postData" :label-col="labelCol" :wrapper-col="wrapperCol"
ref="formRef">
<title-divider title="基础信息"></title-divider>
<a-form-item name="couponType" label="优惠券类型" :rules="[{ required: true, message: '请选择优惠券类型' }]">
<a-select v-model:value="postData.couponType" style="width: 100%;">
<a-select-option value="1">固定面额券</a-select-option>
<a-select-option value="2">阶梯满减券</a-select-option>
</a-select>
</a-form-item>
<a-form-item name="templateName" label="优惠券名称" :rules="[{ required: true, message: '请输入优惠券名称' }]">
<a-input v-model:value="postData.templateName" maxlength="100" placeholder="请输入优惠券名称" />
</a-form-item>
<a-form-item name="totalQuantity" label="发放总量" :rules="[{ required: true, message: '请选择发放总量' }]">
<a-select v-model:value="postData.totalQuantity" style="width: 100%;">
<a-select-option value="1">不限制</a-select-option>
<a-select-option value="2">固定数量</a-select-option>
</a-select>
</a-form-item>
<title-divider title="抵扣规则"></title-divider>
<a-form-item name="remark" label="使用说明">
<a-textarea v-model:value="postData.remark" show-count :maxlength="200"
placeholder="请输入优惠券使用说明,此内容将展示给前端用户" :rows="4" style="width: 580px;" />
</a-form-item>
<a-form-item name="remark" label="备注">
<a-textarea v-model:value="postData.remark" show-count :maxlength="200"
placeholder="仅用于后台运营人员记录信息,不会展示给前端用户" :rows="4" style="width: 580px;" />
</a-form-item>
</a-form>
</a-spin>
</a-drawer>
</div>
</template>
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { EnhanceFormComponent } from "@/core/form/EnhanceFormComponent";
import { message } from "ant-design-vue";
import { User } from "lib/src/entity/security/entity/User";
import TitleDivider from "@/components/TitleDivider.vue";
@Component({
components: { TitleDivider }
})
export default class CouponAddForm extends EnhanceFormComponent<User> {
dialogVisible = false;
titleVisible = "创建优惠券";
pageData = {};
//提交数据
postData = {
id: "",
inspectionAddress: "",
}
init(data): void {
this.pageData = data || {};
this.titleVisible = data.pageState === 'ADD' ? '创建优惠券' : '编辑优惠券';
this.dialogVisible = true;
}
onClose() {
this.dialogVisible = false;
}
handleOk() {
this.$refs.formRef.validate().then((valid) => {
if (valid) {
}
});
}
}
</script>
<style scoped lang="less"></style>
\ No newline at end of file \ No newline at end of file
<template>
<a-card class="tabs-card" :bordered="false">
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm"
@onSearch="handlePageReload" @onReset="handleReset" :simpleFieldNum="4"></m-pagination-query-render>
<!--查询栏end-->
<div class="table-operations" style="margin-bottom: 16px;width: 100%;float: left;">
<div class="flex justify-end" style="float: right;">
<a-button type="primary" @click="handleAdd({})">手动发放</a-button>
</div>
</div>
<a-table :columns="columns" :data-source="pagination.content" :loading="loading" :bordered="false"
@change="pageRefresh" @resizeColumn="this.$filters.tableResizeColumn" size="small" :pagination="pageState"
:row-key="record => record.id" :scroll="{ y: 'calc(100vh - 350px)' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'activityType'">
{{activityTypeList.find(item => item.value === record.activityType)?.label || '-'}}
</template>
<template v-if="column.key === 'status'">
{{statusList.find(item => item.value === record.status)?.label || '-'}}
</template>
</template>
</a-table>
</a-card>
</template>
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { message, TableColumnsType } from "ant-design-vue";
import { Operator, Order } from "lib/src/core/page/Pagination";
import { PaginationComponent } from "@/components/PaginationComponent";
import { Vehicle } from "lib/src/entity/vehicle/entity/Vehicle";
import { DetectionController } from "@/api/DetectionController";
@Component({
components: {}
})
export default class DiscountActivityPage extends PaginationComponent<Vehicle> {
activityTypeList = [
{ label: '自动触发发放', value: 1 },
{ label: '直接发放', value: 2 },
];
statusList = [
{ label: '待启动', value: 1 },
{ label: '进行中', value: 2 },
{ label: '已结束', value: 3 },
{ label: '已停用', value: 4 },
];
/**
* 表格列配置
*/
columns: TableColumnsType = [
{
title: '序号', key: 'index', width: 70, align: 'center', sorter: false,
customRender: ({ index }) => {
return (this.getPagination().pageIndex - 1) * this.getPagination().pageSize + index + 1;
},
},
{ title: '活动ID / 名称', dataIndex: 'activityName', key: 'activityName', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '优惠券ID / 名称', dataIndex: 'templateName', key: 'templateName', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '发放用户名 / 手机号', dataIndex: 'activityType', key: 'activityType', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '发放类型', dataIndex: 'couponIds', key: 'couponIds', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '优惠券状态', dataIndex: 'faceAmount', key: 'faceAmount', align: 'center', width: 240, resizable: true, ellipsis: true },
{ title: '关联订单号 / 车型', dataIndex: ['vehicle', 'baseInfo', "licensePlate"], key: 'licensePlate', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '成交价 / 抵扣金额', dataIndex: 'totalQuantity', key: 'totalQuantity', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '发放时间', dataIndex: 'scoreLevel', key: 'scoreLevel', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '使用/过期时间', dataIndex: 'scoreLevel', key: 'scoreLevel', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '操作', key: 'action', width: 170, align: 'center', fixed: 'right' },
];
getPagination() {
return this.pagination;
}
/**
* 初始化配置
*/
created(): void {
this.init(this.axios, DetectionController.PAGE_INSPECTOR_REPORT);
this.buildQueryForm({
activityId: [null, { label: '活动信息', field: 'activityId', placeholder: '输入活动名称或ID', operator: Operator.like }],
userId: [null, { label: '用户信息', field: 'userId', placeholder: '输入用户名或手机号', operator: Operator.like }],
status: [null, { label: '优惠券状态', field: 'status', type: 'select', allowClear: true, optionItems: this.statusList, operator: Operator.eq }],
activityType: [null, { label: '发放类型', type: 'select', optionItems: this.activityTypeList, allowClear: true, field: 'activityType', operator: Operator.eq }],
orderId: [null, { label: '关联订单号', field: 'orderId', placeholder: '输入订单号', operator: Operator.like }],
createTime: [null, { label: '发放时间', field: 'createTime', operator: Operator.dateBetween, type: 'date-range' }],
});
this.pagination.setDefaultSort('createTime', Order.desc);
this.pageLoad();
}
//查询
handlePageReload() {
this.pageReload();
}
//重置查询条件
handleReset() {
this.pageReset();
}
}
</script>
<style scoped lang="less"></style>
<template>
<div>
</div>
</template>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!