parent
6b22078098
commit
f8eda78cf7
@ -0,0 +1,39 @@ |
||||
|
||||
import request from '@/utils/request'; |
||||
|
||||
// 查询车型列表
|
||||
export function getCarList(param) { |
||||
return request({ |
||||
url: '/driver-api/tdSysUserMember/duima/car/list', |
||||
method: 'get', |
||||
params: param |
||||
}); |
||||
} |
||||
|
||||
// 查询会员列表
|
||||
export function getMemberList(param) { |
||||
return request({ |
||||
url: '/driver-api/tdSysUserMember/duima/member/list', |
||||
method: 'get', |
||||
params: param |
||||
}); |
||||
} |
||||
|
||||
|
||||
// 查询用户会员列表
|
||||
export function getUserMemberList(param) { |
||||
return request({ |
||||
url: '/driver-api/tdSysUserMember/duima/user/member/list', |
||||
method: 'get', |
||||
params: param |
||||
}); |
||||
} |
||||
|
||||
//新增会员
|
||||
export function addUserMember(data) { |
||||
return request({ |
||||
url: '/driver-api/tdSysUserMember/duima/user/member', |
||||
method: 'post', |
||||
data: data |
||||
}); |
||||
} |
@ -0,0 +1,113 @@ |
||||
<template> |
||||
<el-dialog title="VIP" :close-on-click-modal="false" append-to-body :visible.sync="visible" width="500px" @close="closeDialog"> |
||||
<div> |
||||
<el-form ref="dialogForm" :model="dialogForm" :rules="dataRule" @keyup.enter.native="dialogFormSubmit()"> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="手机号" prop="phone"> |
||||
<el-input v-model="dialogForm.phone" placeholder="请输入" clearable /> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="车型" prop="carTypeId"> |
||||
<el-select v-model="dialogForm.carTypeId" clearable placeholder="选择车型"> |
||||
<el-option v-for="item in carOptions" :key="item.carTypeId" :label="item.carName" :value="item.carTypeId" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="会员" prop="memberId"> |
||||
<el-select v-model="dialogForm.memberId" clearable placeholder="选择车型"> |
||||
<el-option v-for="item in memberOptions.filter(item => item.carTypeId === dialogForm.carTypeId)" :key="item.memberId" :label="item.memberName" :value="item.memberId" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
|
||||
</div> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button plain @click="(visible = false)">取消</el-button> |
||||
<el-button v-jclick type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import { addUserMember, getCarList, getMemberList } from '@/api/vip'; |
||||
|
||||
export default { |
||||
name:"VipForm", |
||||
data() { |
||||
return { |
||||
visible: false, |
||||
canSubmit: true, |
||||
dialogForm: { |
||||
userId: undefined, |
||||
memberId: undefined, |
||||
phone: undefined |
||||
}, |
||||
dataRule: { |
||||
phone: [{ required: true, message: '手机号不为空', trigger: 'blur' }, |
||||
{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }], carTypeId: [{ required: true, message: '车型不能为空', trigger: 'blur' }], |
||||
memberId: [{ required: true, message: '会员不能为空', trigger: 'blur' }] |
||||
}, |
||||
carOptions:[], |
||||
memberOptions:[] |
||||
}; |
||||
}, |
||||
methods: { |
||||
init(info = undefined) { |
||||
// debugger |
||||
this.visible = true; |
||||
this.getCarList(); |
||||
this.getMemberList(); |
||||
this.$nextTick(() => { |
||||
this.resetDialogForm(); |
||||
// this.$refs['dialogForm'].resetFields(); |
||||
if (info) { |
||||
this.dialogForm = this.deepClone(info); |
||||
} |
||||
}); |
||||
}, |
||||
resetDialogForm() { |
||||
this.dialogForm = { |
||||
userId: undefined, |
||||
memberId: undefined, |
||||
phone: undefined |
||||
}; |
||||
}, |
||||
closeDialog() { |
||||
this.$emit('update:dialogVisible', false); |
||||
}, |
||||
// 表单提交 |
||||
dialogFormSubmit() { |
||||
this.$refs.dialogForm.validate((valid) => { |
||||
if (valid) { |
||||
addUserMember(this.dialogForm).then(response => { |
||||
if (response.code == 200) { |
||||
this.$modal.msgSuccess('新增成功'); |
||||
this.$emit('update'); |
||||
this.visible = false; |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
}, |
||||
getCarList(){ |
||||
getCarList().then(resp => { |
||||
this.carOptions = resp.data; |
||||
}) |
||||
}, |
||||
getMemberList(){ |
||||
getMemberList().then(resp => { |
||||
this.memberOptions = resp.data |
||||
}) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -0,0 +1,96 @@ |
||||
<template> |
||||
<div class="app-container" > |
||||
<el-form size="small" :inline="true" label-width="68px" @submit.native.prevent> |
||||
<el-row :gutter="20"> |
||||
<el-form-item label="手机号"> |
||||
<el-input v-model="queryParams.phone" placeholder="请输入" clearable @keyup.enter.native="handleQuery" /> |
||||
</el-form-item> |
||||
</el-row> |
||||
<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-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button> |
||||
|
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-table v-loading="loading" :data="tableList" > |
||||
<el-table-column type="index" width="55" align="center" /> |
||||
<el-table-column label="手机号" align="center" prop="phone" min-width="140" /> |
||||
<el-table-column label="会员名" align="center" prop="memberName" min-width="140"/> |
||||
<el-table-column label="车型" align="center" prop="carName" min-width="100" /> |
||||
<el-table-column label="科目" align="center" prop="subjects" min-width="100"/> |
||||
<el-table-column label="开始时间" align="center" prop="startDate" min-width="100"/> |
||||
<el-table-column label="结束时间" align="center" prop="endDate" min-width="100"/> |
||||
|
||||
<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-download" @click="handleEdit(scope.row)">编辑</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" /> --> |
||||
<VipForm v-if="dialogVisible" ref="dialogForm" :dialog-visible="dialogVisible" @update="getList" /> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getUserMemberList } from '@/api/vip'; |
||||
import VipForm from './components/VipForm.vue' |
||||
|
||||
export default { |
||||
name: 'Vip', |
||||
components:{ |
||||
VipForm |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: false, |
||||
// 总条数 |
||||
total: 0, |
||||
tableList: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
phone: undefined |
||||
}, |
||||
dialogVisible: false, |
||||
dialogAddVisible: false |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询文件列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
getUserMemberList(this.queryParams).then(response => { |
||||
this.tableList = response.data; |
||||
// this.total = response.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
|
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.queryParams.question = ''; |
||||
this.handleQuery(); |
||||
}, |
||||
|
||||
handleAdd(item) { |
||||
this.dialogVisible = true; |
||||
this.$nextTick(() => { |
||||
this.$refs.dialogForm.init(item); |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
Loading…
Reference in new issue