ITP_MLOANMNG02010.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. require(['config'], function() {
  2. require([
  3. ], function($) {
  4. mobPageObj.init();
  5. });
  6. });
  7. /*API URL*/
  8. const API_MOBILE_GRID_LIST = '/api/dspt/mng/detail-grid-list'; // 목록
  9. const API_MOBILE_INFO = '/api/dspt/mng/info-dspt'; // 상세
  10. const API_MOBILE_DSPT_REQ = '/api/dspt/mng/request-dspt'; // 신규/승인
  11. const API_MOBILE_DSPT_REJ = '/api/dspt/mng/remove-dspt'; // 삭제/반려
  12. const API_MOBILE_APPROVE = '/api/dspt/mng/approve-dspt'; // 승인
  13. const API_MOBILE_REJECT = '/api/dspt/mng/reject-dspt'; // 반려
  14. const API_POP_SEARCH_LIST = '/api/store/pop-grid-list';
  15. // 이지페이 결제 생성
  16. let EASYPAY_PAYMENT_CREATE = '/api/easypay/payment/create';
  17. const PAGE_MODE_LIST = "LIST";
  18. const PAGE_MODE_VIEW = "VIEW";
  19. let mobPageObj = {
  20. viewMode: PAGE_MODE_LIST,
  21. init: function () {
  22. this.ui.init();
  23. this.event.init();
  24. this.ready();
  25. },
  26. ui: {
  27. init: function () {
  28. this.view();
  29. this.info();
  30. },
  31. view: function() {
  32. // 공통코드 표시
  33. $('select').each(function() {
  34. if($(this).data('select-code')) {
  35. fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
  36. }
  37. });
  38. // 조회일자 지정
  39. $('#ITP_MOBILE_MLOANMNG02010 .itp_input.date').datepicker(ITP_DATE_LANGUAGE);
  40. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH_FROM_DT').datepicker('setDate', itp_fn_date_add('M', -1));
  41. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH_TO_DT').datepicker('setDate', itp_fn_date_add('M', 0));
  42. $('#ITP_FORM_MLOANMNG02010_POP_DPST_DT').datepicker('setDate', itp_fn_date_add('M', 0));
  43. fn_make_user_info.get('apprYn') === 'Y' ? $('#ITP_BTN_MLOANMNG02010_LIST_PAY').show() : $('#ITP_BTN_MLOANMNG02010_LIST_PAY').hide();
  44. if(fn_make_user_info.get('authTpCd') === '50') {
  45. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_NM').val(fn_make_user_info.get('storeNm'));
  46. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_BTN_MLOANMNG02010_LIST_SEARCH_RTN_PLACE').hide();
  47. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_BTN_MLOANMNG02010_LIST_DELETE_RTN_PLACE').hide();
  48. }
  49. itp_fn_form_event.onKeyup('#ITP_FORM_MLOANMNG02010_PAY');
  50. },
  51. info: function() {
  52. $('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
  53. $('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
  54. }
  55. },
  56. event: {
  57. init: function() {
  58. this.action();
  59. },
  60. action: function() {
  61. $('button[id^="ITP_BTN_MLOANMNG02010_LIST"]').on('click', function() {
  62. var id = $(this).attr('id');
  63. switch (id) {
  64. case 'ITP_BTN_MLOANMNG02010_LIST_SEARCH_RTN_PLACE' : mobPopObj.popStoreNm.init(); break;
  65. case 'ITP_BTN_MLOANMNG02010_LIST_DELETE_RTN_PLACE' : mobPopObj.popStoreNm.delete(); break;
  66. case 'ITP_BTN_MLOANMNG02010_LIST_PAY' : mobContentObj.list.payment.view(); break;
  67. case 'ITP_BTN_MLOANMNG02010_LIST_ADD' : mobContentObj.list.add(); break;
  68. case 'ITP_BTN_MLOANMNG02010_LIST_SEARCH' : mobContentObj.list.search(); break;
  69. }
  70. return false;
  71. });
  72. $('button[id^="ITP_BTN_MLOANMNG02010_PAY"]').on('click', function() {
  73. var id = $(this).attr('id');
  74. switch (id) {
  75. case 'ITP_BTN_MLOANMNG02010_PAY_REQ' : mobContentObj.list.payment.view(); break;
  76. case 'ITP_BTN_MLOANMNG02010_PAY_CANCEL' : mobContentObj.list.payment.cancel(); break;
  77. }
  78. return false;
  79. });
  80. $('select[id^="ITP_FORM_MLOANMNG02010_VIEW_EMAIL_CD"]').on('change', function() {
  81. var val = $(this).val();
  82. var emailId = '#ITP_FORM_MLOANMNG02010_VIEW_PAY_EMAIL_NM';
  83. if(val === '') {
  84. $(emailId).val('');
  85. $(emailId).attr('readonly', false);
  86. } else {
  87. $(emailId).val($(this).val());
  88. $(emailId).attr('readonly', true);
  89. }
  90. });
  91. $(document).on('click', '#ITP_LIST_MLOANMNG02010_LIST_ITEM_ROWS li', function(e) {
  92. var index = $(this).index();
  93. if($(e.target).hasClass('AGR')) {
  94. mobContentObj.list.agree(index);
  95. } else if($(e.target).hasClass('RJT')) {
  96. mobContentObj.list.reject(index);
  97. } else {
  98. }
  99. });
  100. $(document).on('click', '#ITP_LIST_MLOANMNG02010_POP_STORE_ROWS li button', function() {
  101. mobPopObj.popWhsNm.choice($(this));
  102. });
  103. }
  104. },
  105. switchScreen: function(mode) {
  106. this.viewMode = mode;
  107. $('#ITP_MOBILE_MLOANMNG02010').find('div[id$="_CONTAINER"]').each(function(i) {
  108. $(this).hide();
  109. });
  110. if(mode === PAGE_MODE_LIST) {
  111. $('#ITP_AJAX_MLOANMNG02010_LIST_CONTAINER').show();
  112. this.moreView(true);
  113. } else if(mode === PAGE_MODE_VIEW) {
  114. $('#ITP_AJAX_MLOANMNG02010_VIEW_CONTAINER').show();
  115. this.moreView(false);
  116. }
  117. },
  118. moreView: function(isScroll) {
  119. var _this = this;
  120. if(isScroll) {
  121. $('#ITP_LIST_MLOANMNG02010_LIST_ITEM_AREA').on('scroll', function () {
  122. if($(this).scrollTop() + $(this).innerHeight() + 1 >= $(this)[0].scrollHeight) {
  123. if(mobContentObj.list.totPage > mobContentObj.list.listPage) {
  124. if(!mobContentObj.list.isSearch) {
  125. mobContentObj.list.load();
  126. }
  127. }
  128. }
  129. });
  130. } else {
  131. $('#ITP_LIST_MLOANMNG02010_LIST_AREA').off('scroll');
  132. }
  133. },
  134. ready: function() {
  135. mobContentObj.list.init();
  136. }
  137. };
  138. let mobContentObj = {
  139. list: {
  140. listSize: 10,
  141. listPage: 0,
  142. totPage: 0,
  143. isSearch: false,
  144. rows: [],
  145. init: function() {
  146. mobPageObj.switchScreen(PAGE_MODE_LIST);
  147. this.search();
  148. },
  149. search: function() {
  150. this.listPage = 0;
  151. this.totPage = 0;
  152. this.rows.length = 0;
  153. $('#ITP_LIST_MLOANMNG02010_LIST_ITEM_ROWS').empty();
  154. this.load();
  155. },
  156. load: function() {
  157. var _this = this;
  158. this.isSearch = true;
  159. var callbackFn = function(result) {
  160. console.log(result);
  161. _this.isSearch = false;
  162. _this.totPage = result.gridTotal;
  163. $.each(result.gridRows, function (i, item) {
  164. $('#ITP_LIST_MLOANMNG02010_LIST_ITEM_AREA .panel-group').append($('#ITP_LIST_MLOANMNG02010_LIST_ITEM_ROWCOPY').html());
  165. var $li = $('#ITP_LIST_MLOANMNG02010_LIST_ITEM_AREA .panel-group > .item-row:last');
  166. $li.find('.fnStoreNm').text(item.storeNm);
  167. $li.find('.fnLoanDvsnNm').text(item.loanDvsnNm);
  168. $li.find('.fnReqDt').text(item.reqDt);
  169. $li.find('.fnDpstDt').text(item.dpstDt);
  170. $li.find('.fnDpstAmt').text(CommonObj.currency.add(item.dpstAmt));
  171. $li.find('.fnDpstNm').text(CommonObj.nullToString(item.dpstNm));
  172. $li.find('.fnDpstAuthDt').text(CommonObj.nullToString(item.dpstAuthDt));
  173. $li.find('.fnDpstRjctDt').text(CommonObj.nullToString(item.dsptRjctDt));
  174. $li.find('.fnRcvAcctNo').text(CommonObj.nullToString(item.rcvAcctNo));
  175. $li.find('.fnDpstBnkNm').text(CommonObj.nullToString(item.dpstBnkNm));
  176. $li.find('.fnDpstStNm').text(CommonObj.nullToString(item.dpstStNm));
  177. (fn_make_user_info.get('authTpCd') === '50') ? $li.find('.btn-dpst').hide() : (item.dpstStCd === 'DP01') ? $li.find('.btn-dpst').show() : $li.find('.btn-dpst').hide();
  178. _this.rows.push(item);
  179. });
  180. };
  181. var errFn = function() { _this.isSearch = false;};
  182. const param = $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH').serializeObject();
  183. param.gridPage = ++this.listPage;
  184. param.gridSize = this.listSize
  185. param.fromDt = CommonObj.onlyNumber(param.fromDt);
  186. param.toDt = CommonObj.onlyNumber(param.toDt);
  187. console.log(JSON.stringify(param));
  188. fn_ajax_call(API_MOBILE_GRID_LIST, JSON.stringify(param), callbackFn, 'POST', errFn);
  189. },
  190. payment: {
  191. view: function() {
  192. var storeId = $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_ID').val();
  193. if(storeId.length < 1) {
  194. itp_fn_modal_alert('신규입금 처리를 위한 매장을 선택하세요.');
  195. return;
  196. }
  197. this.popup();
  198. },
  199. popup: function() {
  200. // 결제 팝업 결과
  201. var popFn = function(rowDataPop) {
  202. console.log(JSON.stringify(rowDataPop));
  203. mobContentObj.grid.search();
  204. };
  205. // 결제 팝업
  206. // 결제타입코드 : 10(선불(충전)), 20(후불(결제)), 30(후불(선결제)), 30(후불(선결제))
  207. var loanDvsn = $('#ITP_FORM_LOANMNG02010_SEARCH_STORE_LOAN_DVSN').val();
  208. var args = {
  209. 'payTpCd': loanDvsn === 'LD01' ? '10' : '30',
  210. 'brandId': $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH_BRAND_ID').val(),
  211. 'storeId': $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_ID').val()
  212. };
  213. fn_call_popup('biz', 'BIZPOP_PO_PAYMENT', '#ITP_ASIDE', popFn, args, 'M');
  214. },
  215. },
  216. add: function() {
  217. var storeId = $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_ID').val();
  218. if(storeId.length < 1) {
  219. itp_fn_modal_alert('신규입금 처리를 위한 매장을 선택하세요.');
  220. return;
  221. }
  222. mobPopObj.popDpstReq.init();
  223. },
  224. agree: function(index) {
  225. var item = this.rows[index];
  226. if(item.dpstStCd !== 'DP01') {
  227. itp_fn_modal_alert('입금요청 건만 승인처리를 할 수 있습니다.');
  228. return;
  229. }
  230. if(confirm(ITP_MSG_LOCALE.message.form.procData)) {
  231. var param = {"dsptMgntNoList": [item.dsptMgntNo]};
  232. fn_ajax_call(API_MOBILE_APPROVE, JSON.stringify(param), function() { mobContentObj.list.search(); }, 'POST');
  233. }
  234. },
  235. reject: function(index) {
  236. var item = this.rows[index];
  237. if(item.dpstStCd !== 'DP01') {
  238. itp_fn_modal_alert('입금요청 건만 반려처리를 할 수 있습니다.');
  239. return;
  240. }
  241. mobPopObj.popDpstRjct.init(item);
  242. }
  243. },
  244. view: {
  245. init: function(item) {
  246. mobPageObj.switchScreen(PAGE_MODE_VIEW);
  247. this.search(item);
  248. },
  249. search: function(item) {
  250. var _this = this;
  251. var callbackFn = function(result) {
  252. console.log(result);
  253. _this.view(result);
  254. };
  255. const param = {
  256. 'brandId': fn_make_user_info.get('brandId'),
  257. 'spplyId': fn_make_user_info.get('spplyId'),
  258. 'loanMgntUnqNo': item.loanMgntUnqNo
  259. };
  260. fn_ajax_call(API_MOBILE_INFO, param, callbackFn, 'GET');
  261. },
  262. view: function(result) {
  263. var _this = this;
  264. var id = '#ITP_AJAX_MLOANMNG02010_VIEW_CONTAINER';
  265. $(id).find('.fnStoreNm').text(result.storeNm);
  266. $(id).find('.fnLoanDvsnNm').text(result.loanDvsnNm);
  267. var limitAmt;
  268. if(result.loanDvsn == 'LD01') { // 선불(충전)
  269. limitAmt = result.chrgeLimitAmt;
  270. } else if(result.loanDvsn == 'LD02') { // 후불(신용)
  271. limitAmt = result.credtLimitAmt;
  272. }
  273. $(id).find('.fnLimitAmt').text(CommonObj.currency.add(limitAmt));
  274. $(id).find('.fnUseYnNm').text(result.useYnNm);
  275. $(id).find('.fnPosbLimitAmt').text(CommonObj.currency.add(limitAmt - result.useAmtTotal));
  276. $(id).find('.fnTmpRcvAcctTotal').text(CommonObj.currency.add(result.tmpRcvAcctTotal));
  277. $(id).find('.fnUseAmtTotal').text(CommonObj.currency.add(result.useAmtTotal));
  278. _this.history.init(result.loanMgntUnqNo);
  279. },
  280. payment:function() {
  281. location.replace('app:payment');
  282. },
  283. cancel: function () {
  284. var id = '#ITP_AJAX_MLOANMNG02010_VIEW_CONTAINER';
  285. $(id).find('.fnItemid').text('');
  286. $(id).find('.fnItemNm').text('');
  287. $(id).find('.fnUPodrQty').text('');
  288. $(id).find('#ITP_FORM_MLOANMNG02010_VIEW_TRSC_AMT').val('');
  289. $(id).find('#ITP_FORM_MLOANMNG02010_VIEW_MBL_NO').val('');
  290. $(id).find('#ITP_FORM_MLOANMNG02010_VIEW_PAY_EMAIL_ID').val('');
  291. $(id).find('#ITP_FORM_MLOANMNG02010_VIEW_PAY_EMAIL_NM').val('');
  292. $(id).find('#ITP_FORM_MLOANMNG02010_VIEW_EMAIL_CD').val('');
  293. mobPageObj.switchScreen(PAGE_MODE_LIST);
  294. }
  295. }
  296. };
  297. let mobPopObj = {
  298. popStoreNm: {
  299. popId: 'ITP_POP_MLOANMNG02010_STORE_AREA',
  300. rows: [],
  301. init: function () {
  302. this.rows.length = 0;
  303. mobPopObj.show(this.popId);
  304. this.search();
  305. this.action();
  306. },
  307. search: function () {
  308. var _this = this;
  309. $('#ITP_LIST_MLOANMNG02010_POP_STORE_AREA .panel-group').empty();
  310. var callbackFn = function(result) {
  311. console.log(result);
  312. _this.view(result.gridRows);
  313. };
  314. const param = $('#ITP_FORM_MLOANMNG02010_POP_STORE').serializeObject();
  315. fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
  316. },
  317. view: function(gridRows) {
  318. this.rows = gridRows;
  319. $.each(gridRows, function (i, item) {
  320. $('#ITP_LIST_MLOANMNG02010_POP_STORE_AREA .panel-group').append($('#ITP_LIST_MLOANMNG02010_POP_STORE_ROWCOPY').html());
  321. var $li = $('#ITP_LIST_MLOANMNG02010_POP_STORE_AREA .panel-group > .row_2:last');
  322. $li.find('.fnStoreNm').text(item.storeNm);
  323. $li.find('.fnStoreStNm').text(item.storeStNm);
  324. $li.find('.fnStoreId').data('store-id', item.storeId);
  325. });
  326. },
  327. choice: function(elem) {
  328. var _this = this;
  329. var storeId = $(elem).data('store-id');
  330. $.each(this.rows, function (i, item) {
  331. if(storeId === item.storeId) {
  332. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_ID').val(item.storeId);
  333. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_NM').val(item.storeNm);
  334. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_FORM_LOANMNG02010_SEARCH_STORE_LOAN_DVSN').val(item.loanDvsn);
  335. _this.close();
  336. return false;
  337. }
  338. });
  339. },
  340. action: function() {
  341. var _this = this;
  342. $('button[id^="ITP_BTN_MLOANMNG02010_POP_STORE"]').off('click').on('click', function() {
  343. var id = $(this).attr('id');
  344. switch (id) {
  345. case 'ITP_BTN_MLOANMNG02010_POP_STORE_SEARCH' : _this.search(); break;
  346. case 'ITP_BTN_MLOANMNG02010_POP_STORE_CHOICE' : _this.choice($(this)); break;
  347. case 'ITP_BTN_MLOANMNG02010_POP_STORE_CLOSE' : _this.close(); break;
  348. }
  349. return false;
  350. });
  351. },
  352. delete: function() {
  353. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_ID').val('');
  354. $('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_NM').val('');
  355. },
  356. close: function() {
  357. this.rows.length = 0;
  358. $('#ITP_POP_MLOANMNG02010_LIST_WHS_AREA .panel-group').empty();
  359. $('#ITP_FORM_MLOANMNG02010_POP_STORE #ITP_FORM_MLOANMNG02010_POP_STORE_KEYWORD').val('');
  360. mobPopObj.hide(this.popId);
  361. }
  362. },
  363. popDpstReq: {
  364. popId: 'ITP_POP_MLOANMNG02010_DPST_REQ_AREA',
  365. init: function() {
  366. this.reset();
  367. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_BRAND_NM').val(fn_make_user_info.get('brandNm'));
  368. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_POP_FORM_MLOANMNG02010_DPST_REQ_STORE_ID').val($('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_ID').val());
  369. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_STORE_NM').val($('#ITP_FORM_MLOANMNG02010_LIST_SEARCH #ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_NM').val());
  370. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_DPST_DT').val(itp_fn_date_add('M', 0));
  371. mobPopObj.show(this.popId);
  372. this.action();
  373. },
  374. action: function() {
  375. var _this = this;
  376. $('button[id="ITP_BTN_MLOANMNG02010_POP_DPST_ADD"]').off('click').on('click', function() {
  377. _this.save();
  378. });
  379. $('button[id="ITP_BTN_MLOANMNG02010_POP_DPST_CANCEL"]').off('click').on('click', function() {
  380. _this.cancel();
  381. });
  382. },
  383. save: function() {
  384. var _this = this;
  385. const formId = '#ITP_POP_FORM_MLOANMNG02010_DPST_REQ';
  386. if (itp_fn_form_event.isValid(formId)) {
  387. if(confirm(ITP_MSG_LOCALE.message.form.procData)) {
  388. var saveFn = function() {
  389. _this.cancel();
  390. mobContentObj.list.search();
  391. };
  392. var param = $(formId).serializeObject();
  393. param.dpstDt = param.dpstDt.replace(/-/g, ".");
  394. console.log(JSON.stringify(param));
  395. fn_ajax_call(API_MOBILE_DSPT_REQ, JSON.stringify(param), saveFn, 'POST');
  396. }
  397. }
  398. },
  399. reset: function() {
  400. itp_fn_form_clear_validate(null, '#ITP_POP_FORM_MLOANMNG02010_DPST_REQ');
  401. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_STORE_ID').val('');
  402. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_BRAND_NM').val('');
  403. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_STORE_NM').val('');
  404. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_DPST_AMT').val('');
  405. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_DPST_DT').val('');
  406. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_DPST_NM').val('');
  407. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_DPST_BNK').val('');
  408. $('#ITP_POP_FORM_MLOANMNG02010_DPST_REQ #ITP_FORM_MLOANMNG02010_POP_DPST_ACCT_NO').val('');
  409. },
  410. cancel: function() {
  411. mobPopObj.hide(this.popId);
  412. }
  413. },
  414. popDpstRjct: {
  415. popId: 'ITP_POP_MLOANMNG02010_DPST_RJCT_AREA',
  416. init: function(item) {
  417. this.reset();
  418. this.view(item);
  419. this.action();
  420. this.dsptMgntNo = item.dsptMgntNo;
  421. mobPopObj.show(this.popId);
  422. },
  423. view: function(item) {
  424. console.log(item);
  425. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnBrandNm').text(item.brandNm);
  426. $('#ITP_POP_MLOANMNG02010_DPST_RJCT_AREA .fnStoreNm').text(item.storeNm);
  427. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstAmt').text(CommonObj.currency.add(item.dpstAmt));
  428. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstDt').text(item.dpstDt);
  429. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstNm').text(item.dpstNm);
  430. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstBnk').text(item.dpstBnkNm);
  431. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnRcvAcctNo').text(item.rcvAcctNo);
  432. },
  433. action: function() {
  434. var _this = this;
  435. $('button[id="ITP_BTN_MLOANMNG02010_POP_DPST_RJCT"]').off('click').on('click', function() {
  436. _this.save();
  437. });
  438. },
  439. save: function() {
  440. var _this = this;
  441. var reason = $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT #ITP_POP_FORM_MLOANMNG02010_DPST_RJCT_REASON').val();
  442. if(reason.length < 1) {
  443. itp_fn_modal_alert('반려 사유를 입력해 주세요.');
  444. return;
  445. }
  446. var modalFn = {
  447. callBack: function(args) {
  448. var saveFn = function() {
  449. _this.cancel();
  450. mobContentObj.list.search();
  451. };
  452. var param = {'dsptMgntNoList': [_this.dsptMgntNo], 'dsptRjctRsn': reason};
  453. fn_ajax_call(API_MOBILE_REJECT, JSON.stringify(param), saveFn, 'POST');
  454. }
  455. };
  456. itp_fn_modal_confirm(ITP_MSG_LOCALE.message.form.procData, modalFn);
  457. },
  458. reset: function() {
  459. itp_fn_form_clear_validate(null, '#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT');
  460. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnBrandNm').text('');
  461. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnStoreNm').text('');
  462. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstAmt').text('');
  463. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstDt').text('');
  464. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstNm').text('');
  465. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstBnk').text('');
  466. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT .fnDpstAcctNo').text('');
  467. $('#ITP_POP_FORM_MLOANMNG02010_DPST_RJCT #ITP_POP_FORM_MLOANMNG02010_DPST_RJCT_REASON').val('');
  468. },
  469. cancel: function() {
  470. mobPopObj.hide(this.popId);
  471. }
  472. },
  473. show: function(popId) {
  474. $('button[id$="_CLOSE"]').off('click').on('click', function() {
  475. console.log($(this).attr('id'));
  476. if($(this).hasClass('btn-pop-close')) {
  477. mobPopObj.hide(popId);
  478. }
  479. });
  480. $('#' + popId).show();
  481. },
  482. hide: function(popId) {
  483. $('#' + popId).closest('.mobile-pop-close').hide();
  484. }
  485. };