(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["driverManagement/addDiver/addDiver"],{"19c9":function(e,t,n){"use strict";var o=n("4c4d"),i=n.n(o);i.a},3187:function(e,t,n){"use strict";n.r(t);var o=n("586e"),i=n("7fb4");for(var r in i)"default"!==r&&function(e){n.d(t,e,(function(){return i[e]}))}(r);n("19c9");var a,s=n("f0c5"),u=Object(s["a"])(i["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],a);t["default"]=u.exports},"4c4d":function(e,t,n){},"586e":function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return o}));var o={uniList:function(){return n.e("uni_modules/uni-list/components/uni-list/uni-list").then(n.bind(null,"0500"))},uniListItem:function(){return n.e("uni_modules/uni-list/components/uni-list-item/uni-list-item").then(n.bind(null,"6d48"))},uRadioGroup:function(){return Promise.all([n.e("common/vendor"),n.e("uview-ui/components/u-radio-group/u-radio-group")]).then(n.bind(null,"b5d9"))},uRadio:function(){return n.e("uview-ui/components/u-radio/u-radio").then(n.bind(null,"9e1a"))},uSwitch:function(){return n.e("uview-ui/components/u-switch/u-switch").then(n.bind(null,"6316"))},uPicker:function(){return Promise.all([n.e("common/vendor"),n.e("uview-ui/components/u-picker/u-picker")]).then(n.bind(null,"482e"))}},i=function(){var e=this,t=e.$createElement;e._self._c},r=[]},"7fb4":function(e,t,n){"use strict";n.r(t);var o=n("edc5"),i=n.n(o);for(var r in o)"default"!==r&&function(e){n.d(t,e,(function(){return o[e]}))}(r);t["default"]=i.a},"97ce":function(e,t,n){"use strict";(function(e){n("84da");o(n("66fd"));var t=o(n("3187"));function o(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=n,e(t.default)}).call(this,n("543d")["createPage"])},edc5:function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=s(n("a34a")),i=s(n("3415")),r=s(n("87ef")),a=s(n("0c78"));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t,n,o,i,r,a){try{var s=e[r](a),u=s.value}catch(c){return void n(c)}s.done?t(u):Promise.resolve(u).then(o,i)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var r=e.apply(t,n);function a(e){u(r,o,i,a,s,"next",e)}function s(e){u(r,o,i,a,s,"throw",e)}a(void 0)}))}}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d={data:function(){var e;return{show:!1,disabled:!1,postData:(e={phone:"",birthday:"",password:"",userName:""},l(e,"birthday",""),l(e,"headPhoto",""),l(e,"plateNumber",""),l(e,"registerMode","1"),l(e,"userSource","OMS-MINIAPP"),e),aboutEnterprise:{customerId:"",customerCode:"",companyId:"",companyNature:1,shareCompanyQuota:0,dayAmountToplimit:"0",orderAmountToplimit:"0",dayVolumeToplimit:"0",orderVolumeToplimit:"0",name:"",nickName:"",plateNumberCompany:"",remark:""},openText:{one:"开启",off:"关闭"},switchOpen:!0,enterpriseType:"自营",radiolist1:[{name:"自营",disabled:!1},{name:"外请",disabled:!1}]}},onLoad:function(){var t=this;e.$on("company",(function(e){t.aboutEnterprise.companyId=e.id,t.aboutEnterprise.name=e.name,console.log(e)})),console.log(i.default.chooseImage)},methods:{inputFn:function(t){console.log(t),-1!=this.aboutEnterprise[t].indexOf(".")&&this.aboutEnterprise[t].split(".")[1].length>2&&(e.showToast({title:"最多保留小数点后两位",icon:"none"}),this.$nextTick((function(){this.aboutEnterprise[t]=Number(this.aboutEnterprise[t]).toFixed(2)})))},clearFn:function(){var e=this,t=["companyNature","shareCompanyQuota"];Object.keys(this.aboutEnterprise).forEach((function(n){t.includes(n)||(e.aboutEnterprise[n]="")})),this.aboutEnterprise.shareCompanyQuota=1,this.switchOpen=!0,this.enterpriseType="自营",this.disabled=!1},postFn:function(){var t=this,n=this,o=null,s=null;console.log(this.aboutEnterprise);var u={userName:{tacitly:"",WrongText:"用户昵称不能为空"},password:{tacitly:"",minLength:8,WrongText:"密码最少为8位"},phone:{custom:/^[1][3,4,5,7,8,9][0-9]{9}$/,WrongText:"请输入正确手机号码"}};if(s=i.default.checkFn(this.postData,[],u),s.result){if(""!==this.aboutEnterprise.name){var c={plateNumberCompany:{tacitly:"",custom:/(^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$)/,WrongText:"企业车牌号码错误"}};if(o=i.default.checkFn(this.aboutEnterprise,[],"自营"==this.enterpriseType?c:{}),!o.result)return void e.showToast({title:o.WrongText,icon:"none"})}r.default.saveNewDriver(Object.assign(JSON.parse(JSON.stringify(this.postData)),{password:(0,a.default)(this.postData.password)})).then((function(i){2e4===i.code&&(e.showToast({title:"司机新增成功",icon:"success"}),setTimeout((function(){if(null!==o){var a=i.data;n.aboutEnterprise.customerId=a.id,n.aboutEnterprise.customerCode=a.userCode,t.aboutEnterprise.nickName=t.postData.userName,t.aboutEnterprise.shareCompanyQuota=t.switchOpen?1:0,r.default.saveOilCard(t.aboutEnterprise).then((function(t){2e4===t.code&&(e.showToast({title:"油卡新增成功",icon:"success"}),setTimeout((function(){e.redirectTo({url:"/driverManagement/index/index"})}),500))}))}else e.redirectTo({url:"/driverManagement/index/index"})}),500))}))}else e.showToast({title:s.WrongText,icon:"none"})},jump:function(){e.navigateTo({url:"../company/company"})},dateConfirm:function(e){this.postData.birthday=e.year+"-"+e.month+"-"+e.day,console.log(this.postData.birthday)},open:function(){this.show=!this.show},clickfn:function(t){if("object"!==typeof t)return this.postData.headPhoto=t,void e.showToast({title:"上传成功"});i.default.chooseImage(this.clickfn)},random:function(){var e=this;return c(o.default.mark((function t(){var n,i,r,a,s,u,c;return o.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:n=[],i=!1,r=0;case 3:if(!(r<8)){t.next=21;break}if(i=parseInt(10*Math.random())>parseInt(10*Math.random()),a=n.join("").match(/[A-z]/g)||[],s=n.join("").match(/[0-9]/g)||[],4==s.length&&(i=!1),4==a.length&&(i=!0),!i){t.next=14;break}u=e.randomNumberFn(),n.push(u),t.next=18;break;case 14:return t.next=16,e.randomUnicodeFn();case 16:c=t.sent,n.push(String.fromCharCode(c));case 18:r++,t.next=3;break;case 21:e.postData.password=n.join(""),console.log(n.join(""),"---");case 23:case"end":return t.stop()}}),t)})))()},randomNumberFn:function(){return parseInt(10*Math.random())},randomUnicodeFn:function(){return new Promise((function(e,t){var n=/^9[1-6]{1}$/,o=setInterval((function(){var t=parseInt(57*Math.random())+65;n.test(t)||(console.log(String.fromCharCode(t),t),clearInterval(o),e(t))}),10)}))},change:function(){this.aboutEnterprise.shareCompanyQuota=this.switchOpen?1:0,console.log(this.switchOpen)},radioChange:function(e){console.log(e)},groupChange:function(){this.aboutEnterprise.companyNature="自营"==this.enterpriseType?1:0,console.log(this.aboutEnterprise.companyNature,"----"),"外请"==this.enterpriseType?(this.aboutEnterprise.plateNumberCompany="",this.switchOpen=!1,this.disabled=!0):(this.switchOpen=!0,this.disabled=!1),console.log(this.aboutEnterprise.companyNature,this.disabled,"----")}}};t.default=d}).call(this,n("543d")["default"])}},[["97ce","common/runtime","common/vendor"]]]);