applayruzhu.vue
3.7 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<template>
<view class="content">
<view class="writebox commnonpadding">
<view class="companyitem flextwo">
<view class="companyitemleft">姓名</view>
<view class="cright">
<input type="text" placeholder="请填写姓名" placeholder-class="entercom" @input="entername"/>
</view>
</view>
<view class="companyitem flextwo">
<view class="companyitemleft">省份</view>
<view class="cright">
<picker @change="bindproChange" :value="index" :range="provincelist" range-key="name">
<view class="entercom">{{provincename}}</view>
</picker>
</view>
</view>
<view class="companyitem flextwo">
<view class="companyitemleft">联系电话</view>
<view class="cright">
<input type="number" placeholder="请填写联系电话" placeholder-class="entercom" @input="enterphone" />
</view>
</view>
<view class="huiyuanbot boxsizing shenhe">
<view class="behuiyuanbtn" @click="submitshen">提交</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data() {
return {
atten:false,
provincename:'请选择省份',
index:0,
provincelist:[],
province_id:'',
name:'',
phone:''
}
},
onLoad() {
this.getprolist()
},
methods: {
enterword(e){
let name=e.currentTarget.dataset.name;
console.log(name);
this.obj[name]=e.detail.value;
},
// 获取省份
getprolist(){
let that = this;
var url = 'forum/get_province';
var params = {
is_forum_hot: ''
}
console.log('7766554', params)
app.post(url, params).then((res) => {
console.log(res);
that.provincelist = res.data.data;
}).catch((err) => {
})
},
bindproChange: function(e) {
this.index = e.target.value;
this.provincename=this.provincelist[e.target.value].name;
this.province_id=this.provincelist[e.target.value].id
},
//填写姓名
entername(e){
this.name=e.detail.value
},
// 填写手机号
enterphone(e){
this.phone=e.detail.value
},
// 提交审核
submitshen(){
let that = this;
if(that.name==''){
uni.showToast({
title:"请填写姓名",
icon:"none"
})
return false
}
if(that.province_id==''){
uni.showToast({
title:'请选择省份',
icon:'none'
})
return false
}
if(that.phone==''){
uni.showToast({
title:"请填写手机号",
icon:"none"
})
return false
}
if(that.phone!=''){
if (!(/^1[3456789]\d{9}$/.test(that.phone))) {
wx.showToast({
title: '请输入正确手机号',
icon: 'none'
})
return false;
}
}
var url = 'enter/apply_enter';
var params = {
name:that.name,
mobile:that.phone,
province_id:that.province_id
}
console.log('7766554', params)
app.post(url, params).then((res) => {
uni.showToast({
title:"提交成功",
icon:"none"
})
setTimeout(function(){
uni.navigateBack({
checked:true
})
},1500)
console.log(res);
}).catch((err) => {
console.log(err)
uni.showToast({
title:err.msg,
icon:'none'
})
})
},
}
}
</script>
<style>
@import url('../../base/usercenter');
page {
background: #F9F9FB;
}
.huiyuanbot{
position: fixed;
bottom:0;
left:0;
}
.writebox {
background: #fff;
}
</style>