update 会员区分运营商

This commit is contained in:
Lemon
2023-08-25 13:17:30 +08:00
parent 914380b3ea
commit 454022c553
10 changed files with 622 additions and 471 deletions

View File

@@ -12,6 +12,7 @@ import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.enums.uniapp.BalanceChangesEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.domain.MemberPlateNumberRelation;
@@ -21,14 +22,17 @@ import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.service.IMemberPlateNumberRelationService;
import com.jsowell.pile.service.IMemberTransactionRecordService;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import com.jsowell.pile.vo.web.MemberTransactionVO;
import com.jsowell.pile.vo.web.PlatformTesterVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@@ -61,6 +65,22 @@ public class MemberBasicInfoController extends BaseController {
return getDataTable(list);
}
/**
* 获取当前会员表中存在的运营商列表
* @return
*/
@GetMapping("/getMerchantListByAuth")
public RestApiResponse<?> getMerchantListByAuth() {
RestApiResponse<?> response = null;
List<String> deptIds = getDeptIds();
List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuth(deptIds);
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
response = new RestApiResponse<>(list);
return response;
}
/**
* 导出会员基础信息列表
*/

View File

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
import com.jsowell.common.constant.HttpStatus;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.core.domain.model.LoginUser;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
import com.jsowell.common.core.page.PageDomain;
import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.core.page.TableDataInfo;
@@ -17,6 +18,7 @@ import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.sql.SqlUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
@@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.InitBinder;
import javax.servlet.http.HttpServletRequest;
import java.beans.PropertyEditorSupport;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -194,4 +197,23 @@ public class BaseController {
public String getMemberIdByAuthorization(HttpServletRequest request) {
return getMemberIdByAuthorization(request.getHeader("Authorization"));
}
/**
* 获取当前登录账号有权限的运营商部门id
*
* 平台管理员账号会返回空数组
* @return
*/
public List<String> getDeptIds() {
// 获取登录账号信息
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
if (authorizedMap == null) {
return new ArrayList<>();
}
List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
if (CollectionUtils.isNotEmpty(merchantDeptIds)) {
return merchantDeptIds;
}
return new ArrayList<>();
}
}

View File

@@ -2,6 +2,8 @@ package com.jsowell.pile.dto;
import lombok.Data;
import java.util.List;
/**
* TODO
*
@@ -19,4 +21,8 @@ public class QueryMemberInfoDTO {
private String mobileNumber;
private String memberId;
private String merchantId;
private List<String> merchantDeptIds;
}

View File

@@ -3,6 +3,7 @@ package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.dto.QueryMemberInfoDTO;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import org.apache.ibatis.annotations.Param;
@@ -113,4 +114,9 @@ public interface MemberBasicInfoMapper {
*/
List<MemberVO> selectMemberList(@Param("dto") QueryMemberInfoDTO dto);
/**
* 获取当前会员中的运营商列表(带权限校验)
*/
List<MerchantInfoVO> getMerchantListByAuth(@Param("deptIds") List<String> deptIds);
}

View File

@@ -4,6 +4,7 @@ import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.dto.PlatformTesterDTO;
import com.jsowell.pile.dto.QueryMemberInfoDTO;
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.uniapp.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
@@ -146,4 +147,10 @@ public interface IMemberBasicInfoService {
* @return
*/
List<MemberBalanceVO> getMemberRefundAmount(List<String> memberIds);
/**
* 获取当前会员中的运营商列表(带权限校验)
*/
List<MerchantInfoVO> getMerchantListByAuth(List<String> deptIds);
}

View File

