Blame view

public/js/cart/select-address.page.js 1.18 KB
陈轩 authored
1 2 3 4 5
/**
 * 购物车 地址选择
 * @author: bikai<kai.bi@yoho.cn>
 * @date: 2015/12/14
 */
陈峰 authored
6 7
require('cart/select-address.page.css');
let $ = require('yoho-jquery'),
陈轩 authored
8 9
    orderInfo = require('./order-info').orderInfo;
陈峰 authored
10
let $confim = $('.confim-mask'),
陈轩 authored
11 12
    deleteId;
郭成尧 authored
13
require('./address/address');
14
require('common');
陈轩 authored
15 16

$('.address-item').on('click', function() {
陈峰 authored
17 18 19
    let $this = $(this);
    let addressId = decodeURIComponent($this.data('address-id'));
    let address = {
陈轩 authored
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
        address_id: addressId,
        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('click', '.edit', function() {
    window.location.href = $(this).data('href');
    return false;
}).on('click', '.del', function() {
    deleteId = $(this).data('id');
});

$confim.on('click', '.confim', function() {
    if (orderInfo('addressId') === deleteId) {
        orderInfo('addressId', null);
        orderInfo('address', null);
    }
});