select-address.js
1.31 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
/**
* 购物车 地址选择
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/12/14
*/
var $ = require('jquery'),
orderInfo = require('./order-info').orderInfo;
var $confim = $('.confim-mask'),
deleteId;
require('../common');
$('.address-item').on('touchend', function() {
var $this = $(this);
var addressId = $this.data('address-id');
var address = {
address_id: $this.data('address-id'),
consignee: $this.find('.name').text(),
mobile: $this.find('.tel').text(),
address_info: $this.find('.address-info').text(),
is_support: $this.data('is-support')
};
orderInfo('addressId', addressId);
orderInfo('address', address);
window.location.href = $this.data('href') + (orderInfo('limitUrlSufix') || '');
}).on('touchend', '.edit', function() {
window.location.href = $(this).data('href');
return false;
}).on('touchstart', '.del', function() {
deleteId = $(this).data('id');
});
$confim.on('touchend', '.confim', function() {
if (orderInfo('addressId') === deleteId) {
orderInfo('addressId', null);
orderInfo('address', null);
}
});
function phoneHidden(phone) {
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
}
$('.tel').each(function(index) {
$('.tel').eq(index).html(phoneHidden($('.tel').html()));
});