优惠券列表

master
wqy 2 years ago
parent 471220c8af
commit 642bfca904

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 查询优惠券活动表列表
export function listCouponActivity(query, pageReq) {
return request({
url: '/act/couponActivity/list',
method: 'post',
data: query,
params: pageReq
})
}
// 查询优惠券活动表详细
export function getCouponActivity(id) {
return request({
url: '/act/couponActivity/' + id,
method: 'get'
})
}
// 新增优惠券活动表
export function addCouponActivity(data) {
return request({
url: '/act/couponActivity',
method: 'post',
data: data
})
}
// 修改优惠券活动表
export function updateCouponActivity(data) {
return request({
url: '/act/couponActivity',
method: 'put',
data: data
})
}
// 删除优惠券活动表
export function delCouponActivity(id) {
return request({
url: '/act/couponActivity/' + id,
method: 'delete'
})
}
// 导出优惠券活动表
export function exportCouponActivity(query) {
return request({
url: '/act/couponActivity/export',
method: 'get',
params: query
})
}

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 查询用户领券记录列表
export function listMemberCoupon(query, pageReq) {
return request({
url: '/act/memberCoupon/list',
method: 'post',
data: query,
params: pageReq
})
}
// 查询用户领券记录详细
export function getMemberCoupon(id) {
return request({
url: '/act/memberCoupon/' + id,
method: 'get'
})
}
// 新增用户领券记录
export function addMemberCoupon(data) {
return request({
url: '/act/memberCoupon',
method: 'post',
data: data
})
}
// 修改用户领券记录
export function updateMemberCoupon(data) {
return request({
url: '/act/memberCoupon',
method: 'put',
data: data
})
}
// 删除用户领券记录
export function delMemberCoupon(id) {
return request({
url: '/act/memberCoupon/' + id,
method: 'delete'
})
}
// 导出用户领券记录
export function exportMemberCoupon(query) {
return request({
url: '/act/memberCoupon/export',
method: 'get',
params: query
})
}

@ -1,6 +1,6 @@
export const dict_types = ["sys_user_sex", export const dict_types = ["sys_user_sex",
"sys_show_hide", "sys_normal_disable", "sys_job_status", "sys_job_group", "sys_yes_no", "sys_notice_type", "sys_notice_status", "sys_show_hide", "sys_normal_disable", "sys_job_status", "sys_job_group", "sys_yes_no", "sys_notice_type", "sys_notice_status",
"sys_oper_type", "sys_common_status", "wms_item_type", "wms_carrier_level", "wms_supplier_level", "wms_receipt_type", "wms_receipt_status", "sys_oper_type", "sys_common_status", "wms_item_type", "wms_carrier_level", "wms_supplier_level", "wms_receipt_type", "wms_receipt_status",
"wms_shipment_type", "wms_shipment_status", "wms_movement_type", "wms_movement_status", "wms_shipment_type", "wms_shipment_status", "wms_movement_type", "wms_movement_status",'coupon_use_scope','coupon_exchange_type',
"pms_publish_status", 'sku_sort_list', 'sys_show_status','oms_pay_type','oms_order_status','oms_aftersale_status','oms_aftersale_type' "pms_publish_status", 'sku_sort_list', 'sys_show_status','oms_pay_type','oms_order_status','oms_aftersale_status','oms_aftersale_type'
]; ];

