changeCustomer.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. <template>
  2. <div>
  3. <el-button size="mini" :type="disabled || data.status === '已无效' || data.status === '已过期'?'':'primary'" @click="onShow" :disabled="disabled || data.status === '已无效' || data.status === '已过期'" >转化客户</el-button>
  4. <el-drawer
  5. title="转化为客户"
  6. :visible.sync="drawer"
  7. size="600px"
  8. direction="rtl"
  9. :show-close="false"
  10. append-to-body
  11. @close="onClose">
  12. <div class="drawer__panel">
  13. <el-row :gutter="20">
  14. <el-form :model="form" :rules="rules" ref="form" label-width="85px" label-position="right" size="mini">
  15. <el-col :span="20">
  16. <el-form-item label="客户名称:" prop="enterprisename_customer">
  17. <el-input v-model="form.enterprisename_customer" placeholder="请输入客户名称" style="width: 100%"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="4">
  21. <businessInquiry ref="businessRef" :keyword="form.enterprisename_customer"
  22. @businessData="businessSelect"></businessInquiry>
  23. </el-col>
  24. <el-col :span="24">
  25. <el-form-item label="企业简称:" prop="abbreviation">
  26. <el-input v-model="form.abbreviation" placeholder="请输入企业简称" style="width: 100%"></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="24" >
  30. <el-form-item label="客户类型:" prop="type">
  31. <el-select v-model="form.type" placeholder="请选择客户类型" style="width: 100%">
  32. <el-option
  33. v-for="item in options.type"
  34. :key="item.value"
  35. :label="item.value"
  36. :value="item.value">
  37. <!-- <span style="float: left">{{ item.value }}</span>
  38. <span v-if="item.remarks !== ''" style="float: right; color: #8492a6; font-size: 10px">{{ item.remarks }}</span>-->
  39. <span style="float: left">{{ item.value }}</span>
  40. <span style="float: right; color: #8492a6; font-size: 12px">{{ item.remarks?item.remarks:'暂无描述' }}</span>
  41. </el-option>
  42. </el-select>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="24">
  46. <el-form-item label="客户等级:" prop="grade">
  47. <el-select v-model="form.grade" placeholder="请选择客户等级" style="width: 100%">
  48. <el-option
  49. v-for="item in options.customerGrade"
  50. :key="item.rowindex"
  51. :label="item.value "
  52. :value="item.value">
  53. <span style="float: left">{{ item.value }}</span>
  54. <span style="float: right; color: #8492a6; font-size: 12px">{{ item.remarks?item.remarks:'暂无描述' }}</span>
  55. </el-option>
  56. </el-select>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="24">
  60. <el-form-item label="客户分类:" prop="customergrade">
  61. <el-select v-model="form.customergrade" placeholder="请选择客户分类" style="width: 100%">
  62. <el-option
  63. v-for="item in options.customerClassification"
  64. :key="item.rowindex"
  65. :label="item.value "
  66. :value="item.value">
  67. <span style="float: left">{{ item.value }}</span>
  68. <span style="float: right; color: #8492a6; font-size: 12px">{{ item.remarks?item.remarks:'暂无描述' }}</span>
  69. </el-option>
  70. </el-select>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="24">
  74. <el-form-item label="客户行业:" prop="industry">
  75. <el-select
  76. ref="sle"
  77. style="width:100%;"
  78. v-model="form.industry"
  79. multiple
  80. placeholder="请选择所属行业"
  81. size="mini"
  82. >
  83. <el-option
  84. v-for="item in options.industryData"
  85. :key="item.value"
  86. :label="item.value"
  87. :value="item.value"
  88. >
  89. <span style="float: left">{{ item.value }}</span>
  90. <span style="float: right; color: #8492a6; font-size: 12px">{{ item.remarks?item.remarks:'暂无描述' }}</span>
  91. </el-option>
  92. </el-select>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="24">
  96. <el-form-item label="联系人:" prop="contactsinfo.name">
  97. <contactsNewTemplate ownertable="" ownerid="" @contactData="contactData" :name="form.contactsinfo.name" @inputChange="inputChange"></contactsNewTemplate>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="24" v-if="isPhone">
  101. <el-form-item label="联系方式:" prop="contactsinfo.phonenumber">
  102. <el-button-group>
  103. <!-- <el-button type="primary" size="mini" @click="phoneChang('手机')">手机号</el-button>
  104. <el-button type="" size="mini" @click="phoneChang('座机')">座机电话</el-button>-->
  105. <el-radio v-model="isPhone" :label="true" @change="phoneChang('手机')">手机号</el-radio>
  106. <el-radio v-model="isPhone" :label="false" @change="phoneChang('座机')">座机电话</el-radio>
  107. </el-button-group>
  108. <el-input v-model="form.contactsinfo.phonenumber" placeholder="请输入手机号" style="width: 100%;margin-top: 10px" @input="telephoneChange('手机')"></el-input>
  109. </el-form-item>
  110. </el-col>
  111. <el-col :span="24" v-if="!isPhone">
  112. <el-form-item label="联系方式:" prop="contactsinfo.telephone">
  113. <el-button-group>
  114. <!-- <el-button type="" size="mini" @click="phoneChang('手机')">手机号</el-button>
  115. <el-button type="primary" size="mini" @click="phoneChang('座机')">座机电话</el-button>-->
  116. <el-radio v-model="isPhone" :label="true" @change="phoneChang('手机')">手机号</el-radio>
  117. <el-radio v-model="isPhone" :label="false" @change="phoneChang('座机')">座机电话</el-radio>
  118. </el-button-group>
  119. <div style="width: 100%">
  120. <el-input v-model="areaCode" placeholder="请输入区号" style="width:25%;margin-top: 10px" @input="telephoneChange('座机')"></el-input>
  121. <span style="color: #999999">——</span>
  122. <el-input v-model="telephone" placeholder="请输入座机电话" style="width:68%;margin-top: 10px" @input="telephoneChange('座机')"></el-input>
  123. </div>
  124. </el-form-item>
  125. </el-col>
  126. <el-col :span="24">
  127. <el-form-item label="税号:" prop="taxno">
  128. <el-input v-model="form.taxno" placeholder="请输入企业税号" style="width: 100%"></el-input>
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="24">
  132. <el-form-item label="法人:" prop="contact">
  133. <el-input v-model="form.contact" placeholder="请输入法人信息" style="width: 100%"></el-input>
  134. </el-form-item>
  135. </el-col>
  136. <el-col :span="24">
  137. <el-form-item label="联系电话:" prop="phonenumber">
  138. <el-input v-model="form.phonenumber" placeholder="请输入联系电话" style="width: 100%"></el-input>
  139. </el-form-item>
  140. </el-col>
  141. <el-col :span="24">
  142. <el-form-item label="省市县:" prop="province">
  143. <el-cascader
  144. style="width: 100%"
  145. v-model="value"
  146. :options="basicData.data().areaData"
  147. @change="cascaderChange" clearable>
  148. </el-cascader>
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="24">
  152. <el-form-item label="详细地址:" prop="address">
  153. <el-input v-model="form.address" placeholder="请输入企业地址" style="width: 100%"></el-input>
  154. </el-form-item>
  155. </el-col>
  156. <el-col :span="24">
  157. <el-form-item label="上级企业:" prop="superiorenterprisename">
  158. <el-popover
  159. placement="bottom"
  160. width="700"
  161. trigger="click"
  162. v-model="customerShow"
  163. @show="customerList">
  164. <el-input
  165. style="width:300px;margin-bottom: 10px"
  166. placeholder="请输入内容"
  167. v-model="customerParam.content.where.condition"
  168. clearable
  169. @clear="customerList(customerParam.content.pageNumber = 1)"
  170. size="mini"
  171. @keyup.enter.native="customerList(customerParam.content.pageNumber = 1)">
  172. <i slot="prefix" class="el-icon-search" @click="customerList(customerParam.content.pageNumber = 1)"></i>
  173. </el-input>
  174. <el-table :data="customer.customerData" @row-click="customerData" height="396px" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini">
  175. <el-table-column
  176. label="客户编号"
  177. width="75">
  178. <template slot-scope="scope">
  179. <span style="margin-left: 10px">{{ scope.row.sa_customersid?scope.row.sa_customersid:'--' }}</span>
  180. </template>
  181. </el-table-column>
  182. <el-table-column
  183. label="客户名称"
  184. width="260">
  185. <template slot-scope="scope">
  186. <span style="margin-left: 10px">{{ scope.row.enterprisename?scope.row.enterprisename:'--'}}</span>
  187. </template>
  188. </el-table-column>
  189. <el-table-column
  190. label="地址"
  191. >
  192. <template slot-scope="scope">
  193. <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
  194. </template>
  195. </el-table-column>
  196. </el-table>
  197. <div class="container normal-panel" style="text-align:right">
  198. <el-pagination
  199. background
  200. small
  201. @size-change="handleSizeChangeCustomer"
  202. @current-change="handleCurrentChangeCustomer"
  203. :page-sizes="[10,20,50,100,]"
  204. layout="total,sizes, prev, pager, next, jumper"
  205. :current-page="customer.currentPage"
  206. :total="customer.total">
  207. </el-pagination>
  208. </div>
  209. <el-input slot="reference" :readonly="true" v-model="form.superiorenterprisename" autocomplete="off" placeholder="请选择客户" @input="selectCustomer"></el-input>
  210. </el-popover>
  211. </el-form-item>
  212. </el-col>
  213. <el-col :span="24">
  214. <el-form-item label="客户来源:" prop="source">
  215. <selectTemp ref="sourceRef" placeholder="请选择来源" payload="cluesource" @selectChange="selectSource" :cluesource="form.source"></selectTemp>
  216. </el-form-item>
  217. </el-col>
  218. </el-form>
  219. </el-row>
  220. </div>
  221. <div class="fixed__btn__panel">
  222. <el-button size="small" @click="onClose" class="normal-btn-width inline-16">取 消</el-button>
  223. <duplicateCheck :data="form" ref="check" @checkSuccess="checkSuccess" @onSuccess="onClose" @onCheck="onCheck"></duplicateCheck>
  224. <el-button size="small" type="primary" @click="onSave" class="normal-btn-width">确 定</el-button>
  225. </div>
  226. </el-drawer>
  227. </div>
  228. </template>
  229. <script>
  230. import businessMessage from '@/components/businessMessage/index'
  231. import duplicateCheck from "@/components/duplicatesCheck/customerChangeCheck";
  232. import contactsNewTemplate from '@/template/contactsNewTemplate/index'
  233. import businessInquiry from '@/template/businessInquiry/index'
  234. export default {
  235. props: ["disabled", "data"],
  236. name: "changeCustomer",
  237. components: {businessMessage, duplicateCheck, contactsNewTemplate, businessInquiry},
  238. data() {
  239. return {
  240. activeName: 'first',
  241. drawer: false,
  242. customerShow: false,
  243. checkResults: '',
  244. rules: {
  245. phonenumber: [
  246. {required: false, message: '请输入手机号码', trigger: 'change'},
  247. // {pattern: /^1[3-9]\d{9}$/, message: '请输入正确手机号码', trigger: 'change'}
  248. ],
  249. enterprisename_customer: [
  250. { required: true, message: '请输入客户名称', trigger: 'blur' },
  251. ],
  252. roleids: [
  253. { required: true, message: '请选择授权角色', trigger: 'change' }
  254. ],
  255. type: [
  256. { required: true, message: '请选择客户类型', trigger: 'change' }
  257. ],
  258. contact: [
  259. { required: false, message: '请输入法人', trigger: 'change,blur' },
  260. ],
  261. telephone: [
  262. { required: false, message: '请输入联系电话', trigger: 'change,blur' },
  263. { pattern:/^1[3-9]\d{9}$/, message: '请输入正确手机号码',trigger: 'change' }
  264. ],
  265. province: [
  266. { required: true, message: '请选择省市县', trigger: 'change,blur' },
  267. ],
  268. source: [
  269. { required: true, message: '请选择客户来源', trigger: 'change' },
  270. ],
  271. 'contactsinfo.name':[
  272. { required: true, message: '请输入联系人姓名', trigger: 'change,blur' }
  273. ],
  274. 'contactsinfo.phonenumber': [
  275. { required: true, message: '请输入联系电话', trigger: 'change' },
  276. { pattern:/^1[3-9]\d{9}$/, message: '请输入正确手机号码',trigger: 'change' }
  277. ],
  278. 'contactsinfo.telephone': [
  279. { required: true, message: '请输入座机电话', trigger: 'change' },
  280. { pattern:/^0\d{2,3}-\d{7,8}$/, message: '请输入正确座机电话',trigger: 'change' }
  281. ],
  282. },
  283. form:{
  284. "sat_orderclueid": '',
  285. "enterprisename_customer":'',
  286. "sa_customersid": 0, //新增是传0
  287. "parentid": 0, //上级客户ID,默认或没有上级的时候传0
  288. "sys_enterpriseid": 0, //合作企业档案ID,新增是传0,更新
  289. "enterprisename": "", //客户名称(企业名称)
  290. "type": "", //客户类型
  291. "source": "", //客户来源
  292. "province": "", //非必填,可选
  293. "city": "", //非必填,可选
  294. "county": "", //非必填,可选
  295. "address": "", //非必填,可选
  296. "abbreviation": "", //非必填,可选
  297. "taxno": "", //税号,非必填,可选
  298. "grade": '', // 客户等级(商户等级)
  299. "industry": [], //非必填,可选,所属行业
  300. "contact": "", //非必填,可选
  301. "phonenumber": "", //非必填,可选
  302. "customergrade": "", //客户等级
  303. "contactsinfo": {
  304. "name": "",
  305. "telephone": "",
  306. "phonenumber": "",
  307. "sys_phonebookid":""
  308. },
  309. },
  310. customerParam:{
  311. "id": 20220920083901,
  312. "content": {
  313. "pageNumber": 1,
  314. "pageSize": 10,
  315. "where": {
  316. "condition": "",
  317. "type":6,
  318. "sa_projectid":""
  319. }
  320. }
  321. },
  322. customer:{
  323. customerData:[],
  324. total:0,
  325. currentPage:0,
  326. },
  327. value:'',
  328. options:{
  329. type:[],
  330. parentCustomers:[],
  331. gradeData:[],
  332. industryData:[],
  333. customerGrade:[],
  334. customerClassification:[],
  335. distributor:[]
  336. },
  337. isPhone:true,
  338. enterpriseContact:{
  339. param:{
  340. "content": {
  341. "sys_enterpriseid": '',
  342. "pageNumber": 1,
  343. "pageSize": 20,
  344. "where": {
  345. "condition": ""
  346. }
  347. },
  348. "id": 20221219193002,
  349. },
  350. listData:[],
  351. total:0,
  352. currentPage:0,
  353. show:false
  354. },
  355. myContacts:{
  356. param:{
  357. "id": 20221219161202,
  358. "content": {
  359. "pageNumber": 1,
  360. "pageSize": 20,
  361. "ownertable":'sa_customers',
  362. "ownerid":'',
  363. "where": {
  364. "condition": ""
  365. }
  366. }
  367. },
  368. listData:[],
  369. total:0,
  370. currentPage:0,
  371. show:false
  372. },
  373. areaCode:'',
  374. telephone:''
  375. }
  376. },
  377. methods:{
  378. onShow(){
  379. this.drawer = true
  380. this.form = Object.assign({},this.form,this.data)
  381. this.form.phonenumber = ''
  382. this.form.source = this.form.cluesource
  383. this.value = [this.form.province,this.form.city,this.form.county]
  384. this.form.contactsinfo.name = this.data.name
  385. /*this.form.contactsinfo.phonenumber = this.data.phonenumber*/
  386. if (this.data.phonenumber.indexOf('-') != '-1'){
  387. this.isPhone = false
  388. this.areaCode = this.data.phonenumber.substring(0,this.data.phonenumber.indexOf('-'))
  389. this.telephone = this.data.phonenumber.substring(this.areaCode.length+1)
  390. this.form.contactsinfo.telephone = this.areaCode + '-' + this.telephone
  391. this.form.contactsinfo.phonenumber = ''
  392. }else {
  393. this.isPhone = true
  394. this.form.contactsinfo.phonenumber = this.data.phonenumber
  395. this.form.contactsinfo.telephone = ''
  396. this.areaCode = ''
  397. this.telephone = ''
  398. }
  399. this.gradeList()
  400. this.industryList()
  401. this.typeList()
  402. this.queryCustomerGrade()
  403. this.enterpriseContactList()
  404. },
  405. /*查重检查*/
  406. onCheck(){
  407. this.$refs.form.validate((valid) => {
  408. if (!valid) return false
  409. this.$refs.check.queryRule()
  410. })
  411. },
  412. /*自动查重判断*/
  413. duplicateCheck(){
  414. this.$refs.form.validate(async (valid) => {
  415. if (!valid) return false
  416. const res = await this.$api.requested({
  417. "id": 20221208172002,
  418. "content": {
  419. "sa_customersid":0,
  420. "enterprisename":this.form.enterprisename_customer,
  421. "taxno":this.form.taxno,
  422. "address":this.form.address
  423. },
  424. })
  425. if (res.data.length !== 0){
  426. console.log("重复")
  427. }
  428. this.checkResults = res.data.length
  429. this.onSave()
  430. })
  431. },
  432. onSave(){
  433. this.form.enterprisename = this.form.enterprisename_customer
  434. this.$refs.form.validate((valid) => {
  435. if (!valid) return false
  436. this.$refs.check.creatShow = true
  437. this.$refs.check.queryRule()
  438. })
  439. },
  440. async setTag(id){
  441. const res = await this.$api.requested({
  442. "id": 20220929090901,
  443. "content": {
  444. "ownertable":"sa_customers",
  445. "ownerid":id,
  446. "datatag":[
  447. "疑似重复",
  448. ]
  449. }
  450. })
  451. this.$emit('onChangeCustomer')
  452. this.$refs['form'].resetFields();
  453. this.form = {
  454. "sat_orderclueid": '',
  455. "enterprisename_customer":'',
  456. "sa_customersid": 0, //新增是传0
  457. "parentid": 0, //上级客户ID,默认或没有上级的时候传0
  458. "sys_enterpriseid": 0, //合作企业档案ID,新增是传0,更新
  459. "enterprisename": "", //客户名称(企业名称)
  460. "type": "", //客户类型
  461. "source": "", //客户来源
  462. "province": "", //非必填,可选
  463. "city": "", //非必填,可选
  464. "county": "", //非必填,可选
  465. "address": "", //非必填,可选
  466. "abbreviation": "", //非必填,可选
  467. "taxno": "", //税号,非必填,可选
  468. "grade": '', // 客户等级(商户等级)
  469. "industry": "", //非必填,可选,所属行业
  470. "contact": "", //非必填,可选
  471. "phonenumber": "", //非必填,可选
  472. "customergrade": "", //客户等级
  473. }
  474. this.drawer = false
  475. this.checkResults = ''
  476. this.value = ''
  477. },
  478. onSubmit(){
  479. this.form.enterprisename = this.form.enterprisename_customer
  480. this.$refs.form.validate(async (valid)=>{
  481. if (!valid) return false
  482. const res = await this.$api.requested({
  483. "id": 20221216184302,
  484. "content": this.form,
  485. })
  486. this.tool.showMessage(res,()=>{
  487. if (this.checkResults === 0){
  488. this.$emit('onChangeCustomer')
  489. this.$refs['form'].resetFields();
  490. this.form = {
  491. }
  492. this.drawer = false
  493. this.checkResults = ''
  494. this.value = ''
  495. }else {
  496. this.setTag(res.data.sa_customersid)
  497. }
  498. })
  499. })
  500. },
  501. onClose(){
  502. this.$refs['form'].resetFields();
  503. this.isPhone = true
  504. this.drawer = false
  505. this.checkResults = ''
  506. this.value = ''
  507. this.areaCode = ''
  508. this.telephone = ''
  509. this.$refs.sourceRef.value = ''
  510. this.$emit('onChangeCustomer')
  511. },
  512. /*获取工商信息*/
  513. businessSelect(val, regProvince) {
  514. this.$confirm('是否以查询的工商信息更新客户信息?', '提示', {
  515. confirmButtonText: '确定',
  516. cancelButtonText: '取消',
  517. type: 'warning'
  518. }).then(() => {
  519. this.$refs.businessRef.businessShow = false;
  520. this.form.enterprisename_customer = val.companyName;
  521. this.form.enterprisename = val.companyName;
  522. this.form.address = val.address === "-" ? '' : val.address;
  523. this.form.taxno = val.taxNum;
  524. this.value = [regProvince, val.regCity, val.regArea];
  525. this.form.province = regProvince;
  526. this.form.city = val.regCity;
  527. this.form.county = val.regArea;
  528. this.form.contact = val.legalPerson;
  529. this.form.phonenumber = val.phone
  530. }).catch(() => {
  531. this.$refs.businessRef.businessShow = false;
  532. this.$message({
  533. type: 'info',
  534. message: '已取消更新'
  535. });
  536. })
  537. },
  538. /*省市县*/
  539. cascaderChange(val) {
  540. this.form.province = val[0]
  541. if (val.length === 1)
  542. return this.form = Object.assign({}, this.form, {province: val[0], city: '', county: ''});
  543. this.form = Object.assign({}, this.form, {province: val[0], city: val[1], county: val[2]});
  544. this.$refs.form.validateField('province')
  545. },
  546. /*客户分类*/
  547. async gradeList(){
  548. const siteid = JSON.parse(sessionStorage.getItem('active_account')).siteid
  549. const res = await this.$api.requested({
  550. "classname": "sysmanage.develop.optiontype.optiontype",
  551. "method": "optiontypeselect",
  552. "content": {
  553. "pageNumber": 1,
  554. "pageSize": 20,
  555. "typename": "customergrade",
  556. "parameter": {
  557. "siteid": siteid
  558. }
  559. }
  560. })
  561. /*for (var i=0;i<res.data.length; i++){
  562. if (res.data[i].remarks !== ''){
  563. this.options.gradeData[i] = res.data[i].value + "——" + res.data[i].remarks
  564. }else{
  565. this.options.gradeData[i] = res.data[i].value
  566. }
  567. }*/
  568. this.options.customerClassification = res.data
  569. },
  570. /*客户等级*/
  571. queryCustomerGrade(){
  572. this.$store.dispatch('optiontypeselect','agentgrade').then(res=>{
  573. this.options.customerGrade = res.data
  574. })
  575. },
  576. /*行业列表*/
  577. async industryList(){
  578. const siteid = JSON.parse(sessionStorage.getItem('active_account')).siteid
  579. const res = await this.$api.requested({
  580. "classname": "sysmanage.develop.optiontype.optiontype",
  581. "method": "optiontypeselect",
  582. "content": {
  583. "pageNumber": 1,
  584. "pageSize": 20,
  585. "typename": "industry",
  586. "parameter": {
  587. "siteid": siteid
  588. }
  589. }
  590. })
  591. this.options.industryData = res.data
  592. },
  593. async customerList(){
  594. const res = await this.$api.requested(this.customerParam)
  595. this.customer.customerData = res.data
  596. this.customer.total = res.total
  597. this.customer.currentPage = res.pageNumber
  598. },
  599. selectCustomer(){
  600. this.customerParam.content.where.condition = this.form.superiorenterprisename
  601. this.customerList()
  602. },
  603. /*客户选择信息*/
  604. customerData(val){
  605. this.form.parentid = val.sa_customersid
  606. this.form.superiorenterprisename = val.enterprisename
  607. this.customerShow = false
  608. },
  609. /*客户分页*/
  610. handleSizeChangeCustomer(val) {
  611. // console.log(`每页 ${val} 条`);
  612. this.customerParam.content.pageSize = val
  613. this.customerList()
  614. },
  615. handleCurrentChangeCustomer(val) {
  616. // console.log(`当前页: ${val}`);
  617. this.customerParam.content.pageNumber = val
  618. this.customerList()
  619. },
  620. /*客户类型列表*/
  621. async typeList(){
  622. const siteid = JSON.parse(sessionStorage.getItem('active_account')).siteid
  623. const res = await this.$api.requested({
  624. "classname": "sysmanage.develop.optiontype.optiontype",
  625. "method": "optiontypeselect",
  626. "content": {
  627. "pageNumber": 1,
  628. "pageSize": 20,
  629. "typename": "customertypemx",
  630. "parameter": {
  631. "siteid": siteid
  632. }
  633. }
  634. })
  635. this.options.type = res.data
  636. },
  637. checkSuccess(val){
  638. this.checkResults = val
  639. },
  640. phoneChang(val){
  641. if (val === '座机'){
  642. this.isPhone = false
  643. }else {
  644. this.isPhone = true
  645. }
  646. },
  647. searchData(){
  648. this.changeTab()
  649. },
  650. changeTab(){
  651. this.enterpriseContactList()
  652. this.myContactList()
  653. },
  654. /*企业联系人*/
  655. async enterpriseContactList(){
  656. this.enterpriseContact.param.content.where.condition = this.form.contactsinfo.name
  657. this.enterpriseContact.param.content.sys_enterpriseid = 0
  658. const res = await this.$api.requested(this.enterpriseContact.param)
  659. this.enterpriseContact.listData = res.data
  660. this.enterpriseContact.total = res.total
  661. this.enterpriseContact.currentPage = res.pageNumber
  662. },
  663. /*选择企业联系人*/
  664. enterpriseContactSelect(val){
  665. this.form.contactsinfo.name = val.name
  666. this.form.contactsinfo.oldcontactsid = val.contactsid
  667. if (val.phonenumber.indexOf('-') != '-1'){
  668. this.isPhone = false
  669. this.areaCode = val.phonenumber.substring(0,val.phonenumber.indexOf('-'))
  670. this.telephone = val.phonenumber.substring(this.areaCode.length+1)
  671. this.form.contactsinfo.telephone = this.areaCode + '-' + this.telephone
  672. this.form.contactsinfo.phonenumber = ''
  673. }else {
  674. this.isPhone = true
  675. this.form.contactsinfo.phonenumber = val.phonenumber
  676. this.form.contactsinfo.telephone = ''
  677. this.areaCode = ''
  678. this.telephone = ''
  679. }
  680. this.enterpriseContact.show = false
  681. },
  682. handleSizeChangeEnterprise(val) {
  683. // console.log(`每页 ${val} 条`);
  684. this.enterpriseContact.param.content.pageSize = val
  685. this.enterpriseContactList()
  686. },
  687. handleCurrentChangeEnterprise(val) {
  688. // console.log(`当前页: ${val}`);
  689. this.enterpriseContact.param.content.pageNumber = val
  690. this.enterpriseContactList()
  691. },
  692. /*我的联系人*/
  693. async myContactList(){
  694. this.myContacts.param.content.where.condition = this.form.contactsinfo.name
  695. this.myContacts.param.content.sys_enterpriseid = 0
  696. this.myContacts.param.content.ownerid = 0
  697. const res = await this.$api.requested(this.myContacts.param)
  698. this.myContacts.listData = res.data
  699. this.myContacts.total = res.total
  700. this.myContacts.currentPage = res.pageNumber
  701. },
  702. /*选择我的联系人*/
  703. myContactSelect(val){
  704. this.form.contactsinfo.oldcontactsid = 0
  705. this.form.contactsinfo.name = val.name
  706. if (val.phonenumber.indexOf('-') != '-1'){
  707. this.isPhone = false
  708. this.areaCode = val.phonenumber.substring(0,val.phonenumber.indexOf('-'))
  709. this.telephone = val.phonenumber.substring(this.areaCode.length+1)
  710. this.form.contactsinfo.telephone = this.areaCode + '-' + this.telephone
  711. this.form.contactsinfo.phonenumber = ''
  712. }else {
  713. this.isPhone = true
  714. this.form.contactsinfo.phonenumber = val.phonenumber
  715. this.form.contactsinfo.telephone = ''
  716. }
  717. this.enterpriseContact.show = false
  718. },
  719. handleSizeChangeMy(val) {
  720. // console.log(`每页 ${val} 条`);
  721. this.myContacts.param.content.pageSize = val
  722. this.myContactList()
  723. },
  724. handleCurrentChangeMy(val) {
  725. // console.log(`当前页: ${val}`);
  726. this.myContacts.param.content.pageNumber = val
  727. this.myContactList()
  728. },
  729. telephoneChange(val){
  730. if (val === '座机'){
  731. this.form.contactsinfo.phonenumber = ''
  732. this.form.contactsinfo.telephone = this.areaCode + '-' + this.telephone
  733. }else {
  734. this.form.contactsinfo.telephone = ''
  735. this.areaCode = ''
  736. this.telephone = ''
  737. }
  738. },
  739. inputChange(val){
  740. this.form.contactsinfo.name = val
  741. },
  742. contactData(val){
  743. this.form.contactsinfo.name = val.name
  744. this.form.contactsinfo.sys_phonebookid = val.sys_phonebookid
  745. if (val.phonenumber.indexOf('-') != '-1'){
  746. this.isPhone = false
  747. this.areaCode = val.phonenumber.substring(0,val.phonenumber.indexOf('-'))
  748. this.telephone = val.phonenumber.substring(this.areaCode.length+1)
  749. this.form.contactsinfo.telephone = this.areaCode + '-' + this.telephone
  750. this.form.contactsinfo.phonenumber = ''
  751. }else {
  752. this.isPhone = true
  753. this.form.contactsinfo.phonenumber = val.phonenumber
  754. this.form.contactsinfo.telephone = ''
  755. }
  756. },
  757. selectSource(data){
  758. this.form.source = data
  759. }
  760. },
  761. mounted() {
  762. }
  763. }
  764. </script>
  765. <style scoped>
  766. /deep/.el-input__prefix {
  767. display: flex;
  768. align-items: center;
  769. }
  770. </style>