123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437 |
- <template>
- <div class="pageIndexClass">
- <!-- <div style="padding: 20px; background: #fff; margin-bottom: 20px">
- <el-button type="primary" style="margin-left: 10px" @click="openModal()">添加客户</el-button>
- </div> -->
- <div style="display:flex;height:calc(100vh - 120px);">
- <div style="width:240px;height:100%;overflow:auto;background:#fff;padding:15px">
- <div style="margin-bottom:10px">
- <el-button type="primary" style="width:100%" @click="handleSearch()">全部客户</el-button>
- </div>
- <el-collapse v-model="activeNames">
- <el-collapse-item title="客户跟进" name="1">
- <template #title>
- <div>
- <!-- <img src="@/assets/images/custom-1.png" alt="" style="object-fit: contain;width: 20px;height: 20px;vertical-align: middle;" />
- 客户跟进 -->
- <TitleInfo :content="'客户跟进'"></TitleInfo>
- </div>
- </template>
- <div style="padding:0 10px">
- <div style="display:flex;justify-content:space-between;cursor:pointer" :class="{'activeSearch':(4+'follow')==activeSearch}"
- @click="handleSearchOne(4)">
- <span>近7天有跟进</span> <span>{{leftDataFour[0]}}</span>
- </div>
- <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
- :class="{'activeSearch':(1+'follow')==activeSearch}" @click="handleSearchOne(1)">
- <span>超7天未跟进</span> <span>{{leftDataFour[7]}}</span>
- </div>
- <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
- :class="{'activeSearch':(2+'follow')==activeSearch}" @click="handleSearchOne(2)">
- <span>超30天未跟进</span> <span>{{leftDataFour[30]}}</span>
- </div>
- <div style="display:flex;justify-content:space-between;cursor:pointer;margin-top:5px"
- :class="{'activeSearch':(3+'follow')==activeSearch}" @click="handleSearchOne(3)">
- <span>超半年未跟进</span> <span>{{leftDataFour[180]}}</span>
- </div>
- </div>
- </el-collapse-item>
- <el-collapse-item title="客户来源" name="2">
- <template #title>
- <div>
- <!-- <img src="@/assets/images/custom-2.png" alt="" style="object-fit: contain;width: 20px;height: 20px;vertical-align: middle;" />
- 客户来源 -->
- <TitleInfo :content="'客户来源'"></TitleInfo>
- </div>
- </template>
- <div style="padding:0 10px">
- <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerSource" :key="item.value"
- :class="{'activeSearch':(item.value+'source')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
- @click="handleSearch(item.value,'source')">
- <span>{{item.label}}</span> <span>{{showLeftData(item.value,'source')}}</span>
- </div>
- </div>
- </el-collapse-item>
- <el-collapse-item title="客户类型" name="3">
- <template #title>
- <div>
- <!-- <img src="@/assets/images/custom-4.png" alt="" style="object-fit: contain;width: 20px;height: 20px;vertical-align: middle;" />
- 客户类型 -->
- <TitleInfo :content="'客户类型'"></TitleInfo>
- </div>
- </template>
- <div style="padding:0 10px">
- <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerStatus" :key="item.value"
- :class="{'activeSearch':(item.value+'status')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
- @click="handleSearch(item.value,'status')">
- <span>{{item.label}}</span> <span>{{showLeftData(item.value,'status')}}</span>
- </div>
- </div>
- </el-collapse-item>
- <el-collapse-item title="客户标签" name="4">
- <template #title>
- <div>
- <!-- <img src="@/assets/images/custom-3.png" alt="" style="object-fit: contain;width: 20px;height: 20px;vertical-align: middle;" />
- 客户标签 -->
- <TitleInfo :content="'客户标签'"></TitleInfo>
- </div>
- </template>
- <div style="padding:0 10px">
- <div style="display:flex;justify-content:space-between;cursor:pointer" v-for="(item,index) in customerTag" :key="item.value"
- :class="{'activeSearch':(item.value+'tag')==activeSearch}" :style="{marginTop:index!=0?'15px':'0px'}"
- @click="handleSearch(item.value,'tag')">
- <span>{{item.label}}</span> <span>{{showLeftData(item.value,'tag')}}</span>
- </div>
- </div>
- </el-collapse-item>
- </el-collapse>
- </div>
- <div style="width:10px"></div>
- <div style="width:calc(100% - 250px);height:100%;overflow:auto">
- <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :statConfig="[]"
- :selectConfig="selectConfig" highlight-current-row :action-list="[
- {
- text: '导出Excel',
- action: () => exportExcel(),
- disabled: false,
- },
- {
- text: '添加客户',
- action: () => openModal(),
- },
- ]" @moreSearch="moreSearch" @get-list="getList" ref="table">
- <template #isTop="{ item }">
- <div>
- <img style="cursor: pointer; width: 20px; transform: translateY(5px)" :src="'/img/isTop.png'" @click="deleteTop(item)"
- v-if="item.isTop === 1" />
- <img style="cursor: pointer; width: 20px; transform: translateY(5px)" :src="'/img/noTop.png'" @click="addTop(item)" v-else />
- </div>
- </template>
- <template #address="{ item }">
- <span>{{ item.countryName }}</span>
- <span v-if="item.provinceName"> ,{{ item.provinceName }}</span>
- <span v-if="item.cityName"> ,{{ item.cityName }}</span>
- </template>
- <template #name="{ item }">
- <div class="el-click" @click="handleClickName(item)">
- {{ item.name }}
- </div>
- </template>
- <template #tags="{ item }">
- <div style="width: 100%">
- <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.tag" closable :key="index" @close="tagClose(tag, item)">
- {{ dictValueLabel(tag, customerTag) }}
- </el-tag>
- <template v-if="item.tag.length !== customerTag.length">
- <el-select v-if="item.addTagShow" v-model="addTag" style="width: 100%" @change="
- (val) => {
- return changeTag(val, item);
- }
- ">
- <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value"
- :disabled="judgeTagSelect(item.tag, tag.value)" />
- </el-select>
- <el-tag style="cursor: pointer" type="success" @click="showSelect(item)" v-else>
- +
- </el-tag>
- </template>
- </div>
- </template>
- <template #follow="{ item }">
- <div :class="'getWidth' + item.id" style="width: 100%">
- <div style="width: 100%; display: flex">
- <template v-if="
- item.customerFollowRecordsList &&
- item.customerFollowRecordsList.length > 0
- ">
- <div :style="
- index > 2
- ? 'line-height: 32px; margin-right: 8px; padding: 0 8px; background-color: #eeeeee; border-radius: 4px; cursor: pointer; display: none'
- : 'line-height: 32px; margin-right: 8px; padding: 0 8px; background-color: #eeeeee; border-radius: 4px; cursor: pointer'
- " v-for="(record, index) in item.customerFollowRecordsList" :key="record.id">
- <el-popover placement="bottom" :width="300" trigger="hover" @show="recordShow(record)">
- <template #reference>
- <div>
- <span v-if="record.date">{{
- record.date.substr(0, 10)
- }}</span>
- <el-icon style="margin-left: 8px; transform: translateY(2px)" @click="deleteFollow(record)">
- <DeleteFilled />
- </el-icon>
- </div>
- </template>
- <template #default>
- <div style="width: 100%">
- <div style="color: #909399; margin: 8px 0">
- 跟进时间: {{ record.date }}
- </div>
- <div style="margin: 8px 0">
- 跟进人:
- {{ dictValueLabel(record.createUser, userList) }}
- </div>
- <div v-if="record.type == '30'">
- <div style="word-wrap: break-word; margin: 8px 0" v-html="getStyle(record.content)" v-if="record.content"></div>
- <div v-else>跟进记录:</div>
- </div>
- <div v-else>
- <div style="word-wrap: break-word; margin: 8px 0">
- {{ getContent(record) }}
- </div>
- </div>
- <div style="margin: 8px 0; display: flex" v-if="record.fileList && record.fileList.length > 0">
- <div style="width: 36px">附件:</div>
- <div style="width: calc(100% - 36px)">
- <div v-for="(file, index) in record.fileList" :key="index">
- <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
- </div>
- </div>
- </div>
- </div>
- </template>
- </el-popover>
- </div>
- <div style="
- line-height: 32px;
- margin-right: 8px;
- padding: 0 8px;
- background-color: #eeeeee;
- border-radius: 4px;
- cursor: pointer;
- " @click="clickMore(item)" v-if="item.customerFollowRecordsList.length >= 3">
- 更多
- </div>
- </template>
- </div>
- </div>
- </template>
- </byTable>
- </div>
- </div>
- <el-dialog :title="modalType == 'add' ? '新增' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="80%" v-loading="loadingOperation">
- <div class="public_height_dialog">
- <AddCustomer ref="AddCustomerDom" :modalType="modalType" :customerId="customerId" :isHighseas="true" @refreshList="refreshList"></AddCustomer>
- </div>
- <template #footer v-if="modalType!='detail'">
- <el-button @click="dialogVisible = false" size="default">取 消</el-button>
- <el-button type="primary" @click="submitForm()" size="default" :loading="submitLoading">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog title="添加跟进记录" v-if="openFollow" v-model="openFollow" width="500" destroy-on-close>
- <byForm :formConfig="formConfigAFollow" :formOption="formOption" v-model="formFollow.data" :rules="rulesFollow" ref="follow">
- <template #fileSlot>
- <div style="width: 100%">
- <el-upload v-model:fileList="fileList" :action="uploadUrl" :data="uploadData" multiple :before-upload="uploadFile"
- :on-preview="onPreviewFile">
- <el-button type="primary">文件上传</el-button>
- </el-upload>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="openFollow = false" size="default">取 消</el-button>
- <el-button type="primary" @click="submitFollow()" size="default">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog title="跟进记录" v-if="openRecordMore" v-model="openRecordMore" width="800" destroy-on-close>
- <div>
- <div style="padding: 8px 0">
- <el-button type="primary" @click="clickFollowUp(rowData)" plain>添加跟进记录</el-button>
- </div>
- <div style="padding-top: 16px">
- <div v-infinite-scroll="infiniteScroll" class="infinite-scroll" :infinite-scroll-disabled="judgeTotal()">
- <el-timeline>
- <el-timeline-item v-for="(record, index) in recordList" :key="index" :timestamp="record.date" hide-timestamp>
- <div>
- <div style="
- padding: 0 0 8px 0;
- display: flex;
- justify-content: space-between;
- ">
- <span>{{
- dictValueLabel(record.createUser, userList)
- }}</span>
- <span>{{ record.date }}</span>
- </div>
- <div v-if="record.type == '30'">
- <div style="word-wrap: break-word; margin: 8px 0" v-html="getStyle(record.content)" v-if="record.content"></div>
- <div v-else>跟进记录:</div>
- </div>
- <div v-else>
- <div style="word-wrap: break-word; margin: 8px 0">
- {{ getContent(record) }}
- </div>
- </div>
- <div style="margin: 8px 0; display: flex" v-if="record.fileList && record.fileList.length > 0">
- <div style="width: 36px">附件:</div>
- <div style="width: calc(100% - 36px)">
- <div v-for="(file, index) in record.fileList" :key="index">
- <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
- </div>
- </div>
- </div>
- </div>
- </el-timeline-item>
- </el-timeline>
- </div>
- </div>
- </div>
- <template #footer>
- <el-button @click="openRecordMore = false" size="default">关 闭</el-button>
- </template>
- </el-dialog>
- <el-dialog title="高级检索" v-if="openSearch" v-model="openSearch" width="600" :before-close="cancelSearch">
- <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
- <template #address>
- <el-row style="width: 100%">
- <el-col :span="8">
- <el-form-item prop="countryId">
- <el-select v-model="sourceList.pagination.countryId" placeholder="国家" clearable filterable
- @change="(val) => getCitySearchData(val, '20', true)">
- <el-option v-for="item in countrySearchData" :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item prop="provinceName">
- <selectCity placeholder="省/洲" @change="(val) => getCitySearchData(val, '30', true)" addressId="provinceId" addressName="provinceName"
- v-model="sourceList.pagination" :data="provinceSearchData">
- </selectCity>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item prop="cityName">
- <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="sourceList.pagination" :data="citySearchData">
- </selectCity>
- </el-form-item>
- </el-col>
- </el-row>
- </template>
- <template #tags>
- <div style="width: 100%">
- <el-tag style="margin-right: 8px" type="info" v-for="(tag, index) in sourceList.pagination.tags" closable :key="index"
- @close="tagSearchClose(tag)">
- {{ dictValueLabel(tag, customerTag) }}
- </el-tag>
- <template v-if="sourceList.pagination.tags.length !== customerTag.length">
- <el-select v-if="addTagSearchShow" v-model="addSearchTag" style="margin-top: 8px" @change="changeSearchTag">
- <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value" :disabled="
- judgeTagSelect(sourceList.pagination.tags, tag.value)
- " />
- </el-select>
- <el-tag style="cursor: pointer" type="info" @click="addTagSearchShow = true" v-else>
- +
- </el-tag>
- </template>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="cancelSearch()" size="default">取 消</el-button>
- <el-button type="primary" @click="submitSearch()" size="default">确 定</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import { ElMessage, ElMessageBox } from "element-plus";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import { computed, ref } from "vue";
- import useUserStore from "@/store/modules/user";
- import selectCity from "@/components/selectCity/index.vue";
- import TitleInfo from "@/components/TitleInfo/index.vue";
- import AddCustomer from "@/views/customer/addCustomer.vue";
- const AddCustomerDom = ref(null);
- const customerId = ref("");
- const { proxy } = getCurrentInstance();
- const activeNames = ref(["1", "2", "3", "4"]);
- const loading = ref(false);
- const loadingOperation = ref(false);
- const submitLoading = ref(false);
- const openPerson = ref(false);
- const customerTag = ref([]);
- const customerSource = ref([]);
- const customerStatus = ref([]);
- const contactType = ref([]);
- const userList = ref([]);
- const fileList = ref([]);
- const uploadData = ref({});
- const statisticsType = ref([
- {
- label: "客户来源统计",
- value: 1,
- },
- {
- label: "客户类型统计",
- value: 2,
- },
- ]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- type: 0,
- source: "",
- status: "",
- name: "",
- countryId: "",
- provinceId: "",
- cityId: "",
- customerCode: "",
- tag: "",
- tags: [],
- },
- paginationTwo: {
- statisticsType: 1,
- type: 0,
- },
- });
- const statConfig = computed(() => [
- {
- label: "客户来源统计",
- data: [
- {
- label: "合计",
- num: statisticalData.value.countAmount,
- type: 2,
- },
- ...customerSource.value
- .filter((a) => getNum(a.value) > 0)
- .map((b) => {
- let num = getNum(b.value);
- return {
- label: b.label,
- num,
- type: 1,
- };
- }),
- ],
- },
- {
- label: "客户类型统计",
- data: [
- {
- label: "合计",
- num: statisticalData.value.countAmount,
- type: 2,
- },
- ...customerStatus.value
- .filter((a) => getNum(a.value) > 0)
- .map((b) => {
- let num = getNum(b.value);
- return {
- label: b.label,
- num,
- type: 1,
- };
- }),
- ],
- },
- ]);
- const selectConfig = computed(() => {
- return [
- {
- label: "客户来源",
- prop: "source",
- data: customerSource.value,
- },
- {
- label: "客户类型",
- prop: "status",
- data: customerStatus.value,
- },
- ];
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "",
- slot: "isTop",
- fixed: "left",
- width: 60,
- align: "center",
- },
- },
- {
- attrs: {
- label: "客户名称",
- slot: "name",
- fixed: "left",
- width: 160,
- },
- },
- {
- attrs: {
- label: "所在城市",
- slot: "address",
- width: 160,
- },
- },
- {
- attrs: {
- label: "客户来源",
- prop: "source",
- width: 120,
- },
- render(type) {
- return proxy.dictValueLabel(type, customerSource.value);
- },
- },
- {
- attrs: {
- label: "客户类型",
- prop: "status",
- width: 120,
- },
- render(type) {
- return proxy.dictValueLabel(type, customerStatus.value);
- },
- },
- {
- attrs: {
- label: "客户标签",
- slot: "tags",
- width: 180,
- },
- },
- {
- attrs: {
- label: "业务员",
- prop: "userId",
- width: 140,
- },
- render(type) {
- let data = userList.value.filter((item) => item.value == type);
- if (data && data.length > 0) {
- return data[0].label;
- } else {
- return "";
- }
- },
- },
- {
- attrs: {
- label: "跟进",
- slot: "follow",
- "min-width": 440,
- },
- },
- {
- attrs: {
- label: "操作",
- width: 180,
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- {
- attrs: {
- label: "跟进",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickFollowUp(row);
- },
- },
- {
- attrs: {
- label: "修改",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- update(row);
- },
- },
- {
- attrs: {
- label: "认领客户",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- ElMessageBox.confirm("是否确定认领该客户?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- proxy
- .post("/customer/CustomerAllocation", {
- id: row.id,
- userId: useUserStore().user.userId,
- })
- .then(() => {
- ElMessage({
- message: "认领成功",
- type: "success",
- });
- getList();
- obtainStatisticalData();
- });
- });
- },
- },
- ];
- },
- },
- ];
- });
- let modalType = ref("add");
- let dialogVisible = ref(false);
- let openFollow = ref(false);
- let formData = reactive({
- data: {
- countryId: "44",
- },
- });
- let formPerson = reactive({
- data: {},
- });
- let formFollow = reactive({
- data: {},
- });
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const formConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "name",
- label: "客户名称",
- required: true,
- itemWidth: 100,
- itemType: "text",
- },
- {
- type: "slot",
- slotName: "address",
- prop: "countryId",
- label: "详细地址",
- },
- {
- type: "select",
- label: "客户来源",
- prop: "source",
- itemWidth: 50,
- data: customerSource.value,
- },
- {
- type: "select",
- label: "客户类型",
- prop: "status",
- itemWidth: 50,
- data: customerStatus.value,
- },
- {
- type: "select",
- label: "业务员",
- prop: "userId",
- itemWidth: 100,
- data: userList.value,
- clearable: true,
- disabled: modalType.value == "edit",
- },
- {
- type: "select",
- label: "客户标签",
- prop: "tags",
- itemWidth: 100,
- multiple: true,
- data: customerTag.value,
- style: {
- width: "100%",
- },
- },
- {
- type: "input",
- prop: "beneficiaryName",
- label: "Beneficiary Name",
- required: true,
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "input",
- prop: "beneficiaryAccountNumber",
- label: "Beneficiary Account Number",
- required: true,
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "input",
- prop: "beneficiaryBank",
- label: "Beneficiary Bank",
- required: true,
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "input",
- prop: "swiftCode",
- label: "Swift Code",
- required: true,
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "input",
- prop: "beneficiaryBankAddress",
- label: "Beneficiary Bank Address",
- required: true,
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "input",
- prop: "beneficiaryAddress",
- label: "Beneficiary Address",
- required: true,
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "slot",
- slotName: "person",
- label: "客户联系人",
- },
- ];
- });
- let rules = ref({
- name: [{ required: true, message: "请输入客户名称", trigger: "blur" }],
- name2: [{ required: true, message: "请输入联系人", trigger: "blur" }],
- email: [{ required: true, message: "请输入电子邮箱", trigger: "blur" }],
- countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
- provinceId: [{ required: true, message: "请选择省/州", trigger: "change" }],
- cityId: [{ required: true, message: "请选择城市", trigger: "change" }],
- source: [{ required: true, message: "请选择客户来源", trigger: "change" }],
- status: [{ required: true, message: "请选择类型", trigger: "change" }],
- });
- const formConfigAFollow = computed(() => {
- return [
- {
- type: "date",
- itemType: "datetime",
- label: "跟进时间",
- prop: "date",
- itemWidth: 100,
- },
- {
- type: "input",
- itemType: "textarea",
- label: "跟进内容",
- prop: "content",
- itemWidth: 100,
- },
- {
- type: "slot",
- label: "上传附件",
- prop: "fileList",
- slotName: "fileSlot",
- },
- ];
- });
- let rulesPerson = ref({
- name: [{ required: true, message: "请输入联系人", trigger: "blur" }],
- email: [{ required: true, message: "请输入电子邮箱", trigger: "blur" }],
- type: [{ required: true, message: "请选择类型", trigger: "change" }],
- contactNo: [{ required: true, message: "请输入联系号码", trigger: "blur" }],
- });
- let rulesFollow = ref({
- date: [{ required: true, message: "请选择跟进时间", trigger: "change" }],
- content: [{ required: true, message: "请输入跟进内容", trigger: "blur" }],
- });
- const submit = ref(null);
- const person = ref(null);
- const allocation = ref(null);
- const follow = ref(null);
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy.post("/customer/page", sourceList.value.pagination).then((res) => {
- res.rows.forEach((x) => {
- x.addTagShow = false;
- if (x.tag) {
- x.tag = x.tag.split(",");
- } else {
- x.tag = [];
- }
- });
- sourceList.value.data = res.rows;
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- const openModal = () => {
- modalType.value = "add";
- dialogVisible.value = true;
- };
- const submitFollow = () => {
- follow.value.handleSubmit(() => {
- if (fileList.value && fileList.value.length > 0) {
- formFollow.data.fileList = fileList.value.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- formFollow.data.fileList = [];
- }
- proxy
- .post("/customerFollowRecords/" + modalType.value, formFollow.data)
- .then(
- () => {
- ElMessage({
- message: modalType.value == "add" ? "添加成功" : "编辑成功",
- type: "success",
- });
- openFollow.value = false;
- getList();
- },
- (err) => {
- console.log(err);
- }
- );
- });
- };
- const submitForm = () => {
- AddCustomerDom.value.handleSubmit();
- };
- const getDict = () => {
- proxy
- .getDictOne([
- "customer_tag",
- "customer_source",
- "customer_status",
- "contact_type",
- ])
- .then((res) => {
- customerTag.value = res["customer_tag"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- customerSource.value = res["customer_source"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- customerStatus.value = res["customer_status"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- contactType.value = res["contact_type"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- });
- proxy
- .get("/tenantUser/list", {
- pageNum: 1,
- pageSize: 10000,
- tenantId: useUserStore().user.tenantId,
- })
- .then((res) => {
- userList.value = res.rows.map((item) => {
- return {
- label: item.nickName,
- value: item.userId,
- };
- });
- });
- };
- getDict();
- getList();
- const handleClickName = (row) => {
- customerId.value = row.id;
- modalType.value = "detail";
- dialogVisible.value = true;
- // proxy.$router.push({
- // path: "Portrait",
- // query: {
- // id: row.id,
- // },
- // });
- };
- const deleteFollow = (data) => {
- ElMessageBox.confirm("是否确认删除该跟进?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- proxy
- .post("/customerFollowRecords/delete", {
- id: data.id,
- })
- .then(() => {
- ElMessage({
- message: "删除成功",
- type: "success",
- });
- getList();
- });
- });
- };
- const addTag = ref("");
- const judgeTagSelect = (data, val) => {
- if (data && data.length > 0) {
- if (data.includes(val)) {
- return true;
- }
- }
- return false;
- };
- const changeTag = (val, item) => {
- let data = {
- id: item.id,
- tag: JSON.parse(JSON.stringify(item.tag)),
- };
- data.tag.push(val);
- data.tag = data.tag.join(",");
- proxy.post("/customer/editTag", data).then(() => {
- ElMessage({
- message: "添加成功",
- type: "success",
- });
- item.addTagShow = false;
- addTag.value = "";
- getList();
- });
- };
- const tagClose = (val, item) => {
- let data = {
- id: item.id,
- tag: JSON.parse(JSON.stringify(item.tag)),
- };
- data.tag = data.tag.filter((row) => row !== val);
- if (data.tag && data.tag.length > 0) {
- data.tag = data.tag.join(",");
- } else {
- data.tag = "";
- }
- proxy.post("/customer/editTag", data).then(() => {
- ElMessage({
- message: "添加成功",
- type: "success",
- });
- item.addTagShow = false;
- addTag.value = "";
- getList();
- });
- };
- const showSelect = (item) => {
- item.addTagShow = true;
- };
- const clickFollowUp = (item) => {
- formFollow.data = {
- customerId: item.id,
- fileList: [],
- };
- fileList.value = [];
- modalType.value = "add";
- openFollow.value = true;
- openRecordMore.value = false;
- };
- const uploadFile = async (file) => {
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- uploadData.value = res.uploadBody;
- file.id = res.id;
- file.fileName = res.fileName;
- file.fileUrl = res.fileUrl;
- return true;
- };
- const onPreviewFile = (file) => {
- window.open(file.raw.fileUrl, "_blank");
- };
- const getStyle = (val) => {
- if (val) {
- return "跟进记录: " + val.replace(/\n|\r\n/g, "<br>");
- } else {
- return "";
- }
- };
- const getContent = (item) => {
- if (item.type === "10") {
- return "跟进记录: " + "报价单总金额 " + proxy.moneyFormat(item.amount, 2);
- } else if (item.type === "20") {
- return (
- "跟进记录: " +
- "合同总金额 " +
- proxy.moneyFormat(item.amount, 2) +
- ` (${item.contractCode}) `
- );
- }
- };
- const recordShow = (item) => {
- if (
- !(item.fileList && item.fileList.length > 0) &&
- JSON.stringify(item.fileList) !== "[]"
- ) {
- proxy
- .post("/fileInfo/getList", { businessIdList: [item.id] })
- .then((fileObj) => {
- item.fileList = fileObj[item.id] || [];
- });
- }
- };
- const openFile = (path) => {
- window.open(path, "_blank");
- };
- const recordList = ref([]);
- const rowData = ref({});
- const openRecordMore = ref(false);
- const queryParams = ref({
- total: 0,
- pageNum: 1,
- pageSize: 10,
- customerId: "",
- });
- const clickMore = (item) => {
- if (openRecordMore.value === false) {
- queryParams.value.pageNum = 1;
- recordList.value = [];
- rowData.value = item;
- queryParams.value.customerId = item.id;
- }
- proxy.post("/customerFollowRecords/page", queryParams.value).then((res) => {
- recordList.value = recordList.value.concat(res.rows);
- queryParams.value.total = res.total;
- proxy
- .post("/fileInfo/getList", {
- businessIdList: res.rows.map((rows) => rows.id),
- })
- .then((fileObj) => {
- for (let i = 0; i < res.rows.length; i++) {
- recordList.value[
- parseInt(
- i + (queryParams.value.pageNum - 1) * queryParams.value.pageSize
- )
- ].fileList =
- fileObj[
- recordList.value[
- parseInt(
- i +
- (queryParams.value.pageNum - 1) * queryParams.value.pageSize
- )
- ].id
- ] || [];
- }
- });
- });
- openRecordMore.value = true;
- };
- const infiniteScroll = () => {
- queryParams.value.pageNum++;
- clickMore();
- };
- const judgeTotal = () => {
- if (
- queryParams.value.pageNum * queryParams.value.pageSize >=
- queryParams.value.total
- ) {
- return true;
- }
- return false;
- };
- const deleteTop = (item) => {
- proxy.post("/customerTop/delete", { customerId: item.id }).then(() => {
- item.isTop = 0;
- });
- };
- const addTop = (item) => {
- proxy.post("/customerTop/add", { customerId: item.id }).then(() => {
- item.isTop = 1;
- });
- };
- const statisticalData = ref({
- countAmount: 0,
- customerList: [],
- });
- const leftData = ref({});
- const leftDataFour = ref({
- 0: 0,
- 7: 0,
- 30: 0,
- 180: 0,
- });
- const obtainStatisticalData = () => {
- proxy
- .post("/customer/sourceStatistics", { statisticsType: 1, type: "0" })
- .then((res) => {
- leftData.value.source = res;
- });
- proxy
- .post("/customer/sourceStatistics", { statisticsType: 2, type: "0" })
- .then((res) => {
- leftData.value.status = res;
- });
- proxy.post("/customer/tagStatistics", { type: "0" }).then((res) => {
- leftData.value.tag = res;
- });
- proxy.post("/customer/followStatistics", { type: "0" }).then((res) => {
- leftDataFour.value = res;
- });
- };
- obtainStatisticalData();
- const showLeftData = (dictKey, att) => {
- const data = leftData.value[att];
- if (data && data.customerList.length > 0) {
- const current = data.customerList.find((x) => x[att] == dictKey);
- if (current && current.count) {
- return current.count;
- } else {
- return 0;
- }
- }
- };
- const activeSearch = ref("");
- const handleSearch = (value, att) => {
- activeSearch.value = value + att;
- sourceList.value.pagination = {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- type: "",
- source: "",
- status: "",
- name: "",
- countryId: "",
- provinceId: "",
- cityId: "",
- customerCode: "",
- userId: "",
- tag: "",
- tags: [],
- };
- if (value || att) {
- sourceList.value.pagination[att] = value;
- }
- getList();
- };
- const handleSearchOne = (type, att = "follow") => {
- activeSearch.value = type + att;
- sourceList.value.pagination = {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- type: "",
- source: "",
- status: "",
- name: "",
- countryId: "",
- provinceId: "",
- cityId: "",
- customerCode: "",
- userId: "",
- tag: "",
- tags: [],
- };
- if (type == 4) {
- sourceList.value.pagination.beginDay = -1;
- sourceList.value.pagination.endDay = 7;
- } else if (type == 1) {
- sourceList.value.pagination.beginDay = 7;
- sourceList.value.pagination.endDay = 30;
- } else if (type == 2) {
- sourceList.value.pagination.beginDay = 30;
- sourceList.value.pagination.endDay = 180;
- } else {
- sourceList.value.pagination.beginDay = 180;
- sourceList.value.pagination.endDay = "";
- }
- getList();
- };
- const getNum = (val) => {
- let num = 0;
- if (
- statisticalData.value.customerList &&
- statisticalData.value.customerList.length > 0
- ) {
- statisticalData.value.customerList.map((item) => {
- if (sourceList.value.paginationTwo.statisticsType === 1) {
- if (item.source === val) {
- num = item.count;
- }
- } else if (sourceList.value.paginationTwo.statisticsType === 2) {
- if (item.status === val) {
- num = item.count;
- }
- } else if (sourceList.value.paginationTwo.statisticsType === 3) {
- if (item.userId === val) {
- num = item.count;
- }
- }
- });
- }
- return num;
- };
- const countrySearchData = ref([]);
- const provinceSearchData = ref([]);
- const citySearchData = ref([]);
- const getCitySearchData = (id, type, isChange) => {
- proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
- if (type === "20") {
- provinceSearchData.value = res;
- if (isChange) {
- sourceList.value.pagination.provinceId = "";
- sourceList.value.pagination.provinceName = "";
- sourceList.value.pagination.cityId = "";
- sourceList.value.pagination.cityName = "";
- }
- } else if (type === "30") {
- citySearchData.value = res;
- if (isChange) {
- sourceList.value.pagination.cityId = "";
- sourceList.value.pagination.cityName = "";
- }
- } else {
- countrySearchData.value = res;
- }
- });
- };
- getCitySearchData("0");
- const openSearch = ref(false);
- const formSearchConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "name",
- label: "客户名称",
- itemType: "text",
- },
- {
- type: "input",
- prop: "contactName",
- label: "客户联系人",
- itemType: "text",
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "contactEmail",
- label: "联系人邮箱",
- itemType: "text",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "address",
- label: "所在城市",
- },
- {
- type: "select",
- label: "客户来源",
- prop: "source",
- itemWidth: 50,
- data: customerSource.value,
- clearable: true,
- },
- {
- type: "select",
- label: "客户类型",
- prop: "status",
- itemWidth: 50,
- data: customerStatus.value,
- clearable: true,
- },
- {
- type: "slot",
- slotName: "tags",
- label: "客户标签",
- },
- ];
- });
- const addSearchTag = ref("");
- const addTagSearchShow = ref(false);
- let copySearch = ref({});
- const moreSearch = () => {
- if (sourceList.value.pagination.tag) {
- sourceList.value.pagination.tags =
- sourceList.value.pagination.tag.split(",");
- } else {
- sourceList.value.pagination.tags = [];
- }
- addTagSearchShow.value = false;
- // copySearch.value = proxy.deepClone(sourceList.value.pagination);
- openSearch.value = true;
- };
- const cancelSearch = () => {
- // sourceList.value.pagination = copySearch.value;
- openSearch.value = false;
- };
- const submitSearch = () => {
- if (
- sourceList.value.pagination.tags &&
- sourceList.value.pagination.tags.length > 0
- ) {
- sourceList.value.pagination.tag =
- sourceList.value.pagination.tags.join(",");
- } else {
- sourceList.value.pagination.tag = "";
- }
- openSearch.value = false;
- sourceList.value.pagination.keyword = "";
- sourceList.value.pagination.pageNum = 1;
- getList();
- };
- const tagSearchClose = (val) => {
- sourceList.value.pagination.tags = sourceList.value.pagination.tags.filter(
- (item) => item !== val
- );
- };
- const changeSearchTag = (val) => {
- sourceList.value.pagination.tags.push(val);
- addTagSearchShow.value = false;
- addSearchTag.value = "";
- };
- const update = (row) => {
- modalType.value = "edit";
- customerId.value = row.id;
- dialogVisible.value = true;
- };
- const table = ref(null);
- onMounted(() => {
- watch(
- () => table.value.statSelectVal,
- (val) => {
- sourceList.value.paginationTwo.statisticsType = val + 1;
- obtainStatisticalData();
- }
- );
- });
- const refreshList = () => {
- dialogVisible.value = false;
- getList();
- };
- const exportExcel = () => {
- proxy.msgTip("正在导出,请稍后", 2);
- proxy
- .postTwo("/customer/exportExcel", sourceList.value.pagination)
- .then((res) => {
- proxy.downloadFile(res, "公海客户.xlsx");
- });
- };
- </script>
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- .infinite-scroll {
- max-height: calc(89vh - 94px - 70px - 58px - 16px);
- overflow-y: auto;
- &::-webkit-scrollbar {
- width: 0px;
- }
- }
- .by-dropdown {
- position: relative;
- text-align: left;
- height: 32px;
- z-index: 1010;
- padding: 0 10px;
- transition: all 0.5s ease;
- cursor: pointer;
- line-height: 32px;
- .by-dropdown-title {
- font-size: 14px;
- background-color: #fff;
- }
- ul {
- position: absolute;
- left: 0;
- top: 32px;
- padding: 0;
- margin: 0;
- z-index: 1200;
- display: none;
- white-space: nowrap;
- background-color: #fff;
- li {
- list-style: none;
- z-index: 1200;
- font-size: 12px;
- height: 30px;
- padding: 0 10px;
- }
- li:hover {
- background-color: #eff6ff;
- color: #0084ff;
- }
- }
- }
- .by-dropdown::before {
- display: block;
- width: 1px;
- content: " ";
- position: absolute;
- height: 14px;
- top: 8px;
- background-color: #ddd;
- right: 0;
- z-index: 1011;
- }
- .by-dropdown:hover {
- background: #ffffff;
- border-radius: 2px 2px 2px 2px;
- opacity: 1;
- ul {
- background: #ffffff;
- box-shadow: 0px 2px 16px 1px rgba(0, 0, 0, 0.06);
- border-radius: 2px 2px 2px 2px;
- opacity: 1;
- display: block;
- text-align: left;
- }
- }
- .by-dropdown-lists {
- max-height: 50vh;
- overflow-y: auto;
- line-height: 1;
- }
- .statistics-text {
- padding-left: 8px;
- width: 152px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .activeSearch {
- background: #409eff;
- color: #fff;
- border-radius: 2px;
- padding: 0 5px;
- }
- </style>
|