Commit 18016f2c by LJM

js

parent cccc9bf5
......@@ -165,6 +165,23 @@ layui.use(['form', 'table', 'laydate'], function () {
},
handleBind: function () {
//国家/地区
$(document).on('change', 'select[name="country"]', function () {
var country_name = $(this).find('option:selected').text();
var type = $(this).attr('data');
if (type == 1) {
//收货信息
layui.form.val('receiveInfo', {
country_name: country_name
})
} else {
//账单邮寄信息
layui.form.val('billingInfo', {
country_name: country_name
})
}
});
//收货信息
layui.form.on('submit(receiveInfoSubmit)', function (data) {
var text = $(data.elem).text();
......@@ -189,6 +206,30 @@ layui.use(['form', 'table', 'laydate'], function () {
return false;
});
//账单邮寄信息
layui.form.on('submit(billingInfoSubmit)', function (data) {
var text = $(data.elem).text();
if (text == '修改') {
$(data.elem).text('保存');
$(data.elem).next().show();
$(data.elem).parent().parent().find('.show').prev().hide();
$(data.elem).parent().parent().find('.show').show();
return false;
} else {
Request('/api/order/editOrderAdress', 'POST', data.field, function (res) {
if (res.code == 0) {
layer.msg('操作成功', {shift: 0, time: 2000}, function () {
layer.closeAll();
window.location.reload();
});
} else {
layer.msg(res.msg);
}
});
}
return false;
});
//结算信息
layui.form.on('submit(settlementInfoSubmit)', function (data) {
var text = $(data.elem).text();
......@@ -230,6 +271,39 @@ layui.use(['form', 'table', 'laydate'], function () {
$("#order_total_amount").empty().text(freight_charge + pay_commission + order_amount);
}, 800))
//同收货地址
layui.form.on('switch(switchChange)', function (data) {
if (data.elem.checked) {
layui.form.val('billingInfo', {
shipping_name: layui.form.val('receiveInfo').shipping_name,
shipping_sn: layui.form.val('receiveInfo').shipping_sn,
consignee: layui.form.val('receiveInfo').consignee,
company_name: layui.form.val('receiveInfo').company_name,
email: layui.form.val('receiveInfo').email,
phone: layui.form.val('receiveInfo').phone,
country: layui.form.val('receiveInfo').country,
province: layui.form.val('receiveInfo').province,
city: layui.form.val('receiveInfo').city,
post_code: layui.form.val('receiveInfo').post_code,
detail_address: layui.form.val('receiveInfo').detail_address
})
} else {
layui.form.val('billingInfo', {
shipping_name: '',
shipping_sn: '',
consignee: '',
company_name: '',
email: '',
phone: '',
country: '',
province: '',
city: '',
post_code: '',
detail_address: ''
})
}
});
return this;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment