You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

524 lines
17 KiB

<template>
<div class="app-container">
<div v-show="viewState == 1">
<div class="tab-header webtop">
<div>销售政策管理</div>
<div>
<el-button type="primary" size="small" @click="handleCreate()">新增</el-button>
<el-button type="danger" size="small" @click="handleDelete()">删除</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
</div>
<div class="webcon">
<div class="searchcon">
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button>
<div v-show="isSearchShow" class="search">
<el-form ref="listQueryform" :inline="true" :model="listQuery" label-width="130px" class="tab-header">
<el-form-item label="政策类别">
<el-select v-model="listQuery.params.salesPolicy" placeholder="请选择" @change="salesPolicyChange">
<el-option
v-for="item in salesPolicy_list"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="优惠包类别">
<el-select v-model="listQuery.params.discountType" placeholder="请选择" @change="discountTypeChange">
<el-option
v-for="item in discountType_list"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否有效">
<el-select v-model="listQuery.params.isEmploy" placeholder="请选择" @change="isEmployChange">
<el-option
v-for="item in effective"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="有效期">
<div class="block">
<el-date-picker
v-model="listQuery.params.getEffectiveStartDate"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd">
</el-date-picker>
</div>
<label>至</label>
<div class="block">
<el-date-picker
v-model="listQuery.params.getEffectiveEndDate"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd">
</el-date-picker>
</div>
</el-form-item>
<div class="searchbtns">
<el-button type="primary" @click="handleFilter">查询</el-button>
<el-button type="primary" @click="handleReset">重置</el-button>
</div>
</el-form>
</div>
</div>
<div class="listtop">
<div class="tit">销售政策列表</div>
<pageye v-show="total > 0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size"
class="pagination" @pagination="getList"/>
</div>
<div class="">
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column width="80px" label="序号" type="index" :index="indexMethod" align="center"/>
<el-table-column width="50px" type="selection" align="center"/>
<el-table-column width="150px" label="操作" align="center">
<template slot-scope="scope">
<div class="searchbtns"> <!--:disabled=""-->
<el-button size="small" type="primary"
@click="changeNodeState(scope.row)">办理
</el-button>
<el-button size="small" type="primary" @click="handleCheck(scope.row)">查看</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<span>{{ scope.row.nodeState }}</span>
</template>
</el-table-column>
<el-table-column label="政策类别" align="center">
<template slot-scope="scope">
<span>{{ scope.row.salesPolicy }}</span>
</template>
</el-table-column>
<el-table-column label="优惠包类别" align="center">
<template slot-scope="scope">
<span>{{ scope.row.discountType }}</span>
</template>
</el-table-column>
<el-table-column label="优惠包名称" align="center">
<template slot-scope="scope">
<span>{{ scope.row.discountName }}</span>
</template>
</el-table-column>
<el-table-column label="优惠包价值" align="center">
<template slot-scope="scope">
<span>{{ scope.row.amount }}</span>
</template>
</el-table-column>
<el-table-column label="优惠项目说明" align="center">
<template slot-scope="scope">
<span>{{ scope.row.detail }}</span>
</template>
</el-table-column>
<el-table-column label="有效期" align="center">
<template slot-scope="scope">
<span>{{ scope.row.effectiveDate }}</span>
</template>
</el-table-column>
<el-table-column label="是否生效" align="center">
<template slot-scope="scope">
<span>{{ scope.row.isEmploy }}</span>
</template>
</el-table-column>
</el-table>
</div>
<div class="pages">
<div class="tit"/>
<!-- 翻页 -->
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size"
class="pagination" @pagination="getList"/>
</div>
</div>
</div>
<xiaoshouzhengce-add v-show="viewState == 2 || viewState == 3" ref="divadd" @doback="resetState"
@reloadlist="getList"></xiaoshouzhengce-add>
<xiaoshouzhengce-info v-show="viewState == 4" ref="divinfo" @doback="resetState"></xiaoshouzhengce-info>
</div>
</template>
<script>
import {mapGetters} from 'vuex'
import {listPage, deleteBySids, typeValues} from '@/api/jichuxinxi/salepolicy'
import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
import xiaoshouzhengceAdd from "./xiaoshouzhengceAdd"
import xiaoshouzhengceInfo from "./xiaoshouzhengceInfo"
export default {
name: "xiaoshouzhengce",
components: {
Pagination,
pageye,
xiaoshouzhengceAdd,
xiaoshouzhengceInfo
},
data() {
return {
disabled: false, // 办理按钮
isSearchShow: false,
searchxianshitit: '显示查询条件',
viewState: 1, // 1、列表 2、添加-车辆预订 3、编辑 4、查看 5、订金-订金收取
// 查询 -----------
salesPolicy_list: [], //政策类别
discountType_list: [], // 优惠包类别
effective: [{ // 是否有效
value: 0,
label: '是'
}, {
value: 1,
label: '否'
}],
tableKey: 0,
list: [],
sids: [],
total: 1,
FormLoading: false,
listLoading: false,
listQuery: {
current: 1,
size: 20,
params: {
discountType: '', //优惠类型(赠送套餐 等,数据字典)
discountTypeKey: '', //优惠类型key
getEffectiveEndDate: '', //结束有效期
getEffectiveStartDate: '', //开始有效期
isEmploy: '', //是否有效
salesPolicy: '', //政策类别
salesPolicyKey: '' //政策类别key
},
},
submitDto: {
businessSid: '',
userSid: window.sessionStorage.getItem('userSid'),
},
nodeState: '',
}
},
computed: {
...mapGetters([
'id',
'roles',
'rolesIds',
'departmentId',
'departmentCode',
]),
},
created() {
// 初始化变量
this.init()
// 加载列表
this.getList()
},
methods: {
// 搜索条件效果
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
if (this.isSearchShow) {
this.searchxianshitit = '隐藏查询条件'
} else {
this.searchxianshitit = '显示查询条件'
}
},
init() {
this.getType()
},
// ----------功能打开开始--------
resetState() {
this.viewState = 1
},
// 重置
handleReset() {
this.listQuery = {
current: 1,
size: 20,
params: {
discountType: '',
discountTypeKey: '',
getEffectiveEndDate: '',
getEffectiveStartDate: '',
isEmploy: '',
salesPolicy: '',
salesPolicyKey: ''
},
}
},
// 下拉框
getType() {
typeValues({
type: 'discountPolicyType'
}).then((res) => {
if (res.code === '200') {
this.salesPolicy_list = res.data
console.log('下拉框请求政策类别', this.salesPolicy_list)
}
})
typeValues({
type: 'discountPackageType'
}).then((res) => {
if (res.code === '200') {
this.discountType_list = res.data
console.log('下拉框请求优惠包类别', this.discountType_list)
}
})
},
// 政策类别
salesPolicyChange(value) {
console.log('触发下拉框按钮')
let bb = {}
this.salesPolicy_list.forEach((e) => {
if (e.dictKey === value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
}
}
})
this.listQuery.params.salesPolicy = bb.name
this.listQuery.params.salesPolicyKey = bb.key
console.log('name', this.listQuery.params.salesPolicy)
},
// 优惠包类别
discountTypeChange(value) {
console.log('触发下拉框按钮')
let bb = {}
this.discountType_list.forEach((e) => {
if (e.dictKey === value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
}
}
})
this.listQuery.params.discountType = bb.name
this.listQuery.params.discountTypeKey = bb.name
console.log('name', this.listQuery.params.discountType)
},
isEmployChange(value) {
console.log('触发下拉框按钮')
let bb = {}
this.effective.forEach((e) => {
if (e.dictKey === value) {
bb = {
name: e.value,
}
}
})
this.listQuery.params.isEmploy = bb.name
console.log('name', this.listQuery.params.isEmploy)
},
// 打开添加
handleCreate() {
this.viewState = 2
this.$refs['divadd'].showAdd()
},
// 打开编辑
handleUpdate() {
if (this.sids.length === 1) {
this.viewState = 3
this.$refs['divadd'].showEdit(this.sids[0])
} else if (this.sids.length > 1) {
this.$notify({
title: '提示',
message: '不能选中多个信息修改!!',
type: 'info',
duration: 2000,
})
} else {
this.$notify({
title: '提示',
message: '没有选择信息!!',
type: 'error',
duration: 2000,
})
return
}
},
//办理
changeNodeState(row) {
console.log('111', row)
// if (row.flowState === 0) {
this.viewState = 3
this.$refs['divadd'].showEdit(row.sid)
// } else {
// return
// }
},
// 打开查看详情
handleCheck(row) {
this.viewState = 4
this.$refs['divinfo'].showInfo(row.sid)
},
// 序号
indexMethod(index) {
var pagestart = (this.listQuery.current - 1) * this.listQuery.size
var pageindex = index + 1 + pagestart
return pageindex
},
// 查询列表信息
getList() {
this.listLoading = true
listPage(this.listQuery).then((response) => {
this.listLoading = false
if (
response.code === '200' &&
response.data &&
response.data.total > 0
) {
this.list = response.data.records
this.total = response.data.total
} else {
this.list = []
this.total = 0
}
})
},
// 查询按钮
handleFilter() {
this.listQuery.current = 1
this.getList()
},
// 勾选
handleSelectionChange(row) {
console.log('row', row)
const aa = []
const bb = []
row.forEach((element) => {
aa.push(element.sid)
bb.push(element.depositBillTypeKey)
});
this.sids = aa
this.billType = bb
console.log('选择sid', this.sids)
console.log('选择订单类型', this.billType)
},
// 根据本行ID删除数据
handleDelete() {
if (this.sids.length > 0) {
const sids = this.sids
deleteBySids(sids).then((response) => {
if (response.code === '200') {
this.$notify({
title: '提示',
message: '删除成功',
type: 'success',
duration: 2000,
})
this.getList()
} else {
this.$notify({
title: '删除失败',
message: response.msg,
type: 'error',
})
}
})
} else {
this.$notify({
title: '提示',
message: '没有选择资方信息!!',
type: 'error',
duration: 2000,
})
return
}
},
// 提交
// handleSubmit(row) {
// // if (this.sids.length == 1) {
// this.$confirm('是否将此条数据加入到待办任务', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// this.submitDto.businessSid = row.sid
// submitApprove(this.submitDto).then((response) => {
// if (response.code === '200') {
// this.updateDto.nodeState = response.data.nodeState
// this.$notify({
// title: '提示',
// message: '添加成功',
// type: 'success',
// duration: 2000,
// })
// // 更新审批 状态
// this.updateDto.sid = row.sid
// updateState(this.updateDto).then((response) => {
// if (response.code === '200') {
// this.$notify({
// title: '提示',
// message: '更新成功',
// type: 'success',
// duration: 2000,
// })
// this.getList()
// } else {
// this.$notify({
// title: '更新失败',
// message: response.msg,
// type: 'error',
// })
// }
// })
// } else {
// this.$notify({
// title: '添加失败',
// message: response.msg,
// type: 'error',
// })
// }
// })
// })
// // } else if (this.sids.length == 0) {
// // this.$notify({
// // title: '您还未选择,请选择数据!!!',
// // type: 'error',
// // })
// // } else if (this.sids.length > 1) {
// // this.$notify({
// // title: '您选择的数据过多,请选择一条数据编辑!!',
// // type: 'error',
// // })
// // }
// },
},
}
</script>
<style scoped>
/* .listcon{height: calc(100vh - 480px);overflow-y: auto;overflow-x: hidden;} */
.el-input__icon {
width: 40px;
}
.el-form-item .el-form-item__label {
width: 100% !important;
}
.block {
display: inline-block;
}
.el-form-item__content label {
padding: 0 5px;
}
</style>