order-detail.page.js 1 KB
var cancelOrder = require('./order/cancel-order');
var editOrder = require('./order/edit-order');


function reload() {
    location.reload();
}

$('.order .cancel-btn').on('click', function() {
    var $this = $(this);
    var code = $this.closest('.order').data('code');

    cancelOrder.start(code, reload);
});

$('.order .edit-btn').on('click', function() {
    var $this = $(this);
    var $userInfo = $('.user-info.info-box');
    var code = $this.closest('.order').data('code');

    var areaCode = $userInfo.data('area');
    var userName = $userInfo.find('.user-name-sel').data('name');
    var address = $userInfo.find('.user-addr-sel').data('address');
    var mobile = $userInfo.find('.user-mo-sel').data('mobile');
    var phone = $userInfo.find('.user-ph-sel').data('phone');

    editOrder.start({
        data: {
            orderCode: code,
            userName: userName,
            address: address,
            mobile: mobile,
            phone: phone,
            areaCode: areaCode
        }
    });
});