From 71f90f27e228cf73b420c3c11368c8b31ce61c39 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Tue, 30 Nov 2021 02:28:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=88=86=E9=94=80=E5=95=86bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 11 +++++ .../adddistributorinfo/adddistributorinfo.js | 49 +++++++++++++------ 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index d3ca1f18..bbc97de6 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -398,10 +398,21 @@ export const getResellerList = (params) => { export const getExistName = (name) => { return req('get', baseurl + "/reseller/exist_name/"+name) } + +//编辑分销商异步校验分销商名称是否重复 +export const geteditExistName = (name,params) => { + return req('get', baseurl + "/reseller/exist_name/"+name,params) +} + //新建分销商异步校验分销商登陆账号是否重复 export const getExistAccount = (name) => { return req('get', baseurl + "/reseller/exist_account/"+name) } + +//编辑分销商异步校验分销商登陆账号是否重复 +export const geteditExistAccount = (name,params) => { + return req('get', baseurl + "/reseller/exist_account/"+name,params) +} //新建分销商-销售人员 export const getPersonnel = () => { return req('get', baseurl + "/auth/admin/all") diff --git a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js index d1ac84a1..e8096b63 100644 --- a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js +++ b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js @@ -8,7 +8,7 @@ import "../../../assets/comm.css" import {Select,Dialog,Button,ImageUpload ,onUpload,FormInputField,Notify,CopyButton } from "zent" import Bus from "../../../assets/eventBus.js" import _ from "lodash"; -import {getExistName,getCompany,uploadImg,getPersonnel,handelResponse,getExistAccount} from "../../../assets/api.js" +import {getExistName,geteditExistName,getCompany,uploadImg,getPersonnel,geteditExistAccount,handelResponse,getExistAccount} from "../../../assets/api.js" export default class adduserinfo extends React.Component{ constructor(props){ @@ -197,28 +197,45 @@ export default class adduserinfo extends React.Component{ } //校验分销商名称 NameblurFn(e){ +console.log(200,this.props.enumer); + if(this.props.enumer==0){ getExistName(e).then(res=>{ handelResponse(res,(response,msg)=>{ - },err=>{ + },err=>{}); + }).catch(err=>{}); + }else{ + let formInfo=JSON.parse(sessionStorage.getItem('dataInfo')); + let data={ + id:formInfo.id + } + geteditExistName(e,data).then(res=>{ + handelResponse(res,(response,msg)=>{ - }); - }).catch(err=>{ - - }); + },err=>{}); + }).catch(err=>{}); + } } //校验登陆账号名称 AccountblurFn(e){ - getExistAccount(e).then(res=>{ - handelResponse(res,(response,msg)=>{ - - },err=>{ - - - }); - }).catch(err=>{ - - }); + if(this.props.enumer==0){ + getExistAccount(e).then(res=>{ + handelResponse(res,(response,msg)=>{ + },err=>{}); + }).catch(err=>{ + + }); + }else{ + let formInfo=JSON.parse(sessionStorage.getItem('dataInfo')); + let data={ + id:formInfo.id + } + geteditExistAccount(e,data).then(res=>{ + handelResponse(res,(response,msg)=>{ + },err=>{}); + }).catch(err=>{ + }); + } } cancel(){ let model2 = {}