This commit is contained in:
liyanhong 2024-11-13 17:32:05 +08:00
parent fdb942c706
commit 341cbab1b3
12 changed files with 286 additions and 363 deletions

View File

@ -1,9 +0,0 @@
import request from '@/utils/request'
export function getList(params) {
return request({
url: '/vue-admin-template/table/list',
method: 'get',
params
})
}

View File

@ -1,5 +1,5 @@
import request from '@/utils/request'
// 登录
export function login(data) {
return request({
url: '/vue-admin-template/user/login',
@ -7,7 +7,7 @@ export function login(data) {
data
})
}
// 用户信息
export function getInfo(token) {
return request({
url: '/vue-admin-template/user/info',
@ -15,10 +15,42 @@ export function getInfo(token) {
params: { token }
})
}
// 登出
export function logout() {
return request({
url: '/vue-admin-template/user/logout',
method: 'post'
})
}
// 推广人注册
export function register(data) {
return request({
url: '/api/promoter/register',
method: 'post',
data
})
}
// 图片上传
export function upload(data) {
return request({
url: '/api/public/upload',
method: 'post',
data
})
}
// 所在地区
export function getArea(data) {
return request({
url: '/api/public/areas',
method: 'post',
data
})
}
// 进件列表
export function getApplyList(data) {
return request({
url: '/api/promoter/account_list',
method: 'post',
data
})
}

View File

@ -29,12 +29,12 @@ export default {
methods: {
getBreadcrumb() {
// only show routes with meta.title
let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
const first = matched[0]
const matched = this.$route.matched.filter(item => item.meta && item.meta.title)
// const first = matched[0]
if (!this.isDashboard(first)) {
matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched)
}
// if (!this.isDashboard(first)) {
// matched = [{ path: '/dashboard', meta: { title: '广' }}].concat(matched)
// }
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
},

View File

@ -7,21 +7,10 @@
<div class="right-menu">
<el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper">
<img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar">
<img class="user-avatar" :src="'https://pics0.baidu.com/feed/38dbb6fd5266d0162e9568c498ca300937fa35b9.jpeg?token=7a95a445d85460e466d9063cbc0597e3'" alt="">
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
<router-link to="/">
<el-dropdown-item>
Home
</el-dropdown-item>
</router-link>
<a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">
<el-dropdown-item>Github</el-dropdown-item>
</a>
<a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
<el-dropdown-item>Docs</el-dropdown-item>
</a>
<el-dropdown-item divided @click.native="logout">
<span style="display:block;">Log Out</span>
</el-dropdown-item>
@ -53,7 +42,7 @@ export default {
},
async logout() {
await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
this.$router.push({ name: 'login' })
}
}
}

View File

@ -29,9 +29,9 @@ if (process.env.NODE_ENV === 'production') {
}
// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui按如下方式声明
// Vue.use(ElementUI)
Vue.use(ElementUI)
Vue.config.productionTip = false

View File

@ -32,7 +32,7 @@ router.beforeEach(async(to, from, next) => {
} else {
try {
// get user info
await store.dispatch('user/getInfo')
// await store.dispatch('user/getInfo')
next()
} catch (error) {

View File

@ -30,51 +30,50 @@ const mutations = {
const actions = {
// user login
login({ commit }, userInfo) {
const { username, password } = userInfo
// const { username, password } = userInfo
return new Promise((resolve, reject) => {
login({ username: username.trim(), password: password }).then(response => {
const { data } = response
commit('SET_TOKEN', data.token)
setToken(data.token)
// login({ username: username.trim(), password: password }).then(response => {
commit('SET_TOKEN', 'admin-token')
setToken('admin-token')
resolve()
}).catch(error => {
reject(error)
})
// }).catch(error => {
// reject(error)
// })
})
},
// get user info
getInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo(state.token).then(response => {
const { data } = response
// getInfo(state.token).then(response => {
// const { data } = response
if (!data) {
return reject('Verification failed, please Login again.')
}
// if (!data) {
// return reject('Verification failed, please Login again.')
// }
const { name, avatar } = data
// const { name, avatar } = data
commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)
}).catch(error => {
reject(error)
})
// commit('SET_NAME', name)
// commit('SET_AVATAR', avatar)
// resolve(data)
// }).catch(error => {
// reject(error)
// })
})
},
// user logout
logout({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
// logout(state.token).then(() => {
removeToken() // must remove token first
resetRouter()
commit('RESET_STATE')
resolve()
}).catch(error => {
reject(error)
})
// }).catch(error => {
// reject(error)
// })
})
},

