crm_second_opening_mini/pages/index/groupCompany/subsidiary/newSubsidiary/newSubsidiary.js

1 line
10 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/groupCompany/subsidiary/newSubsidiary/newSubsidiary"],{"419b":function(e,t,i){"use strict";(function(e,t){var n=i("4ea4");i("8886");n(i("66fd"));var a=n(i("e6fe"));e.__webpack_require_UNI_MP_PLUGIN__=i,t(a.default)}).call(this,i("bc2e")["default"],i("543d")["createPage"])},6785:function(e,t,i){"use strict";var n=i("d693"),a=i.n(n);a.a},a515:function(e,t,i){"use strict";(function(e,n){var a=i("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o,s=a(i("9523")),r=a(i("448a")),c=i("c7eb"),l=i("dc92"),d=i("d47e"),u=i("154c"),h=i("76dd"),f=i("0c59"),m={mixins:[u.pageJumps],components:{formItem:function(){Promise.all([i.e("common/vendor"),i.e("components/form/formitem")]).then(function(){return resolve(i("d7bf"))}.bind(null,i)).catch(i.oe)}},data:function(){return{BASE_IMG_URL:f.BASE_IMG_URL,noClick:!0,name:"",subname:"",industry:"",level:"",source:"",follow:"",address_dingwei:"",address_detail:"",lng:"",lat:"",parent_id:"",parentList:[],plist:[],parentIndex:null,parentName:"",is_event:!0,event_start_time:"",event_title:"",remindtype:"",remindList:["准时提醒","5分钟前","15分钟前","30分钟前","一个小时前","两个小时前","一天前","两天前","一周前"],remindIndex:null,location:"",is_contacts:!0,is_record:1,followList:[],follow_type:null,followIndex:null,next_time:"",uploadShow:!1,uploadActions:[{id:1,text:"拍照",color:"#03aa96"},{id:2,text:"从相册中选择",color:"#03aa96"}],imgList:[],fileList:[],content:"",DefaultRemind:[],remindPeople:[],sourceList:[],sourceIndex:null,listForm:[],firstContactForm:[],dateTimeArray:[],dateArr:[],dateTime:[],countryType:1}},onLoad:function(e){this.parent_id=e.id,this.getSelectlist(),this.getPrevCoustomer(),this.listForm=[],this.firstContactForm=[],this.getForm(),this.getFirstContactform(),this.initTime()},onShow:function(){this.remindPeople=[],this.getDefaultRemind()},onUnload:function(){e.removeStorageSync("remindlist")},methods:(o={moreClick:function(){e.navigateTo({url:"/pagesA/crm/selectMember/selectMember"})},getDefaultRemind:function(){var t=this;(0,l.netStaffDefaultReviewer)({type:"record"}).then((function(i){i=i.data,i.forEach((function(e,t){e.isDel=!1})),t.DefaultRemind=i,t.remindPeople=t.$deWeight([].concat((0,r.default)(i),(0,r.default)(e.getStorageSync("remindlist"))))}))},delRemind:function(t){this.remindPeople.splice(t,1),e.setStorageSync("remindlist",this.remindPeople)},getForm:function(){var e=this;(0,l.netSetForm)({type:"customer"}).then((function(t){t=t.data.data,t.forEach((function(e,i){"name"==e.id&&t.splice(i,1)})),e.listForm=t}))},changeData:function(e,t,i){var n=this,a=this.listForm;a.forEach((function(e,a){e.id==i.id&&(e.value=t,n.$set(n.listForm,a,e))}))},getFirstContactform:function(){var e=this;(0,l.netSetForm)({type:"contacts"}).then((function(t){t=t.data.data,e.firstContactForm=t,e.changeCountry(e.countryType)}))},changeCountry:function(e){this.countryType=e;var t=this.firstContactForm;1==e?t.forEach((function(e,t){"mobile"==e.id&&(e.config.required=!0),"email"==e.id&&(e.config.required=!1)})):t.forEach((function(e,t){"mobile"==e.id&&(e.config.required=!0),"email"==e.id&&(e.config.required=!0)})),this.firstContactForm=t},changeContactData:function(e,t,i){var n=this,a=this.firstContactForm;a.forEach((function(e,a){e.id==i.id&&(e.value=t,n.$set(n.firstContactForm,a,e))}))},getPrevCoustomer:function(){var e=this;(0,h.netPrevCustomer)().then((function(t){e.parentList=t.data,e.handleData(t.data),e.parent_id?(e.handleParent(),e.parentDisabled=!0):e.parentDisabled=!1}))},handleData:function(e){var t=[];e.forEach((function(e){t.push(e.name)})),this.plist=t},handleParent:function(){var e=this,t=this.parent_id;this.parentList.forEach((function(i,n){i.id==t&&(e.parentIndex=n,e.parentName=i.name)}))},getSelectlist:function(){var e=this;(0,h.netSelect)().then((function(t){e.followList=t.data["跟进类型"],e.sourceList=t.data["客户来源"]}))},changeFollow:function(e){this.followIndex=e.detail.value,this.follow_type=this.followList[e.detail.value]},changeTime:function(e){var t=e.detail.value,i=this.handleTime(t);this.next_time=i},changeAlipayTime:function(e){this.next_time=e.detail.value},handleTime:function(e){var t=this.dateArr[0][e[0]],i=this.dateArr[1][e[1]],n=this.dateArr[2][e[2]],a=this.dateArr[3][e[3]],o=this.dateArr[4][e[4]],s=t+"-"+i+"-"+n+" "+a+":"+o;return s},uploadClick:function(){this.uploadShow=!0},onCancel:function(){this.uploadShow=!1},uploadType:function(t){var i=this;0==t?e.chooseImage({sourceType:["camera"],sizeType:["compressed"],success:function(e){var t=e.tempFilePaths;t.forEach((function(e){i.uploadFile(e,1)}))}}):1==t?e.chooseImage({sourceType:["album"],sizeType:["compressed"],success:function(e){var t=e.tempFilePaths;t.forEach((function(e){i.uploadFile(e,1)}))}}):n.chooseMessageFile({count:1,type:"file",success:function(e){console.log(e);var t=e.tempFiles[0];i.uploadFile(t,2)},fail:function(e){console.log(e)}})},uploadFile:function(t,i){var n=this;e.uploadFile({url:l.uploadUrl,name:"file",header:{token:e.getStorageSync("token")},filePath:1==i?t:t.path,success:function(a){var o=JSON.parse(a.data);if(n.uploadShow=!1,1==o.code)if(1==i){var s={id:o.data.id,file_path:o.data.url};n.imgList.push(s)}else{var r={id:o.data.id,file_path:o.data.url};t=Object.assign({},t,r),n.fileList.push(t)}else e.showToast({title:"上传失败",icon:"none"})},fail:function(e){console.log(e)}})},delImg:function(e){this.imgList.splice(e,1)},delFile:function(e){this.fileList.splice(e,1)},changeContent:function(e){this.content=e.detail.value},checkName:function(){var t=this.name;t?(0,h.netCheckName)({name:t}).then((function(t){e.showToast({title:t.msg,icon:"none",duration:2e3})})):e.showToast({title:"请填写客户姓名",icon:"none",duration:2e3})},changeParent:function(e){this.parentIndex=e.detail.value,this.parentName=this.parentList[e.detail.value].name,this.parent_id=this.parentList[e.detail.value].id},changeSwitch:function(){this.is_event=!this.is_event},initTime:function(){var e=new Date,t=e.getFullYear(),i=(0,c.dateTimePicker)(this.startYear,t);i.dateTimeArray.pop(),i.dateTime.pop(),i.dateArray.pop();this.dateTimeArray=i.dateTimeArray,this.dateArr=i.dateArray,this.dateTime=i.dateTime},changeFollowTime:function(t){var i=t.detail.value;if(i.includes(-1))e.showToast({title:"请选择正确的时间",icon:"none"});else{var n=this.handleTime(i);this.event_start_time=n}}},(0,s.default)(o,"handleTime",(function(e){var t=this.dateArr[0][e[0]],i=this.dateArr[1][e[1]],n=this.dateArr[2][e[2]],a=this.dateArr[3][e[3]],o=this.dateArr[4][e[4]],s=t+"-"+i+"-"+n+" "+a+":"+o;return s})),(0,s.default)(o,"changeRemind",(function(e){this.remindIndex=e.detail.value,this.remindtype=this.remindList[e.detail.value]})),(0,s.default)(o,"detailAddClick",(function(){var t=this;e.chooseLocation({success:function(e){t.lat=e.latitude,t.lng=e.longitude,t.address_detail=e.name,t.address_dingwei=e.address},fail:function(t){"chooseLocation:fail auth deny"==t.errMsg&&e.showToast({title:"请允许使用位置信息",icon:"none"})}})})),(0,s.default)(o,"subSave",(function(){var t=this.name,i=(this.location,this.address_dingwei),n=this.address_detail,a=this.lng,o=this.lat,s=this.parent_id,r=(this.is_event,this.event_start_time,this.event_title,this.remindtype,this.is_contacts),c=this.is_record,l=this.follow_type,u=this.next_time,f=this.imgList,m=this.fileList,p=this.content,v=this.remindPeople;if(t)if(a&&o){var g={is_contacts:r?1:0,is_record:c},_=[],w={};this.listForm.forEach((function(e){_.push({name:e.id,required:e.config.required,msg:e.config.placeholder,value:e.value})}));for(var T=0;T<_.length;T++){if(_[T].required&&!_[T].value)return void e.showToast({title:_[T].msg,icon:"none"});if("mobile"==_[T].name&&!(0,d.checkPhone)(_[T].value))return void e.showToast({title:"请填写正确的手机号",icon:"none"});if("telephone"==_[T].name&&!(0,d.checkPhone)(_[T].value))return void e.showToast({title:"请填写正确的手机号",icon:"none"});if(("mobile"==_[T].name||"telephone"==_[T].name)&&_[T].value&&!(0,d.checkPhone)(_[T].value))return void e.showToast({title:"请填写正确的手机号",icon:"none"});w[_[T].name]=_[T].value}w=Object.assign({},w,{name:t,address_detail:n,lng:a,lat:o,address:i,parent_id:s});var y={},b=[];this.firstContactForm.forEach((function(e){b.push({name:e.id,required:e.config.required,msg:e.config.placeholder,value:e.value})}));for(var F=0;F<b.length;F++){if(b[F].required&&!b[F].value&&r)return void e.showToast({title:b[F].msg,icon:"none"});if("mobile"==b[F].name&&!(0,d.checkPhone)(b[F].value))return void e.showToast({title:"请填写正确的手机号",icon:"none"});if("telephone"==b[F].name&&!(0,d.checkPhone)(b[F].value))return void e.showToast({title:"请填写正确的手机号",icon:"none"});y[b[F].name]=b[F].value}if(l)if(u)if(p){var L,S=[];f.forEach((function(e){S.push(e.id)})),m.forEach((function(e){S.push(e.id)})),L=S.join(",");var A,P=[];v.forEach((function(e){P.push(e.id)})),A=P.join(",");var C={files:L,follow_type:l,next_time:u,content:p,reminds_id:A};g.record=C,g.customer=w,g.contacts=y,(0,h.netAddkehu)(g).then((function(t){e.showToast({title:t.msg,icon:"none",duration:2e3}),setTimeout((function(){e.navigateBack({delta:1})}),2e3)}))}else e.showToast({title:"请填写跟进内容",icon:"none",duration:2e3});else e.showToast({title:"请选择跟进时间",icon:"none",duration:2e3});else e.showToast({title:"请选择跟进类型",icon:"none",duration:2e3})}else e.showToast({title:"请选择所在位置",icon:"none",duration:2e3});else e.showToast({title:"请填写客户名称",icon:"none",duration:2e3})})),o)};t.default=m}).call(this,i("543d")["default"],i("bc2e")["default"])},a735:function(e,t,i){"use strict";i.r(t);var n=i("a515"),a=i.n(n);for(var o in n)["default"].indexOf(o)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(o);t["default"]=a.a},d48a:function(e,t,i){"use strict";i.d(t,"b",(function(){return a})),i.d(t,"c",(function(){return o})),i.d(t,"a",(function(){return n}));var n={uActionSheet:function(){return i.e("uview-ui/components/u-action-sheet/u-action-sheet").then(i.bind(null,"b13b"))}},a=function(){var e=this.$createElement,t=(this._self._c,this.imgList.length),i=this.fileList.length;this.$mp.data=Object.assign({},{$root:{g0:t,g1:i}})},o=[]},d693:function(e,t,i){},e6fe:function(e,t,i){"use strict";i.r(t);var n=i("d48a"),a=i("a735");for(var o in a)["default"].indexOf(o)<0&&function(e){i.d(t,e,(function(){return a[e]}))}(o);i("6785");var s=i("f0c5"),r=Object(s["a"])(a["default"],n["b"],n["c"],!1,null,"39a78046",null,!1,n["a"],void 0);t["default"]=r.exports}},[["419b","common/runtime","common/vendor"]]]);