超市前台
parent
23f22bf8fa
commit
62fd533393
|
@ -1,6 +1,6 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function list(data) {
|
||||
export function list3(data) {
|
||||
return request({
|
||||
url: '/customer/list',
|
||||
method: 'post',
|
||||
|
@ -9,27 +9,27 @@ export function list(data) {
|
|||
}
|
||||
|
||||
|
||||
export function add(data) {
|
||||
export function add3(data) {
|
||||
return request({
|
||||
url: '/customer/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function update(data) {
|
||||
export function update3(data) {
|
||||
return request({
|
||||
url: '/customer/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function findById(userId) {
|
||||
export function findById3(userId) {
|
||||
return request({
|
||||
url: '/customer/findById/' + userId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
export function deleteId(customerId) {
|
||||
export function deleteId3(customerId) {
|
||||
return request({
|
||||
url: '/customer/deleteId/' + customerId,
|
||||
method: 'delete'
|
||||
|
|
|
@ -15,7 +15,7 @@ export function sendCode(phone) {
|
|||
})
|
||||
}
|
||||
|
||||
export function list(data) {
|
||||
export function list4(data) {
|
||||
return request({
|
||||
url: '/user/list',
|
||||
method: 'post',
|
||||
|
@ -23,7 +23,7 @@ export function list(data) {
|
|||
})
|
||||
}
|
||||
|
||||
export function list2(data) {
|
||||
export function list5(data) {
|
||||
return request({
|
||||
url: '/user/list2',
|
||||
method: 'post',
|
||||
|
@ -48,27 +48,55 @@ export function logout() {
|
|||
}
|
||||
|
||||
|
||||
export function add(data) {
|
||||
export function add4(data) {
|
||||
return request({
|
||||
url: '/user/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function update(data) {
|
||||
export function update4(data) {
|
||||
return request({
|
||||
url: '/user/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function findById(userId) {
|
||||
export function findById4(userId) {
|
||||
return request({
|
||||
url: '/user/findById/' + userId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
export function deleteId(userId) {
|
||||
export function deleteId4(userId) {
|
||||
return request({
|
||||
url: '/user/deleteId/' + userId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function add5(data) {
|
||||
return request({
|
||||
url: '/user/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function update5(data) {
|
||||
return request({
|
||||
url: '/user/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function findById5(userId) {
|
||||
return request({
|
||||
url: '/user/findById/' + userId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
export function deleteId5(userId) {
|
||||
return request({
|
||||
url: '/user/deleteId/' + userId,
|
||||
method: 'delete'
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function list2(data) {
|
||||
return request({
|
||||
url: '/vip/list',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function add2(data) {
|
||||
return request({
|
||||
url: '/vip/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function update2(data) {
|
||||
return request({
|
||||
url: '/vip/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function findById2(userId) {
|
||||
return request({
|
||||
url: '/vip/findById/' + userId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteId2(userId) {
|
||||
return request({
|
||||
url: '/vip/deleteId/' + userId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -43,17 +43,7 @@ export const constantRoutes = [
|
|||
hidden: true
|
||||
},
|
||||
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/dashboard',
|
||||
children: [{
|
||||
path: 'dashboard',
|
||||
name: 'Dashboard',
|
||||
component: () => import('@/views/dashboard/index'),
|
||||
meta: { title: 'Dashboard', icon: 'dashboard' }
|
||||
}]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
path: '/example',
|
||||
|
@ -90,6 +80,18 @@ export const constantRoutes = [
|
|||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/dashboard',
|
||||
children: [{
|
||||
path: 'dashboard',
|
||||
name: '导航',
|
||||
component: () => import('@/views/dashboard/index'),
|
||||
meta: { title: '导航', icon: 'dashboard' }
|
||||
}]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/merch',
|
||||
component: Layout,
|
||||
|
@ -142,6 +144,19 @@ export const constantRoutes = [
|
|||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/vip',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: 'vip',
|
||||
name: '会员管理',
|
||||
component: () => import('@/views/vip/index'),
|
||||
meta: { title: '会员管理', icon: 'vip' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/nested',
|
||||
component: Layout,
|
||||
|
|
|
@ -63,3 +63,11 @@ div:focus {
|
|||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.el-message__content--success {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.el-message__content--error {
|
||||
color: red;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">查询</el-button>
|
||||
<el-button type="primary" @click="onSubmit3">查询</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-button type="primary" @click="add">添加</el-button>
|
||||
<el-button type="primary" @click="add3">添加</el-button>
|
||||
|
||||
<el-table :data="customerResponse.list" style="width: 100%">
|
||||
<el-table-column label="客户编号" width="180">
|
||||
|
@ -50,17 +50,17 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="update(scope.row.customerId)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteId(scope.row.customerId)">删除</el-button>
|
||||
<el-button size="mini" @click="update3(scope.row.customerId)">编辑</el-button><br>
|
||||
<el-button size="mini" type="danger" @click="deleteId3(scope.row.customerId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange3"
|
||||
@current-change="handleCurrentChange3"
|
||||
:current-page="customerRequest.pageNum"
|
||||
:page-sizes="[100, 200, 300, 400]"
|
||||
:page-sizes="[1, 2, 3, 4]"
|
||||
:page-size="customerRequest.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="customerResponse.total">
|
||||
|
@ -74,6 +74,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="客户年龄" :label-width="formLabelWidth">
|
||||
<el-input v-model="customer.customerAge" autocomplete="off"></el-input>
|
||||
<el-button @click="customerAge2">验证客户年龄</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户性别" :label-width="formLabelWidth">
|
||||
<el-select v-model="customer.customerGender" placeholder="请选择活动区域">
|
||||
|
@ -83,22 +84,23 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="客户住址" :label-width="formLabelWidth">
|
||||
<el-input v-model="customer.customerAddress" autocomplete="off"></el-input>
|
||||
|
||||
<el-button @click="customerAddress2">验证客户住址</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户联系方式" :label-width="formLabelWidth">
|
||||
<el-input v-model="customer.customerTel" autocomplete="off"></el-input>
|
||||
<el-button @click="customerTel2">验证客户联系方式</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="operAdd">确 定</el-button>
|
||||
<el-button type="primary" @click="operAdd3">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {list,add,update,deleteId,findById} from '@/api/customer'
|
||||
import {list3,add3,update3,deleteId3,findById3} from '@/api/customer'
|
||||
|
||||
export default {
|
||||
name: 'customer',
|
||||
|
@ -119,33 +121,58 @@
|
|||
customer:{},
|
||||
title:'表单',
|
||||
|
||||
vailcustomerName:/^(?:[\u4e00-\u9fa5·]{2,16})$/
|
||||
vailcustomerName:/^(?:[\u4e00-\u9fa5·]{2,16})$/,
|
||||
vailcustomerAge:/^(1?\d{1,2}|200)$/,
|
||||
vailcustomerTel:/^\d{11}$/,
|
||||
vailcustomerAddress:/^(?:[\u4e00-\u9fa5·]{2,16})$/
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.onSubmit()
|
||||
this.onSubmit3()
|
||||
},
|
||||
methods: {
|
||||
customerName2(){
|
||||
if (this.vailcustomerName.test(this.customer.customerName)){
|
||||
alert("客户名称格式正确")
|
||||
customerAddress2(){
|
||||
if (this.vailcustomerAddress.test(this.customer.customerAddress)){
|
||||
this.$message({ message: '地址格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("客户名称格式错误")
|
||||
this.$message({ message: '地址格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
add(){
|
||||
customerTel2(){
|
||||
if (this.vailcustomerTel.test(this.customer.customerTel)){
|
||||
this.$message({ message: '手机号格式校验成功', type: 'success' });
|
||||
}else{
|
||||
this.$message({ message: '手机号格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
customerAge2(){
|
||||
if (this.vailcustomerAge.test(this.customer.customerAge)){
|
||||
this.$message({ message: '年龄格式校验成功', type: 'success' });
|
||||
}else{
|
||||
this.$message({ message: '年龄格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
customerName2(){
|
||||
if (this.vailcustomerName.test(this.customer.customerName)){
|
||||
this.$message({ message: '客户名称格式校验成功', type: 'success' });
|
||||
}else{
|
||||
this.$message({ message: '客户名称格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
|
||||
add3(){
|
||||
this.dialogFormVisible=true
|
||||
this.customer={}
|
||||
this.title='添加'
|
||||
},
|
||||
update(customerId){
|
||||
findById(customerId).then(res=>{
|
||||
update3(customerId){
|
||||
findById3(customerId).then(res=>{
|
||||
this.dialogFormVisible=true
|
||||
this.customer=res.data
|
||||
this.title='编辑'
|
||||
})
|
||||
},
|
||||
operAdd(){
|
||||
operAdd3(){
|
||||
if (this.customer.customerId){
|
||||
this.updateCustomer()
|
||||
}else{
|
||||
|
@ -153,42 +180,41 @@
|
|||
}
|
||||
},
|
||||
addCustomer(){
|
||||
add(this.customer).then(res=>{
|
||||
add3(this.customer).then(res=>{
|
||||
this.dialogFormVisible=false
|
||||
this.customer={}
|
||||
this.title='编辑'
|
||||
alert("添加成功")
|
||||
this.onSubmit()
|
||||
this.$message.success('添加成功')
|
||||
this.onSubmit3()
|
||||
})
|
||||
},
|
||||
updateCustomer(){
|
||||
update(this.customer).then(res=>{
|
||||
update3(this.customer).then(res=>{
|
||||
this.dialogFormVisible=false
|
||||
this.customer={}
|
||||
this.title='编辑'
|
||||
alert("修改成功")
|
||||
this.onSubmit()
|
||||
this.$message.success('修改成功')
|
||||
this.onSubmit3()
|
||||
})
|
||||
},
|
||||
deleteId(customerId){
|
||||
deleteId(customerId).then(res=>{
|
||||
deleteId3(customerId){
|
||||
deleteId3(customerId).then(res=>{
|
||||
this.$message.success('删除成功')
|
||||
alert("删除成功")
|
||||
this.onSubmit()
|
||||
this.onSubmit3()
|
||||
})
|
||||
},
|
||||
onSubmit(){
|
||||
list(this.customerRequest).then(res=>{
|
||||
onSubmit3(){
|
||||
list3(this.customerRequest).then(res=>{
|
||||
this.customerResponse=res.data
|
||||
})
|
||||
},
|
||||
handleSizeChange(val){
|
||||
handleSizeChange3(val){
|
||||
this.customerRequest.pageSize=val
|
||||
this.onSubmit()
|
||||
this.onSubmit3()
|
||||
},
|
||||
handleCurrentChange(val){
|
||||
handleCurrentChange3(val){
|
||||
this.customerRequest.pageNum=val
|
||||
this.onSubmit()
|
||||
this.onSubmit3()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">查询</el-button>
|
||||
<el-button type="primary" @click="onSubmit1">查询</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -36,6 +36,11 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.merchPrice}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="优惠价" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.salesProPrice}}</span>
|
||||
</template>
|
||||
|
@ -75,10 +80,10 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.onSubmit()
|
||||
this.onSubmit1()
|
||||
},
|
||||
methods: {
|
||||
onSubmit(){
|
||||
onSubmit1(){
|
||||
list(this.merchRequest).then(res=>{
|
||||
this.merchResponse=res.data
|
||||
})
|
||||
|
|
|
@ -5,56 +5,56 @@
|
|||
<el-input v-model="userRequest.userId"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">查询</el-button>
|
||||
<el-button type="primary" @click="onSubmit4">查询</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-button type="primary" @click="add">添加</el-button>
|
||||
<el-button type="primary" @click="add4">添加</el-button>
|
||||
|
||||
<el-table :data="userResponse.list" style="width: 100%">
|
||||
<el-table-column label="用户编号" width="180">
|
||||
<el-table-column label="员工编号" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userId}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户名字" width="180">
|
||||
<el-table-column label="员工名字" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户类型" width="180">
|
||||
<el-table-column label="员工类型" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userType }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="用户身份证" width="180">
|
||||
<el-table-column label="员工身份证" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userIdcard }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户年龄" width="180">
|
||||
<el-table-column label="员工年龄" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userAge }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户性别" width="180">
|
||||
<el-table-column label="员工性别" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userGender }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户住址" width="180">
|
||||
<el-table-column label="员工住址" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userAddress }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户职位" width="180">
|
||||
<el-table-column label="员工职位" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userPosition }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户薪资" width="180">
|
||||
<el-table-column label="员工薪资" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userSal }}</span>
|
||||
</template>
|
||||
|
@ -72,15 +72,15 @@
|
|||
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="update(scope.row.userId)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteId(scope.row.userId)">删除</el-button>
|
||||
<el-button size="mini" @click="update4(scope.row.userId)">编辑</el-button><br>
|
||||
<el-button size="mini" type="danger" @click="deleteId4(scope.row.userId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange4"
|
||||
@current-change="handleCurrentChange4"
|
||||
:current-page="userRequest.pageNum"
|
||||
:page-sizes="[1,2,3,4]"
|
||||
:page-size="userRequest.pageSize"
|
||||
|
@ -90,44 +90,42 @@
|
|||
|
||||
<el-dialog :title="title" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="User">
|
||||
<el-form-item label="用户名字" :label-width="formLabelWidth">
|
||||
<el-form-item label="员工名字" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userName" autocomplete="off"></el-input>
|
||||
<el-button @click="userName2">验证用户名称</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户密码" :label-width="formLabelWidth">
|
||||
<el-form-item label="员工密码" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userPwd" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户类型" :label-width="formLabelWidth">
|
||||
<el-select v-model="User.userType" placeholder="请选择">
|
||||
<el-form-item label="员工类型" :label-width="formLabelWidth">
|
||||
<el-select v-model="User.userType" placeholder="请选择" @change="updateUserPosition">
|
||||
<el-option label="销售员" value="1"></el-option>
|
||||
<el-option label="仓库管理员" value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户身份证" :label-width="formLabelWidth">
|
||||
<el-form-item label="员工身份证" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userIdcard" autocomplete="off"></el-input>
|
||||
<el-button @click="userIdcard2">验证用户身份证</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户年龄" :label-width="formLabelWidth">
|
||||
<el-form-item label="员工年龄" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userAge" autocomplete="off"></el-input>
|
||||
<el-button @click="userAge2">验证用户年龄</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户性别" :label-width="formLabelWidth">
|
||||
<el-form-item label="员工性别" :label-width="formLabelWidth">
|
||||
<el-select v-model="User.userGender" placeholder="请选择">
|
||||
<el-option label="男" value="男"></el-option>
|
||||
<el-option label="女" value="女"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户住址" :label-width="formLabelWidth">
|
||||
<el-form-item label="员工住址" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userAddress" autocomplete="off"></el-input>
|
||||
<el-button @click="userAddress2">验证地址格式</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户职位" :label-width="formLabelWidth">
|
||||
<el-select v-model="User.userPosition" placeholder="请选择">
|
||||
<el-option label="销售员" value="销售员"></el-option>
|
||||
<el-option label="仓库管理员" value="仓库管理员"></el-option>
|
||||
</el-select>
|
||||
<el-form-item label="员工职位" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userPosition" autocomplete="off"></el-input> <el-input v-model="User.userPosition" v-for="position in positionsByType" :key="position.value" :placeholder="position.label" :value="position.value">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户薪资" :label-width="formLabelWidth">
|
||||
<el-form-item label="员工薪资" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userSal" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" :label-width="formLabelWidth">
|
||||
|
@ -141,14 +139,14 @@
|
|||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="operAdd">确 定</el-button>
|
||||
<el-button type="primary" @click="operAdd4">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {list,add,update,findById,deleteId} from '@/api/user'
|
||||
import {list4,add4,update4,findById4,deleteId4} from '@/api/user'
|
||||
|
||||
export default {
|
||||
name: 'User',
|
||||
|
@ -166,74 +164,87 @@
|
|||
dialogFormVisible:false,
|
||||
formLabelWidth:"120px",
|
||||
title:'表单',
|
||||
User:{},
|
||||
User:{
|
||||
userType: '', // 员工类型
|
||||
userPosition: '' // 员工职位
|
||||
},
|
||||
vailuserName:/^[\u4E00-\u9FA5]+$/,
|
||||
vailuserIdcard:/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/,
|
||||
vailuserAge:/^(1?\d{1,2}|200)$/,
|
||||
vailphone:/^\d{11}$/,
|
||||
vailAddress:/^.{5,50}$/
|
||||
vailAddress:/^(?:[\u4e00-\u9fa5·]{2,16})$/,
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.onSubmit()
|
||||
this.onSubmit4()
|
||||
},
|
||||
methods: {
|
||||
updateUserPosition() {
|
||||
if (this.User.userType === '1') {
|
||||
this.User.userPosition = '销售员';
|
||||
} else if (this.User.userType === '2') {
|
||||
this.User.userPosition = '仓库管理员';
|
||||
}
|
||||
},
|
||||
userAddress2(){
|
||||
if (this.vailAddress.test(this.User.userAddress)){
|
||||
alert("地址格式正确")
|
||||
this.$message({ message: '地址格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("地址格式错误")
|
||||
this.$message({ message: '地址格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
phone2(){
|
||||
if (this.vailphone.test(this.User.phone)){
|
||||
alert("手机号格式正确")
|
||||
this.$message({ message: '手机号格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("手机号格式错误")
|
||||
this.$message({ message: '手机号格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
userName2(){
|
||||
if (this.vailuserName.test(this.User.userName)){
|
||||
alert("用户名称格式正确")
|
||||
this.$message({ message: '用户名称格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("用户名称格式错误")
|
||||
this.$message({ message: '用户名称格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
userIdcard2(){
|
||||
if (this.vailuserIdcard.test(this.User.userIdcard)){
|
||||
alert("身份证格式正确")
|
||||
this.$message({ message: '身份证格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("身份证格式错误")
|
||||
this.$message({ message: '身份证格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
userAge2(){
|
||||
if (this.vailuserAge.test(this.User.userAge)){
|
||||
alert("年龄格式正确")
|
||||
this.$message({ message: '年龄格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("年龄格式错误")
|
||||
this.$message({ message: '年龄格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
deleteId(userId){
|
||||
deleteId(userId).then(res=>{
|
||||
alert("删除成功")
|
||||
this.onSubmit();
|
||||
deleteId4(userId){
|
||||
deleteId4(userId).then(res=>{
|
||||
this.$message.success('删除成功')
|
||||
this.onSubmit4();
|
||||
})
|
||||
},
|
||||
add(){
|
||||
add4(){
|
||||
this.dialogFormVisible=true
|
||||
this.title='添加'
|
||||
this.User={}
|
||||
},
|
||||
update(userId){
|
||||
findById(userId).then(res=>{
|
||||
update4(userId){
|
||||
findById4(userId).then(res=>{
|
||||
this.dialogFormVisible=true
|
||||
this.title='修改'
|
||||
this.User=res.data
|
||||
})
|
||||
},
|
||||
|
||||
operAdd(){
|
||||
operAdd4(){
|
||||
if (this.User.userId){
|
||||
this.updateUser()
|
||||
}else{
|
||||
|
@ -241,47 +252,47 @@
|
|||
}
|
||||
},
|
||||
updateUser(){
|
||||
update(this.User).then(res=>{
|
||||
update4(this.User).then(res=>{
|
||||
this.dialogFormVisible=false
|
||||
this.User={}
|
||||
this.title='修改成功'
|
||||
alert("修改成功")
|
||||
this.onSubmit()
|
||||
this.$message.success('修改成功')
|
||||
this.onSubmit4()
|
||||
})
|
||||
},
|
||||
addUser(){
|
||||
add(this.User).then(res=>{
|
||||
addUser() {
|
||||
add4(this.User).then(res => {
|
||||
if (
|
||||
this.User.userAddress && this.vailAddress.test(this.User.userAddress)&&
|
||||
this.User.phone && this.vailphone.test(this.User.phone)&&
|
||||
this.User.userName && this.vailuserName.test(this.User.userName)&&
|
||||
this.User.userIdcard && this.vailuserIdcard.test(this.User.userIdcard)&&
|
||||
this.User.userAge && this.vailuserAge.test(this.User.userAge)
|
||||
){
|
||||
this.dialogFormVisible=false
|
||||
alert("添加成功")
|
||||
this.title='添加成功'
|
||||
this.User={}
|
||||
this.onSubmit()
|
||||
}else{
|
||||
alert("表单格式错误,请仔细检查")
|
||||
this.vailAddress.test(this.User.userAddress) &&
|
||||
this.vailphone.test(this.User.phone) &&
|
||||
this.vailuserName.test(this.User.userName) &&
|
||||
this.vailuserIdcard.test(this.User.userIdcard) &&
|
||||
this.vailuserAge.test(this.User.userAge)
|
||||
) {
|
||||
this.dialogFormVisible = false;
|
||||
this.$message.success('添加成功');
|
||||
this.title = '添加成功';
|
||||
this.User = {};
|
||||
this.onSubmit4();
|
||||
} else {
|
||||
alert("表单格式错误,请仔细检查");
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
onSubmit(){
|
||||
list(this.userRequest).then(res=>{
|
||||
onSubmit4(){
|
||||
list4(this.userRequest).then(res=>{
|
||||
this.userResponse=res.data
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
handleSizeChange(val){
|
||||
handleSizeChange4(val){
|
||||
this.userRequest.pageSize=val
|
||||
this.onSubmit()
|
||||
this.onSubmit4()
|
||||
},
|
||||
handleCurrentChange(val){
|
||||
handleCurrentChange4(val){
|
||||
this.userRequest.pageNum=val
|
||||
this.onSubmit()
|
||||
this.onSubmit4()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,56 +5,56 @@
|
|||
<el-input v-model="userRequest.userId"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">查询</el-button>
|
||||
<el-button type="primary" @click="onSubmit5">查询</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-button type="primary" @click="add">添加</el-button>
|
||||
<el-button type="primary" @click="add5">添加</el-button>
|
||||
|
||||
<el-table :data="userResponse.list" style="width: 100%">
|
||||
<el-table-column label="用户编号" width="180">
|
||||
<el-table-column label="管理员编号" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userId}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户名字" width="180">
|
||||
<el-table-column label="管理员名字" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户类型" width="180">
|
||||
<el-table-column label="管理员类型" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userType }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="用户身份证" width="180">
|
||||
<el-table-column label="管理员身份证" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userIdcard }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户年龄" width="180">
|
||||
<el-table-column label="管理员年龄" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userAge }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户性别" width="180">
|
||||
<el-table-column label="管理员性别" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userGender }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户住址" width="180">
|
||||
<el-table-column label="管理员住址" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userAddress }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户职位" width="180">
|
||||
<el-table-column label="管理员职位" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userPosition }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户薪资" width="180">
|
||||
<el-table-column label="管理员薪资" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.userSal }}</span>
|
||||
</template>
|
||||
|
@ -72,15 +72,15 @@
|
|||
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="update(scope.row.userId)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteId(scope.row.userId)">删除</el-button>
|
||||
<el-button size="mini" @click="update5(scope.row.userId)">编辑</el-button><br>
|
||||
<el-button size="mini" type="danger" @click="deleteId5(scope.row.userId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange5"
|
||||
@current-change="handleCurrentChange5"
|
||||
:current-page="userRequest.pageNum"
|
||||
:page-sizes="[1,2,3,4]"
|
||||
:page-size="userRequest.pageSize"
|
||||
|
@ -90,44 +90,44 @@
|
|||
|
||||
<el-dialog :title="title" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="User">
|
||||
<el-form-item label="用户名称" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员名称" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userName"></el-input>
|
||||
<el-button @click="userName2">验证用户名称</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户密码" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员密码" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userPwd" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户类型" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员类型" :label-width="formLabelWidth">
|
||||
<el-select v-model="User.userType" placeholder="请选择">
|
||||
<el-option label="管理员" value="3"></el-option>
|
||||
<el-option label="超级管理员" value="4"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户身份证" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员身份证" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userIdcard" autocomplete="off"></el-input>
|
||||
<el-button @click="userIdcard2">验证用户身份证</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户年龄" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员年龄" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userAge" autocomplete="off"></el-input>
|
||||
<el-button @click="userAge2">验证用户年龄</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户性别" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员性别" :label-width="formLabelWidth">
|
||||
<el-select v-model="User.userGender" placeholder="请选择">
|
||||
<el-option label="男" value="男"></el-option>
|
||||
<el-option label="女" value="女"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户住址" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员住址" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userAddress" autocomplete="off"></el-input>
|
||||
<el-button @click="userAddress2">验证地址格式</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户职位" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员职位" :label-width="formLabelWidth">
|
||||
<el-select v-model="User.userPosition" placeholder="请选择">
|
||||
<el-option label="管理员" value="管理员"></el-option>
|
||||
<el-option label="超级管理员" value="超级管理员"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户薪资" :label-width="formLabelWidth">
|
||||
<el-form-item label="管理员薪资" :label-width="formLabelWidth">
|
||||
<el-input v-model="User.userSal" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" :label-width="formLabelWidth">
|
||||
|
@ -142,14 +142,14 @@
|
|||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="operAdd">确 定</el-button>
|
||||
<el-button type="primary" @click="operAdd5">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {list2,add,update,findById,deleteId} from '@/api/user'
|
||||
import {list5,add5,update5,findById5,deleteId5} from '@/api/user'
|
||||
|
||||
export default {
|
||||
name: 'User',
|
||||
|
@ -173,105 +173,105 @@
|
|||
vailuserIdcard:/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/,
|
||||
vailuserAge:/^(1?\d{1,2}|200)$/,
|
||||
vailphone:/^\d{11}$/,
|
||||
vailAddress:/^.{5,50}$/
|
||||
vailAddress:/^(?:[\u4e00-\u9fa5·]{2,16})$/
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.onSubmit()
|
||||
this.onSubmit5()
|
||||
},
|
||||
methods: {
|
||||
userAddress2(){
|
||||
if (this.vailAddress.test(this.User.userAddress)){
|
||||
alert("地址格式正确")
|
||||
this.$message({ message: '地址格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("地址格式错误")
|
||||
this.$message({ message: '地址格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
},
|
||||
phone2(){
|
||||
if (this.vailphone.test(this.User.phone)){
|
||||
alert("手机号格式正确")
|
||||
this.$message({ message: '手机号格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("手机号格式错误")
|
||||
this.$message({ message: '手机号格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
userName2(){
|
||||
if (this.vailuserName.test(this.User.userName)){
|
||||
alert("用户名称格式正确")
|
||||
this.$message({ message: '用户名称格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("用户名称格式错误")
|
||||
this.$message({ message: '用户名称格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
userIdcard2(){
|
||||
if (this.vailuserIdcard.test(this.User.userIdcard)){
|
||||
alert("身份证格式正确")
|
||||
this.$message({ message: '身份证格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("身份证格式错误")
|
||||
this.$message({ message: '身份证格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
userAge2(){
|
||||
if (this.vailuserAge.test(this.User.userAge)){
|
||||
alert("年龄格式正确")
|
||||
this.$message({ message: '年龄格式校验成功', type: 'success' });
|
||||
}else{
|
||||
alert("年龄格式错误")
|
||||
this.$message({ message: '年龄格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
deleteId(userId){
|
||||
deleteId(userId).then(res=>{
|
||||
alert("删除成功")
|
||||
this.onSubmit();
|
||||
deleteId5(userId){
|
||||
deleteId5(userId).then(res=>{
|
||||
this.$message.success('删除成功')
|
||||
this.onSubmit5();
|
||||
})
|
||||
},
|
||||
add(){
|
||||
add5(){
|
||||
this.dialogFormVisible=true
|
||||
this.title='添加'
|
||||
this.User={}
|
||||
},
|
||||
update(userId){
|
||||
findById(userId).then(res=>{
|
||||
update5(userId){
|
||||
findById5(userId).then(res=>{
|
||||
this.dialogFormVisible=true
|
||||
this.title='修改'
|
||||
this.User=res.data
|
||||
})
|
||||
},
|
||||
|
||||
operAdd(){
|
||||
operAdd5(){
|
||||
if (this.User.userId){
|
||||
this.updateUser()
|
||||
this.updateUser2()
|
||||
}else{
|
||||
this.addUser()
|
||||
this.addUser2()
|
||||
}
|
||||
},
|
||||
updateUser(){
|
||||
update(this.User).then(res=>{
|
||||
updateUser2(){
|
||||
update5(this.User).then(res=>{
|
||||
this.dialogFormVisible=false
|
||||
this.User={}
|
||||
this.title='修改成功'
|
||||
alert("修改成功")
|
||||
this.onSubmit()
|
||||
this.$message.success('修改成功')
|
||||
this.onSubmit5()
|
||||
})
|
||||
},
|
||||
addUser(){
|
||||
add(this.User).then(res=>{
|
||||
addUser2(){
|
||||
add5(this.User).then(res=>{
|
||||
this.dialogFormVisible=false
|
||||
alert("添加成功")
|
||||
this.$message.success('添加成功')
|
||||
this.title='添加成功'
|
||||
this.User={}
|
||||
this.onSubmit()
|
||||
this.onSubmit5()
|
||||
})
|
||||
},
|
||||
onSubmit(){
|
||||
list2(this.userRequest).then(res=>{
|
||||
onSubmit5(){
|
||||
list5(this.userRequest).then(res=>{
|
||||
this.userResponse=res.data
|
||||
})
|
||||
},
|
||||
|
||||
handleSizeChange(val){
|
||||
handleSizeChange5(val){
|
||||
this.userRequest.pageSize=val
|
||||
this.onSubmit()
|
||||
this.onSubmit5()
|
||||
},
|
||||
handleCurrentChange(val){
|
||||
handleCurrentChange5(val){
|
||||
this.userRequest.pageNum=val
|
||||
this.onSubmit()
|
||||
this.onSubmit5()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-form ref="form" :model="vipRequest" label-width="80px">
|
||||
<el-form-item label="id">
|
||||
<el-input v-model="vipRequest.vipId"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="vipRequest.vipName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit2">查询</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-button type="primary" @click="add2">添加</el-button>
|
||||
|
||||
<el-table :data="vipResponse.list" style="width: 100%">
|
||||
<el-table-column label="会员编号" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.vipId}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员姓名" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.vipName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员年龄" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.vipAge}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员性别" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.vipGender}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户编号" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.customerId}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员联系方式" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.vipTel}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员等级" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.vipGrade}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="注册日期" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{scope.row.regDate}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="update2(scope.row.vipId)">编辑</el-button><br>
|
||||
<el-button size="mini" type="danger" @click="deleteId2(scope.row.vipId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="vipRequest.pageNum"
|
||||
:page-sizes="[1,2,3,4]"
|
||||
:page-size="vipRequest.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="vipResponse.total">
|
||||
</el-pagination>
|
||||
|
||||
<el-dialog :title="title" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="vip">
|
||||
<el-form-item label="会员姓名" :label-width="formLabelWidth">
|
||||
<el-input v-model="vip.vipName" autocomplete="off"></el-input>
|
||||
<el-button @click="vipName2">验证用户名称</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员年龄" :label-width="formLabelWidth">
|
||||
<el-input v-model="vip.vipAge" autocomplete="off"></el-input>
|
||||
<el-button @click="vipAge2">验证用户名称</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员性别" :label-width="formLabelWidth">
|
||||
<el-select v-model="vip.vipGender" placeholder="请选择">
|
||||
<el-option label="男" value="男"></el-option>
|
||||
<el-option label="女" value="女"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户编号" :label-width="formLabelWidth">
|
||||
<el-input v-model="vip.customerId" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员联系方式" :label-width="formLabelWidth">
|
||||
<el-input v-model="vip.vipTel" autocomplete="off"></el-input>
|
||||
<el-button @click="vipTel2">验证用户名称</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员等级" :label-width="formLabelWidth">
|
||||
<el-select v-model="vip.vipGrade" placeholder="请选择">
|
||||
<el-option label="会员" value="会员"></el-option>
|
||||
<el-option label="大会员" value="大会员"></el-option>
|
||||
<el-option label="超级大会员" value="超级大会员"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="operAdd2">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {list2,add2,update2,findById2,deleteId2} from '@/api/vip'
|
||||
|
||||
export default {
|
||||
name: 'Vip',
|
||||
data() {
|
||||
return {
|
||||
vipRequest:{
|
||||
vipId:'',
|
||||
vipName:'',
|
||||
pageNum:1,
|
||||
pageSize:3
|
||||
},
|
||||
vipResponse:{
|
||||
total:0,
|
||||
list:[]
|
||||
},
|
||||
dialogFormVisible:false,
|
||||
formLabelWidth:'120px',
|
||||
vip:{},
|
||||
title:'表单',
|
||||
|
||||
vailvipName:/^[\u4E00-\u9FA5]+$/,
|
||||
vailvipAge:/^(1?\d{1,2}|200)$/,
|
||||
vailvipTel:/^\d{11}$/,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.onSubmit2()
|
||||
},
|
||||
methods: {
|
||||
vipName2(){
|
||||
if (this.vailvipName.test(this.vip.vipName)){
|
||||
this.$message({ message: '名称格式校验成功', type: 'success' });
|
||||
}else{
|
||||
this.$message({ message: '名称格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
vipAge2(){
|
||||
if (this.vailvipAge.test(this.vip.vipAge)){
|
||||
this.$message({ message: '年龄格式校验成功', type: 'success' });
|
||||
}else{
|
||||
this.$message({ message: '年龄格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
vipTel2(){
|
||||
if (this.vailvipTel.test(this.vip.vipTel)){
|
||||
this.$message({ message: '手机号格式校验成功', type: 'success' });
|
||||
}else{
|
||||
this.$message({ message: '手机号格式校验失败', type: 'error' });
|
||||
}
|
||||
},
|
||||
deleteId2(vipId){
|
||||
deleteId2(vipId).then(res=>{
|
||||
this.$message.success('删除成功')
|
||||
this.onSubmit2()
|
||||
})
|
||||
},
|
||||
add2(){
|
||||
this.dialogFormVisible=true
|
||||
this.vip={}
|
||||
this.title='添加'
|
||||
},
|
||||
update2(vipId){
|
||||
findById2(vipId).then(res=>{
|
||||
this.dialogFormVisible=true
|
||||
this.vip=res.data
|
||||
this.title='回显'
|
||||
})
|
||||
},
|
||||
operAdd2(){
|
||||
if (this.vip.vipId){
|
||||
this.vipUpdate()
|
||||
}else{
|
||||
this.vipAdd()
|
||||
}
|
||||
},
|
||||
vipAdd(){
|
||||
add2(this.vip).then(res=>{
|
||||
this.dialogFormVisible=false
|
||||
this.vip={}
|
||||
this.title='添加成功'
|
||||
this.$message.success('添加成功')
|
||||
this.onSubmit2()
|
||||
})
|
||||
},
|
||||
vipUpdate(){
|
||||
update2(this.vip).then(res=>{
|
||||
this.dialogFormVisible=false
|
||||
this.vip={}
|
||||
this.title='修改成功'
|
||||
this.$message.success('修改成功')
|
||||
this.onSubmit2()
|
||||
})
|
||||
},
|
||||
onSubmit2(){
|
||||
list2(this.vipRequest).then(res=>{
|
||||
this.vipResponse=res.data
|
||||
})
|
||||
},
|
||||
handleSizeChange(val){
|
||||
this.vipRequest.pageSize=val
|
||||
this.onSubmit2()
|
||||
},
|
||||
handleCurrentChange(val){
|
||||
this.vipRequest.pageNum=val
|
||||
this.onSubmit2()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
Loading…
Reference in New Issue