积分规则管理 特约商户管理 左边菜单栏修改
This commit is contained in:
parent
bbb96ffa94
commit
688a2d9ab1
|
@ -0,0 +1,25 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function list(params) {
|
||||
return request({
|
||||
url: '/api/convenience/fingertipIntegral/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: '/api/convenience/fingertipIntegral',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(params) {
|
||||
return request({
|
||||
url: '/api/convenience/fingertipIntegral',
|
||||
method: 'DELETE',
|
||||
params
|
||||
})
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function speciallyBusinessList(data) {
|
||||
return request({
|
||||
url: '/api/convenience/speciallyBusiness/fixServ/speciallyBusinessList',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function list(data) {
|
||||
return request({
|
||||
url: '/api/convenience/speciallyBusiness/fixServ/list',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function speciallyBusinessSet(data) {
|
||||
return request({
|
||||
url: '/api/convenience/speciallyBusiness/fixServ/speciallyBusinessSet',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
|
@ -1,24 +1,24 @@
|
|||
<script>
|
||||
export default {
|
||||
name: "MenuItem",
|
||||
name: 'MenuItem',
|
||||
functional: true,
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
default: ""
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ""
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
render(h, context) {
|
||||
const { icon, title } = context.props;
|
||||
const vnodes = [];
|
||||
const { icon, title } = context.props
|
||||
const vnodes = []
|
||||
|
||||
if (icon) {
|
||||
if (icon.includes("el-icon")) {
|
||||
vnodes.push(<i class={[icon, "sub-el-icon"]} />);
|
||||
if (icon.includes('el-icon')) {
|
||||
vnodes.push(<i class={[icon, 'sub-el-icon']} />)
|
||||
// icon_menu_statistical
|
||||
} else {
|
||||
vnodes.push(
|
||||
|
@ -28,25 +28,26 @@ export default {
|
|||
// >
|
||||
// <svg-icon icon-class={icon} />
|
||||
// </div>
|
||||
<i class={["icon_menu_" + icon, "icon_menu"]}></i>
|
||||
);
|
||||
<i class={['icon_menu_' + icon, 'icon_menu']}></i>
|
||||
)
|
||||
// vnodes.push(<svg-icon icon-class={icon}/>)
|
||||
}
|
||||
}
|
||||
|
||||
if (title) {
|
||||
vnodes.push(<span slot="title">{title}</span>);
|
||||
vnodes.push(<span slot='title'>{title}</span>)
|
||||
}
|
||||
return vnodes;
|
||||
return vnodes
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.icon_menu {
|
||||
display: inline-block;
|
||||
width: 53px;
|
||||
height: 53px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-right: 17px;
|
||||
/* background: url('./img/icon_home.png')no-repeat; */
|
||||
background-size: cover !important;
|
||||
}
|
||||
|
|
|
@ -58,10 +58,11 @@ export default {
|
|||
</script>
|
||||
<style>
|
||||
.el-menu-item {
|
||||
height: 153px;
|
||||
justify-content: center;
|
||||
height: 80px;
|
||||
/* justify-content: center; */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* flex-direction: column; */
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -7,10 +7,10 @@ Vue.use(Router)
|
|||
import Layout from '@/layout'
|
||||
|
||||
/* Router Modules */
|
||||
import componentsRouter from './modules/components'
|
||||
import chartsRouter from './modules/charts'
|
||||
import tableRouter from './modules/table'
|
||||
import nestedRouter from './modules/nested'
|
||||
// import componentsRouter from './modules/components'
|
||||
// import chartsRouter from './modules/charts'
|
||||
// import tableRouter from './modules/table'
|
||||
// import nestedRouter from './modules/nested'
|
||||
|
||||
/**
|
||||
* Note: sub-menu only appear when route children.length >= 1
|
||||
|
@ -367,6 +367,56 @@ export const asyncRoutes = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/fingertipIntegral',
|
||||
component: Layout,
|
||||
name: 'FingertipIntegral',
|
||||
redirect: '/fingertipIntegral/list',
|
||||
meta: {
|
||||
title: '积分管理',
|
||||
icon: 'townRanking',
|
||||
roles: ['SSS']
|
||||
},
|
||||
hidden: false,
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
component: () => import('@/views/fingertipIntegral/list'),
|
||||
name: 'FingertipIntegralList',
|
||||
meta: {
|
||||
title: '规则列表',
|
||||
icon: 'townRanking',
|
||||
affix: true,
|
||||
parentTitle: '积分管理'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/speciallyBusiness',
|
||||
component: Layout,
|
||||
name: 'SpeciallyBusiness',
|
||||
redirect: '/speciallyBusiness/list',
|
||||
meta: {
|
||||
title: '特约商户管理',
|
||||
icon: 'townRanking',
|
||||
roles: ['SSS']
|
||||
},
|
||||
hidden: false,
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
component: () => import('@/views/speciallyBusiness/list'),
|
||||
name: 'speciallyBusinessList',
|
||||
meta: {
|
||||
title: '商户列表',
|
||||
icon: 'townRanking',
|
||||
affix: true,
|
||||
parentTitle: '特约商户管理'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// path: '/permission',
|
||||
// component: Layout,
|
||||
|
|
|
@ -24,8 +24,8 @@ $menuHover:#5d94ff;
|
|||
$subMenuBg:#1f2d3d;
|
||||
$subMenuHover:#001528;
|
||||
|
||||
// $sideBarWidth: 210px;
|
||||
$sideBarWidth: 150px;
|
||||
$sideBarWidth: 230px;
|
||||
// $sideBarWidth: 150px;
|
||||
|
||||
// the :export directive is the magic sauce for webpack
|
||||
// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
|
||||
|
|
|
@ -0,0 +1,395 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
style="margin-bottom:20px"
|
||||
@click="handleAdd()"
|
||||
>新增规则</el-button>
|
||||
<el-table :data="list" border style="width: 100%">
|
||||
|
||||
<el-table-column label="规则名称" prop="name" />
|
||||
<el-table-column label="规则类型" prop="ruleType">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.ruleType | optionsFilter(ruleTypeOptions)
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.createDate | parseTime("{y}-{m}-{d} {h}:{i}:{s}")
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="最后更新时间">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.lastUpdateDate | parseTime("{y}-{m}-{d} {h}:{i}:{s}")
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" fixed="right" align="center" width="280px">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
round
|
||||
style="font-size:14px;padding:10px 20px"
|
||||
@click="handleAdd(scope.row)"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="danger"
|
||||
round
|
||||
style="font-size:14px;padding:10px 20px"
|
||||
@click="handleDel(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-if="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.lastPageIndex"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog
|
||||
class="dialog"
|
||||
:title="diaTitle"
|
||||
append-to-body
|
||||
center
|
||||
width="604px"
|
||||
:visible.sync="diaVisible"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:close="closeDia"
|
||||
>
|
||||
<div class="preview-container">
|
||||
<el-form
|
||||
ref="form"
|
||||
label-position="left"
|
||||
label-width="150px"
|
||||
:rules="rules"
|
||||
:model="form"
|
||||
>
|
||||
<el-form-item label="规则名称" prop="name">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规则类型" prop="ruleType">
|
||||
<el-select v-model="form.ruleType">
|
||||
<el-option v-for="item of ruleTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.ruleType === 'TEMPORARY'" label="生效时间" prop="dateRange">
|
||||
<el-date-picker
|
||||
v-model="form.dateRange"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="行政区域" prop="regionIds">
|
||||
<el-cascader
|
||||
v-model="form.regionIds"
|
||||
class="filter-item"
|
||||
style="width:240px"
|
||||
:options="regions"
|
||||
:props="{ checkStrictly: true }"
|
||||
placeholder="行政区域"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否适用于子级区域" prop="all">
|
||||
<el-radio v-model="form.all" :label="true">是</el-radio>
|
||||
<el-radio v-model="form.all" :label="false">否</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请办件积分" prop="apply">
|
||||
<el-input
|
||||
v-model="form.apply"
|
||||
type="number"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理办件积分" prop="handling">
|
||||
<el-input
|
||||
v-model="form.handling"
|
||||
type="number"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="差评扣分(负数)" prop="negativeComment">
|
||||
<el-input
|
||||
v-model="form.negativeComment"
|
||||
type="number"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="阅读" prop="read">
|
||||
<el-input
|
||||
v-model="form.read"
|
||||
type="number"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="实名认证积分" prop="realNameAuthentication">
|
||||
<el-input
|
||||
v-model="form.realNameAuthentication"
|
||||
type="number"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发朋友圈" prop="sendACircleOfFriends">
|
||||
<el-input
|
||||
v-model="form.sendACircleOfFriends"
|
||||
type="number"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="超期办件扣分(负数)" prop="timeOut">
|
||||
<el-input
|
||||
v-model="form.timeOut"
|
||||
type="number"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="非常满意得分" prop="verySatisfied">
|
||||
<el-input
|
||||
v-model="form.verySatisfied"
|
||||
type="number"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="default" @click="closeDia">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination'
|
||||
import { list, add, del } from '@/api/fingertipIntegral'
|
||||
import { getRegions } from '@/api/region'
|
||||
export default {
|
||||
components: { Pagination },
|
||||
filters: {
|
||||
optionsFilter(value, options = []) {
|
||||
const findItem = options.find((option) => option.value === value)
|
||||
if (findItem) {
|
||||
return findItem.label
|
||||
}
|
||||
return ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
total: 0,
|
||||
listQuery: {
|
||||
lastPageIndex: 1,
|
||||
// params: {},
|
||||
size: 10
|
||||
},
|
||||
list: undefined,
|
||||
|
||||
diaTitle: '',
|
||||
diaVisible: false,
|
||||
form: {
|
||||
name: undefined,
|
||||
ruleType: 'FINAL',
|
||||
regionIds: undefined,
|
||||
all: false,
|
||||
dateRange: undefined,
|
||||
|
||||
apply: undefined,
|
||||
handling: undefined,
|
||||
negativeComment: undefined,
|
||||
read: undefined,
|
||||
realNameAuthentication: undefined,
|
||||
sendACircleOfFriends: undefined,
|
||||
timeOut: undefined,
|
||||
verySatisfied: undefined
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入', trigger: 'change' }],
|
||||
ruleType: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
regionIds: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
all: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
dateRange: [{ required: true, message: '请选择', trigger: 'change' }]
|
||||
},
|
||||
|
||||
ruleTypeOptions: [
|
||||
{
|
||||
label: '长期规则',
|
||||
value: 'FINAL'
|
||||
},
|
||||
{
|
||||
label: '临时规则',
|
||||
value: 'TEMPORARY'
|
||||
}
|
||||
],
|
||||
regions: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'listQuery.lastPageIndex': {
|
||||
handler(val) {
|
||||
this.getList()
|
||||
},
|
||||
deep: true // true 深度监听
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getRegions()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
list(this.listQuery).then(res => {
|
||||
// console.log(res);
|
||||
this.list = res.d
|
||||
this.total = res.d.total
|
||||
this.pageSize = res.d.pageSize
|
||||
// if (!res.d.lastPageIndex) {
|
||||
// this.listQuery.lastPageIndex;
|
||||
// }
|
||||
})
|
||||
},
|
||||
getRegions() {
|
||||
getRegions().then(res => {
|
||||
const tempData = res.d
|
||||
const countyArr = [] // 县,1
|
||||
tempData.map(county => {
|
||||
const countyObj = {
|
||||
value: county.root.id,
|
||||
label: county.root.name,
|
||||
disabled: !county.root.check,
|
||||
children: []
|
||||
}
|
||||
countyArr.push(countyObj)
|
||||
county.node.map(town => {
|
||||
const townObj = {
|
||||
value: town.root.id,
|
||||
label: town.root.name,
|
||||
disabled: !town.root.check,
|
||||
children: []
|
||||
}
|
||||
countyObj.children.push(townObj)
|
||||
town.node.map(country => {
|
||||
townObj.children.push({
|
||||
value: country.root.id,
|
||||
label: country.root.name,
|
||||
disabled: !country.root.check
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
this.regions = countyArr
|
||||
})
|
||||
},
|
||||
handleAdd(item) {
|
||||
if (item) {
|
||||
this.diaTitle = '编辑规则'
|
||||
const tmpItem = JSON.parse(JSON.stringify(item))
|
||||
const { regionIds, startDate, endDate } = tmpItem
|
||||
tmpItem.regionIds = regionIds.split(',')
|
||||
if (startDate || endDate) {
|
||||
tmpItem.dateRange = [new Date(startDate * 1000), new Date(endDate * 1000)]
|
||||
}
|
||||
this.form = tmpItem
|
||||
} else {
|
||||
this.diaTitle = '新增规则'
|
||||
this.form = {
|
||||
name: undefined,
|
||||
ruleType: 'FINAL',
|
||||
regionIds: undefined,
|
||||
all: false,
|
||||
dateRange: undefined,
|
||||
|
||||
apply: undefined,
|
||||
handling: undefined,
|
||||
negativeComment: undefined,
|
||||
read: undefined,
|
||||
realNameAuthentication: undefined,
|
||||
sendACircleOfFriends: undefined,
|
||||
timeOut: undefined,
|
||||
verySatisfied: undefined
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
const formEl = this.$refs['form']
|
||||
if (formEl) formEl.clearValidate()
|
||||
this.diaVisible = true
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
// console.log(this.form)
|
||||
// return
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const { dateRange } = this.form
|
||||
const form = JSON.parse(JSON.stringify(this.form))
|
||||
const { regionIds = [] } = form
|
||||
form.regionIds = regionIds.join(',')
|
||||
if (dateRange) {
|
||||
form.startDate = dateRange[0].getTime() / 1000
|
||||
form.endDate = dateRange[1].getTime() / 1000
|
||||
}
|
||||
add(form).then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!'
|
||||
})
|
||||
this.closeDia()
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDel(item) {
|
||||
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
del({ id: item.id }).then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
})
|
||||
this.getList()
|
||||
})
|
||||
})
|
||||
},
|
||||
jumpStaff(item) {
|
||||
const { name, id } = item
|
||||
this.$router.push({
|
||||
path: '/dept/staff',
|
||||
query: {
|
||||
name,
|
||||
id
|
||||
}
|
||||
})
|
||||
},
|
||||
closeDia() {
|
||||
this.diaVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
|
@ -0,0 +1,400 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<!-- <el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
style="margin-bottom:20px"
|
||||
@click="handleAdd()"
|
||||
>新增规则</el-button> -->
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="待添加列表" name="first" />
|
||||
<el-tab-pane label="已添加列表" name="second" />
|
||||
</el-tabs>
|
||||
<el-table v-loading="loading" :data="list" border style="width: 100%">
|
||||
|
||||
<el-table-column prop="name" label="姓名" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="nameZ" label="姓名(藏语)" width="180">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.nameZ }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="phone" label="手机号" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.phone }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="phone" label="身份证号" width="200">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.idCard }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="phone" label="是否是便民工作人员" width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.isConvenience ? "是" : "否" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="phone" label="所属行政区域">
|
||||
<template slot-scope="scope">
|
||||
{{
|
||||
scope.row.permanentResidenceRegion +
|
||||
(scope.row.permanentResidenceTown
|
||||
? "-" + scope.row.permanentResidenceTown
|
||||
: "") +
|
||||
(scope.row.permanentResidenceTownShip
|
||||
? "-" + scope.row.permanentResidenceTownShip
|
||||
: "")
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" fixed="right" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="activeName === 'first'"
|
||||
size="mini"
|
||||
type="primary"
|
||||
round
|
||||
style="font-size:14px;padding:10px 20px"
|
||||
@click="handleAdd(scope.row, 'add')"
|
||||
>添加</el-button>
|
||||
<el-button
|
||||
v-if="activeName === 'second'"
|
||||
size="mini"
|
||||
type="primary"
|
||||
round
|
||||
style="font-size:14px;padding:10px 20px"
|
||||
@click="handleAdd(scope.row, 'edit')"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
v-if="activeName === 'second'"
|
||||
size="mini"
|
||||
type="danger"
|
||||
round
|
||||
style="font-size:14px;padding:10px 20px"
|
||||
@click="handleDel(scope.row)"
|
||||
>移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-if="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.lastPageIndex"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog
|
||||
class="dialog"
|
||||
:title="diaTitle"
|
||||
append-to-body
|
||||
center
|
||||
width="604px"
|
||||
:visible.sync="diaVisible"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:close="closeDia"
|
||||
>
|
||||
<div class="preview-container">
|
||||
<el-form
|
||||
ref="form"
|
||||
label-position="left"
|
||||
label-width="150px"
|
||||
:rules="rules"
|
||||
:model="form"
|
||||
>
|
||||
<el-form-item label="商户名称" prop="name">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户名称(藏文)" prop="nameZ">
|
||||
<el-input
|
||||
v-model="form.nameZ"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户图片" prop="images">
|
||||
<CutUploadImage :init-url="form.images" multiple @imgupload="UploadCbk" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商户地址" prop="address">
|
||||
<el-input
|
||||
v-model="form.address"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户地址(藏文)" prop="addressZ">
|
||||
<el-input
|
||||
v-model="form.addressZ"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户介绍" prop="introduce">
|
||||
<el-input
|
||||
v-model="form.introduce"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户介绍(藏文)" prop="introduceZ">
|
||||
<el-input
|
||||
v-model="form.introduceZ"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="兑换规则" prop="rule">
|
||||
<el-input
|
||||
v-model="form.rule"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="兑换规则(藏文)" prop="ruleZ">
|
||||
<el-input
|
||||
v-model="form.ruleZ"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="default" @click="closeDia">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination'
|
||||
import CutUploadImage from '@/components/cutUploadImage'
|
||||
import { list, speciallyBusinessList, speciallyBusinessSet } from '@/api/speciallyBusiness'
|
||||
import { getRegions } from '@/api/region'
|
||||
export default {
|
||||
components: { Pagination, CutUploadImage },
|
||||
filters: {
|
||||
optionsFilter(value, options = []) {
|
||||
const findItem = options.find((option) => option.value === value)
|
||||
if (findItem) {
|
||||
return findItem.label
|
||||
}
|
||||
return ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
total: 0,
|
||||
listQuery: {
|
||||
lastPageIndex: 1,
|
||||
// params: {},
|
||||
size: 10
|
||||
},
|
||||
list: undefined,
|
||||
|
||||
listMethod: list,
|
||||
activeName: 'first',
|
||||
|
||||
diaTitle: '',
|
||||
diaVisible: false,
|
||||
form: {
|
||||
name: undefined,
|
||||
nameZ: undefined,
|
||||
images: [],
|
||||
address: undefined,
|
||||
addressZ: undefined,
|
||||
introduce: undefined,
|
||||
introduceZ: undefined,
|
||||
rule: undefined,
|
||||
ruleZ: undefined
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入', trigger: 'change' }],
|
||||
ruleType: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
regionIds: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
all: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
dateRange: [{ required: true, message: '请选择', trigger: 'change' }]
|
||||
},
|
||||
|
||||
ruleTypeOptions: [
|
||||
{
|
||||
label: '长期规则',
|
||||
value: 'FINAL'
|
||||
},
|
||||
{
|
||||
label: '临时规则',
|
||||
value: 'TEMPORARY'
|
||||
}
|
||||
],
|
||||
regions: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'listQuery.lastPageIndex': {
|
||||
handler(val) {
|
||||
this.getList()
|
||||
},
|
||||
deep: true // true 深度监听
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getRegions()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
this.listMethod(this.listQuery).then(res => {
|
||||
// console.log(res);
|
||||
this.list = res.d.list
|
||||
this.total = res.d.total
|
||||
this.pageSize = res.d.pageSize
|
||||
this.loading = false
|
||||
// if (!res.d.lastPageIndex) {
|
||||
// this.listQuery.lastPageIndex;
|
||||
// }
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
handleClick() {
|
||||
const { activeName } = this
|
||||
// console.log(activeName)
|
||||
switch (activeName) {
|
||||
case 'first':
|
||||
this.listMethod = list
|
||||
break
|
||||
default:
|
||||
this.listMethod = speciallyBusinessList
|
||||
}
|
||||
this.listQuery.lastPageIndex = 1
|
||||
this.getList()
|
||||
},
|
||||
getRegions() {
|
||||
getRegions().then(res => {
|
||||
const tempData = res.d
|
||||
const countyArr = [] // 县,1
|
||||
tempData.map(county => {
|
||||
const countyObj = {
|
||||
value: county.root.id,
|
||||
label: county.root.name,
|
||||
disabled: !county.root.check,
|
||||
children: []
|
||||
}
|
||||
countyArr.push(countyObj)
|
||||
county.node.map(town => {
|
||||
const townObj = {
|
||||
value: town.root.id,
|
||||
label: town.root.name,
|
||||
disabled: !town.root.check,
|
||||
children: []
|
||||
}
|
||||
countyObj.children.push(townObj)
|
||||
town.node.map(country => {
|
||||
townObj.children.push({
|
||||
value: country.root.id,
|
||||
label: country.root.name,
|
||||
disabled: !country.root.check
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
this.regions = countyArr
|
||||
})
|
||||
},
|
||||
handleAdd(item, type) {
|
||||
if (type === 'edit') {
|
||||
this.diaTitle = '编辑'
|
||||
const tmpItem = JSON.parse(JSON.stringify(item.speciallyBusinessInfo))
|
||||
tmpItem.id = item.id
|
||||
this.form = tmpItem
|
||||
} else if (type === 'add') {
|
||||
this.diaTitle = '添加'
|
||||
this.form = {
|
||||
id: item.id,
|
||||
name: undefined,
|
||||
nameZ: undefined,
|
||||
images: [],
|
||||
address: undefined,
|
||||
addressZ: undefined,
|
||||
introduce: undefined,
|
||||
introduceZ: undefined,
|
||||
rule: undefined,
|
||||
ruleZ: undefined
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
const formEl = this.$refs['form']
|
||||
if (formEl) formEl.clearValidate()
|
||||
this.diaVisible = true
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
// console.log(this.form)
|
||||
// return
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const form = JSON.parse(JSON.stringify(this.form))
|
||||
speciallyBusinessSet([{
|
||||
id: form.id,
|
||||
add: true,
|
||||
speciallyBusinessInfo: form
|
||||
}]).then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!'
|
||||
})
|
||||
this.closeDia()
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDel(item) {
|
||||
this.$confirm('是否移除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
speciallyBusinessSet([{
|
||||
id: item.id,
|
||||
add: false
|
||||
}]).then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!'
|
||||
})
|
||||
this.getList()
|
||||
})
|
||||
})
|
||||
},
|
||||
UploadCbk(data) {
|
||||
this.form.images = data
|
||||
},
|
||||
// jumpStaff(item) {
|
||||
// const { name, id } = item
|
||||
// this.$router.push({
|
||||
// path: '/dept/staff',
|
||||
// query: {
|
||||
// name,
|
||||
// id
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
closeDia() {
|
||||
this.diaVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
Loading…
Reference in New Issue