ITP_MPOMNG01010.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. let mobPageObj = {
  13. init: function () {
  14. this.ui.init();
  15. this.event.init();
  16. this.ready();
  17. },
  18. ui: {
  19. init: function () {
  20. this.info();
  21. },
  22. info: function() {
  23. $('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
  24. $('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
  25. }
  26. },
  27. event: {
  28. init: function() {
  29. this.button();
  30. },
  31. button: function() {
  32. $('button[id^="ITP_BTN_MPOMNG01010_DETAIL"]').on('click', function() {
  33. if($(this).is('[data-call-popup]')) {
  34. mobPopObj.show($(this).data('call-popup'));
  35. } else {
  36. var id = $(this).attr('id');
  37. switch (id) {
  38. case 'ITP_BTN_MPOMNG01010_DETAIL_ADDROW': contPopObj.list.addRow(); break;
  39. case 'ITP_BTN_MPOMNG01010_DETAIL_DELROW': contPopObj.list.delRow(); break;
  40. case 'ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM': break;
  41. case 'ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE': break;
  42. case 'ITP_BTN_MPOMNG01010_DETAIL_CANCEL':break;
  43. }
  44. }
  45. return false;
  46. });
  47. }
  48. },
  49. ready: function() {
  50. contPopObj.init();
  51. }
  52. };
  53. let contPopObj = {
  54. init: function() {
  55. this.data.load();
  56. },
  57. data: {
  58. initPchReq: null,
  59. load: function() {
  60. var _this = this;
  61. var callbackFn = function(result) {
  62. _this.initPchReq = result;
  63. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(result.brandId);
  64. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val(result.storeId);
  65. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
  66. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
  67. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
  68. $('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text(itp_fn_set_comma(result.ordUseAmt) + '원');
  69. };
  70. const key = {brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId')};
  71. fn_ajax_call(API_MOBILE_INIT_INFO, key, callbackFn, 'GET');
  72. }
  73. },
  74. list: {
  75. addRow: function() {
  76. var _this = this;
  77. var callbackFn = function(result) {
  78. mobPopObj.addRow.init(result);
  79. };
  80. let param = $('#ITP_FORM_MPOMNG01010_POPUP_ITEM').serializeObject();
  81. param.gridSize = 10;
  82. fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
  83. },
  84. delRow: function() {
  85. }
  86. }
  87. };
  88. let mobPopObj = {
  89. addRow: {
  90. rows: [],
  91. init: function(rows) {
  92. this.rows = rows;
  93. mobPopObj.show('ITP_POP_MPOMNG01010_ITEM_NM');
  94. this.view();
  95. },
  96. view: function() {
  97. $.each(this.rows, function (i, item) {
  98. $('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWS').append($('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY').html());
  99. var li = $('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWS .panel-group > .row_2:last');
  100. $(li).find('#ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
  101. $(li).find('.fnItemNm').text(item.itemNm);
  102. $(li).data('brandUnitUnqNo', item.brandUnitUnqNo);
  103. $(li).data('podrPssblDvsn', item.podrPssblDvsn);
  104. $(li).data('spplyId', item.spplyId);
  105. $(li).data('stddQty', item.stddQty);
  106. $(li).data('storeUnitUnqNo', item.storeUnitUnqNo);
  107. $(li).data('unit', item.unit);
  108. $(li).data('unitAmt', item.unitAmt);
  109. $(li).data('unitGubun', item.unitGubun);
  110. });
  111. },
  112. search: function() {
  113. },
  114. choice: function() {
  115. }
  116. },
  117. show: function(id, args, fn) {
  118. this.button();
  119. $('#' + id).show();
  120. },
  121. button: function() {
  122. var _this = this;
  123. $('button[id^="ITP_BTN_MPOMNG01010_POP"]').off('click').on('click', function() {
  124. var id = $(this).attr('id');
  125. if($(this).hasClass('btn-pop-close')) {
  126. _this.hide(id);
  127. return;
  128. }
  129. switch (id) {
  130. case 'ITP_BTN_MPOMNG01010_POP_CONFIRM': break;
  131. case 'ITP_BTN_MPOMNG01010_POP_SEARCH':
  132. break;
  133. }
  134. return false;
  135. });
  136. },
  137. hide: function(id) {
  138. $('#' + id).closest('.mobile-pop-close').hide();
  139. }
  140. };