12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
- <el-form-item label="企微公司" prop="corpId">
- <el-select v-model="queryParams.corpId" placeholder="企微公司" size="small" @change="updateCorpId()">
- <el-option
- v-for="dict in myQwCompanyList"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="客户名称" prop="name">
- <el-input
- v-model="queryParams.name"
- placeholder="请输入客户名称"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="所属名称" prop="qwUserName">
- <el-input
- v-model="queryParams.qwUserName"
- placeholder="请输入所属员工名称"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="用户类别" prop="type">
- <el-select v-model="queryParams.type" placeholder="请选择用户类别" clearable size="small">
- <el-option
- v-for="dict in typeOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="性别" prop="gender">
- <el-select v-model="queryParams.gender" placeholder="状态" clearable size="small">
- <el-option
- v-for="dict in genderOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="电话号码" prop="remarkMobiles">
- <el-input
- v-model="queryParams.remarkMobiles"
- placeholder="请输入备注电话号码"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="来源" prop="addWay">
- <el-select v-model="queryParams.addWay" placeholder="来源" clearable size="small">
- <el-option
- v-for="dict in addWayOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="状态" prop="status">
- <el-select v-model="queryParams.status" placeholder="状态" clearable size="small">
- <el-option
- v-for="dict in statusOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="转接状态" prop="addWay">
- <el-select v-model="queryParams.transferStatus" placeholder="转接状态" clearable size="small">
- <el-option
- v-for="dict in transferStatusOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="是否绑小程序" prop="isBindMini">
- <el-select v-model="queryParams.isBindMini" placeholder="是否绑定小程序" clearable size="small" @change="handleQuery" >
- <el-option
- v-for="dict in isBindMiniOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="标签" prop="tagIds">
- <el-select v-model="selectTags" remote multiple placeholder="请选择" filterable style="width: 100%;">
- <el-option
- v-for="dict in tagList"
- :label="dict.name"
- :value="dict.tagId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="备注" prop="remark">
- <el-input
- v-model="queryParams.remark"
- placeholder="请输入备注"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="添加时间" prop="createTime">
- <el-date-picker clearable size="small"
- v-model="queryParams.createTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="选择添加时间">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="流失时间" prop="lossTime">
- <el-date-picker clearable size="small"
- v-model="queryParams.lossTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="选择流失时间">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="删除时间" prop="delTime">
- <el-date-picker clearable size="small"
- v-model="queryParams.delTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="选择删除时间">
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <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="['qw:externalContact:add']"
- >同步</el-button>
- </el-col> -->
- <el-col :span="1.5">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- :disabled="single"
- @click="handleUpdate"
- v-hasPermi="['qw:externalContact:edit']"
- >修改备注</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- :loading="exportLoading"
- @click="handleExport"
- v-hasPermi="['qw:externalContact:export']"
- >导出</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- size="mini"
- @click="addUserTag"
- v-hasPermi="['qw:externalContact:addTag']"
- >批量添加标签</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- size="mini"
- @click="delUserTag"
- v-hasPermi="['qw:externalContact:delTag']"
- >批量移除标签</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- size="mini"
- @click="updateTalk"
- >批量更改交流状态</el-button>
- </el-col>
- <!-- <el-col :span="1.5">-->
- <!-- <el-button-->
- <!-- type="primary"-->
- <!-- plain-->
- <!-- size="mini"-->
- <!-- @click="setUserCourseSop"-->
- <!-- v-hasPermi="['qw:externalContact:setCourseSop']"-->
- <!-- >批量设置课程SOP</el-button>-->
- <!-- </el-col>-->
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-tabs type="card" v-model="isBindActiveName" @tab-click="handleClickX">
- <el-tab-pane label="全部" name="all"></el-tab-pane>
- <el-tab-pane label="已绑定CRM" name="isBind"></el-tab-pane>
- <el-tab-pane label="未绑定CRM" name="noBind"></el-tab-pane>
- </el-tabs>
- <el-table v-loading="loading" :data="externalContactList" @selection-change="handleSelectionChange" border>
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="企微客户ID" align="center" prop="id" />
- <el-table-column label="企微客户头像" align="center" prop="avatar" width="100px">
- <template slot-scope="scope">
- <el-popover
- placement="right"
- title=""
- trigger="hover">
- <img slot="reference" :src="scope.row.avatar" width="60px">
- <img :src="scope.row.avatar" style="max-width: 200px;">
- </el-popover>
- </template>
- </el-table-column>
- <el-table-column label="企微客户名称" prop="name" width="110px"/>
- <el-table-column label="所属员工" align="center" prop="qwUserName" width="120px"/>
- <el-table-column label="员工部门" align="center" prop="departmentName" width="120px"/>
- <el-table-column label="用户类别" align="center" prop="type">
- <template slot-scope="scope">
- <dict-tag :options="typeOptions" :value="scope.row.type"/>
- </template>
- </el-table-column>
- <el-table-column label="性别" align="center" prop="gender">
- <template slot-scope="scope">
- <dict-tag :options="genderOptions" :value="scope.row.gender"/>
- </template>
- </el-table-column>
- <el-table-column label="备注" align="center" prop="remark" />
- <el-table-column label="描述信息" align="center" prop="description" />
- <el-table-column label="是否重粉" align="center" prop="isRepeat" >
- <template slot-scope="scope">
- <el-tag :type="scope.row.isRepeat === 1 ? 'success' : 'info'">
- {{ scope.row.isRepeat === 1 ? '是' : '否' }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="标签" align="center" prop="tagIds" width="250px">
- <template slot-scope="scope">
- <div v-for="i in JSON.parse(scope.row.tagIds)" :key="i" style="display: inline;">
- <el-tag type="success" v-for="ii in tagList" :key="ii.id" style="margin: 3px;" v-if="ii.tagId==i">{{ii.name}}</el-tag>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="状态" align="center" prop="status" width="120px" >
- <template slot-scope="scope">
- <dict-tag :options="statusOptions" :value="scope.row.status"/>
- </template>
- </el-table-column>
- <el-table-column label="添加时间" align="center" prop="createTime" width="100px" />
- <el-table-column label="流失时间" align="center" prop="lossTime" width="100px" />
- <el-table-column label="删除时间" align="center" prop="delTime" width="100px" />
- <el-table-column label="备注电话号码" align="center" prop="remarkMobiles" width="150px">
- <template slot-scope="scope">
- <div v-for="i in JSON.parse(scope.row.remarkMobiles)" :key="i">{{i}}</div>
- </template>
- </el-table-column>
- <el-table-column label="备注企业名称" align="center" prop="remarkCorpName" />
- <el-table-column label="来源" align="center" prop="addWay" width="100px">
- <template slot-scope="scope">
- <dict-tag :options="addWayOptions" :value="scope.row.addWay"/>
- </template>
- </el-table-column>
- <el-table-column label="转接状态" align="center" prop="transferStatus" width="100px" >
- <template slot-scope="scope">
- <dict-tag :options="transferStatusOptions" :value="scope.row.transferStatus"/>
- </template>
- </el-table-column>
- <el-table-column label="企业id" align="center" prop="corpId" />
- <el-table-column label="是否绑小程序" width="100px" align="center" fixed="right">
- <template slot-scope="scope">
- <el-tag v-if="scope.row.fsUserId" >已绑定</el-tag>
- <el-tag v-else type="info"> 未绑定</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
- <template slot-scope="scope">
- <el-button
- v-if="scope.row.status==0||scope.row.status==2"
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['qw:externalContact:edit']"
- >修改备注</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit-outline"
- @click="handleUpdateCustomer(scope.row)"
- >
- <span v-if="scope.row.customerId">换绑CRM</span>
- <span v-else>绑定CRM</span>
- </el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit-outline"
- @click="handleUpdateUser(scope.row)"
- >
- <span v-if="scope.row.fsUserId">换绑小程序用户</span>
- <span v-else>绑定小程序用户</span>
- </el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-thumb"
- @click="handleUnBindUserId(scope.row)"
- v-hasPermi="['qw:externalContact:unBindUserId']"
- >
- <span v-if="scope.row.fsUserId">解除小程序用户绑定</span>
- </el-button>
- <el-button v-if="scope.row.customerId"
- size="mini"
- type="text"
- icon="el-icon-paperclip"
- @click="handleShow(scope.row)"
- >CRM客户详情</el-button>
- <el-button
- size="mini"
- type="text"
- @click="handledetails(scope.row)"
- >用户信息
- </el-button>
- <el-button
- size="mini"
- type="text"
- @click="handleViewRepeat(scope.row)"
- v-if="scope.row.isRepeat===1"
- >查看重粉</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <el-drawer size="75%" :title="show.title" :visible.sync="show.open">
- <customer-details ref="customerDetails" @refreshList="refreshList"/>
- </el-drawer>
- <el-dialog visible.sync="true" width="800px">
- </el-dialog>
- <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
- <div>搜索标签:
- <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
- </div>
- <el-form ref="form" :model="addTagForm" label-width="80px">
- <div v-for="item in tagGroupList" :key="item.id" >
- <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
- <span class="name-background">{{ item.name }}</span>
- </div>
- <div class="tag-container">
- <a
- v-for="tagItem in item.tag"
- class="tag-box"
- @click="tagSelection(tagItem)"
- :class="{ 'tag-selected': tagItem.isSelected }"
- >
- {{ tagItem.name }}
- </a>
- </div>
- </div>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
- <el-button @click="addTagCancel">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
- <div>搜索标签:
- <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
- </div>
- <el-form ref="form" :model="addTagForm" label-width="80px">
- <div v-for="item in tagGroupList" :key="item.id" >
- <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
- <span class="name-background">{{ item.name }}</span>
- </div>
- <div class="tag-container">
- <a
- v-for="tagItem in item.tag"
- class="tag-box"
- @click="tagSelection(tagItem)"
- :class="{ 'tag-selected': tagItem.isSelected }"
- >
- {{ tagItem.name }}
- </a>
- </div>
- </div>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
- <el-button @click="DelTagCancel">取 消</el-button>
- </div>
- </el-dialog>
- <!-- 添加或修改企业微信客户对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="100px">
- <el-form-item label="备注" prop="remark">
- <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
- </el-form-item>
- <el-form-item label="描述信息" prop="description">
- <el-input v-model="form.description" type="textarea" :rows="3" placeholder="请输入描述信息" />
- </el-form-item>
- <el-form-item label="备注电话号码" prop="remarkMobiles">
- <el-tag
- :key="tag"
- v-for="tag in remarkMobiles"
- closable
- :disable-transitions="false"
- @close="handleClose(tag)">
- {{tag}}
- </el-tag>
- <el-input
- style="width:110px"
- class="input-new-tag"
- v-if="inputVisible"
- v-model="inputValue"
- ref="saveTagInput"
- size="small"
- @keyup.enter.native="handleInputConfirm"
- @blur="handleInputConfirm"
- >
- </el-input>
- <el-button v-else class="button-new-tag" size="small" style="width: 110px" @click="showInput">新增电话</el-button>
- </el-form-item>
- <el-form-item label="备注企业名称" prop="remarkCorpName">
- <el-input v-model="form.remarkCorpName" placeholder="请输入备注企业名称" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <!-- 绑定客户 -->
- <el-dialog :title="bindCustomer.title" :visible.sync="bindCustomer.open" width="1200px" append-to-body>
- <mycustomer ref="mycustomer" @bindCustomerId="bindCustomerId"></mycustomer>
- </el-dialog>
- <!-- 设置一个课程sop-->
- <el-dialog :title="setSop.title" :visible.sync="setSop.open" width="1200px" append-to-body>
- <SopDialog ref="SopDialog" @bindCourseSop="bindCourseSop"></SopDialog>
- </el-dialog>
- <el-dialog :title="user.title" :visible.sync="user.open" width="800px" append-to-body>
- <selectUser ref="selectUser" @bindMiniCustomerId="bindMiniCustomerId"></selectUser>
- </el-dialog>
- <el-dialog :title="info.title" :visible.sync="info.open" width="1100px" append-to-body>
- <info ref="Details" />
- </el-dialog>
- <el-dialog :title="repeatDialog.title" :visible.sync="repeatDialog.visible" width="70%" append-to-body>
- <el-table v-loading="repeatDialog.loading" :data="repeatDialog.data" border>
- <el-table-column label="所属公司ID" prop="companyId" align="center" />
- <el-table-column label="公司名称" prop="companyName" align="center" />
- <el-table-column label="销售ID" prop="companyUserId" align="center" />
- <el-table-column label="销售名称" prop="companyUserName" align="center" />
- <el-table-column label="销售微信号" prop="saleerWx" align="center" />
- <el-table-column label="创建时间" prop="createDate" align="center" />
- </el-table>
- <div slot="footer" class="dialog-footer">
- <el-button @click="repeatDialog.visible = false">关 闭</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- bindUserId,
- addTag,
- delTag,
- listExternalContact,
- getExternalContact,
- delExternalContact,
- addExternalContact,
- updateExternalContact,
- exportExternalContact,
- editbindCustomer,
- setCustomerCourseSop,
- getCustomerCourseSop,
- setCustomerCourseSopList,
- unBindUserId
- } from '@/api/qw/externalContact'
- import { getMyQwUserList,getMyQwCompanyList } from "@/api/qw/user";
- import {listTag, getTag, searchTags,} from "@/api/qw/tag";
- import { allListTagGroup} from "@/api/qw/tagGroup";
- import mycustomer from '@/views/qw/externalContact/mycustomer'
- import customerDetails from '@/views/qw/externalContact/customerDetails'
- import SopDialog from '@/views/course/sop/SopDialog.vue'
- import selectUser from "@/views/qw/externalContact/selectUser.vue";
- import info from "@/views/qw/externalContact/info.vue";
- import { editTalk } from "@/api/qw/externalContactInfo";
- import {getQwRepeatData} from "@/api/user/fsUser";
- export default {
- name: "ExternalContact",
- components:{mycustomer,customerDetails,SopDialog,selectUser,info},
- data() {
- return {
- user:{
- open:false,
- title:"修改客户"
- },
- userForm:{
- id:null,
- fsUserId:null,
- },
- info:{
- title:"用户信息",
- open:false,
- },
- isBindMiniOptions:[
- {dictLabel:"已绑定",dictValue:'isBindMini'},
- {dictLabel:"未绑定",dictValue:'noBindMini'},
- ],
- //标签弹窗选择
- tagChange:{
- open:false,
- index:null,
- },
- // 遮罩层
- loading: false,
- // 导出遮罩层
- exportLoading: false,
- tagOpen:false,
- tagDelOpen:false,
- // 选中数组
- ids: [],
- isBindActiveName:"all",
- remarkMobiles: [],
- inputVisible: false,
- inputValue: '',
- // 非单个禁用
- single: true,
- tagGroupList: [],
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 企业微信客户表格数据
- externalContactList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 用户类别字典
- typeOptions: [],
- // 性别字典
- genderOptions: [],
- addTagForm:{
- userIds:[],
- tagIds:[]
- },
- myQwCompanyList:[],
- show:{
- title:"客户详情",
- open:false,
- },
- //存储选择的客户
- chooseCustomerSOP:null,
- setSop:{
- title:"选择课节SOP",
- open:false,
- //区分单选1还是多选2
- type:null,
- },
- //合成的客户-课节SOP参数
- customerCourseForm:{},
- //查询是否已经设置过客户-某个课节的SOP
- customerCourseFormLogs:{},
- //绑定客户
- bindCustomer:{
- title:null,
- open:false,
- },
- //绑定的参数表
- qwFormCustomer:{
- externalContactId:null,
- customerId:null,
- },
- // 来源字典
- addWayOptions: [],
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- userId: null,
- qwUserName:null,
- externalUserId: null,
- name: null,
- avatar: null,
- type: null,
- qwUserId:null,
- gender: null,
- description: null,
- tagIds: null,
- remark:null,
- remarkMobiles: null,
- remarkCorpName: null,
- addWay: null,
- operUserid: null,
- corpId: null,
- companyId: null,
- status:null,
- transferStatus:null,
- isBind:null,
- isBindMini:null,
- lossTime:null,
- createTime:null,
- },
- selectTags:[],
- // 表单参数
- form: {},
- tagList:[],
- transferStatusOptions:[],
- statusOptions:[],
- // 表单校验
- rules: {
- },
- repeatDialog: {
- visible: false,
- loading: false,
- title: "查看重粉数据",
- data: []
- }
- };
- },
- created() {
- this.getDicts("sys_qw_externalContact_type").then(response => {
- this.typeOptions = response.data;
- });
- getMyQwCompanyList().then(response => {
- this.myQwCompanyList = response.data;
- if(this.myQwCompanyList!=null){
- this.queryParams.corpId=this.myQwCompanyList[0].dictValue
- var listTagFrom={corpId:this.queryParams.corpId}
- allListTagGroup(listTagFrom).then(response => {
- this.tagGroupList = response.rows;
- });
- listTag(listTagFrom).then(response => {
- this.tagList = response.rows;
- });
- this.getList();
- }
- });
- this.getDicts("sys_sex").then(response => {
- this.genderOptions = response.data;
- });
- this.getDicts("sys_qw_externalContact_addWay").then(response => {
- this.addWayOptions = response.data;
- });
- this.getDicts("sys_qw_external_contact_status").then(response => {
- this.statusOptions = response.data;
- });
- this.getDicts("sys_qw_transfer_status").then(response => {
- this.transferStatusOptions = response.data;
- });
- },
- methods: {
- // 查看重粉
- handleViewRepeat(row){
- this.repeatDialog.data = [];
- this.repeatDialog.visible = true;
- this.repeatDialog.loading = true;
- const params = {
- externalUserID: row.externalUserId,
- corpId: row.corpId
- };
- getQwRepeatData(params).then(response => {
- if (response.code === 200) {
- this.repeatDialog.data = response.data || [];
- } else {
- this.msgError(response.msg || "获取重粉数据失败");
- }
- this.repeatDialog.loading = false;
- }).catch(error => {
- console.error("Error fetching repeat follower data:", error);
- this.msgError("请求重粉数据接口失败");
- this.repeatDialog.loading = false;
- });
- },
- updateCorpId(){
- var listTagFrom={corpId:this.queryParams.corpId}
- allListTagGroup(listTagFrom).then(response => {
- this.tagGroupList = response.rows;
- });
- listTag(listTagFrom).then(response => {
- this.tagList = response.rows;
- });
- this.getList();
- },
- /** 查询企业微信客户列表 */
- getList() {
- this.loading = true;
- listExternalContact(this.queryParams).then(response => {
- this.externalContactList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- bindMiniCustomerId(row){
- console.log(row)
- this.userForm.fsUserId=row;
- bindUserId(this.userForm).then(res=>{
- if (res.code==200){
- this.$message.success('绑定成功')
- }else {
- this.$message.error('绑定失败:',res.msg)
- }
- this.getList()
- this.user.open=false;
- })
- },
- /** 查看客户详情 */
- handleShow(row){
- this.show.open=true;
- var that=this;
- const tab = "visit";
- setTimeout(() => {
- that.$refs.customerDetails.getDetails(row.customerId);
- that.$refs.customerDetails.handleClick(tab);
- }, 200);
- },
- handledetails(row){
- this.info.open=true;
- setTimeout(() => {
- this.$refs.Details.getDetails(row.id);
- }, 1);
- },
- closeInfo(){
- this.info.open=false
- },
- handleClickX(tab, event) {
- this.queryParams.isBind=tab.name;
- this.handleQuery();
- },
- handleClose(tag) {
- this.remarkMobiles.splice(this.remarkMobiles.indexOf(tag), 1);
- },
- showInput() {
- this.inputVisible = true;
- this.$nextTick(_ => {
- this.$refs.saveTagInput.$refs.input.focus();
- });
- },
- handleInputConfirm() {
- let inputValue = this.inputValue;
- if (inputValue) {
- this.remarkMobiles.push(inputValue);
- }
- this.inputVisible = false;
- this.inputValue = '';
- },
- addUserTag(){
- if(this.ids==null||this.ids==""){
- return this.$message('请选择需要添加标签的客户');
- }
- for (let i = 0; i < this.tagGroupList.length; i++) {
- for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
- this.tagGroupList[i].tag[x].isSelected=false;
- }
- }
- this.tagOpen = true;
- },
- delUserTag(){
- if(this.ids==null||this.ids==""){
- return this.$message('请选择需要移除标签的客户');
- }
- for (let i = 0; i < this.tagGroupList.length; i++) {
- for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
- this.tagGroupList[i].tag[x].isSelected=false;
- }
- }
- this.tagDelOpen = true;
- },
- //重新获取页面数据
- refreshList(){
- this.getList();
- },
- //批量设置课程sop
- setUserCourseSop(){
- if(this.ids==null||this.ids==""){
- return this.$message('请选择需要设置课程SOP的客户');
- }
- this.$confirm('批量设置客户课节SOP可能会存在重复,确定要批量设置吗?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.setSop.open = true;
- this.setSop.type = 2;
- })
- .catch(() => {
- // 可以处理用户点击“取消”的逻辑
- });
- },
- tagSelection(row){
- row.isSelected= !row.isSelected;
- this.$forceUpdate();
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- addTagCancel() {
- this.tagOpen = false;
- this.addTagForm={
- userIds:[],
- tagIds:[]
- };
- },
- DelTagCancel() {
- this.tagDelOpen = false;
- this.addTagForm={
- userIds:[],
- tagIds:[]
- };
- },
- addTagSubmitForm(){
- for (let i = 0; i < this.tagGroupList.length; i++) {
- for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
- if(this.tagGroupList[i].tag[x].isSelected==true){
- this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId)
- }
- }
- }
- if(this.addTagForm.tagIds==[]||this.addTagForm.tagIds==null||this.addTagForm.tagIds==""){
- return this.$message('请选择标签');
- }
- this.addTagForm.corpId=this.queryParams.corpId
- this.addTagForm.userIds=this.ids;
- let loadingRock = this.$loading({
- lock: true,
- text: '正在执行中请稍后~~请不要刷新页面!!',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- addTag(this.addTagForm).then(response => {
- this.msgSuccess(response.msg);
- this.tagOpen = false;
- loadingRock.close();
- this.addTagForm={
- userIds:[],
- tagIds:[]
- };
- this.getList()
- }).finally(res=>{
- loadingRock.close();
- });
- },
- tagDelSubmitForm(){
- for (let i = 0; i < this.tagGroupList.length; i++) {
- for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
- if(this.tagGroupList[i].tag[x].isSelected==true){
- this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId)
- }
- }
- }
- if(this.addTagForm.tagIds==[]||this.addTagForm.tagIds==null||this.addTagForm.tagIds==""){
- return this.$message('请选择标签');
- }
- this.addTagForm.corpId=this.queryParams.corpId
- this.addTagForm.userIds=this.ids;
- let loadingRock = this.$loading({
- lock: true,
- text: '正在执行中请稍后~~请不要刷新页面!!',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- delTag(this.addTagForm).then(response => {
- this.msgSuccess(response.msg);
- this.tagDelOpen = false;
- loadingRock.close();
- this.addTagForm={
- userIds:[],
- tagIds:[]
- };
- this.getList()
- }).finally(res=>{
- loadingRock.close();
- });
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- userId: null,
- externalUserId: null,
- name: null,
- companyUserId:null,
- customerId:null,
- avatar: null,
- type: null,
- gender: null,
- remark: null,
- description: null,
- tagIds: null,
- remarkMobiles: null,
- remarkCorpName: null,
- addWay: null,
- operUserid: null,
- corpId: null,
- companyId: null,
- transferStatus:null,
- status:null,
- createTime:null,
- transferTime:null,
- transferNum:null,
- lossTime:null,
- delTime:null,
- state:null,
- wayId:null,
- stageStatus:null,
- customerName:null
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.tagIds=this.selectTags.join(',')
- this.queryParams.pageNum = 1;
- this.getList();
- },
- handleSearchTags(name){
- searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
- this.tagGroupList = response.rows;
- });
- },
- cancelSearchTags(){
- this.updateCorpId()
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.queryParams.corpId= this.myQwCompanyList[0].dictValue;
- this.selectTags=[];
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.loading=true;
- this.form.corpId=this.queryParams.corpId
- addExternalContact(this.form).then(response => {
- this.msgSuccess("同步成功");
- this.getList();
- }).finally(()=>{
- this.loading=false;
- });
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getExternalContact(id).then(response => {
- this.form = response.data;
- if(this.form.remarkMobiles!=null){
- this.remarkMobiles=JSON.parse(this.form.remarkMobiles)
- }else{
- this.remarkMobiles=[]
- }
- this.open = true;
- this.title = "修改企业微信客户";
- });
- },
- /** 绑定客户操作 */
- handleUpdateCustomer(row){
- this.bindCustomer.title="绑定客户"
- this.bindCustomer.open=true;
- this.form.id=row.id
- this.form.externalUserId=row.externalUserId
- this.form.name=row.name
- },
- handleUpdateUser(row){
- this.user.title="绑定客户"
- this.user.open=true;
- this.userForm.id=row.id;
- },
- handleUnBindUserId(val){
- this.$confirm(
- '确认解绑客户:<span style="color: green;">' + val.name + '' +
- '</span> 的小程序用户?<br><span style="color: red;">【ps:可能会导致客户无法看课】</span>',
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
- }
- ).then(() => {
- return unBindUserId(val.id);
- }).then(response => {
- this.getList();
- this.msgSuccess("解绑成功");
- }).finally(res=>{
- this.getList();
- })
- },
- bindCustomerId(row){
- console.log("row",row)
- // this.qwFormCustomer.customerId=row;
- this.form.customerId=row;
- this.form.corpId=this.queryParams.corpId;
- this.msgWarning("绑定中.....同步信息中.....");
- editbindCustomer(this.form).then(res=>{
- //清空表单
- this.reset();
- this.bindCustomer.open = false;
- this.msgSuccess("绑定成功");
- this.getList();
- })
- },
- //设置一个SOP
- setCourseSOP(row) {
- // 检查 row.miniUserId 是否为 null
- if (row.miniUserId === null || row.miniUserId === undefined) {
- return this.$confirm('当前客户【CRM客户详情】中 未绑定小程序客户,请先绑定', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).catch(error => {
- this.msgWarning("操作取消:", error);
- });
- } else {
- this.chooseCustomerSOP = row;
- this.setSop.open = true;
- this.setSop.type=1;
- }
- },
- //选择课程SOP
- // 用于设置 customerCourseForm 和 customerCourseFormLogs 的共同属性
- setCommonProperties(form, row) {
- form.qwUserid = this.chooseCustomerSOP.userId;
- form.companyUserId = this.chooseCustomerSOP.companyUserId;
- form.externalUserId = this.chooseCustomerSOP.externalUserId;
- form.customerId = this.chooseCustomerSOP.customerId;
- form.miniUserId = this.chooseCustomerSOP.miniUserId;
- form.businessId = row.businessId;
- },
- bindCourseSop(row,days) {
- if (this.setSop.type==2){
- this.setSop.open = false;
- this.loading=true;
- this.msgWarning("设定中.....同步信息中.....");
- setCustomerCourseSopList({ids:this.ids,fsCourseSopId:row.id,days:days}).then(res=>{
- let msg=" 批量设置成功数【" + res.successNum + "】,<br>"
- if (res.failCRM.length>0){
- msg+="失败的客户【" + res.failCRM + "】,原因是未绑定CRM客户。<br>"
- }
- if (res.failMiNi.length>0){
- msg+="失败的客户【" + res.failMiNi + "】,原因是CRM中未绑定小程序客户。<br>"
- }
- if (res.failCompany.length>0){
- msg+="失败的客户【" + res.failCompany + "】,原因是客户没有所属成员。<br>"
- }
- return this.$confirm(msg, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- dangerouslyUseHTMLString: true // 允许使用HTML标签
- }).catch(error => {
- this.msgSuccess("操作完成~");
- });
- }).finally(()=>{
- this.loading = false;
- this.getList();
- })
- }else if (this.setSop.type==1){
- // 设置 customerCourseFormLogs 的属性
- this.setCommonProperties(this.customerCourseFormLogs, row);
- // 设置 customerCourseForm 的属性
- this.setCommonProperties(this.customerCourseForm, row);
- this.customerCourseForm.sopId = row.id;
- this.customerCourseForm.sopType = row.sopType;
- this.customerCourseForm.setting = row.setting;
- this.customerCourseForm.days = days;
- // 执行异步操作
- getCustomerCourseSop(this.customerCourseFormLogs)
- .then(res => {
- if (res) {
- return this.$confirm('当前客户已设置过相同课程课节SOP,确定还要再次设置吗?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- });
- } else {
- return Promise.resolve(); // 如果没有设置过,直接执行后续操作
- }
- })
- .then(() => {
- this.loading = true;
- this.setSop.open = false;
- this.msgSuccess("设定中.....同步信息中.....");
- return setCustomerCourseSop(this.customerCourseForm);
- })
- .then(() => {
- this.msgSuccess("设定成功");
- })
- .catch(error => {
- this.msgWarning("操作取消:", error);
- })
- .finally(() => {
- this.loading = false;
- this.getList();
- });
- }
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- this.form.remarkMobiles=JSON.stringify(this.remarkMobiles)
- updateExternalContact(this.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addExternalContact(this.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$confirm('是否确认删除企业微信客户编号为"' + ids + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delExternalContact(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {});
- },
- updateTalk(row){
- const ids = row.id || this.ids;
- this.$confirm('是否确认批量更改用户信息为非首次交流', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return editTalk(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- const queryParams = this.queryParams;
- this.$confirm('是否确认导出所有企业微信客户数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.exportLoading = true;
- return exportExternalContact(queryParams);
- }).then(response => {
- this.download(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
- }
- }
- };
- </script>
- <style scoped>
- /* CSS 样式 */
- .tag-container {
- display: flex;
- flex-wrap: wrap; /* 超出宽度时自动换行 */
- gap: 8px; /* 设置标签之间的间距 */
- }
- .name-background {
- display: inline-block;
- background-color: #abece6; /* 背景颜色 */
- padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
- border-radius: 4px; /* 可选:设置圆角 */
- }
- /* CSS 样式 */
- .tag-container {
- display: flex;
- flex-wrap: wrap; /* 超出宽度时自动换行 */
- gap: 8px; /* 设置标签之间的间距 */
- }
- .name-background {
- display: inline-block;
- background-color: #abece6; /* 背景颜色 */
- padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
- border-radius: 4px; /* 可选:设置圆角 */
- }
- .tag-box {
- padding: 8px 12px;
- border: 1px solid #989797;
- border-radius: 4px;
- cursor: pointer;
- display: inline-block;
- }
- .tag-selected {
- background-color: #00bc98;
- color: #fff;
- border-color: #00bc98;
- }
- .el-tag + .el-tag {
- margin-left: 10px;
- }
- .button-new-tag {
- margin-left: 10px;
- height: 32px;
- line-height: 30px;
- padding-top: 0;
- padding-bottom: 0;
- }
- .input-new-tag {
- width: 90px;
- margin-left: 10px;
- vertical-align: bottom;
- }
- </style>
|