1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
| /**
| 初始化 公司信息
|
| **/
|
| (function(vc){
| vc.extends({
| data:{
| storeTypes:[],
| companyBaseInfo:{
| name:"",
| address:"",
| tel:"",
| storeTypeCd:"",
| nearbyLandmarks:""
| }
| },
| _initMethod:function(){
| vc.component.initStoreType();
| },
| _initEvent:function(){
| // vc.component.$on('errorInfoEvent',function(_errorInfo){
| // vc.component.registerInfo.errorInfo = _errorInfo;
| // console.log('errorInfoEvent 事件被监听',_errorInfo)
| // });
|
| },
| watch:{
| companyBaseInfo:{
| deep: true,
| handler:function(){
| vc.component.$emit('companyBaseEvent',vc.component.companyBaseInfo);
| }
| }
| },
| methods:{
| initStoreType:function(){
| var param = {
| params:{
| msg:"123"
| }
|
| }
| vc.http.get('company','getStoreType',
| JSON.stringify(param),
| function(json,res){
| if(res.status == 200){
| vc.component.storeTypes = JSON.parse(json);
| return ;
| }
| //vc.component.$emit('errorInfoEvent',json);
| },function(errInfo,error){
| console.log('请求失败处理',errInfo,error);
| vc.component.$emit('errorInfoEvent',errInfo);
| });
| },
| validateBase:function(){
| return vc.validate.validate({
| companyBaseInfo:vc.component.companyBaseInfo
| },{
| 'companyBaseInfo.name':[
| {
| limit:"required",
| param:"",
| errInfo:"公司名不能为空"
| },
| {
| limit:"maxLength",
| param:"100",
| errInfo:"用户名长度必须在100位之内"
| },
| ],
| 'companyBaseInfo.address':[
| {
| limit:"required",
| param:"",
| errInfo:"地址不能为空"
| },
| {
| limit:"maxLength",
| param:"200",
| errInfo:"地址长度必须在200位之内"
| },
| ],
| 'companyBaseInfo.tel':[
| {
| limit:"required",
| param:"",
| errInfo:"手机号不能为空"
| },
| {
| limit:"phone",
| param:"",
| errInfo:"不是有效的手机号"
| }
| ],
| 'companyBaseInfo.storeTypeCd':[
| {
| limit:"required",
| param:"",
| errInfo:"商户类型不能为空"
| }
| ],
| 'companyBaseInfo.nearbyLandmarks':[
| {
| limit:"required",
| param:"",
| errInfo:"附近建筑不能为空"
| },
| {
| limit:"maxLength",
| param:"200",
| errInfo:"地址长度必须在200位之内"
| }
| ],
|
| });
| }
| }
|
| });
|
| })(window.vc);
|
|