Merge remote-tracking branch 'origin/test' into test

feature/mall_product
tangqian 2023-06-09 17:10:40 +08:00
commit add7251696
5 changed files with 547 additions and 2 deletions

View File

@ -17,6 +17,15 @@ export function updatePromoter(data) {
})
}
// 更新全部推广员
export function tenantIgnoreUpdate(data) {
return request({
url: '/member/promoter/tenantIgnoreUpdate',
method: 'put',
data: data
})
}
export function updatePassword(data) {
return request({
url: 'member/user/update-password',
@ -41,6 +50,15 @@ export function getPromoter(id) {
})
}
// 获得全部推广员分页
export function getallPage(query) {
return request({
url: '/member/promoter/allPage',
method: 'get',
params: query
})
}
// 获得推广员分页
export function getPromoterPage(query) {
return request({

View File

@ -34,6 +34,14 @@ export function getDept(deptId) {
})
}
// 获取全部部门精简信息列表
export function getDeptListAll() {
return request({
url: '/system/dept/list-all',
method: 'get'
})
}
// 获取部门精简信息列表
export function listSimpleDepts() {
return request({

View File

@ -0,0 +1,519 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
<el-form-item label="所属组织" prop="deptId">
<treeselect style="width: 240px;" v-model="queryParams.deptId" :options="deptOptions" :show-count="true"
:clearable="false"
placeholder="请选择所属组织" :normalizer="normalizer" />
</el-form-item>
<!-- <el-form-item label="启用状态" prop="status">-->
<!-- <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>-->
<!-- <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"-->
<!-- :key="dict.value" :label="dict.label" :value="dict.value"/>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<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="sourceType">
<el-select v-model="queryParams.sourceType" placeholder="请选择来源" clearable @keyup.enter.native="handleQuery">
<el-option value="1" label="后台注册"/>
<el-option value="2" label="扫码注册"/>
</el-select>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="queryParams.mobile" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery" v-hasPermi="['member:promoter:query']"></el-button>
<el-button icon="el-icon-refresh" @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:promoter:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport"
v-hasPermi="['member:promoter:export']">导入
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['member:promoter:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" prop="id"/>
<el-table-column label="推广员名称" align="center" prop="nickname"/>
<el-table-column label="手机号" align="center" prop="mobile"/>
<el-table-column label="注册来源" align="center" prop="sourceType">
<template v-slot="scope">
<div>{{scope.row.sourceType == "1"?'后台注册':'扫码注册'}}</div>
</template>
</el-table-column>
<el-table-column label="所属组织" align="center" prop="orgName"/>
<!-- <el-table-column label="启用状态" align="center" prop="status">-->
<!-- <template v-slot="scope">-->
<!-- <el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1"-->
<!-- @change="handleStatusChange(scope.row)"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['member:promoter:update']">修改
</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-key" @click="handleUpdatePassword(scope.row)"-->
<!-- v-hasPermi="['member:promoter:delete']">修改密码-->
<!-- </el-button>-->
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="所属组织" prop="deptId">
<treeselect style="width: 240px;" v-model="form.deptId" :options="deptOptions" :show-count="true"
:clearable="false"
placeholder="请选择所属组织" :normalizer="normalizer" @select="handleChange"/>
</el-form-item>
<!-- <el-form-item label="启用状态" prop="status">-->
<!-- <el-radio-group v-model="form.status">-->
<!-- <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"-->
<!-- :key="dict.value" :label="parseInt(dict.value)">{{ dict.label }}-->
<!-- </el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="注册来源" prop="sourceType">
<el-select v-model="form.sourceType" placeholder="请选择来源" clearable disabled>
<el-option value="1" label="后台注册"/>
<el-option value="2" label="扫码注册"/>
</el-select>
</el-form-item>
<el-form-item label="推广员姓名" prop="nickname">
<el-input v-model="form.nickname" maxlength="100" placeholder="请输入"/>
</el-form-item>
<el-form-item label="推广员手机号" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :loading="submitLoading" :disabled="submitLoading"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<!-- <div class="el-upload__tip" slot="tip">-->
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据-->
<!-- </div>-->
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
@click="importTemplate">下载模板
</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm" :loading="submitLoading" :disabled="submitLoading"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
<!-- 修改密码 -->
<el-dialog title="修改密码" :visible.sync="updatePassword.show" width="500px" append-to-body>
<el-form ref="updatePasswordForm" :model="updatePasswordForm" :rules="passwrodRules" label-width="80px">
<el-form-item label="密码" prop="password">
<el-input type="password" v-model="updatePasswordForm.password" placeholder="请输入"/>
</el-form-item>
<el-form-item label="确认密码" prop="checkPass">
<el-input type="password" v-model="updatePasswordForm.checkPass" placeholder="请输入"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitPasswordForm" :loading="submitLoading" :disabled="submitLoading"> </el-button>
<el-button @click="updatePassword.show = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createPromoter,
tenantIgnoreUpdate,
deletePromoter,
getPromoter,
getallPage,
importTemplate,
exportPromoterExcel, updatePassword
} from '@/api/member/promoter';
import {
changeUserStatus
} from '@/api/member/user';
import {getDeptListAll} from '@/api/system/dept';
import {listSimplePosts} from '@/api/system/post';
import {getBaseHeader} from '@/utils/request';
import {CommonStatusEnum} from '@/utils/constants';
import {DICT_TYPE} from '@/utils/dict';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
import ImageUpload from '@/components/ImageUpload/index.vue';
export default {
name: 'Promoter',
computed: {
DICT_TYPE() {
return DICT_TYPE
}
},
components: {
ImageUpload,
Treeselect
},
data() {
const validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'));
} else {
if (this.updatePasswordForm.checkPass !== '') {
this.$refs.updatePasswordForm.validateField('checkPass');
}
callback();
}
};
const validateCheckPass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.updatePasswordForm.password) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return {
//
loading: true,
submitLoading: false,
deptOptions: undefined,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
// 广
list: [],
//
title: '',
//
open: false,
//
upload: {
//
open: false,
//
title: '推广员导入',
//
isUploading: false,
//
updateSupport: 0,
//
headers: getBaseHeader(),
//
url: process.env.VUE_APP_BASE_API + '/admin-api/member/promoter/import'
},
updatePassword: {
show: false,
userId: ''
},
passwrodRules:{
password: [
{ required: true, message: "请输入密码", trigger: "blur" },
{ validator: validatePass, trigger: 'blur' }
],
checkPass: [
{ required: true, message: "请输入确认密码", trigger: "blur" },
{ validator: validateCheckPass, trigger: 'blur' }
],
},
updatePasswordForm: {},
//
queryParams: {
pageNo: 1,
pageSize: 10,
deptId: null,
userId: null,
},
//
form: {
},
//
rules: {
deptId: [{
required: true,
message: '请选择所属组织',
trigger: 'blur'
}],
status: [{
required: true,
message: '请选择状态',
trigger: 'blur'
}],
nickname: [{
required: true,
message: '请输入名称',
trigger: 'blur'
}],
mobile: [
{
required: true,
message: '请输入手机号',
trigger: 'blur'
},
{
pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur'
}
]
}
};
},
created() {
this.getList();
this.getTreeselect();
},
methods: {
handleChange(value){
this.form.tenantId = value.tenantId
},
//
normalizer(node) {
return {
id: node.id,
label: node.name,
children: node.children
}
},
/** 查询部门下拉树结构 + 岗位下拉 */
getTreeselect() {
getDeptListAll().then(response => {
// deptOptions
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id'));
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
this.queryParams.deptId = data.id;
},
/** 查询列表 */
getList() {
this.loading = true;
//
getallPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
handleUpdatePassword(row) {
this.updatePasswordForm = {}
this.updatePassword.show = true
this.updatePassword.userId = row.userId
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
deptId: undefined,
userId: undefined,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.form.status = 0
this.form.sourceType = "1"
this.open = true;
this.title = '添加推广员';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = row
this.open = true;
this.title = '修改推广员';
},
submitPasswordForm(){
this.$refs['updatePasswordForm'].validate(valid => {
if (!valid) {
return;
}
this.submitLoading = true
//
updatePassword({
id: this.updatePassword.userId,
password: this.updatePasswordForm.password
}).then(response => {
this.$modal.msgSuccess('修改成功');
this.updatePassword.show = false;
}).finally(()=>{
this.submitLoading = false
})
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
if (!valid) {
return;
}
this.submitLoading = true
//
if (this.form.id != null) {
tenantIgnoreUpdate(this.form).then(response => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
}).finally(()=>{
this.submitLoading = false
})
return;
}
//
createPromoter(this.form).then(response => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
}).finally(()=>{
this.submitLoading = false
})
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除推广员编号为"' + id + '"的数据项?').then(function () {
return deletePromoter(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
}).catch(() => {
});
},
//
handleStatusChange(row) {
console.log('row', row)
let text = row.status === CommonStatusEnum.ENABLE ? '启用' : '禁用';
this.$modal.confirm('您确认要"' + text + '""' + row.nickname + '"推广员吗?').then(function () {
return changeUserStatus({
id: row.userId,
status: row.status
});
}).then(() => {
this.$modal.msgSuccess(text + '成功');
}).catch(function () {
row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
: CommonStatusEnum.ENABLE;
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有推广员数据项?').then(() => {
this.exportLoading = true;
return exportPromoterExcel(params);
}).then(response => {
this.$download.excel(response, '推广员.xls');
this.exportLoading = false;
}).catch(() => {
});
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = '推广员导入';
this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
this.$download.excel(response, '推广员导入模板.xls');
});
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
if (response.code !== 0) {
this.$modal.msgError(response.msg)
return;
}
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
//
let data = response.data;
let text = '创建成功数量:' + data.createUsernames.length;
for (const username of data.createUsernames) {
text += '<br />&nbsp;&nbsp;&nbsp;&nbsp;' + username;
}
text += '<br />创建失败数量:' + Object.keys(data.failureUsernames).length;
for (const username in data.failureUsernames) {
text += '<br />&nbsp;&nbsp;&nbsp;&nbsp;' + username + '' + data.failureUsernames[username];
}
this.$alert(text, '导入结果', {dangerouslyUseHTMLString: true});
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
}
}
};
</script>

View File

@ -84,7 +84,7 @@ export default {
loginForm: {
loginType: "uname",
username: "admin",
password: "admin123",
password: "cyywl20220606.",
rememberMe: false,
captchaVerification: "",
},

View File

@ -56,7 +56,7 @@
</view>
<view class="money-box money-time">
<text>返费结束时间</text>
<text class="money-text">{{item.startTime}}</text>
<text class="money-text">{{item.endTime}}</text>
</view>
</view>
</view>