会员权益-修改状态字典

This commit is contained in:
XinWei 2024-09-30 08:55:36 +08:00
parent 1d965addd4
commit 0db74fac5b
13 changed files with 147 additions and 64 deletions

View File

@ -1,44 +1,48 @@
import request from '@/config/axios'
// 付费会员权益 VO
export interface PaidMemberBenefitVO {
id: number // 编号
name: string // 名称
iconUrl: string // 图标地址
intro: string // 描述
status: boolean // 状态:(默认)0隐藏 1显示
sort: number // 排序
}
// 付费会员权益 API
export const PaidMemberBenefitApi = {
// 查询付费会员权益分页
getPaidMemberBenefitPage: async (params: any) => {
return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/page`, params })
},
// 查询付费会员权益详情
getPaidMemberBenefit: async (id: number) => {
return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/get?id=` + id })
},
// 新增付费会员权益
createPaidMemberBenefit: async (data: PaidMemberBenefitVO) => {
return await request.post({ url: `/paidmemberbenefit/paid-member-benefit/create`, data })
},
// 修改付费会员权益
updatePaidMemberBenefit: async (data: PaidMemberBenefitVO) => {
return await request.put({ url: `/paidmemberbenefit/paid-member-benefit/update`, data })
},
// 删除付费会员权益
deletePaidMemberBenefit: async (id: number) => {
return await request.delete({ url: `/paidmemberbenefit/paid-member-benefit/delete?id=` + id })
},
// 导出付费会员权益 Excel
exportPaidMemberBenefit: async (params) => {
return await request.download({ url: `/paidmemberbenefit/paid-member-benefit/export-excel`, params })
},
}
import request from '@/config/axios'
// 付费会员权益 VO
export interface PaidMemberBenefitVO {
id: number // 编号
name: string // 名称
iconUrl: string // 图标地址
intro: string // 描述
status: boolean // 状态:(默认)0隐藏 1显示
sort: number // 排序
}
// 付费会员权益 API
export const PaidMemberBenefitApi = {
// 查询付费会员权益分页
getPaidMemberBenefitPage: async (params: any) => {
return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/page`, params })
},
// 查询付费会员权益详情
getPaidMemberBenefit: async (id: number) => {
return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/get?id=` + id })
},
// 新增付费会员权益
createPaidMemberBenefit: async (data: PaidMemberBenefitVO) => {
return await request.post({ url: `/paidmemberbenefit/paid-member-benefit/create`, data })
},
// 修改付费会员权益
updatePaidMemberBenefit: async (data: PaidMemberBenefitVO) => {
return await request.put({ url: `/paidmemberbenefit/paid-member-benefit/update`, data })
},
// 修改会员权益状态
updatePaidMemberBenefitStatus: async (data: any) => {
return await request.put({ url: `/paidmemberbenefit/paid-member-benefit/updateStatus`, data})
},
// 删除付费会员权益
deletePaidMemberBenefit: async (id: number) => {
return await request.delete({ url: `/paidmemberbenefit/paid-member-benefit/delete?id=` + id })
},
// 导出付费会员权益 Excel
exportPaidMemberBenefit: async (params) => {
return await request.download({ url: `/paidmemberbenefit/paid-member-benefit/export-excel`, params })
},
}

View File

