Commit d4979ab2 authored by Mac's avatar Mac

客户阶段的新增

parent 81bd283b
......@@ -503,6 +503,17 @@ export function SetSynvEduEmployee(data) {
})
}
/**
* 保存客户阶段流程
*
*/
export function setCustomerStageFlowInfo(data) {
return request({
url: '/QYCustomer/SetCustomerStageFlowInfo',
method: 'post',
data
})
}
......
......@@ -21,9 +21,45 @@
border-left: 3px solid #3470ff;
margin-bottom: 20px;
margin-left: -20px;
padding-left: 20px;
padding: 0 20px;
display: flex;
align-items: center;
justify-content: space-between;
}
.addPhase .all-stage {
width: 300px;
padding: 20px 45px;
border: 1px solid #d7d7d7;
border-radius: 8px;
min-height: 260px;
}
.addPhase .select-item-title {
font-size: 14px;
font-weight: 800;
padding-bottom: 10px;
}
.addPhase .right-arrow {
width: 28px;
height: 28px;
background: #e7e7e7;
border-radius: 50%;
align-self: center;
line-height: 28px;
text-align: center;
color: #fff;
font-size: 16px;
margin: 0 30px;
}
.addPhase .user_lists {
width: 100%;
display: flex;
flex-wrap: wrap;
margin-top: 20px;
}
</style>
<template>
......@@ -36,16 +72,55 @@
<div class="box">
<div class="bold">阶段适用范围</div>
<q-btn class="q-mr-md" label="选择部门/成员" @click="outerVisible = true" />
<div class="user_lists" v-if="showMember && showMember.length>0">
<div v-for="(x,y) in showMember" :key='y'>
<el-tag style="margin-right: 15px;" v-if="x.DataType==1"><i class="el-icon-folder"
style="margin-right: 3px;"></i>{{x.DeptName}}</el-tag>
<el-tag style="margin-right: 15px;" type="success" v-if="x.DataType==2"><i class="el-icon-user-solid"
style="margin-right: 3px;"></i>{{x.DeptName}}</el-tag>
</div>
</div>
</div>
<div class="box">
<div class="bold">选择使用阶段</div>
<div class="bold">选择使用阶段
<span style="font-size: 14px;font-weight: 300;color:rgb(133, 133, 152);">
若没有找到可选项,请前往 <span style="color:#3470ff;cursor: pointer;" @click="stageManagement"> "阶段管理"</span>进行</span>
</div>
<div style="display:flex;align-items: center;">
<div class="all-stage" :style="{height:getheight+'px'}">
<p class="select-item-title">全部阶段</p>
<div class="" v-for="(x,y) in StageList" :key='y' v-if="x.Type==1">
<q-checkbox v-model="addMsg.UseStage" :val="x.Id" :label="x.Name" :disable="x.IsDefault==0?false:true"
@input="getusestageName" />
</div>
</div>
<div class="right-arrow"><i class="el-icon-arrow-right"></i></div>
<div class="all-stage" :style="{height:getheight+'px'}">
<p class="select-item-title">已选阶段</p>
<div style="height:40px;line-height: 40px;" v-for="(x,y) in UseStageName" :key='y' v-if="x.IsDefault==0">
<span>{{x.Name}}</span>
</div>
<div style="height:40px;line-height: 40px;" v-for="(x,y) in UseStageName" :key='y' v-if="x.IsDefault==1">
<span style="color: #ccc;">{{x.Name}}</span>
</div>
</div>
</div>
</div>
<div v-if="StageList">
<div class="box" v-for="(x,y) in StageList" v-if="x.Type==2">
<div class="bold" v-if="x.Name=='已输单'">选择输单原因</div>
<div class="bold" v-if="x.Name=='无效'">选择无效原因</div>
<div class="bold" v-if="x.Name=='已输单'">选择输单原因
<span style="font-size: 14px;font-weight: 300;color:rgb(133, 133, 152);">若没有找到可选项,请前往 <span
style="color:#3470ff;cursor: pointer;" @click="stageManagement"> "阶段管理"</span>进行</span>
</div>
<div class="bold" v-if="x.Name=='无效'">
选择无效原因
<span style="font-size: 14px;font-weight: 300;color:rgb(133, 133, 152);">若没有找到可选项,请前往 <span
style="color:#3470ff;cursor: pointer;" @click="stageManagement"> "阶段管理"</span>进行</span>
</div>
<div style="display:flex;align-items: center;flex-wrap: wrap;">
<q-checkbox v-model="addMsg.LoseCause" v-if="x.Name=='已输单'" v-for="(item,index) in x.OptionsList" :key='index'
:val="item.Id" :label="item.Name" />
......@@ -63,8 +138,8 @@
</q-card-actions>
</div>
<!-- 人员/部门选择 -->
<choiceapprovalorbranch v-if="outerVisible" @close="outerVisible = false" @success="getsuccess2" :byval='showMember'
cptype="1"></choiceapprovalorbranch>
<choiceapprovalorbranch v-if="outerVisible" @close="outerVisible = false" @success="getsuccess2" :list=showMember
:byval='defaultlist' cptype="1"></choiceapprovalorbranch>
</div>
</template>
......@@ -72,7 +147,7 @@
import choiceapprovalorbranch from './components/choiceapprovalorbranch'
import {
getCustomerStageList,
setCustomerStageFlowInfo
} from '../../../../api/system/wechat';
export default {
meta: {
......@@ -88,14 +163,19 @@
loading: false,
outerVisible: false,
addMsg: {
Id: 0,
FlowName: '',
DeptEmpList: [],
UseStage: '',
UseStage: [],
LoseCause: [],
InvalidCause: [],
},
showMember: [],
defaultlist: [],
StageList: [],
UseStageName: [],
getheight: 270,
gettypeoneList: [],//跟进阶段的数量
}
},
created() {
......@@ -105,19 +185,122 @@
goblck() { //返回上一个页面
this.$router.go(-1); //返回上一层
},
savemove() {},
savemove() {
let data = JSON.parse(JSON.stringify(this.addMsg))
if (data.FlowName == '') {
this.$q.notify({
type: 'negative',
message: '请填写名称',
position: 'top'
})
return
}
if (this.showMember.length == 0) {//判断部门
this.$q.notify({
type: 'negative',
message: '请选择阶段适用范围',
position: 'top'
})
return
} else {
data.DeptEmpList = [];
if (this.showMember && this.showMember.length > 0) {
this.showMember.forEach(x => {
let obj = {
Id: x.DeptId,
Name: x.DeptName,
Type: x.DataType,
}
data.DeptEmpList.push(obj)
})
}
}
if (data.UseStage.length > 0) {
data.UseStage = data.UseStage.join(',')
} else {
data.UseStage = ''
}
if (data.LoseCause.length > 0) {
data.LoseCause = data.LoseCause.join(',')
} else {
data.LoseCause = ''
}
if (data.InvalidCause.length > 0) {
data.InvalidCause = data.InvalidCause.join(',')
} else {
data.InvalidCause = ''
}
console.log(data)
this.loading = true
setCustomerStageFlowInfo(data).then(res => {
this.loading = false
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: res.Message,
position: 'top'
})
this.goblck()
}
})
},
getCustomerStageList() {
getCustomerStageList({}).then(res => {
this.loading = false
if (res.Code == 1) {
this.StageList = res.Data
this.StageList = res.Data;
this.gettypeoneList = []
this.StageList.forEach(x => {
if (x.Type == 1) {
if (x.IsDefault == 1) {
this.addMsg.UseStage.push(x.Id)
}
this.gettypeoneList.push(x)
}
})
if (this.gettypeoneList.length > 5) {//阶段数量大于5个的时候
this.getheight = 71 + Number(this.gettypeoneList.length) * 40
}
this.getusestageName()
}
})
},
getsuccess2(list, type) {
getsuccess2(list, defaultlist) {
this.showMember = list
this.outerVisible = false
this.defaultlist = defaultlist
},
stageManagement() {//跳转到阶段管理
this.$router.push({
path: '/enterprise/customer/CSChild/stageManagement',
});
},
compare(property) {
return function (a, b) {
var value1 = a[property];
var value2 = b[property];
return value1 - value2;
}
},
getusestageName() {
this.UseStageName = []
if (this.addMsg.UseStage && this.addMsg.UseStage.length > 0) {
this.addMsg.UseStage.forEach(x => {
this.StageList.forEach(j => {
if (x == j.Id) {
this.UseStageName.push(j)
}
})
})
this.UseStageName = this.UseStageName.sort(this.compare('Sort'))
}
}
}
}
</script>
\ No newline at end of file
......@@ -28,48 +28,53 @@
display: flex;
align-items: center;
margin-top: 24px;
margin-left: 56px;;
margin-left: 56px;
;
margin-bottom: 30px;
}
</style>
<template>
<div class="stageManagement" style="background: transparent;">
<div class="box">
<div class="bold" style="margin-bottom: 30px;">跟进阶段</div>
<ul v-for="(x,y) in addMsg" :key="y" v-if="x.Type==1">
<div v-if="x.IsDefault==0">
<draggable v-model="x.OptionsList">
<li v-for="(item,index) in x.OptionsList" :key="index">
<draggable v-model="followupStage">
<ul v-for="(x,y) in followupStage" :key="y">
<div v-if="x.IsDefault==0">
<li>
<div style="width: 57px;">
<i class="iconfont icon-weiyi" style="font-size: 14px;color: #777;margin: 0 10px;"></i>
</div>
<q-input clearable debounce filled maxlength="10" counter v-model="item.Name" style="width:500px"
<q-input clearable debounce filled maxlength="10" counter v-model="x.Name" style="width:500px"
@input="$forceUpdate()" placeholder="名称" :rules="[val => !!val || '不能为空']" />
<q-btn flat size="sm" icon="delete" color="negative" class="q-mr-xs" style="margin-left: 10px;" label=""
@click="addMsg[y].OptionsList.splice(index,1)" />
@click="followupStage.splice(y,1)" />
</li>
</draggable>
<div class="btn">
<q-btn v-if="x.OptionsList.length<30" color="accent" class="q-mr-md" label="添加" icon='add'
@click="addMsg[y].OptionsList.push({Id:0,Name:'',disable:false}),$forceUpdate()" style="width: 100px;" />
<span style="color:#858598"> 已设/可设上限:{{x.OptionsList.length}}/30 </span>
</div>
</div>
<div v-if="x.IsDefault==1">
<li v-for="(item,index) in x.OptionsList" :key="index">
<div style="width: 57px;">
</div>
<q-input clearable debounce filled v-model="item.Name" style="width:500px" disable @input="$forceUpdate()"
placeholder="名称" :rules="[val => !!val || '不能为空']" />
</li>
</div>
</ul>
</draggable>
<ul>
<li v-for="(x,y) in followupStage_d" :key="y">
<div style="width: 57px;">
</div>
<q-input clearable debounce filled v-model="x.Name" style="width:500px" disable @input="$forceUpdate()"
placeholder="名称" :rules="[val => !!val || '不能为空']" />
</li>
</ul>
<div class="btn">
<q-btn v-if="followupStage.length<30" color="accent" class="q-mr-md" label="添加" icon='add' @click="followupStage.push({Id: 0,
IsDefault: 0,
Name: '',
OptionsList: [],
Sort: 0,
Type: 1}),$forceUpdate()" style="width: 100px;" />
<span style="color:#858598"> 已设/可设上限:{{followupStage.length}}/30 </span>
</div>
</div>
<div class="box">
<div class="bold">结束跟进</div>
<div v-for="(x,y) in addMsg" :key="y" v-if="x.Type==2">
<div v-for="(x,y) in reasonList" :key="y" v-if="x.Type==2">
<ul style="margin-left: 30px;margin-top: 10px;">
<li>
<q-input clearable filled debounce placeholder="名称" v-model="x.Name" style="width:500px" disable />
......@@ -84,13 +89,14 @@
<q-input clearable debounce filled maxlength="10" counter v-model="item.Name" style="width:500px"
@input="$forceUpdate()" placeholder="名称" :rules="[val => !!val || '不能为空']" />
<q-btn flat size="sm" icon="delete" color="negative" class="q-mr-xs" style="margin-left: 10px;" label=""
@click="addMsg[y].OptionsList.splice(index,1)" />
@click="reasonList[y].OptionsList.splice(index,1)" />
</li>
</draggable>
</ul>
<div class="btn" style="margin-left: 61px">
<q-btn v-if="x.OptionsList.length<30" color="accent" class="q-mr-md" label="添加" icon='add'
@click="addMsg[y].OptionsList.push({Id:0,Name:'',disable:false}),$forceUpdate()" style="width: 100px;" />
@click="reasonList[y].OptionsList.push({Id:0,Name:'',disable:false}),$forceUpdate()"
style="width: 100px;" />
<span style="color:#858598"> 已设/可设上限:{{x.OptionsList.length}}/30 </span>
</div>
</div>
......@@ -124,6 +130,9 @@
return {
loading: false,
addMsg: [],
followupStage: [],
followupStage_d: [],
reasonList: []
}
},
created() {
......@@ -135,25 +144,23 @@
this.loading = false
if (res.Code == 1) {
this.addMsg = res.Data
let num = 0
let isexistence = false
this.followupStage = [];
this.followupStage_d = [];
this.reasonList = []
let orderEntered = false //判读是否有已输单
let invalid = false //无效
this.addMsg.forEach(x => {
let list = JSON.parse(JSON.stringify(this.addMsg))
list.forEach(x => {
if (x.Type == 1) {
num++
if (x.OptionsList && x.OptionsList.length > 0) {
for (let j = 0; j < x.OptionsList.length; j++) {
let z = x.OptionsList[j]
if (z.Name == '成交') { //判断是否有默认值
isexistence = true
break
}
}
if (x.IsDefault == 0) {
this.followupStage.push(x)
} else {
this.followupStage_d.push(x)
}
}
if (x.Type == 2) {
this.reasonList.push(x)
if (x.Name == '已输单') {
orderEntered = true
}
......@@ -162,49 +169,7 @@
}
}
})
if (num == 0) { //判断没有type==1的时候加2条数据
let obj = [{
Id: 0,
IsDefault: 0,
Name: '跟进阶段',
OptionsList: [],
Sort: 0,
Type: 1
},
{
Id: 0,
IsDefault: 1,
Name: '跟进阶段',
OptionsList: [{
Id: 0,
Name: '成交'
}, {
Id: 0,
Name: '多次成交'
}, ],
Sort: 0,
Type: 1
},
]
this.addMsg = this.addMsg.concat(obj)
}
if (num > 0 && isexistence == false) { //判断type==1有 但是没有默认值
let obj = {
Id: 0,
IsDefault: 1,
Name: '跟进阶段',
OptionsList: [{
Id: 0,
Name: '成交'
}, {
Id: 0,
Name: '多次成交'
}, ],
Sort: 0,
Type: 1
};
this.addMsg.unshift(obj)
}
if (orderEntered == false) { //没有的话 加一个已输单
let obj = {
Id: 0,
......@@ -214,7 +179,7 @@
Sort: 0,
Type: 2
};
this.addMsg.push(obj)
this.reasonList.push(obj)
}
if (invalid == false) { //没有的话 加一个无效
let obj = {
......@@ -225,7 +190,7 @@
Sort: 0,
Type: 2
};
this.addMsg.push(obj)
this.reasonList.push(obj)
}
}
})
......@@ -235,30 +200,44 @@
},
savemove() {
let show = false
for (let i = 0; i < this.addMsg.length; i++) {
let x = this.addMsg[i]
for (let i = 0; i < this.followupStage.length; i++) {//判断根据阶段的值填写没有
let x = this.followupStage[i]
if (x.Name == '') {
this.$q.notify({
type: 'negative',
message: '请填写跟进阶段列表选项值',
position: 'top'
})
return
break
}
}
for (let i = 0; i < this.reasonList.length; i++) {
let x = this.reasonList[i]
if (show == true) {
return
break
}
for (let j = 0; j < x.OptionsList.length; j++) {
let z = x.OptionsList[j]
z.Id=j+1
if (z.Name == '') {
let message = ''
if (x.Type == 1) {
message = '请填写跟进阶段列表选项值'
} else {
message = '请填写结束跟进列表选项值'
}
this.$q.notify({
type: 'negative',
message: message,
message: '请填写'+x.Name+'原因值',
position: 'top'
})
show = true
return
break
}
}
}
this.addMsg = []
this.addMsg = (this.followupStage.concat(this.followupStage_d)).concat(this.reasonList)
this.addMsg.forEach((x,i)=>{
x.Sort = i+1
})
this.loading = true
setCustomerStageInfo(this.addMsg).then(res => {
this.loading = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment