提交 1055f4b0 authored 作者: 翟畅's avatar 翟畅

zc添加营销服务-三科经销商模块

上级 53187a7c
......@@ -55,6 +55,30 @@ const marketManageRouter = {
hidden: true
},
{
path: 'three_branch_dealer',
component: () => import('@/views/marketing_manage/three_branch_dealer/index'),
name: 'three_branch_dealer',
meta: { title: '三科经销商' },
},
{
path: 'createDealer',
component: () => import('@/views/marketing_manage/three_branch_dealer/create'),
name: 'createDealer',
meta: {
title: '新建三科经销商',noCache: true, activeMenu: `/marketing_manage/three_branch_dealer`
},
hidden: true
},
{
path: 'editDealer',
component: () => import('@/views/marketing_manage/three_branch_dealer/edit'),
name: 'editDealer',
meta: {
title: '编辑三科经销商',noCache: true, activeMenu: `/marketing_manage/three_branch_dealer`
},
hidden: true
},
{
path: 'client_module',
component: () => import('@/views/marketing_manage/client_module/index'),
name: 'client_module',
......
......@@ -59,6 +59,7 @@ export default {
province: null,
fax: null,
id: null,
type: 1,
},
value:null,
rules: {
......@@ -72,7 +73,6 @@ export default {
],
contactInformation:[
{ required: true , message: '请输入联系方式' },
// { pattern: /(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/, message: '联系方式为电话号码或座机号码' }
],
province:[
{ required: true , message: '请输入省份简称' },
......
......@@ -67,6 +67,7 @@
pageNum: 1,
pageSize: 50,
orderBy:null,
type:1,
},
total: null,
listLoading: false,
......
<template>
<div class="divBox" id="book_create">
<el-card class="box-card">
<div class="module_content">
<div class="back_box" @click="goBack()" v-if="this.$route.query.type=='view'">
<img src="@/assets/img/common/back.png"><span>返回</span>
</div>
<div class="resource_title" style="padding-left:40px;">
<img src="@/assets/img/common/basic.png">基本信息
</div>
<el-form :model="dataForm" :rules="rules" ref="dataForm" label-width="140px">
<el-form-item label="省份:" prop="province">
<el-input v-model="dataForm.province" placeholder="请输入省份,中间用逗号隔开" style="width:40%;"></el-input>
</el-form-item>
<el-form-item label="授权经销商名称:" prop="fax">
<el-input v-model="dataForm.fax" style="width:40%;" type="textarea" :autosize="{ minRows: 3, maxRows: 6}" placeholder="请输入授权经销商名称,中间用逗号隔开"></el-input>
</el-form-item>
<el-form-item label="联系人:" prop="name">
<el-input v-model="dataForm.name" style="width:40%;" type="textarea" :autosize="{ minRows: 3, maxRows: 6}" placeholder="请输入联系人,中间用逗号隔开"></el-input>
</el-form-item>
<el-form-item label="联系方式:" prop="contactInformation">
<el-input v-model="dataForm.contactInformation" style="width:40%;" type="textarea" :autosize="{ minRows: 3, maxRows: 6}" placeholder="请输入联系方式,中间用逗号隔开"></el-input>
</el-form-item>
<el-form-item label="地址:" prop="content">
<el-input v-model="dataForm.content" style="width:40%;" type="textarea" :autosize="{ minRows: 3, maxRows: 6}" placeholder="请输入地址,中间用逗号隔开"></el-input>
</el-form-item>
<el-form-item label="排序:" prop="sort">
<el-input v-model="dataForm.sort" style="width:40%;" placeholder="请输入排序号"></el-input>
</el-form-item>
</el-form>
</div>
<div class="footer_fixed">
<el-button @click="goBack()" size="small">取消</el-button>
<el-button v-if="!viewFlag" @click="dataSubmit" type="primary" :disabled="sending" :loading="sending" size="small">保存</el-button>
</div>
</el-card>
</div>
</template>
<script>
import { contactListAPI, contactDeleteAPI, contactSaveAPI, contactDetailAPI, contactMaxOrderNumAPI } from "@/api/marketing/agency";
import { fileUrl, pdfFileUrl, baseUrl } from '@/utils/global'
import { formatSort } from '@/utils/format'
import { valValidate, isbnValidate, fontValidate } from '@/utils/validate'
import store from '@/store'
export default {
name:'createDealer',
components:{
},
data() {
return {
pdfFileUrl,baseUrl,
loading:false,
configMsg: { UEDITOR_HOME_URL: '/Ueditor/', readonly: false, autoFloatEnabled: false },
configMsg1: { UEDITOR_HOME_URL: '/Ueditor/', readonly: false, autoFloatEnabled: false },
viewFlag: false,
fileUrl,
dataForm:{
name: null,
contactInformation: null,
province: null,
content: null,
id: null,
fax: null,
type: 2,
},
value:null,
rules: {
name:[
{ required: true , message: '请输入联系人' },
{ validator: valValidate },
],
fax: [
{ required: true , message: '请输入授权经销商名称' },
],
content: [
{ required: true , message: '请输入地址' },
],
contactInformation:[
{ required: true , message: '请输入联系方式' },
],
province:[
{ required: true , message: '请输入省份' },
],
sort:[
{ pattern: /^\d*$/, message: '排序号为数字' }
]
},
sending: false,
sortList: [],
options: [],
dialogVisible: false,
listLoading: false,
}
},
created() {
this.viewFlag = this.$route.query.type == 'view'
},
mounted() {
if(this.$route.query.editId){//修改功能
this.dataForm.id = this.$route.query.editId
this.getDet()
}else{
this.dataForm.id = null
}
},
deactivated(){ // keep-alive生命周期 被keep-alive缓存的组件停用时调用
if(!this.$store.state.tagsView.lockViews.find(item=>item==this.$options.name)){ // 当前缓存组件不在被缓存列表中时进行销毁
this.$destroy(this.$options.name)
}
},
methods: {
goBack(){
let view = this.$route
this.$store.dispatch('tagsView/delView', view)
if(this.viewFlag){
this.$router.replace({path:this.$route.query.path,query:{id:this.$route.query.id}})
}else{
this.$router.replace({path:this.$route.meta.activeMenu})
}
},
getDet() { //图书详情
contactDetailAPI(this.dataForm.id).then(res =>{
if(res.data.code === 0) {
this.dataForm = res.data.data
} else {
this.$message.error('数据加载失败');
}
})
},
getMaxSort() { //获取最大排序号
contactMaxOrderNumAPI().then(res => {
res.data.code === 0 ? this.dataForm.sort = res.data.data : this.$message.error('获取失败')
})
},
dataSubmit() { //添加联系信息
this.sending = true
this.$refs['dataForm'].validate((valid) => {
if (valid) {
contactSaveAPI(this.dataForm).then(res =>{
if (res.data.code === 0) {
this.$message.success('保存成功');
this.goBack()
} else {
this.$message.error(res.data.msg);
this.sending = false
}
})
} else {
this.$message.warning("有未通过的验证");
this.sending = false
}
})
},
handleCoverSuccess(response, file) { //封面上传成功
this.dataForm.cover = response
},
beforeCoverUpload(file) { //图片限制
const isFile = file.type == 'image/jpeg' || file.type == 'image/jpg' || file.type == 'image/png' || file.type == 'image/bmp' || file.type == 'image/gif'
const isLimit = file.size / 1024 / 1024 < 2;
if (!isFile) {
this.$message.error('上传图片仅支持jpg、jpeg、png、gif、bmp格式!');
}else if (!isLimit) {
this.$message.error('上传图片大小不能超过2MB!');
}
return isFile && isLimit;
},
},
}
</script>
<style lang="scss" scoped>
@import '@/assets/css/common.scss';
.el_tree{
max-height: 400px;
overflow-y: auto;
min-width:420px;
}
.line_tip{
width:205px
}
.el_sel{
width: 30%;
min-width: 400px;
}
.diy_sel{
width:300px;
}
.upload_resource{
width:143px;height:195px;
}
.ueditor_box{
width: 800px;
}
.pointer{
cursor: pointer;
}
// .book_pdf{
// display: flex;
// justify-content: flex-start;
// align-items: center;
// }
.pdfName {
display: inline-block;
min-width: 260px;
height: 25px;
line-height: 25px;
font-size: 12px;
color: #666666;
background: #F5F7FA;
padding-left: 25px;
box-sizing: border-box;
margin-left: 12px;
}
.pdfTip {
// color: #FC5514;
font-size: 14px;
margin-top: 10px;
}
.upload_btn{
float: left;
}
.checkPdfName{
width: 400px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
margin-top: 0;
}
// .pdf_box{
// display: flex;
// justify-content: flex-start;
// }
#book_create .bookLeft, #book_create .bookRight {
float: left;
width: 50%;
}
#book_create .bookTab_box {
width: 800px;
height: 40px;
line-height: 40px;
border: 1px solid #DCDFE6;
border-bottom: none;
background: #F5F7FA;
border-radius: 3px 3px 0px 0px;
box-sizing: border-box;
.tab{
width: 118px;
display: inline-block;
color: #3F4560;
text-align: center;
cursor: pointer;
border-right: 1px solid #DCDFE6;
&:last-child {
border-right: none;
}
}
.hover_tab{
background: #fff;
color: #1F71FF;
font-weight: bold;
}
}
.dialog-footer{
width: 200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
}
/deep/.el-dialog__body{
padding-bottom: 16px;
}
</style>
<style>
.hidden-selection {
display: none !important;
}
</style>
\ No newline at end of file
<template>
<div>
<edit></edit>
</div>
</template>
<script>
import edit from './component'
export default {
name:'createDealer',
components:{
edit
}
}
</script>
\ No newline at end of file
<template>
<div>
<edit></edit>
</div>
</template>
<script>
import edit from './component'
export default {
name:'editDealer',
components:{
edit
}
}
</script>
\ No newline at end of file
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-button class="mr10" size="small" type='primary' v-for="(item,index) in topBtn" :key="index" @click="handleBtn(item.url)">{{item.name}}</el-button>
</div>
<el-table ref="table" class="table_box" v-loading="listLoading" :data="dataList" style="width: 100%" size="mini" highlight-current-row>
<el-table-column prop="province" align="center" label="省份" min-width="10%"></el-table-column>
<el-table-column prop="fax" align="center" label="授权经销商名称" min-width="15%"></el-table-column>
<el-table-column prop="name" align="center" label="联系人" min-width="10%"></el-table-column>
<el-table-column prop="contactInformation" align="center" label="联系方式" min-width="10%"></el-table-column>
<el-table-column prop="content" align="center" label="地址" min-width="15%"></el-table-column>
<el-table-column prop="sort" align="center" label="排序" min-width="8%" sortable></el-table-column>
<el-table-column label="操作" min-width="15%" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" v-for="(item,index) in lineBtn" @click="handleBtn(item.url,scope.row)" v-if="(item.url != 'removeLine' || scope.row.status == 0)" :key="index">{{item.name}}</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
@size-change="sizeChange"
@current-change="currentChange"
:current-page="listQuery.pageNum"
:page-sizes="[30, 50, 100, 200]"
:page-size="listQuery.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
/>
</div>
</el-card>
<!-- 排序弹窗 -->
<el-dialog title="修改排序" :visible.sync="editSortDialog" width="300px">
<el-form :model="editSortData" ref="editSortData" :rules="rules" label-position="right" label-width="80px" size="small">
<el-form-item label="排序号:" prop="sort">
<el-input v-model="editSortData.sort" placeholder="请填写排序号"></el-input>
</el-form-item>
</el-form>
<span class="dialog-footer" style="text-align:center;width:100%;display:inline-block">
<el-button @click="editSortDialog=false" size="small">取消</el-button>
<el-button @click="editSortSave" type="primary" :loading="sending" size="small">确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { contactListAPI, contactDeleteAPI, contactSaveAPI, contactDetailAPI, contactMaxOrderNumAPI, editSortDetailAPI } from "@/api/marketing/agency";
import { confirm } from "@/utils/function";
import { getSelectionIds } from "@/filters/getIds";
import { pcUrl } from '@/utils/global'
export default {
name: 'three_branch_dealer',
components: {
},
data() {
return {
editSortDialog:false,
editSortData:{
sort:null,
},
topBtn:[],
lineBtn:[],
collapse: false,
classisyFlag:false,
dataList: [],
listQuery: {
pageNum: 1,
pageSize: 50,
orderBy:null,
type:2,
},
total: null,
listLoading: false,
value: null,
chooiceList: [],
sortList: [],
inResize: true,
sending: null,
rules:{
sort:[{ pattern:/^\d*$/, message:'排序号为数字'}]
}
}
},
mounted() {
window.addEventListener("click", this.clickOther);
this.getList();
setTimeout(() => {
let list = this.$store.state.btn.btnList;
list.forEach(item => {
if(item.type == 8){
this.topBtn.push(item)
}else if(item.type == 9 ){
this.lineBtn.push(item)
}
})
},0)
console.log(this.topBtn,'this.topBtn')
},
methods: {
clickOther(){
this.classisyFlag = false
this.collapse = false
},
handleBtn(btnName, obj) {
let status = {
createBtn: () => { //新建
this.createdBook();
},
editLine: () => { //编辑
this.createdBook(obj.id);
},
deleteLine: () => { //删除
this.removeData(obj.id);
},
editSortLine: () => {//修改排序
this.editSortNow(obj)
},
};
status[btnName]();
},
editSortNow(obj){
this.editSortData.sort = obj.sort
this.editSortData.id = obj.id
this.editSortDialog = true
},
editSortSave(){
editSortDetailAPI(this.editSortData).then((res) => {
if(res.data.code == 0){
this.$message.success('修改排序成功');
this.editSortDialog = false
this.getList(1)
}else{
this.$message.warning(res.data.msg)
}
})
},
createdBook(id){
if(id){
this.$router.push({path:'/marketing_manage/editDealer',query:{editId:id}})
}else{
this.$router.push({path:'/marketing_manage/createDealer'})
}
},
sortChanged(column){
this.listQuery.orderBy = column.prop + (column.order == 'descending'?' desc' : '')
this.getList(1)
},
getList(num) {
//列表
this.listLoading = true;
this.listQuery.pageNum = num ? num : this.listQuery.pageNum
contactListAPI(this.listQuery).then(res => {
if (res.data.code === 0) {
this.dataList = res.data.data.list?res.data.data.list:[];
this.total = res.data.data.total?res.data.data.total:0;
} else {
this.$message.error("获取数据失败");
}
this.listLoading = false;
}).catch(res => {
this.listLoading = false
this.$message.error(res.msg)
});
},
removeData(id) {
//删除数据
let arr = [];
arr.push(id);
confirm.apply(this, ["确定要删除选择的经销商信息吗?"]).then(() => {
contactDeleteAPI(arr).then(res => {
if (res.data.code !== 0) {
this.$message.error(res.data.msg);
return;
}
this.$message.success("删除成功");
this.getList();
});
});
},
sizeChange(val) {
this.listQuery.pageSize = val;
this.getList();
},
currentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
}
}
</script>
<style scoped lang="scss">
@import '@/styles/top_common.scss';
.cover_img{
width: 28px;
height: 38px;
}
</style>
<style>
.el-input-group__append, .el-input-group__prepend{
background: #fff !important;
border: none !important;
}
</style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论