ITP_MPOMNG01010.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. require(['config'], function() {
  2. require([
  3. ], function($) {
  4. mobPageObj.init();
  5. });
  6. });
  7. /*API URL*/
  8. const API_MOBILE_INIT_INFO = '/api/pomng/init-pchReq';
  9. const API_MOBILE_SAVE = '/api/pomng/save-pchReq';
  10. const API_POP_SEARCH_LIST = '/api/whs/mng/pop-whs-search';
  11. const API_POP_ITEM_LIST = '/api/item/pop-grid-list';
  12. const ID_ITP_POP_MPOMNG01010_REQ_AREA = "ITP_POP_MPOMNG01010_REQ_AREA";
  13. const ID_ITP_POP_MPOMNG01010_WHS_AREA = "ITP_POP_MPOMNG01010_WHS_AREA";
  14. const ID_ITP_POP_MPOMNG01010_ITEM_AREA = "ITP_POP_MPOMNG01010_ITEM_AREA";
  15. const PCH_REQ_ST_CD_TEMP_SAVE ="PR00";
  16. const PCH_REQ_ST_CD_REQUEST_SAVE ="PR20";
  17. let mobPageObj = {
  18. isPrevPage: false,
  19. pageParam: null,
  20. init: function () {
  21. this.ui.init();
  22. this.event.init();
  23. this.ready();
  24. },
  25. ui: {
  26. init: function () {
  27. this.info();
  28. },
  29. info: function() {
  30. $('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
  31. $('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
  32. $('#ITP_FORM_MPOMNG01010_DETAIL_DLV_REQ_DT').val(itp_fn_date_add('M', 0));
  33. if(fn_make_user_info.get('authTpCd') === '50') {
  34. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').attr('readonly', true);
  35. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_BTN_MPOMNG01010_DETAIL_SEARCH_WHS_NM').attr('disabled', true);
  36. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM').attr('disabled', true);
  37. }
  38. }
  39. },
  40. event: {
  41. init: function() {
  42. this.button();
  43. },
  44. button: function() {
  45. $('button[id^="ITP_BTN_MPOMNG01010_DETAIL"]').on('click', function() {
  46. if($(this).is('[data-call-popup]')) {
  47. mobPopObj.show($(this).data('call-popup'), $(this).attr('id'));
  48. } else {
  49. var id = $(this).attr('id');
  50. switch (id) {
  51. case 'ITP_BTN_MPOMNG01010_DETAIL_DELROW' : mobContObj.list.delRow(); break;
  52. case 'ITP_BTN_MPOMNG01010_DETAIL_SEARCH_WHS_NM' : mobPopObj.popWhsNm.init(); break;
  53. case 'ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM' : mobPopObj.popWhsNm.delete(); break;
  54. case 'ITP_BTN_MPOMNG01010_DETAIL_CANCEL' : mobContObj.cancel(); break;
  55. }
  56. }
  57. return false;
  58. });
  59. // $(document).on('click', '#ITP_BTN_MPOMNG01010_DETAIL_PLUS', function() {
  60. // console.log('ITP_BTN_MPOMNG01010_DETAIL_PLUS ===> ');
  61. // mobContObj.list.actPlus($(this));
  62. // });
  63. // $(document).on('click', '#ITP_BTN_MPOMNG01010_DETAIL_MINUS', function() {
  64. // mobContObj.list.actMinus($(this));
  65. // });
  66. }
  67. },
  68. ready: function() {
  69. mobContObj.init();
  70. }
  71. };
  72. let mobContObj = {
  73. init: function() {
  74. this.data.load();
  75. },
  76. data: {
  77. initPchReq: null,
  78. load: function() {
  79. var _this = this;
  80. var callbackFn = function(result) {
  81. console.log(result);
  82. _this.initPchReq = result;
  83. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(result.brandId);
  84. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val(result.storeId);
  85. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
  86. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
  87. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
  88. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_MALL_ID').val(result.mallId);
  89. $('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text(CommonObj.currency.add(result.ordUseAmt));
  90. if(result.whsId !== '' && result.location !== '') {
  91. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_ID').val(result.whsId);
  92. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').val(result.whsNm);
  93. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOCATION').val(result.location);
  94. }
  95. };
  96. const param = {brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId')};
  97. fn_ajax_call(API_MOBILE_INIT_INFO, param, callbackFn, 'GET');
  98. }
  99. },
  100. list: {
  101. rows: [],
  102. addRow: function() {
  103. },
  104. delRow: function() {
  105. this.detachRow();
  106. },
  107. attachRow: function (item) {
  108. console.log(item);
  109. var _this = this;
  110. var fnIsExist = function(rows) {
  111. var isExist = false;
  112. $.each(rows, function(i, row) {
  113. if(row.brandUnitUnqNo === item.brandUnitUnqNo) {
  114. isExist = true;
  115. return false;
  116. }
  117. });
  118. return isExist;
  119. };
  120. if(!fnIsExist(this.rows)) {
  121. this.rows.push(item);
  122. $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_DETAIL_ROWCOPY').html());
  123. var $li = $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group > .list-row:last');
  124. $li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
  125. $li.find('.fnItemNm').text(item.itemNm);
  126. $li.find('.fnPchReqQty').text(item.pchReqQty);
  127. $li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
  128. this.pchReqAmtTot();
  129. $('.list-row #ITP_BTN_MPOMNG01010_DETAIL_PLUS')[$li.index()].addEventListener('click', function() { _this.actPlus(this); });
  130. $('.list-row #ITP_BTN_MPOMNG01010_DETAIL_MINUS')[$li.index()].addEventListener('click', function() { _this.actMinus(this); });
  131. }
  132. },
  133. detachRow: function () {
  134. if($('#ITP_LIST_MPOMNG01010_ITEM_AREA input:checkbox[name=brandUnitUnqNo]:checked').length > 0) {
  135. var _this = this;
  136. $('#ITP_LIST_MPOMNG01010_DETAIL_ROWS li').each(function(index, elem) {
  137. var isChecked = $(this).find('input[type="checkbox"]').is(':checked');
  138. if(isChecked) {
  139. $(this).remove();_this.rows.splice(index, 1);
  140. }
  141. });
  142. this.pchReqAmtTot();
  143. }
  144. },
  145. actPlus: function(elem) {
  146. var $div = $(elem).siblings('div');
  147. var num = Number($div.text());
  148. console.log('actPlus ===> ' + num);
  149. $($div).text((num + 1).toString());
  150. this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
  151. this.pchReqAmtTot();
  152. },
  153. actMinus: function(elem) {
  154. var $div = $(elem).siblings('div');
  155. var num = Number($div.text());
  156. console.log('actMinus ===> ' + num);
  157. if(num <= 1) {
  158. alert('주문수량을 확인하세요.');
  159. } else {
  160. $($div).text((num - 1).toString());
  161. this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
  162. this.pchReqAmtTot();
  163. }
  164. },
  165. pchReqAmtTot: function() {
  166. var reqAmt = 0;
  167. $.each(this.rows, function(index, item) {
  168. var qty = item.pchReqQty;
  169. var amt = item.unitAmt;
  170. reqAmt += Number(qty) * amt;
  171. });
  172. $('#ITP_AJAX_MPOMNG01010_VIEW_CONTAINER').find('.fnPchReqAmtTot').text(CommonObj.currency.add(reqAmt));
  173. }
  174. },
  175. cancel: function () {
  176. $(location).attr('href', MOBILE_CONTEXTPATH + '/app/main.html');
  177. }
  178. };
  179. let mobPopObj = {
  180. init: function(popId, parentId) {
  181. switch (popId) {
  182. case 'ITP_POP_MPOMNG01010_REQ_AREA' : this.popReqConfirm.init(parentId); break;
  183. case 'ITP_POP_MPOMNG01010_WHS_AREA' : this.popWhsNm.init(); break;
  184. case 'ITP_POP_MPOMNG01010_ITEM_AREA' : this.popItem.init(); break;
  185. }
  186. },
  187. popItem: {
  188. // rows: null,
  189. init: function() {
  190. this.search();
  191. },
  192. search: function() {
  193. $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').empty();
  194. var callbackFn = function(result) {
  195. console.log(result);
  196. mobPopObj.popItem.rows = result.gridRows;
  197. $.each(mobPopObj.popItem.rows, function (i, item) {
  198. $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY').html());
  199. var $li = $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group > .row_2:last');
  200. $li.find('#ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
  201. $li.find('.fnItemNm').text(item.itemNm);
  202. $li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
  203. });
  204. mobPopObj.popItem.addRow.init();
  205. };
  206. let param = $('#ITP_FORM_MPOMNG01010_POPUP_ITEM').serializeObject();
  207. fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
  208. },
  209. addRow: {
  210. init: function() {
  211. this.button.init();
  212. },
  213. button: {
  214. init: function() {
  215. var _this = this;
  216. $('button[id^="ITP_BTN_MPOMNG01010_POP_ITEM_"]').off('click').on('click', function() {
  217. var id = $(this).attr('id');
  218. switch (id) {
  219. case 'ITP_BTN_MPOMNG01010_POP_ITEM_PLUS' : _this.actPlus($(this)); break;
  220. case 'ITP_BTN_MPOMNG01010_POP_ITEM_MINUS' : _this.actMinus($(this)); break;
  221. case 'ITP_BTN_MPOMNG01010_POP_ITEM_ADD' : _this.actItemAdd($(this)); break;
  222. case 'ITP_BTN_MPOMNG01010_POP_ITEM_SEARCH' : mobPopObj.popItem.search(); break;
  223. case 'ITP_BTN_MPOMNG01010_POP_ITEM_CLOSE' : mobPopObj.hide(id); break;
  224. }
  225. return false;
  226. });
  227. },
  228. actPlus: function(elem) {
  229. var $div = $(elem).siblings('div');
  230. var num = Number($div.text());
  231. $($div).text((num + 1).toString());
  232. },
  233. actMinus: function(elem) {
  234. var $div = $(elem).siblings('div');
  235. var num = Number($div.text());
  236. if(num <= 1) {
  237. alert('주문수량을 확인하세요.');
  238. } else {
  239. $($div).text((num - 1).toString());
  240. }
  241. },
  242. actItemAdd: function(elem) {
  243. var index = $(elem).closest('li').index();
  244. var item = mobPopObj.popItem.rows[index];
  245. item['pchReqQty'] = $(elem).closest('li').find('.fnPchReqQty').html();
  246. mobContObj.list.attachRow(item);
  247. }
  248. }
  249. },
  250. delRow: function() {
  251. }
  252. },
  253. popWhsNm: {
  254. init: function () {
  255. this.rows.length = 0;
  256. this.search();
  257. this.action();
  258. },
  259. rows: [],
  260. search: function () {
  261. var _this = this;
  262. $('#ITP_LIST_MPOMNG01010_POP_WHS_AREA .panel-group').empty();
  263. var callbackFn = function(result) {
  264. console.log(result);
  265. _this.view(result.gridRows);
  266. };
  267. const param = $('#ITP_FORM_MPOMNG01010_POP_WHS').serializeObject();
  268. fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
  269. },
  270. view: function(gridRows) {
  271. this.rows = gridRows;
  272. $.each(gridRows, function (i, item) {
  273. $('#ITP_LIST_MPOMNG01010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_WHS_ROWCOPY').html());
  274. var $li = $('#ITP_LIST_MPOMNG01010_POP_WHS_AREA .panel-group > .row_2:last');
  275. $li.find('.fnWhsNm').text(item.whsNm);
  276. $li.find('.fnLocationNm').text(item.locationNm);
  277. $li.find('.fnWhsId').data('whs-id', item.whsId);
  278. });
  279. },
  280. action: function() {
  281. var _this = this;
  282. $('#ITP_LIST_MPOMNG01010_POP_WHS_AREA button[id$="POP_WHS_CHOICE"]').off('click').on('click', function() {
  283. var whsId = $(this).data('whs-id');
  284. $.each(_this.rows, function (i, item) {
  285. if(whsId === item.whsId) {
  286. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_ID').val(item.whsId);
  287. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').val(item.whsNm);
  288. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOCATION').val(item.location);
  289. mobPopObj.hide(ID_ITP_POP_MPOMNG01010_WHS_AREA);
  290. itp_fn_form_clear_validate(null, '#ITP_FORM_MPOMNG01010_DETAIL');
  291. return false;
  292. }
  293. });
  294. });
  295. $('#ITP_FORM_MPOMNG01010_POP_WHS button[id="ITP_BTN_MPOMNG01010_POP_WHS_SEARCH"]').off('click').on('click', function() {
  296. _this.search();
  297. });
  298. },
  299. delete: function() {
  300. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_ID').val('');
  301. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').val('');
  302. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOCATION').val('');
  303. }
  304. },
  305. popReqConfirm: {
  306. saveMode: 1, // 1 : 임시저장, 2 : 구매요청, 요청금액이 가능금액보다 클 경우 (3 : PG 정보 없음, 4 : 선불매장, 5 : 후불매장)
  307. init: function (parentId) {
  308. this.formId = '#ITP_FORM_MPOMNG01010_DETAIL';
  309. this.pchReqStCd = (parentId === 'ITP_BTN_MPOMNG01010_DETAIL_REQ_ORDER') ? PCH_REQ_ST_CD_REQUEST_SAVE : PCH_REQ_ST_CD_TEMP_SAVE;
  310. this.view();
  311. this.action();
  312. },
  313. view: function() {
  314. var popMsg = '';
  315. var loanDvsn = $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN').val();
  316. var ordUseAmt = CommonObj.onlyNumber($('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text());
  317. var pchReqAmtTot = CommonObj.onlyNumber($('#ITP_FORM_MPOMNG01010_DETAIL .fnPchReqAmtTot').text());
  318. if(this.pchReqStCd === PCH_REQ_ST_CD_REQUEST_SAVE) { // 구매요청
  319. if(loanDvsn === 'LD03') { // 무정산
  320. this.saveMode = 2;
  321. popMsg = '구매요청 하시겠습니까?';
  322. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('확인');
  323. } else {
  324. if (ordUseAmt < pchReqAmtTot) { // 요청금액이 가능금액보다 클 경우
  325. if($('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_MALL_ID').val() === '') { // PG 정보 없음
  326. this.saveMode = 3;
  327. popMsg = '무통장 입금 후 구매요청해 주세요.<br>' +
  328. '임시저장 하시겠습니까?';
  329. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('확인');
  330. } else {
  331. if(loanDvsn === 'LD01') { // 선불매장
  332. this.saveMode = 4;
  333. popMsg = '선불매장이므로 결재를 하셔야 구매요청이 진행이 됩니다.<br>' +
  334. '결재를 하시겠습니까?';
  335. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('결제');
  336. } else if(loanDvsn === 'LD02') { // 후불매장
  337. this.saveMode = 5;
  338. popMsg = '구매한도가 부족합니다.<br>' +
  339. '선결재를 하신 후에 구매요청을 하시기 바랍니다.<br>' +
  340. '결재를 하시겠습니까?';
  341. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('결제');
  342. }
  343. }
  344. } else {
  345. this.saveMode = 2;
  346. popMsg = '구매요청 하시겠습니까?';
  347. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('확인');
  348. }
  349. }
  350. } else { // 임시저장
  351. this.saveMode = 1;
  352. popMsg = '임시저장 하시겠습니까?';
  353. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('확인');
  354. }
  355. $('#ITP_POP_MPOMNG01010_REQ_AREA .fnPopDlvReqDt').text($('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_DLV_REQ_DT').val());
  356. $('#ITP_POP_MPOMNG01010_REQ_AREA .fnItemQty').text(CommonObj.currency.add(mobContObj.list.rows.length, '개'));
  357. $('#ITP_POP_MPOMNG01010_REQ_AREA .fnOrdAmt').text(CommonObj.currency.add(pchReqAmtTot));
  358. $('#ITP_POP_MPOMNG01010_REQ_AREA .pop_msg').html(popMsg);
  359. },
  360. action: function() {
  361. var _this = this;
  362. $('#ITP_POP_MPOMNG01010_REQ_AREA button[id="ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM"]').off('click').on('click', function() {
  363. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_ST_CD').val(_this.pchReqStCd);
  364. _this.save();
  365. });
  366. },
  367. save: function() {
  368. var procSave = function (rtnFn) {
  369. let param = $('#ITP_FORM_MPOMNG01010_DETAIL').serializeObject();
  370. $.each(mobContObj.list.rows, function(index, item) {
  371. item['viewCd'] = 'C';
  372. });
  373. param.gridInsertData = mobContObj.list.rows;
  374. param['dlvReqDt'] = param.dlvReqDt.replace(/[^0-9]/g, "");
  375. var saveFn = function (result) {
  376. console.log(result);
  377. mobPopObj.hide('ITP_POP_MPOMNG01010_REQ_AREA');
  378. if(typeof rtnFn === 'function') rtnFn();
  379. };
  380. fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), saveFn, 'POST');
  381. };
  382. if (this.saveMode === 1 || this.saveMode === 2 || this.saveMode === 3) {
  383. if(this.saveMode === 3)
  384. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_ST_CD').val(PCH_REQ_ST_CD_TEMP_SAVE);
  385. procSave();
  386. } else if (this.saveMode === 4 || this.saveMode === 5) {
  387. // 결제 팝업 결과
  388. var popFn = function(rowDataPop) {
  389. console.log(JSON.stringify(rowDataPop));
  390. procSave(function(result) { mobContObj.data.load(); });
  391. };
  392. // 결제 팝업
  393. var ordUseAmt = CommonObj.onlyNumber($('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text());
  394. var pchReqAmtTot = CommonObj.onlyNumber($('#ITP_FORM_MPOMNG01010_DETAIL .fnPchReqAmtTot').text());
  395. var args = {
  396. 'payTpCd' : '40',
  397. 'brandId' : $('#ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(),
  398. 'storeId' : $('#ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val(),
  399. 'goodsAmt' : Number(pchReqAmtTot - ordUseAmt)
  400. };
  401. fn_call_popup('biz', 'BIZPOP_PO_PAYMENT', '#ITP_ASIDE', popFn, args, 'M');
  402. // var procPay = function() {
  403. // var payFn = function(result) {
  404. // console.log(result);
  405. // mobContObj.data.load();
  406. // };
  407. // var args = {
  408. // 'payTpCd': this.saveMode === 4 ? '10' : '30',
  409. // 'brandId': $('#ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(),
  410. // 'storeId': $('#ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val()
  411. // };
  412. // itp_fn_payment.call(args, payFn);
  413. // };
  414. // if(this.saveMode === 5) {
  415. // $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_ST_CD').val(PCH_REQ_ST_CD_TEMP_SAVE);
  416. // procSave(procPay);
  417. // } else {
  418. // mobPopObj.hide('ITP_POP_MPOMNG01010_REQ_AREA');
  419. // }
  420. }
  421. }
  422. },
  423. show: function(popId, parentId) {
  424. var _this = this;
  425. $('button[id$="CLOSE"]').off('click').on('click', function() {
  426. var id = $(this).attr('id');
  427. if($(this).hasClass('btn-pop-close')) {
  428. _this.hide(id);
  429. }
  430. });
  431. if(parentId === 'ITP_BTN_MPOMNG01010_DETAIL_REQ_ORDER' || parentId === 'ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE') {
  432. var formId = '#ITP_FORM_MPOMNG01010_DETAIL';
  433. itp_fn_form_clear_validate(null, formId);
  434. if (itp_fn_form_event.isValid(formId)) {
  435. if($('#ITP_LIST_MPOMNG01010_DETAIL_ROWS > li').size() < 1) {
  436. alert('품목추가 버튼을 이용하여 품목을 추가해 주세요.');
  437. return false;
  438. } else {
  439. $('#' + popId).show();
  440. mobPopObj.init(popId, parentId);
  441. }
  442. }
  443. } else {
  444. $('#' + popId).show();
  445. mobPopObj.init(popId, parentId);
  446. }
  447. },
  448. hide: function(id) {
  449. $('#' + id).closest('.mobile-pop-close').hide();
  450. }
  451. };