会员服务-获取所有会员等级

news/2024/11/15 6:46:37/

1.接口文档

在这里插入图片描述
在这里插入图片描述

2.配置会员服务路由

在gulimall-gateway中配置会员服务的路由

 #会员服务- id: member_routeuri: lb://gulimall-memberpredicates:- Path=/api/member/**filters:- RewritePath=/api/(?<segment>.*),/$\{segment}

在这里插入图片描述

3.前端完整代码

3.1.level.vue

<template><div class="mod-config"><el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"><el-form-item><el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input></el-form-item><el-form-item><el-button @click="getDataList()">查询</el-button><el-buttonv-if="isAuth('member:memberlevel:save')"type="primary"@click="addOrUpdateHandle()">新增</el-button><el-buttonv-if="isAuth('member:memberlevel:delete')"type="danger"@click="deleteHandle()":disabled="dataListSelections.length <= 0">批量删除</el-button></el-form-item></el-form><el-table:data="dataList"borderv-loading="dataListLoading"@selection-change="selectionChangeHandle"style="width: 100%;"><el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column><el-table-column prop="id" header-align="center" align="center" label="id"></el-table-column><el-table-column prop="name" header-align="center" align="center" label="等级名称"></el-table-column><el-table-column prop="growthPoint" header-align="center" align="center" label="所需成长值"></el-table-column><el-table-column prop="defaultStatus" header-align="center" align="center" label="默认等级"><template slot-scope="scope"><i class="el-icon-success" v-if="scope.row.defaultStatus==1"></i><i class="el-icon-error" v-else></i></template></el-table-column><el-table-column prop="freeFreightPoint" header-align="center" align="center" label="免运费标准"></el-table-column><el-table-columnprop="commentGrowthPoint"header-align="center"align="center"label="每次评价获取的成长值"></el-table-column><el-table-column label="特权"header-align="center" align="center" ><el-table-columnprop="priviledgeFreeFreight"header-align="center"align="center"label="免邮特权"><template slot-scope="scope"><i class="el-icon-success" v-if="scope.row.priviledgeFreeFreight==1"></i><i class="el-icon-error" v-else></i></template></el-table-column><el-table-columnprop="priviledgeMemberPrice"header-align="center"align="center"label="会员价格特权"width="120px"><template slot-scope="scope"><i class="el-icon-success" v-if="scope.row.priviledgeMemberPrice==1"></i><i class="el-icon-error" v-else></i></template></el-table-column><el-table-columnprop="priviledgeBirthday"header-align="center"align="center"label="生日特权"><template slot-scope="scope"><i class="el-icon-success" v-if="scope.row.priviledgeBirthday==1"></i><i class="el-icon-error" v-else></i></template></el-table-column></el-table-column><el-table-column prop="note" header-align="center" align="center" label="备注"></el-table-column><el-table-column fixed="right" header-align="center" align="center" width="150" label="操作"><template slot-scope="scope"><el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button><el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button></template></el-table-column></el-table><el-pagination@size-change="sizeChangeHandle"@current-change="currentChangeHandle":current-page="pageIndex":page-sizes="[10, 20, 50, 100]":page-size="pageSize":total="totalPage"layout="total, sizes, prev, pager, next, jumper"></el-pagination><!-- 弹窗, 新增 / 修改 --><add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update></div>
</template><script>
import AddOrUpdate from "./memberlevel-add-or-update";
export default {data() {return {dataForm: {key: ""},dataList: [],pageIndex: 1,pageSize: 10,totalPage: 0,dataListLoading: false,dataListSelections: [],addOrUpdateVisible: false};},components: {AddOrUpdate},activated() {this.getDataList();},methods: {// 获取数据列表getDataList() {this.dataListLoading = true;this.$http({url: this.$http.adornUrl("/member/memberlevel/list"),method: "get",params: this.$http.adornParams({page: this.pageIndex,limit: this.pageSize,key: this.dataForm.key})}).then(({ data }) => {if (data && data.code === 0) {this.dataList = data.page.list;this.totalPage = data.page.totalCount;} else {this.dataList = [];this.totalPage = 0;}this.dataListLoading = false;});},// 每页数sizeChangeHandle(val) {this.pageSize = val;this.pageIndex = 1;this.getDataList();},// 当前页currentChangeHandle(val) {this.pageIndex = val;this.getDataList();},// 多选selectionChangeHandle(val) {this.dataListSelections = val;},// 新增 / 修改addOrUpdateHandle(id) {this.addOrUpdateVisible = true;this.$nextTick(() => {this.$refs.addOrUpdate.init(id);});},// 删除deleteHandle(id) {var ids = id? [id]: this.dataListSelections.map(item => {return item.id;});this.$confirm(`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,"提示",{confirmButtonText: "确定",cancelButtonText: "取消",type: "warning"}).then(() => {this.$http({url: this.$http.adornUrl("/member/memberlevel/delete"),method: "post",data: this.$http.adornData(ids, false)}).then(({ data }) => {if (data && data.code === 0) {this.$message({message: "操作成功",type: "success",duration: 1500,onClose: () => {this.getDataList();}});} else {this.$message.error(data.msg);}});});}}
};
</script>

3.2.memberlevel-add-or-update.vue

<template><el-dialog:title="!dataForm.id ? '新增' : '修改'":close-on-click-modal="false":visible.sync="visible"><el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="140px"><el-form-item label="等级名称" prop="name"><el-input v-model="dataForm.name" placeholder="等级名称"></el-input></el-form-item><el-form-item label="所需成长值" prop="growthPoint"><el-input-number v-model="dataForm.growthPoint" :min="0"></el-input-number></el-form-item><el-form-item label="默认等级" prop="defaultStatus"><el-checkbox v-model="dataForm.defaultStatus" :true-label="1" :false-label="0"></el-checkbox></el-form-item><el-form-item label="免运费标准" prop="freeFreightPoint"><el-input-number :min="0" v-model="dataForm.freeFreightPoint"></el-input-number></el-form-item><el-form-item label="每次评价获取的成长值" prop="commentGrowthPoint" label-width="180px"><el-input-number :min="0" v-model="dataForm.commentGrowthPoint"></el-input-number></el-form-item><el-form-item label="是否有免邮特权" prop="priviledgeFreeFreight"><el-checkbox v-model="dataForm.priviledgeFreeFreight" :true-label="1" :false-label="0"></el-checkbox></el-form-item><el-form-item label="是否有会员价格特权" prop="priviledgeMemberPrice" label-width="160px"><el-checkbox v-model="dataForm.priviledgeMemberPrice" :true-label="1" :false-label="0"></el-checkbox></el-form-item><el-form-item label="是否有生日特权" prop="priviledgeBirthday"><el-checkbox v-model="dataForm.priviledgeBirthday" :true-label="1" :false-label="0"></el-checkbox></el-form-item><el-form-item label="备注" prop="note"><el-input v-model="dataForm.note" placeholder="备注"></el-input></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="visible = false">取消</el-button><el-button type="primary" @click="dataFormSubmit()">确定</el-button></span></el-dialog>
</template><script>export default {data () {return {visible: false,dataForm: {id: 0,name: '',growthPoint: 0,defaultStatus: 0,freeFreightPoint: 0,commentGrowthPoint: 0,priviledgeFreeFreight: 0,priviledgeMemberPrice: 0,priviledgeBirthday: 0,note: ""},dataRule: {name: [{ required: true, message: '等级名称不能为空', trigger: 'blur' }],growthPoint: [{ required: true, message: '等级需要的成长值不能为空', trigger: 'blur' }],defaultStatus: [{ required: true, message: '是否为默认等级[0->不是;1->是]不能为空', trigger: 'blur' }],freeFreightPoint: [{ required: true, message: '免运费标准不能为空', trigger: 'blur' }],commentGrowthPoint: [{ required: true, message: '每次评价获取的成长值不能为空', trigger: 'blur' }],priviledgeFreeFreight: [{ required: true, message: '是否有免邮特权不能为空', trigger: 'blur' }],priviledgeMemberPrice: [{ required: true, message: '是否有会员价格特权不能为空', trigger: 'blur' }],priviledgeBirthday: [{ required: true, message: '是否有生日特权不能为空', trigger: 'blur' }],note: [{ required: true, message: '备注不能为空', trigger: 'blur' }]}}},methods: {init (id) {this.dataForm.id = id || 0this.visible = truethis.$nextTick(() => {this.$refs['dataForm'].resetFields()if (this.dataForm.id) {this.$http({url: this.$http.adornUrl(`/member/memberlevel/info/${this.dataForm.id}`),method: 'get',params: this.$http.adornParams()}).then(({data}) => {if (data && data.code === 0) {this.dataForm.name = data.memberLevel.namethis.dataForm.growthPoint = data.memberLevel.growthPoint||0this.dataForm.defaultStatus = data.memberLevel.defaultStatus||0this.dataForm.freeFreightPoint = data.memberLevel.freeFreightPoint||0this.dataForm.commentGrowthPoint = data.memberLevel.commentGrowthPoint||0this.dataForm.priviledgeFreeFreight = data.memberLevel.priviledgeFreeFreight||0this.dataForm.priviledgeMemberPrice = data.memberLevel.priviledgeMemberPrice||0this.dataForm.priviledgeBirthday = data.memberLevel.priviledgeBirthday||0this.dataForm.note = data.memberLevel.note}})}})},// 表单提交dataFormSubmit () {this.$refs['dataForm'].validate((valid) => {if (valid) {this.$http({url: this.$http.adornUrl(`/member/memberlevel/${!this.dataForm.id ? 'save' : 'update'}`),method: 'post',data: this.$http.adornData({'id': this.dataForm.id || undefined,'name': this.dataForm.name,'growthPoint': this.dataForm.growthPoint,'defaultStatus': this.dataForm.defaultStatus,'freeFreightPoint': this.dataForm.freeFreightPoint,'commentGrowthPoint': this.dataForm.commentGrowthPoint,'priviledgeFreeFreight': this.dataForm.priviledgeFreeFreight,'priviledgeMemberPrice': this.dataForm.priviledgeMemberPrice,'priviledgeBirthday': this.dataForm.priviledgeBirthday,'note': this.dataForm.note})}).then(({data}) => {if (data && data.code === 0) {this.$message({message: '操作成功',type: 'success',duration: 1500,onClose: () => {this.visible = falsethis.$emit('refreshDataList')}})} else {this.$message.error(data.msg)}})}})}}}
</script>

http://www.ppmy.cn/news/812525.html

相关文章

网易云游戏时长2023兑换码

有些玩家在网易云游戏平台上有游戏时长的限制&#xff0c;想要延长时间的话&#xff0c;要怎么办呢&#xff1f;可以通过兑换码来免费获取时长&#xff0c;小编这里就给大家分享网易云游戏时长2023兑换码&#xff0c;真实有效。 网易云游戏兑换码兑换教程 1、首先进入网易云游戏…

西部数码服务器未续费,域名到期了,如何续费?

域名到期了&#xff0c;怎么续费&#xff1f; 答&#xff1a;域名到期前&#xff0c;西部数码网站会向会员填写的通知邮箱发出系统通知&#xff0c;提醒您域名等业务进行及时续费&#xff0c;会员可以登录网站进行自助续费&#xff0c;如果是邮件通知&#xff0c;请注意辨识西部…

会员积分

将原有积分进行备份&#xff0c;然后赠送每位会员500积分&#xff0c;编写程序输出积分情况。 package javadome3;import java.util.Scanner;public class Text4 {public static void main(String[] args) {Scanner input new Scanner(System.in);System.out.println("请…

小程序到期了怎么办?

很多商家对于小程序按年收费感到不满。我们之前接触过一些商家,他们说:我辛辛苦苦花了大价钱做了一个小程序,为什么以后还要按年付费,如果不付费就会被第三方软件服务商停运,这根本不是自己的小程序,有一种被绑架的感觉!非常希望能够找到一家公司真正给我提供好用而且无…

qq音乐会员联合会员都有哪些

QQ音乐单买的话要180元/年&#xff0c;选择QQ音乐联合会员不仅便宜&#xff0c;还能获得其他的会员权益。那么qq音乐会员联合会员都有哪些。 1.QQ音乐和百度文库的联合会员。文库月卡QQ音乐年卡119元&#xff0c;文库年卡QQ音乐年卡139元&#xff0c;文库月卡QQ音乐喜马双年卡…

网易VIP等级,QQ会员等级,TOMVIP邮箱多少钱?

网易vip等级都有什么?QQ会员等级有什么?TOMVIP邮箱多少钱?个人VIP邮箱该如何选择?下面来个大家介绍一下这几大品牌的VIP邮箱价格 一、TOMVIP邮箱 TOMVIP邮箱有四个等级,不同的等级特权不同,价格不同。 商务普通版 8.5元/月 100元/年 商务精英版 15元/月 180元/年 商务黄…

咖啡汪日志————使用Redisson延迟队列,实现会员到期前N天提醒

这个其实不怎么推荐&#xff0c;当然她使用的话&#xff0c;也是没有问题的&#xff0c;只是因为用到了定时器 所以不如RMapCache好用&#xff0c;大家可以当作是了解Redisson延时队列来看待这篇博客 源码链接&#xff1a; https://github.com/HuskyCorps/distributeMiddleware…

AutoCAD试用版即将到期怎么办?

如果个人用户的AutoCAD试用版即将到期&#xff0c;并且软件已经显示试用版到期前剩余的天数&#xff0c;用户怎么将试用版转换为固定期限使用许可&#xff1f; AutoCAD试用期到期之际&#xff0c;您是无权延长该期限的&#xff0c;但可以通过订购固定期限使用许可来继续使用软…