@ -227,6 +227,7 @@ export enum DICT_TYPE {
PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status', // 砍价记录的状态
PROMOTION_COMBINATION_RECORD_STATUS = 'promotion_combination_record_status', // 拼团记录的状态
PROMOTION_BANNER_POSITION = 'promotion_banner_position', // banner 定位
MEMBER_BENEFIT_STATUS = 'member_benefit_status', // 会员权益状态
// ========== CRM - 客户管理模块 ==========
CRM_AUDIT_STATUS = 'crm_audit_status', // CRM 审批状态

View File

@ -17,9 +17,14 @@
<el-input v-model="formData.intro" placeholder="请输入描述" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
<el-select v-model="formData.status" class="!w-240px" placeholder="请选择" clearable>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.MEMBER_BENEFIT_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="formData.sort" placeholder="请输入排序" />
@ -33,7 +38,7 @@
</template>
<script setup lang="ts">
import { PaidMemberBenefitApi, PaidMemberBenefitVO } from '@/api/mall/promotion/memberbenefit'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
/** 付费会员权益 表单 */
defineOptions({ name: 'PaidMemberBenefitForm' })

View File

@ -36,13 +36,13 @@
/>
</el-form-item> -->
<el-form-item label="状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择状态"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
<el-select v-model="queryParams.status" class="!w-240px" placeholder="请选择" clearable>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.MEMBER_BENEFIT_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="排序" prop="sort">
@ -96,7 +96,19 @@
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="图标地址" align="center" prop="iconUrl" />
<el-table-column label="描述" align="center" prop="intro" />
<el-table-column label="状态" align="center" prop="status" />
<el-table-column align="center" label="状态" min-width="80">
<template #default="{ row }">
<el-switch
v-model="row.status"
:active-value="1"
:inactive-value="0"
active-text="显示"
inactive-text="隐藏"
inline-prompt
@click="handleStatusChange(row)"
/>
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sort" />
<el-table-column
label="创建时间"
@ -144,7 +156,8 @@ import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { PaidMemberBenefitApi, PaidMemberBenefitVO } from '@/api/mall/promotion/memberbenefit'
import PaidMemberBenefitForm from './PaidMemberBenefitForm.vue'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { ProductSpuStatusEnum } from '@/utils/constants'
/** 付费会员权益 列表 */
defineOptions({ name: 'PaidMemberBenefit' })
@ -166,13 +179,13 @@ const queryParams = reactive({
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await PaidMemberBenefitApi.getPaidMemberBenefitPage(queryParams)
list.value = data.list
console.table(list.value)
total.value = data.total
} finally {
loading.value = false
@ -229,4 +242,22 @@ const handleExport = async () => {
onMounted(() => {
getList()
})
/** 更新显示/隐藏状态 */
const handleStatusChange = async (row: any) => {
try {
//
const text = row.status ? '显示' : '隐藏'
await message.confirm(`确认要${text}"${row.name}"吗?`)
//
await PaidMemberBenefitApi.updatePaidMemberBenefitStatus({id: row.id, status: row.status })
message.success(text + '成功')
//
await getList()
} catch {
row.status =
row.status === ProductSpuStatusEnum.DISABLE.status
? ProductSpuStatusEnum.ENABLE.status
: ProductSpuStatusEnum.DISABLE.status
}
}
</script>

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.member.controller.admin.memberbenefit;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitRespVO;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitStatusReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
import cn.iocoder.yudao.module.member.service.memberbenefit.PaidMemberBenefitService;
import org.springframework.web.bind.annotation.*;
@ -54,6 +55,13 @@ public class PaidMemberBenefitController {
paidMemberBenefitService.updatePaidMemberBenefit(updateReqVO);
return success(true);
}
@PutMapping("/updateStatus")
@Operation(summary = "更新付费会员权益")
@PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:update')")
public CommonResult<Boolean> updatePaidMemberBenefitStatus(@RequestBody PaidMemberBenefitStatusReqVO req) {
paidMemberBenefitService.updatePaidMemberBenefitStatus(req);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除付费会员权益")

View File

@ -25,7 +25,7 @@ public class PaidMemberBenefitPageReqVO extends PageParam {
private String intro;
@Schema(description = "状态:(默认)0隐藏 1显示", example = "1")
private Boolean status;
private Integer status;
@Schema(description = "排序")
private Integer sort;

View File

@ -31,7 +31,7 @@ public class PaidMemberBenefitRespVO {
@Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("状态:(默认)0隐藏 1显示")
private Boolean status;
private Integer status;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("排序")

View File

@ -25,7 +25,7 @@ public class PaidMemberBenefitSaveReqVO {
@Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态:(默认)0隐藏 1显示不能为空")
private Boolean status;
private Integer status;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "排序不能为空")

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 付费会员权益新增/修改 Request VO")
@Data
public class PaidMemberBenefitStatusReqVO {
@Schema(description = " 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29131")
private Long id;
@Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态:(默认)0隐藏 1显示不能为空")
private Integer status;
}

View File

@ -42,7 +42,7 @@ public class PaidMemberBenefitDO extends BaseDO {
/**
* 状态(默认)0隐藏 1显示
*/
private Boolean status;
private Integer status;
/**
* 排序
*/

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitStatusReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
/**
@ -53,4 +54,9 @@ public interface PaidMemberBenefitService {
*/
PageResult<PaidMemberBenefitDO> getPaidMemberBenefitPage(PaidMemberBenefitPageReqVO pageReqVO);
/**
* 更新付费会员状态
* @return void
*/
void updatePaidMemberBenefitStatus(PaidMemberBenefitStatusReqVO req);
}

View File

@ -1,7 +1,9 @@
package cn.iocoder.yudao.module.member.service.memberbenefit;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO;
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitStatusReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberbenefit.PaidMemberBenefitMapper;
import org.springframework.stereotype.Service;
@ -72,4 +74,12 @@ public class PaidMemberBenefitServiceImpl implements PaidMemberBenefitService {
return paidMemberBenefitMapper.selectPage(pageReqVO);
}
@Override
public void updatePaidMemberBenefitStatus(PaidMemberBenefitStatusReqVO req) {
// 校验存在
validatePaidMemberBenefitExists(req.getId());
// 更新状态
paidMemberBenefitMapper.updateById(new PaidMemberBenefitDO().setId(req.getId()).setStatus(req.getStatus()));
}
}

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.srbscribe.service.reservation;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.ServiceTimeVO;
@ -18,7 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;