我们发布啦

This commit is contained in:
张乐
2020-08-13 16:12:57 +08:00
parent a3e1c38d27
commit c0cec49f41
1885 changed files with 376936 additions and 2 deletions

View File

@@ -0,0 +1,180 @@
<template>
<div>
<el-form ref="pram" :model="pram" :rules="rules" label-width="100px">
<el-form-item label="管理员账号" prop="account">
<el-input v-model="pram.account" placeholder="管理员账号" />
</el-form-item>
<el-form-item label="管理员密码" prop="pwd">
<el-input
v-model="pram.pwd"
placeholder="管理员密码,不更改可以不填写"
clearable
@input="handlerPwdInput"
@clear="handlerPwdInput"
/>
</el-form-item>
<el-form-item v-if="pram.pwd" label="确认密码" prop="repwd">
<el-input v-model="pram.repwd" placeholder="确认密码" clearable />
</el-form-item>
<el-form-item label="管理员姓名" prop="realName">
<el-input v-model="pram.realName" placeholder="管理员姓名" />
</el-form-item>
<el-form-item label="管理员身份" prop="roles">
<el-select v-model="pram.roles" placeholder="身份" clearable multiple>
<el-option
v-for="item,index in roleList.list"
:key="index"
:label="item.roleName"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="pram.status" :active-value="true" :inactive-value="false" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handlerSubmit('pram')">{{ isCreate===0?'確定':'更新' }}</el-button>
<el-button @click="close">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import * as constants from '@/utils/constants.js'
import * as roleApi from '@/api/role.js'
import * as systemAdminApi from '@/api/systemadmin.js'
export default {
// name: "edit"
components: { },
props: {
isCreate: {
type: Number,
required: true
},
editData: {
type: Object,
default: () => {
return { rules: [] }
}
}
},
data() {
const validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'))
} else if (value !== this.pram.pwd) {
callback(new Error('两次输入密码不一致!'))
} else {
callback()
}
}
return {
constants,
pram: {
account: null,
level: null,
pwd: null,
repwd: null,
realName: null,
roles: null,
status: null,
id: null
},
roleList: [],
rules: {
account: [{ required: true, message: '请填管理员账号', trigger: ['blur', 'change'] }],
// level: null,
pwd: [{ required: true, message: '请填管理员密码', trigger: ['blur', 'change'] }],
repwd: [{ required: true, message: '确认密码密码', validator: validatePass, trigger: ['blur', 'change'] }],
realName: [{ required: true, message: '管理员姓名', trigger: ['blur', 'change'] }],
roles: [{ required: true, message: '管理员身份', trigger: ['blur', 'change'] }]
}
}
},
mounted() {
this.initEditData()
this.handleGetRoleList()
},
methods: {
close() {
this.$emit('hideEditDialog')
},
handleGetRoleList() {
const _pram = {
page: 1,
limit: constants.page.limit[4]
}
roleApi.getRoleList(_pram).then(data => {
this.roleList = data
})
},
initEditData() {
if (this.isCreate !== 1) return
const { account, realName, roles, level, status, id } = this.editData
this.pram.account = account
this.pram.realName = realName
const _roles = []
if (roles.length > 0 && !roles.includes(',')) {
_roles.push(Number.parseInt(roles))
} else {
_roles.push(...roles.split(',').map(item => Number.parseInt(item)))
}
this.pram.roles = _roles
this.pram.status = status
this.pram.id = id
this.rules.pwd = []
this.rules.repwd = []
},
handlerSubmit(form) {
this.$refs[form].validate(valid => {
if (!valid) return
if (this.isCreate === 0) {
this.handlerSave()
} else {
this.handlerEdit()
}
})
},
handlerSave() {
systemAdminApi.adminAdd(this.pram).then(data => {
this.$message.success('创建管理员成功')
this.$emit('hideEditDialog')
})
},
handlerEdit() {
this.pram.roles = this.pram.roles.join(',')
systemAdminApi.adminUpdate(this.pram).then(data => {
this.$message.success('更新管理员成功')
this.$emit('hideEditDialog')
})
},
rulesSelect(selectKeys) {
this.pram.rules = selectKeys
},
handlerPwdInput(val) {
if (!val) {
this.rules.pwd = []
this.rules.repwd = []
return
}
this.rules.pwd = [
{ required: true, message: '请填管理员密码', trigger: ['blur', 'change'] },
{ min: 6, max: 20, message: '长度6-20个字符', trigger: ['blur', 'change'] }]
this.rules.repwd = [{ required: true, message: '两次输入密码不一致', validator: (rule, value, callback) => {
if (value === '') {
callback(new Error('两次输入密码不一致!'))
} else if (value !== this.pram.pwd) {
callback(new Error('两次输入密码不一致!'))
} else {
callback()
}
}, trigger: ['blur', 'change'] }]
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,220 @@
<template>
<div class="divBox">
<el-card class="box-card">
<el-form inline size="small">
<el-form-item>
<el-select v-model="listPram.realName" placeholder="身份" clearable class="selWidth">
<el-option
v-for="item in roleList.list"
:key="item.id"
:label="item.roleName"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="listPram.isDel" placeholder="删除状态" clearable class="selWidth">
<el-option
v-for="item in constants.deletedOrNormal"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="listPram.status" placeholder="状态" clearable class="selWidth">
<el-option
v-for="item in constants.roleListStatus"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-input v-model="listPram.roleName" placeholder="姓名或者账号" clearable class="selWidth"/>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click.native="handleGetAdminList">查询</el-button>
</el-form-item>
</el-form>
<el-form inline>
<el-form-item>
<el-button size="mini" type="primary" @click="handlerOpenEdit(0)">添加管理员</el-button>
</el-form-item>
</el-form>
<el-table :data="listData.list" size="mini">
<el-table-column label="姓名" prop="realName" />
<el-table-column label="账号" prop="account" />
<el-table-column label="身份" prop="realName">
<template slot-scope="scope">
<span v-for="item in roleList.list" :key="item.id">
<el-tag v-if="scope.row.roles.includes(item.id)" type="info">{{ item.roleName }}</el-tag>
<!-- <span>{{ scope.row }}</span>-->
</span>
</template>
</el-table-column>
<el-table-column label="最后登录时间" prop="lastTime">
<template slot-scope="scope">
<span>{{ scope.row.lastTime | filterEmpty }}</span>
</template>
</el-table-column>
<el-table-column label="最后登录IP" prop="lastIp">
<template slot-scope="scope">
<span>{{ scope.row.lastIp | filterEmpty }}</span>
</template>
</el-table-column>
<el-table-column label="状态" prop="status" width="100">
<template slot-scope="scope">
<span>{{ scope.row.status | filterShowOrHide }}</span>
</template>
</el-table-column>
<el-table-column label="删除标记" prop="status" width="100">
<template slot-scope="scope">
<span>{{ scope.row.isDel | filterYesOrNo }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<template v-if="scope.row.isDel">
<span>-</span>
</template>
<template v-else>
<el-button type="text" size="mini" @click="handlerOpenEdit(1,scope.row)">编辑</el-button>
<el-button type="text" size="mini" @click="handlerOpenDel(scope.row)">删除</el-button>
</template>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="listPram.page"
:page-sizes="constants.page.limit"
:layout="constants.page.layout"
:total="listData.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
<el-dialog
:visible.sync="editDialogConfig.visible"
:title="editDialogConfig.isCreate === 0? '创建身份':'编辑身份'"
destroy-on-close
:close-on-click-modal="false"
>
<edit
v-if="editDialogConfig.visible"
:is-create="editDialogConfig.isCreate"
:edit-data="editDialogConfig.editData"
@hideEditDialog="hideEditDialog"
/>
</el-dialog>
</div>
</template>
<script>
import * as systemAdminApi from '@/api/systemadmin.js'
import * as roleApi from '@/api/role.js'
import * as constants from '@/utils/constants.js'
import edit from './edit'
export default {
// name: "index"
components: { edit },
data() {
return {
constants,
listData: { list: [] },
listPram: {
account: null,
addTime: null,
isDel: null, // false=正常true=已删除,数据库逻辑删除
lastIp: null,
lastTime: null,
level: null,
loginCount: null,
realName: null,
roles: null,
status: null,
page: 1,
limit: constants.page.limit[1]
},
roleList: [],
menuList: [],
editDialogConfig: {
visible: false,
isCreate: 0, // 0=创建1=编辑
editData: {}
}
}
},
mounted() {
this.handleGetAdminList()
this.handleGetRoleList()
},
methods: {
handleSizeChange(val) {
this.listPram.limit = val
this.handleGetRoleList(this.listPram)
},
handleCurrentChange(val) {
this.listPram.page = val
this.handleGetRoleList(this.listPram)
},
handleGetRoleList() {
const _pram = {
page: 1,
limit: constants.page.limit[4]
}
roleApi.getRoleList(_pram).then(data => {
this.roleList = data
})
},
handlerOpenDel(rowData) {
this.$confirm('确认删除当前数据').then(() => {
const _pram = { id: rowData.id, isDel: 1, roles: Array.of(rowData.roles) }
systemAdminApi.adminUpdate(_pram).then(data => {
this.$message.success('删除数据成功')
this.handleGetAdminList()
})
})
},
handleGetAdminList() {
systemAdminApi.adminList(this.listPram).then(data => {
this.listData = data
// this.handlerGetMenuList()
})
},
handlerOpenEdit(isCreate, editDate) {
this.editDialogConfig.editData = editDate
this.editDialogConfig.isCreate = isCreate
this.editDialogConfig.visible = true
},
handlerGetMenuList() { // 获取菜单全部数据后做menu翻译使用
systemAdminApi.listCategroy({ page: 1, limit: 999, type: 5 }).then(data => {
this.menuList = data.list
this.listData.list.forEach(item => {
const _muneText = []
const menuids = item.rules.split(',')
menuids.map(muid => {
this.menuList.filter(menu => {
if (menu.id == muid) {
_muneText.push(menu.name)
}
})
})
item.rulesView = _muneText.join(',')
this.$set(item, 'rulesViews', item.rulesView)
})
})
},
hideEditDialog() {
this.editDialogConfig.visible = false
this.handleGetAdminList()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,110 @@
<template>
<div>
<el-form ref="pram" :model="pram" label-width="100px">
<el-form-item label="身份名称" prop="roleName" :rules="[{required:true,message:'请填写身份名称', trigger:['blur','change']}]">
<el-input v-model="pram.roleName" placeholder="身份名称" />
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="pram.status" :active-value="true" :inactive-value="false" />
</el-form-item>
<el-form-item label="权限">
<category-list
:biztype="constants.categoryType[4]"
:select-model="true"
:row-select="pram.rules"
:select-model-keys="editData.rules"
@rulesSelect="rulesSelect"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handlerSubmit('pram')">{{ isCreate===0?'確定':'更新' }}</el-button>
<el-button @click="close">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import categoryList from '@/components/Category/list'
import * as constants from '@/utils/constants.js'
import * as roleApi from '@/api/role.js'
export default {
// name: "edit"
components: { categoryList },
props: {
isCreate: {
type: Number,
required: true
},
editData: {
type: Object,
default: () => {
return { rules: [] }
}
}
},
data() {
return {
constants,
pram: {
level: 0,
roleName: null,
rules: [],
status: null,
id: null
}
}
},
mounted() {
this.initEditData()
},
methods: {
close() {
this.$emit('hideEditDialog')
},
initEditData() {
if (this.isCreate !== 1) return
const { level, roleName, rules, status, id } = this.editData
this.pram.rules = rules
this.pram.level = level
this.pram.roleName = roleName
this.pram.status = status
this.pram.id = id
},
handlerSubmit(form) {
this.$refs[form].validate(valid => {
if (!valid) return
if (this.isCreate === 0) {
this.handlerSave()
} else {
this.handlerEdit()
}
})
},
handlerSave() {
roleApi.addRole(this.pram).then(data => {
this.$message.success('创建身份成功')
this.$emit('hideEditDialog')
})
},
handlerEdit() {
roleApi.updateRole(this.pram).then(data => {
this.$message.success('更新身份成功')
this.$emit('hideEditDialog')
})
},
rulesSelect(selectKeys) {
// let _ids = []
// select.map(item => {
// _ids.push(item.id)
// })
// this.pram.rules = _ids.join(',')
this.pram.rules = selectKeys
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,165 @@
<template>
<div class="divBox">
<el-card class="box-card">
<el-form inline size="small">
<el-form-item>
<el-select v-model="listPram.status" placeholder="状态" clearable class="selWidth">
<el-option
v-for="item in constants.roleListStatus"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-input v-model="listPram.roleName" placeholder="请输入身份昵称" clearable class="selWidth"/>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click.native="handleGetRoleList">查询</el-button>
</el-form-item>
</el-form>
<el-form inline>
<el-form-item>
<el-button size="mini" type="primary" @click="handlerOpenEdit(0)">添加身份</el-button>
</el-form-item>
</el-form>
<el-table :data="listData.list" size="mini">
<el-table-column label="身份昵称" prop="roleName" min-width="130"/>
<el-table-column label="权限" show-overflow-tooltip min-width="350">
<template slot-scope="scope">
{{ scope.row.rulesView | filterEmpty }}
</template>
</el-table-column>
<!--<el-table-column label="level" prop="level" />-->
<el-table-column label="状态" prop="status">
<template slot-scope="scope">
<span>{{ scope.row.status | filterShowOrHide }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" min-width="150"/>
<el-table-column label="更新时间" prop="updateTime" min-width="150"/>
<el-table-column label="操作" min-width="130" fixed="right">
<template slot-scope="scope">
<el-button size="small" type="text" @click="handlerOpenEdit(1,scope.row)">编辑</el-button>
<el-button size="small" type="text" @click="handlerOpenDel(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="listPram.page"
:page-sizes="constants.page.limit"
:layout="constants.page.layout"
:total="listData.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
<el-dialog
:visible.sync="editDialogConfig.visible"
:title="editDialogConfig.isCreate === 0? '创建身份':'编辑身份'"
destroy-on-close
:close-on-click-modal="false"
>
<edit
v-if="editDialogConfig.visible"
:is-create="editDialogConfig.isCreate"
:edit-data="editDialogConfig.editData"
@hideEditDialog="hideEditDialog"
/>
</el-dialog>
</div>
</template>
<script>
import * as roleApi from '@/api/role.js'
import * as categroyApi from '@/api/categoryApi.js'
import * as constants from '@/utils/constants.js'
import edit from './edit'
export default {
// name: "index"
components: { edit },
data() {
return {
constants,
listData: { list: [] },
listPram: {
createTime: null,
updateTime: null,
level: null,
page: 1,
limit: constants.page.limit[1],
roleName: null,
rules: null,
status: null
},
menuList: [],
editDialogConfig: {
visible: false,
isCreate: 0, // 0=创建1=编辑
editData: {}
}
}
},
mounted() {
this.handleGetRoleList()
},
methods: {
handlerOpenDel(rowData) {
this.$confirm('确认删除当前数据').then(() => {
roleApi.delRole(rowData).then(data => {
this.$message.success('删除数据成功')
this.handleGetRoleList()
})
})
},
handleGetRoleList() {
roleApi.getRoleList(this.listPram).then(data => {
this.listData = data
this.handlerGetMenuList()
})
},
handlerOpenEdit(isCreate, editDate) {
if (isCreate === 1) { editDate.rules = editDate.rules.split(',') }
this.editDialogConfig.editData = editDate
this.editDialogConfig.isCreate = isCreate
this.editDialogConfig.visible = true
},
handlerGetMenuList() { // 获取菜单全部数据后做menu翻译使用
categroyApi.listCategroy({ page: 1, limit: 999, type: 5 }).then(data => {
this.menuList = data.list
this.listData.list.forEach(item => {
const _muneText = []
const menuids = item.rules.split(',')
menuids.map(muid => {
this.menuList.filter(menu => {
if (menu.id == muid) {
_muneText.push(menu.name)
}
})
})
item.rulesView = _muneText.join(',')
this.$set(item, 'rulesViews', item.rulesView)
})
})
},
hideEditDialog() {
this.editDialogConfig.visible = false
this.handleGetRoleList()
},
handleSizeChange(val) {
this.listPram.limit = val
this.handleGetRoleList(this.listPram)
},
handleCurrentChange(val) {
this.listPram.page = val
this.handleGetRoleList(this.listPram)
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,15 @@
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,87 @@
<template>
<div class="divBox">
<!--<el-card shadow style="max-width: 500px;" class="mr20">-->
<!--<div slot="header" class="clearfix">-->
<!--<span>前端路由</span>-->
<!--</div>-->
<!--<div v-for="item,index in asyncRoutes">-->
<!--<template v-if="!item.hidden">-->
<!--<span v-if="item.meta">{{ item.meta.title }}{{ item.path }}</span>-->
<!--&lt;!&ndash; <span>name:{{ item.name }}</span>&ndash;&gt;-->
<!--&lt;!&ndash; <span>path:{{ item.path }}</span>&ndash;&gt;-->
<!--<template v-if="item.children">-->
<!--<div v-for="item1,iindex in item.children" class="ml20">-->
<!--<span v-if="item1.meta">{{ item1.meta.title }}</span>-->
<!--&lt;!&ndash; <span>name:{{ item1.name }}</span>&ndash;&gt;-->
<!--&lt;!&ndash; <span>path:{{ item1.path }}</span>&ndash;&gt;-->
<!--<span>allPath:{{ item.path }}/{{ item1.path }}</span>-->
<!--<template v-if="item1.children">-->
<!--<div v-for="item2,index2 in item1.children" class="ml20">-->
<!--<span v-if="item2.meta">{{ item2.meta.title }}</span>-->
<!--&lt;!&ndash; <span>name:{{ item2.name }}</span>&ndash;&gt;-->
<!--&lt;!&ndash; <span>path:{{ item2.path }}</span>&ndash;&gt;-->
<!--<span>allPath:{{ item.path }}/{{ item1.path }}/{{ item2.path }}</span>-->
<!--</div>-->
<!--</template>-->
<!--</div>-->
<!--</template>-->
<!--</template>-->
<!--</div>-->
<!--</el-card>-->
<category-list :biztype="constants.categoryType[4]" />
</div>
</template>
<script>
import { asyncRoutes, constantRoutes } from '@/router'
import * as categoryApi from '@/api/categoryApi.js'
import categoryList from '@/components/Category/list'
import * as constants from '@/utils/constants.js'
export default {
// name: "index"
components: { categoryList },
data() {
return {
asyncRoutes,
constants
}
},
mounted() {
},
methods: {
handleTreeCheckChange(data, checked, indateminate) {
console.log(data, checked, indateminate)
},
categoryAdd(pram) {
const _pram = {
extra: pram.extra,
name: pram.name,
pid: pram.pid,
sort: pram.sort,
status: pram.status,
type: pram.type,
url: pram.url
}
categoryApi.addCategroy(_pram).then(data => {
this.$message.success('添加菜单成功')
})
}
}
}
</script>
<style scoped>
.routerView{
display: flex;
flex-direction: row;
flex: 1;
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
</style>

View File

@@ -0,0 +1,215 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix" v-if="parentId>0">
<el-form inline size="small">
<el-form-item>
<el-button type="primary" @click="back()">返回</el-button>
<!-- <el-button type="primary" @click="addcity()"><i class="el-icon-plus" />添加城市</el-button>-->
</el-form-item>
</el-form>
</div>
<el-table
v-loading="loading"
:data="tableData"
size="mini"
class="table"
highlight-current-row
>
<el-table-column
prop="cityId"
label="编号"
min-width="100"
/>
<el-table-column
label="上级名称"
min-width="100"
>
<div>{{ parentName }}</div>
</el-table-column>
<el-table-column
min-width="250"
label="地区名称"
>
<template slot-scope="scope">
<el-link :underline="false" @click="cityDetail(scope.row)">{{ scope.row.name }}</el-link>
</template>
</el-table-column>
<el-table-column
label="状态"
min-width="100"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
class="demo"
active-text="开启"
inactive-text="关闭"
@change="cityStatus(scope.row)"
/>
</template>
</el-table-column>
<el-table-column
fixed="right"
min-width="80"
label="操作"
>
<template slot-scope="scope">
<el-button type="text" size="small" @click="editCity(scope.row)">编辑</el-button>
<!-- <el-button type="text" size="small">删除</el-button>-->
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
title="提示"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose"
>
<parser v-if="formShow" :form-conf="formConf" :form-edit-data="formData" :is-edit="isCreate === 1" @submit="submit" />
</el-dialog>
</div>
</template>
<script>
import parser from '@/components/FormGenerator/components/parser/Parser'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import * as logistics from '@/api/logistics.js'
export default {
name: 'CityList',
components: { parser },
data() {
return {
// 表单
formConf: { fields: [] },
// 生成表单id
formId: 70,
tableData: [],
// 上级名称
parentName: '中国',
// 父级城市id
parentId: 0,
loading: false,
dialogVisible: false,
// 选中id
editId: 0,
formShow: false,
formData: {},
isCreate: 0
}
},
created() {
this.getCityList()
},
methods: {
// 获取城市数据
getCityList() {
this.loading = true
logistics.cityList({
parentId: this.parentId
}).then(data => {
this.loading = false
this.tableData = data
})
},
// 城市详情
cityDetail(item) {
this.parentId = item.cityId
this.parentName = item.name
this.getCityList()
},
// 返回
back() {
this.parentName = '中国'
this.parentId = 0
this.getCityList()
},
// 状态
cityStatus(e) {
logistics.updateStatus({
id: e.cityId,
status: e.isShow
}).then(res => {
this.$message.success('操作成功')
}).catch(() => {
e.isShow = !e.isShow
})
},
// 编辑
editCity(item) {
this.editId = item.id
const _pram = { id: this.formId }
systemFormConfigApi.getFormConfigInfo(_pram).then(data => {
this.formShow = false
this.isCreate = 0
this.getCityInfo()
this.dialogVisible = true
this.formConf = JSON.parse(data.content)
})
},
// 详情
getCityInfo() {
logistics.cityInfo({
id: this.editId
}).then(res => {
this.isCreate = 1
this.formData = res
this.formData.parentName = this.parentName
setTimeout(() => { // 让表单重复渲染待编辑数据
this.formShow = true
}, 80)
})
},
submit(data) {
const param = {
id: this.editId,
parentId: this.parentId,
name: data.name
}
logistics.cityUpdate(param).then(res => {
this.dialogVisible = false
this.getCityList()
})
},
// 关闭模态框
handleClose(done) {
this.formConf.fields = []
this.dialogVisible = false
}
}
}
</script>
<style lang="scss" scoped>
.el-icon-plus {
margin-right: 5px;
}
.demo .el-switch__label {
position: absolute;
display: none;
color: #fff;
}
/*打开时文字位置设置*/
.demo .el-switch__label--right {
z-index: 1;
}
/*关闭时文字位置设置*/
.demo .el-switch__label--left {
z-index: 1;
left: 19px;
}
/*显示文字*/
.demo .el-switch__label.is-active {
display: block;
}
.demo.el-switch .el-switch__core,
.el-switch .el-switch__label {
width: 60px !important;
}
</style>

View File

@@ -0,0 +1,266 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form ref="form" inline :model="form">
<el-form-item label="搜索:">
<el-input v-model="form.name" placeholder="请输入内容" class="selWidth" size="small">
<el-button slot="append" size="small" icon="el-icon-search" @click="getExpressList" />
</el-input>
</el-form-item>
</el-form>
</div>
<el-button type="primary" size="small" @click="addExpress">添加物流公司</el-button>
</div>
<el-table
v-loading="loading"
:data="tableData.list"
style="width: 100%"
>
<el-table-column
prop="id"
label="ID"
min-width="180"
/>
<el-table-column
label="物流公司名称"
min-width="150"
prop="name"
/>
<el-table-column
min-width="200"
label="编码"
prop="code"
/>
<el-table-column
min-width="100"
label="排序"
prop="sort"
sortable
/>
<el-table-column
label="状态"
min-width="100"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
class="demo"
active-text="开启"
inactive-text="关闭"
@change="bindStatus(scope.row)"
/>
</template>
</el-table-column>
<el-table-column
prop="address"
fixed="right"
min-width="120"
label="操作"
>
<template slot-scope="scope">
<el-button type="text" size="small" @click="bindEdit(scope.row)">编辑</el-button>
<el-button type="text" size="small" @click="bindDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block-pagination">
<el-pagination
:page-sizes="[12, 20, 40, 60]"
:page-size="tableData.limit"
:current-page="tableData.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@current-change="pageChange"
@size-change="handleSizeChange"
/>
</div>
</el-card>
<el-dialog
title="提示"
:visible.sync="dialogVisible"
width="700px"
:before-close="handleClose"
>
<parser v-if="formShow" ref="formBox" class="formBox" :form-conf="formConf" :form-edit-data="formData" :is-edit="isCreate === 1" @submit="submit" />
</el-dialog>
</div>
</template>
<script>
import parser from '@/components/FormGenerator/components/parser/Parser'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import * as logistics from '@/api/logistics.js'
export default {
name: 'CompanyList',
components: { parser },
data() {
return {
// 表单
formConf: { fields: [] },
form: {
name: ''
},
tableData: {},
page: 1,
limit: 12,
loading: false,
dialogVisible: false,
fromType: 'add',
formData: {},
isCreate: 0,
formShow: false,
editId: 0
}
},
created() {
this.getExpressList()
},
methods: {
// 获取物流公司列表
getExpressList() {
this.loading = true
logistics.expressList({
page: this.page,
limit: this.limit,
keywords: this.form.name
}).then(res => {
this.loading = false
this.tableData = res
})
},
// 物流开关
bindStatus(item) {
logistics.expressUpdate({
code: item.code,
id: item.id,
isShow: item.isShow,
name: item.name,
sort: item.sort
}).then(res => {
this.$message.success('操作成功')
}).catch(() => {
item.isShow = !item.isShow
})
},
// 分页
pageChange(e) {
this.page = e
this.getExpressList()
},
handleSizeChange(e) {
this.limit = e
this.getExpressList()
},
// 添加物流公司
addExpress() {
this.fromType = 'add'
const _pram = { id: 71 }
systemFormConfigApi.getFormConfigInfo(_pram).then(data => {
this.dialogVisible = true
this.formConf = JSON.parse(data.content)
this.formShow = true
})
},
// 删除物流公司
bindDelete(item) {
this.$modalSure().then(() => {
logistics.expressDelete({ id: item.id }).then(res => {
this.$message.success('删除成功')
this.getExpressList()
})
})
},
// 表单提交
submit(data) {
if (this.fromType === 'add') {
logistics.expressSave(data).then(res => {
this.handleClose()
this.getExpressList()
this.$message.success('操作成功')
})
} else {
data.id = this.editId
console.log(data)
logistics.expressUpdate(data).then(res => {
this.handleClose()
this.getExpressList()
this.$message.success('操作成功')
})
}
},
// 关闭模态框
handleClose(done) {
this.formShow = false
this.formData = {}
this.formConf.fields = []
this.dialogVisible = false
this.isCreate = 0
},
// 编辑
bindEdit(item) {
this.editId = item.id
this.fromType = 'edit'
const _pram = { id: 71 }
systemFormConfigApi.getFormConfigInfo(_pram).then(data => {
this.formShow = false
this.isCreate = 0
this.dialogVisible = true
this.formConf = JSON.parse(data.content)
this.getInfo(item)
})
},
getInfo(item) {
logistics.expressInfo({ id: item.id }).then(res => {
this.formData = res
this.isCreate = 1
setTimeout(() => { // 让表单重复渲染待编辑数据
this.formShow = true
}, 80)
})
}
}
}
</script>
<style lang="scss" scoped>
.selWidth{
width: 350px;
}
.el-icon-plus {
margin-right: 5px;
}
.demo .el-switch__label {
position: absolute;
display: none;
color: #fff;
}
/*打开时文字位置设置*/
.demo .el-switch__label--right {
z-index: 1;
}
/*关闭时文字位置设置*/
.demo .el-switch__label--left {
z-index: 1;
left: 19px;
}
/*显示文字*/
.demo .el-switch__label.is-active {
display: block;
}
.demo.el-switch .el-switch__core,
.el-switch .el-switch__label {
width: 60px !important;
}
.formBox{
.el-input-number--medium{
width: 100px;
}
}
</style>

View File

@@ -0,0 +1,75 @@
<template>
<div class="divBox">
<el-card class="box-card">
<parser v-if="isShow" class="formBox" :form-conf="formConf" :form-edit-data="formData" :is-edit="isCreate === 1" @submit="submit" />
</el-card>
</div>
</template>
<script>
import parser from '@/components/FormGenerator/components/parser/Parser'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import { configSaveForm, configInfo } from '@/api/systemConfig.js'
export default {
name: 'Config',
components: { parser },
data() {
return {
// 表单
formConf: { fields: [] },
formId: 74,
formData: {},
isCreate: 0,
isShow: false
}
},
created() {
systemFormConfigApi.getFormConfigInfo({ id: this.formId }).then(data => {
this.formConf = JSON.parse(data.content)
})
this.getFormInfo()
},
methods: {
submit(data) {
const tempArr = []
for (var key in data) {
const obj = {}
obj.name = key
obj.title = key
obj.value = data[key]
tempArr.push(obj)
}
const _pram = {
'fields': tempArr,
'id': this.formId,
'sort': 0,
'status': true
}
console.log(_pram)
configSaveForm(_pram).then(res => {
this.getFormInfo()
this.$message.success('操作成功')
})
},
// 获取表单详情
getFormInfo() {
configInfo({ id: this.formId }).then(res => {
this.isShow = false
this.formData = res
this.isCreate = 1
setTimeout(() => { // 让表单重复渲染待编辑数据
this.isShow = true
}, 80)
})
}
}
}
</script>
<style lang="scss" scoped>
.el-button--primary{
width: 100%;
height: 40px;
margin-top: 10px;
}
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,472 @@
<template>
<el-dialog
v-if="dialogVisible"
title="运费模板"
:visible.sync="dialogVisible"
width="1000px"
:before-close="handleClose"
>
<el-form ref="ruleForm" :model="ruleForm" label-width="120px" size="mini" v-if="dialogVisible" :rules="rules">
<el-form-item label="模板名称" prop="name">
<el-input v-model="ruleForm.name" class="withs" placeholder="请输入模板名称" />
</el-form-item>
<el-form-item label="计费方式" prop="type">
<el-radio-group v-model="ruleForm.type" @change="changeRadio(ruleForm.type)">
<el-radio :label="1">按件数</el-radio>
<el-radio :label="2">按重量</el-radio>
<el-radio :label="3">按体积</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="配送区域及运费" prop="region">
<el-table v-loading="listLoading" :data="ruleForm.region" border fit highlight-current-row style="width: 100%" size="mini" class="tempBox">
<el-table-column align="center" label="可配送区域" min-width="260">
<template slot-scope="scope">
<span v-if="scope.$index === 0">默认全国</span>
<el-cascader
v-else
v-model="scope.row.city_ids"
style="width: 98%"
:options="cityList"
:props="props"
collapse-tags
clearable
filterable
@change="changeRegion"
/>
</template>
</el-table-column>
<el-table-column min-width="130px" align="center" :label="columns.title">
<template slot-scope="{row}">
<el-input-number v-model="row.first" controls-position="right" :min="1" />
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" label="运费(元)">
<template slot-scope="{row}">
<el-input-number v-model="row.firstPrice" controls-position="right" />
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" :label="columns.title2">
<template slot-scope="{row}">
<el-input-number v-model="row.renewal" controls-position="right" />
</template>
</el-table-column>
<el-table-column class-name="status-col" align="center" label="续费(元)" min-width="120">
<template slot-scope="{row}">
<el-input-number v-model="row.renewalPrice" controls-position="right" />
</template>
</el-table-column>
<el-table-column align="center" label="操作" min-width="80">
<template slot-scope="scope">
<el-button
v-if="scope.$index > 0"
type="text"
size="small"
@click="confirmEdit(ruleForm.region,scope.$index)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" icon="el-icon-edit" @click="addRegion(ruleForm.region)">
添加配送区域
</el-button>
</el-form-item>
<el-form-item label="指定包邮" prop="appoint">
<el-radio-group v-model="ruleForm.appoint">
<el-radio :label="true">开启</el-radio>
<el-radio :label="false">关闭</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="ruleForm.appoint === true" prop="free">
<el-table v-loading="listLoading" :data="ruleForm.free" border fit highlight-current-row style="width: 100%" size="mini">
<el-table-column align="center" label="选择地区" min-width="220">
<template slot-scope="{row}">
<el-cascader
v-model="row.city_ids"
style="width: 95%"
:options="cityList"
:props="props"
collapse-tags
clearable
/>
</template>
</el-table-column>
<el-table-column min-width="180px" align="center" :label="columns.title3">
<template slot-scope="{row}">
<el-input-number v-model="row.number" controls-position="right" />
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" label="包邮金额(元)">
<template slot-scope="{row}">
<el-input-number v-model="row.price" controls-position="right" />
</template>
</el-table-column>
<el-table-column align="center" label="操作" min-width="120">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click="confirmEdit(ruleForm.free,scope.$index)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item v-if="ruleForm.appoint === true">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="addFree(ruleForm.free)">
添加指定包邮区域
</el-button>
</el-form-item>
<!--<el-row :gutter="20">-->
<!--<el-col :span="7">-->
<!--<el-form-item label="指定区域不配送" prop="undelivery">-->
<!--<el-radio-group v-model="ruleForm.undelivery">-->
<!--<el-radio :label="1">开启</el-radio>-->
<!--<el-radio :label="0">关闭</el-radio>-->
<!--</el-radio-group>-->
<!--</el-form-item>-->
<!--</el-col>-->
<!--<el-col :span="14">-->
<!--<el-form-item v-if="ruleForm.undelivery === 1" class="noBox" prop="city_id3">-->
<!--<el-cascader-->
<!--v-model="ruleForm.city_id3"-->
<!--placeholder="请选择不配送区域"-->
<!--:options="cityList"-->
<!--:props="props"-->
<!--collapse-tags-->
<!--clearable-->
<!--style="width: 46%"-->
<!--/>-->
<!--</el-form-item>-->
<!--</el-col>-->
<!--</el-row>-->
<el-form-item label="排序">
<el-input v-model="ruleForm.sort" class="withs" placeholder="请输入排序" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="onClose('ruleForm')"> </el-button>
<el-button type="primary" @click="onsubmit('ruleForm')"> </el-button>
</span>
</el-dialog>
</template>
<script>
import * as logistics from '@/api/logistics'
import { Loading } from 'element-ui'
const defaultRole = {
name: '',
type: 1,
appoint: false,
sort: 0,
region: [{
first: 1,
firstPrice: 1,
renewal: 1,
renewalPrice: 1,
city_id: [],
city_ids: []
}],
undelivery: 0,
free: [],
undelives: {},
city_id3: []
}
const kg = '重量kg'
const m = '体积'
const statusMap = [
{
title: '首件',
title2: '续件',
title3: '包邮件数'
},
{
title: `首件${kg}`,
title2: `续件${kg}`,
title3: `包邮${kg}`
},
{
title: `首件${m}`,
title2: `续件${m}`,
title3: `包邮${m}`
}
]
export default {
name: 'CreatTemplates',
components: {
},
data() {
return {
rules: {
name: [
{ required: true, message: '请输入模板名称', trigger: 'blur' }
],
free: [
{ type: 'array', required: true, message: '请至少添加一个地区', trigger: 'change' }
],
appoint: [
{ required: true, message: '请选择是否指定包邮', trigger: 'change' }
],
undelivery: [
{ required: true, message: '请选择是否指定区域不配送', trigger: 'change' }
],
type: [
{ required: true, message: '请选择计费方式', trigger: 'change' }
],
region: [
{ required: true, message: '请选择活动区域', trigger: 'change' }
],
city_id3: [
{ type: 'array', required: true, message: '请至少选择一个地区', trigger: 'change' }
]
},
nodeKey: 'city_id',
props: {
children: 'child',
label: 'name',
value: 'cityId',
multiple: true
},
dialogVisible: false,
ruleForm: Object.assign({}, defaultRole),
listLoading: false,
cityList: [],
columns: {
title: '首件',
title2: '续件',
title3: '包邮件数'
},
tempId: 0,
type: 0 // 0添加 1编辑
}
},
mounted() {
},
methods: {
changType(type) {
this.type = type
},
onClose(formName) {
this.dialogVisible = false
this.$refs[formName].resetFields()
},
confirmEdit(row, index) {
row.splice(index, 1)
},
popoverHide() {},
handleClose() {
this.dialogVisible = false
this.$refs['ruleForm'].resetFields()
},
changeRegion(value) {
// console.log(value)
},
changeRadio(num) {
this.columns = Object.assign({}, statusMap[num - 1])
},
// 添加配送区域
addRegion(region) {
region.push(Object.assign({}, {
first: 1,
firstPrice: 1,
renewal: 1,
renewalPrice: 1,
city_id: [],
city_ids: []
}))
},
addFree(Free) {
Free.push(Object.assign({}, {
city_id: [],
number: 1,
price: 1,
city_ids: []
}))
},
/**
* 详情
* id 模板id
* appoint true包邮 false不包邮
**/
getInfo(id, appoint) {
this.tempId = id
const loadingInstance = Loading.service({ fullscreen: true })
logistics.templateDetailApi({ id }).then(res => {
this.dialogVisible = true
const info = res
this.ruleForm = Object.assign(this.ruleForm, {
name: info.name,
type: info.type,
appoint: info.appoint,
sort: info.sort
})
this.$nextTick(() => {
loadingInstance.close()
})
// 不包邮地区
this.shippingRegion()
// 包邮地区
if (info.appoint) {
this.shippingFree()
}
}).catch(res => {
// console.log(res)
this.$message.error(res.message)
this.$nextTick(() => {
loadingInstance.close()
})
})
},
// 不包邮
shippingRegion() {
logistics.shippingRegion({ tempId: this.tempId }).then(res => {
res.forEach((item, index) => {
item.title = JSON.parse(item.title)
item.city_id = item.title
item.city_ids = item.title
})
this.ruleForm.region = res
})
},
// 包邮
shippingFree() {
logistics.shippingFree({ tempId: this.tempId }).then(res => {
res.forEach((item, index) => {
item.title = JSON.parse(item.title)
item.city_id = item.title
item.city_ids = item.title
})
this.ruleForm.free = res
})
},
// 列表
getCityList() {
logistics.cityListTree().then(res => {
// console.log(res, 'getCityList')
res.forEach((el, index) => {
el.child.forEach((cel, j) => {
delete cel.child
})
})
this.cityList = res
}).catch(res => {
this.$message.error(res.message)
})
},
change(idBox) {
idBox.map(item => {
const ids = []
item.city_ids.map(j => {
j.splice(0, 1)
ids.push(j[0])
})
item.city_id = ids
})
return idBox
},
changeOne(idBox) {
const city_ids = []
idBox.map(item => {
item.splice(0, 1)
city_ids.push(item[0])
})
return city_ids
},
onsubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const param = {
appoint: this.ruleForm.appoint,
name: this.ruleForm.name,
sort: this.ruleForm.sort,
type: this.ruleForm.type,
// 配送区域及运费
shippingTemplatesRegionRequestList: [],
// 指定包邮设置
shippingTemplatesFreeRequestList: []
}
console.log(this.ruleForm.region)
this.ruleForm.region.forEach((el, index) => {
console.log(el)
el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
for (var i = 0; i < el.city_ids.length; i++) {
el.city_ids[i].shift()
}
el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
})
param.shippingTemplatesRegionRequestList = this.ruleForm.region
param.shippingTemplatesRegionRequestList.forEach((el, index) => {
// delete el.city_ids
// delete el.city_id
})
if (this.ruleForm.appoint) {
this.ruleForm.free.forEach((el, index) => {
el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
for (var i = 0; i < el.city_ids.length; i++) {
el.city_ids[i].shift()
}
el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
})
param.shippingTemplatesFreeRequestList = this.ruleForm.free
param.shippingTemplatesFreeRequestList.forEach((el, index) => {
// delete el.city_ids
// delete el.city_id
})
}
if (this.type === 0) {
logistics.shippingSave(param).then(res => {
this.$message.success('操作成功')
this.$nextTick(() => {
this.dialogVisible = false
this.$refs[formName].resetFields()
})
setTimeout(() => {
this.$emit('getList')
console.log(this.$refs, 'this.$refs[formName]')
}, 600)
})
} else {
logistics.shippingUpdate(param, { id: this.tempId }).then(res => {
this.$message.success('操作成功')
setTimeout(() => {
this.$emit('getList')
// this.$refs[formName].resetFields()
// this.clear()
}, 600)
this.$nextTick(() => {
this.dialogVisible = false
this.$refs[formName].resetFields()
})
})
}
} else {
return false
}
})
}
}
}
</script>
<style scoped lang="scss">
.withs{
width: 50%;
}
.noBox{
/deep/.el-form-item__content{
margin-left: 0 !important;
}
}
.tempBox{
/deep/.el-input-number--mini{
width: 100px !important;
}
}
</style>

View File

@@ -0,0 +1,190 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form ref="form" inline :model="form">
<el-form-item label="搜索:">
<el-input v-model="form.name" placeholder="请输入内容" class="selWidth" size="small">
<el-button slot="append" icon="el-icon-search" @click="handleSearch" />
</el-input>
</el-form-item>
</el-form>
</div>
<el-button type="primary" size="mini" @click="handleSubmit()">添加运费模板</el-button>
</div>
<el-table
v-loading="loading"
:data="tableData.list"
style="width: 100%"
size="mini"
>
<el-table-column
prop="id"
label="ID"
min-width="60"
/>
<el-table-column
label="模板名称"
min-width="150"
prop="name"
/>
<el-table-column
min-width="100"
label="计费方式"
prop="type"
>
<template slot-scope="{row}">
<p>{{ row.type | typeFilter }}</p>
</template>
</el-table-column>
<el-table-column
min-width="100"
label="指定包邮"
prop="appoint"
>
<template slot-scope="{row}">
<p>{{ row.appoint | statusFilter }}</p>
</template>
</el-table-column>
<el-table-column
min-width="120"
label="指定区域不配送"
prop="type"
/>
<el-table-column
label="排序"
min-width="100"
prop="sort"
/>
<el-table-column
label="添加时间"
min-width="150"
prop="createTime"
/>
<el-table-column
prop="address"
fixed="right"
width="120"
label="操作"
>
<template slot-scope="scope">
<el-button type="text" size="small" @click="bindEdit(scope.row)">修改</el-button>
<el-button type="text" size="small" @click="bindDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block-pagination">
<el-pagination
:page-sizes="[12, 20, 40, 60]"
:page-size="tableData.limit"
:current-page="tableData.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@current-change="pageChange"
@size-change="handleSizeChange"
/>
</div>
</el-card>
<CreatTemplates ref="addTemplates" @getList="getList" />
</div>
</template>
<script>
import CreatTemplates from './creatTemplates'
import * as logistics from '@/api/logistics.js'
export default {
name: 'ShippingTemplates',
filters: {
statusFilter(status) {
const statusMap = {
true: '开启',
false: '关闭'
}
return statusMap[status]
},
typeFilter(status) {
const statusMap = {
1: '按件数',
2: '按重量',
3: '按体积'
}
return statusMap[status]
}
},
components: { CreatTemplates },
data() {
return {
dialogVisible: false,
form: {
name: ''
},
tableData: '',
page: 1,
limit: 12,
loading: false
}
},
created() {
this.getDataList()
},
methods: {
// 添加
handleSubmit() {
this.$refs.addTemplates.dialogVisible = true
this.$refs.addTemplates.getCityList()
this.$refs.addTemplates.changType(0, this.te)
},
handleSearch() {
this.getDataList()
},
// 分页
pageChange(e) {
this.page = e
this.getDataList()
},
handleSizeChange(e) {
this.limit = e
this.getDataList()
},
// 数据列表
getDataList() {
this.loading = true
logistics.shippingTemplatesList({
name: this.form.name,
page: this.page,
limit: this.limit
}).then(res => {
this.loading = false
this.tableData = res
})
},
// 编辑
bindEdit(item) {
// this.$refs.addTemplates.dialogVisible = true
this.$refs.addTemplates.getCityList()
this.$refs.addTemplates.getInfo(item.id, item.appoint)
this.$refs.addTemplates.changType(1)
},
// 删除
bindDelete(item) {
this.$modalSure().then(() => {
logistics.shippingDetete({ id: item.id }).then(res => {
this.$message.success('删除成功')
this.getDataList()
})
})
// logistics.shippingDetete()
},
getList() {
this.getDataList()
}
}
}
</script>
<style scoped lang="scss">
.selWidth{
width: 350px;
}
</style>

View File

@@ -0,0 +1,254 @@
<template>
<div class="divBox">
<el-card class="box-card">
{{activeNamel1}}
<el-tabs v-model="activeNamel1" @tab-click="handleTabClick">
<el-tab-pane
v-for="tab,index in treeList"
:key="index"
:label="tab.name"
:name="tab.extra"
>
<!-- 文件上传特殊处理-->
<template v-if="activeNamel1 == 4">
<el-radio-group v-model="activeNamel2" class="mb10">
<el-radio v-for="tabItem,itemIndex in tab.child"
:key="itemIndex"
:label="tabItem.name" @change="()=>handleItemTabClick(tabItem.extra)">{{tabItem.name}}</el-radio>
</el-radio-group>
<parser
v-if="formConfChild.render"
:is-edit="formConfChild.isEdit"
:form-conf="formConfChild.content"
:form-edit-data="currentEditData"
@submit="handlerSubmit"
/>
</template>
<!-- 正常配置渲染-->
<template v-else>
{{activeNamel2}}
<el-tabs v-if="tab.child.length > 0" v-model="activeNamel2"
type="border-card" @tab-click="handleItemTabClick">
<el-tab-pane
v-for="tabItem,itemIndex in tab.child"
:key="itemIndex"
:label="tabItem.name"
:name="tabItem.extra"
>
<parser
v-if="formConfChild.render"
:is-edit="formConfChild.isEdit"
:form-conf="formConfChild.content"
:form-edit-data="currentEditData"
@submit="handlerSubmit"
/>
</el-tab-pane>
</el-tabs>
<span v-else>
<parser
v-if="formConf.render"
:is-edit="formConf.isEdit"
:form-conf="formConf.content"
:form-edit-data="currentEditData"
@submit="handlerSubmit"
/>
</span>
</template>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
import parser from '@/components/FormGenerator/components/parser/Parser'
import * as constants from '@/utils/constants.js'
import * as categoryApi from '@/api/categoryApi.js'
import * as selfUtil from '@/utils/ZBKJIutil.js'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import * as systemSettingApi from '@/api/systemSetting.js'
import * as systemConfigApi from '@/api/systemConfig.js'
import Template from "@/views/appSetting/wxAccount/wxTemplate/index";
import {beautifierConf} from "@/components/FormGenerator/utils";
export default {
// name: "index",
components: {Template, parser },
data() {
return {
formConf: { content: { fields: [] }, id: null, render: false, isEdit: false },
formConfChild: { content: { fields: [] }, id: null, render: false, isEdit: false },
activeNamel1: null,
activeNamel2: '本地(不推荐)',//针对文件特殊处理
treeList: [],
editDataChild: {},
isCreate: 0,
currentEditId: null,
currentEditData: null,
currentSelectedUploadFlag:null,
}
},
mounted() {
console.log(this.$route.path.split("/")[1])
this.handlerGetTreeList()
this.getCurrentUploadSelectedFlag()
},
methods: {
handleTabClick(tab, event) {
console.log(tab)
if (tab.name) {
this.handlerGetLevel1FormConfig(tab.name)
} else if (tab.$children.length > 0 ) { // 初次加载第二层的第一个Tab数据
// if(tab.$children[0].panes){ // todo 优化。。。
// this.activeNamel2 = tab.$children[0].panes[0].name
// }else{
// conaole.log()
// }
let _selected = tab.$children[0].panes[0]
// 设置特殊处理的文件长传表单默认选中第一个tab
this.activeNamel2 = _selected.name != 72 ? _selected.name : _selected.label
console.log(this.activeNamel2)
if(this.activeNamel2 == 108){
switch (this.currentSelectedUploadFlag) {
case 1:
this.activeNamel2 = '本地(不推荐)'
this.handlerGetLevel2FormConfig(108)
break
case 2:
this.activeNamel2 = '阿里云配置'
this.handlerGetLevel2FormConfig(81)
break
case 3:
this.activeNamel2 = '七牛云配置'
this.handlerGetLevel2FormConfig(82)
break
case 4:
this.activeNamel2 = '腾讯云配置'
this.handlerGetLevel2FormConfig(83)
break
}
}else{
this.handlerGetLevel2FormConfig(_selected.name)
}
}
},
handlerGetLevel1FormConfig(id) {
const formPram = { id: id }
this.currentEditId = id
this.formConf.content = { fields: [] }
this.formConf.render = false
systemFormConfigApi.getFormConfigInfo(formPram).then(data => {
const { id, name, info, content } = data
this.formConf.content = JSON.parse(content)
this.formConf.id = id
this.handlerGetSettingInfo(id, 1)
})
},
handleItemTabClick(tab, event) { //这里对tabs=tab.name和radio=id做了兼容
let _id = tab.name ? tab.name : tab
if(!_id) return this.$message.error('表单配置不正确,请关联正确表单后使用')
this.handlerGetLevel2FormConfig(_id)
},
handlerGetLevel2FormConfig(id) {
const formPram = { id: id }
this.currentEditId = id
this.formConfChild.content = { fields: [] }
this.formConfChild.render = false
systemFormConfigApi.getFormConfigInfo(formPram).then(data => {
const { id, name, info, content } = data
this.formConfChild.content = JSON.parse(content)
this.formConfChild.id = id
this.handlerGetSettingInfo(id, 2)
})
},
handlerGetSettingInfo(id, level) {
systemSettingApi.systemConfigInfo({ id: id }).then(data => {
this.currentEditData = data
if (level === 1) {
this.formConf.isEdit = this.currentEditData !== null
this.formConf.render = true
} else {
this.formConfChild.isEdit = this.currentEditData !== null
this.formConfChild.render = true
}
})
},
handlerSubmit(formValue) {
this.handlerSave(formValue)
},
handlerSave(formValue) {
const _pram = this.buildFormPram(formValue)
let _formId = 0
systemSettingApi.systemConfigSave(_pram).then(data => {
this.$message.success('添加数据成功')
// 81 82 83
// 针对云存储配置特殊处理 切勿随意改动
_formId = parseInt(_pram.id)
if(_formId === 108 || _formId === 81 || _formId === 82 || _formId === 83){
let _value
switch (_formId) {
case 108: _value = 1
break;
case 81: _value = 2
break;
case 82: _value = 3
break;
case 83: _value = 4
break;
}
const _pram = { key:"uploadType",value:_value }
systemConfigApi.configSaveUniq(_pram)
}
})
},
handlerGetTreeList() {
const _pram = { type: constants.categoryType[5].value, status: -1 }
categoryApi.treeCategroy(_pram).then(data => {
this.treeList = this.handleAddArrt(data)
if (this.treeList.length > 0) this.activeNamel1 = this.treeList[0].extra
if (this.treeList.length > 0 && this.treeList[0].child.length > 0) {
this.activeNamel2 = this.treeList[0].child[0].extra
}
if (this.activeNamel2) {
this.handlerGetLevel2FormConfig(this.treeList[0].child[0].extra)
} else {
this.handlerGetLevel1FormConfig(this.treeList[0].extra)
}
})
},
handleAddArrt(treeData) {
// let _result = this.addTreeListLabel(treeData)
const _result = selfUtil.addTreeListLabel(treeData)
console.log(_result)
return _result
},
buildFormPram(formValue) {
const _pram = {
fields: [],
id: this.currentEditId,
sort: 0, // 参数暂时无用
status: true // 参数暂时无用
}
const _fields = []
Object.keys(formValue).forEach((key) => {
_fields.push({
name: key,
title: key,
value: formValue[key] || '1111'
})
})
_pram.fields = _fields
return _pram
},
getCurrentUploadSelectedFlag(){
systemConfigApi.configGetUniq({key:"uploadType"}).then(data => {
this.currentSelectedUploadFlag = parseInt(data)
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,254 @@
<template>
<div class="divBox">
<el-card class="box-card">
{{activeNamel1}}
<el-tabs v-model="activeNamel1" @tab-click="handleTabClick">
<el-tab-pane
v-for="tab,index in treeList"
:key="index"
:label="tab.name"
:name="tab.extra"
>
<!-- 文件上传特殊处理-->
<template v-if="activeNamel1 == 4">
<el-radio-group v-model="activeNamel2" class="mb10">
<el-radio v-for="tabItem,itemIndex in tab.child"
:key="itemIndex"
:label="tabItem.name" @change="()=>handleItemTabClick(tabItem.extra)">{{tabItem.name}}</el-radio>
</el-radio-group>
<parser
v-if="formConfChild.render"
:is-edit="formConfChild.isEdit"
:form-conf="formConfChild.content"
:form-edit-data="currentEditData"
@submit="handlerSubmit"
/>
</template>
<!-- 正常配置渲染-->
<template v-else>
{{activeNamel2}}
<el-tabs v-if="tab.child.length > 0" v-model="activeNamel2"
type="border-card" @tab-click="handleItemTabClick">
<el-tab-pane
v-for="tabItem,itemIndex in tab.child"
:key="itemIndex"
:label="tabItem.name"
:name="tabItem.extra"
>
<parser
v-if="formConfChild.render"
:is-edit="formConfChild.isEdit"
:form-conf="formConfChild.content"
:form-edit-data="currentEditData"
@submit="handlerSubmit"
/>
</el-tab-pane>
</el-tabs>
<span v-else>
<parser
v-if="formConf.render"
:is-edit="formConf.isEdit"
:form-conf="formConf.content"
:form-edit-data="currentEditData"
@submit="handlerSubmit"
/>
</span>
</template>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
import parser from '@/components/FormGenerator/components/parser/Parser'
import * as constants from '@/utils/constants.js'
import * as categoryApi from '@/api/categoryApi.js'
import * as selfUtil from '@/utils/ZBKJIutil.js'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import * as systemSettingApi from '@/api/systemSetting.js'
import * as systemConfigApi from '@/api/systemConfig.js'
import Template from "@/views/appSetting/wxAccount/wxTemplate/index";
import {beautifierConf} from "@/components/FormGenerator/utils";
export default {
// name: "index",
components: {Template, parser },
data() {
return {
formConf: { content: { fields: [] }, id: null, render: false, isEdit: false },
formConfChild: { content: { fields: [] }, id: null, render: false, isEdit: false },
activeNamel1: null,
activeNamel2: '本地(不推荐)',//针对文件特殊处理
treeList: [],
editDataChild: {},
isCreate: 0,
currentEditId: null,
currentEditData: null,
currentSelectedUploadFlag:null,
}
},
mounted() {
console.log(this.$route.path.split("/")[1])
this.handlerGetTreeList()
this.getCurrentUploadSelectedFlag()
},
methods: {
handleTabClick(tab, event) {
console.log(tab)
if (tab.name) {
this.handlerGetLevel1FormConfig(tab.name)
} else if (tab.$children.length > 0 ) { // 初次加载第二层的第一个Tab数据
// if(tab.$children[0].panes){ // todo 优化。。。
// this.activeNamel2 = tab.$children[0].panes[0].name
// }else{
// conaole.log()
// }
let _selected = tab.$children[0].panes[0]
// 设置特殊处理的文件长传表单默认选中第一个tab
this.activeNamel2 = _selected.name != 72 ? _selected.name : _selected.label
console.log(this.activeNamel2)
if(this.activeNamel2 == 108){
switch (this.currentSelectedUploadFlag) {
case 1:
this.activeNamel2 = '本地(不推荐)'
this.handlerGetLevel2FormConfig(108)
break
case 2:
this.activeNamel2 = '阿里云配置'
this.handlerGetLevel2FormConfig(81)
break
case 3:
this.activeNamel2 = '七牛云配置'
this.handlerGetLevel2FormConfig(82)
break
case 4:
this.activeNamel2 = '腾讯云配置'
this.handlerGetLevel2FormConfig(83)
break
}
}else{
this.handlerGetLevel2FormConfig(_selected.name)
}
}
},
handlerGetLevel1FormConfig(id) {
const formPram = { id: id }
this.currentEditId = id
this.formConf.content = { fields: [] }
this.formConf.render = false
systemFormConfigApi.getFormConfigInfo(formPram).then(data => {
const { id, name, info, content } = data
this.formConf.content = JSON.parse(content)
this.formConf.id = id
this.handlerGetSettingInfo(id, 1)
})
},
handleItemTabClick(tab, event) { //这里对tabs=tab.name和radio=id做了兼容
let _id = tab.name ? tab.name : tab
if(!_id) return this.$message.error('表单配置不正确,请关联正确表单后使用')
this.handlerGetLevel2FormConfig(_id)
},
handlerGetLevel2FormConfig(id) {
const formPram = { id: id }
this.currentEditId = id
this.formConfChild.content = { fields: [] }
this.formConfChild.render = false
systemFormConfigApi.getFormConfigInfo(formPram).then(data => {
const { id, name, info, content } = data
this.formConfChild.content = JSON.parse(content)
this.formConfChild.id = id
this.handlerGetSettingInfo(id, 2)
})
},
handlerGetSettingInfo(id, level) {
systemSettingApi.systemConfigInfo({ id: id }).then(data => {
this.currentEditData = data
if (level === 1) {
this.formConf.isEdit = this.currentEditData !== null
this.formConf.render = true
} else {
this.formConfChild.isEdit = this.currentEditData !== null
this.formConfChild.render = true
}
})
},
handlerSubmit(formValue) {
this.handlerSave(formValue)
},
handlerSave(formValue) {
const _pram = this.buildFormPram(formValue)
let _formId = 0
systemSettingApi.systemConfigSave(_pram).then(data => {
this.$message.success('添加数据成功')
// 81 82 83
// 针对云存储配置特殊处理 切勿随意改动
_formId = parseInt(_pram.id)
if(_formId === 108 || _formId === 81 || _formId === 82 || _formId === 83){
let _value
switch (_formId) {
case 108: _value = 1
break;
case 81: _value = 2
break;
case 82: _value = 3
break;
case 83: _value = 4
break;
}
const _pram = { key:"uploadType",value:_value }
systemConfigApi.configSaveUniq(_pram)
}
})
},
handlerGetTreeList() {
const _pram = { type: constants.categoryType[5].value, status: -1 }
categoryApi.treeCategroy(_pram).then(data => {
this.treeList = this.handleAddArrt(data)
if (this.treeList.length > 0) this.activeNamel1 = this.treeList[0].extra
if (this.treeList.length > 0 && this.treeList[0].child.length > 0) {
this.activeNamel2 = this.treeList[0].child[0].extra
}
if (this.activeNamel2) {
this.handlerGetLevel2FormConfig(this.treeList[0].child[0].extra)
} else {
this.handlerGetLevel1FormConfig(this.treeList[0].extra)
}
})
},
handleAddArrt(treeData) {
// let _result = this.addTreeListLabel(treeData)
const _result = selfUtil.addTreeListLabel(treeData)
console.log(_result)
return _result
},
buildFormPram(formValue) {
const _pram = {
fields: [],
id: this.currentEditId,
sort: 0, // 参数暂时无用
status: true // 参数暂时无用
}
const _fields = []
Object.keys(formValue).forEach((key) => {
_fields.push({
name: key,
title: key,
value: formValue[key] || '1111'
})
})
_pram.fields = _fields
return _pram
},
getCurrentUploadSelectedFlag(){
systemConfigApi.configGetUniq({key:"uploadType"}).then(data => {
this.currentSelectedUploadFlag = parseInt(data)
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,194 @@
<template>
<el-dialog v-model="dialogFormVisible" :title="id?'修改核销员':'添加核销员'" :visible.sync="dialogFormVisible" width="750px" @close="cancel">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm">
<el-form-item label="商城用户:" prop="avatar">
<div class="publicPicBox" @click="upImg">
{{ruleForm.avatar}}
<div class="pictrue" v-if="ruleForm.avatar">
<el-image
:src="ruleForm.avatar"
fit="cover"></el-image>
</div>
<div class="upLoad acea-row row-center-wrapper" v-else>
<i class="el-icon-camera iconfont"></i>
</div>
</div>
</el-form-item>
<el-form-item label="所属提货点:" prop="storeId">
<el-select v-model="ruleForm.storeId" placeholder="请选择" style="width:50%" clearable>
<el-option
v-for="item in storeSelectList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="核销员名称:">
<el-input v-model="ruleForm.staffName" placeholder="请输入提货点简介" class="dialogWidth"></el-input>
</el-form-item>
<el-form-item label="手机号码:">
<el-input v-model="ruleForm.phone" placeholder="请输入提货点简介" class="dialogWidth"></el-input>
</el-form-item>
<el-form-item label="核销开关:">
<el-radio-group v-model="ruleForm.verifyStatus">
<el-radio :label="1">开启</el-radio>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="状态:">
<el-radio-group v-model="ruleForm.status">
<el-radio :label="1">开启</el-radio>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="editForm('ruleForm')" v-if="id">修改</el-button>
<el-button type="primary" @click="submitForm('ruleForm')" v-else>提交</el-button>
</div>
<customer-info ref="customer" @upImgUid="upImgUid"></customer-info>
</el-dialog>
</template>
<script>
import customerInfo from '@/components/customerInfo';
import { storeStaffSaveApi, storeStaffUpdateApi, storeStaffInfoApi, storeListApi } from '@/api/storePoint';
export default {
name: "addClerk",
components: { customerInfo },
props: {
storeSelectList: Array
},
data(){
const validateUpload = (rule, value, callback) => {
if (!this.ruleForm.avatar) {
callback(new Error('请上传商城用户图片'))
} else {
callback()
}
};
return{
dialogFormVisible: false,
id:0,
ruleForm:{
avatar:'',
phone:'',
staffName:'',
status:1,
storeId:'',
verifyStatus:1,
uid:''
},
rules: {
avatar: [
{ required: true, validator: validateUpload, trigger: 'change' }
],
storeId: [
{ required: true, message: '请选择提货点地址', trigger: 'change' }
]
}
}
},
created(){
},
mounted(){
},
methods:{
//接收来自子集的值;
upImgUid(id,img){
this.ruleForm.avatar = img;
this.ruleForm.uid = id;
},
upImg(){
this.$refs.customer.dialogFormVisible = true;
this.$refs.customer.tableList();
},
//详情
getInfo (id) {
let that = this;
that.id = id;
storeStaffInfoApi({id:id}).then(res=>{
that.ruleForm = res;
}).catch(res=>{
this.$message.error(res.message);
})
},
//取消
cancel(){
this.dialogFormVisible = false;
this.clearFrom();
this.resetForm('ruleForm');
this.id = 0
},
//数据归为初始状态
clearFrom(){
this.ruleForm.phone = '';
this.ruleForm.staffName = '';
this.ruleForm.status = 1;
this.ruleForm.verifyStatus = 1;
},
//重置
resetForm (name) {
this.$refs[name].resetFields();
},
// 提交
submitForm (name) {
this.$refs[name].validate((valid) => {
if (valid) {
let phone = this.ruleForm.phone;
if(phone){
if(!/^1[3456789]\d{9}$/.test(phone)){
return this.$message.error('手机号格式不正确');
}
}
storeStaffSaveApi(this.ruleForm).then(async () => {
this.$message.success('提交成功');
this.dialogFormVisible = false;
this.$emit("tableList");
this.clearFrom();
this.resetForm(name);
this.id = 0;
}).catch(res => {
this.$message.error(res.message);
})
} else {
return false;
}
})
},
// 编辑
editForm(name){
this.$refs[name].validate((valid) => {
if (valid) {
let phone = this.ruleForm.phone;
if(phone){
if(!/^1[3456789]\d{9}$/.test(phone)){
return this.$message.error('手机号格式不正确');
}
}
storeStaffUpdateApi(this.ruleForm).then(async () => {
this.$message.success('编辑成功');
this.dialogFormVisible = false;
this.$emit("tableList");
this.clearFrom();
this.resetForm(name);
this.id = 0;
}).catch(res => {
this.$message.error(res.message);
})
} else {
return false;
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,205 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form ref="form" inline :model="artFrom" size="small">
<el-form-item label="提货点名称:">
<el-select v-model="artFrom.storeId" placeholder="请选择" class="selWidth" clearable @change="search">
<el-option
v-for="item in storeSelectList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<el-button type="primary" size="small" @click="add">添加核销员</el-button>
</div>
<el-table
v-loading="loading"
:data="tableData"
size="mini"
style="width: 100%">
<el-table-column
prop="id"
label="ID"
sortable
width="80">
</el-table-column>
<!--<el-table-column-->
<!--prop="nickname"-->
<!--label="微信名称"-->
<!--min-width="150">-->
<!--</el-table-column>-->
<el-table-column
prop="avatar"
label="头像"
min-width="100">
<template slot-scope="{ row, index }" class="picMiddle">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="row.avatar"
:preview-src-list="[row.avatar]"
/>
</div>
</template>
</el-table-column>
<el-table-column
prop="staffName"
label="核销员名称"
min-width="150">
</el-table-column>
<el-table-column
prop="systemStore.detailedAddress"
label="所属提货点"
min-width="150">
</el-table-column>
<el-table-column
prop="createTime"
label="添加时间"
min-width="180">
</el-table-column>
<el-table-column
prop="status"
label="状态"
min-width="100">
<template slot-scope="{ row, index }">
<el-switch
v-model="row.status"
:active-value="1"
:inactive-value="0"
active-text="显示"
inactive-text="隐藏"
@change="onchangeIsShow(row.id,row.status)">
</el-switch>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
min-width="120">
<template slot-scope="{ row, index }">
<el-button type="text" size="small" @click="edit(row.id)">编辑</el-button>
<!--<el-divider direction="vertical"></el-divider>-->
<el-button type="text" size="small" @click="storeDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
class="mt20"
@size-change="sizeChange"
@current-change="pageChange"
:current-page="artFrom.page"
:page-sizes="[20, 40, 60, 100]"
:page-size="artFrom.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
<add-clerk-list ref="template" @tableList="tableList" :storeSelectList="storeSelectList"></add-clerk-list>
</el-card>
</div>
</template>
<script>
import addClerkList from './addClerk';
import { storeStaffListApi, storeListApi, storeStaffDeleteApi, storeStaffUpdateStatusApi } from '@/api/storePoint';
export default {
name: 'clerkList',
components: { addClerkList },
data () {
return{
storeSelectList:[],
artFrom: {
page: 1,
limit: 20,
storeId: ''
},
loading: false,
tableData:[],
total:0
}
},
created () {
this.tableList();
this.storeList();
},
methods: {
//是否显示
onchangeIsShow(id, isShow){
let that = this;
storeStaffUpdateStatusApi({id:id,status:isShow}).then(() => {
that.$message.success("操作成功");
that.tableList();
}).catch(res=>{
that.$message.error(res.message);
})
},
storeList() {
let artFrom = {
page: 1,
limit: 9999,
status: '1',
keywords: ''
};
storeListApi(artFrom).then(res=>{
this.storeSelectList = res.list;
})
},
tableList(){
let that = this;
that.loading = true;
storeStaffListApi (that.artFrom).then(res=>{
that.loading = false;
that.tableData = res.list;
that.total = res.total;
}).catch(res => {
that.$message.error(res.message);
})
},
//切换页数
pageChange(index){
this.artFrom.page = index;
this.tableList();
},
//切换显示条数
sizeChange(index){
this.artFrom.limit = index;
this.tableList();
},
//搜索
search(){
this.artFrom.page = 1;
this.tableList();
},
//刪除
storeDelete(id){
let that = this;
that.$modalSure().then(() => {
storeStaffDeleteApi({ id: id }).then(() => {
that.$message.success('删除成功');
that.tableList();
})
}).catch(res=>{
that.$message.error(res.message);
})
},
//添加
add() {
this.$refs.template.dialogFormVisible = true;
},
//编辑
edit(id) {
this.$refs.template.dialogFormVisible = true;
this.$refs.template.getInfo(id);
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,252 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form size="small" label-width="100px">
<el-form-item label="时间选择:" class="width100">
<el-radio-group v-model="tableFrom.dateLimit" type="button" class="mr20" size="small" @change="selectChange(tableFrom.dateLimit)">
<el-radio-button v-for="(item,i) in fromList.fromTxt" :key="i" :label="item.val">{{ item.text }}</el-radio-button>
</el-radio-group>
<el-date-picker v-model="timeVal" value-format="yyyy/MM/dd" format="yyyy/MM/dd" size="small" type="daterange" placement="bottom-end" placeholder="自定义时间" style="width: 250px;" @change="onchangeTime" />
</el-form-item>
<el-form-item label="选择门店:">
<el-select v-model="tableFrom.storeId" clearable filterable placeholder="请选择" class="selWidth" clearable @change="seachList">
<el-option
v-for="item in storeSelectList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="关键字:" class="width100">
<el-input v-model="tableFrom.keywords" placeholder="请输入姓名、电话、订单ID" class="selWidth" size="small">
<el-button slot="append" icon="el-icon-search" size="small" @click="seachList" />
</el-input>
</el-form-item>
</el-form>
</div>
<cards-data :card-lists="cardLists" />
</div>
<el-table
v-loading="listLoading"
:data="tableData.data"
style="width: 100%"
size="mini"
class="table"
highlight-current-row
>
<el-table-column
label="订单号"
prop="orderId"
min-width="170"
/>
<el-table-column
prop="realName"
label="用户信息"
min-width="130"
/>
<el-table-column
label="推荐人信息"
min-width="150"
>
<template slot-scope="scope">
<span>{{ scope.row.spreadInfo.name }}</span>
</template>
</el-table-column>
<el-table-column
label="商品信息"
min-width="330"
>
<!--<template slot-scope="scope">-->
<!--<div v-for="(val, i ) in scope.row.productList" :key="i" class="tabBox acea-row row-middle">-->
<!--<div class="demo-image__preview">-->
<!--<el-image-->
<!--:src="val.info.productInfo.image"-->
<!--:preview-src-list="[val.info.productInfo.image]"-->
<!--/>-->
<!--</div>-->
<!--<span class="tabBox_tit">{{ val.info.productInfo.storeName + ' | ' }}{{ val.info.productInfo.attrInfo.sku }}</span>-->
<!--<span class="tabBox_pice">{{ '¥'+ val.info.productInfo.price + ' x '+ val.info }}</span>-->
<!--</div>-->
<!--</template>-->
</el-table-column>
<el-table-column
prop="payPrice"
label="实际支付"
min-width="100"
/>
<el-table-column
prop="clerkName"
label="核销员"
min-width="100"
/>
<el-table-column
prop="storeName"
label="核销门店"
min-width="100"
/>
<el-table-column
label="支付状态"
min-width="80"
>
<template slot-scope="scope">
<span>{{ scope.row.paid | paidFilter }}</span>
</template>
</el-table-column>
<el-table-column
label="订单状态"
min-width="100"
>
<template slot-scope="scope">
<span>{{ scope.row.status | orderStatusFilter }}</span>
</template>
</el-table-column>
<el-table-column
prop="createTime"
label="下单时间"
min-width="100"
/>
</el-table>
<div class="block">
<el-pagination
:page-sizes="[20, 40, 60, 80]"
:page-size="tableFrom.limit"
:current-page="tableFrom.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@size-change="handleSizeChange"
@current-change="pageChange"
/>
</div>
</el-card>
</div>
</template>
<script>
import { orderListApi, storeListApi } from '@/api/storePoint'
import cardsData from '@/components/cards/index'
import { fromList } from '@/utils/constants.js'
export default {
components: { cardsData },
data() {
return {
storeSelectList: [],
orderId: 0,
tableData: {
data: [],
total: 0
},
listLoading: true,
tableFrom: {
keywords: '',
storeId: '',
dateLimit: '',
page: 1,
limit: 20
},
timeVal: [],
fromList: fromList,
ids: '',
cardLists: [],
}
},
mounted() {
this.storeList()
this.getList()
},
methods: {
seachList() {
this.tableFrom.page = 1
this.getList()
},
storeList() {
let artFrom = {
page: 1,
limit: 999,
status: '1',
keywords: ''
};
storeListApi(artFrom).then(res=>{
this.storeSelectList = res.list;
})
},
pageChangeLog(page) {
this.tableFromLog.page = page
this.getList()
},
handleSizeChangeLog(val) {
this.tableFromLog.limit = val
this.getList()
},
// 选择时间
selectChange(tab) {
this.tableFrom.date = tab
this.tableFrom.page = 1
this.timeVal = []
this.getList()
},
// 具体日期
onchangeTime(e) {
this.timeVal = e
this.tableFrom.dateLimit = e ? this.timeVal.join('-') : ''
this.tableFrom.page = 1
this.getList()
},
// 列表
getList() {
this.listLoading = true
orderListApi(this.tableFrom).then(res => {
this.tableData.data = res.list.list
this.tableData.total = res.list.total
this.cardLists = [
{ name: '订单数量', count: res.total },
{ name: '订单金额', count: res.orderTotalPrice },
{ name: '退款总单数', count: res.refundTotal },
{ name: '退款总金额', count: res.refundTotalPrice }
]
this.cardLists = res.data.stat
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
pageChange(page) {
this.tableFrom.page = page
this.getList()
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList()
}
}
}
</script>
<style lang="scss" scoped>
.demo-table-expand{
/deep/ label{
width: 83px !important;
}
}
.selWidth{
width: 350px;
}
.el-dropdown-link {
cursor: pointer;
color: #409EFF;
font-size: 12px;
}
.el-icon-arrow-down {
font-size: 12px;
}
.tabBox_tit {
width: 60%;
font-size: 12px !important;
margin: 0 2px 0 10px;
letter-spacing: 1px;
padding: 5px 0;
box-sizing: border-box;
}
</style>

View File

@@ -0,0 +1,284 @@
<template>
<el-dialog v-model="dialogFormVisible" :title="id?'修改提货点':'添加提货点'" :visible.sync="dialogFormVisible" width="750px" @close="cancel">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm">
<el-form-item label="提货点名称:" prop="name">
<el-input v-model="ruleForm.name" placeholder="请输入提货点名称" class="dialogWidth"></el-input>
</el-form-item>
<el-form-item label="提货点简介:">
<el-input v-model="ruleForm.introduction" placeholder="请输入提货点简介" class="dialogWidth"></el-input>
</el-form-item>
<el-form-item label="提货点手机号:" prop="phone">
<el-input v-model="ruleForm.phone" placeholder="请输入提货点手机号" class="dialogWidth"></el-input>
</el-form-item>
<el-form-item label="提货点地址:" prop="address">
<el-cascader
class="cascaderW"
clearable
v-model="ruleForm.address"
:options="addresData"
:props="{ value: 'label' }"
@change="handleChange"></el-cascader>
</el-form-item>
<el-form-item label="详细地址:" prop="detailedAddress">
<el-input v-model="ruleForm.detailedAddress" placeholder="请输入详细地址" class="dialogWidth"></el-input>
</el-form-item>
<el-form-item label="提货点营业:">
<el-time-picker
is-range
v-model="dayTime"
range-separator=""
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="请选择时间营业时间"
value-format="HH:mm:ss"
@change="onchangeTime">
</el-time-picker>
</el-form-item>
<!-- prop="image"-->
<el-form-item label="提货点logo">
<div class="upLoadPicBox" @click="modalPicTap('1')">
<div class="pictrue" v-if="ruleForm.image"><img :src="ruleForm.image"></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</el-form-item>
<el-form-item label="经纬度:" prop="latitude">
<el-tooltip content="请点击查找位置选择位置">
<el-input v-model="ruleForm.latitude" placeholder="请查找位置" class="dialogWidth">
<el-button slot="append" @click="onSearch">查找位置</el-button>
</el-input>
</el-tooltip>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="editForm('ruleForm')" v-if="id">修改</el-button>
<el-button type="primary" @click="submitForm('ruleForm')" v-else>提交</el-button>
</div>
<el-dialog v-model="modalMap" title='上传经纬度' :visible.sync="modalMap" append-to-body class="mapBox" width="500px">
<iframe
id="mapPage" width="100%" height="100%" frameborder=0
v-bind:src="keyUrl"
></iframe>
</el-dialog>
</el-dialog>
</template>
<script>
import { storeSaveApi, storeInfoApi, storeUpdateApi } from '@/api/storePoint';
import { cityListTree } from '@/api/logistics';
import { configInfo } from '@/api/systemConfig';
import city from '@/utils/city';
export default {
name: "index",
components: {},
// props: {
// children: 'child',
// label: 'name',
// value: 'name'
// },
data() {
const validatePhone = (rule, value, callback) => {
if (!value) {
return callback(new Error('请填写手机号'));
} else if (!/^1[3456789]\d{9}$/.test(value)) {
callback(new Error('手机号格式不正确!'));
} else {
callback();
}
};
const validateUpload = (rule, value, callback) => {
if (!this.ruleForm.image) {
callback(new Error('请上传提货点logo'))
} else {
callback()
}
};
return {
dialogFormVisible: false,
modalMap: false,
keyUrl: '',
addresData:[],
ruleForm: {
name: '',
introduction: '',
phone: '',
address: '',
detailedAddress: '',
dayTime: '',
image:'http://admin.crmeb.net/uploads/attach/2020/05/20200515/d8dd47952e638c58c25633fa1009db1c.png',
latitude: ''
},
id:0,
dayTime:['',''],
rules: {
name: [
{ required: true, message: '请输入提货点名称', trigger: 'blur' }
],
address: [
{ required: true, message: '请选择提货点地址', trigger: 'change' }
],
dayTime: [
{ required: true, type: 'array', message: '请选择提货点营业时间', trigger: 'change' }
],
phone: [
{ required: true, validator: validatePhone, trigger: 'blur' }
],
detailedAddress: [
{ required: true, message: '请输入详细地址', trigger: 'blur' }
],
image: [
{ required: true, validator: validateUpload, trigger: 'change' }
],
latitude: [
{ required: true, message: '请选择经纬度', trigger: 'blur' }
]
}
}
},
created(){
this.addresData = city;
this.getKey();
},
mounted(){
window.addEventListener('message', function (event) {
// 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息
var loc = event.data;
if (loc && loc.module === 'locationPicker') { // 防止其他应用也会向该页面post信息需判断module是否为'locationPicker'
window.parent.selectAdderss(loc);
}
}, false);
window.selectAdderss = this.selectAdderss;
},
methods:{
//详情
getInfo (id) {
let that = this;
that.id = id;
storeInfoApi({id:id}).then(res=>{
that.ruleForm = res;
that.ruleForm.address = res.address.split(",");
that.dayTime = res.dayTime.split("-")
}).catch(res=>{
this.$message.error(res.message);
})
},
//取消
cancel (){
this.dialogFormVisible = false;
this.clearFrom();
this.resetForm('ruleForm');
this.id = 0
},
//重置
resetForm (name) {
this.$refs[name].resetFields();
},
// 提交
submitForm (name) {
this.$refs[name].validate((valid) => {
if (valid) {
storeSaveApi(this.ruleForm).then(async () => {
this.$message.success('提交成功');
this.dialogFormVisible = false;
this.$parent.tableList();
this.$parent.storeGetCount();
this.clearFrom();
this.resetForm(name);
this.id = 0;
}).catch(res => {
this.$message.error(res.message);
})
} else {
return false;
}
})
},
//编辑
editForm(name){
this.$refs[name].validate((valid) => {
if (valid) {
this.handleChange(this.ruleForm.address);
storeUpdateApi(this.ruleForm,this.id).then(async () => {
this.$message.success('编辑成功');
this.dialogFormVisible = false;
this.$parent.tableList();
this.clearFrom();
this.resetForm(name);
this.id = 0;
}).catch(res => {
this.$message.error(res.message);
})
} else {
return false;
}
})
},
//数据归为初始状态
clearFrom(){
this.ruleForm.introduction = '';
this.dayTime = ['',''];
},
//确认省市区
handleChange(e){
let province = e[0];
let city = e[1];
let area = e[2];
if(e.length===2){
this.ruleForm.address = province + ',' + city;
}else if(e.length===3){
this.ruleForm.address = province + ',' + city + ',' + area;
}
},
//营业时间
onchangeTime(e){
let start = e[0];
let end = e[1];
this.ruleForm.dayTime = start + '-' + end;
},
//上传图片
modalPicTap (tit) {
const _this = this
this.$modalUpload(function(img) {
_this.ruleForm.image = img[0].sattDir
},tit, 'system')
},
//查找位置
onSearch () {
this.modalMap = true;
},
// 选择经纬度
selectAdderss (data) {
this.ruleForm.latitude = data.latlng.lat + ',' + data.latlng.lng;
this.modalMap = false;
},
// key值
getKey () {
const _pram = { id: 74 };
configInfo(_pram).then(async res => {
let keys = res.tengxun_map_key;
this.keyUrl = `https://apis.map.qq.com/tools/locpicker?type=1&key=${keys}&referer=myapp`;
}).catch(res => {
this.$Message.error(res.message);
})
},
}
}
</script>
<style lang="scss">
.el-input-group__append, .el-input-group__prepend{
background-color:#1890ff!important;
color: #fff!important;
border-color:#1890ff!important;
border-radius: 0 4px 4px 0;
}
.cascaderW{
width: 350px;
}
.mapBox .el-dialog__body{
height: 640px !important;
}
</style>

View File

@@ -0,0 +1,207 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-tabs v-model="artFrom.status" @tab-click="onClickTab">
<el-tab-pane :label="'显示中的提货点('+ headerCount.show +')'" name="1"></el-tab-pane>
<el-tab-pane :label="'隐藏中的提货点('+ headerCount.hide +')'" name="0"></el-tab-pane>
<el-tab-pane :label="'回收站的提货点('+ headerCount.recycle +')'" name="2"></el-tab-pane>
</el-tabs>
<el-form ref="form" inline :model="artFrom">
<el-form-item label="关键字:">
<el-input v-model="artFrom.keywords" placeholder="请输入提货点名称/电话" class="selWidth" size="small">
<el-button slot="append" icon="el-icon-search" @click="search" />
</el-input>
</el-form-item>
</el-form>
<el-button type="primary" size="small" @click="add">添加提货点</el-button>
</div>
<el-table
v-loading="loading"
size="mini"
:data="tableData"
style="width: 100%">
<el-table-column
prop="id"
label="ID"
min-width="80">
</el-table-column>
<el-table-column
prop="image"
label="提货点图片"
min-width="100">
<template slot-scope="{ row, index }" class="picMiddle">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="row.image"
:preview-src-list="[row.image]"
/>
</div>
</template>
</el-table-column>
<el-table-column
prop="name"
label="提货点名称"
min-width="150">
</el-table-column>
<el-table-column
prop="phone"
label="提货点电话"
min-width="100">
</el-table-column>
<el-table-column
prop="detailedAddress"
label="地址"
min-width="100">
</el-table-column>
<el-table-column
prop="dayTime"
label="营业时间"
min-width="180">
</el-table-column>
<el-table-column
prop="isShow"
label="是否显示"
min-width="100">
<template slot-scope="{ row, index }">
<el-switch
:active-value="true"
:inactive-value="false"
active-text="显示"
inactive-text="隐藏"
v-model="row.isShow"
@change="onchangeIsShow(row.id,row.isShow)">
</el-switch>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
min-width="120">
<template slot-scope="{ row, index }">
<el-button type="text" size="small" @click="edit(row.id)">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-button type="text" size="small" @click="storeDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
class="mt20"
@size-change="sizeChange"
@current-change="pageChange"
:current-page="artFrom.page"
:page-sizes="[20, 40, 60, 100]"
:page-size="artFrom.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</el-card>
<system-store ref="template"></system-store>
</div>
</template>
<script>
import systemStore from './addPoint';
import { storeListApi, storeGetCountApi, storeUpdateStatusApi, storeDeleteApi } from '@/api/storePoint';
export default {
name: 'Point',
components: { systemStore },
data () {
return{
artFrom: {
page: 1,
limit: 20,
status: '1',
keywords: ''
},
loading: false,
tableData:[],
total:0,
headerCount:{}
}
},
created () {
this.storeGetCount();
this.tableList();
},
methods: {
//头部数量显示;
storeGetCount(){
let that = this;
storeGetCountApi().then(res=>{
that.headerCount = res
})
},
//表格列表
tableList(){
let that = this;
that.loading = true;
storeListApi (that.artFrom).then(res=>{
that.loading = false;
that.tableData = res.list;
that.total = res.total;
}).catch(res => {
that.$message.error(res.message);
})
},
//切换页数
pageChange(index){
this.artFrom.page = index;
this.tableList();
},
//切换显示条数
sizeChange(index){
this.artFrom.limit = index;
this.tableList();
},
//头部切换
onClickTab() {
this.artFrom.keywords = '';
this.tableList();
},
//搜索
search(){
this.artFrom.page = 1;
this.tableList();
},
//是否显示
onchangeIsShow(id, isShow){
let that = this;
storeUpdateStatusApi({id:id,status:isShow}).then(() => {
that.$message.success("操作成功");
that.tableList();
that.storeGetCount();
}).catch(res=>{
that.$message.error(res.message);
})
},
//刪除
storeDelete(id){
let that = this;
that.$modalSure().then(() => {
storeDeleteApi({ id: id }).then(() => {
that.$message.success('删除成功')
that.tableList();
that.storeGetCount();
})
}).catch(res=>{
that.$message.error(res.message);
})
},
//添加
add() {
this.$refs.template.dialogFormVisible = true;
},
//编辑
edit(id) {
this.$refs.template.dialogFormVisible = true;
this.$refs.template.getInfo(id);
}
}
}
</script>
<style scoped lang="scss">
</style>