assist.vue 27 KB

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