information.js 20 KB

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