This commit is contained in:
夜良king
2023-02-03 10:06:50 +08:00
47 changed files with 1816 additions and 718 deletions

View File

@@ -400,7 +400,7 @@ export const getChildRegion = (id) => {
// 重置用户密码
export const resetPassword = (params) => {
return postRequest(`/passport/user/resetPassword/${params}"`);
return postRequest(`/passport/user/resetPassword/${params}`);
};
// 初始化商品索引

View File

@@ -209,28 +209,34 @@ export const auditApplySeckill = params => {
export const getFullDiscountList = params => {
return getRequest(`/promotion/fullDiscount`, params);
};
// 满优惠列表
export const getFullDiscountById = id => {
return getRequest(`/promotion/fullDiscount/${id}`);
};
// 开启、关闭满额活动
export const updateFullDiscount = (id, promotionStatus) => {
return putRequest(`/promotion/fullDiscount/status/${id}`)
}
// 积分商品列表
export const getPointsGoodsList = params => {
return getRequest(`/promotion/pointsGoods`, params);
};
// 积分商品详情
export const getPointsGoodsById = id => {
return getRequest(`/promotion/pointsGoods/${id}`);
};
// 添加积分商品
export const addPointsGoods = params => {
return postRequest(`/promotion/pointsGoods`, params, {
"Content-type": "application/json"
});
};
// 修改积分商品
export const updatePointsGoods = params => {
return putRequest(`/promotion/pointsGoods`, params, {
@@ -250,19 +256,28 @@ export const deletePointsGoodsStatus = id => {
export const getPointsGoodsCategoryList = params => {
return getRequest(`/promotion/pointsGoodsCategory`, params);
};
// 积分商品分类详情
export const getPointsGoodsCategoryById = id => {
return getRequest(`/promotion/pointsGoodsCategory/${id}`);
};
// 添加积分商品分类
export const addPointsGoodsCategory = params => {
return postRequest(`/promotion/pointsGoodsCategory`, params);
};
// 更新积分商品分类
export const updatePointsGoodsCategory = params => {
return putRequest(`/promotion/pointsGoodsCategory`, params);
};
// 删除积分商品分类
export const deletePointsGoodsCategoryById = id => {
return deleteRequest(`/promotion/pointsGoodsCategory/${id}`);
};
// 获取优惠券领取记录
export const getCouponReceiveList = (params) => {
return getRequest("/promotion/coupon/received", params);
};

View File

@@ -193,6 +193,12 @@ export const otherRouter = {
name: "manager-coupon",
component: () => import("@/views/promotions/coupon/coupon.vue")
},
{
path: "promotions/coupon-receive",
title: "优惠券领取记录",
name: "coupon-receive",
component: () => import("@/views/promotions/coupon/coupon-receive.vue"),
},
{
path: "promotions/add-platform-coupon",
title: "添加平台优惠券",

View File

@@ -57,4 +57,31 @@ export function promotionsScopeTypeRender(h, params) {
]);
}
export function memberPromotionsStatusRender(h, status) {
let text = "未知",
color = "red";
if (status == "NEW") {
text = "已领取";
color = "geekblue";
} else if (status == "USED") {
text = "已使用";
color = "green";
} else if (status == "EXPIRE") {
text = "已过期";
color = "red";
} else if (status == "CLOSED") {
text = "已作废";
color = "red";
}
return h("div", [
h(
"Tag",
{
props: {
color: color,
},
},
text
),
]);
}

View File

@@ -0,0 +1,321 @@
<template>
<div class="search">
<Card>
<Button style="margin-bottom: 10px" @click="back()">返回</Button>
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="75"
class="search-form mb_10"
>
<Form-item label="优惠券名称" prop="couponName">
<Input
type="text"
v-model="searchForm.couponName"
placeholder="请输入优惠券名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="会员名称" prop="memberName">
<Input
type="text"
v-model="searchForm.memberName"
placeholder="请输入会员名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="获取方式" prop="getType">
<Select
v-model="searchForm.getType"
placeholder="请选择"
clearable
style="width: 200px"
>
<Option value="FREE">免费获取</Option>
<Option value="ACTIVITY">活动获取</Option>
</Select>
</Form-item>
<Form-item label="优惠券状态" prop="memberCouponStatus">
<Select
v-model="searchForm.memberCouponStatus"
placeholder="请选择"
clearable
style="width: 200px"
>
<Option value="NEW">已领取</Option>
<Option value="USED">已使用</Option>
<Option value="EXPIRE">已过期</Option>
<Option value="CLOSED">已作废</Option>
</Select>
</Form-item>
<Form-item label="活动时间">
<DatePicker
v-model="selectDate"
type="daterange"
clearable
placeholder="选择起始时间"
style="width: 200px"
></DatePicker>
</Form-item>
<Button
@click="handleSearch"
type="primary"
icon="ios-search"
class="search-btn"
>搜索</Button
>
</Form>
<Table
v-if="refreshTable"
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
class="mt_10"
@on-selection-change="changeSelect"
>
</Table>
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</Card>
</div>
</template>
<script>
import { getCouponReceiveList } from "@/api/promotion";
import {
memberPromotionsStatusRender,
promotionsScopeTypeRender,
} from "@/utils/promotions";
export default {
name: "coupon-recevie",
data() {
return {
loading: true, // 表单加载状态
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "create_time", // 默认排序字段
order: "desc", // 默认排序方式
getType: "", // 默认排序方式
couponId: this.$route.query.couponId, // 优惠券id
},
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
// 表头
{
title: "会员名称",
key: "memberName",
minWidth: 130,
fixed: "left",
},
{
title: "优惠券名称",
key: "couponName",
minWidth: 100,
tooltip: true,
},
{
title: "发布店铺",
key: "storeName",
minWidth: 100,
render: (h, params) => {
return h("div", (params.row.storeName === 'platform' && "平台") || params.row.storeName);
},
},
{
title: "面额/折扣",
key: "price",
width: 100,
render: (h, params) => {
if (params.row.price) {
return h(
"div",
this.$options.filters.unitPrice(params.row.price, "¥")
);
} else {
return h("div", params.row.discount + "折");
}
},
},
{
title: "使用门槛",
key: "consumeThreshold",
width: 130,
},
{
title: "获取方式",
width: 120,
key: "getType",
render: (h, params) => {
if (params.row.getType === "FREE") {
return h("Tag", { props: { color: "red" } }, "免费获取");
} else if (params.row.getType === "ACTIVITY") {
return h("Tag", { props: { color: "volcano" } }, "活动获取");
} else if (params.row.getType === "INSIDE") {
return h("Tag", { props: { color: "lime" } }, "内购");
} else {
return h("Tag", { props: { color: "purple" } }, "未知");
}
},
},
{
title: "会员优惠券状态",
width: 130,
key: "memberCouponStatus",
render: (h, params) => {
return memberPromotionsStatusRender(
h,
params.row.memberCouponStatus
);
},
},
{
title: "优惠券类型",
key: "couponType",
width: 120,
render: (h, params) => {
if (params.row.couponType === "DISCOUNT") {
return h("Tag", { props: { color: "orange" } }, "打折");
} else if (params.row.couponType === "PRICE") {
return h("Tag", { props: { color: "magenta" } }, "减免现金");
} else {
return h("Tag", { props: { color: "purple" } }, "未知");
}
},
},
{
title: "品类描述",
key: "scopeType",
width: 120,
render: (h, params) => {
return promotionsScopeTypeRender(h, params);
},
},
{
title: "有效时间",
width: 150,
render: (h, params) => {
if (
params?.row?.getType === "ACTIVITY" &&
params?.row?.rangeDayType === "DYNAMICTIME"
) {
return h("div", "长期有效");
} else if (params?.row?.startTime && params?.row?.endTime) {
return h("div", {
domProps: {
innerHTML:
params.row.startTime + "<br/>" + params.row.endTime,
},
});
}
},
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
refreshTable: true, // 修改选中状态后刷新表格
selectDate: [], //选中的信息
};
},
props: {
promotionStatus: {
type: String,
default: "",
},
},
watch: {
$route(e) {
// 监听路由,参数变化调取接口
this.searchForm.couponId = e.query.couponId;
if (this.couponId) {
this.getDataList();
} else {
this.$refs.form.resetFields();
}
},
},
methods: {
back() {
this.$store.commit("removeTag", "coupon-receive");
this.$router.go(-1);
},
check() {
// 选中的优惠券
this.$emit("selected", this.selectList);
},
// 初始化数据
init() {
this.getDataList();
},
changePage(v) {
// 改变页码
this.searchForm.pageNumber = v;
this.getDataList();
},
changePageSize(v) {
// 改变页数
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
// 搜索
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
/**
* 选择优惠券
*/
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
if (this.getType === "ACTIVITY") this.check();
},
getDataList() {
// 获取数据
this.loading = true;
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {
this.searchForm.startTime = this.selectDate[0].getTime();
this.searchForm.endTime = this.selectDate[1].getTime();
} else {
this.searchForm.startTime = null;
this.searchForm.endTime = null;
}
getCouponReceiveList(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
console.log(res);
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
},
mounted() {
this.init();
},
};
</script>

View File

@@ -17,6 +17,17 @@
style="width: 200px"
/>
</Form-item>
<Form-item label="获取方式" prop="getType">
<Select
v-model="searchForm.getType"
placeholder="请选择"
clearable
style="width: 200px"
>
<Option value="FREE">免费获取</Option>
<Option value="ACTIVITY">活动获取</Option>
</Select>
</Form-item>
<Form-item label="活动状态" prop="promotionStatus">
<Select
v-model="searchForm.promotionStatus"
@@ -50,6 +61,7 @@
<Row class="operation padding-row" v-if="getType !== 'ACTIVITY'">
<Button @click="add" type="primary">添加优惠券</Button>
<Button @click="delAll">批量关闭</Button>
<Button @click="receivePage()" type="info">优惠券领取记录</Button>
</Row>
<Table
v-if="refreshTable"
@@ -97,6 +109,13 @@
@click="remove(row)"
>删除
</Button>
<Button
style="margin: 5px"
type="info"
size="small"
@click="receivePage(row.id)"
>领取记录
</Button>
</template>
</Table>
<Row type="flex" justify="end" class="mt_10">
@@ -150,12 +169,6 @@ export default {
align: "center",
fixed: "left",
},
{
title: "活动名称",
key: "promotionName",
width: 180,
fixed: "left",
},
{
title: "优惠券名称",
key: "couponName",
@@ -200,6 +213,24 @@ export default {
return h("div", params.row.usedNum + "/" + params.row.receivedNum);
},
},
{
title: "获取方式",
width: 120,
key: "getType",
render: (h, params) => {
if (params.row.getType === "FREE") {
return h("Tag", { props: { color: "red" } }, "免费获取");
} else if (params.row.getType === "ACTIVITY") {
return h("Tag", { props: { color: "volcano" } }, "活动获取");
} else if (params.row.getType === "INSIDE") {
return h("Tag", { props: { color: "lime" } }, "内购");
} else if (params.row.getType === "IGAME") {
return h("Tag", { props: { color: "lime" } }, "游戏人生");
} else {
return h("Tag", { props: { color: "purple" } }, "未知");
}
},
},
{
title: "优惠券类型",
key: "couponType",
@@ -324,6 +355,13 @@ export default {
// 选中的优惠券
this.$emit("selected", this.selectList);
},
receivePage(id) {
if (id) {
this.$router.push({ name: "coupon-receive", query: { couponId: id } });
} else {
this.$router.push({ name: "coupon-receive" });
}
},
// 初始化数据
init() {
this.getDataList();

View File

@@ -33,11 +33,7 @@
<Select
v-model="form.pointsGoodsCategoryId"
:label-in-value="true"
@on-change="
(val) => {
changeCategory(val, index);
}
"
@on-change="changeCategory"
>
<Option v-for="item in categoryList" :value="item.id" :key="item.id">{{
item.name
@@ -97,7 +93,10 @@ export default {
name: "editPointsGoods",
data() {
return {
pointsGoodsCategoryId:'',
pointsGoodsCategoryName:'',
form: {
/** 活动名称 */
promotionName: "",
/** 报名截止时间 */
@@ -110,6 +109,7 @@ export default {
seckillRule: "",
goodsSku: {},
promotionStatus: "NEW",
},
categoryList: [], // 分类列表
id: this.$route.query.id, // 活动id
@@ -134,6 +134,12 @@ export default {
}
},
methods: {
// 分类
changeCategory(v){
console.log(v);
this.pointsGoodsCategoryId=v.value
this.pointsGoodsCategoryName=v.label
},
// 关闭当前页面
closeCurrentPage() {
this.$store.commit("removeTag", "edit-points-goods");
@@ -167,7 +173,12 @@ export default {
this.form.startTime = start;
this.form.endTime = end;
this.submitLoading = true;
updatePointsGoods(this.form).then((res) => {
let params={
...this.form,
pointsGoodsCategoryId: this.pointsGoodsCategoryId,
pointsGoodsCategoryName:this.pointsGoodsCategoryName
}
updatePointsGoods(params).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("积分商品修改成功");