@@ -3,8 +3,10 @@ package com.jsowell.pile.service.impl;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.domain.MemberPlateNumberRelation;
@@ -19,6 +21,7 @@ import com.jsowell.pile.mapper.MemberWalletInfoMapper;
import com.jsowell.pile.mapper.MemberWalletLogMapper;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.service.IPileBasicInfoService;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.uniapp.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
@@ -31,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -291,6 +295,15 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
*/
@Override
public List<MemberVO> selectMemberList(QueryMemberInfoDTO dto) {
// 获取登录账号信息
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
if (authorizedMap == null) {
return new ArrayList<>();
}
List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
if (CollectionUtils.isNotEmpty(merchantDeptIds)) {
dto.setMerchantDeptIds(merchantDeptIds);
}
return memberBasicInfoMapper.selectMemberList(dto);
}
@@ -364,5 +377,13 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
return memberWalletLogMapper.getMemberRefundAmount(memberIds);
}
/**
* 获取当前会员中的运营商列表(带权限校验)
*/
@Override
public List<MerchantInfoVO> getMerchantListByAuth(List<String> deptIds) {
return memberBasicInfoMapper.getMerchantListByAuth(deptIds);
}
}

View File

@@ -24,6 +24,13 @@ public class MemberVO {
*/
private String memberId;
private String merchantId;
/**
* 运营商名称
*/
private String merchantName;
/**
* 状态
*/

View File

@@ -197,6 +197,8 @@
<select id="selectMemberList" resultType="com.jsowell.pile.vo.uniapp.MemberVO">
SELECT
t1.merchant_id as merchantId,
t3.merchant_name as merchantName,
t1.member_id as memberId,
t1.STATUS as status,
t1.nick_name as nickName,
@@ -207,12 +209,35 @@
FROM
member_basic_info t1
JOIN member_wallet_info t2 ON t1.member_id = t2.member_id and t2.del_flag = '0'
JOIN pile_merchant_info t3 ON t1.merchant_id = t3.id and t3.del_flag = '0'
where
t1.del_flag = '0'
<if test="dto.mobileNumber != null and dto.mobileNumber != ''">and t1.mobile_number like '%${dto.mobileNumber}%'</if>
<if test="dto.nickName != null and dto.nickName != ''">and t1.nick_name like '%${dto.nickName}%'</if>
<if test="dto.memberId != null and dto.memberId != ''">and t1.member_id like '%${dto.memberId}%'</if>
<if test="dto.merchantId != null and dto.merchantId != ''">and t1.merchant_id like '%${dto.merchantId}%'</if>
<if test="dto.merchantDeptIds != null and dto.merchantDeptIds.size() != 0">
and t3.dept_id in
<foreach collection="dto.merchantDeptIds" item="deptId" open="(" separator="," close=")">
#{deptId,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="getMerchantListByAuth" resultType="com.jsowell.pile.vo.base.MerchantInfoVO">
SELECT DISTINCT
( t1.merchant_id ) as merchantId,
t2.merchant_name as merchantName
FROM
member_basic_info t1
JOIN pile_merchant_info t2 ON t1.merchant_id = t2.id and t1.del_flag = '0'
<where>
<if test="deptIds != null and deptIds.size() != 0">
t2.dept_id in
<foreach collection="deptIds" item="deptid" open="(" separator="," close=")">
#{deptid,jdbcType=VARCHAR}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@@ -2,114 +2,122 @@ import request from '@/utils/request'
// 查询会员基础信息列表
export function listInfo(data) {
return request({
url: '/member/info/list',
method: 'post',
data: data
})
return request({
url: '/member/info/list',
method: 'post',
data: data
})
}
// 查询会员基础信息详细
export function getInfo(id) {
return request({
url: '/member/info/' + id,
method: 'get'
})
return request({
url: '/member/info/' + id,
method: 'get'
})
}
// 查询会员个人桩信息
export function getMemberPersonPileInfo(id) {
return request({
url: '/member/info/getMemberPersonPileInfo/' + id,
method: 'get'
})
return request({
url: '/member/info/getMemberPersonPileInfo/' + id,
method: 'get'
})
}
// 新增会员基础信息
export function addInfo(data) {
return request({
url: '/member/info',
method: 'post',
data: data
})
return request({
url: '/member/info',
method: 'post',
data: data
})
}
// 修改会员基础信息
export function updateInfo(data) {
return request({
url: '/member/info',
method: 'put',
data: data
})
return request({
url: '/member/info',
method: 'put',
data: data
})
}
// 删除会员基础信息
export function delInfo(id) {
return request({
url: '/member/info/' + id,
method: 'delete'
})
return request({
url: '/member/info/' + id,
method: 'delete'
})
}
// 修改会员基础信息
export function updateGiftBalance(data) {
return request({
url: '/member/info/updateGiftBalance',
method: 'put',
data: data
})
return request({
url: '/member/info/updateGiftBalance',
method: 'put',
data: data
})
}
// 获取用户账户余额变动信息
export function getMemberBalanceChanges(data) {
return request({
url: '/member/info/queryMemberBalanceChanges',
method: 'post',
data: data
})
return request({
url: '/member/info/queryMemberBalanceChanges',
method: 'post',
data: data
})
}
// 获取会员交易流水
export function getMemberTransactionRecordList(data) {
return request({
url: '/member/info/selectMemberTransactionRecordList',
method: 'post',
data: data
})
return request({
url: '/member/info/selectMemberTransactionRecordList',
method: 'post',
data: data
})
}
// 删除车牌号信息
export function deletePlateNumber(data) {
return request({
url: '/member/info/deletePlateNumber',
method: 'post',
data: data
})
return request({
url: '/member/info/deletePlateNumber',
method: 'post',
data: data
})
}
//修改车牌号
export function updatePlateNumber(data) {
return request({
url: '/member/info/updatePlateNumber',
method: 'post',
data: data
})
return request({
url: '/member/info/updatePlateNumber',
method: 'post',
data: data
})
}
// 查询会员详情页 平台测试员状态
export function selectPlatformTesterStatus(data) {
return request({
url: '/member/info/selectPlatformTesterStatus',
method: 'post',
data: data
})
return request({
url: '/member/info/selectPlatformTesterStatus',
method: 'post',
data: data
})
}
// 修改会员详情页 平台测试员状态
export function updatePlatformTester(data) {
return request({
url: '/member/info/updatePlatformTester',
method: 'post',
data: data
})
return request({
url: '/member/info/updatePlatformTester',
method: 'post',
data: data
})
}
// 获取运营商列表
export function getMerchantList() {
return request({
url: '/member/info/getMerchantListByAuth',
method: 'get'
})
}

View File

@@ -1,422 +1,451 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="会员id" prop="memberId">
<el-input
v-model="queryParams.memberId"
placeholder="请输入会员id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="运营商" prop="merchantId">
<el-select
v-model="queryParams.merchantId"
clearable placeholder="请选择运营商"
>
<el-option
v-for="item in merchantList"
:key="item.merchantName"
:label="item.merchantName"
:value="item.merchantId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="手机号" prop="mobileNumber">
<el-input
v-model="queryParams.mobileNumber"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<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-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="['member:info:add']"
>新增</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['member:info:edit']"
>修改</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['member:info:remove']"
>删除</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['member:info:export']"
>导出</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<!--<el-table-column label="" align="center" prop="id" />-->
<el-table-column label="会员id" align="center" prop="memberId"/>
<el-table-column label="昵称" align="center" prop="nickName">
<template slot-scope="scope">
<router-link
:to="'/member/detail/index/'+scope.row.memberId"
class="link-type"
>
<span>{{ scope.row.nickName }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag
:options="dict.type.member_status"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column label="头像" align="center" prop="avatarUrl">
<template slot-scope="scope">
<!-- <el-image v-if="scope.row.avatarUrl === null" :src="defaultImg" />-->
<el-image style="height: 50px;width: 50px"
:src="scope.row.avatarUrl === null? defaultImg[0].img :scope.row.avatarUrl"
:preview-src-list='[scope.row.avatarUrl === null? defaultImg[0].img :scope.row.avatarUrl]'/>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobileNumber"/>
<el-table-column label="本金余额" align="center" prop="principalBalance"/>
<!-- <el-table-column label="赠送余额" align="center" prop="giftBalance" />-->
<el-table-column label="备注" align="center" prop="remark"/>
<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="['member:info:edit']"
>修改
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdateGiftBalance(scope.row)"-->
<!-- v-hasPermi="['member:balance:update']"-->
<!-- >充值/扣款</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['member:info: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-form-item label="会员id" prop="memberId">
<el-input
v-model="queryParams.memberId"
placeholder="请输入会员id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- 添加或修改会员基础信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="会员Id" prop="memberId">
<el-input v-model="form.memberId" :disabled="true" placeholder="请输入手机号"/>
</el-form-item>
<el-form-item label="手机号" prop="mobileNumber">
<el-input v-model="form.mobileNumber" :disabled="true" placeholder="请输入手机号"/>
</el-form-item>
<el-form-item label="昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入昵称"/>
</el-form-item>
<el-form-item label="头像url" prop="avatarUrl">
<el-input v-model="form.avatarUrl" placeholder="请输入头像url"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"/>
</el-form-item>
<!--<el-form-item label="本金余额" prop="principalBalance">
<el-input v-model="form.principalBalance" placeholder="请输入本金余额" />
</el-form-item>
<el-form-item label="赠送余额" prop="giftBalance">
<el-input v-model="form.giftBalance" placeholder="请输入赠送余额" />
</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>
<el-form-item label="昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- 添加或修改会员余额对话框 -->
<el-dialog title="会员充值/扣款" @close="closeUpdateGiftBalance" :visible.sync="openUpdateGiftBalance" width="500px"
append-to-body>
<p>后管平台只能充值赠送余额本金余额只能客户通过手机端充值</p>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="操作类型">
<el-radio v-model="type" label="1" border>充值</el-radio>
<el-radio v-model="type" label="2" border>扣款</el-radio>
</el-form-item>
<el-form-item label="金额" prop="giftBalance">
<el-input-number v-model="updateGiftBalance" placeholder="请输入金额" :min="0" :controls="false"
:precision="2"></el-input-number>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitUpdateGiftBalance"> </el-button>
<el-button @click="resetGiftBalance"> </el-button>
</div>
</el-dialog>
</div>
<el-form-item label="手机号" prop="mobileNumber">
<el-input
v-model="queryParams.mobileNumber"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<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-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="['member:info:add']"
>新增</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['member:info:edit']"
>修改</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['member:info:remove']"
>删除</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['member:info:export']"
>导出</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<!--<el-table-column label="" align="center" prop="id" />-->
<el-table-column label="运营商" align="center" prop="merchantName"/>
<el-table-column label="会员id" align="center" prop="memberId"/>
<el-table-column label="昵称" align="center" prop="nickName">
<template slot-scope="scope">
<router-link
:to="'/member/detail/index/'+scope.row.memberId"
class="link-type"
>
<span>{{ scope.row.nickName }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag
:options="dict.type.member_status"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column label="头像" align="center" prop="avatarUrl">
<template slot-scope="scope">
<!-- <el-image v-if="scope.row.avatarUrl === null" :src="defaultImg" />-->
<el-image style="height: 50px;width: 50px"
:src="scope.row.avatarUrl === null? defaultImg[0].img :scope.row.avatarUrl"
:preview-src-list='[scope.row.avatarUrl === null? defaultImg[0].img :scope.row.avatarUrl]'/>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobileNumber"/>
<el-table-column label="本金余额" align="center" prop="principalBalance"/>
<!-- <el-table-column label="赠送余额" align="center" prop="giftBalance" />-->
<el-table-column label="备注" align="center" prop="remark"/>
<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="['member:info:edit']"
>修改
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdateGiftBalance(scope.row)"-->
<!-- v-hasPermi="['member:balance:update']"-->
<!-- >充值/扣款</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['member:info: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="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="会员Id" prop="memberId">
<el-input v-model="form.memberId" :disabled="true" placeholder="请输入手机号"/>
</el-form-item>
<el-form-item label="手机号" prop="mobileNumber">
<el-input v-model="form.mobileNumber" :disabled="true" placeholder="请输入手机号"/>
</el-form-item>
<el-form-item label="昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入昵称"/>
</el-form-item>
<el-form-item label="头像url" prop="avatarUrl">
<el-input v-model="form.avatarUrl" placeholder="请输入头像url"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"/>
</el-form-item>
<!--<el-form-item label="本金余额" prop="principalBalance">
<el-input v-model="form.principalBalance" placeholder="请输入本金余额" />
</el-form-item>
<el-form-item label="赠送余额" prop="giftBalance">
<el-input v-model="form.giftBalance" placeholder="请输入赠送余额" />
</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>
<!-- 添加或修改会员余额对话框 -->
<el-dialog title="会员充值/扣款" @close="closeUpdateGiftBalance" :visible.sync="openUpdateGiftBalance" width="500px"
append-to-body>
<p>后管平台只能充值赠送余额本金余额只能客户通过手机端充值</p>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="操作类型">
<el-radio v-model="type" label="1" border>充值</el-radio>
<el-radio v-model="type" label="2" border>扣款</el-radio>
</el-form-item>
<el-form-item label="金额" prop="giftBalance">
<el-input-number v-model="updateGiftBalance" placeholder="请输入金额" :min="0" :controls="false"
:precision="2"></el-input-number>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitUpdateGiftBalance"> </el-button>
<el-button @click="resetGiftBalance"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listInfo, getInfo, delInfo, addInfo, updateInfo, updateGiftBalance} from "@/api/member/info";
import {listInfo, getInfo, delInfo, addInfo, updateInfo, updateGiftBalance, getMerchantList} from "@/api/member/info";
export default {
name: "Info",
dicts: ['member_status'],
data() {
return {
defaultImg: [{img: require('../../../assets/images/headPort.png')}],
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 会员基础信息表格数据
infoList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
openUpdateGiftBalance: false, // 控制充值扣款对话框
updateGiftBalance: "", // 充值扣款金额
updateGiftBalanceMemberId: "", // 需要充值扣款的会员id
type: '1', // 操作类型 1-充值2-扣款
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
nickName: null,
status: null,
avatarUrl: null,
mobileNumber: null,
memberId: null,
principalBalance: null,
giftBalance: null,
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
computed: {
// 子类型 进账10-充值, 11-赠送, 12-订单结算退款 出账20-后管扣款, 21-订单付款, 22-用户退款
subType() {
return this.type === '1' ? '11' : '20';
}
},
created() {
this.getList();
},
methods: {
/** 查询会员基础信息列表 */
getList() {
this.loading = true;
const params = {
pageNum: this.queryParams.pageNum,
pageSize: this.queryParams.pageSize,
memberId: this.queryParams.memberId,
nickName: this.queryParams.nickName,
mobileNumber: this.queryParams.mobileNumber
}
console.log("params", params)
listInfo(params).then(response => {
this.infoList = response.rows;
console.log(this.infoList);
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
nickName: null,
status: "0",
avatarUrl: null,
mobileNumber: null,
remark: null,
principalBalance: null,
giftBalance: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: 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) {
console.log("修改按钮", row);
this.reset();
const id = row.memberId || this.ids
getInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改会员基础信息";
});
},
// 重置 充值赠送金额相关
resetGiftBalance() {
console.log("重置 充值赠送金额相关");
this.openUpdateGiftBalance = false;
this.updateGiftBalance = "";
this.updateGiftBalanceMemberId = "";
this.type = "1";
},
// changeInput() {
// const pattern = /^[1-9][0-9]*$/; // 正整数的正则表达式
// // 不符合正整数时
// if (!pattern.test(this.updateGiftBalance)) {
// // input 框绑定的内容为空
// this.updateGiftBalance = ''
// }
// },
// 关闭赠送余额 对话框
closeUpdateGiftBalance() {
console.log("关闭赠送余额 对话框");
this.resetGiftBalance();
},
// 点击充值按钮
handleUpdateGiftBalance(row) {
this.openUpdateGiftBalance = true;
this.updateGiftBalanceMemberId = row.memberId;
},
// 点击对话框确认按钮
submitUpdateGiftBalance() {
const param = {
memberId: this.updateGiftBalanceMemberId,
updateGiftBalance: this.updateGiftBalance,
type: this.type,
subType: this.subType
};
console.log("修改会员赠送余额 param:", param);
updateGiftBalance(param).then(response => {
console.log("修改会员赠送余额 response:", response);
this.$modal.msgSuccess("充值成功");
this.openUpdateGiftBalance = false;
this.getList();
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(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 delInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('member/info/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
name: "Info",
dicts: ['member_status'],
data() {
return {
defaultImg: [{img: require('../../../assets/images/headPort.png')}],
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 会员基础信息表格数据
infoList: [],
// 运营商列表
merchantList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
openUpdateGiftBalance: false, // 控制充值扣款对话框
updateGiftBalance: "", // 充值扣款金额
updateGiftBalanceMemberId: "", // 需要充值扣款的会员id
type: '1', // 操作类型 1-充值2-扣款
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
merchantId: null,
nickName: null,
status: null,
avatarUrl: null,
mobileNumber: null,
memberId: null,
principalBalance: null,
giftBalance: null,
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
computed: {
// 子类型 进账10-充值, 11-赠送, 12-订单结算退款 出账20-后管扣款, 21-订单付款, 22-用户退款
subType() {
return this.type === '1' ? '11' : '20';
}
},
created() {
this.getList();
this.getMerchantList();
},
methods: {
/** 查询会员基础信息列表 */
getList() {
this.loading = true;
const params = {
pageNum: this.queryParams.pageNum,
pageSize: this.queryParams.pageSize,
memberId: this.queryParams.memberId,
nickName: this.queryParams.nickName,
mobileNumber: this.queryParams.mobileNumber,
merchantId: this.queryParams.merchantId,
}
console.log("params", params)
listInfo(params).then(response => {
this.infoList = response.rows;
console.log(this.infoList);
this.total = response.total;
this.loading = false;
});
},
// 获取运营商列表
getMerchantList() {
getMerchantList().then((response) =>{
console.log("response", response)
this.merchantList = response.obj
})
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
nickName: null,
status: "0",
avatarUrl: null,
mobileNumber: null,
remark: null,
principalBalance: null,
giftBalance: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: 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) {
console.log("修改按钮", row);
this.reset();
const id = row.memberId || this.ids
getInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改会员基础信息";
});
},
// 重置 充值赠送金额相关
resetGiftBalance() {
console.log("重置 充值赠送金额相关");
this.openUpdateGiftBalance = false;
this.updateGiftBalance = "";
this.updateGiftBalanceMemberId = "";
this.type = "1";
},
// changeInput() {
// const pattern = /^[1-9][0-9]*$/; // 正整数的正则表达式
// // 不符合正整数时
// if (!pattern.test(this.updateGiftBalance)) {
// // input 框绑定的内容为空
// this.updateGiftBalance = ''
// }
// },
// 关闭赠送余额 对话框
closeUpdateGiftBalance() {
console.log("关闭赠送余额 对话框");
this.resetGiftBalance();
},
// 点击充值按钮
handleUpdateGiftBalance(row) {
this.openUpdateGiftBalance = true;
this.updateGiftBalanceMemberId = row.memberId;
},
// 点击对话框确认按钮
submitUpdateGiftBalance() {
const param = {
memberId: this.updateGiftBalanceMemberId,
updateGiftBalance: this.updateGiftBalance,
type: this.type,
subType: this.subType
};
console.log("修改会员赠送余额 param:", param);
updateGiftBalance(param).then(response => {
console.log("修改会员赠送余额 response:", response);
this.$modal.msgSuccess("充值成功");
this.openUpdateGiftBalance = false;
this.getList();
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(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 delInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('member/info/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
}
};
</script>