Commit 2011369e authored by yujinyao's avatar yujinyao

客户跟进

parent e6197a81
......@@ -59,3 +59,28 @@ export function exportCustomerFollowExcel(query) {
responseType: 'blob'
})
}
export function getCustomerFollowList(params) {
return request({
url: '/customer/followup/page',
method: 'get',
params
})
}
export function getCustomerFollowDetail(params) {
return request({
url: '/customer/followup/get',
method: 'get',
params
})
}
export function addCustomerFollow(data) {
return request({
url: '/customer/followup/create',
method: 'post',
data
})
}
......@@ -163,7 +163,10 @@ export const DICT_TYPE = {
CUSTOMER_GET_METHOD: 'customer_get_method', //获取方式
CUSTOMER_FROM: 'customer_from', //创建入口
CUSTOMER_ROLE: 'customer_role', //角色
MAJOR_COMPETITORS: 'major_competitors', //主要竞争对手
CUSTOMER_FOLLOWUP_TYPE: 'customer_followup_type', //跟进类型
CUSTOMER_FOLLOWUP_METHOD: 'customer_followup_method', //跟进方式
CUSTOMER_FOLLOWUP_RESULT_TYPE: 'customer_followup_result_type', //跟进结果
CUSTOMER_FOLLOWUP_STATUS: 'customer_followup_status', //跟进状态
// order
ORDER_TYPE: "order_type", // 订单类型
PRODUCT_RECORD_ATTRIBUTE: "product_record_attribute", //产品备案属性
......
<template>
<div>
<div style="display: flex;justify-content: right;margin-bottom: 15px">
<el-button type="primary" style="text-align: right" @click="customerFollow.dialogVisible = true">{{$t('新增')}}</el-button>
</div>
<el-table
:data="customerFollowList"
style="width: 100%"
>
<el-table-column
prop="number"
:label="$t('编号')"
>
</el-table-column>
<el-table-column
prop="followType"
:label="$t('跟进类型')"
:formatter="(row, column, cellValue) => getDictDataLabel(DICT_TYPE.CUSTOMER_FOLLOWUP_TYPE, cellValue)"
>
</el-table-column>
<el-table-column
prop="contactName"
:label="$t('联系人')"
>
</el-table-column>
<el-table-column
prop="followMethod"
:label="$t('跟进方式')"
:formatter="(row, column, cellValue) => getDictDataLabel(DICT_TYPE.CUSTOMER_FOLLOWUP_METHOD, cellValue)"
>
</el-table-column>
<el-table-column
prop="followTime"
:label="$t('跟进时间')"
:formatter="(row, column, cellValue) => parseTime(cellValue)"
>
</el-table-column>
<el-table-column
prop="feedback"
:label="$t('客户反馈')"
>
</el-table-column>
<el-table-column
prop="result"
:label="$t('处理结果')"
>
</el-table-column>
<el-table-column
prop="followUserName"
:label="$t('客户经理')"
>
</el-table-column>
<el-table-column :label="$t('跟进时间')" align="center">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.followTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('下次跟进时间')" align="center">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.nextTime ) }}</span>
</template>
</el-table-column>
<el-table-column width="200px" :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ecw:customer:follow-update']"
>{{ $t("编辑") }}</el-button
>
<el-button
size="mini"
v-has-permi="['ecw:customer:follow-add-plan']"
type="text"
icon="el-icon-collection"
@click="addPlan(scope.row)"
>{{ $t("增加计划") }}</el-button
>
</template>
</el-table-column>
</el-table>
<pagination :total="total" :page.sync="pageNo" :limit.sync="pageSize"
@pagination="getCustomerFollowList"/>
<el-dialog
append-to-body
:title="$t('客户跟进')"
:visible.sync="customerFollow.dialogVisible"
:close-on-click-modal="false"
:before-close="customerFollowClose"
width="900px">
<el-form ref="customerFollowForm" :model="form" label-width="120px">
<el-row :gutter="10">
<el-col :span="12">
<el-form-item :label="$t('编号')" prop="number">
<el-input
v-model="form.number"
:placeholder="$t('请输入编号')"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进状态')">
<el-select
v-model="form.status"
:placeholder="$t('请选择')"
disabled
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_STATUS)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('客户编号')">
<el-input
v-model="form.customerId"
:placeholder="$t('请输入客户编号')"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进类型')" required>
<el-select
v-model="form.followType"
:placeholder="$t('请选择')"
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_TYPE)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="13" v-if="form.followType == '2'">
<el-form-item :label="$t('报价单')">
<el-input
v-model="form.offerId"
:placeholder="$t('请输入报价单')"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进时间')" required>
<el-date-picker v-model="form.followTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" type="datetime" :placeholder="$t('选择跟进时间')"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('联系人')" required>
<el-select v-model="form.contactName" :placeholder="$t('请选择')">
<el-option
v-for="(item, index) in customerContactsList"
:key="index"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('客户经理')" required>
<el-select v-model="form.followUserId" :placeholder="$t('请选择')">
<el-option
v-for="item in serviceUserList"
:key="item.id"
:label="item.nickname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进方式')" required>
<dict-selector ref="dictMethod" v-model="form.followMethod" :type="DICT_TYPE.CUSTOMER_FOLLOWUP_METHOD"></dict-selector>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('上一级跟进单')" prop="parentNumber">
<el-input
v-model="form.parentNumber"
:placeholder="$t('请输入上一级跟进单')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进结果')" prop="followMethod">
<el-select
v-model="form.resultType"
:placeholder="$t('请选择')"
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_RESULT_TYPE)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('目的')" prop="purpose">
<el-input
type="textarea"
:rows="2"
v-model="form.purpose"
:placeholder="$t('请输入目的')"
maxlength="200"
show-word-limit
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('下一步计划')" prop="nextPlan">
<el-input
type="textarea"
:rows="2"
v-model="form.nextPlan"
:placeholder="$t('请输入下一步计划')"
/>
</el-form-item>
</el-col>
<el-col :span="20" v-show="false">
<el-form-item :label="$t('跟进情况')">
<div class="follow-deal">
【客户反馈:】<br />
{{ form.feedback }}<br />
【处理结果:】<br />
{{ form.result }}
</div>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('附件')" prop="attatchment">
<FileUpload :limit="5" :isShowTip="false" v-model="form.attatchment" :fileType="fileType" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('下次跟进时间')">
<el-date-picker
v-model="form.nextTime"
type="datetime"
value-format="timestamp"
:placeholder="$t('请选择')"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('创建人')" prop="founder">
<el-select v-model="form.founder" disabled>
<el-option
v-for="item in allSimplList"
:key="item.id"
:label="item.nickname"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('创建时间')" prop="createTime">
<el-date-picker
v-model="form.createTime"
type="datetime"
value-format="timestamp"
disabled
:placeholder="$t('选择创建时间')"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('最后更新人')">
<el-select v-model="form.updater" disabled>
<el-option
v-for="item in allSimplList"
:key="item.id"
:label="item.nickname"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('最后更新时间')">
<el-date-picker
v-model="form.updateTime"
type="datetime"
value-format="timestamp"
disabled
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="warning" @click="goBack">{{$t('返 回')}}</el-button>
<el-button type="primary" @click="customerFollowSubmit(0)">{{$t('保 存')}}</el-button>
<el-button type="success" @click="customerFollowSubmit(1)">{{$t('提交结果')}}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {createCustomerFollow, getCustomerFollowPage, getCustomerFollowPage2, addCustomerFollow, getCustomerFollowList} from "@/api/ecw/customerFollow"
import { DICT_TYPE, getDictDataLabel } from '@/utils/dict'
import { getCustomerContactsListByCustomer } from '@/api/ecw/customerContacts'
import {
listAllSimpl,
listServiceUser,
listSimpleUsers,
} from "@/api/system/user";
import { parseTime } from '@/utils/ruoyi'
import FileUpload from "@/components/FileUpload";
export default {
/**
* 客户跟进
* 客户投诉跟进
*/
name: "CustomerFollow",
props: {
/**
* 如果是客户投诉跟进,则id为客户投诉id;如果是客户跟进,则id为客户id
*/
id: Number,
customerId: Number,
customerQuery:{
type:Boolean,
default:false
}
},
components: { FileUpload },
data() {
return {
fileType: ["doc","xls","ppt","txt","pdf","png","jpg","jpeg"],
DICT_TYPE,
getDictDataLabel,
parseTime,
customerFollowList: [],
serviceUserList: [],
customerContactsList: [],
customerFollow: {
dialogVisible: false,
form: {
followType:'3'
}
},
form: {},
pageNo:1,
pageSize:10,
total:10,
allSimplList: [],
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now()
}
}
}
},
computed: {
isChinese(){
return this.$i18n.locale === 'zh_CN'
}
},
created() {
// this.resetCustomerFollowForm()
if (!!this.customerId) getCustomerContactsListByCustomer({customerId: this.customerId}).then(r => {
this.customerContactsList = r.data
this.form.customerId = this.customerId
this.form.bizId = this.id
})
listServiceUser().then(r => {
// console.log( r.data,'r.data跟进业务')
this.serviceUserList = r.data
})
listAllSimpl().then((r) => {
this.allSimplList = r.data;
});
this.getCustomerFollowList()
this.reset()
},
methods: {
reset() {
this.form = {
attatchment: undefined,
contactName: undefined,
customerId: 0,
feedback: undefined,
followMethod: undefined,
followTime: undefined,
followType: undefined,
followUserId: undefined,
nextPlan: undefined,
nextTime: undefined,
number: undefined,
offerId: undefined,
parentNumber: undefined,
purpose: undefined,
resultType: undefined,
status: undefined,
founder: this.$store.getters.userId,
createTime: new Date().getTime(),
updater: this.$store.getters.userId,
updateTime: new Date().getTime()
};
},
customerFollowSubmit(status) {
console.log(this.form)
this.$refs["customerFollowForm"].validate(valid => {
if (!valid) {
return
}
if(!this.form.followType){
this.$modal.msgError("请选择跟进类型");
return
}
if(!this.form.followTime){
this.$modal.msgError(this.$t('请选择跟进时间'));
return
}
if(!this.form.contactName){
this.$modal.msgError(this.$t('请选择联系人'));
return
}
if(!this.form.followUserId){
this.$modal.msgError(this.$t('请选择跟进业务'));
return
}
if(!this.form.followMethod){
this.$modal.msgError(this.$t('请选择跟进方式'));
return
}
if (status == 0) {
this.saveSubmitData(status)
} else {
this.$confirm(this.$t('提交后无法修改'), this.$t('提示'), {
confirmButtonText: this.$t('确定'),
cancelButtonText: this.$t('取消'),
type: 'warning'
}).then(() => {
this.saveSubmitData(status)
})
}
})
},
saveSubmitData(status) {
addCustomerFollow({
...this.form,
status
}).then(r => {
this.customerFollowClose()
this.getCustomerFollowList()
})
},
goBack() {
this.$confirm(this.$t('是否确认不保存信息'), this.$t('提示'), {
confirmButtonText: this.$t('确定'),
cancelButtonText: this.$t('取消'),
type: 'warning'
}).then(() => {
this.customerFollowClose()
})
},
customerFollowClose(){
this.resetCustomerFollowForm()
this.customerFollow.dialogVisible = false
},
resetCustomerFollowForm() {
this.reset()
// this.$refs.dictType.changeValue(this.customerFollow.form.followType);
this.$refs.dictMethod.changeValue(this.customerFollow.form.followMethod);
},
getCustomerFollowList() {
if(this.customerQuery){
getCustomerFollowList({customerId: this.customerId,pageNo:this.pageNo,pageSize:this.pageSize}).then(r => {
this.customerFollowList = r.data.list;
this.total = r.data.total;
})
}else {
getCustomerFollowPage2({bizId: this.id,followType:3,pageNo:this.pageNo,pageSize:this.pageSize}).then(r => {
this.customerFollowList = r.data.list;
this.total = r.data.total;
})
}
},
handleUpdate() {
//
},
addPlan() {
//
}
}
}
</script>
<style scoped>
</style>
<template xmlns="">
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-row :gutter="10">
<el-col :span="12">
<el-form-item :label="$t('编号')" prop="name">
<el-input
v-model="form.name"
:placeholder="$t('请输入编号')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进状态')">
<el-select
v-model="form.status"
:placeholder="$t('请选择')"
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_STATUS)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('客户编号')" prop="source">
<el-input
v-model="form.name"
:placeholder="$t('请输入客户名称')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进类型')" prop="followType">
<el-select
v-model="form.followType"
:placeholder="$t('请选择')"
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_TYPE)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="13">
<el-form-item :label="$t('报价单')">
<el-input
v-model="form.offerId"
:placeholder="$t('请输入报价单')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进时间')">
<el-date-picker
v-model="form.followTime"
type="datetime"
:placeholder="$t('请选择')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('联系人')" prop="source">
<el-input
v-model="form.name"
:placeholder="$t('请输入客户名称')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('客户经理')" prop="followUserId">
<el-select
v-model="form.followUserId"
:placeholder="$t('请选择客户经理')"
>
<el-option
v-for="item in serviceUserList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进方式')" prop="followMethod">
<el-select
v-model="form.followMethod"
:placeholder="$t('请选择')"
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_METHOD)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('上一级跟进单')" prop="parentNumber">
<el-input
v-model="form.parentNumber"
:placeholder="$t('请输入上一级跟进单')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('目的')" prop="purpose">
<el-input
type="textarea"
:rows="2"
v-model="form.purpose"
:placeholder="$t('请输入目的')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('跟进结果')" prop="followMethod">
<el-select
v-model="form.resultType"
:placeholder="$t('请选择')"
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_RESULT_TYPE)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('情况')" prop="address">
<el-input
v-model="form.address"
:placeholder="$t('请输入联系地址')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('附件')" prop="attatchment">
<FileUpload :limit="1" :isShowTip=false v-model="form.attatchment" :fileType="fileType" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('下次跟进时间')">
<el-date-picker
v-model="form.nextTime"
type="datetime"
value-format="timestamp"
disabled
:placeholder="$t('选择创建时间')"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('下一步计划')" prop="nextPlan">
<el-input
type="textarea"
:rows="2"
v-model="form.nextPlan"
:placeholder="$t('请输入下一步计划')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('创建人')" prop="founder">
<el-select v-model="form.founder" disabled>
<el-option
v-for="item in allSimplList"
:key="item.id"
:label="item.nickname"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('创建时间')" prop="createTime">
<el-date-picker
v-model="form.createTime"
type="datetime"
value-format="timestamp"
disabled
:placeholder="$t('选择创建时间')"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('最后更新人')">
<el-select v-model="form.updater" disabled>
<el-option
v-for="item in allSimplList"
:key="item.id"
:label="item.nickname"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('最后更新时间')">
<el-date-picker
v-model="form.updateTime"
type="datetime"
value-format="timestamp"
disabled
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="margin-top: 15px; text-align: center">
<el-button type="warning" @click="goBack">{{
$t("返 回")
}}</el-button>
<el-button type="primary" @click="submitForm">{{
$t("保 存")
}}</el-button>
<el-button type="success" @click="submitResult">{{ $t("提交结果") }}</el-button>
</div>
</div>
</template>
<script>
import { getDictDatas, DICT_TYPE } from "@/utils/dict";
import upload from "@/components/ImageUpload";
import FileUpload from "@/components/FileUpload";
import {
createCustomer,
getCustomer,
getCustomerList,
getCustomerPage,
memberUserList,
updateCustomer,
userMemberUserList,
getCustomerLines,
fillupCustomeInfo,
getServiceNetwork,
addCompetitor,
competitorListAll
} from "@/api/ecw/customer";
import { getNodeList } from "@/api/ecw/node";
import { getProductTypeList } from "@/api/ecw/productType";
import { getProductList } from "@/api/ecw/product";
import { getTradeCityList } from "@/api/ecw/region";
import { getWarehouseList } from "@/api/ecw/warehouse";
import CustomerLineTable from "@/components/CustomerLineTable";
import { getCustomerSelect } from "@/api/ecw/customer";
import {
listAllSimpl,
listServiceUser,
listSimpleUsers,
} from "@/api/system/user";
import { getZhongPaoBest, getZhongPaoPage } from "@/api/ecw/zhongPao";
import { getCustomerContactsListByCustomer } from "@/api/ecw/customerContacts";
import { getCountryListAll } from "@/api/ecw/country";
import Template from "@/views/cms/template";
import { validatorMobile } from "@/api/ecw/validate";
// import {customerDropDownList} from "@/api/ecw/customerCommissionInfo";
import MemberSelector from "@/components/MemberSelector";
import { getCurrencyList } from "@/api/ecw/currency";
export default {
name: "EcwCustomerEdit",
components: {
Template,
upload,
CustomerLineTable,
MemberSelector,
FileUpload
},
created() {
this.reset();
listServiceUser().then((r) => {
this.serviceUserList = r.data;
})
},
data() {
return {
fileTypes: ["doc","xls","ppt","txt","pdf","png","jpg","jpeg"],
getDictDatas,
DICT_TYPE,
// 表单参数
form: {},
// 表单校验
rules: {
name: [
{
required: true,
message: this.$t("客户名称不能为空"),
trigger: "blur",
},
],
country: [
{ required: true, message: this.$t("国家不能为空"), trigger: "blur" },
],
level: [
{
required: true,
message: this.$t("客户等级不能为空"),
trigger: "blur",
},
],
type: [
{
required: true,
message: this.$t("客户类别不能为空"),
trigger: "blur",
},
],
createTime: [
{
required: true,
message: this.$t("创建时间不能为空"),
trigger: "blur",
},
],
source: [
{
required: true,
message: this.$t("客户来源不能为空"),
trigger: "blur",
},
],
customerService: [
{
required: this.customerId === "0",
message: this.$t("客户经理不能为空"),
trigger: "blur",
},
],
status: [
{
required: true,
message: this.$t("客户状态不能为空"),
trigger: "blur",
},
],
busiCountryIds: [
{
required: true,
message: this.$t("请选择业务国家"),
trigger: "change",
},
],
competitorIds: [
{
required: true,
message: this.$t("请选择主要竞争对手"),
trigger: "change",
},
],
},
contactRules: {
name: [
{ required: true, message: this.$t("请输入联系人"), trigger: "blur" },
],
areaCode: [
{ required: true, message: this.$t("请选择区号"), trigger: "change" },
{
required: true,
trigger: "change",
validator: this.codeValidator,
},
],
phoneNew: [
{
required: true,
trigger: "blur",
validator: this.phoneValidator,
},
],
},
// 网点
nodeList: [],
productTypeList: [],
productList: [],
showZhong: false,
showZhong1: false,
showPao: false,
showPao1: false,
warehouseList: [], // 仓库列表
importCityList: [], // 进口地址
customerSelect: [],
recommended: [],
serviceUserList: [],
countryList: [],
zhongLines: [], // 重货线路
paoLines: [], // 泡货线路
memberList: [], //会员列表
selectMemberList: [], //选中会员列表
serviceNetworkList: [], //网点列表
allSimplList: [],
currecyList: [],
enterOpenSeaTime: undefined,
showBaseFlag: true,
showShippingFlag: true,
showSettingFlag: true,
showFinanceFlag: true,
competitorList: [],
};
},
methods: {
addEmail(row) {
row.push("");
},
deleteEmail(row, index) {
row.splice(index, 1);
},
change(val) {
this.form.productIds = [];
this.getProductListFn(val);
},
getProductListFn(val) {
getProductList({ typeId: val }).then((r) => {
this.productList = r.data;
});
},
deleteBankData(index) {
this.form.customerBanks.splice(index, 1);
},
remoteMethod(val) {
this.getCustomerSelect(val);
},
getCustomerSelect(val = "") {
getCustomerSelect({ pageNo: 1, pageSize: 30, searchKey: val }).then(
(res) => {
this.customerSelect = res.data.list;
}
);
},
phoneValidator(rule, value, callback) {
if (!value) {
return callback(new Error(this.$t("请输入联系方式")));
}
let areaCode = this.form.customerContacts.find(
(e) => e.phoneNew === value
).areaCode;
if (areaCode) {
validatorMobile({
code: areaCode,
mobile: value,
})
.then((r) => {
if (r.data) {
callback();
} else {
callback(new Error(r.msg || this.$t("手机号验证失败")));
}
})
.catch((e) => {
console.error(e);
callback(new Error(this.$t("手机号验证失败")));
});
}
},
codeValidator(rule, value, callback) {
let index = +rule.field.split(".")[1];
let phone = this.form.customerContacts[index].phoneNew;
if (phone) {
validatorMobile({
code: value,
mobile: phone,
})
.then((r) => {
if (r.data) {
callback();
} else {
callback();
this.$message.error(r.msg || this.$t("手机号验证失败"));
}
})
.catch((e) => {
console.error(e);
callback();
this.$message.error(this.$t("手机号验证失败"));
});
}
},
handleDefaultChange($index) {
// 只有一个联系人,设置成非默认
if (
this.form.customerContacts.length === 1 &&
this.form.customerContacts[0].isDefault === 0
) {
this.$modal.msgWarning(this.$t("至少拥有一个默认联系人"));
this.form.customerContacts[0].isDefault = 1;
return;
}
// 设置默认联系人
if (this.form.customerContacts[$index].isDefault === 1) {
// 其他的置否
let i = 0;
this.form.customerContacts.forEach((e) => {
if (i !== $index) {
e.isDefault = 0;
}
i++;
});
} else {
// 第一个置是
this.form.customerContacts[0].isDefault = 1;
}
},
cancel() {
this.$tab.closePage();
this.open = false;
this.reset();
},
/** 提交按钮 */
submitForm() {
if (this.form.customerContacts.length === 0) {
this.$modal.alert(this.$t("至少添加一位联系人"));
return;
}
this.$refs["contactForm"].validate((valid1, err1) => {
this.$refs["form"].validate((valid2, err2) => {
this.$refs.bankForm.validate((valid3, err3) => {
console.log(valid3, "valid3");
if (!valid1 || !valid2 || !valid3) {
this.$showFormValidateErrors({ ...err1, ...err2, ...err3 });
return;
}
if (this.form.customerContacts.length === 0) {
this.$modal.msgError(this.$t("至少填写一个联系人信息"));
return;
}
if (this.form.competitorIds == 0) {
this.$modal.msgError(this.$t("请重新选择主要竞争对手"));
return;
}
// 重货标准和泡货标准,未打开就不传,提交前清空一下
if (!this.showZhong) {
this.form.weightUnit = null;
this.zhongLines = [];
}
if (!this.showZhong1) {
this.zhongLines = [];
}
if (!this.showPao) {
this.form.lightUnit = null;
this.paoLines = [];
}
if (!this.showPao1) {
this.paoLines = [];
}
this.updateCustomerLines();
const form = {
...this.form,
type: this.form.type?.join(","),
transportType: (this.form.transportType || [])?.join(","),
taxRate: Number(this.form.taxRate),
roles: (this.form.roles || [])?.join(","),
pickupPoints: (this.form.pickupPoints || [])?.join(","),
productIds: (this.form.productIds || [])?.join(","),
busiCountryIds: (this.form.busiCountryIds || [])?.join(","),
noConsignee: undefined,
defaultPay: undefined,
defaultBilling: undefined,
};
form.customerContacts = JSON.parse(
JSON.stringify(this.form.customerContacts)
);
form.customerContacts.forEach((e) => {
e.email = [...e.email].filter((i) => i !== "").join(",");
});
// 检查路线是否启用了但是没选择目的仓
let errors = 0;
form.customerLines.forEach((line) => {
if (!line.objectiveIds || line.objectiveIds == "") {
errors++;
}
});
if (errors) {
return this.$message.error("有两条路线未选择目的地");
}
//我的客户页面跳转直接,完善客户
if (this.isCustomerServiceConfirmed) {
form.isCustomerServiceConfirmed = this.isCustomerServiceConfirmed;
}
// 修改的提交
if (this.form.id != null) {
this.form.customerContacts.forEach((e) => {
e.customerId = this.customerId;
});
console.log(this.form)
if (this.$route.name === "perfect") {
fillupCustomeInfo(form).then((r) => {
this.$modal.msgSuccess(this.$t("修改成功"));
this.open = false;
const obj = { path: "/customer/customer" };
this.$tab.closeOpenPage(obj);
});
} else {
updateCustomer(form).then((response) => {
this.$modal.msgSuccess(this.$t("修改成功"));
this.open = false;
// this.getList();
const obj = { path: "/customer/customer" };
this.$tab.closeOpenPage(obj);
});
}
return;
}
// 添加的提交
createCustomer(form).then((response) => {
this.$modal.msgSuccess(this.$t("新增成功"));
this.open = false;
// this.getList();
const obj = { path: "/customer/customer" };
this.$tab.closeOpenPage(obj);
});
});
});
});
},
/** 表单重置 */
reset() {
this.form = {
inquiry: undefined,
id: undefined,
number: undefined,
name: undefined,
nameEn: undefined,
level: 1,
country: undefined,
type: undefined,
transportType: [],
agentId: undefined,
company: undefined,
companyEn: undefined,
payerName: undefined,
address: undefined,
productType: undefined,
// productId: undefined,
// pickupPoint: undefined,
pickupPoints: [],
productIds: [],
memberId: undefined,
birthday: undefined,
balance: undefined,
source: undefined,
picture: undefined,
customerService: undefined,
customerContacts: [],
customerLines: [],
lightUnit: undefined,
promoter: undefined,
status: 1,
founder: this.$store.getters.userId,
department: undefined,
invoiceTitle: undefined,
licenseNumber: undefined,
bank: undefined,
bankNumber: undefined,
project: undefined,
billingAddress: undefined,
billingTell: undefined,
taxRate: undefined,
remarks: undefined,
arrivalConfirm: undefined,
weightUnit: undefined,
createTime: undefined,
isShowTidanPrice: true,
carName: undefined,
carNo: undefined,
customerBanks: [],
isNew: true,// 业绩类型
firstDealTime: undefined,// 首次成交时间
// estimateEnterOpenSeaTime: undefined,// 掉入公海时间
getMethod: undefined,// 获取方式
createFrom: undefined,// 创建入口
catchTime: undefined,//捞取时间
customerServiceConfirmedTime: undefined,//归属时间
updater: this.$store.getters.userId,// 更新人
updateTime: undefined,// 更新时间
roles: undefined,// 客户角色
busiCountryIds: undefined,// 业务国家
competitorIds: undefined,// 主要竞争对手
weightYearly: undefined,// 年度发货量
numYearly: undefined,// 年度发货次数
noConsignee: false,// 控制无收货人
defaultPay: false,// 默认付款
defaultBilling: false,// 默认开票
};
this.form.createTime = new Date().getTime();
this.form.updateTime = new Date().getTime();
this.resetForm("form");
},
getCustomer(id) {
return getCustomer(id).then((response) => {
console.log(response, "response");
this.form = {
...this.form,
...response.data,
id: this.customerId,
transportType:
response.data.transportType && response.data.transportType !== ""
? response.data.transportType.split(",")
: [],
customerBanks: response.data.customerBankBackVOList,
roles: response.data.roles? response.data.roles.split(",") : [],
pickupPoints: this.stringArrToNumberArr(response.data.pickupPoints),
productIds: this.stringArrToNumberArr(response.data.productIds),
busiCountryIds: this.stringArrToNumberArr(response.data.busiCountryIds),
competitorIds: Number(response.data.competitorIds)
};
if (this.form.productType) {
console.log("1231", this.form.productType);
this.getProductListFn(this.form.productType);
}
console.log(this.form)
this.open = true;
this.title = this.$t("修改客户");
this.$forceUpdate()
this.getZhongPao();
});
},
stringArrToNumberArr(data) {
if (data) {
const strArr = data.split(",")
const numArr = strArr.map(item => Number(item))
return numArr
} else {
return []
}
},
updateCustomerLines() {
let zhongLines = [],
paoLines = [];
if (this.zhongLines.length > 0) {
zhongLines = this.zhongLines;
}
if (this.paoLines.length > 0) {
paoLines = this.paoLines;
}
this.form.customerLines = [...zhongLines, ...paoLines];
},
handleAddContact() {
this.form.customerContacts.push({
areaCode: "",
// "customerId": 0,q
department: "",
email: [""],
isDefault: this.form.customerContacts.length === 0 ? 1 : 0,
name: "",
phoneNew: "",
position: "",
social: undefined,
socialNumber: "",
userid: undefined,
nameEn: "",
// "username": ""
});
},
handleDeleteContact($index) {
this.form.customerContacts.splice($index, 1);
if (this.form.customerContacts.length > 0) {
this.$refs["contactForm"].clearValidate();
if (!this.form.customerContacts.find((e) => e.isDefault)) {
this.form.customerContacts[0].isDefault = 1;
}
}
},
getZhongPao() {
getZhongPaoBest({
customerId: this.customerId,
// departureId: this.departureId,
// objectiveId: this.objectiveId
}).then((r) => {
if (!this.form.weightUnit) this.form.weightUnit = r.data.zhongEdge;
if (!this.form.lightUnit) this.form.lightUnit = r.data.paoEdge;
});
},
getCompetitorList() {
competitorListAll().then((r) => {
this.competitorList = r.data;
})
},
changeCompetitor(val) {
if (val == 0) {
this.$prompt("请输入主要竞争对手", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
}).then((data) => {
console.log(data)
addCompetitor({
name: data.value
}).then(_ => {
this.$message.success('添加成功!')
this.getCompetitorList()
})
})
}
}
},
computed: {
isChinese() {
return this.$i18n.locale === "zh_CN";
},
userId() {
return this.$store.state.user.id;
},
customerId() {
return this.$route.params.customerId;
},
/* userMemberUser(){
let list = this.memberList.filter(item => {
return this.selectMemberList.findIndex(i => i.id === item.id) < 0
})
return [...this.selectMemberList,...list]
}, */
productListFilter() {
return this.productList.filter((p) => p.typeId === this.form.productType);
},
customerSelectFn() {
if (this.recommended.length > 0) {
let i = this.customerSelect.find(
(item) => item.id === this.recommended[0].id
);
if (!i) {
this.customerSelect.push(this.recommended[0]);
}
return this.customerSelect;
} else {
return this.customerSelect;
}
},
},
watch: {
zhongLines() {
console.log("zhongLines", this.zhongLines);
this.updateCustomerLines();
},
paoLines() {
console.log("paoLines", this.paoLines);
this.updateCustomerLines();
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-table__cell {
padding-bottom: 0;
.cell {
.el-form-item {
margin-bottom: 9px;
}
.el-form-item__error {
z-index: 1;
padding-top: 0;
top: 32px;
}
}
}
.title-text {
font-size: 18px;
color: #111;
}
</style>
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
label-width="100px"
>
<el-form-item :label="$t('跟进类型')">
<dict-selector
clearable
:type="DICT_TYPE.CUSTOMER_TYPE"
v-model="queryParams.followType"
@change="handleQuery"
></dict-selector>
</el-form-item>
<el-form-item :label="$t('跟进方式')">
<dict-selector
clearable
:type="DICT_TYPE.CUSTOMER_FOLLOWUP_METHOD"
v-model="queryParams.followMethod"
@change="handleQuery"
></dict-selector>
</el-form-item>
<el-form-item :label="$t('客户经理')" prop="customerService">
<el-select
multiple
clearable
v-model="queryParams.customerService"
:placeholder="$t('请选择客户经理')"
size="small"
@change="handleQuery"
>
<el-option
v-for="dict in customerServiceList"
:key="dict.id"
:label="dict.nickname"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('跟进结果')">
<el-select
clearable
v-model="queryParams.resultType"
:placeholder="$t('请选择')"
size="small"
@change="handleQuery"
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_RESULT_TYPE)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('跟进状态')">
<el-select
multiple
clearable
v-model="queryParams.status"
:placeholder="$t('请选择')"
size="small"
@change="handleQuery"
>
<el-option
v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FOLLOWUP_STATUS)"
:key="dict.value"
:label="isChinese ? dict.label : dict.labelEn"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('跟进时间')">
<el-date-picker
type="datetimerange"
clearable
v-model="dateRangeCreateTime"
style="width: 320px"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="-"
:start-placeholder="$t('开始跟进时间')"
:end-placeholder="$t('结束跟进时间')"
/>
</el-form-item>
<el-form-item :label="$t('下次跟进时间')">
<el-date-picker
type="datetimerange"
clearable
v-model="dateRangeCreateTime"
style="width: 320px"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="-"
:start-placeholder="$t('开始下次跟进时间')"
:end-placeholder="$t('结束下次跟进时间')"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
$t("搜索")
}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{
$t("重置")
}}</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<div
v-if="path === '/customer/customer'"
style="color: red; margin-bottom: 5px"
>
注意:创建的客户需接收
</div>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="[selectAuthorityFn('ecw:customer:follow-create')]"
>{{ $t("新增") }}
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
:loading="exportLoading"
v-hasPermi="[selectAuthorityFn('ecw:customer:follow-export')]"
>{{ $t("导出") }}</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="[selectAuthorityFn('ecw:customer:follow-modify-status')]"
:disabled="!selectCustomerList.length"
@click="setFullContainerLoad(true)"
type="primary"
plain
size="mini"
:loading="exportLoading"
>{{ $t("修改状态") }}</el-button
>
</el-col>
</el-row>
<!-- 列表 -->
<el-table
ref="multipleTable"
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column :label="$t('编号')" align="center" prop="number">
<template v-slot="{ row }">
{{ row.number }}
</template>
</el-table-column>
<el-table-column :label="$t('跟进类型')" align="center">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.CUSTOMER_FOLLOWUP_TYPE" :value="scope.row.followType" />
</template>
</el-table-column>
<el-table-column :label="$t('报价单')" align="center" prop="offerId"></el-table-column>
<el-table-column :label="$t('客户编号')" align="center" prop="customerId"></el-table-column>
<el-table-column :label="$t('客户经理')" align="center" prop="customerServiceName"></el-table-column>
<el-table-column :label="$t('目的')" align="center" prop="purpose"></el-table-column>
<el-table-column :label="$t('跟进方式')" align="center">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.CUSTOMER_FOLLOWUP_METHOD" :value="scope.row.followMethod" />
</template>
</el-table-column>
<el-table-column :label="$t('跟进结果')" align="center">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.CUSTOMER_FOLLOWUP_RESULT_TYPE" :value="scope.row.resultType" />
</template>
</el-table-column>
<el-table-column :label="$t('跟进时间')" align="center">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.beginFollowTime) }}~{{ parseTime(scope.row.endFollowTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('下次跟进计划')" align="center" prop="nextPlan"></el-table-column>
<el-table-column :label="$t('下次跟进时间')" align="center">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.beginNextTime) }}~{{ parseTime(scope.row.endNextTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('创建人')" align="center" prop="creatorName"></el-table-column>
<el-table-column :label="$t('创建时间')" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column width="200px" :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="[selectAuthorityFn('ecw:customer:follow-update')]"
>{{ $t("编辑") }}</el-button
>
<el-button
size="mini"
v-has-permi="[selectAuthorityFn('ecw:customer:follow-add-plan')]"
type="text"
icon="el-icon-collection"
@click="followUp(scope.row)"
>{{ $t("增加计划") }}</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import {
createCustomer,
updateCustomer,
deleteCustomer,
getCustomer,
getCustomerPage,
exportCustomerExcel,
testEnterToOpenSea,
getCustomerDeptPage,
changeCustomerAir,
getPotential,
setChangeCustomerFcl,
potentialExportExcel,
deptExportExcel,
recycleUnconfirmedCustomer,
updatecustomerToOld,
} from "@/api/ecw/customer";
import { getDictDatas, DICT_TYPE } from "@/utils/dict";
import { CommonStatusEnum } from "@/utils/constants";
import { uploadFile } from "@/api/infra/file";
import upload from "@/components/ImageUpload";
import { getNodeList } from "@/api/ecw/node";
import CustomerFollowList from "@/components/CustomerFollowList";
import customerComplaints from "@/components/customerComplaints";
import { listServiceUser } from "@/api/system/user";
import { getCountryListAll } from "@/api/ecw/country";
import { getCreditPage } from "@/api/customer/credit";
import { customerExportExcel, changeCustomerDefaultPay, changeCustomerNoConsignee,changeCustomerDefaultBilling} from "@/api/ecw/customer";
import transferCustomer from "@/views/ecw/customer/transferCustomer";
import Template from "@/views/cms/template/index.vue";
import AddPotentialCustom from "@/views/ecw/customer/addPotentialCustom.vue";
import Contacts from "@/views/ecw/customer/components/contacts.vue";
import { getUserProfile } from "@/api/system/user";
import AreaCodeSelector from "@/components/AreaCodeSelector/index.vue";
import {getCustomerFollowList} from "@/api/ecw/customerFollow";
export default {
name: "EcwCustomerIndex",
components: {
Contacts,
AddPotentialCustom,
Template,
upload,
CustomerFollowList,
customerComplaints,
transferCustomer,
AreaCodeSelector
},
data() {
return {
env: process.env.NODE_ENV,
getDictDatas,
DICT_TYPE,
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 显示搜索条件
showSearch: false,
// 总条数
total: 0,
// 客户列表
list: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
dateRangeCreateTime: [],
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 10,
number: null,
name: null,
level: null,
source: null,
customerService: null,
status: null,
department: null,
creditLevel: null,
country: null,
resourceType: null,
memberCode: null,
memberName: null,
memberMobile: null,
memberAreaCode: null
},
// 表单参数
form: {},
// 表单校验
rules: {
name: [
{
required: true,
message: this.$t("客户名称不能为空"),
trigger: "blur",
},
],
country: [
{ required: true, message: this.$t("国家不能为空"), trigger: "blur" },
],
level: [
{
required: true,
message: this.$t("客户等级不能为空"),
trigger: "blur",
},
],
type: [
{
required: true,
message: this.$t("客户类别不能为空"),
trigger: "blur",
},
],
// createTime: [{ required: true, message: this.$t("创建时间不能为空"), trigger: "blur" }],
source: [
{
required: true,
message: this.$t("客户来源不能为空"),
trigger: "blur",
},
],
customerService: [
{
required: true,
message: this.$t("客户经理不能为空"),
trigger: "blur",
},
],
status: [
{
required: true,
message: this.$t("客户状态不能为空"),
trigger: "blur",
},
],
founder: [
{
required: true,
message: this.$t("创建人不能为空"),
trigger: "blur",
},
],
},
// 网点
nodeList: [],
showLine: false,
customerId: undefined,
customerServiceList: [],
countryList: [],
creditList: [],
selectCustomerList: [],
transferShow: false,
dialogVisible: false,
customData: {},
currentisNew: false,
userId: undefined, //lanbm 2024-05-23 add
};
},
computed: {
path() {
return this.$route.path;
},
channel() {
return (val) => {
return !!val
? this.getDictDatas(this.DICT_TYPE.ECW_CUSTOMER_TRANSPORT_TYPE)
.filter((i) => (val.split(",") || []).includes(i.value))
.map((i) => (this.isChinese ? i.label : i.labelEn))
.join("")
: "";
};
},
isChinese() {
return this.$i18n.locale === "zh_CN";
},
authorityFn() {
let i = "";
switch (this.$route.path) {
case "/customer/department-customers":
i = "dep-";
break;
case "/customer/potential":
i = "pot-";
break;
}
return i;
},
selectAuthorityFn() {
return (val) => {
let t = val.split(":");
t[t.length - 1] = this.authorityFn + t[t.length - 1];
console.log(t.join(":"));
return t.join(":");
};
},
},
watch: {
selectCustomerList(val) {
if (val.length === 0) {
this.getList();
this.$refs.multipleTable.clearSelection();
}
},
},
created() {
this.getList();
listServiceUser().then((r) => {
this.customerServiceList = r.data;
});
},
activated() {
this.getList();
},
methods: {
handleMergeCus() {
//合并客户
},
recovery(row) {
this.$confirm(this.$t("是否要回收当前{name}", row), "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
recycleUnconfirmedCustomer({ customerId: row.id }).then((r) => {
this.$message.success(this.$t("回收成功。"));
this.getList();
});
})
.catch(() => {
this.$message.info(this.$t("已取消"));
});
},
// 设置整柜
setFullContainerLoad(isFcl) {
setChangeCustomerFcl({
customerIdList: this.selectCustomerList,
isFcl,
}).then((r) => {
if (r.code === 0) {
this.$message.success(
isFcl ? "设置客户为海运整柜成功!" : "设置客户为非海运整柜成功!"
);
this.selectCustomerList = [];
this.getList();
}
});
},
// 设置空运客户
setChangeCustomerAir(isAir) {
changeCustomerAir({
customerIdList: this.selectCustomerList,
isAir,
}).then((r) => {
console.log(r);
if (r.code === 0) {
this.$message.success(
isAir ? "设为空运客户成功!" : "设为非空运客户成功!"
);
this.selectCustomerList = [];
this.getList();
}
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
complaint(row) {
this.customerId = row.id;
this.$nextTick(() => {
this.$refs.customerComplaints.handleAdd();
});
},
countryFormatter(row, column, cellValue) {
const country = this.countryList.find((e) => e.id === cellValue);
return this.isChinese ? country?.nameZh : country?.nameEn;
},
delay(row) {
this.$router.push({ path: "/customer/delay", query: { id: row.id } });
},
followUp(row) {
this.customerId = row.id;
this.$nextTick(() => {
this.$refs.CustomerFollowList.customerFollow.dialogVisible = true;
});
},
//报价
quote(row) {
//lanbm 2024-05-23 添加报价是判断客户所属客户经理,不是就不能报价
if (row.customerService != this.userId) {
this.$message.error(this.$t("此客户属于其他客户经理名下的客户。"));
return;
}
//this.$router.push({path:'/offer/create',query:{id:row.id}})
this.$router
.push({ path: "/offer/create", query: { customer: row, type: 1 } })
.then({
//this.$refs.push({path:'/customer-contacts/select',query:{pageNo:1,pageSize:10,searchKey:row.defaultContactPhone}})
});
},
/** 查询列表 */
getList() {
this.loading = true;
// 处理查询参数
let params = { ...this.queryParams };
this.addBeginAndEndTime(
params,
this.dateRangeCreateTime,
"createTime",
false
);
// 执行查询
getCustomerFollowList(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
})
},
/** 新增按钮操作 */
handleAdd() {
this.$router.push("/customer/follow-add-edit/0");
// this.reset();
// this.open = true;
// this.title = this.$t("添加客户");
},
// 新增潜在客户
handleAddPotential() {
this.$refs.potentialCustom.dialogTableVisible = true;
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
const name = row.name;
const number = row.number;
this.$modal
.confirm(
this.$t('是否确认删除客户编号为"') + number + this.$t('"的数据项?')
)
.then(function () {
return deleteCustomer(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess(this.$t("删除成功"));
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
let func = null;
let title = "";
switch (this.$route.path) {
case "/customer/customer":
func = customerExportExcel;
title = "是否确认导出所有客户数据项?";
break;
case "/customer/department-customers":
func = deptExportExcel;
title = "是否确认导出部门客户数据项?";
break;
case "/customer/potential":
func = potentialExportExcel;
title = "是否确认导出潜在客户数据项?";
break;
}
// // 执行导出
this.$modal
.confirm(this.$t(title))
.then(() => {
func().then((r) => {
this.$message.success(
this.$t("已加入导出队列,请稍后在下载日志中下载")
);
});
})
.catch(() => {});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
handleSelectionChange(val) {
this.selectCustomerList = val.map((i) => i.id);
},
/** 修改按钮操作 */
handleUpdate(row) {
console.log(row.id);
this.$router.push("/customer/add-edit/" + row.id);
// this.reset();
// const id = row.id;
// getCustomer(id).then(response => {
// this.form = { ...this.form, ...response.data };
// this.open = true;
// this.title = this.$t("修改客户");
// });
},
/** 查看按钮操作 */
handleView(row) {
this.$router.push("/customer/query/" + row.id);
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
number: undefined,
name: undefined,
level: undefined,
country: undefined,
type: undefined,
agentId: undefined,
company: undefined,
address: undefined,
productType: undefined,
productId: undefined,
pickupPoint: undefined,
memberId: undefined,
birthday: undefined,
balance: undefined,
source: undefined,
picture: undefined,
customerService: undefined,
customerContacts: [],
customerLines: [],
promoter: undefined,
status: undefined,
founder: undefined,
department: undefined,
invoiceTitle: undefined,
licenseNumber: undefined,
bank: undefined,
bankNumber: undefined,
project: undefined,
billingAddress: undefined,
billingTell: undefined,
taxRate: undefined,
remarks: undefined,
arrivalConfirm: undefined,
weightUnit: undefined,
};
this.resetForm("form");
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.queryParams = {
pageNo: 1,
pageSize: 10,
number: null,
name: null,
level: null,
source: null,
customerService: null,
status: null,
department: null,
creditLevel: null,
country: null,
memberCode: null,
memberName: null,
memberMobile: null,
memberAreaCode: null
};
this.handleQuery();
},
/** 调入公海池测试用 */
seasPond(row) {
testEnterToOpenSea(row.id).then((r) => {
if (r.code === 0) {
this.$t("调入公海池成功!");
this.getList();
}
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (!valid) {
// return;
}
// 修改的提交
if (this.form.id != null) {
updateCustomer(this.form).then((response) => {
this.$modal.msgSuccess(this.$t("修改成功"));
this.open = false;
this.getList();
});
return;
}
// 添加的提交
createCustomer(this.form).then((response) => {
this.$modal.msgSuccess(this.$t("新增成功"));
this.open = false;
this.getList();
});
});
},
// 修改客户类型
modifyCustomer() {
this.$confirm(
this.$t("修改业绩类型后,将会影响客户新订单业绩计算,请问确定吗?"),
this.$t("提示"),
{
confirmButtonText: this.$t("确定"),
cancelButtonText: this.$t("取消"),
type: "warning",
}
)
.then(() => {
updatecustomerToOld({
customerId: this.customData.id,
isNew: this.currentisNew,
}).then((r) => {
this.$message.success(this.$t("修改成功"));
this.dialogVisible = false;
this.getList();
});
})
.catch(() => {});
},
setDefaultPay() {
changeCustomerDefaultPay({
customerIdList: this.selectCustomerList,
defaultPay: true
}).then(_ => {
this.$message.success(this.$t("操作成功"))
this.getList()
})
},
setNoConsignee() {
changeCustomerNoConsignee({
customerIdList: this.selectCustomerList,
noConsigee: true
}).then(_ => {
this.$message.success(this.$t("操作成功"))
this.getList()
})
},
setDefaultBilling() {
changeCustomerDefaultBilling({
customerIdList: this.selectCustomerList,
defaultBilling: true
}).then(_ => {
this.$message.success(this.$t("操作成功"))
this.getList()
})
}
},
};
</script>
......@@ -761,7 +761,7 @@ import {
import { DICT_TYPE, getDictDataLabel, getDictDatas2 } from '@/utils/dict'
import { getProductTypeList } from '@/api/ecw/productType'
import { getNodeList } from '@/api/ecw/node'
import CustomerFollow from "@/components/CustomerFollow"
import CustomerFollow from "./components/customerFollow"
import { parseTime } from '@/utils/ruoyi'
import CustomerComplaint from '@/views/ecw/customerComplaint'
import { listServiceUser } from '@/api/system/user'
......@@ -1099,7 +1099,7 @@ export default {
this.$nextTick(()=>{
if(val === 'follow'){
this.$refs['customerFollow'].customerFollow.dialogVisible = true;
}else {
} else {
this.$refs['customerComplaint'].handleAdd()
}
})
......
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