edit.vue 28 KB

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