my.vue 28 KB

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