修改
This commit is contained in:
parent
bdbeb91993
commit
5d28818c39
@ -26,16 +26,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
type="primary"
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
icon="el-icon-search"
|
|
||||||
size="mini"
|
|
||||||
@click="handleQuery"
|
|
||||||
>搜索</el-button
|
|
||||||
>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
||||||
>重置</el-button
|
|
||||||
>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -48,8 +40,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['system:coupon:add']"
|
v-hasPermi="['system:coupon:add']"
|
||||||
>新增</el-button
|
>新增</el-button>
|
||||||
>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -60,8 +51,7 @@
|
|||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['system:coupon:edit']"
|
v-hasPermi="['system:coupon:edit']"
|
||||||
>修改</el-button
|
>修改</el-button>
|
||||||
>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -72,8 +62,7 @@
|
|||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['system:coupon:remove']"
|
v-hasPermi="['system:coupon:remove']"
|
||||||
>删除</el-button
|
>删除</el-button>
|
||||||
>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -86,25 +75,13 @@
|
|||||||
>导出</el-button
|
>导出</el-button
|
||||||
>
|
>
|
||||||
</el-col>-->
|
</el-col>-->
|
||||||
<right-toolbar
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
:showSearch.sync="showSearch"
|
|
||||||
@queryTable="getList"
|
|
||||||
></right-toolbar>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table
|
<el-table v-loading="loading" :data="couponList" @selection-change="handleSelectionChange">
|
||||||
v-loading="loading"
|
|
||||||
:data="couponList"
|
|
||||||
@selection-change="handleSelectionChange"
|
|
||||||
>
|
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<!-- <el-table-column label="主键id" align="center" prop="id" /> -->
|
<!-- <el-table-column label="主键id" align="center" prop="id" /> -->
|
||||||
<el-table-column
|
<el-table-column label="优惠券名称" align="center" prop="couponTitle" show-overflow-tooltip />
|
||||||
label="优惠券名称"
|
|
||||||
align="center"
|
|
||||||
prop="couponTitle"
|
|
||||||
show-overflow-tooltip
|
|
||||||
/>
|
|
||||||
<el-table-column label="优惠券编码" align="center" prop="couponCode" />
|
<el-table-column label="优惠券编码" align="center" prop="couponCode" />
|
||||||
<el-table-column label="优惠券类型" align="center" prop="couponType">
|
<el-table-column label="优惠券类型" align="center" prop="couponType">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@ -115,17 +92,9 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column label="优惠券有效期(天)" align="center" prop="couponReductionDays" />
|
||||||
label="优惠券有效期(天)"
|
|
||||||
align="center"
|
|
||||||
prop="couponReductionDays"
|
|
||||||
/>
|
|
||||||
<el-table-column label="优惠券面额" align="center" prop="couponPrice" />
|
<el-table-column label="优惠券面额" align="center" prop="couponPrice" />
|
||||||
<el-table-column
|
<el-table-column label="优惠券适用门槛" align="center" prop="couponConsumePrice" />
|
||||||
label="优惠券适用门槛"
|
|
||||||
align="center"
|
|
||||||
prop="couponConsumePrice"
|
|
||||||
/>
|
|
||||||
<el-table-column label="领取方式" align="center" prop="receiveType">
|
<el-table-column label="领取方式" align="center" prop="receiveType">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.receiveType == "NEW_PEOPLE_WELFARE" ? "新人福利" : "" }}
|
{{ scope.row.receiveType == "NEW_PEOPLE_WELFARE" ? "新人福利" : "" }}
|
||||||
@ -145,11 +114,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>-->
|
</el-table-column>-->
|
||||||
<el-table-column label="显示顺序" align="center" prop="showSort" />
|
<el-table-column label="显示顺序" align="center" prop="showSort" />
|
||||||
<el-table-column
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
class-name="small-padding fixed-width"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -157,16 +122,14 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['system:coupon:edit']"
|
v-hasPermi="['system:coupon:edit']"
|
||||||
>修改</el-button
|
>修改</el-button>
|
||||||
>
|
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['system:coupon:remove']"
|
v-hasPermi="['system:coupon:remove']"
|
||||||
>删除</el-button
|
>删除</el-button>
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -180,14 +143,14 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改优惠券信息对话框 -->
|
<!-- 添加或修改优惠券信息对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
<el-dialog
|
||||||
<el-form
|
:title="title"
|
||||||
ref="form"
|
:visible.sync="open"
|
||||||
:model="form"
|
width="800px"
|
||||||
:rules="rules"
|
append-to-body
|
||||||
label-width="130px"
|
:before-close="cancel"
|
||||||
:inline="true"
|
|
||||||
>
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="130px" :inline="true">
|
||||||
<el-form-item label="优惠券名称" prop="couponTitle">
|
<el-form-item label="优惠券名称" prop="couponTitle">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.couponTitle"
|
v-model="form.couponTitle"
|
||||||
@ -211,7 +174,6 @@
|
|||||||
@keyup.native="form.couponPrice =oninput(form.couponPrice) "
|
@keyup.native="form.couponPrice =oninput(form.couponPrice) "
|
||||||
v-model="form.couponPrice"
|
v-model="form.couponPrice"
|
||||||
maxlength="8"
|
maxlength="8"
|
||||||
|
|
||||||
placeholder="请输入优惠券面额,单位:元"
|
placeholder="请输入优惠券面额,单位:元"
|
||||||
style="width: 220px"
|
style="width: 220px"
|
||||||
/>
|
/>
|
||||||
@ -220,7 +182,6 @@
|
|||||||
<el-input
|
<el-input
|
||||||
:change="checkPrice()"
|
:change="checkPrice()"
|
||||||
maxlength="8"
|
maxlength="8"
|
||||||
|
|
||||||
v-model="form.couponConsumePrice"
|
v-model="form.couponConsumePrice"
|
||||||
placeholder="请输入优惠券适用门槛"
|
placeholder="请输入优惠券适用门槛"
|
||||||
style="width: 220px"
|
style="width: 220px"
|
||||||
@ -238,8 +199,7 @@
|
|||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
>
|
></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="优惠券类型" prop="couponType">
|
<el-form-item label="优惠券类型" prop="couponType">
|
||||||
@ -254,8 +214,7 @@
|
|||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
>
|
></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="显示顺序" prop="showSort">
|
<el-form-item label="显示顺序" prop="showSort">
|
||||||
@ -314,7 +273,7 @@ import {
|
|||||||
getCoupon,
|
getCoupon,
|
||||||
delCoupon,
|
delCoupon,
|
||||||
addCoupon,
|
addCoupon,
|
||||||
updateCoupon,
|
updateCoupon
|
||||||
} from "@/api/system/coupon";
|
} from "@/api/system/coupon";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -340,8 +299,8 @@ export default {
|
|||||||
couponTypeoption: [
|
couponTypeoption: [
|
||||||
{
|
{
|
||||||
value: "FULL_REDUCTION_COUPON",
|
value: "FULL_REDUCTION_COUPON",
|
||||||
label: "满减券",
|
label: "满减券"
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// value: "CASH_COUPON",
|
// value: "CASH_COUPON",
|
||||||
// label: "代金券",
|
// label: "代金券",
|
||||||
@ -368,8 +327,8 @@ export default {
|
|||||||
option: [
|
option: [
|
||||||
{
|
{
|
||||||
value: "NEW_PEOPLE_WELFARE",
|
value: "NEW_PEOPLE_WELFARE",
|
||||||
label: "新人福利",
|
label: "新人福利"
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// value: "EVENT_GIFT",
|
// value: "EVENT_GIFT",
|
||||||
// label: "活动赠送",
|
// label: "活动赠送",
|
||||||
@ -397,7 +356,7 @@ export default {
|
|||||||
receiveCount: null,
|
receiveCount: null,
|
||||||
receiveLimitCount: null,
|
receiveLimitCount: null,
|
||||||
useScope: null,
|
useScope: null,
|
||||||
showSort: null,
|
showSort: null
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
@ -407,50 +366,50 @@ export default {
|
|||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入优惠券名称",
|
message: "请输入优惠券名称",
|
||||||
trigger: "blur",
|
trigger: "blur"
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
couponType: [
|
couponType: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请选择优惠券类型",
|
message: "请选择优惠券类型",
|
||||||
trigger: "blur",
|
trigger: "blur"
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
couponReductionDays: [
|
couponReductionDays: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入优惠券有效期",
|
message: "请输入优惠券有效期",
|
||||||
trigger: "blur",
|
trigger: "blur"
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
couponPrice: [
|
couponPrice: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入优惠券面额",
|
message: "请输入优惠券面额",
|
||||||
trigger: "blur",
|
trigger: "blur"
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
couponConsumePrice: [
|
couponConsumePrice: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入优惠券适用门槛",
|
message: "请输入优惠券适用门槛",
|
||||||
trigger: "blur",
|
trigger: "blur"
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
couponDescription: [
|
couponDescription: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入优惠券概述",
|
message: "请输入优惠券概述",
|
||||||
trigger: "blur",
|
trigger: "blur"
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
receiveType: [
|
receiveType: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请选择领取方式",
|
message: "请选择领取方式",
|
||||||
trigger: "blur",
|
trigger: "blur"
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
// useScope: [
|
// useScope: [
|
||||||
// {
|
// {
|
||||||
@ -463,36 +422,33 @@ export default {
|
|||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入显示顺序",
|
message: "请输入显示顺序",
|
||||||
trigger: "blur",
|
trigger: "blur"
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
/**只能输入数字且有小数点最多保留两位*/
|
/**只能输入数字且有小数点最多保留两位*/
|
||||||
checkPrice() {
|
checkPrice() {
|
||||||
let checkPlan = '' + this.form.couponConsumePrice
|
let checkPlan = "" + this.form.couponConsumePrice;
|
||||||
checkPlan = checkPlan
|
checkPlan = checkPlan
|
||||||
.replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符
|
.replace(/[^\d.]/g, "") // 清除“数字”和“.”以外的字符
|
||||||
.replace(/\.{2,}/g, '.') // 只保留第一个. 清除多余的
|
.replace(/\.{2,}/g, ".") // 只保留第一个. 清除多余的
|
||||||
.replace(/^\./g, '') // 保证第一个为数字而不是.
|
.replace(/^\./g, "") // 保证第一个为数字而不是.
|
||||||
.replace('.', '$#$')
|
.replace(".", "$#$")
|
||||||
.replace(/\./g, '')
|
.replace(/\./g, "")
|
||||||
.replace('$#$', '.')
|
.replace("$#$", ".");
|
||||||
if (checkPlan.indexOf('.') < 0 && checkPlan !== '') {
|
if (checkPlan.indexOf(".") < 0 && checkPlan !== "") {
|
||||||
// 以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
|
// 以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
|
||||||
checkPlan = parseFloat(checkPlan) + ''
|
checkPlan = parseFloat(checkPlan) + "";
|
||||||
} else if (checkPlan.indexOf('.') >= 0) {
|
} else if (checkPlan.indexOf(".") >= 0) {
|
||||||
checkPlan = checkPlan
|
checkPlan = checkPlan.replace(/^()*(\d+)\.(\d\d).*$/, "$1$2.$3"); // 只能输入两个小数
|
||||||
.replace(/^()*(\d+)\.(\d\d).*$/, '$1$2.$3') // 只能输入两个小数
|
|
||||||
}
|
}
|
||||||
this.form.couponConsumePrice = checkPlan
|
this.form.couponConsumePrice = checkPlan;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
oninput(num) {
|
oninput(num) {
|
||||||
@ -516,7 +472,10 @@ export default {
|
|||||||
}
|
}
|
||||||
//正则替换
|
//正则替换
|
||||||
str = str.replace(/[^\d^.\\ .]+/g, ""); // 保留数字和小数点
|
str = str.replace(/[^\d^.\\ .]+/g, ""); // 保留数字和小数点
|
||||||
str = str.replace(".", "$#$").replace(/\./g, "").replace("$#$", "."); // 小数点后只能输两位
|
str = str
|
||||||
|
.replace(".", "$#$")
|
||||||
|
.replace(/\./g, "")
|
||||||
|
.replace("$#$", "."); // 小数点后只能输两位
|
||||||
str = str.replace(/^(-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
|
str = str.replace(/^(-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
@ -524,7 +483,7 @@ export default {
|
|||||||
/** 查询优惠券信息列表 */
|
/** 查询优惠券信息列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listCoupon(this.queryParams).then((response) => {
|
listCoupon(this.queryParams).then(response => {
|
||||||
this.couponList = response.rows;
|
this.couponList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@ -563,7 +522,7 @@ export default {
|
|||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -579,7 +538,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map((item) => item.id);
|
this.ids = selection.map(item => item.id);
|
||||||
this.single = selection.length !== 1;
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
@ -593,7 +552,7 @@ export default {
|
|||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids;
|
const id = row.id || this.ids;
|
||||||
getCoupon(id).then((response) => {
|
getCoupon(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改优惠券信息";
|
this.title = "修改优惠券信息";
|
||||||
@ -608,16 +567,16 @@ export default {
|
|||||||
this.form.couponConsumePrice = Number(this.form.couponConsumePrice);
|
this.form.couponConsumePrice = Number(this.form.couponConsumePrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$refs["form"].validate((valid) => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateCoupon(this.form).then((response) => {
|
updateCoupon(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addCoupon(this.form).then((response) => {
|
addCoupon(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -645,11 +604,11 @@ export default {
|
|||||||
this.download(
|
this.download(
|
||||||
"system/coupon/export",
|
"system/coupon/export",
|
||||||
{
|
{
|
||||||
...this.queryParams,
|
...this.queryParams
|
||||||
},
|
},
|
||||||
`coupon_${new Date().getTime()}.xlsx`
|
`coupon_${new Date().getTime()}.xlsx`
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user