1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780 |
- <template>
- <div class="tenant">
- <div style="padding: 20px; background: #fff; margin-bottom: 20px">
- <el-button type="primary" style="margin-left: 10px" @click="openModal()"
- >添加客户</el-button
- >
- </div>
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- :selectConfig="selectConfig"
- :statConfig="statConfig"
- highlight-current-row
- @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
- style="cursor: pointer; color: #409eff; word-break: break-all"
- @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) }} -->
- <span v-if="record.type === '10'"
- >跟进记录:报价单总金额
- </span>
- <span v-if="record.type === '20'"
- >跟进记录:合同总金额
- </span>
- <span>{{ moneyFormat(record.amount, 2) }}</span>
- <span
- v-if="record.type === '10' && record.code"
- :class="{ 'code-class': isHave }"
- @click="
- isHaveOne ? handlePushRoute(record) : () => {}
- "
- >({{ record.code }})</span
- >
- <span
- v-if="record.type === '20' && record.contractCode"
- :class="{ 'code-class': isHaveOne }"
- @click="isHave ? handlePushRoute(record) : () => {}"
- >({{ record.contractCode }})</span
- >
- </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>
- <el-dialog
- :title="modalType == 'add' ? '新增' : '编辑'"
- v-if="dialogVisible"
- v-model="dialogVisible"
- width="800"
- v-loading="loadingOperation"
- >
- <byForm
- :formConfig="formConfig"
- :formOption="formOption"
- v-model="formData.data"
- :rules="rules"
- ref="submit"
- >
- <template #address>
- <el-row style="width: 100%">
- <el-col :span="8">
- <el-form-item prop="countryId">
- <el-select
- v-model="formData.data.countryId"
- placeholder="国家"
- filterable
- @change="(val) => getCityData(val, '20', true)"
- >
- <el-option
- v-for="item in countryData"
- :label="item.chineseName"
- :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) => getCityData(val, '30', true)"
- addressId="provinceId"
- addressName="provinceName"
- v-model="formData.data"
- :data="provinceData"
- >
- </selectCity>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item prop="cityName">
- <selectCity
- placeholder="城市"
- addressId="cityId"
- addressName="cityName"
- v-model="formData.data"
- :data="cityData"
- ></selectCity>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="24">
- <el-form-item prop="address">
- <el-input v-model="formData.data.address" type="textarea">
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </template>
- <template #person>
- <div style="width: 100%">
- <el-button type="primary" @click="clickAddPerson">添 加</el-button>
- <el-table
- :data="formData.data.customerUserList"
- style="width: 100%; margin-top: 16px"
- >
- <el-table-column label="联系人" width="160">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item
- :prop="'customerUserList.' + $index + '.name'"
- :rules="rules.name2"
- :inline-message="true"
- >
- <el-input v-model="row.name" placeholder="请输入联系人" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="电子邮箱">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item
- :prop="'customerUserList.' + $index + '.email'"
- :rules="rules.email"
- :inline-message="true"
- >
- <el-input
- v-model="row.email"
- placeholder="请输入电子邮箱"
- />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="操作"
- width="120"
- fixed="right"
- >
- <template #default="{ row, $index }">
- <el-button
- type="primary"
- link
- @click="clickInformationMore(row, $index)"
- >更多</el-button
- >
- <el-button type="primary" link @click="clickDelete($index)"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="dialogVisible = false" size="large">取 消</el-button>
- <el-button
- type="primary"
- @click="submitForm()"
- size="large"
- :loading="submitLoading"
- >确 定</el-button
- >
- </template>
- </el-dialog>
- <el-dialog
- title="更多联系方式"
- v-if="openPerson"
- v-model="openPerson"
- width="700"
- >
- <el-form
- :label-position="'top'"
- :model="formPerson.data"
- :rules="rulesPerson"
- ref="person"
- >
- <el-form-item label="联系人" prop="name">
- <el-input v-model="formPerson.data.name" />
- </el-form-item>
- <el-form-item label="电子邮箱" prop="email">
- <el-input v-model="formPerson.data.email" />
- </el-form-item>
- <el-form-item label="更多联系方式">
- <div style="width: 100%">
- <el-button type="primary" @click="clickAddMoreInformation"
- >添 加</el-button
- >
- <el-table
- :data="formPerson.data.contact"
- style="width: 100%; margin-top: 16px"
- >
- <el-table-column label="类型" width="180">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item
- :prop="'contact.' + $index + '.type'"
- :rules="rulesPerson.type"
- :inline-message="true"
- >
- <el-select
- v-model="row.type"
- placeholder="请选择类型"
- style="width: 100%"
- >
- <el-option
- v-for="item in contactType"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="联系号码">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item
- :prop="'contact.' + $index + '.contactNo'"
- :rules="rulesPerson.contactNo"
- :inline-message="true"
- >
- <el-input
- v-model="row.contactNo"
- placeholder="请输入联系号码"
- />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="操作"
- width="120"
- fixed="right"
- >
- <template #default="{ $index }">
- <el-button
- type="primary"
- link
- @click="clickInformationDelete($index)"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button @click="openPerson = false" size="large">取 消</el-button>
- <el-button type="primary" @click="submitPerson()" size="large"
- >确 定</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="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
- :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="large">取 消</el-button>
- <el-button type="primary" @click="submitFollow()" size="large"
- >确 定</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) }} -->
- <span v-if="record.type === '10'"
- >跟进记录:报价单总金额
- </span>
- <span v-if="record.type === '20'"
- >跟进记录:合同总金额
- </span>
- <span>{{ moneyFormat(record.amount, 2) }}</span>
- <span
- v-if="record.type === '10' && record.code"
- :class="{ 'code-class': isHave }"
- @click="isHaveOne ? handlePushRoute(record) : () => {}"
- >({{ record.code }})</span
- >
- <span
- v-if="record.type === '20' && record.contractCode"
- :class="{ 'code-class': isHaveOne }"
- @click="isHave ? handlePushRoute(record) : () => {}"
- >({{ record.contractCode }})</span
- >
- </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="large"
- >关 闭</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.chineseName"
- :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="large">取 消</el-button>
- <el-button type="primary" @click="submitSearch()" size="large"
- >确 定</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";
- const { proxy } = getCurrentInstance();
- 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: "customerCode",
- width: 120,
- },
- },
- {
- 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: 140,
- 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() {
- 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: "input",
- prop: "customerCode",
- label: "客户代码",
- required: true,
- itemWidth: 100,
- itemType: "text",
- },
- {
- type: "input",
- prop: "dutyParagraph",
- label: "客户税号",
- required: true,
- itemWidth: 100,
- itemType: "text",
- },
- {
- 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,
- },
- {
- type: "select",
- label: "客户标签",
- prop: "tags",
- itemWidth: 100,
- multiple: true,
- data: customerTag.value,
- style: {
- width: "100%",
- },
- },
- {
- 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";
- formData.data = {
- countryId: "44",
- tags: [],
- customerUserList: [
- {
- name: "",
- email: "",
- },
- ],
- };
- getCityData(formData.data.countryId, "20");
- loadingOperation.value = false;
- dialogVisible.value = true;
- };
- const countryData = ref([]);
- const provinceData = ref([]);
- const cityData = ref([]);
- const getCityData = (id, type, isChange) => {
- proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
- if (type === "20") {
- provinceData.value = res;
- if (isChange) {
- formData.data.provinceId = "";
- formData.data.provinceName = "";
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else if (type === "30") {
- cityData.value = res;
- if (isChange) {
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else {
- countryData.value = res;
- }
- });
- };
- getCityData("0");
- const clickAddPerson = () => {
- if (
- formData.data.customerUserList &&
- formData.data.customerUserList.length > 0
- ) {
- formData.data.customerUserList.push({
- name: "",
- email: "",
- });
- } else {
- formData.data.customerUserList = [
- {
- name: "",
- email: "",
- },
- ];
- }
- };
- 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 = () => {
- submit.value.handleSubmit(() => {
- if (
- formData.data.customerUserList &&
- formData.data.customerUserList.length > 0
- ) {
- formData.data.tag = formData.data.tags.join(",");
- submitLoading.value = true;
- proxy.post("/customer/" + modalType.value, formData.data).then(
- () => {
- ElMessage({
- message: modalType.value == "add" ? "添加成功" : "编辑成功",
- type: "success",
- });
- dialogVisible.value = false;
- submitLoading.value = false;
- getList();
- obtainStatisticalData();
- },
- (err) => {
- console.log(err);
- submitLoading.value = false;
- }
- );
- } else {
- ElMessage("请添加客户联系人");
- }
- });
- };
- 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) => {
- proxy.$router.push({
- path: "/ERP/customer/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 moreIndex = ref(0);
- const clickInformationMore = (item, index) => {
- moreIndex.value = index;
- if (item.contactJson) {
- item.contact = JSON.parse(item.contactJson);
- } else {
- item.contact = [];
- }
- formPerson.data = proxy.deepClone(item);
- openPerson.value = true;
- };
- const clickDelete = (index) => {
- formData.data.customerUserList.splice(index, 1);
- };
- const clickAddMoreInformation = () => {
- if (formPerson.data.contact && formPerson.data.contact.length > 0) {
- formPerson.data.contact.push({
- type: "",
- contactNo: "",
- });
- } else {
- formPerson.data.contact = [
- {
- type: "",
- contactNo: "",
- },
- ];
- }
- };
- const clickInformationDelete = (index) => {
- formPerson.data.contact.splice(index, 1);
- };
- const submitPerson = () => {
- person.value.validate((valid) => {
- if (valid) {
- formPerson.data.contactJson = JSON.stringify(formPerson.data.contact);
- formData.data.customerUserList[moreIndex.value] = formPerson.data;
- openPerson.value = 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 obtainStatisticalData = () => {
- proxy
- .post("/customer/sourceStatistics", sourceList.value.paginationTwo)
- .then((res) => {
- statisticalData.value = res;
- });
- };
- obtainStatisticalData();
- 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: "slot",
- slotName: "address",
- label: "所在城市",
- },
- {
- type: "input",
- prop: "customerCode",
- label: "客户代码",
- itemType: "text",
- },
- {
- 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 isHave = ref(false);
- if (
- useUserStore().permissions &&
- useUserStore().permissions.includes("contract")
- ) {
- isHave.value = true;
- }
- // 判断当前用户有无报价单页面权限
- const isHaveOne = ref(false);
- if (
- useUserStore().permissions &&
- useUserStore().permissions.includes("priceSheet")
- ) {
- isHaveOne.value = true;
- }
- const handlePushRoute = (row) => {
- if (row.type === "10") {
- proxy.$router.push({
- name: "PriceSheet",
- query: {
- code: row.code,
- },
- });
- } else if (row.type === "20") {
- proxy.$router.push({
- name: "Contract",
- query: {
- code: row.contractCode,
- },
- });
- }
- };
- const table = ref(null);
- onMounted(() => {
- watch(
- () => table.value.statSelectVal,
- (val) => {
- sourceList.value.paginationTwo.statisticsType = val + 1;
- obtainStatisticalData();
- }
- );
- });
- </script>
- <style lang="scss" scoped>
- .code-class {
- cursor: pointer;
- color: #409eff;
- }
- .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;
- }
- </style>
|