information.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. ;
  2. var information = new Vue({
  3. el:'#information',
  4. data:{
  5. tabCurrentIndex:1,
  6. loginLoading: false,
  7. isRequset:true,
  8. params:{
  9. userId:'',
  10. shopId:'',
  11. townId:'',
  12. provinceId: '',//省id
  13. cityId: '',
  14. address:'',
  15. name:'',//公司名称
  16. shortName:'',//公司简称
  17. linkMan:'',//联系人
  18. contractEmail:'',//
  19. contractPhone:'',//固定电话
  20. faxNumber:'',//传真
  21. legalPerson:'',//法人代表
  22. registeredCapital:'',//注册资本
  23. companyNature:'',//公司性质
  24. turnover:'',//年营业额
  25. },
  26. form:{
  27. townID:'',
  28. provinceID: '',//省id
  29. cityID: '',
  30. },
  31. params2:{
  32. userId:'',
  33. shopId:'',
  34. firstShopType:'',//公司类型 1医疗 2非医疗
  35. secondShopType:'',//医疗下的二级分类
  36. medicalPracticeLicense:'',//资质
  37. mainProduct:'',//主营产品
  38. businessScope:'',//经营内容
  39. website:'', //公司网址
  40. wxOfficialAccount:'',//微信公众号
  41. wxApplets:'',//微信小程序
  42. shopDesc:'',//公司介绍
  43. mainProductDesc:'',//主打说明
  44. },
  45. params3:{
  46. socialCreditCode:'',//营业执照编号
  47. businessLicense:'',//营业执照
  48. logo:'',//公司logo
  49. operationLicence:'',//生产
  50. hygienicLicense:'',//卫生
  51. taxLicense:'',//税务
  52. honorCertification:'',//荣誉
  53. productCertification:'',//产品
  54. },
  55. mainProEdit: '',
  56. shopScopeEdit:'',
  57. formData:new FormData(),
  58. HonorImagesList:[],
  59. productImagesList:[],
  60. mentuzCampNullList:[
  61. {value:'1',name:'产品',checked:false},
  62. {value:'2',name:'仪器',checked:false},
  63. {value:'3',name:'服务',checked:false}
  64. ],
  65. Scopelist:[
  66. {value:'1',name:'仪器护理类',checked:false},
  67. {value:'2',name:'护肤品类',checked:false},
  68. {value:'3',name:'纹绣类',checked:false},
  69. {value:'4',name:'美体内衣',checked:false},
  70. {value:'5',name:'整形耗材',checked:false},
  71. {value:'6',name:'国际品牌',checked:false},
  72. {value:'7',name:'美胸类',checked:false},
  73. {value:'8',name:'健康保健类',checked:false},
  74. {value:'9',name:'面膜类',checked:false},
  75. {value:'10',name:'抗衰老',checked:false},
  76. {value:'11',name:'生殖保养',checked:false},
  77. {value:'12',name:'健康养生',checked:false},
  78. {value:'13',name:'纤体减肥',checked:false}
  79. ],
  80. shopMainPros: [],
  81. shopScope:[],
  82. rule:{
  83. name: '^[a-zA-Z\\u4e00-\\u9fa5]{2,}$',
  84. phone: '^\\d{6,12}$',
  85. code: '^\\d{6}$',
  86. license: '^[a-zA-Z0-9_]{18}$',
  87. email: '^(([^<>()\\[\\]\\\\.,;:\\s@&quot;]+(\\.[^<>()\\[\\]\\\\.,;:\\s@&quot;]+)*)|(&quot;.+&quot;))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$',
  88. password: "^[^\\u4e00-\\u9fa5]{8,16}$",
  89. num:'^[1-9]+(.[0-9]{2})?$'
  90. },
  91. provinceArray:[],
  92. cityArray: [],//市
  93. townArray: [],//区
  94. },
  95. methods:{
  96. //图片放大
  97. showViewerbigImage:function(){
  98. var viewer = new Viewer(document.getElementById('uploadImage'));
  99. },
  100. showViewerImageFn:function(){
  101. var viewer = new Viewer(document.getElementById('businessImage'));
  102. },
  103. showViewerImageFn1:function(){
  104. var viewer = new Viewer(document.getElementById('logoImage'));
  105. },
  106. showViewerImageFn2:function(){
  107. var viewer = new Viewer(document.getElementById('zizhiImage'));
  108. },
  109. showViewerImageFn3:function(){
  110. var viewer = new Viewer(document.getElementById('hygienicImage'));
  111. },
  112. showViewerImageFn4:function(){
  113. var viewer = new Viewer(document.getElementById('taxImage'));
  114. },
  115. showViewerImageFn5:function(){
  116. var viewer = new Viewer(document.getElementById('HonorImages'));
  117. },
  118. showViewerImageFn6:function(){
  119. var viewer = new Viewer(document.getElementById('productImages'));
  120. },
  121. shopInfo:function(){
  122. var _this = this;
  123. SupplierApi.shopInfo({userId:_this.params.userId},function(res){
  124. if(res.code==0){
  125. console.log('asda-=======',res.data);
  126. _this.isRequset=false;
  127. var shop = res.data.shop;
  128. var user = res.data.user;
  129. _this.params.name = shop.name;
  130. _this.params.shortName = shop.shortName;
  131. _this.params.linkMan = shop.linkMan;
  132. _this.params.contractEmail = shop.contractEmail;
  133. _this.params.address = shop.provincialAddress;
  134. _this.params.provinceId = shop.provinceId;
  135. _this.params.cityId = shop.cityId;
  136. _this.params.townId = shop.townId;
  137. _this.params.contractPhone = shop.contractPhone;
  138. _this.params.faxNumber = shop.faxNumber;
  139. _this.params.legalPerson = shop.legalPerson;
  140. _this.params.registeredCapital = shop.registeredCapital;
  141. _this.params.companyNature = shop.companyNature;
  142. _this.params.turnover = shop.turnover;
  143. // _this.shopMainPros = _this.setNewMainpro(shop.mainpro);
  144. // _this.shopScope = _this.setNewScope(shop.businessScope);
  145. _this.params2.firstShopType = shop.firstShopType;
  146. _this.params2.secondShopType = shop.secondShopType;
  147. _this.params2.medicalPracticeLicense = shop.medicalPracticeLicense;
  148. _this.params2.website = shop.website;
  149. _this.params2.wxOfficialAccount = shop.wxOfficialAccount;
  150. _this.params2.wxApplets = shop.wxApplets;
  151. _this.params2.shopDesc = shop.shopDesc;
  152. _this.params2.mainProductDesc = shop.mainProductDesc;
  153. _this.params3.socialCreditCode = shop.socialCreditCode;
  154. _this.params3.businessLicense = shop.businessLicense;
  155. _this.params3.logo = shop.logo;
  156. _this.params3.operationLicence = shop.operationLicence;
  157. _this.params3.hygienicLicense = shop.hygienicLicense;
  158. _this.params3.taxLicense = shop.taxLicense;
  159. _this.params3.honorCertification = shop.honorCertification;
  160. _this.params3.productCertification = shop.productCertification;
  161. _this.HonorImagesList = shop.honorCertification;
  162. _this.productImagesList = shop.productCertification;
  163. if(shop.mainpro != "" && shop.mainProduct != null){
  164. _this.mentuzCampNullList = _this.setNewMainpro(shop.mainProduct);
  165. _this.mentuzCampNullList.forEach(function (item) {
  166. if(item.checked){
  167. _this.shopMainPros.push(item.name)
  168. }
  169. })
  170. }
  171. if(shop.businessScope != "" && shop.businessScope != null){
  172. _this.Scopelist = _this.setNewScope(shop.businessScope);
  173. _this.Scopelist.forEach(function (item) {
  174. if(item.checked){
  175. _this.shopScope.push(item.name)
  176. }
  177. })
  178. }
  179. if(shop.cityId!=''&&shop.cityId!=null){
  180. _this.getcity()
  181. }
  182. if(shop.townId!=''&&shop.townId!=null){
  183. _this.getcTown();
  184. }
  185. }
  186. })
  187. },
  188. changeMainPros:function(event){
  189. var _this = this;
  190. var values = event.target.value;
  191. if(event.target.checked){
  192. _this.shopMainPros.push(values)
  193. }else {
  194. _this.shopMainPros.splice(_this.shopMainPros.indexOf(values), 1);
  195. }
  196. },
  197. changeScope:function(event){
  198. var _this = this;
  199. var values = event.target.value;
  200. if(event.target.checked){
  201. _this.shopScope.push(values)
  202. }else {
  203. _this.shopScope.splice(_this.shopScope.indexOf(values), 1);
  204. }
  205. },
  206. shopSubmit:function(){ //提交
  207. var _self = this;
  208. var params = {};
  209. var pass = verifyForm();
  210. if (_self.loginLoading) { return false; }
  211. this.$nextTick(function() {
  212. if (!pass) {return false;}
  213. if(_self.tabCurrentIndex==1){
  214. params = _self.params;
  215. }else if(_self.tabCurrentIndex==2){
  216. _self.params2.mainProduct = _self.shopMainPros.join("/");
  217. _self.params2.businessScope = _self.shopScope.join("/");
  218. params = _self.params2
  219. }else if(_self.tabCurrentIndex==3){
  220. params = _self.params3
  221. }
  222. if(_self.params2.website!=''){
  223. var WebRegExp = new RegExp(/^((http|ftp|https):\/\/[a-zA-Z0-9]|[a-zA-Z0-9])[-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+.?$/);
  224. if (!WebRegExp.test(_self.params2.website)) {
  225. $('#website').parent().addClass("error");
  226. $('#website').siblings('.errTips').text('请填写正确的网址').addClass("show");
  227. return false;
  228. }
  229. }
  230. params = Object.assign(_self.params,_self.params2,_self.params3);
  231. SupplierApi.modifiedData(params,function (res) {
  232. if(res.code === 0){
  233. CAIMEI.dialog('修改成功',true,function () {
  234. window.location.href='/supplier/dashboard.html';
  235. _self.loginLoading = false;
  236. });
  237. } else {
  238. CAIMEI.Alert(res.msg,'确定',false);
  239. _self.loginLoading = false;
  240. }
  241. })
  242. })
  243. },
  244. mainProAdd: function(){//添加主营内容
  245. var _self = this;
  246. if (_self.mainProEdit.length>0) {
  247. var obj = {name:_self.mainProEdit};
  248. if(_self.checkedArray(_self.mainProEdit,_self.mentuzCampNullList)){
  249. CAIMEI.dialog('主营内容已存在!',false);
  250. }else {
  251. _self.mentuzCampNullList.push(obj);
  252. }
  253. }
  254. },
  255. shopScopeAdd:function(){ //经营内容
  256. var _self = this;
  257. if (_self.shopScopeEdit.length>0) {
  258. var obj = {name:_self.shopScopeEdit};
  259. if(_self.checkedArray(_self.shopScopeEdit,_self.Scopelist)){
  260. CAIMEI.dialog('主营内容已存在!',false);
  261. }else {
  262. _self.Scopelist.push(obj);
  263. }
  264. }
  265. },
  266. checkedArray:function(content,arr){//判断主营内容是否已存在
  267. for(var i in arr){
  268. if(arr[i].name == content){
  269. return true;
  270. }
  271. }
  272. return false;
  273. },
  274. uploadzizhiImageFn: function(event){//上传医疗资质
  275. var _this = this;
  276. var inputDOM = _this.$refs.medicalPracticeLicenseImg1;
  277. var file = inputDOM.files;
  278. _this.formData.append('file', file[0]);
  279. PublicApi.uploadimg(_this.formData,function(response){
  280. _this.params2.medicalPracticeLicense = response.data;
  281. event.target.value = '';
  282. });
  283. },
  284. uploadBusinessLicenseImageFn: function(event){//上传营业执照
  285. var _this = this;
  286. var inputDOM = _this.$refs.businessLicenseImage;
  287. var file = inputDOM.files;
  288. _this.formData.append('file', file[0]);
  289. PublicApi.uploadimg(_this.formData,function(response){
  290. _this.params3.businessLicense = response.data;
  291. event.target.value = '';
  292. });
  293. },
  294. uploadlogoImageFn: function(event){//上传公司logo
  295. var _this = this;
  296. var inputDOM = _this.$refs.logo;
  297. var file = inputDOM.files;
  298. _this.formData.append('file', file[0]);
  299. PublicApi.uploadimg(_this.formData,function(response){
  300. _this.params3.logo = response.data;
  301. event.target.value = '';
  302. });
  303. },
  304. uploadproductionLicenceImageFn: function(event){//上传生产
  305. var _this = this;
  306. var inputDOM = _this.$refs.productionLicence;
  307. var file = inputDOM.files;
  308. _this.formData.append('file', file[0]);
  309. PublicApi.uploadimg(_this.formData,function(response){
  310. _this.params3.operationLicence = response.data;
  311. event.target.value = '';
  312. });
  313. },
  314. uploadhygienicLicenseImageFn: function(event){//上传卫生
  315. var _this = this;
  316. var inputDOM = _this.$refs.hygienicLicense;
  317. var file = inputDOM.files;
  318. _this.formData.append('file', file[0]);
  319. PublicApi.uploadimg(_this.formData,function(response){
  320. _this.params3.hygienicLicense = response.data;
  321. event.target.value = '';
  322. });
  323. },
  324. uploadtaxLicenseImageFn: function(event){//上传税务
  325. var _this = this;
  326. var inputDOM = _this.$refs.taxLicense;
  327. var file = inputDOM.files;
  328. _this.formData.append('file', file[0]);
  329. PublicApi.uploadimg(_this.formData,function(response){
  330. _this.params3.taxLicense = response.data;
  331. event.target.value = '';
  332. });
  333. },
  334. uploadHonorImageFn: function(event){//荣誉证书上传
  335. var _this = this;
  336. var inputDOM = _this.$refs.Honor;
  337. var file = inputDOM.files;
  338. _this.formData.append('file', file[0]);
  339. PublicApi.uploadimg(_this.formData,function(response){
  340. _this.HonorImagesList.push(response.data);
  341. _this.params3.honorCertification =_this.HonorImagesList.toString()+',';
  342. event.target.value = '';
  343. });
  344. },
  345. uploadproductImageFn: function(event){//产品证书上传
  346. var _this = this;
  347. var inputDOM = _this.$refs.product;
  348. var file = inputDOM.files;
  349. _this.formData.append('file', file[0]);
  350. PublicApi.uploadimg(_this.formData,function(response){
  351. _this.productImagesList.push(response.data);
  352. _this.params3.productCertification =_this.productImagesList.toString()+',';
  353. event.target.value = '';
  354. });
  355. },
  356. deletaxImage:function(){//删除卫生
  357. this.params3.taxLicense = '';
  358. },
  359. deletehygienicImage:function(){//删除卫生
  360. this.params3.hygienicLicense = '';
  361. },
  362. deleteproducImage:function(){//删除生产
  363. this.params3.operationLicence = '';
  364. },
  365. deletelogoImage:function(){//删除logo图片
  366. this.params3.logo = '';
  367. },
  368. deleteBusinessImage:function(){//删除营业执照图片
  369. this.params3.businessLicense = '';
  370. },
  371. deleteMedicalImage:function(){//删除医疗执照图片
  372. this.params2.medicalPracticeLicense = '';
  373. },
  374. removeGoodsImagesFn: function(index){//删除荣誉图片
  375. var _this = this;
  376. _this.HonorImagesList.splice(index,1);
  377. _this.params3.honorCertification =_this.HonorImagesList.toString()+',';
  378. },
  379. removeproductImagesFn: function(index){//删除产品图片
  380. var _this = this;
  381. _this.productImagesList.splice(index,1);
  382. _this.params3.productCertification =_this.productImagesList.toString()+',';
  383. },
  384. blurHandle: function(event) { // 失去焦点校验
  385. var el = event.currentTarget;
  386. verifyHandle(el);
  387. },
  388. checkedFn:function (index) {
  389. this.tabCurrentIndex = index;
  390. console.log( this.tabCurrentIndex);
  391. },
  392. province:function () {
  393. var _this = this;
  394. _this.params.provinceId = event.target.value;
  395. if(_this.params.provinceId==0){//省为请选择时市区初始化
  396. _this.cityArray=[];
  397. _this.townArray=[];
  398. _this.params.townId=0;
  399. _this.params.cityId = 0;
  400. }else {
  401. _this.getcity();
  402. _this.params.cityId = 0;
  403. }
  404. },
  405. getcity:function(event){//加载市
  406. var _this = this;
  407. PublicApi.GetCity({ provinceId: _this.params.provinceId },function(response){
  408. if(response.code == 0 ){
  409. _this.cityArray = response.data;
  410. _this.params.cityId = event.target.value;
  411. if(_this.params.cityId==0){
  412. _this.townArray=[];
  413. _this.params.townId = 0;
  414. }else {
  415. _this.getcTown();
  416. _this.params.townId = 0;
  417. }
  418. }
  419. })
  420. },
  421. getcTown:function(event){
  422. var _this = this;
  423. PublicApi.GetTown({cityId:_this.params.cityId},function(response){
  424. if(response.code == 0 ){
  425. _this.townArray = response.data;
  426. _this.params.townId = event.target.value;
  427. }else{
  428. CAIMEI.Alert(response.msg, '确定', false);
  429. }
  430. })
  431. },
  432. setNewMainpro:function(arr){//回显处理主营内容
  433. var newArr = [];
  434. arr.split('/').forEach(function(item,index){
  435. newArr.push({value:(index+1).toString(),'name':item,checked:true});
  436. });
  437. return newArr
  438. },
  439. setNewScope:function(arr) {//回显处理主营内容
  440. var newArr = [];
  441. arr.split('/').forEach(function(item,index){
  442. newArr.push({value:(index+1).toString(),'name':item,checked:true});
  443. });
  444. return newArr
  445. },
  446. },
  447. mounted:function () {
  448. var _self=this;
  449. if(globalUserData){
  450. _self.params.userId = globalUserData.userId;
  451. _self.params.shopId = globalUserData.shopId;
  452. _self.params2.userId = globalUserData.userId;
  453. _self.params2.shopId = globalUserData.shopId;
  454. _self.params3.userId = globalUserData.userId;
  455. _self.params3.shopId = globalUserData.shopId;
  456. };
  457. _self.shopInfo();
  458. PublicApi.GetProvince({},function(response){ //省份
  459. if(response.code == 0){
  460. console.log(response)
  461. _self.provinceArray = response.data
  462. }else{
  463. CAIMEI.Alert(response.msg, '确定', false);
  464. }
  465. });
  466. $('.navLayout').find('.navList').removeClass("on").find('.con').hide().find('a').removeClass("on");
  467. $('.navLayout').find('.navList').eq(2).addClass("on").find('.con').show().find('a').eq(0).addClass("on");
  468. }
  469. })