crm_second_opening_mini/pagesA/crm/createCustomer/createCustomer.js

1 line
6.4 KiB
JavaScript

require('../../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pagesA/crm/createCustomer/createCustomer"],{4956:function(t,e,n){},"56e2":function(t,e,n){"use strict";(function(t,e){var i=n("4ea4");n("8886");i(n("66fd"));var a=i(n("933f"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(a.default)}).call(this,n("bc2e")["default"],n("543d")["createPage"])},"7c6d":function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return i}));var i={uSelect:function(){return n.e("uview-ui/components/u-select/u-select").then(n.bind(null,"ef3c"))}},a=function(){var t=this.$createElement;this._self._c},o=[]},"933f":function(t,e,n){"use strict";n.r(e);var i=n("7c6d"),a=n("9d58");for(var o in a)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(o);n("b52d");var s=n("f0c5"),r=Object(s["a"])(a["default"],i["b"],i["c"],!1,null,"ad35fd3e",null,!1,i["a"],void 0);e["default"]=r.exports},"9d58":function(t,e,n){"use strict";n.r(e);var i=n("b08b"),a=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(o);e["default"]=a.a},b08b:function(t,e,n){"use strict";(function(t){var i=n("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=i(n("9523")),o=n("0c59"),s=n("c7eb"),r=n("dc92"),d=(n("d47e"),n("154c")),c=n("76dd"),u=n("db68"),l=n("8683"),f=n("ab23"),m={mixins:[d.pageJumps,l.commonF],components:{formItem:function(){Promise.all([n.e("common/vendor"),n.e("components/form/formitem")]).then(function(){return resolve(n("d7bf"))}.bind(null,n)).catch(n.oe)},selectCustomer:function(){Promise.all([n.e("common/vendor"),n.e("components/selectCustomer")]).then(function(){return resolve(n("5bcd"))}.bind(null,n)).catch(n.oe)}},data:function(){var t;return t={BASE_IMG_URL:o.BASE_IMG_URL,noClick:!0,name:"",subname:"",industry:"",level:"",source:"",follow:"",address_dingwei:"",address_detail:"",lng:"",lat:"",parent_id:"",parentList:[],plist:[],parentIndex:null,parentName:""},(0,a.default)(t,"BASE_IMG_URL",o.BASE_IMG_URL),(0,a.default)(t,"location",""),(0,a.default)(t,"show",!1),(0,a.default)(t,"remindPeople",[]),(0,a.default)(t,"remindType","customer"),(0,a.default)(t,"sourceIndex",null),(0,a.default)(t,"listForm",[]),(0,a.default)(t,"isAddContact",!0),(0,a.default)(t,"contactsForm",[]),(0,a.default)(t,"list",[]),(0,a.default)(t,"isRequired",!1),(0,a.default)(t,"addressList",[]),(0,a.default)(t,"parentDisabled",!1),(0,a.default)(t,"leads_id",""),t},onLoad:function(e){this.addressList=f.citys,e.id&&(this.parent_id=e.id,t.setNavigationBarTitle({title:"新建子公司"})),e.leads_id&&(this.leads_id=e.leads_id),this.listForm=[],this.init(),this.initTime()},onShow:function(){},methods:{changeRequired:function(t){this.isRequired=t.detail.value},init:function(){return this.leads_id?Promise.all([this.getForm(),this.getPrevCoustomer(),this.getclubInfo()]):Promise.all([this.getForm(),this.getPrevCoustomer()])},initTime:function(){var t=(0,s.dateTimePicker)();t.dateTimeArray.pop(),t.dateTime.pop(),t.dateArray.pop();this.dateTimeArray=t.dateTimeArray,this.dateTime=t.dateTime,this.dateArr=t.dateArray},getclubInfo:function(){var t=this;(0,u.netCluesDetail)({id:this.leads_id}).then((function(e){t.name=e.data.name,t.address_detail=e.data.address_detail,t.listForm.forEach((function(t){t.value=e.data[t.id]})),e.data.name=""}))},moreClick:function(){t.navigateTo({url:"/pagesA/crm/selectMember/selectMember"})},getForm:function(){var t=this;(0,r.netSetForm)({type:"customer"}).then((function(e){e=e.data;var n=e.data;t.isAddContact=e.isAddContact;var i=[];n.forEach((function(t,e){"name"!=t.id&&(t.value="",i.push(t))})),t.listForm=i,e.isAddContact&&t.getContactForm()}))},getContactForm:function(){var t=this;(0,r.netSetForm)({type:"contacts"}).then((function(e){var n=e.data.data;n.forEach((function(t){t.value=""})),t.contactsForm=n}))},changeData:function(t,e,n){var i=this,a=this.listForm;a.forEach((function(n,a){n.id==t&&(n.value=e,i.$set(i.listForm,a,n))}))},changeContactData:function(t,e,n){var i=this,a=this.contactsForm;a.forEach((function(n,a){n.id==t&&(n.value=e,i.$set(i.contactsForm,a,n))}))},getPrevCoustomer:function(){var t=this;(0,c.netPrevCustomer)().then((function(e){t.parentList=e.data,t.handleData(e.data),t.parent_id?(t.handleParent(),t.parentDisabled=!0):t.parentDisabled=!1}))},handleData:function(t){var e=[];t.forEach((function(t){e.push(t.name)})),this.plist=e},handleParent:function(){var t=this,e=this.parent_id;this.parentList.forEach((function(n,i){n.id==e&&(t.parentIndex=i,t.parentName=n.name)}))},checkName:function(){var e=this.name;e?(0,c.netCheckName)({name:e}).then((function(e){t.showToast({title:e.msg,icon:"none",duration:2e3})})):t.showToast({title:"请填写客户姓名",icon:"none",duration:2e3})},changeParent:function(){this.$refs.customerChild.init()},sureSelect:function(t){this.parentName=t.name,this.parent_id=t.id},detailAddClick:function(){var e=this;t.chooseLocation({success:function(t){e.lat=t.latitude,e.lng=t.longitude,e.address_detail=t.name,e.address_dingwei=t.address},fail:function(e){"chooseLocation:fail auth deny"==e.errMsg&&t.showToast({title:"请允许使用位置信息",icon:"none"})}})},confirm:function(t){this.address_dingwei=t[0].label+t[1].label+t[2].label},saveAdd:function(){this.subSave(2)},subSave:function(e){var n=this.name,i=(this.location,this.address_dingwei),a=this.address_detail,o=this.lng,s=this.lat,r=this.parent_id;if(n)if(i)if(a){var d={},u=this.checkCommonForm(this.listForm);if(u){u=Object.assign({},u,{name:n,address_detail:a,lng:o,lat:s,address:i,parent_id:r});var l={};if(!this.isAddContact||(l=this.checkCommonForm(this.contactsForm),l)){var f,m=[];this.remindPeople.forEach((function(t){m.push(t.id)})),f=m.join(",");var h={reminds_id:f};d.record=h,d.customer=u,d.contacts=l,this.leads_id&&(d.leads_id=this.leads_id),console.log(d,"提交"),(0,c.netAddkehu)(d).then((function(n){t.showToast({title:n.msg,icon:"none",duration:2e3}),setTimeout((function(){e&&2==e?t.redirectTo({url:"/pagesA/crm/linkman/newLinkman/newLinkman?id="+n.data.id}):t.redirectTo({url:"/pagesA/crm/customerManagement/customerManagement"})}),2e3)}))}}}else t.showToast({title:"请填写详细地址",icon:"none",duration:2e3});else t.showToast({title:"请选择所在位置",icon:"none",duration:2e3});else t.showToast({title:"请填写客户名称",icon:"none",duration:2e3})}}};e.default=m}).call(this,n("543d")["default"])},b52d:function(t,e,n){"use strict";var i=n("4956"),a=n.n(i);a.a}},[["56e2","common/runtime","common/vendor"]]]);