@ -0,0 +1,387 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="100px" size="medium" class="ry_form">
<el-form-item label="活动名称" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入活动名称"
clearable
size="small"
/>
</el-form-item>
<el-form-item label="使用范围" prop="useScope">
<DictRadio v-model="queryParams.useScope" @change="handleQuery" size="small"
:radioData="dict.type.coupon_use_scope" :showAll="'all'"/>
</el-form-item>
<el-form-item label="兑换类型" prop="couponType">
<DictRadio v-model="queryParams.couponType" @change="handleQuery" size="small"
:radioData="dict.type.coupon_exchange_type" :showAll="'all'"/>
</el-form-item>
<el-form-item class="flex_one tr">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['act:couponActivity:opt']"
>新增
</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="CouponActivityList">
<el-table-column label="活动名称" align="center" prop="title"/>
<el-table-column label="使用范围" align="center" prop="useScope">
<template slot-scope="scope">
<dict-tag :value="scope.row.useScope" prop-name="coupon_use_scope"/>
</template>
</el-table-column>
<el-table-column label="优惠内容" align="center">
<template slot-scope="scope">
<span v-if="scope.row.minAmount">{{ scope.row.minAmount }}{{ scope.row.couponAmount }}</span>
<span v-else>{{ scope.row.couponAmount }}</span>
</template>
</el-table-column>
<el-table-column label="发行总数" align="center" prop="totalCount"/>
<el-table-column label="剩余总数" align="center" prop="leftCount"/>
<el-table-column label="已使用" align="center" prop="useCount"/>
<el-table-column label="每人限领" align="center" prop="userLimit"/>
<el-table-column label="兑换类型" align="center" prop="couponType">
<template slot-scope="scope">
<dict-tag :value="scope.row.couponType" prop-name="coupon_exchange_type"/>
</template>
</el-table-column>
<el-table-column label="要兑换的积分" align="center" prop="useIntegral"/>
<el-table-column label="活动时间" align="center" prop="beginTime" width="180">
<template slot-scope="scope">
<p>{{ scope.row.beginTime }}</p>
<p> ~ </p>
<p>{{ scope.row.endTime }}</p>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="seeCouponList(scope.row)"
>领取记录
</el-button>
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
v-hasPermi="['act:couponActivity:opt']"
>修改
</el-button>
<el-button
size="mini"
type="text"
@click="handleDelete(scope.row)"
v-if="scope.row.leftCount === scope.row.totalCount"
v-hasPermi="['act:couponActivity:opt']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改优惠券活动表对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="108px">
<el-form-item label="活动名称" prop="title">
<el-input v-model="form.title" placeholder="请输入活动名称"/>
</el-form-item>
<el-form-item label="发放数量" prop="totalCount">
<el-input-number v-model="form.totalCount" placeholder="请输入发放数量" style="width:220px" :min="1"
:disabled="form.id"/>
</el-form-item>
<el-form-item label="每人限领" prop="userLimit">
<el-input v-model="form.userLimit" style="width:220px">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="最低消费金额" prop="minAmount">
<el-input v-model="form.minAmount" style="width:220px">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="优惠券金额" prop="couponAmount">
<el-input v-model="form.couponAmount" style="width:220px">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="兑换类型" prop="couponType">
<el-radio-group v-model="form.couponType" :disabled="form.id">
<el-radio :label="1">免费兑换</el-radio>
<el-radio :label="2">积分兑换</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="要兑换的积分" prop="useIntegral" v-if="form.couponType === 2">
<el-input-number v-model="form.useIntegral" placeholder="请输入要兑换的积分" style="width:220px"
:disabled="form.id"/>
</el-form-item>
<el-form-item label="活动开始时间" prop="beginTime">
<el-date-picker clearable size="small"
v-model="form.beginTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择活动开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="活动结束时间" prop="endTime">
<el-date-picker clearable size="small"
v-model="form.endTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择活动结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="使用范围" prop="useScope">
<el-radio-group v-model="form.useScope" :disabled="form.id">
<el-radio :label="1">全场通用</el-radio>
<el-radio :label="2">指定商品可用</el-radio>
<el-radio :label="3">指定商品不可用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="商品列表" prop="productIds" v-if="[2,3].includes(form.useScope)">
<el-button @click="chooseSku" size="small">选择商品</el-button>
<el-table :data="productList" class="mt10" max-height="300px">
<el-table-column label="菜品信息">
<template v-slot="{row}">
<div class="flex-center">
<el-image v-if="row.pic" :src="row.pic" :preview-src-list="[row.pic]" class="small-img circle-img"/>
<span class="ml5">{{ row.name }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template v-slot="{row}">
<span class="red ml5 pointer" @click="delProduct(row)"></span>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<product-select ref="productSelect" @onComplete="completeProductIds"/>
<receive-list ref="receiveListRef"/>
</div>
</template>
<script>
import {
listCouponActivity,
delCouponActivity,
addCouponActivity,
updateCouponActivity,
exportCouponActivity
} from "@/api/act/couponActivity";
import ProductSelect from "@/views/pms/product/productSelect.vue";
import receiveList from "@/views/act/couponActivity/receiveList.vue";
export default {
name: "CouponActivity",
components: {ProductSelect, receiveList},
dicts: ['coupon_use_scope', 'coupon_exchange_type'],
data() {
return {
//
loading: true,
productList: [],
//
exportLoading: false,
//
ids: [],
//
total: 0,
//
CouponActivityList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
title: null,
useScope: null,
couponType: null,
},
//
form: {},
//
rules: {
title: [
{required: true, message: "活动名称不能为空", trigger: "blur"}
],
useScope: [
{required: true, message: "使用范围不能为空", trigger: "change"}
],
totalCount: [
{required: true, message: "发行总数不能为空", trigger: "blur"}
],
userLimit: [
{required: true, message: "每人限领不能为空", trigger: "blur"}
],
couponAmount: [
{required: true, message: "优惠券金额不能为空", trigger: "blur"}
],
couponType: [
{required: true, message: "兑换类型不能为空", trigger: "change"}
],
beginTime: [
{required: true, message: "活动开始时间不能为空", trigger: "change"}
],
endTime: [
{required: true, message: "活动结束时间不能为空", trigger: "change"}
],
},
showMoreCondition: false
};
},
created() {
this.getList();
},
methods: {
delProduct(item) {
this.productList = this.productList.filter(it => it.id !== item.id)
this.completeProductIds([])
},
completeProductIds(products) {
this.productList = this.productList.concat(products)
if (!this.productList.length) {
this.form.productIds = null
return
}
this.form.productIds = this.productList.map(it => it.id).join()
},
chooseSku() {
this.$refs.productSelect.init(this.productList.map(it => it.id))
},
/** 查询优惠券活动表列表 */
getList() {
this.loading = true;
const {pageNum, pageSize} = this.queryParams;
const query = {...this.queryParams, pageNum: undefined, pageSize: undefined};
const pageReq = {page: pageNum - 1, size: pageSize};
listCouponActivity(query, pageReq).then(response => {
const {content, totalElements} = response
this.CouponActivityList = content;
this.total = totalElements;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
title: null,
useScope: 1,
productIds: null,
totalCount: null,
userLimit: 1,
couponAmount: null,
minAmount: null,
useIntegral: null,
couponType: 1,
beginTime: null,
endTime: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 新增按钮操作 */
handleAdd() {
this.productList = []
this.reset();
this.open = true;
this.title = "添加优惠券活动";
},
seeCouponList(row) {
this.$refs.receiveListRef.init(row.id)
},
/** 修改按钮操作 */
handleUpdate(row) {
this.productList = row.productList
this.form = row;
this.open = true;
this.title = "修改优惠券活动";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
delete this.form.createTime
updateCouponActivity(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCouponActivity(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除优惠券活动【' + row.title + '】?').then(function () {
return delCouponActivity(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$modal.confirm('是否确认导出所有优惠券活动表数据项?').then(() => {
this.exportLoading = true;
return exportCouponActivity(queryParams);
}).then(response => {
this.$download.download(response);
this.exportLoading = false;
}).catch(() => {
});
}
}
};
</script>

@ -0,0 +1,95 @@
<template>
<el-dialog title="领取记录" :visible.sync="open" width="80%" append-to-body>
<el-form :model="queryParams" :inline="true" label-width="100px" size="medium" class="ry_form">
<el-form-item label="使用状态" prop="useStatus">
<DictRadio v-model="queryParams.useStatus" @change="handleQuery" size="small"
:radioData="dict.type.activity_coupon_status" :showAll="'all'"/>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tableList">
<el-table-column label="券ID" align="center" prop="id" />
<el-table-column label="用户信息 " align="center">
<template slot-scope="scope">
<div class="flex-center">
<el-avatar :src="scope.row.avatar"></el-avatar>
<div class="tl ml5">
<p>{{scope.row.nickname}}</p>
<p>{{scope.row.phone}}</p>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="领取时间" align="center" prop="createTime" width="180" />
<el-table-column label="使用状态" align="center">
<template slot-scope="scope">
<dict-tag :value="scope.row.useStatus" prop-name="activity_coupon_status"/>
</template>
</el-table-column>
<el-table-column label="有效期" align="center" width="180" >
<template slot-scope="scope">
<p>{{ scope.row.startTime}}</p>
<p> ~ </p>
<p>{{ scope.row.endTime}}</p>
</template>
</el-table-column>
<el-table-column label="订单号" align="center" prop="itemId" />
<el-table-column label="使用时间" align="center" prop="useTime" width="180" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-dialog>
</template>
<script>
import {listMemberCoupon} from "@/api/act/memberCoupon";
export default {
dicts: ['activity_coupon_status'],
data(){
return{
open:false,
loading: false,
tableList: [],
queryParams: {
pageNum: 1,
pageSize: 10,
useStatus: null,
couponActivityId: null,
},
total: 0,
}
},
methods:{
async init(activityId){
if (!activityId) {
return
}
this.queryParams.couponActivityId = activityId
await this.handleQuery()
this.open = true
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
getList() {
this.loading = true;
const {pageNum, pageSize} = this.queryParams;
const query = {...this.queryParams, pageNum: undefined, pageSize: undefined};
const pageReq = {page: pageNum - 1, size: pageSize};
return listMemberCoupon(query, pageReq).then(response => {
const { content, totalElements } = response
this.tableList = content;
this.total = totalElements;
this.loading = false;
});
},
}
}
</script>

@ -0,0 +1,474 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" size="medium" class="ry_form">
<el-form-item label="活动id" prop="couponActivityId">
<el-input
v-model="queryParams.couponActivityId"
placeholder="请输入活动id"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户id" prop="memberId">
<el-input
v-model="queryParams.memberId"
placeholder="请输入用户id"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="活动名称" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入活动名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="使用范围 1全场通用 2指定商品可用 3指定商品不可用" prop="useScope">
<el-input
v-model="queryParams.useScope"
placeholder="请输入使用范围 1全场通用 2指定商品可用 3指定商品不可用"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="商品id集合逗号分隔" prop="productIds">
<el-input
v-model="queryParams.productIds"
placeholder="请输入商品id集合逗号分隔"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="优惠券金额" prop="couponAmount">
<el-input
v-model="queryParams.couponAmount"
placeholder="请输入优惠券金额"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="最低消费金额" prop="minAmount">
<el-input
v-model="queryParams.minAmount"
placeholder="请输入最低消费金额"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<template v-if="showMoreCondition">
<el-form-item label="要兑换的积分" prop="useIntegral">
<el-input
v-model="queryParams.useIntegral"
placeholder="请输入要兑换的积分"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="1免费兑换 2积分兑换" prop="couponType">
<el-select v-model="queryParams.couponType" placeholder="请选择1免费兑换 2积分兑换" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="券开始时间" prop="beginTime">
<el-date-picker
clearable
size="small"
v-model="queryParams.beginTime"
type="datetime"
value-format="yyyy-MM-ddTHH:mm:ss"
placeholder="选择券开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="券结束时间" prop="endTime">
<el-date-picker
clearable
size="small"
v-model="queryParams.endTime"
type="datetime"
value-format="yyyy-MM-ddTHH:mm:ss"
placeholder="选择券结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="0未使用 1已使用" prop="useStatus">
<el-select v-model="queryParams.useStatus" placeholder="请选择0未使用 1已使用" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="订单id" prop="orderId">
<el-input
v-model="queryParams.orderId"
placeholder="请输入订单id"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="使用时间" prop="useTime">
<el-date-picker
clearable
size="small"
v-model="queryParams.useTime"
type="datetime"
value-format="yyyy-MM-ddTHH:mm:ss"
placeholder="选择使用时间">
</el-date-picker>
</el-form-item>
</template>
<el-form-item class="flex_one tr">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
<el-button :icon="showMoreCondition ? 'el-icon-arrow-up' : 'el-icon-arrow-down'" size="mini" @click="showMoreCondition = !showMoreCondition">{{showMoreCondition ? '收起条件' : '展开条件'}}</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['act:memberCoupon:add']"
>新增</el-button>
</el-col>
</el-col>
</el-row>
<el-table v-loading="loading" :data="MemberCouponList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="活动id" align="center" prop="couponActivityId" />
<el-table-column label="用户id" align="center" prop="memberId" />
<el-table-column label="活动名称" align="center" prop="title" />
<el-table-column label="使用范围 1全场通用 2指定商品可用 3指定商品不可用" align="center" prop="useScope" />
<el-table-column label="商品id集合逗号分隔" align="center" prop="productIds" />
<el-table-column label="优惠券金额" align="center" prop="couponAmount" />
<el-table-column label="最低消费金额" align="center" prop="minAmount" />
<el-table-column label="要兑换的积分" align="center" prop="useIntegral" />
<el-table-column label="1免费兑换 2积分兑换" align="center" prop="couponType" />
<el-table-column label="券开始时间" align="center" prop="beginTime" width="180" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.beginTime, '')}}</span>
</template>
</el-table-column>
<el-table-column label="券结束时间" align="center" prop="endTime" width="180" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endTime, '')}}</span>
</template>
</el-table-column>
<el-table-column label="0未使用 1已使用" align="center" prop="useStatus" />
<el-table-column label="订单id" align="center" prop="orderId" />
<el-table-column label="使用时间" align="center" prop="useTime" width="180" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.useTime, '')}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['act:memberCoupon:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['act:memberCoupon:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改用户领券记录对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="108px" inline class="dialog-form-two">
<el-form-item label="活动id" prop="couponActivityId">
<el-input v-model="form.couponActivityId" placeholder="请输入活动id" />
</el-form-item>
<el-form-item label="用户id" prop="memberId">
<el-input v-model="form.memberId" placeholder="请输入用户id" />
</el-form-item>
<el-form-item label="活动名称" prop="title">
<el-input v-model="form.title" placeholder="请输入活动名称" />
</el-form-item>
<el-form-item label="使用范围 1全场通用 2指定商品可用 3指定商品不可用" prop="useScope">
<el-input v-model="form.useScope" placeholder="请输入使用范围 1全场通用 2指定商品可用 3指定商品不可用" />
</el-form-item>
<el-form-item label="商品id集合逗号分隔" prop="productIds">
<el-input v-model="form.productIds" placeholder="请输入商品id集合逗号分隔" />
</el-form-item>
<el-form-item label="优惠券金额" prop="couponAmount">
<el-input v-model="form.couponAmount" placeholder="请输入优惠券金额" />
</el-form-item>
<el-form-item label="最低消费金额" prop="minAmount">
<el-input v-model="form.minAmount" placeholder="请输入最低消费金额" />
</el-form-item>
<el-form-item label="要兑换的积分" prop="useIntegral">
<el-input v-model="form.useIntegral" placeholder="请输入要兑换的积分" />
</el-form-item>
<el-form-item label="1免费兑换 2积分兑换" prop="couponType">
<el-select v-model="form.couponType" placeholder="请选择1免费兑换 2积分兑换">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="券开始时间" prop="beginTime">
<el-date-picker clearable size="small"
v-model="form.beginTime"
type="datetime"
value-format="yyyy-MM-ddTHH:mm:ss"
placeholder="选择券开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="券结束时间" prop="endTime">
<el-date-picker clearable size="small"
v-model="form.endTime"
type="datetime"
value-format="yyyy-MM-ddTHH:mm:ss"
placeholder="选择券结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="0未使用 1已使用">
<el-radio-group v-model="form.useStatus">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="订单id" prop="orderId">
<el-input v-model="form.orderId" placeholder="请输入订单id" />
</el-form-item>
<el-form-item label="使用时间" prop="useTime">
<el-date-picker clearable size="small"
v-model="form.useTime"
type="datetime"
value-format="yyyy-MM-ddTHH:mm:ss"
placeholder="选择使用时间">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listMemberCoupon, getMemberCoupon, delMemberCoupon, addMemberCoupon, updateMemberCoupon, exportMemberCoupon } from "@/api/act/memberCoupon";
export default {
name: "MemberCoupon",
data() {
return {
//
loading: true,
//
exportLoading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
MemberCouponList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
couponActivityId: null,
memberId: null,
title: null,
useScope: null,
productIds: null,
couponAmount: null,
minAmount: null,
useIntegral: null,
couponType: null,
beginTime: null,
endTime: null,
useStatus: null,
orderId: null,
useTime: null,
},
//
form: {},
//
rules: {
couponActivityId: [
{ required: true, message: "活动id不能为空", trigger: "blur" }
],
title: [
{ required: true, message: "活动名称不能为空", trigger: "blur" }
],
useScope: [
{ required: true, message: "使用范围 1全场通用 2指定商品可用 3指定商品不可用不能为空", trigger: "blur" }
],
couponAmount: [
{ required: true, message: "优惠券金额不能为空", trigger: "blur" }
],
couponType: [
{ required: true, message: "1免费兑换 2积分兑换不能为空", trigger: "change" }
],
beginTime: [
{ required: true, message: "券开始时间不能为空", trigger: "blur" }
],
endTime: [
{ required: true, message: "券结束时间不能为空", trigger: "blur" }
],
useStatus: [
{ required: true, message: "0未使用 1已使用不能为空", trigger: "blur" }
],
},
showMoreCondition: false
};
},
created() {
this.getList();
},
methods: {
/** 查询用户领券记录列表 */
getList() {
this.loading = true;
const {pageNum, pageSize} = this.queryParams;
const query = {...this.queryParams, pageNum: undefined, pageSize: undefined};
const pageReq = {page: pageNum - 1, size: pageSize};
listMemberCoupon(query, pageReq).then(response => {
const { content, totalElements } = response
this.MemberCouponList = content;
this.total = totalElements;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
couponActivityId: null,
memberId: null,
title: null,
useScope: null,
productIds: null,
couponAmount: null,
minAmount: null,
useIntegral: null,
couponType: null,
beginTime: null,
endTime: null,
useStatus: 0,
orderId: null,
useTime: null,
createTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加用户领券记录";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getMemberCoupon(id).then(response => {
this.form = response;
this.open = true;
this.title = "修改用户领券记录";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateMemberCoupon(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMemberCoupon(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除用户领券记录编号为"' + ids + '"的数据项?').then(function() {
return delMemberCoupon(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$modal.confirm('是否确认导出所有用户领券记录数据项?').then(() => {
this.exportLoading = true;
return exportMemberCoupon(queryParams);
}).then(response => {
this.$download.download(response);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>

@ -0,0 +1,131 @@
<template>
<el-dialog :title="chooseSkuObj.title" :visible.sync="chooseSkuObj.open" :width="chooseSkuObj.width" append-to-body>
<el-form ref="auditForm" inline :model="chooseSkuObj.queryParams" label-width="80px">
<el-form-item label="菜品名称" prop="nameLike">
<el-input
size="small"
placeholder="请输入菜品名称"
v-model="chooseSkuObj.queryParams.nameLike"
clearable
/>
</el-form-item>
<el-form-item label="菜品分类" prop="productCategoryName">
<product-category-select v-model="chooseSkuObj.queryParams.categoryId"></product-category-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getSkuList"></el-button>
</el-form-item>
</el-form>
<el-table class="mt20" :data="chooseSkuObj.list" ref="table" v-loading="chooseSkuObj.loading" max-height="500"
row-key="id" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"/>
<el-table-column label="菜品名称" align="center" prop="name">
<template v-slot="{row}">
<div class="flex-center">
<el-image v-if="row.pic" :src="row.pic" :preview-src-list="[row.pic]" class="small-img circle-img"/>
<span class="ml5">{{ row.name }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="销量" align="center" prop="sales"/>
<el-table-column label="创建时间" align="center" prop="createTime"/>
</el-table>
<pagination
v-show="chooseSkuObj.total>0"
:total="chooseSkuObj.total"
:page.sync="chooseSkuObj.queryParams.pageNum"
:limit.sync="chooseSkuObj.queryParams.pageSize"
@pagination="getSkuList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="chooseSkuObj.open=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {listPmsProduct} from "@/api/pms/product";
import ProductCategorySelect from "@/views/components/ProductCategorySelect.vue";
export default {
components: {ProductCategorySelect},
data() {
return {
selectSkuIds: [],
selectProducts: [],
chooseSkuObj: {
loading: false,
open: false,
title: "选择菜品",
list: [],
width: '60%',
queryParams: {
pageNum: 1,
categoryId: null,
pageSize: 10,
nameLike: null,
publishStatus: 1,
excludeProductIds: []
},
total: 0
}
}
},
methods: {
submitForm() {
this.$emit('onComplete', this.selectProducts)
this.chooseSkuObj.open = false
},
async init(chooseProductId) {
this.chooseSkuObj.queryParams.excludeProductIds = chooseProductId;
this.chooseSkuObj.queryParams.pageNum = 1;
await this.getSkuList();
this.chooseSkuObj.open = true
this.$nextTick(()=>{
this.$refs.table.clearSelection()
})
},
judge() {
this.$nextTick(()=>{
this.chooseSkuObj.list.forEach(ele => {
if (this.selectProducts.some(item => item.id === ele.id)) {
this.$refs.table.toggleRowSelection(ele, true)
} else {
this.$refs.table.toggleRowSelection(ele, false)
}
});
})
},
handleSelectionChange(selection) {
this.selectProducts = selection
},
async getSkuList() {
this.chooseSkuObj.loading = true;
const query = {...this.chooseSkuObj.queryParams, pageNum: undefined, pageSize: undefined};
if (query.categoryId && Array.isArray(query.categoryId)) {
query.categoryId = query.categoryId.pop()
}
const {pageNum, pageSize} = this.chooseSkuObj.queryParams;
const pageReq = {page: pageNum - 1, size: pageSize};
await listPmsProduct(query, pageReq).then(response => {
const {content, totalElements} = response
this.chooseSkuObj.list = [...content];
this.chooseSkuObj.total = totalElements;
this.chooseSkuObj.loading = false;
});
},
}
}
</script>
<style lang="stylus">
.line
display flex
align-items center
margin-bottom: 5px;
border-bottom 1px dashed #ccc
.line:last-child
border-bottom 0 !important
margin-bottom 0 !important
</style>
Loading…
Cancel
Save