<template>
|
<div class="advance">
|
<el-dialog
|
:title="'推进'"
|
append-to-body
|
:visible.sync="commonConfig.visible"
|
:width="dialogWidth"
|
:before-close="handleClose"
|
custom-class="advance-dialog"
|
>
|
<div class="content">
|
<el-radio-group v-model="radio">
|
<div class="one">
|
<el-radio :label="1">
|
<span>推进到下一阶段</span>
|
<el-select v-model="value1" size="mini" disabled>
|
<el-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
|
</el-select>
|
</el-radio>
|
</div>
|
<div class="two">
|
<el-radio :label="2">
|
<span>推进到指定阶段</span>
|
<el-select v-model="value" size="mini" @change="designatedStageClick">
|
<el-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
|
</el-select>
|
<div v-if="value === '失败关闭'" class="reason">
|
<div class="label"><span style="color: red">*</span>原因</div>
|
<el-input class="input" type="textarea" :rows="2" placeholder="请输入内容" v-model="reason"></el-input>
|
</div>
|
</el-radio>
|
</div>
|
</el-radio-group>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" size="small" @click="saveClick()">推进</el-button>
|
<el-button size="small" @click="commonConfig.visible = false">取消</el-button>
|
</div>
|
<!-- 新建/编辑客户管理 -->
|
<AddClientManageDialog
|
v-if="editConfig.visible"
|
:edit-client-manage-config="editConfig"
|
@salesOpportunityClick="salesOpportunityClick"
|
/>
|
<!-- 新建/编辑销售机会 -->
|
<AddSalesOpportunityDialog v-if="editOpportunityConfig.visible" :edit-common-config="editOpportunityConfig" />
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { pushSalesSources } from "@/api/client/salesLead"
|
import AddClientManageDialog from "@/views/client/client/AddClientManageDialog"
|
import AddSalesOpportunityDialog from "@/views/sales/salesOpportunity/AddSalesOpportunityDialog"
|
export default {
|
name: "AdvanceDialog",
|
props: {
|
advanceConfig: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
infomation: {}
|
}
|
}
|
}
|
},
|
components: { AddClientManageDialog, AddSalesOpportunityDialog },
|
computed: {},
|
data() {
|
return {
|
dialogWidth: "25%",
|
radio: 1,
|
commonConfig: this.advanceConfig,
|
value1: "",
|
value: "",
|
options: [],
|
reason: "",
|
editConfig: {
|
visible: false,
|
title: "新建",
|
isSalesOpportunity: false,
|
infomation: {}
|
},
|
editOpportunityConfig: {
|
visible: false,
|
title: "新建",
|
infomation: {}
|
}
|
}
|
},
|
watch: {},
|
created() {
|
this.setData(this.advanceConfig.infomation.sales_status)
|
},
|
methods: {
|
setData(status) {
|
if (status === 0) {
|
this.options = ["跟进中", "失败关闭", "升级到客户", "升级到客户和销售机会"]
|
this.value = "跟进中"
|
this.value1 = "跟进中"
|
} else if (status === 1) {
|
this.options = ["失败关闭", "升级到客户", "升级到客户和销售机会"]
|
this.value = "失败关闭"
|
this.value1 = "失败关闭"
|
} else if (status === -1) {
|
this.options = ["升级到客户", "升级到客户和销售机会"]
|
this.value = "升级到客户"
|
this.value1 = "升级到客户"
|
}
|
},
|
handleClose() {
|
this.commonConfig.visible = false
|
if (this.value === "升级到客户和销售机会") {
|
this.$parent.getData()
|
}
|
},
|
designatedStageClick(val) {
|
console.log(val)
|
this.radio = 2
|
},
|
saveClick() {
|
console.log(this.value)
|
if (this.value === "跟进中") {
|
// val === '新建' ||
|
this.pushSalesSources(1)
|
} else if (this.value === "失败关闭") {
|
if (this.reason.length > 0) {
|
this.pushSalesSources(-1)
|
} else {
|
this.$message.warning("原因不能为空")
|
}
|
} else if (this.value === "升级到客户") {
|
this.$confirm('升级后将转入"客户管理"模块, 是否继续?', "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
this.editConfig.visible = true
|
this.editConfig.title = "新建"
|
this.editConfig.infomation = {
|
...this.commonConfig.infomation,
|
sales_leads_id: this.commonConfig.infomation.id
|
}
|
})
|
.catch(() => {})
|
} else if (this.value === "升级到客户和销售机会") {
|
this.$confirm('升级后将转入"客户管理"和"销售机会"模块, 是否继续?', "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
this.editConfig.visible = true
|
this.editConfig.title = "新建"
|
this.editConfig.isSalesOpportunity = true
|
this.editConfig.infomation = {
|
...this.commonConfig.infomation,
|
sales_leads_id: this.commonConfig.infomation.id
|
}
|
})
|
.catch(() => {})
|
}
|
},
|
// 推进接口
|
async pushSalesSources(step) {
|
await pushSalesSources({
|
id: this.commonConfig.infomation.id,
|
reason: this.reason,
|
step: step
|
}).then((res) => {
|
console.log(res)
|
this.$message.success("推进成功")
|
this.handleClose()
|
this.$parent.getData()
|
})
|
},
|
// 销售机会
|
salesOpportunityClick(item) {
|
console.log(item)
|
this.editOpportunityConfig.visible = true
|
this.editOpportunityConfig.title = "新建"
|
this.editOpportunityConfig.infomation = { client_name: item.name }
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
::v-deep {
|
.advance-dialog .el-dialog__body {
|
padding: 10px 20px;
|
.content {
|
.el-select {
|
margin-left: 10px;
|
}
|
.two {
|
margin-top: 15px;
|
.reason {
|
display: flex;
|
margin-top: 10px;
|
align-items: center;
|
.label {
|
width: 122px;
|
text-align: right;
|
}
|
.input {
|
margin-left: 10px;
|
width: 195px;
|
}
|
}
|
}
|
}
|
.dialog-footer {
|
background-color: #f5f5f5;
|
height: 55px;
|
line-height: 55px;
|
}
|
}
|
}
|
</style>
|