merge master into develop - CscListRForm.jsp FAQ 아코디언 버그 수정
This commit is contained in:
399
build/resources/main/static/mngr/js/crm/dlvylc/dlvylc.js
Normal file
399
build/resources/main/static/mngr/js/crm/dlvylc/dlvylc.js
Normal file
@@ -0,0 +1,399 @@
|
||||
/**********************************************
|
||||
자주쓰는 배송지 조회 페이징
|
||||
***********************************************/
|
||||
const fn_select_rpuseDlvylcList = function (pageIndex) {
|
||||
let pageUnit = $("#rpuseSelect").val();
|
||||
if (pageUnit === 'undefined') {
|
||||
pageUnit = 10;
|
||||
}
|
||||
if (pageIndex === 'undefined') {
|
||||
pageIndex = $("#rpusePageIndex").val();
|
||||
}
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/crm/dlvylc/selectRpuseDlvylcListInqire',
|
||||
data: {
|
||||
mbrInnb: $("#leftMbrInnb").val(),
|
||||
mbrDvCd: $("#leftMbrDvCd").val(),
|
||||
pageIndex: pageIndex,
|
||||
pageUnit: pageUnit
|
||||
},
|
||||
success: function (data) {
|
||||
$('#rpuseDlvylcContent').html(data);
|
||||
$('#resentDlvylcContent').empty();
|
||||
$("#rpuseDlvylcBtn").addClass("current");
|
||||
$("#rpuseDlvylcContent").addClass("current");
|
||||
$("#rpuseSelect").niceSelect()
|
||||
$(".mbtlnb").each(function () {
|
||||
let mbtlnb = $(this).text().replace(/\s+/g, '');
|
||||
mbtlnb = fn_format_mbtlnb(mbtlnb);
|
||||
$(this).text(mbtlnb);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**********************************************
|
||||
최근 배송지 조회 페이징
|
||||
***********************************************/
|
||||
const fn_select_recentDlvylcList = function (pageIndex, ordering) {
|
||||
if (ordering == undefined) {
|
||||
ordering = 'recentRegist';
|
||||
}
|
||||
let pageUnit = $("#recentId").val();
|
||||
if (pageUnit === 'undefined') {
|
||||
pageUnit = 10;
|
||||
}
|
||||
if (pageIndex === 'undefined') {
|
||||
pageIndex = $("#recentPageIndex").val();
|
||||
}
|
||||
const selectForm = $("#resentDlvylcForm").serialize();
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/crm/dlvylc/selectRecentDlvylcListInqire',
|
||||
data: {
|
||||
selectForm,
|
||||
pageIndex: pageIndex,
|
||||
ordering: ordering,
|
||||
pageUnit: pageUnit,
|
||||
mbrInnb: $("#leftMbrInnb").val(),
|
||||
mbrDvCd: $("#leftMbrDvCd").val()
|
||||
},
|
||||
success: function (data) {
|
||||
$('#resentDlvylcContent').html(data);
|
||||
$('#rpuseDlvylcContent').empty();
|
||||
$("#resentDlvylcBtn").addClass("current");
|
||||
$("#resentDlvylcContent").addClass("current");
|
||||
if ($(".select-box > select").length > 0) {
|
||||
$(".select-box > select").niceSelect();
|
||||
}
|
||||
$(".recentMbtlnb").each(function () {
|
||||
$(this).text(fn_format_mbtlnb($(this).text()));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**********************************************
|
||||
배송지 관리 팝업 (처음 호출 할 때)
|
||||
***********************************************/
|
||||
const fn_move_dlvylc_manage_pop = function (pageIndex, mbrInnb, mbrDvCd, callback) {
|
||||
if (mbrInnb == undefined) {
|
||||
mbrInnb = $("#dlvyLcMbr").val();
|
||||
}
|
||||
if (callback == undefined) {
|
||||
callback = fn_set_dlvylc;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/crm/dlvylc/selectRpuseDlvylcListInqire',
|
||||
data: {
|
||||
isPop: 'Y',
|
||||
pageIndex: pageIndex,
|
||||
mbrInnb: mbrInnb,
|
||||
mbrDvCd: mbrDvCd,
|
||||
callbackNm: callback
|
||||
},
|
||||
success: function (data) {
|
||||
fn_close_modal('dlvylcManage');
|
||||
$('#modalDiv').html(data);
|
||||
$('#dlvylcManage').modal();
|
||||
$(".mbtlnb").each(function () {
|
||||
let mbtlnb = $(this).text().replace(/\s+/g, '');
|
||||
mbtlnb = fn_format_mbtlnb(mbtlnb);
|
||||
$(this).text(mbtlnb);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**********************************************
|
||||
배송지 등록 팝업 호출 ok
|
||||
***********************************************/
|
||||
const fn_move_dlvylc_regpage_pop = function (isPop, mbrInnb, mbrDvCd, dftDlvylcAt) {
|
||||
$("#dlvylcUpdate").remove();
|
||||
if (!mbrInnb) {
|
||||
mbrInnb = $("#leftMbrInnb").val();
|
||||
}
|
||||
if (!mbrDvCd) {
|
||||
mbrDvCd = $("#leftMbrDvCd").val();
|
||||
}
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/crm/dlvylc/selectDlvylcRegistForm',
|
||||
data: {
|
||||
mbrInnb: mbrInnb,
|
||||
mbrDvCd: mbrDvCd
|
||||
},
|
||||
success: function (data) {
|
||||
$('#dlvylcUpdate').remove();
|
||||
$('#dlvylcRegist').remove();
|
||||
$('#modalDiv').html(data);
|
||||
$('#isPop').val(isPop);
|
||||
$('#dlvylcRegist').modal();
|
||||
if (dftDlvylcAt == 'Y') {
|
||||
$('#dftDlvylcAt').prop("checked", true);
|
||||
}
|
||||
fn_set_event('.telno', 'keyup', fn_fmt_telno);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**********************************************
|
||||
배송지 등록 ok
|
||||
***********************************************/
|
||||
const fn_insert_dlvylc = function (mbrInnb, mbrDvCd, msg, data) {
|
||||
$("#dlvylcUpdate").remove();
|
||||
let paramData = null;
|
||||
const registForm = $("#dlvylcRegistForm").serialize();
|
||||
if (data != null) {
|
||||
paramData = data;
|
||||
} else {
|
||||
paramData = registForm;
|
||||
}
|
||||
if (confirm('자주쓰는 배송지를 등록하시겠습니까?')) {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/crm/dlvylc/insertDlvylcRegist',
|
||||
data: paramData,
|
||||
success: function () {
|
||||
alert(msg);
|
||||
fn_close_modal('dlvylcRegist');
|
||||
if ($("#isPop").val() == 'Y') {
|
||||
fn_move_dlvylc_manage_pop(1, mbrInnb, mbrDvCd, 'fn_set_dlvylc');
|
||||
} else {
|
||||
fn_select_rpuseDlvylcList(1);
|
||||
//최근 배송지 form, 버튼 활성화 삭제
|
||||
$('#resentDlvylcForm').remove();
|
||||
$("#resentDlvylcBtn").removeClass("active");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**********************************************
|
||||
최근 배송지 자주쓰는 배송지로 등록
|
||||
***********************************************/
|
||||
const fn_move_repuseDlvylc = function (msg,target) {
|
||||
const trTarget = $(target).closest("tr");
|
||||
const data = {
|
||||
recpntNm: trTarget.find('input[name=recpntNm]').val(),
|
||||
mbrInnb: trTarget.find('input[name=recentMbrInnb]').val(),
|
||||
mbrDvCd: trTarget.find('input[name=recentMbrDvCd]').val(),
|
||||
zip: trTarget.find('input[name=dlvylcZip]').val(),
|
||||
adres: trTarget.find('input[name=adres]').val(),
|
||||
dtlAdres: trTarget.find('input[name=dlvylcAdresDtl]').val(),
|
||||
mbtlnb: trTarget.find('input[name=recpntMbtlnb]').val(),
|
||||
adresDv: trTarget.find('input[name=dlvylcAdresDvCd]').val(),
|
||||
dlvylcDcCn: trTarget.find('input[name=dlvylcDcCn]').val(),
|
||||
recentDlvylcAt: trTarget.find('input[name=recentDlvylcAt]').val()
|
||||
};
|
||||
fn_insert_dlvylc( trTarget.find('input[name=recentMbrInnb]').val(),trTarget.find('input[name=recentMbrDvCd]').val(), msg, data);
|
||||
}
|
||||
/**********************************************
|
||||
배송지 삭제 OK
|
||||
***********************************************/
|
||||
const fn_delete_dlvylc = function (msg, adbkInnb, isPop, mbrInnb, mbrDvCd) {
|
||||
if (confirm('자주쓰는 배송지를 삭제하시겠습니까?')) {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/crm/dlvylc/deleteDlvylcDel',
|
||||
data: {
|
||||
adbkInnb: adbkInnb
|
||||
, mbrInnb: mbrInnb
|
||||
, mbrDvCd: mbrDvCd
|
||||
},
|
||||
success: function (data) {
|
||||
alert(msg);
|
||||
if (isPop == 'Y') {
|
||||
fn_move_dlvylc_manage_pop(1, mbrInnb, mbrDvCd, fn_set_dlvylc);
|
||||
} else {
|
||||
fn_select_rpuseDlvylcList(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**********************************************
|
||||
배송지 수정 팝업 이동 ok
|
||||
***********************************************/
|
||||
const fn_move_dlvylc_uptpage_pop = function (pageIndex, adbkInnb, isPop, mbrInnb, mbrDvCd) {
|
||||
$("#dlvylcRegist").remove();
|
||||
if (!mbrInnb) {
|
||||
mbrInnb = $("#leftMbrInnb").val();
|
||||
}
|
||||
if (!mbrDvCd) {
|
||||
mbrDvCd = $("#leftMbrDvCd").val();
|
||||
}
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/crm/dlvylc/selectDlvylcUpdtPopupForm',
|
||||
data: {
|
||||
adbkInnb: adbkInnb,
|
||||
pageIndex: pageIndex,
|
||||
mbrInnb: mbrInnb,
|
||||
mbrDvCd: mbrDvCd
|
||||
},
|
||||
success: function (data) {
|
||||
$('#dlvylcRegist').remove();
|
||||
$('#dlvylcUpdate').remove();
|
||||
$('#modalDiv').html(data);
|
||||
$('#isPop').val(isPop);
|
||||
$('#dlvylcUpdate').modal();
|
||||
fn_set_event('.telno', 'keyup', fn_fmt_telno);
|
||||
$(".telno").val(fn_format_mbtlnb($(".telno").val()))
|
||||
}
|
||||
});
|
||||
}
|
||||
/**********************************************
|
||||
배송지 수정 ok
|
||||
***********************************************/
|
||||
const fn_update_dlvylc = function (pageIndex, msg, mbrInnb, mbrDvCd) {
|
||||
const updateForm = $("#dlvylcUpdtForm").serialize();
|
||||
if (confirm('자주쓰는 배송지를 수정하시겠습니까?')) {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/crm/dlvylc/updateDlvylcUpdt',
|
||||
data: updateForm,
|
||||
success: function (data) {
|
||||
alert(msg);
|
||||
fn_close_modal('dlvylcUpdate');
|
||||
if ($("#isPop").val() == 'Y') {
|
||||
fn_move_dlvylc_manage_pop(1, mbrInnb, mbrDvCd, 'fn_set_dlvylc');
|
||||
} else {
|
||||
fn_select_rpuseDlvylcList(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
팝업 배송지 등록 시 도로명, 지번 주소 구분 value값 넣기 ok
|
||||
***********************************************/
|
||||
const fn_select_dlvylc_postcode = function (data) {
|
||||
$('#zip').val(data.postcode);
|
||||
$('#adresDv').val(data.addressType);
|
||||
if (data.addressType == '01') {
|
||||
$('#adres').val(data.roadAddress + data.extraAddress);
|
||||
} else {
|
||||
$('#adres').val(data.jibunAddress + data.extraAddress);
|
||||
}
|
||||
}
|
||||
/**********************************************
|
||||
배송지 등록 시 도로명, 지번 주소 구분 value값 넣기 ok
|
||||
***********************************************/
|
||||
const fn_set_mngrOrdrDlvylc_postcode = function (data) {
|
||||
$("#ordrRecpntNm").val(data.recpntNm);
|
||||
$("#ordrDtlAdres").val(data.dtlAdres);
|
||||
$("#ordrRecpntMbtlnb").val(data.mbtlnb);
|
||||
$('#ordrDlvylcZip').val(data.postcode);
|
||||
$('#ordrAdresDvCd').val(data.addressType);
|
||||
if (data.addressType == '01') {
|
||||
$('#ordrAdres').val(data.roadAddress + data.extraAddress);
|
||||
} else {
|
||||
$('#ordrAdres').val(data.jibunAddress + data.extraAddress);
|
||||
}
|
||||
console.log("data.recpntNm", data.recpntNm);
|
||||
if (data.recpntNm == null) {
|
||||
$("#newDlvyLc").prop("checked", true);
|
||||
} else {
|
||||
$("#defaultDlvyLc").prop("checked", true);
|
||||
}
|
||||
}
|
||||
/**********************************************
|
||||
배송지 관리 팝업에서 배송 정보 가져오기
|
||||
***********************************************/
|
||||
const fn_select_mngrOrdr_postcode = function (callback, index) {
|
||||
let extraAddress = "";
|
||||
callback({
|
||||
postcode: $(".zip").eq(index).val(),
|
||||
addressType: $(".adresDv").eq(index).val(),
|
||||
roadAddress: $(".rnmAdres").eq(index).val(),
|
||||
jibunAddress: $(".lnbAdres").eq(index).val(),
|
||||
recpntNm: $(".recpntNmR").eq(index).val(),
|
||||
dtlAdres: $(".dtlAdres").eq(index).val(),
|
||||
dlvylcAreaCd: $(".dlvylcAreaCd").eq(index).val(),
|
||||
prefcd: $(".prefcd").eq(index).val(),
|
||||
cstmclerCd: $(".cstmclerCd").eq(index).val(),
|
||||
mbtlnb: $(".dlvylcMbtlnb").eq(index).val(),
|
||||
extraAddress: extraAddress
|
||||
});
|
||||
fn_close_modal("dlvylcManage");
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
배송지 관리 팝업 언어 설정
|
||||
***********************************************/
|
||||
const fn_toggle_langHeader = function () {
|
||||
var id = $('[name=dlvylcAreaCd]:checked').attr('id');
|
||||
|
||||
$('.langKr, .langJp').hide();
|
||||
$('.' + id).show();
|
||||
|
||||
if (id == 'langJp') {
|
||||
$('#zip').prop('readonly', false);
|
||||
$('#cstmclerCd').prop('disabled', true);
|
||||
$('#prefcode').prop('disabled', false);
|
||||
} else {
|
||||
$('#zip').prop('readonly', true);
|
||||
$('#cstmclerCd').prop('disabled', false);
|
||||
$('#prefcode').prop('disabled', true);
|
||||
|
||||
$('#postcodeAlert').hide();
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
ibsnet api 호출
|
||||
***********************************************/
|
||||
const fn_select_postcodeJp = function () {
|
||||
$('#postcodeAlert').hide();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'https://zipcloud.ibsnet.co.jp/api/search?zipcode=' + $('#zip').val()
|
||||
+'&callback=' + 'fn_set_postcodeJp',
|
||||
dataType: 'jsonp',
|
||||
success: function(data) {
|
||||
if(data.status == 200) {
|
||||
let result = data.results[0];
|
||||
|
||||
let adres = result.address1;
|
||||
let dtlAdres = [result.address2, result.address3].join(" ");
|
||||
let prefcode = result.prefcode;
|
||||
|
||||
$("#adres").val(adres);
|
||||
$("#dtlAdres").val(dtlAdres);
|
||||
$("#prefcode").val(prefcode);
|
||||
$("#adresDv").val("01");
|
||||
} else {
|
||||
$('#postcodeAlert').show();
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error('API 호출 실패:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
배송지 관리 팝업 언어별 form 초기화
|
||||
***********************************************/
|
||||
let dlvylcFormPreValues = {};
|
||||
const fn_clear_dlvylcForm = function () {
|
||||
const tableInputs = $("#dlvylcFormTable").find("input[name]");
|
||||
|
||||
if (Object.keys(dlvylcFormPreValues).length == 0) {
|
||||
tableInputs.each(function () {
|
||||
const input = $(this);
|
||||
const name = input.attr("name");
|
||||
dlvylcFormPreValues[name] = input.val();
|
||||
input.val("");
|
||||
});
|
||||
} else {
|
||||
tableInputs.each(function () {
|
||||
const input = $(this);
|
||||
const name = input.attr("name");
|
||||
const currentValue = input.val();
|
||||
input.val(dlvylcFormPreValues[name] ?? "");
|
||||
dlvylcFormPreValues[name] = currentValue;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user