MypageCustModifyFormMob.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org"
  4. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  5. layout:decorator="mob/common/layout/MypageLayoutMob">
  6. <!--
  7. *******************************************************************************
  8. * @source : MypageCustModifyFormMob.html
  9. * @desc : 마이페이지 > 회원정보 수정 Page
  10. *============================================================================
  11. * STYLE24
  12. * Copyright(C) 2021 TSIT, All rights reserved.
  13. *============================================================================
  14. * VER DATE AUTHOR DESCRIPTION
  15. * === =========== ========== =============================================
  16. * 1.0 2021.04.26 jsshin 최초 작성
  17. *******************************************************************************
  18. -->
  19. <body>
  20. <th:block layout:fragment="content">
  21. <main class="container my">
  22. <section class="content my_page_edit">
  23. <form id="custModiFyForm" name="custModiFyForm" class="form_wrap">
  24. <div class="inner">
  25. <div class="tbl_wrap">
  26. <div class="tbl_tit">
  27. <h3>회원 정보</h3>
  28. <button type="button" id="btnNameCertify" class="btn_popup">
  29. <span>개명 본인인증</span>
  30. </button>
  31. </div>
  32. <div class="tbl">
  33. <div class="tbl_row">
  34. <table>
  35. <colgroup>
  36. <col width="*">
  37. </colgroup>
  38. <tr>
  39. <th>이름</th>
  40. <td>
  41. <div class="form_field">
  42. <input type="text" id="custNm" name="custNm" class="form_control" readonly="readonly">
  43. </div>
  44. </td>
  45. </tr>
  46. <tr>
  47. <th>생년월일</th>
  48. <td>
  49. <div class="form_field">
  50. <input type="text" id="birthYmd" name="birthYmd" class="form_control" readonly="readonly"/>
  51. </div>
  52. </td>
  53. </tr>
  54. </table>
  55. <p class="desc_txt">본인인증을 통해 자동으로 수집되는 정보입니다.</p>
  56. </div>
  57. <div class="tbl_row">
  58. <table>
  59. <colgroup>
  60. <col width="*">
  61. </colgroup>
  62. <tr>
  63. <th>아이디</th>
  64. <td>
  65. <div class="form_field">
  66. <input type="text" id="custId" name="custId" class="form_control" placeholder="" readonly="readonly"/>
  67. </div>
  68. </td>
  69. </tr>
  70. <tr>
  71. <th>비밀번호</th>
  72. <td>
  73. <div class="form_field password">
  74. <button type="button" id="btn_password_pop" class="btn btn_primary" onclick="cfnPasswordModify();">
  75. <span>비밀번호 변경하기</span>
  76. </button>
  77. </div>
  78. </td>
  79. </tr>
  80. <tr>
  81. <th>이메일</th>
  82. <td>
  83. <div class="form_field">
  84. <input type="text" id="email" name="email" class="form_control"/>
  85. </div>
  86. </td>
  87. </tr>
  88. <tr>
  89. <th>휴대폰 인증</th>
  90. <td>
  91. <div class="input_wrap certi_wrap">
  92. <input type="text" id="cellPhnno" name="cellPhnno" class="form_control" readonly="readonly"/>
  93. <button type="button" id="btnCellCertify" class="btn btn_dark">
  94. <span>본인인증</span>
  95. </button>
  96. </div>
  97. </td>
  98. </tr>
  99. </table>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="inner">
  105. <div class="tbl_wrap">
  106. <div class="tbl_tit">
  107. <h3>마케팅 정보 수신설정</h3>
  108. </div>
  109. <div class="tbl tbl_radio">
  110. <table>
  111. <colgroup>
  112. <col width="*">
  113. </colgroup>
  114. <tr>
  115. <th class="sr-only">이름</th>
  116. <td>
  117. <div class="form_field">
  118. <input type="checkbox" id="emailAgreeYn" name="emailAgreeYn" value="Y"/>
  119. <label for="emailAgreeYn"><span>이메일</span></label>
  120. </div>
  121. </td>
  122. </tr>
  123. <tr>
  124. <th class="sr-only">생년월일</th>
  125. <td>
  126. <div class="form_field">
  127. <input type="checkbox" id="smsAgreeYn" name="smsAgreeYn" value="Y"/>
  128. <label for="smsAgreeYn"><span>SMS</span></label>
  129. </div>
  130. </td>
  131. </tr>
  132. </table>
  133. <p class="desc_txt">회원정보, 구매 정보 및 서비스 주요 정책 관련 내용은 수신동의 여부와<br>관계없이 발송됩니다.</p>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="inner">
  138. <div class="tbl_wrap">
  139. <div class="tbl_tit">
  140. <h3>환불 계좌정보</h3>
  141. </div>
  142. <div class="tbl type1">
  143. <table>
  144. <colgroup>
  145. <col width="*">
  146. </colgroup>
  147. <tr>
  148. <th>예금주</th>
  149. <td>
  150. <div class="form_field">
  151. <input type="text" id="accountNm" name="accountNm" class="form_control" placeholder="" readonly="readonly"/>
  152. </div>
  153. </td>
  154. </tr>
  155. <tr>
  156. <th>은행명</th>
  157. <td>
  158. <div class="form_field">
  159. <div class="select_custom select_bank"> <!-- 210408_ 수정 : select_bank 클래스 변경 -->
  160. <div class="combo">
  161. <div class="select">선택</div>
  162. <input type="hidden" name="bankCd" value=""/>
  163. </div>
  164. </div>
  165. </div>
  166. </td>
  167. </tr>
  168. <tr>
  169. <th>계좌번호</th>
  170. <td>
  171. <div class="input_wrap certi_wrap">
  172. <input type="text" id="accountNo" name="accountNo" class="form_control" maxlength="20" data-valid-type="numeric" placeholder="계좌번호를 입력해 주세요"/>
  173. <button type="button" id="btnAccountCheck" class="btn btn_dark">
  174. <span>계좌인증</span>
  175. </button>
  176. </div>
  177. </td>
  178. </tr>
  179. </table>
  180. </div>
  181. </div>
  182. <div class="btn_group_flex">
  183. <div class="">
  184. <button type="button" id="btnConfirm" class="btn btn_dark btn_block">
  185. <span>확인</span>
  186. </button>
  187. </div>
  188. </div>
  189. </div>
  190. <!-- 210408_ 추가 : 은행 선택 팝업 -->
  191. <div id="refundBankPop" class="popup_box refundBankPop">
  192. <div class="lap">
  193. <div class="popup_close">카테고리닫기</div>
  194. <div class="popup_head sr-only">
  195. <h2 class="">은행 선택 팝업</h2>
  196. </div>
  197. <div class="popup_con">
  198. <div class="button_list clear">
  199. <th:block th:if="${bankList}" th:each="oneData, status : ${bankList}">
  200. <button type="button" th:id="|bankCd_${oneData.cd}|" th:with="cd = ${oneData.cd}">
  201. <span th:text="${oneData.cdNm}"></span>
  202. <input type="hidden" name="bankCd" th:value="${cd}"/>
  203. </button>
  204. </th:block>
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. <!-- //210408_ 추가 : 은행 선택 팝업 -->
  210. </form>
  211. </section>
  212. </main>
  213. <script th:inline="javascript">
  214. /*<![CDATA[*/
  215. let sEncData = [[${sEncData}]]; //인증 후 해당 페이지로 리다이렉트함
  216. let authMethod = [[${authMethod}]]; //인증 후 해당 페이지로 리다이렉트함
  217. let orgCustInfo;
  218. let orgAccountInfo;
  219. let accountCheck = false;
  220. // 고객정보
  221. var fnGetCustInfo = function () {
  222. $.get('/mypage/customer/info', fnGetCustInfoCallback);
  223. }
  224. // 고객정보 데이터
  225. var fnGetCustInfoCallback = function (custInfo) {
  226. orgCustInfo = custInfo; // 원본 데이터저장 수정시 비교 작업
  227. $('#custModiFyForm input[name=custNm]').val(custInfo.custNm);
  228. $('#custModiFyForm input[name=birthYmd]').val(custInfo.birthYmd);
  229. let custId = custInfo.custId;
  230. if (custInfo.snsType === 'NV') {
  231. custId = '네이버 간편가입회원'
  232. }
  233. if (custInfo.snsType === 'KK') {
  234. custId = '카카오 간편가입회원'
  235. }
  236. if (custInfo.snsType === 'YS') {
  237. custId = 'YES24 간편가입회원'
  238. }
  239. $('#custModiFyForm input[name=custId]').val(custId);
  240. $('#custModiFyForm input[name=email]').val(custInfo.email);
  241. $('#custModiFyForm input[name=cellPhnno]').val(custInfo.cellPhnno);
  242. $('#custModiFyForm input[name=accountNm]').val(custInfo.custNm);
  243. fnDisplayEmailAgree(custInfo.emailAgreeYn);
  244. fnDisplaySmsAgree(custInfo.smsAgreeYn);
  245. // 회원(고객) 계좌 조회
  246. fnGetCustAccountInfo();
  247. }
  248. // 이메일 수신동의
  249. var fnDisplayEmailAgree = function (emailAgreeYn) {
  250. const $emailAgreeYn = $('#custModiFyForm input[name=emailAgreeYn]');
  251. if (emailAgreeYn === 'Y') {
  252. $emailAgreeYn.prop('checked', true);
  253. } else {
  254. $emailAgreeYn.prop('checked', false);
  255. }
  256. };
  257. // SMS 수신동의
  258. var fnDisplaySmsAgree = function (smsAgreeYn) {
  259. const $smsAgreeYn = $('#custModiFyForm input[name=smsAgreeYn]');
  260. if (smsAgreeYn === 'Y') {
  261. $smsAgreeYn.prop('checked', true);
  262. } else {
  263. $smsAgreeYn.prop('checked', false);
  264. }
  265. };
  266. // 고객계좌정보
  267. var fnGetCustAccountInfo = function () {
  268. $.get('/mypage/customer/account/info', fnGetCustAccountInfoCallback);
  269. }
  270. // 고객계좌 정보 데이터
  271. var fnGetCustAccountInfoCallback = function (result) {
  272. orgAccountInfo = {};
  273. var $accountNm = $('#custModiFyForm input[name=accountNm]');
  274. if (!gagajf.isNull(result)) {
  275. orgAccountInfo.accountNo = result.accountNo;
  276. orgAccountInfo.bankCd = result.bankCd;
  277. //1. 고객명과 환불계좌 예금주가 다른 경우 현재 고객명을 적어주고 계좌번호, 은행코드 초기화 처리
  278. let $bankCd = '';
  279. if ($accountNm.val() === result.accountNm) {
  280. $('#custModiFyForm input[name=accountNo]').val(result.accountNo);
  281. $bankCd = '#bankCd_'+result.bankCd;
  282. } else {
  283. $('#custModiFyForm input[name=accountNo]').val('');
  284. $bankCd = '#bankCd_';
  285. }
  286. $($bankCd).trigger('click'); // 셀렉트 박스 트리거
  287. } else {
  288. orgAccountInfo.accountNo = '';
  289. orgAccountInfo.bankCd ='';
  290. }
  291. }
  292. // 나이스 본인인증 후 콜백
  293. var fnNiceCallBack = function(encData) {
  294. if (!gagajf.isNull(encData)) {
  295. let custInfo = {};
  296. custInfo.encData = encData;
  297. let jsonData = JSON.stringify(custInfo);
  298. gagajf.ajaxJsonSubmit('/mypage/customer/auth/update', jsonData, fnUpdateAuthInfoCallback);
  299. }
  300. };
  301. var fnUpdateAuthInfoCallback = function (result) {
  302. if (result.isSuccess) {
  303. fnGetCustInfo();
  304. mcxDialog.alert("본인인증을 통해 정보가 변경 되었습니다.");
  305. return;
  306. } else {
  307. mcxDialog.alert("실패하였습니다.<br/>고객센터에 문의하시 바랍니다.");
  308. return;
  309. }
  310. }
  311. // 계좌인증
  312. $('#btnAccountCheck').on('click', function () {
  313. if (!fnGetAccountValidation()) {
  314. return;
  315. }
  316. let custInfo = {};
  317. custInfo.accountNm = $('#custModiFyForm input[name=accountNm]').val();
  318. custInfo.accountNo = $('#custModiFyForm input[name=accountNo]').val();
  319. custInfo.bankCd = $('#custModiFyForm input[name=bankCd]').val();
  320. let jsonData = JSON.stringify(custInfo)
  321. //console.log(jsonData);
  322. gagajf.ajaxJsonSubmit('/mypage/account/check', jsonData, fnAccountCheckCallback);
  323. });
  324. // 계좌인증 콜백
  325. var fnAccountCheckCallback = function (result) {
  326. let msg = '계좌인증에 성공했습니다.'
  327. if (result.isValid) { // 유효하면 true
  328. accountCheck = true;
  329. } else {
  330. accountCheck = false;
  331. msg = '계좌정보를 다시 확인해주세요.'
  332. }
  333. mcxDialog.alertC(msg ,{
  334. sureBtnText: "확인",
  335. sureBtnClick: function() {
  336. }
  337. });
  338. };
  339. // 수정 버튼
  340. $('#btnConfirm').on('click', function () {
  341. let custModiFy = $('#custModiFyForm').serializeObject();
  342. let $bankCd = $('#custModiFyForm input[name=bankCd]');
  343. let $accountNo = $('#custModiFyForm input[name=accountNo]');
  344. let marketingModifyYn = 'N';
  345. let accountModifyYn = 'N';
  346. let emailModifyYn = 'N';
  347. if (gagajf.isNull(custModiFy.email)) {
  348. mcxDialog.alertC('이메일 주소를 입력해주세요.',{
  349. sureBtnText: "확인",
  350. sureBtnClick: function() {
  351. $('#custModiFyForm input[name=email]').focus();
  352. }
  353. });
  354. }
  355. if (orgCustInfo.email !== custModiFy.email) {
  356. emailModifyYn = 'Y';
  357. }
  358. if (!fnGetAccountValidation()) {
  359. return;
  360. }
  361. // 은행코드가 바꼈는지
  362. if (orgAccountInfo.bankCd !== $bankCd.val()) {
  363. accountModifyYn = 'Y';
  364. }
  365. if (orgAccountInfo.accountNo !== $accountNo.val()) {
  366. accountModifyYn = 'Y';
  367. }
  368. if (accountModifyYn === 'Y') { // 환불계좌정보 변경 됐으면
  369. if (!gagajf.isNull($bankCd.val()) && !gagajf.isNull($accountNo.val())) {
  370. if (!accountCheck) {
  371. mcxDialog.alertC('계좌인증이 필요합니다.',{
  372. sureBtnText: "확인",
  373. sureBtnClick: function() {
  374. }
  375. });
  376. return;
  377. }
  378. }
  379. }
  380. if (gagajf.isNull(custModiFy.smsAgreeYn)) {
  381. custModiFy.smsAgreeYn = 'N';
  382. }
  383. if (gagajf.isNull(custModiFy.emailAgreeYn)) {
  384. custModiFy.emailAgreeYn = 'N';
  385. }
  386. // SMS 수신여부
  387. if (orgCustInfo.smsAgreeYn !== custModiFy.smsAgreeYn) {
  388. marketingModifyYn = 'Y';
  389. }
  390. // 이메일 수신여부
  391. if (orgCustInfo.emailAgreeYn !== custModiFy.emailAgreeYn) {
  392. marketingModifyYn = 'Y';
  393. }
  394. custModiFy.bankCd = $bankCd.val();
  395. custModiFy.emailModifyYn = emailModifyYn ;
  396. custModiFy.marketingModifyYn = marketingModifyYn;
  397. custModiFy.accountModifyYn = accountModifyYn;
  398. let jsonData = JSON.stringify(custModiFy);
  399. // console.log('jsonData',jsonData);
  400. gagajf.ajaxJsonSubmit('/mypage/customer/info/save', jsonData, fnSaveCustomerInfoCallback)
  401. });
  402. // 수정 콜백
  403. var fnSaveCustomerInfoCallback = function (result) {
  404. if (result.isSuccess) {
  405. mcxDialog.alert("회원정보가 수정되었습니다.");
  406. fnGetCustInfo();
  407. return;
  408. } else {
  409. mcxDialog.alert("실패하였습니다.<br/>고객센터에 문의하시 바랍니다.");
  410. return;
  411. }
  412. }
  413. // 은행계좌 유효성체크
  414. var fnGetAccountValidation = function () {
  415. let $bankCd = $('#custModiFyForm input[name=bankCd]');
  416. let $accountNo = $('#custModiFyForm input[name=accountNo]');
  417. if (gagajf.isNull($bankCd.val()) && !gagajf.isNull($accountNo.val())) {
  418. mcxDialog.alertC('은행을 선택해주세요.',{
  419. sureBtnText: "확인",
  420. sureBtnClick: function() {
  421. $bankCd.focus();
  422. }
  423. });
  424. return false
  425. }
  426. if (!gagajf.isNull($bankCd.val()) && gagajf.isNull($accountNo.val())) {
  427. mcxDialog.alertC('계좌번호를 입력해주세요.',{
  428. sureBtnText: "확인",
  429. sureBtnClick: function() {
  430. $accountNo.focus();
  431. }
  432. });
  433. return false;
  434. }
  435. return true;
  436. };
  437. // 나이스 본인인증 후 콜백
  438. var fnNiceCallBack = function(encData) {
  439. if (!gagajf.isNull(encData)) {
  440. let custInfo = {};
  441. custInfo.encData = encData;
  442. let jsonData = JSON.stringify(custInfo);
  443. gagajf.ajaxJsonSubmit('/mypage/customer/auth/update', jsonData, fnUpdateAuthInfoCallback);
  444. }
  445. };
  446. var fnUpdateAuthInfoCallback = function (result) {
  447. if (result.isSuccess) {
  448. fnGetCustInfo();
  449. mcxDialog.alert("본인인증을 통해 정보가 변경 되었습니다.");
  450. return;
  451. } else {
  452. mcxDialog.alert("실패하였습니다.<br/>고객센터에 문의하시 바랍니다.");
  453. return;
  454. }
  455. }
  456. //개명 본인인증
  457. $('#btnNameCertify').on('click', function () {
  458. cfnOpenCellphoneCertify(_PAGE_MYPAGE_CUSTOMER_MODIFY+'?confirmYn=Y');
  459. });
  460. $('#btnCellCertify').on('click', function () {
  461. cfnOpenCellphoneCertify(_PAGE_MYPAGE_CUSTOMER_MODIFY+'?confirmYn=Y');
  462. });
  463. $(document).ready(function(){
  464. if (!gagajf.isNull(sEncData)) {
  465. fnNiceCallBack(sEncData, authMethod);
  466. }
  467. $('#htopTitle').text('내 정보 관리');
  468. // 회원(고객) 조회
  469. fnGetCustInfo();
  470. //버튼 색
  471. $(document).on('click','.popup_box .button_list button',function(){
  472. $('.popup_box .button_list button').removeClass('on');
  473. $(this).addClass('on');
  474. $('.combo .select').html($(this)[0].innerHTML); // 값변경
  475. });
  476. //210408_ 추가 : 은행선택 팝업 스크립트
  477. $(document).on("click",".select_bank",function(e){
  478. $('#refundBankPop').show().addClass("active");
  479. $('#refundBankPop').css({"z-index":"1000"});
  480. $("body").css({"overflow":"hidden"});
  481. });
  482. //210408_ 추가 : 은행선택 팝업 스크립트 닫기
  483. $('.refundBankPop .popup_close').on("click",function(){
  484. $('.refundBankPop').hide().removeClass('active');
  485. $("body").css({"overflow":"visible"});
  486. });
  487. })
  488. /*]]>*/
  489. </script>
  490. </th:block>
  491. </body>
  492. </html>