ERP/static/js/chunk-4bd6.95d75c52.js

1 line
12 KiB
JavaScript
Raw Normal View History

2019-03-11 19:01:31 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-4bd6"],{Gm5Y:function(e,t,r){"use strict";r.r(t);var o=r("ql3t"),s=r.n(o),a=r("6HaC"),l=r("BJvg"),n={name:"NewAgent",components:{MyEmp:r("LWcQ").a},data:function(){return{trader:"",empcontrol:!1,nations:[],provinces:[],cities:[],repositories:[],customerForm:{agentname:"",phone:"",type:"",pinyin:"",level:"",source:"",discount:"",countryid:"",provinceid:"",cityid:"",introduce:"",address:"",contactname:"",traderid:"",transmode:"",deliverymode:"",createid:"",newold:""},customerFormrules:{phone:[{required:!0,validator:function(e,t,r){if(!t)return r(new Error("手机号不能为空"));setTimeout(function(){s()(t)?r():r(new Error("请输入数字值"))},1e3)},trigger:"change"}],agentname:[{required:!0,message:"请输入客户名称",trigger:"blur"}],type:[{required:!0,message:"请选择客户类型",trigger:"change"}],countryid:[{required:!0,message:"请选择国家",trigger:"change"}],contactname:[{required:!0,message:"请输入联系人",trigger:"blur"}]},customertypes:[],customertyp:1,levels:[],levelstype:2,sources:[],sourcestype:3}},created:function(){this.getnationlist(),this.getCategory()},methods:{getCategory:function(){var e=this;Object(l.j)(this.customertyp).then(function(t){200===t.data.ret?e.customertypes=t.data.data.content.list:e.$notify.error({title:"错误",message:"出错了",offset:100})}),Object(l.j)(this.levelstype).then(function(t){200===t.data.ret?e.levels=t.data.data.content.list:e.$notify.error({title:"错误",message:"出错了",offset:100})}),Object(l.j)(this.sourcestype).then(function(t){200===t.data.ret?e.sources=t.data.data.content.list:e.$notify.error({title:"错误",message:"出错了",offset:100})})},getnationlist:function(){var e=this;Object(a.b)().then(function(t){200===t.data.ret?e.nations=t.data.data.content:e.$notify.error({title:"错误",message:"出错了",offset:100})})},handlechange:function(e){var t=this;Object(a.c)(e).then(function(e){200===e.data.ret?t.provinces=e.data.data.content:t.$notify.error({title:"错误",message:"出错了",offset:100})})},handlechange2:function(e){var t=this;Object(a.a)(e).then(function(e){console.log(e),200===e.data.ret?t.cities=e.data.data.content:t.$notify.error({title:"错误",message:"出错了",offset:100})})},handlechoose:function(){this.empcontrol=!0},personName:function(e){console.log(e),this.trader=e.personName,this.customerForm.traderid=e.id},handlesave:function(){var e=this;this.$refs.customerForm.validate(function(t){if(!t)return e.$notify.error({title:"错误",message:"信息未填完整",offset:100}),!1;Object(l.c)(e.customerForm).then(function(t){console.log(t),200===t.data.ret?(e.$notify({title:"成功",message:"保存成功",type:"success",offset:100}),e.restAllForm(),e.$refs.customerForm.clearValidate(),e.$refs.customerForm.resetFields(),e.$refs.customerForm2.clearValidate(),e.$refs.customerForm2.resetFields()):e.$notify.error({title:"错误",message:t.data.msg,offset:100})})})},restAllForm:function(){this.customerForm={agentname:"",phone:"",type:"",pinyin:"",level:"",source:"",discount:"",countryid:"",provinceid:"",cityid:"",introduce:"",address:"",contactname:"",traderid:"",transmode:"",deliverymode:"",createid:"",newold:""},this.trader=""},handleentry:function(){var e=this;this.$refs.customerForm.validate(function(t){if(!t){e.$notify.error({title:"错误",message:"信息未填完整",offset:100});var r=e.$refs.geren.offsetTop;return console.log(r),document.documentElement.scrollTop=r-100,!1}Object(l.c)(e.customerForm).then(function(t){if(console.log(t),200===t.data.ret){e.$notify({title:"成功",message:"保存成功",type:"success",offset:100}),e.restAllForm(),e.$refs.customerForm.clearValidate(),e.$refs.customerForm.resetFields(),e.$refs.customerForm2.clearValidate(),e.$refs.customerForm2.resetFields();var r=e.$refs.geren.offsetTop;console.log(r),document.documentElement.scrollTop=r-100}else e.$notify.error({title:"错误",message:t.data.msg,offset:100})})})},handlecancel:function(){this.$router.go(-1);this.$store.dispatch("delView",{path:"/Customer/NewAgent",name:"NewAgent",