View File

@ -5,8 +5,9 @@ import { getToken } from '@/utils/auth'
// create an axios instance
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
baseURL: 'http://192.168.0.155:7301',
timeout: 5000 // request timeout
})
@ -46,26 +47,12 @@ service.interceptors.response.use(
const res = response.data
// if the custom code is not 20000, it is judged as an error.
if (res.code !== 20000) {
if (res.code !== 200) {
Message({
message: res.message || 'Error',
type: 'error',
duration: 5 * 1000
})
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
// to re-login
MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
confirmButtonText: 'Re-Login',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
store.dispatch('user/resetToken').then(() => {
location.reload()
})
})
}
return Promise.reject(new Error(res.message || 'Error'))
} else {
return res

View File

@ -3,7 +3,7 @@
<div class="dashboard-text">
<el-table
:data="tableData"
height="250"
height="800"
border
style="width: 100%"
>

View File

@ -1,239 +1,160 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="名字">
<el-form ref="form" :model="form" label-width="120px" :rules="rules">
<el-form-item label="名字" prop="name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="手机号">
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" />
</el-form-item>
<el-form-item label="所属地区">
<el-form-item label="所属地区" prop="area">
<el-cascader
v-model="form.area"
:options="options"
placeholder="请选择地区"
ref="cascaderRef"
:props="props"
@change="handleChange"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">添加</el-button>
<el-button type="primary" @click="submitForm('form')">添加</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { register, getArea } from '@/api/user'
export default {
data() {
return {
form: {
name: '',
phone: '',
area: ''
area: {}
},
options: [{
value: 'zhinan',
label: '指南',
children: [{
value: 'shejiyuanze',
label: '设计原则',
children: [{
value: 'yizhi',
label: '一致'
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '导航',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
}, {
value: 'zujian',
label: '组件',
children: [{
value: 'basic',
label: 'Basic',
children: [{
value: 'layout',
label: 'Layout 布局'
}, {
value: 'color',
label: 'Color 色彩'
}, {
value: 'typography',
label: 'Typography 字体'
}, {
value: 'icon',
label: 'Icon 图标'
}, {
value: 'button',
label: 'Button 按钮'
}]
}, {
value: 'form',
label: 'Form',
children: [{
value: 'radio',
label: 'Radio 单选框'
}, {
value: 'checkbox',
label: 'Checkbox 多选框'
}, {
value: 'input',
label: 'Input 输入框'
}, {
value: 'input-number',
label: 'InputNumber 计数器'
}, {
value: 'select',
label: 'Select 选择器'
}, {
value: 'cascader',
label: 'Cascader 级联选择器'
}, {
value: 'switch',
label: 'Switch 开关'
}, {
value: 'slider',
label: 'Slider 滑块'
}, {
value: 'time-picker',
label: 'TimePicker 时间选择器'
}, {
value: 'date-picker',
label: 'DatePicker 日期选择器'
}, {
value: 'datetime-picker',
label: 'DateTimePicker 日期时间选择器'
}, {
value: 'upload',
label: 'Upload 上传'
}, {
value: 'rate',
label: 'Rate 评分'
}, {
value: 'form',
label: 'Form 表单'
}]
}, {
value: 'data',
label: 'Data',
children: [{
value: 'table',
label: 'Table 表格'
}, {
value: 'tag',
label: 'Tag 标签'
}, {
value: 'progress',
label: 'Progress 进度条'
}, {
value: 'tree',
label: 'Tree 树形控件'
}, {
value: 'pagination',
label: 'Pagination 分页'
}, {
value: 'badge',
label: 'Badge 标记'
}]
}, {
value: 'notice',
label: 'Notice',
children: [{
value: 'alert',
label: 'Alert 警告'
}, {
value: 'loading',
label: 'Loading 加载'
}, {
value: 'message',
label: 'Message 消息提示'
}, {
value: 'message-box',
label: 'MessageBox 弹框'
}, {
value: 'notification',
label: 'Notification 通知'
}]
}, {
value: 'navigation',
label: 'Navigation',
children: [{
value: 'menu',
label: 'NavMenu 导航菜单'
}, {
value: 'tabs',
label: 'Tabs 标签页'
}, {
value: 'breadcrumb',
label: 'Breadcrumb 面包屑'
}, {
value: 'dropdown',
label: 'Dropdown 下拉菜单'
}, {
value: 'steps',
label: 'Steps 步骤条'
}]
}, {
value: 'others',
label: 'Others',
children: [{
value: 'dialog',
label: 'Dialog 对话框'
}, {
value: 'tooltip',
label: 'Tooltip 文字提示'
}, {
value: 'popover',
label: 'Popover 弹出框'
}, {
value: 'card',
label: 'Card 卡片'
}, {
value: 'carousel',
label: 'Carousel 走马灯'
}, {
value: 'collapse',
label: 'Collapse 折叠面板'
}]
}]
}, {
value: 'ziyuan',
label: '资源',
children: [{
value: 'axure',
label: 'Axure Components'
}, {
value: 'sketch',
label: 'Sketch Templates'
}, {
value: 'jiaohu',
label: '组件交互文档'
}]
}]
rules: {
name: [
{ required: true, message: '请输入名字', trigger: 'blur' }
],
phone: [
{ required: true, message: '请输入手机号', trigger: 'change' },
{ min: 11, max: 11, message: '长度为11位', trigger: 'blur' }
],
area: [
{ required: true, message: '请选择地区', trigger: 'change' }
]
},
proviceID: '',
cityID: '',
provice_name: '',
city_name: '',
area_name: '',
props: {
lazy: true,
lazyLoad(node, resolve) {
var nodes = []
const { level } = node
// 1
const type = level === 0 ? '1' : node.value
const child = []
const child2 = []
if (node.level === 0) {
getArea({ area_level: type }).then(res => {
if (res && res.data) {
//
res.data.map(item => {
const obj = {
value: item.cityCd,
label: item.cityNm,
leaf: level >= 2
}
nodes.push(obj)
this.options = nodes
})
return resolve(nodes)
}
})
} else if (node.level === 1) { //
nodes = this.options
getArea({ parent_city_cd: node.data.value, area_level: '2' }).then(res => {
nodes.map(item => {
if (item.value === node.data.value) {
item.children = []
res.data.map(item2 => {
const obj = {
value: item2.cityCd,
label: item2.cityNm,
leaf: level >= 3
}
item.children.push(obj)
child.push(obj)
})
}
})
this.options = nodes
this.proviceID = node.data.value
this.provice_name = node.data.label
return resolve(child)
})
} else if (node.level === 2) { //
nodes = this.options
this.cityID = node.data.value
this.city_name = node.data.label
getArea({ parent_city_cd: node.data.value, area_level: '3' }).then(res => {
this.options.map(item => {
if (item.value === this.proviceID) {
item.children.map(item2 => {
if (item2.value === this.cityID) {
item2.children = []
res.data.map(item3 => {
const obj = {
value: item3.cityCd,
label: item3.cityNm,
leaf: true
}
item2.children.push(obj)
child2.push(obj)
})
}
})
}
})
return resolve(child2)
})
}
}
}
}
},
methods: {
onSubmit() {
this.$message('submit!')
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
register({ name: this.form.name, phone: this.form.phone,
area: {
provice_name: this.form.area.provice_name,
city_name: this.form.area.city_name,
area_name: this.form.area.area_name
}}
).then(res => {
if (res && res.code === 200) {
this.$message('添加成功!')
this.resetForm(formName)
} else {
this.$message(res.msg)
}
})
}
})
},
resetForm(formName) {
this.$refs[formName].resetFields()
},
handleChange(value) {
console.log(value)
this.form.area = {
provice_name: this.$refs['cascaderRef'].getCheckedNodes()[0].pathLabels[0],
city_name: this.$refs['cascaderRef'].getCheckedNodes()[0].pathLabels[1],
area_name: this.$refs['cascaderRef'].getCheckedNodes()[0].pathLabels[2]
}
}
}
}

View File

@ -3,7 +3,7 @@
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
<div class="title-container">
<h3 class="title">Login Form</h3>
<h3 class="title">登录</h3>
</div>
<el-form-item prop="username">
@ -41,7 +41,7 @@
</span>
</el-form-item>
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">登录</el-button>
<div class="tips">
<span style="margin-right:20px;">username: admin</span>
@ -67,7 +67,7 @@ export default {
}
const validatePassword = (rule, value, callback) => {
if (value.length < 6) {
callback(new Error('The password can not be less than 6 digits'))
callback(new Error('密码不能少于6位数'))
} else {
callback()
}

View File

@ -1,155 +1,138 @@
<template>
<div class="app-container">
<!-- -->
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
:data="list"
border
fit
highlight-current-row
>
<el-table-column align="center" label="商户名字">
<template slot-scope="scope">
{{ scope.$index }}
{{ scope.row.shop_name }}
</template>
</el-table-column>
<el-table-column label="进件时间" align="center">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
<span>{{ scope.row.account_date }}</span>
</template>
</el-table-column>
<el-table-column label="所在地区" align="center">
<template slot-scope="scope">
{{ scope.row.pageviews }}
{{ scope.row.license_address }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="费率" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status | statusFilter">{{ scope.row.status }}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="所属行业" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status | statusFilter">{{ scope.row.status }}</el-tag>
{{ scope.row.rates }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="商户手机号" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status | statusFilter">{{ scope.row.status }}</el-tag>
{{ scope.row.phone }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="法人名字" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status | statusFilter">{{ scope.row.status }}</el-tag>
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="进件人" align="center">
<template slot-scope="scope">
{{ scope.row.manager }}
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="进件状态">
<template slot-scope="scope">
<i class="el-icon-time" />
<span>{{ scope.row.display_time }}</span>
<el-button type="success" size="mini">通过</el-button>
<el-button type="danger" size="mini">驳回</el-button>
<span>{{ scope.row.state==1?'进件中': scope.row.state==2?'审核中':scope.row.state==3?'待签约':scope.row.state==4?'已驳回':'已完成' }}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="详情" align="center">
<template slot-scope="scope">
<span style="color: #3033d1;" @click="dialogFormVisible =true">查看</span>
<span style="color: #409EFF;" @click="checkInfo(scope.row)">查看</span>
</template>
</el-table-column>
</el-table>
<el-dialog title="进件详情" :visible.sync="dialogFormVisible">
<el-form :model="form" :inline="true">
<el-form-item label="商户类型" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="店铺名称" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="身份证正反面" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.shop_name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="法人姓名" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="身份证号" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-form-item label="法人身份证号" :label-width="formLabelWidth">
<el-input v-model="form.id_number" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="手机号" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.phone" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="邮箱" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="营业执照" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.email" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item
label="统一社会信用代
"
:label-width="formLabelWidth"
>
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.uscc" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="营业执照名称" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="执照有效期" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.license_name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="营业执照地址" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.license_address" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="商户营业地区" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="银行卡正反面" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="银行卡号" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-form-item label="结算银行卡号" :label-width="formLabelWidth">
<el-input v-model="form.bank_number" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="预留手机号" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.bank_phone" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="客户经理" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-form-item label="进件人" :label-width="formLabelWidth">
<el-input v-model="form.manager" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="费率" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.rates" autocomplete="off" :disabled="true" />
</el-form-item>
<el-form-item label="进件状态" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off" :disabled="true" />
<el-input v-model="form.state==1?'进件中': form.state==2?'审核中':form.state==3?'待签约':form.state==4?'已驳回':'已完成'" autocomplete="off" :disabled="true" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">驳回</el-button>
<el-button type="primary" @click="dialogFormVisible = false">通过</el-button>
</div>
</el-dialog>
<!-- 分页 -->
<el-pagination
background
layout="prev, pager, next"
:total="total"
:page-size="size"
:current-page="page"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
import { getList } from '@/api/table'
import { getApplyList } from '@/api/user'
export default {
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'gray',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
list: null,
listLoading: true,
list: [],
dialogFormVisible: false,
formLabelWidth: '120px',
form: {}
form: {},
page: 1,
size: 20,
total: 0
}
},
computed: {
currentList() {
const start = (this.page - 1) * this.size
return this.list.slice(start, start + this.size) //
}
},
created() {
@ -157,12 +140,33 @@ export default {
},
methods: {
fetchData() {
this.listLoading = true
getList().then(response => {
this.list = response.data.items
this.listLoading = false
getApplyList({ page: this.page, size: this.size }).then(res => {
this.total = res.data.total || 0
this.list = res.data.data || []
})
},
handleSizeChange(val) {
this.size = val //
this.page = 1 //
this.fetchData()
},
handleCurrentChange(val) {
this.page = val //
this.fetchData() //
},
checkInfo(row) {
this.form = row
this.dialogFormVisible = true
}
}
}
</script>
<style scoped>
.el-pagination {
text-align: center;
margin-top: 20px;
}
.el-table th.status-col {
width: 120px;
}
</style>