my.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="客户编码" prop="customerCode">
  5. <el-input
  6. style="width:220px"
  7. v-model="queryParams.customerCode"
  8. placeholder="请输入客户编码"
  9. clearable
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="客户名称" prop="customerName">
  15. <el-input
  16. style="width:220px"
  17. v-model="queryParams.customerName"
  18. placeholder="请输入客户名称"
  19. clearable
  20. size="small"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="手机" prop="mobile">
  25. <el-input
  26. style="width:220px"
  27. v-model="queryParams.mobile"
  28. placeholder="请输入手机"
  29. clearable
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item label="跟进阶段" prop="status">
  35. <el-select style="width:220px" multiple filterable v-model="statusArr" placeholder="请选择跟进阶段" clearable size="small">
  36. <el-option
  37. v-for="item in statusOptions"
  38. :key="item.dictValue"
  39. :label="item.dictLabel"
  40. :value="item.dictValue"
  41. />
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label="客户类型" prop="customerType">
  45. <el-select style="width:220px" multiple filterable v-model="ctsTypeArr" placeholder="请选择客户类型" clearable size="small">
  46. <el-option
  47. v-for="item in typeOptions"
  48. :key="item.dictValue"
  49. :label="item.dictLabel"
  50. :value="item.dictValue"
  51. />
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item label="客户标签" prop="tags">
  55. <el-select style="width:220px" multiple filterable v-model="tagIds" placeholder="请选择客户标签" clearable size="small">
  56. <el-option
  57. v-for="item in tagsOptions"
  58. :key="item.dictLabel"
  59. :label="item.dictLabel"
  60. :value="item.dictLabel"
  61. />
  62. </el-select>
  63. </el-form-item>
  64. <el-form-item label="客户来源" prop="source">
  65. <el-select style="width:220px" multiple filterable v-model="sourceArr" placeholder="请选择客户来源" clearable size="small">
  66. <el-option
  67. v-for="item in sourceOptions"
  68. :key="item.dictValue"
  69. :label="item.dictLabel"
  70. :value="item.dictValue"
  71. />
  72. </el-select>
  73. </el-form-item>
  74. <el-form-item label="创建时间" prop="createTimeRange">
  75. <el-date-picker
  76. style="width:205.4px"
  77. clearable size="small"
  78. v-model="createTimeRange"
  79. type="daterange"
  80. value-format="yyyy-MM-dd"
  81. start-placeholder="开始日期"
  82. end-placeholder="结束日期">
  83. </el-date-picker>
  84. </el-form-item>
  85. <el-form-item label="领取时间" prop="receiveTime">
  86. <el-date-picker
  87. style="width:220px"
  88. clearable size="small"
  89. v-model="dateRange"
  90. type="daterange"
  91. value-format="yyyy-MM-dd"
  92. start-placeholder="开始日期"
  93. end-placeholder="结束日期">
  94. </el-date-picker>
  95. </el-form-item>
  96. <el-form-item label="历史订单" prop="isHisOrder">
  97. <el-select style="width:220px" filterable v-model="queryParams.isHisOrder" placeholder="请选择历史订单" clearable size="small">
  98. <el-option key="1" label="已下单" value="1" />
  99. <el-option key="0" label="未下单" value="0" />
  100. </el-select>
  101. </el-form-item>
  102. <el-form-item>
  103. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  104. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  105. </el-form-item>
  106. </el-form>
  107. <el-row :gutter="10" class="mb8">
  108. <el-col :span="1.5">
  109. <el-button
  110. type="primary"
  111. size="mini"
  112. icon="el-icon-plus"
  113. @click="handleAdd"
  114. v-hasPermi="['crm:customer:addMyCustomer']"
  115. >新增客户</el-button>
  116. </el-col>
  117. <el-col :span="1.5">
  118. <el-button
  119. type="success"
  120. icon="el-icon-edit"
  121. size="mini"
  122. :disabled="multiple"
  123. @click="handleAssist"
  124. >客户协作</el-button>
  125. </el-col>
  126. <el-col :span="1.5">
  127. <el-button
  128. type="success"
  129. icon="el-icon-edit"
  130. size="mini"
  131. :disabled="multiple"
  132. @click="handleAssign"
  133. v-hasPermi="['crm:customer:assignToUser']"
  134. >客户分配</el-button>
  135. </el-col>
  136. <el-col :span="1.5">
  137. <el-button
  138. type="success"
  139. size="mini"
  140. :disabled="multiple"
  141. @click="handleEditScource"
  142. v-hasPermi="['crm:customer:editScource']"
  143. >修改客户来源</el-button>
  144. </el-col>
  145. <el-col :span="1.5">
  146. <el-button
  147. type="success"
  148. size="mini"
  149. :disabled="multiple"
  150. @click="handleSendBatchSms"
  151. v-hasPermi="['crm:customer:sendBatchSms']"
  152. >批量发送短信</el-button>
  153. </el-col>
  154. <el-col :span="1.5">
  155. <el-dropdown
  156. @command="handleCommand"
  157. trigger="click"
  158. placement="bottom-start"
  159. >
  160. <el-dropdown-menu slot="dropdown" style="width: 120px;">
  161. <el-dropdown-item
  162. v-for="option in sysCreateType"
  163. :key="option.dictValue"
  164. :command="option.dictValue"
  165. >
  166. <i :class="option.iconClass" style="margin-right: 10px;"></i>
  167. {{ option.dictLabel }}
  168. </el-dropdown-item>
  169. </el-dropdown-menu>
  170. <span class="el-dropdown-link" >
  171. <el-button type="success" size="mini" >
  172. 创建订单
  173. </el-button>
  174. </span>
  175. </el-dropdown>
  176. </el-col>
  177. <el-col :span="1.5">
  178. <el-button
  179. type="danger"
  180. icon="el-icon-delete"
  181. size="mini"
  182. :disabled="multiple"
  183. @click="handleRemoveAllAssist"
  184. >删除协作人</el-button>
  185. </el-col>
  186. <el-col :span="1.5">
  187. <el-button
  188. type="warning"
  189. icon="el-icon-download"
  190. size="mini"
  191. @click="handleExport"
  192. v-hasPermi="['crm:customer:export']"
  193. >导出</el-button>
  194. </el-col>
  195. <!-- 新增选择外呼线路的下拉框 -->
  196. <el-col :span="2">
  197. <el-select
  198. v-model="selectedCallerLine"
  199. placeholder="外呼线路"
  200. size="mini"
  201. style="width: 100%;"
  202. @change="changeCallerLine"
  203. >
  204. <el-option
  205. v-for="item in callerApis"
  206. :key="item.callerId"
  207. :label="item.callerLine"
  208. :value="item.callerId"
  209. />
  210. </el-select>
  211. </el-col>
  212. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  213. </el-row>
  214. <el-table height="500" border v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
  215. <el-table-column type="selection" width="55" align="center" />
  216. <el-table-column label="客户编码" align="center" prop="customerCode" />
  217. <el-table-column label="客户名称" align="center" prop="customerName" :show-overflow-tooltip="true">
  218. <template slot-scope="scope">
  219. <el-link @click="handleShow(scope.row)" :underline="false" type="primary" >{{scope.row.customerName}}</el-link>
  220. </template>
  221. </el-table-column>
  222. <el-table-column label="手机" width="120px" align="center" prop="mobile" >
  223. <template slot-scope="scope">
  224. {{scope.row.mobile}}
  225. <el-button type="text" size="mini" @click="callNumber(scope.row.customerId,null,null,selectedCallerLine)">拨号</el-button>
  226. <el-button v-hasPermi="['crm:customer:addVisit']" type="text" size="mini" @click="handleAddVisit(scope.row)">写跟进</el-button>
  227. <el-button type="text" size="mini" @click="addPackageOrder()" style="margin-right: 15px;">创建订单</el-button>
  228. </template>
  229. </el-table-column>
  230. <el-table-column label="客户来源" align="center" prop="source">
  231. <template slot-scope="scope">
  232. <el-tag prop="status" v-for="(item, index) in sourceOptions" v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
  233. </template>
  234. </el-table-column>
  235. <el-table-column label="跟进阶段" width="200" align="center" prop="visitStatus">
  236. <template slot-scope="scope">
  237. <el-tag prop="visitStatus" v-for="(item, index) in statusOptions" v-if="scope.row.visitStatus==item.dictValue">{{item.dictLabel}}</el-tag><br/>
  238. <el-button v-hasPermi="['crm:customer:addVisitStatus']" type="text" size="mini" @click="handleVisitStatus(scope.row)">修改</el-button>
  239. </template>
  240. </el-table-column>
  241. <el-table-column label="客户类型" width="200" align="center" prop="customerType">
  242. <template slot-scope="scope">
  243. <el-tag prop="status" v-for="(item, index) in typeOptions" v-if="scope.row.customerType==item.dictValue">{{item.dictLabel}}</el-tag>
  244. <el-button v-hasPermi="['crm:customer:addCustomerType']" type="text" size="mini" @click="handleCustomerType(scope.row)">修改</el-button>
  245. </template>
  246. </el-table-column>
  247. <el-table-column label="标签" width="120px" align="center" prop="tags" >
  248. <template slot-scope="scope">
  249. {{scope.row.tags}}
  250. <el-button v-hasPermi="['crm:customer:addTag']" type="text" size="mini" @click="handleAddTag(scope.row)">打标签</el-button>
  251. </template>
  252. </el-table-column>
  253. <el-table-column label="备注" width="150px" align="center" prop="remark" >
  254. <template slot-scope="scope">
  255. {{scope.row.remark}}
  256. <el-button v-hasPermi="['crm:customer:addRemark']" type="text" size="mini" @click="handleAddRemark(scope.row)">修改备注</el-button>
  257. </template>
  258. </el-table-column>
  259. <el-table-column label="协作人" width="150px" align="center" >
  260. <template slot-scope="scope">
  261. <div v-for="(user, index) in scope.row.assistUser" :key="index">
  262. {{ user }}
  263. <el-button icon="el-icon-remove-outline" type="text" size="mini" @click="handleRemoveAssist(scope.row,user)"></el-button>
  264. <br v-if="index < scope.row.assistUser.length - 1"> <!-- 在最后一个元素之前添加换行 -->
  265. </div>
  266. </template>
  267. </el-table-column>
  268. <el-table-column label="进线客户详情" align="center" :show-overflow-tooltip="true" prop="registerDesc" />
  269. <el-table-column label="最新跟进时间" align="center" prop="lastTime" />
  270. <el-table-column label="领取时间" align="center" prop="receiveTime" />
  271. <el-table-column label="进线客户提交日期" align="center" prop="registerSubmitTime" />
  272. <el-table-column label="创建时间" align="center" prop="customerCreateTime" width="180">
  273. </el-table-column>
  274. <el-table-column label="操作" align="center" fixed="right" width="120px" class-name="small-padding fixed-width">
  275. <template slot-scope="scope">
  276. <el-button
  277. size="mini"
  278. type="text"
  279. @click="handleShow(scope.row)"
  280. v-hasPermi="['crm:customer:query']"
  281. >查看</el-button>
  282. <el-button
  283. size="mini"
  284. type="text"
  285. @click="handleRecover(scope.row)"
  286. v-hasPermi="['crm:customer:recover']"
  287. >回收公海</el-button>
  288. <!-- <el-button
  289. size="mini"
  290. type="text"
  291. @click="handleAssign(scope.row)"
  292. v-hasPermi="['crm:customer:assign']"
  293. >转移客户</el-button> -->
  294. </template>
  295. </el-table-column>
  296. </el-table>
  297. <pagination
  298. v-show="total>0"
  299. :total="total"
  300. :page.sync="queryParams.pageNum"
  301. :limit.sync="queryParams.pageSize"
  302. @pagination="getList"
  303. />
  304. <el-drawer size="75%" :title="show.title" :visible.sync="show.open">
  305. <customer-details ref="customerDetails" />
  306. </el-drawer>
  307. <el-dialog :title="addSms.title" :visible.sync="addSms.open" width="1000px" append-to-body>
  308. <add-batch-sms ref="sms" @close="closeSms()"></add-batch-sms>
  309. </el-dialog>
  310. <el-dialog :title="source.title" :visible.sync="source.open" width="1000px" append-to-body>
  311. <edit-source ref="editSource" @close="closeSource()"></edit-source>
  312. </el-dialog>
  313. <el-dialog :title="visit.title" :visible.sync="visit.open" width="600px" append-to-body>
  314. <add-visit @closeVisit="closeVisit" ref="addVisit" />
  315. </el-dialog>
  316. <el-dialog :title="customer.title" :visible.sync="customer.open" width="1000px" append-to-body>
  317. <add-or-edit-customer ref="customer" @close="closeCustomer()"></add-or-edit-customer>
  318. </el-dialog>
  319. <el-dialog :title="assign.title" :visible.sync="assign.open" width="800px" append-to-body>
  320. <assign-user ref="assignUser" @close="closeAssign" />
  321. </el-dialog>
  322. <el-dialog :title="assist.title" :visible.sync="assist.open" width="800px" append-to-body>
  323. <assist-user ref="assistUser" @close="closeAssist" />
  324. </el-dialog>
  325. <el-dialog :title="addTag.title" :visible.sync="addTag.open" width="600px" append-to-body>
  326. <add-tag ref="tag" @close="closeTag()"></add-tag>
  327. </el-dialog>
  328. <el-dialog :title="addRemark.title" :visible.sync="addRemark.open" width="600px" append-to-body>
  329. <add-remark ref="remark" @close="closeRemark()"></add-remark>
  330. </el-dialog>
  331. <el-dialog :title="addCustomerType.title" :visible.sync="addCustomerType.open" width="600px" append-to-body>
  332. <add-customer-type ref="customerType" @close="closeCustomerType()"></add-customer-type>
  333. </el-dialog>
  334. <el-dialog :title="addVisitStatus.title" :visible.sync="addVisitStatus.open" width="600px" append-to-body>
  335. <add-visit-status ref="visitStatus" @close="closeVisitStatus()"></add-visit-status>
  336. </el-dialog>
  337. <el-dialog title="创建线上订单" :visible.sync="addPackageOpen" width="1000px" append-to-body>
  338. <addPackage @closePackage="closePackage" ref="addPackageVisit" />
  339. </el-dialog>
  340. <el-dialog title="创建线下订单" :visible.sync="addOfflineOrder.open" width="1000px" append-to-body>
  341. <add-order-offline @closeOrderOffline="closeOrderOffline" ref="addOrderOffline" />
  342. </el-dialog>
  343. </div>
  344. </template>
  345. <script>
  346. import { getMyCustomerList,recover,exportCustomer } from "@/api/crm/customer";
  347. import { remove,listAssist, getAssist, delAssist, addAssist, updateAssist, exportAssist } from "@/api/crm/assist";
  348. import customerDetails from '../components/customerDetails.vue';
  349. import addVisit from '../components/addVisit.vue';
  350. import {getCitys} from "@/api/store/city";
  351. import addBatchSms from '../components/addBatchSms.vue';
  352. import editSource from '../components/editSource.vue';
  353. import addOrEditCustomer from '../components/addOrEditCustomer.vue';
  354. import assignUser from '../components/assignUser.vue';
  355. import assistUser from '../components/assistUser.vue';
  356. import addTag from '../components/addTag.vue';
  357. import addRemark from '../components/addRemark.vue';
  358. import addCustomerType from '../components/addCustomerType.vue';
  359. import addVisitStatus from '../components/addVisitStatus.vue';
  360. import addPackage from "@/views/store/components/addOrder";
  361. import addOrderOffline from "@/views/store/components/addOrderOffline";
  362. import {getMyCallerApiList} from "@/api/company/companyVoiceCaller"
  363. import { getSipAccount } from "@/api/company/companyVoiceApi"
  364. export default {
  365. name: "Customer",
  366. components: {addPackage,addOrderOffline,addVisitStatus,addCustomerType,addRemark,addTag,assignUser,assistUser,addOrEditCustomer,editSource, addBatchSms,customerDetails,addVisit },
  367. data() {
  368. return {
  369. selectedCallerLine:null,
  370. callerApis:[], //我的线路
  371. addOfflineOrder:{
  372. open:false,
  373. },
  374. sysCreateType:[
  375. { dictLabel: "线下订单", dictValue: "1" },
  376. { dictLabel: "线上订单", dictValue: "2" },
  377. ],
  378. addPackageOpen:false,
  379. addVisitStatus:{
  380. open:false,
  381. title:"跟进阶段"
  382. },
  383. addCustomerType:{
  384. open:false,
  385. title:"客户类型"
  386. },
  387. addRemark:{
  388. open:false,
  389. title:"客户备注"
  390. },
  391. addTag:{
  392. open:false,
  393. title:"打标签"
  394. },
  395. tagIds:[],
  396. statusArr:[],
  397. ctsTypeArr:[],
  398. sourceArr:[],
  399. tagsOptions:[],
  400. createTimeRange:[],
  401. customer:{
  402. open:false,
  403. title:"新增客户"
  404. },
  405. users:[],
  406. visit:{
  407. open:false,
  408. title:"写跟进"
  409. },
  410. source:{
  411. open:false,
  412. title:"修改客户来源"
  413. },
  414. assign:{
  415. title:"分配客户",
  416. open:false,
  417. },
  418. assist:{
  419. title:"添加协作人",
  420. open:false,
  421. },
  422. assignForm: {
  423. },
  424. // 表单校验
  425. assignRules: {
  426. // companyUserId: [
  427. // { required: true, message: "员工不能为空", trigger: "blur" }
  428. // ],
  429. },
  430. dateRange:[],
  431. addSms:{
  432. open:false,
  433. title:"批量发短信"
  434. },
  435. cityIds:[],
  436. citys:[],
  437. tags:[],
  438. inputVisible: false,
  439. inputValue: '',
  440. statusOptions:[],
  441. typeOptions:[],
  442. sourceOptions:[],
  443. sexOptions:[],
  444. show:{
  445. title:"客户详情",
  446. open:false,
  447. },
  448. callerShow:{
  449. title:"外呼线路",
  450. open:false,
  451. },
  452. // 选中数组
  453. ids: [],
  454. // 非单个禁用
  455. single: true,
  456. // 非多个禁用
  457. multiple: true,
  458. // 显示搜索条件
  459. showSearch: true,
  460. // 总条数
  461. total: 0,
  462. // 客户表格数据
  463. customerList: [],
  464. // 弹出层标题
  465. title: "",
  466. // 是否显示弹出层
  467. open: false,
  468. // 查询参数
  469. queryParams: {
  470. pageNum: 1,
  471. pageSize: 10,
  472. customerCode: null,
  473. customerName: null,
  474. mobile: null,
  475. sex: null,
  476. weixin: null,
  477. userId: null,
  478. createUserId: null,
  479. receiveUserId: null,
  480. customerUserId: null,
  481. address: null,
  482. location: null,
  483. detailAddress: null,
  484. lng: null,
  485. lat: null,
  486. status: null,
  487. deptId: null,
  488. isDel: null,
  489. customerType: null,
  490. receiveTime: null,
  491. poolTime: null,
  492. companyId: null,
  493. isLine: null,
  494. source: null,
  495. tags: null
  496. },
  497. // 表单参数
  498. form: {
  499. province:null,
  500. city:null,
  501. district:null,
  502. },
  503. // 表单校验
  504. rules: {
  505. customerName: [
  506. { required: true, message: "客户名称不能为空", trigger: "blur" }
  507. ],
  508. mobile: [
  509. { required: true, message: "手机号不能为空", trigger: "blur" }
  510. ],
  511. sex: [
  512. { required: true, message: "性别不能为空", trigger: "blur" }
  513. ],
  514. source: [
  515. { required: true, message: "客户来源不能为空", trigger: "blur" }
  516. ],
  517. },
  518. loading:null,
  519. };
  520. },
  521. created() {
  522. this.getDicts("crm_customer_source").then((response) => {
  523. this.sourceOptions = response.data;
  524. });
  525. this.getDicts("common_sex").then((response) => {
  526. this.sexOptions = response.data;
  527. });
  528. this.getDicts("crm_customer_user_status").then((response) => {
  529. this.statusOptions = response.data;
  530. });
  531. this.getDicts("crm_customer_type").then((response) => {
  532. this.typeOptions = response.data;
  533. });
  534. this.getDicts("crm_customer_tag").then((response) => {
  535. this.tagsOptions = response.data;
  536. });
  537. this.getCitys();
  538. this.getList();
  539. this.getCallerApiList();
  540. },
  541. methods: {
  542. getCallerApiList() {
  543. getMyCallerApiList().then(response => {
  544. this.callerApis = response.rows;
  545. this.selectedCallerLine = this.callerApis[0].callerId
  546. this.changeCallerLine();
  547. });
  548. },
  549. changeCallerLine(){
  550. const param = {callerId:this.selectedCallerLine}
  551. // getSipAccount(param)
  552. this.$store.dispatch('GetSipAccount',param).then(() => {
  553. }).catch(err => {
  554. });
  555. },
  556. handleCommand(command){
  557. if (command==="1"){
  558. this.addOfflineOrder.open = true
  559. }else {
  560. this.addPackageOpen=true;
  561. }
  562. },
  563. closeOrderOffline(){
  564. this.addOfflineOrder.open = false
  565. },
  566. addPackageOrder(){
  567. this.addPackageOpen=true;
  568. },
  569. closePackage(){
  570. this.addPackageOpen=false;
  571. },
  572. closeVisitStatus(){
  573. this.addVisitStatus.open=false;
  574. this.getList();
  575. },
  576. handleVisitStatus(row){
  577. this.addVisitStatus.open=true;
  578. var that=this;
  579. setTimeout(() => {
  580. that.$refs.visitStatus.reset(row);
  581. }, 500);
  582. },
  583. closeCustomerType(){
  584. this.addCustomerType.open=false;
  585. this.getList();
  586. },
  587. handleCustomerType(row){
  588. this.addCustomerType.open=true;
  589. var that=this;
  590. setTimeout(() => {
  591. that.$refs.customerType.reset(row);
  592. }, 500);
  593. },
  594. closeRemark(){
  595. this.addRemark.open=false;
  596. this.getList();
  597. },
  598. handleAddRemark(row){
  599. this.addRemark.open=true;
  600. var that=this;
  601. setTimeout(() => {
  602. that.$refs.remark.reset(row);
  603. }, 500);
  604. },
  605. closeTag(){
  606. this.addTag.open=false;
  607. this.getList();
  608. },
  609. handleAddTag(row){
  610. this.addTag.open=true;
  611. var that=this;
  612. setTimeout(() => {
  613. that.$refs.tag.reset(row);
  614. }, 500);
  615. },
  616. handleShow(row){
  617. this.show.open=true;
  618. var that=this;
  619. const tab = "visit";
  620. setTimeout(() => {
  621. that.$refs.customerDetails.getDetails(row.customerId);
  622. that.$refs.customerDetails.handleClick(tab);
  623. }, 200);
  624. },
  625. handleAdd() {
  626. this.customer.open = true;
  627. var that=this;
  628. setTimeout(() => {
  629. that.$refs.customer.handleAdd(2);
  630. }, 200);
  631. },
  632. closeCustomer(){
  633. this.customer.open=false;
  634. this.getList();
  635. },
  636. closeVisit(){
  637. this.visit.open=false;
  638. this.getList();
  639. },
  640. handleAddVisit(row){
  641. this.visit.open=true;
  642. setTimeout(() => {
  643. this.$refs.addVisit.reset(row.customerId);
  644. }, 200);
  645. },
  646. handleAssist(){
  647. var that=this;
  648. var ids=this.ids;
  649. that.assist.open=true;
  650. setTimeout(() => {
  651. that.$refs.assistUser.init(ids);
  652. }, 200);
  653. },
  654. handleRemoveAllAssist(){
  655. const ids = this.ids;
  656. const data = {customerIds:ids,companyUserId:null}
  657. this.$confirm('是否确认删除协作人?', "警告", {
  658. confirmButtonText: "确定",
  659. cancelButtonText: "取消",
  660. type: "warning"
  661. }).then(function() {
  662. return remove(data);
  663. }).then(() => {
  664. this.getList();
  665. this.msgSuccess("删除成功");
  666. }).catch(function() {});
  667. },
  668. handleRemoveAssist(row,userName){
  669. const match = userName.match(/\((\d+)\)/);
  670. const companyUserId = match[1];
  671. const data = {customerIds:[row.customerId],companyUserId:companyUserId}
  672. this.$confirm('是否确认删除"' + userName + '"协作?', "警告", {
  673. confirmButtonText: "确定",
  674. cancelButtonText: "取消",
  675. type: "warning"
  676. }).then(function() {
  677. return remove(data);
  678. }).then(() => {
  679. this.getList();
  680. this.msgSuccess("删除成功");
  681. }).catch(function() {});
  682. },
  683. handleAssign(){
  684. var that=this;
  685. var ids=this.ids;
  686. that.assign.open=true;
  687. setTimeout(() => {
  688. that.$refs.assignUser.init(ids,3);
  689. }, 200);
  690. },
  691. closeAssign(){
  692. this.assign.open=false;
  693. this.getList();
  694. },
  695. closeAssist(){
  696. this.assist.open=false;
  697. this.getList();
  698. },
  699. handleEditScource(){
  700. this.source.open=true;
  701. var that=this;
  702. setTimeout(() => {
  703. that.$refs.editSource.handleEdit(that.ids);
  704. }, 200);
  705. },
  706. closeSource(){
  707. this.source.open=false;
  708. this.getList();
  709. },
  710. closeSms(){
  711. this.addSms.open=false;
  712. },
  713. handleSendBatchSms(){
  714. const customerIds = this.ids;
  715. this.addSms.open=true;
  716. var that=this;
  717. setTimeout(() => {
  718. console.log(customerIds)
  719. that.$refs.sms.reset(customerIds);
  720. }, 500);
  721. },
  722. handleRecover(row) {
  723. this.$confirm('是否确认回收客户"' + row.customerName + '"?', "警告", {
  724. confirmButtonText: "确定",
  725. cancelButtonText: "取消",
  726. type: "warning"
  727. }).then(function() {
  728. var data={customerUserId:row.customerUserId}
  729. return recover(data);
  730. }).then(() => {
  731. this.getList();
  732. this.msgSuccess("操作成功");
  733. }).catch(function() {});
  734. },
  735. handleCityChange(value) {
  736. console.log(value);
  737. var nodes=this.$refs.citySelect.getCheckedNodes();
  738. this.form.address=nodes[0].pathLabels[0]+"-"+nodes[0].pathLabels[1]+"-"+nodes[0].pathLabels[2];
  739. this.form.cityIds=value.toString();
  740. },
  741. getCitys(){
  742. getCitys().then(res => {
  743. this.loading = false;
  744. this.citys=res.data;
  745. })
  746. },
  747. /** 查询客户列表 */
  748. getList() {
  749. this.loading = true;
  750. if(this.createTimeRange!=null&&this.createTimeRange.length==2){
  751. this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
  752. }
  753. else{
  754. this.queryParams.createTimeRange=null;
  755. }
  756. if(this.statusArr.length>0){
  757. this.queryParams.status=this.statusArr.toString();
  758. }
  759. else{
  760. this.queryParams.status=null
  761. }
  762. if(this.ctsTypeArr.length>0){
  763. this.queryParams.customerType=this.ctsTypeArr.toString();
  764. }
  765. else{
  766. this.queryParams.customerType=null
  767. }
  768. if(this.sourceArr.length>0){
  769. this.queryParams.source=this.sourceArr.toString();
  770. }
  771. else{
  772. this.queryParams.source=null
  773. }
  774. if(this.tagIds.length>0){
  775. this.queryParams.tags=this.tagIds.toString();
  776. }
  777. else{
  778. this.queryParams.tags=null
  779. }
  780. getMyCustomerList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  781. this.customerList = response.rows;
  782. this.total = response.total;
  783. this.loading = false;
  784. });
  785. },
  786. // 取消按钮
  787. cancel() {
  788. this.open = false;
  789. this.reset();
  790. },
  791. /** 搜索按钮操作 */
  792. handleQuery() {
  793. this.queryParams.pageNum = 1;
  794. this.getList();
  795. },
  796. /** 重置按钮操作 */
  797. resetQuery() {
  798. this.resetForm("queryForm");
  799. this.handleQuery();
  800. },
  801. // 多选框选中数据
  802. handleSelectionChange(selection) {
  803. this.ids = selection.map(item => item.customerId)
  804. this.single = selection.length!==1
  805. this.multiple = !selection.length
  806. },
  807. /** 删除按钮操作 */
  808. handleDelete(row) {
  809. const customerIds = row.customerId || this.ids;
  810. this.$confirm('是否确认删除客户编号为"' + customerIds + '"的数据项?', "警告", {
  811. confirmButtonText: "确定",
  812. cancelButtonText: "取消",
  813. type: "warning"
  814. }).then(function() {
  815. return delLineCustomer(customerIds);
  816. }).then(() => {
  817. this.getList();
  818. this.msgSuccess("删除成功");
  819. }).catch(function() {});
  820. },
  821. /** 导出按钮操作 */
  822. handleExport() {
  823. const queryParams = this.queryParams;
  824. this.$confirm('是否确认导出所有客户数据项?', "警告", {
  825. confirmButtonText: "确定",
  826. cancelButtonText: "取消",
  827. type: "warning"
  828. }).then(function() {
  829. return exportCustomer(queryParams);
  830. }).then(response => {
  831. this.download(response.msg);
  832. }).catch(function() {});
  833. },
  834. }
  835. };
  836. </script>
  837. <style>
  838. .el-tag + .el-tag {
  839. margin-left: 10px;
  840. }
  841. .button-new-tag {
  842. margin-left: 10px;
  843. height: 32px;
  844. line-height: 30px;
  845. padding-top: 0;
  846. padding-bottom: 0;
  847. }
  848. .input-new-tag {
  849. width: 90px;
  850. margin-left: 10px;
  851. vertical-align: bottom;
  852. }
  853. .el-dialog__wrapper{
  854. z-index: 100000;
  855. }
  856. </style>