bond.html
20.8 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
{php define('MUI', true);}
{template 'common/header'}
{if $do == 'mobile'}
{if $op == 'index'}
<div class="mui-content mc-tel-bonded">
<div class="mui-text-center">
<img src="{$_W['siteroot']}app/resource/images/bonded-tel.png">
<div class="mui-b">你的手机号:{$profile['mobile']}</div>
</div>
<div class="mui-content-padded">
<a class="mui-btn mui-btn-success mui-btn-block" href="{php echo url('mc/bond/mobile', array('op' => 'mobilechange'))}">更换手机号</a>
</div>
</div>
{/if}
{if $op == 'mobilechange'}
<div class="mui-content">
<div class="sendcode">
<div class="mui-content-padded mui-text-muted">请输入手机号,以收取验证码</div>
<div class="mui-input-group mui-mt15">
<div class="mui-input-row">
<label class="mui-label-icon"><i class="fa fa-user"></i></label>
<input name="mobile" type="text" class="js-mobile-val" value="" placeholder="手机号"/>
</div>
</div>
<div class="mui-content-padded mui-text-center">
<button class="mui-btn mui-btn-success mui-btn-block js-check-mobile" uniacid="{$_W['uniacid']}">获取验证码</button>
</div>
</div>
<div style="display:none;" class="codeverify">
<div class="mui-content-padded mui-text-muted">您的手机号<span class="mui-text-success js-code"></span>会收到一条含有6位数字验证码的短息</div>
<div class="mui-input-group mui-mt15">
<div class="mui-input-row">
<label class="mui-label-icon"><i class="fa fa-key"></i></label>
<input name="code" type="text" placeholder="验证码"/>
</div>
{if !empty($reregister)}
<div class="mui-input-row">
<label class="mui-label-icon"><i class="fa fa-lock"></i></label>
<input type="password" value="" name="password" placeholder="请输入您的新密码"/>
</div>
<div class="mui-input-row">
<label class="mui-label-icon"><i class="fa fa-lock"></i></label>
<input type="password" value="" name="repassword" placeholder="请再次输入您的新密码"/>
</div>
{/if}
</div>
<div class="mui-content-padded mui-text-center">
<button class="mui-btn mui-btn-success mui-btn-block js-bond">确认</button>
<div class="mui-mt15 mui-text-center">
<span class="mui-text-muted js-timer">
</span>
</div>
</div>
</div>
</div>
<script>
$(function(){
$(document).on('input propertychange', '.js-mobile-val', function(){
var mobile_value = $(this).val();
if (mobile_value.length == '11') {
$.post("{php echo url('auth/login/mobile_exist')}", {'mobile' : mobile_value}, function(data) {
data = $.parseJSON(data);
if (data.message.errno == '1') {
$('.js-check-mobile').removeClass('send-code');
util.toast('手机号已被绑定', '', 'error');
return;
} else if (data.message.errno == '2'){
$('.js-check-mobile').addClass('send-code');
}
});
} else {
$('.js-check-mobile').removeClass('send-code');
}
});
$(document).on('click', '.send-code', function(){
var username = $('input[name=mobile]').val();
var oldmobile = '{$_W['member']['mobile']}';
if (username == oldmobile) {
util.toast('无法更改为当前手机号', '', 'error');
return;
}
$('.js-code').text(username);
option = {
'btnElement' : $('.send-code'),
'showElement' : $('.js-timer'),
'btnTips' : '<a class="send-code">重新获取验证码</a>',
'successCallback' : function(ret, message){
if (ret == '0') {
util.toast(message);
$('.sendcode').hide();
$('.codeverify').show();
} else {
util.toast(message);
$('.sendcode').show();
$('.codeverify').hide();
return;
}
}
};
util.sendCode(username, option);
});
$('.js-bond').click(function() {
var code = $('.codeverify input[name="code"]').val();
var mobile = $('.sendcode input[name="mobile"]').val();
var password = $('.codeverify input[name="password"]').val();
var repassword = $('.codeverify input[name="repassword"]').val();
if (!code) {
util.toast('请填写验证码', '', 'error');
return;
}
if (!mobile) {
util.toast('请填写手机号', '', 'error');
return;
}
if(!/^1[3|4|5|7|8][0-9]{9}$/.test(mobile)) {
util.toast('手机格式错误', '', 'error');
return;
}
{if !empty($reregister)}
if (!password || !repassword) {
util.toast('请填写密码', '', 'error');
return;
}
if (password !== repassword) {
util.toast('密码不一致', '', 'error');
return;
}
{/if}
$.post('{php echo url("mc/bond/mobile")}', {'code' : code, 'mobile' : mobile, 'password' : password, 'repassword' : repassword}, function(data) {
data = $.parseJSON(data);
if (data.message.errno == '-1') {
util.toast(data.message.message, '', 'error');
} else if (data.message.errno == '0') {
util.toast(data.message.message, data.redirect, 'success');
}
})
})
});
</script>
{/if}
{/if}
{if $do == 'settings'}
<div class="mui-content">
<ul class="mui-table-view mui-table-view-chevron">
{if empty($profile_hide)}
<li class="mui-table-view-cell">
<a href="{php echo url('mc/profile') . 'wxref=mp.weixin.qq.com#wechat_redirect'}" class="mui-navigate-right">个人资料</a>
</li>
{/if}
<li class="mui-table-view-cell">
<a href="{php echo url('mc/profile/address') . 'wxref=mp.weixin.qq.com#wechat_redirect'}" class="mui-navigate-right">
收货地址
<span class="mui-pull-right">管理</span>
</a>
</li>
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/pay_password') . 'wxref=mp.weixin.qq.com#wechat_redirect'}" class="mui-navigate-right">
支付密码
<span class="mui-pull-right">设置</span>
</a>
</li>
</ul>
<ul class="mui-table-view mui-table-view-chevron">
{if !empty($reregister)}
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/binding_account', array('type' => '1'))}" class="mui-navigate-right">
完善账号
</a>
</li>
{else}
{if $item !== 'mobile'}
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/email')}" class="mui-navigate-right">
邮箱
<span class="mui-pull-right"><span class="mui-mr10">{if !empty($reregister)}请绑定邮箱{else}{$_W['member']['email']}{/if}</span></span>
</a>
</li>
{/if}
{if $item !== 'email'}
<li class="mui-table-view-cell">
{if empty($_W['member']['mobile'])}
<a href="{php echo url('mc/bond/mobile', array('op' =>'mobilechange'))}" class="mui-navigate-right">
{else}
<a href="{php echo url('mc/bond/mobile', array('op' =>'index'))}" class="mui-navigate-right">
{/if}
手机号
<span class="mui-pull-right"><span class="mui-mr10">{if empty($_W['member']['mobile'])}请绑定手机号{else}{$_W['member']['mobile']}{/if}</span></span>
</a>
</li>
{/if}
{if empty($reregister) && $ltype != 'code'}
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/password') . 'wxref=mp.weixin.qq.com#wechat_redirect'}" class="mui-navigate-right">密码设置</a>
</li>
{/if}
{/if}
</ul>
<ul class="mui-table-view mui-table-view-chevron">
{if !empty($_W['setting']['copyright']['companyprofile'])}
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/aboutus') . 'wxref=mp.weixin.qq.com#wechat_redirect'}" class="mui-navigate-right">关于我们</a>
</li>
{/if}
<li class="mui-table-view-cell">
<a href="tel:{$ucpage['params'][0]['params']['contact']}" class="mui-navigate-right" id='contact-us'>联系我们</a>
</li>
</ul>
<div class="mui-content-padded">
<a href="{php echo url('mc/home/login_out');}" class="mui-btn mui-btn-block mui-btn-outlined mui-btn-danger">退出登录</a>
</div>
</div>
{/if}
{if $do == 'aboutus'}
<div class="mui-content mc-about-us">
<div class="mui-text-center logo"><img src="{if tomedia('headimg_'.$_W['acid'].'.jpg')}{php echo tomedia('headimg_'.$_W['acid'].'.jpg');}{else}resource/images/MicroEngine.ico{/if}" class="mui-img-circle"/></div>
<div class="mui-content-padded desc">
{$_W['setting']['copyright']['companyprofile']}
</div>
</div>
{/if}
{if $do == 'email'}
<form class="tab-content clearfix js-ajax-form {if $_W['container'] !== 'wechat'}profile-form{/if}" action="{url 'mc/bond/email'}" method="post" enctype="multipart/form-data">
<div class="mui-content mc-email">
<div class="mui-control-content mui-active" id="email">
<div class="tips mui-content-padded">
您可以使用邮箱作为登录账号,绑定成功后暂不支持修改。
</div>
<div class="mui-input-group mui-mt15">
{if empty($reregister) && !empty($_W['member']['email'])}
<div class="mui-input-row">
<label>邮箱</label>
<input type="text" name="email" value="{$_W['member']['email']}" disabled />
</div>
{else}
<div class="mui-input-row">
<label>邮箱</label>
<input type="text" name="email" value="" placeholder="请输入邮箱" />
</div>
{/if}
</div>
</div>
<div class="mui-content-padded">
{if !empty($reregister) || (empty($reregister) && empty($_W['member']['email']))}
<input type="hidden" name="token" value="{$_W['token']}">
<input type="hidden" id="type" name="type" value="{$type}" />
<button class="mui-btn mui-btn-success mui-btn-block" type="submit" name="submit" value="立刻绑定">立即绑定</button>
{else}
<a class="mui-btn mui-btn-block" href="javascript:history.back(-1);">返回</a>
{/if}
</div>
</div>
</form>
{/if}
{if $do == 'password'}
<form class="tab-content clearfix js-ajax-form {if $_W['container'] !== 'wechat'}profile-form{/if}" action="{url 'mc/bond/password'}" method="post" enctype="multipart/form-data">
<div class="mui-content">
<div class="mui-content-padded mui-text-muted">请设置密码</div>
<div class="mui-input-group mui-mt15">
{if empty($reregister) && !empty($profile['password'])}
<div class="mui-input-row">
<label>旧密码</label>
<input type="password" value="" name="oldpassword" placeholder="请输入您的旧密码"/>
</div>
{/if}
<div class="mui-input-row">
<label>新密码</label>
<input type="password" value="" name="password" placeholder="请输入您的新密码"/>
</div>
<div class="mui-input-row">
<label class="mui-ellipsis">重复新密码</label>
<input type="password" value="" name="repassword" placeholder="请再次输入您的新密码"/>
</div>
</div>
<div class="mui-content-padded">
<input type="hidden" name="token" value="{$_W['token']}">
<button class="mui-btn mui-btn-success mui-btn-block" type="submit" name="submit" value="确定">确定</button>
</div>
</div>
</form>
{/if}
{if $do == 'credits'}
{if $_GPC['type'] == 'record'}
<header class="mui-bar mui-bar-nav">
{if $_W['container'] !== 'wechat'}
<div class="mui-row fixed-bar">
<div class="mui-col-xs-4">
<button class="mui-btn mui-btn-link mui-btn-nav mui-pull-left mui-action-back">
<span class="mui-icon mui-icon-left-nav"></span>
返回
</button>
</div>
<div class="mui-col-xs-4 mui-text-center">{if !empty($title)}{$title}{elseif !empty($_W['page']['title'])}{$_W['page']['title']}{/if}</div>
<div class="mui-col-xs-4 mui-text-right">
<a href="#consume-date">
<span>{if $_GPC['period'] <= 0}{php echo date('Y.m', strtotime($_GPC['period'] . 'month'))}{else}查看全部{/if}</span>
<span class="fa fa-angle-down mui-text-muted"></span>
</a>
</div>
</div>
{else}
<div class="mui-row fixed-bar">
<div class="mui-col-xs-6"></div>
<div class="mui-col-xs-6 mui-text-right">
<a href="#consume-date">
<span>{if $_GPC['period'] <= 0}{php echo date('Y.m', strtotime($_GPC['period'] . 'month'))}{else}查看全部{/if}</span>
<span class="fa fa-angle-down mui-text-muted"></span>
</a>
</div>
</div>
{/if}
</header>
<div id="consume-date" class="mui-popover mui-popover-top">
<ul class="mui-table-view">
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/credits', array('credittype' => $_GPC['credittype'], 'type' => 'record', 'period' => '1'))}">查看全部</a>
</li>
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/credits', array('credittype' => $_GPC['credittype'], 'type' => 'record', 'period' => '0'))}">{php echo date('Y.m', strtotime('today'))}</a>
</li>
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/credits', array('credittype' => $_GPC['credittype'], 'type' => 'record', 'period' => '-1'))}">{php echo date('Y.m', strtotime('-1month'))}</a>
</li>
<li class="mui-table-view-cell">
<a href="{php echo url('mc/bond/credits', array('credittype' => $_GPC['credittype'], 'type' => 'record', 'period' => '-2'))}">{php echo date('Y.m', strtotime('-2month'))}</a>
</li>
</ul>
</div>
<div class="mui-content">
<div class="mui-table mui-table-inline mui-pa10">
<div class="mui-table-cell">
<div class="mui-text-muted ">充值</div>{$income}{if $_GPC['credittype'] == 'credit2'}元{else}积分{/if}
</div>
<div class="mui-table-cell">
<div class="mui-text-muted">消费</div>{$pay}{if $_GPC['credittype'] == 'credit2'}元{else}积分{/if}
</div>
</div>
<div class="credits-display">
<ul class="mui-table-view mui-credits">
{loop $data $row}
<li class="mui-table-view-cell">
<a href="{php echo murl('mc/bond/credits', array('type' => recorddetail, 'id' => $row['id'], 'credittype' => $_GPC['credittype']), true)}">
<div class="mui-row">
<div class="mui-col-xs-6 mui-ellipsis-2">
{$row['remark']}
</div>
<div class="mui-col-xs-6 mui-text-right">
<span class="mui-big {if $_GPC['credittype'] == 'credit2'}mui-rmb{/if}" style="color:{php echo $row['color']}">
<span class="money" style="color:{php echo $row['color']}">{$row['num']}</span>
</span>
<span class="mui-block mui-text-muted mui-small">{$row['createtime']}</span>
</div>
</div>
</a>
</li>
{/loop}
</ul>
</div>
</div>
{/if}
{if $_GPC['type'] == 'recorddetail'}
<div class="mui-bg-white mc-record-detail">
<div class="mui-bb1 mui-row sum">
<div class="mui-col-xs-6 mui-text-muted">
付款金额
</div>
<div class="mui-col-xs-6 mui-text-right">
<span class="mui-big {if $_GPC['credittype'] == 'credit2'}mui-rmb{/if}" style="color:{php echo $row['color']}">
<span class="money" style="color:{php echo $row['color']}">{$data['num']}</span>
</span>
</div>
</div>
<div class="detail-info">
<div class="mui-row">
<div class="mui-col-xs-6 mui-text-muted">
操作人
</div>
<div class="mui-col-xs-6 mui-text-right mui-ellipsis">
{if $data['username']}{$data['username']}{else}本人{/if}
</div>
</div>
<div class="mui-row">
<div class="mui-col-xs-6 mui-text-muted">
数量
</div>
<div class="mui-col-xs-6 mui-text-right mui-ellipsis">
{$data['num']}
</div>
</div>
<div class="mui-row">
<div class="mui-col-xs-6 mui-text-muted">
当前状态
</div>
<div class="mui-col-xs-6 mui-text-right mui-ellipsis">
交易成功
</div>
</div>
<div class="mui-row">
<div class="mui-col-xs-6 mui-text-muted">
时间
</div>
<div class="mui-col-xs-6 mui-text-right mui-ellipsis">
{php echo date('Y-m-d H:i:s', $data['createtime'])}
</div>
</div>
<div class="mui-row">
<div class="mui-col-xs-6 mui-text-muted">
备注
</div>
<div class="mui-col-xs-6 mui-text-right">
{$data['remark']}
</div>
</div>
</div>
</div>
{/if}
<script>
require(['mui.pullrefresh'], function(mui) {
mui.init();
mui.ready(function() {
var page = 2;
var pagetotal = {$pagenums} + 1;
if (page < pagetotal) {
//循环初始化所有下拉刷新,上拉加载。
mui.each(document.querySelectorAll('.credits-display'), function(index, pullRefreshEl) {
mui(pullRefreshEl).pullToRefresh({
up: {
callback: function() {
var self = this;
setTimeout(function() {
$('.mui-pull-bottom-tips').hide();
var ul = self.element.querySelector('.mui-credits');
ul.appendChild(createFragment(ul, index, 5));
if (pagetotal <= page) {
$('.mui-pull-bottom-tips').hide();
self.endPullUpToRefresh(true);
} else {
self.endPullUpToRefresh(false);
}
}, 1000);
}
}
});
});
var createFragment = function(ul, index, count, reverse) {
var length = ul.querySelectorAll('li').length;
var fragment = document.createDocumentFragment();
var li;
var url = "{php echo url('mc/bond/credits', array('credittype' => $_GPC['credittype'], 'type' => $_GPC['type'], 'period' => $_GPC['period']), true)}";
mui.post(url, {'page' : page}, function(data){
data = $.parseJSON(data);
if (data.state == 'error') {
return false;
}
for (var i in data) {
var href = "{php echo url('mc/bond/credits', array('type' => 'recorddetail', 'credittype' => $_GPC['credittype']),true)}";
li = document.createElement('li');
li.className = 'mui-table-view-cell';
li.innerHTML = '<a href="' + href + '&id=' + data[i].id + '" ><div class="mui-row"><div class="mui-col-xs-6 mui-ellipsis-2">' + data[i].remark + '</div><div class="mui-col-xs-6 mui-text-right"><span class="mui-big mui-rmb" style="color:' + data[i].color + '"><span class="money" style="color:' + data[i].color + '">' + data[i].num + '</span></span><span class="mui-block mui-text-muted mui-small">' + data[i].createtime + '</span></div></div></a>';
ul.appendChild(li, ul.firstChild);
}
$('.mui-pull-bottom-tips').show();
});
page++;
return fragment;
};
}
});
});
</script>
{/if}
{if $do == 'binding_account'}
<form class="tab-content clearfix js-ajax-form {if $_W['container'] !== 'wechat'}profile-form{/if}" action="{url 'mc/bond/binding_account'}" method="post" enctype="multipart/form-data">
<div class="mui-content mc-email">
<div class="mui-control-content mui-active" id="email">
<div class="tips mui-content-padded">
您可以使用邮箱或手机作为登录账号。
</div>
<div class="mui-input-group mui-mt15">
{if $type == '1'}
<div class="mui-input-row">
<label>账号</label>
<input type="text" name="username" value="" placeholder="请输入{if $item == 'email'}邮箱{elseif $item == 'mobile'}手机号{else}邮箱或手机号{/if}" />
</div>
{else}
<div class="mui-input-row">
<label>已有邮箱</label>
<input type="text" name="username" value="" placeholder="请输入已有邮箱" />
</div>
{/if}
<div class="mui-input-row">
<label>登录密码</label>
<input type="password" name="password" value="" placeholder="请输入{if $type != '1'}已有邮箱{/if}登录密码"/>
</div>
</div>
</div>
<div class="mui-content-padded">
<div class="mui-text-center mui-mt15 mui-mb10">
{if !empty($reregister) || (empty($reregister) && empty($_W['member']['email']))}
{if $_GPC['type'] == 1}
<a href="{php echo url('mc/bond/binding_account', array('type' => '0'))}">绑定已有账号</a>
{else}
<a href="{php echo url('mc/bond/binding_account', array('type' => '1'))}">绑定新账号</a>
{/if}
{/if}
</div>
{if !empty($reregister) || (empty($reregister) && empty($_W['member']['email']))}
<input type="hidden" name="token" value="{$_W['token']}">
<input type="hidden" id="type" name="type" value="{$type}" />
<button class="mui-btn mui-btn-success mui-btn-block" type="submit" name="submit" value="立刻绑定">立即绑定</button>
{else}
<a class="mui-btn mui-btn-block" href="javascript:history.back(-1);">返回</a>
{/if}
</div>
</div>
</form>
{/if}
{if $do == 'pay_password'}
<form class="tab-content clearfix js-ajax-form {if $_W['container'] !== 'wechat'}profile-form{/if}" action="{url 'mc/bond/pay_password'}" method="post" enctype="multipart/form-data">
<div class="mui-content mc-email">
<div class="mui-control-content mui-active">
<div class="mui-input-group mui-mt15">
<div class="mui-input-row">
<label>开启支付密码</label>
<input type="checkbox" name="pay_password_open" onclick="change()" {if !empty($pay_password)}checked{/if}/>
</div>
</div>
<div class="mui-input-group mui-mt15" id="pay_password">
<div class="mui-input-row">
<label>支付密码</label>
<input type="password" name="pay_password" value="" placeholder="请输入密码" />
</div>
<div class="mui-input-row">
<label>确认支付密码</label>
<input type="password" name="repeat_pay_password" value="" placeholder="请确认密码"/>
</div>
</div>
</div>
<div class="mui-content-padded">
<button class="mui-btn mui-btn-block" type="submit">确定</button>
</div>
</div>
</form>
<script>
$('#pay_password').hide();
var change = function() {
open = $('[name="pay_password_open"]').prop('checked');
if (open === true) {
$('#pay_password').show();
} else {
$('#pay_password').hide();
}
};
</script>
{/if}
{template 'common/footer'}