Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product

pull/2/head
tangqian 2023-05-17 18:21:41 +08:00
commit 711b61ca25
3 changed files with 212 additions and 79 deletions

View File

@ -53,11 +53,7 @@ export function exportUserExcel(query) {
}) })
} }
// 用户状态修改 // 用户状态修改
export function changeUserStatus(id, status) { export function changeUserStatus(data) {
const data = {
id,
status
}
return request({ return request({
url: '/member/user/update-status', url: '/member/user/update-status',
method: 'put', method: 'put',

View File

@ -2,12 +2,23 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="组织id" prop="orgId"> <el-form-item label="所属组织" prop="orgId">
<el-input v-model="queryParams.orgId" placeholder="请输入组织id" clearable @keyup.enter.native="handleQuery"/> <treeselect style="width: 240px;" v-model="queryParams.orgId" :options="deptOptions" :show-count="true"
:clearable="false"
placeholder="请选择所属组织" :normalizer="normalizer"/>
</el-form-item> </el-form-item>
<el-form-item label="会员id" prop="userId"> <el-form-item label="启用状态" prop="status">
<el-input v-model="queryParams.userId" placeholder="请输入会员id" clearable @keyup.enter.native="handleQuery"/> <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="mobile">
<el-input v-model="queryParams.mobile" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
@ -19,11 +30,13 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['member:promoter:create']">新增</el-button> v-hasPermi="['member:promoter:create']">新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport" <el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport"
v-hasPermi="['system:user:import']">导入</el-button> v-hasPermi="['system:user:import']">导入
</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"--> <!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"-->
@ -40,17 +53,18 @@
<el-table-column label="所属组织" align="center" prop="orgName"/> <el-table-column label="所属组织" align="center" prop="orgName"/>
<el-table-column label="启用状态" align="center" prop="status"> <el-table-column label="启用状态" align="center" prop="status">
<template v-slot="scope"> <template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1" @change="handleStatusChange(scope.row)" /> <el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1"
@change="handleStatusChange(scope.row)"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope"> <template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['member:promoter:update']">修改</el-button> v-hasPermi="['member:promoter:update']">修改
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" </el-button>
v-hasPermi="['member:promoter:delete']">修改密码</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleUpdatePassword(scope.row)"
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleStatusChange(scope.row)" v-hasPermi="['member:promoter:delete']">修改密码
v-hasPermi="['member:promoter:delete']">禁用</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -60,12 +74,24 @@
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="组织id" prop="orgId"> <el-form-item label="所属组织" prop="orgId">
<el-input v-model="form.orgId" placeholder="请输入组织id" /> <treeselect style="width: 240px;" v-model="form.orgId" :options="deptOptions" :show-count="true"
:clearable="false"
placeholder="请选择所属组织" :normalizer="normalizer"/>
</el-form-item> </el-form-item>
<el-form-item label="会员id" prop="userId"> <el-form-item label="启用状态" prop="status">
<el-input v-model="form.userId" placeholder="请输入会员id" /> <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="nickname">
<el-input v-model="form.nickname" placeholder="请输入"/>
</el-form-item>
<el-form-item label="推广员手机号" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -85,7 +111,9 @@
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据--> <!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据-->
<!-- </div>--> <!-- </div>-->
<span>仅允许导入xlsxlsx格式文件</span> <span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"></el-link> <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
@click="importTemplate">下载模板
</el-link>
</div> </div>
</el-upload> </el-upload>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -93,30 +121,62 @@
<el-button @click="upload.open = false"> </el-button> <el-button @click="upload.open = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 修改密码 -->
<el-dialog title="修改密码" :visible.sync="updatePassword.show" width="500px" append-to-body>
<el-form ref="form" :model="updatePasswordForm" :rules="passwrodRules" label-width="80px">
<el-form-item label="密码" prop="title">
<el-input v-model="form.title" placeholder="请输入"/>
</el-form-item>
<el-form-item label="确认密码" prop="picUrl">
<el-input v-model="form.title" placeholder="请输入"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="updatePassword.show = false"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createPromoter, updatePromoter, deletePromoter, getPromoter, getPromoterPage, importTemplate,exportPromoterExcel } from "@/api/member/promoter"; import {
createPromoter,
updatePromoter,
deletePromoter,
getPromoter,
getPromoterPage,
importTemplate,
exportPromoterExcel
} from '@/api/member/promoter';
import { import {
changeUserStatus changeUserStatus
} from "@/api/member/user"; } from '@/api/member/user';
import {getBaseHeader} from "@/utils/request"; import {listSimpleDepts} from '@/api/system/dept';
import {CommonStatusEnum} from "@/utils/constants"; import {listSimplePosts} from '@/api/system/post';
import {DICT_TYPE} from "@/utils/dict"; 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 { export default {
name: "Promoter", name: 'Promoter',
computed: { computed: {
DICT_TYPE() { DICT_TYPE() {
return DICT_TYPE return DICT_TYPE
} }
}, },
components: { components: {
ImageUpload,
Treeselect
}, },
data() { data() {
return { return {
// //
loading: true, loading: true,
deptOptions: undefined,
// //
exportLoading: false, exportLoading: false,
// //
@ -126,7 +186,7 @@ export default {
// 广 // 广
list: [], list: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -134,7 +194,7 @@ export default {
// //
open: false, open: false,
// //
title: "推广员导入", title: '推广员导入',
// //
isUploading: false, isUploading: false,
// //
@ -144,6 +204,11 @@ export default {
// //
url: process.env.VUE_APP_BASE_API + '/admin-api/member/promoter/import' url: process.env.VUE_APP_BASE_API + '/admin-api/member/promoter/import'
}, },
updatePassword: {
show: false,
userId: ''
},
updatePasswordForm: {},
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
@ -155,15 +220,71 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
orgId: [{ required: true, message: "组织id不能为空", trigger: "blur" }], orgId: [{
userId: [{ required: true, message: "会员id不能为空", trigger: "blur" }], 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() { created() {
this.getList(); this.getList();
this.getTreeselect();
}, },
methods: { methods: {
//
normalizer(node) {
return {
id: node.id,
label: node.name,
children: node.children
}
},
/** 查询部门下拉树结构 + 岗位下拉 */
getTreeselect() {
listSimpleDepts().then(response => {
// deptOptions
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id'));
});
listSimplePosts().then(response => {
// postOptions
this.postOptions = [];
this.postOptions.push(...response.data);
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
this.queryParams.deptId = data.id;
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -179,6 +300,11 @@ export default {
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
handleUpdatePassword(row) {
this.updatePasswordForm = {}
this.updatePassword.show = true
this.updatePassword.userId = row.userId
},
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
@ -186,7 +312,7 @@ export default {
orgId: undefined, orgId: undefined,
userId: undefined, userId: undefined,
}; };
this.resetForm("form"); this.resetForm('form');
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
@ -195,35 +321,32 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm('queryForm');
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加推广员"; this.title = '添加推广员';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id; this.form = row
getPromoter(id).then(response => {
this.form = response.data;
this.open = true; this.open = true;
this.title = "修改推广员"; this.title = '修改推广员';
});
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate(valid => {
if (!valid) { if (!valid) {
return; return;
} }
// //
if (this.form.id != null) { if (this.form.id != null) {
updatePromoter(this.form).then(response => { updatePromoter(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
@ -231,7 +354,7 @@ export default {
} }
// //
createPromoter(this.form).then(response => { createPromoter(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
@ -244,16 +367,21 @@ export default {
return deletePromoter(id); return deletePromoter(id);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => {}); }).catch(() => {
});
}, },
// //
handleStatusChange(row) { handleStatusChange(row) {
let text = row.status === CommonStatusEnum.ENABLE ? "启用" : "禁用"; console.log('row', row)
let text = row.status === CommonStatusEnum.ENABLE ? '启用' : '禁用';
this.$modal.confirm('您确认要"' + text + '""' + row.nickname + '"推广员吗?').then(function () { this.$modal.confirm('您确认要"' + text + '""' + row.nickname + '"推广员吗?').then(function () {
return changeUserStatus(row.user_id, row.status); return changeUserStatus({
id: row.userId,
status: row.status
});
}).then(() => { }).then(() => {
this.$modal.msgSuccess(text + "成功"); this.$modal.msgSuccess(text + '成功');
}).catch(function () { }).catch(function () {
row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
: CommonStatusEnum.ENABLE; : CommonStatusEnum.ENABLE;
@ -271,11 +399,12 @@ export default {
}).then(response => { }).then(response => {
this.$download.excel(response, '推广员.xls'); this.$download.excel(response, '推广员.xls');
this.exportLoading = false; this.exportLoading = false;
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
this.upload.title = "推广员导入"; this.upload.title = '推广员导入';
this.upload.open = true; this.upload.open = true;
}, },
/** 下载模板操作 */ /** 下载模板操作 */
@ -307,7 +436,7 @@ export default {
for (const username in data.failureUsernames) { for (const username in data.failureUsernames) {
text += '<br />&nbsp;&nbsp;&nbsp;&nbsp;' + username + '' + data.failureUsernames[username]; text += '<br />&nbsp;&nbsp;&nbsp;&nbsp;' + username + '' + data.failureUsernames[username];
} }
this.$alert(text, "导入结果", { dangerouslyUseHTMLString: true }); this.$alert(text, '导入结果', {dangerouslyUseHTMLString: true});
this.getList(); this.getList();
}, },
// //

View File

@ -271,6 +271,10 @@ export default {
required: true, required: true,
message: '店铺负责人号码不能为空', message: '店铺负责人号码不能为空',
trigger: 'blur' 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'
}], }],
introduction: [{ introduction: [{
required: true, required: true,
@ -279,12 +283,16 @@ export default {
}], }],
serviceTime: [{ serviceTime: [{
required: true, required: true,
message: '服务不能为空', message: '服务时间不能为空',
trigger: 'blur' trigger: 'blur'
}], }],
serviceMobile: [{ serviceMobile: [{
required: true, required: true,
message: '服务不能为空', 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' trigger: 'blur'
}] }]
} }