enter_view.html
13.4 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<!DOCTYPE html>
<html lang="en">
{include file="public/head"/}
<link rel="stylesheet" href="__CDN__/assets/advertising/css/entry.css">
<style>
body,
html {
background-color: #f9f9f9;
}
.images{
width: 1.6rem;
height: 1.6rem;
float: left;
padding-left:0.1rem;
position: relative;
margin-bottom: 0.2rem;
}
.images img{
width: 100%;
height: 100%;
}
.close_img{
position: absolute;
top: -0.15rem;
right: -0.05rem;
width: 0.3rem;
height: 0.3rem;
}
.ban{
background-color: #BDC4CE !important;
pointer-events: none;
}
.hint{
width: 100%;
font-size: 0.28rem;
/*position: fixed;*/
top: 0;
background: #FB7B19;
color: #ffffff;
}
.hint div{
padding: 0.1rem;
}
</style>
<body>
<div class="submit_entry">
{if condition='$data.status eq 3 && $data.expiration_time > time()'}
<div class="hint">
<div>
温馨提示:您的申请审核失败,请于{:date('Y-m-d H:i',$data['expiration_time'])}之后再次提交申请!
</div>
</div>
{/if}
<div class="submit_table">
<div class="submit_single align_center layout flex_row">
<div class="submit_title">商家名称<i>*</i></div>
<input type="text" id="merchant_title" value="{$data.merchant_title}" placeholder="请填写商家名称">
</div>
<div class="submit_single align_center layout flex_row">
<div class="submit_title">联系人<i>*</i></div>
<input type="text" id="merchant_name" value="{$data.merchant_name}" placeholder="请填写联系人姓名">
</div>
<div class="submit_single align_center layout flex_row">
<div class="submit_title">联系电话<i>*</i></div>
<input type="text" id="merchant_mobile" value="{$data.merchant_mobile}" placeholder="请填写联系人电话">
</div>
<div class="submit_single align_center layout flex_row">
<div class="submit_title">地址</div>
<input type="text" id="area" value="{$data.area}" placeholder="请填写所在地址">
</div>
<div class="submit_single layout flex_row">
<div class="submit_title">简介</div>
<textarea name="" id="brief" cols="30" rows="5" placeholder="请填写商家简介">{$data.brief}</textarea>
</div>
<div class="submit_single clearfix">
<div class="submit_title">
营业执照<i>*</i>
</div>
<div class="submit_img ">
<div class="clearfix" id="dom1">
{foreach name="$data.business_images" item="b_i"}
<div class="images">
<img src="{$b_i}" class="images_one"/>
<input type="hidden" class="business_images" value="{$b_i}"/>
<div class="close_img">
<img src="__CDN__/assets/advertising/img/close.png"/>
</div>
</div>
{/foreach}
<div class="submit_img_add upload_one">
<img src="__CDN__/assets/advertising/img/add.png" alt="">
</div>
</div>
<!-- <div class="submited_img">
<img src="" alt="" id="img1">
</div>
<input type="file" id="imgFile" class="submit_img_input" onchange="fileImg(this)"> -->
</div>
</div>
<div class="submit_single layout flex_row">
<div class="submit_title">
其他证件
</div>
<div class="submit_img">
<div class="clearfix" id="dom2">
{foreach name="$data.other_images" item="o_i"}
<div class="images">
<img src="{$o_i}" class="images_two"/>
<input type="hidden" class="other_images" value="{$b_i}"/>
<div class="close_img">
<img src="__CDN__/assets/advertising/img/close.png"/>
</div>
</div>
{/foreach}
<div class="submit_img_add upload_two">
<img src="__CDN__/assets/advertising/img/add.png" alt="">
</div>
</div>
<!-- <input type="file" class="submit_img_input" onchange="fileImgOther"> -->
</div>
</div>
</div>
<div class="btn_box">
<input type="hidden" id="user_id" value="{$user_id}"/>
<div class="btn {if condition='$data.status eq 3 && $data.expiration_time > time()'}ban{/if}">
申请入驻
</div>
</div>
</div>
{include file="public/js" /}
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
$(function(){
var host = "http://"+window.location.host;
wx.config(
{$jssdk}
);
wx.ready(function () {
$('.upload_one').click(function () {
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
$(res.localIds).each(function (key, localId) {
uploadImages(localId,1);
});
}
});
});
$('.upload_two').click(function () {
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
$(res.localIds).each(function (key, localId) {
uploadImages(localId,2);
});
}
});
});
function uploadImages(localId,type) {
wx.uploadImage({
localId: localId,
isShowProgressTips: 1,
success: function (res) {
var serverId = res.serverId; // 返回图片的服务器端ID
$.ajax({
url:"{:url('home/upload/fetImage')}",
type:"GET",
data:{'media':serverId},
success:function(res){
console.log(res);
if(res.code == 1){
if(type == 1){
var html = "<div class=\"images\">\n" +
" <img src=\""+res.data+"\" class=\"images_one\"/>\n" +
" <input type=\"hidden\" class=\"business_images\" value=\""+res.data+"\"/>\n" +
" <div class=\"close_img\">\n" +
" <img src=\"__CDN__/assets/advertising/img/close.png\"/>\n" +
" </div>\n" +
" </div>";
$('#dom1').prepend(html);
}else if(type == 2){
var html = "<div class=\"images\">\n" +
" <img src=\""+res.data+"\" class=\"images_two\"/>\n" +
" <input type=\"hidden\" class=\"other_images\" value=\""+res.data+"\"/>\n" +
" <div class=\"close_img\">\n" +
" <img src=\"__CDN__/assets/advertising/img/close.png\"/>\n" +
" </div>\n" +
" </div>";
$('#dom2').prepend(html);
}
}
},
error:function(res){
toast('与服务器断开连接');
}
})
},
fail: function (res) {
toast(JSON.stringify(res));
}
});
};
$('body').on('click', '.images_one', function () {
var thisUrl = host+$(this).attr('src');
var allUrlLength = $('.images_one').length;
var allUrl = [];
for (var i = 0; i < allUrlLength; i++) {
allUrl.push(host+$('.images_one').eq(i).attr('src'));
}
wx.previewImage({
current: thisUrl,
urls: allUrl
});
});
$('body').on('click', '.images_two', function () {
var thisUrl = host+$(this).attr('src');
var allUrlLength = $('.images_two').length;
var allUrl = [];
for (var i = 0; i < allUrlLength; i++) {
allUrl.push(host+$('.images_two').eq(i).attr('src'));
}
wx.previewImage({
current: thisUrl,
urls: allUrl
});
})
});
//删除
$("body").on('click','.close_img',function(){
$(this).parent(".images").remove();
});
//提交
$('.btn').click(function(){
var user_id = $('#user_id').val();
var merchant_title = $('#merchant_title').val();
var merchant_name = $('#merchant_name').val();
var merchant_mobile = $('#merchant_mobile').val();
var merchant_mobile_regular = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
var area = $('#area').val();
var brief = $('#brief').val();
var business_images = [];
for(var i = 0 ;i < $('.business_images').length ; i++){
business_images.push($('.business_images').eq(i).val());
}
var other_images = [];
for(var i = 0 ;i < $('.other_images').length ; i++){
other_images.push($('.other_images').eq(i).val());
}
if(merchant_title == ''){
toast('请输入商家名称');
return false;
}else if(merchant_name == ''){
toast('请输入联系人');
return false;
}else if(merchant_mobile == ''){
toast('请输入联系电话');
return false;
}else if(!merchant_mobile_regular.test(merchant_mobile)){
toast('请输入正确联系电话');
return false;
}else if(business_images.length == 0){
toast('请上传营业执照');
return false;
}
$.ajax({
url:"{:url('merchant_enter_submit')}",
type:"POST",
data:{'user_id':user_id,'merchant_title':merchant_title,'merchant_name':merchant_name,'merchant_mobile':merchant_mobile,'business_images':business_images,'other_images':other_images,'area':area,'brief':brief},
success:function(res){
if(res.code == 1){
toast("提交成功");
setTimeout(function(){
window.location.href = '';
},2000)
}else{
toast(res.msg);
}
},
error:function(res){
toast("与服务器断开连接");
}
})
})
})
</script>
</body>
</html>