Commit 1dffdad4 authored by yujinyao's avatar yujinyao

跟进默认选择当前的客户经理,下次跟进时间不能小于当前时间

parent 02c24a4c
......@@ -92,10 +92,11 @@ export function editCustomerFollow(data) {
})
}
export function exportCustomerFollow() {
export function exportCustomerFollow(params) {
return request({
url: '/customer/followup/export-excel',
method: 'get'
method: 'get',
params
})
}
......@@ -89,7 +89,7 @@
</el-col>
<el-col :span="13">
<el-form-item :label="$t('下次跟进时间')">
<el-date-picker v-model="form.nextTime" type="datetime" :placeholder="$t('请选择')" :disabled="isView">
<el-date-picker v-model="form.nextTime" type="datetime" :placeholder="$t('请选择')" :disabled="isView" @change="changeNextTime">
</el-date-picker>
</el-form-item>
</el-col>
......@@ -217,8 +217,8 @@ export default {
allSimplList: [],
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now()
}
return time.getTime() <= Date.now()
},
},
isEdit: false,
queryParams: {},
......@@ -303,6 +303,16 @@ export default {
updateTime: new Date().getTime()
};
},
changeNextTime(val) {
if (val) {
const curTime = new Date().getTime()
const valTime = new Date(val).getTime()
if (curTime > valTime) {
this.form.nextTime = null
this.$modal.msgError(this.$t("不能小于当前时间"))
}
}
},
customerFollowSubmit(status) {
console.log(this.form)
this.$refs["customerFollowForm"].validate(valid => {
......
......@@ -1340,11 +1340,11 @@ export default {
],
areaCode: [
{ required: true, message: this.$t("请选择区号"), trigger: "change" },
{
/*{
required: true,
trigger: "change",
validator: this.codeValidator,
},
},*/
],
phoneNew: [
{
......
<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>
......@@ -1374,6 +1374,7 @@
<customer-follow-list
:customer-id="customerId"
:id="customerId"
:customer-service="customerService"
ref="CustomerFollowList"
v-if="customerFollowVisible"
></customer-follow-list>
......@@ -1578,6 +1579,7 @@ export default {
customData: {},
currentisNew: false,
userId: undefined, //lanbm 2024-05-23 add
customerService: undefined,
customerFollowVisible: false,
enterOpenSeaTime: [],
customerServiceConfirmedTime: [],
......@@ -1809,6 +1811,7 @@ export default {
},
followUp(row) {
this.customerId = row.id;
this.customerService = row.customerService;
this.customerFollowVisible = true
this.$nextTick(_ => {
// this.$refs.CustomerFollowList.customerFollow.dialogVisible = true;
......
......@@ -1333,25 +1333,28 @@ export default {
this.getInfoListOfferPage()
},
getCustomerFollowList() {
let queryParams = {}
if (this.followTime && this.followTime.length == 2) {
queryParams.beginFollowTime = this.followTime[0]
queryParams.endFollowTime = this.followTime[0]
}
if (this.nextTime && this.nextTime.length == 2) {
queryParams.beginNextTime = this.nextTime[0]
queryParams.endNextTime = this.nextTime[1]
}
queryParams = Object.assign({}, queryParams, this.followForm)
getCustomerFollowList({
...queryParams,
...this.followForm,
customerId: this.customerId
}).then(r => {
this.customerFollowList = r.data.list;
this.customerFollowTotal = r.data.total;
})
},
/** 跟进记录导出按钮操作 */
handleExport() {
// 执行导出
this.$modal.confirm(this.$t('是否确认导出客户跟进记录数据项?')).then(() => {
exportCustomerFollow({
...this.followForm,
customerId: this.customerId
}).then((r) => {
this.$message.success(
this.$t("已加入导出队列,请稍后在下载日志中下载")
);
});
})
},
// 数据
getOrderStatistics(){
orderStatistics({customerId:this.id}).then(r => {
......@@ -1477,17 +1480,6 @@ export default {
this.handleQuery()
})
},
/** 导出按钮操作 */
handleExport() {
// 执行导出
this.$modal.confirm(this.$t('是否确认导出客户跟进记录数据项?')).then(() => {
exportCustomerFollow().then((r) => {
this.$message.success(
this.$t("已加入导出队列,请稍后在下载日志中下载")
);
});
})
},
}
}
</script>
......@@ -729,6 +729,7 @@
ref="customerFollowList"
:customer-id="customerId"
:id="customerId"
:customer-service="customerService"
v-if="customerFollowVisible"
></customer-follow-list>
<customer-complaints
......@@ -946,6 +947,7 @@ export default {
selectCustomerList: [],
//lanbm 2024-05-26 添加参数
userId:undefined,
customerService: undefined,
customerFollowVisible: false,
enterOpenSeaTime: [],
customerServiceConfirmedTime: [],
......@@ -1236,6 +1238,7 @@ export default {
followUp(row) {
this.customerId = row.id;
// this.$refs["customerFollowList"].customerFollow.dialogVisible = true;
this.customerService = row.customerService;
this.customerFollowVisible = true
this.$nextTick(_ => {
this.$refs['customerFollowList'].init()
......
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