2 Revīzijas 2cb03d301e ... eb55d00a5f

Autors SHA1 Ziņojums Datums
  juney eb55d00a5f Merge branch 'master' of http://106.246.249.162:13000/orderqueen/oqpo-view 2 gadi atpakaļ
  juney e93817f7d6 모바일 위시리스트 추가 2 gadi atpakaļ

+ 67 - 18
src/main/webapp/mobile/app/mpomng/MPOMNG08010.html

@@ -12,53 +12,103 @@
12 12
 		      <div class="line" style="margin-top:1px;">
13 13
 		        <label style="min-width:100px;">위시리스트명</label>
14 14
 		        <div class="float_left">
15
-		          <select id="ITP_FORM_MPOMNG08010_LIST_PCH_PODR_UNQ_NO" name="spchPodrUnqNo" type="text">
16
-		          	<option>위시리스트 목록</option>
15
+		          <select id="ITP_FORM_MPOMNG08010_LIST_WISH_LIST_MGNT_NO" name="wishlistMgntNo" type="text">
17 16
 		          </select>
18 17
 		        </div>
19
-	            <button style="margin-top:3px; height:26px; padding:0; width:64px;" type="button" id="ITP_BTN_MPOMNG01010_DETAIL_DELROW" class="btn-danger btn-sm ADB">목록추가</button>
18
+	            <button style="margin-top:3px; height:26px; padding:0; width:64px;" type="button" id="ITP_BTN_MPOMNG08010_DETAIL_ADDWISH" class="btn-danger btn-sm ADB" data-call-popup="ITP_POP_MPOMNG08010_WISH_LIST_AREA">추가</button>
20 19
 		      </div>
21 20
 		      <div class="table_btn line">
22
-	            <button type="button" id="ITP_BTN_MPOMNG01010_DETAIL_DELROW" class="btn-danger btn-sm ADB">품목삭제</button>
23
-	            <button type="button" id="ITP_BTN_MPOMNG01010_DETAIL_ADDROW" class="btn-primary btn-sm ADB" data-call-popup="ITP_POP_MPOMNG01010_ITEM_AREA">품목추가</button>
21
+	            <button type="button" id="ITP_BTN_MPOMNG08010_DETAIL_DELROW" class="btn-danger btn-sm ADB">품목삭제</button>
22
+	            <button type="button" id="ITP_BTN_MPOMNG08010_DETAIL_ADDROW" class="btn-primary btn-sm ADB" data-call-popup="ITP_POP_MPOMNG08010_ITEM_AREA">품목추가</button>
24 23
 	          </div>
25 24
 	        </div>
26 25
 	      </div>
27 26
       <div id="ITP_LIST_MPOMNG08010_LIST_ITEM_AREA" class="scroll_area row-6">
28 27
         <ul id="ITP_LIST_MPOMNG08010_LIST_ITEM_ROWS" class="mb_0 panel-group"></ul>
29
-        	<div id="ITP_LIST_MPOMNG08010_LIST_ITEM_ROWCOPY" style="display: block;">
28
+		  <!--   검색된 데이터가 없습니다  -->
29
+		  <div class="itp_non_data" style="display:block;">
30
+			  <div>검색된 데이터가 없습니다.</div>
31
+		  </div>
32
+        	<div id="ITP_LIST_MPOMNG08010_LIST_ITEM_ROWCOPY" style="display: none;">
30 33
 		      <li class="history_list16 item-row">
31
-		      	<div style="position:absolute; top:12px; left:3px;">
32
-					<input style="width:18px;" type="checkbox">
34
+		      	<div style="position:absolute; left:3px;">
35
+					<input style="width:18px;" type="checkbox" name="brandUnitUnqNo" class="fnBrandUnitUnqNo">
36
+					<input type="hidden" name="itemId" class="fnItemId">
33 37
 		      	</div>
34 38
 				<div class="left check">
35 39
 					<div class="nomal">
36 40
 						<label class="col_4">품목명</label>
37 41
 						<span>:</span>
38
-						<div class="full fnItemNm">fasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasd</div>
42
+						<div class="full fnItemNm"></div>
39 43
 					</div>
40 44
 				</div>
41 45
 				<div class="left check">
42 46
 					<div class="nomal">
43 47
 						<label class="col_4">품목번호</label>
44 48
 						<span>:</span>
45
-						<div class="fnDlvMgrNm">fdafasdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsds</div>
49
+						<div class="fnStoreUnitUnqNo"></div>
46 50
 						<label class="col_1">단가</label>
47 51
 						<span>:</span>
48
-						<div class="fnWhsCnfmNm">fasddfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd</div>
52
+						<div class="fnUnitAmt"></div>
49 53
 					</div>
50 54
 				</div>
51 55
 			</li>
52 56
 	      </div>
53 57
 	    </div>
54 58
 	    <div class="button_bar">
55
-	        <button id="ITP_BTN_MPOMNG01010_DETAIL_REQ_ORDER" data-call-popup="ITP_POP_MPOMNG01010_REQ_AREA" class="btn_col_6 btn-m-orange REQ">저장</button>
56
-	        <button id="ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE" data-call-popup="ITP_POP_MPOMNG01010_REQ_AREA" class="btn_col_3 btn-w-gray TSA">취소</button>
59
+	        <button id="ITP_BTN_MPOMNG08010_DETAIL_SAVE" class="btn_col_6 btn-m-orange REQ">저장</button>
60
+	        <button id="ITP_BTN_MPOMNG08010_DETAIL_CANCEL" class="btn_col_3 btn-w-gray TSA">취소</button>
57 61
         </div>
58 62
     </form>
59 63
   </div>
60 64
 	<div id="ITP_MOBILE_JS"></div>
61
-	<div id="ITP_POP_MPOMNG08010_WISH_LIST_AREA" class="popup2 mobile-pop-close" style="display: block;">
65
+	<div id="ITP_POP_MPOMNG08010_ITEM_AREA" class="popup2 mobile-pop-close" style="display: none;">
66
+		<div class="pop">
67
+			<div class="header">
68
+				<div class="header_left">
69
+					<label>품목 검색</label>
70
+				</div>
71
+				<div class="header_right">
72
+					<button type="button" id="ITP_BTN_MPOMNG08010_POP_ITEM_CLOSE" class="btn-pop-close"><img src="../img/close.png"></button>
73
+				</div>
74
+			</div>
75
+			<form id="ITP_FORM_MPOMNG08010_POPUP_ITEM" class="form-horizontal" onsubmit="return false;">
76
+				<input type="hidden" id="ITP_FORM_MPOMNG08010_POPUP_ITEM_BRAND_ID" name="sbrandId" value="">
77
+				<input type="hidden" id="ITP_FORM_MPOMNG08010_POPUP_ITEM_STORE_ID" name="sstoreId" value="">
78
+				<div class="search_bar">
79
+					<input id="ITP_FORM_MPOMNG08010_POP_ITEM_KEYWORD" name="sitemNm" type="text" placeholder="품목명/품목번호" />
80
+					<button id="ITP_BTN_MPOMNG08010_POP_ITEM_SEARCH"><img src="../img/search.png"></button>
81
+				</div>
82
+				<div class="select_btn">
83
+					<button id="ITP_BTN_MPOMNG08010_POP_ITEM_ADD" class="btn_blue">추가</button>
84
+				</div>
85
+			</form>
86
+			<div id="ITP_LIST_MPOMNG08010_POP_ITEM_AREA" class="popup_scroll">
87
+				<ul id="ITP_LIST_MPOMNG08010_POP_ITEM_ROWS" class="mb_0 panel-group"></ul>
88
+				<div id="ITP_LIST_MPOMNG08010_POP_ITEM_ROWCOPY" style="display: none;">
89
+					<li class="row_2 item-row">
90
+						<div class="scroll_left item">
91
+							<div class="con_2 fnItemNm"></div>
92
+							<div class="mg_0">
93
+								<div class="sub fnUnitAmt"></div>
94
+								<div class="type_hide">/</div>
95
+								<div class="amt fnOrdAmt"></div>
96
+							</div>
97
+						</div>
98
+						<div class="right">
99
+							<button id="ITP_BTN_MPOMNG08010_POP_ITEM_MINUS">-</button>
100
+							<input type="number" id="ITP_MPOMNG08010_POP_NUM" class="" value="1" maxlength="5">
101
+							<button id="ITP_BTN_MPOMNG08010_POP_ITEM_PLUS">+</button>
102
+						</div>
103
+						<div class="scroll_right">
104
+							<input id="ITP_FORM_MPOMNG08010_POP_ITEM_ADD" type="checkbox">
105
+						</div>
106
+					</li>
107
+				</div>
108
+			</div>
109
+		</div>
110
+	</div>
111
+	<div id="ITP_POP_MPOMNG08010_WISH_LIST_AREA" class="popup2 mobile-pop-close" style="display: none;">
62 112
 		<div class="pop" style="height:145px;">
63 113
 			<div class="header">
64 114
 				<div class="header_left">
@@ -71,14 +121,13 @@
71 121
 			<div class="search_bar" style="width:100%; margin:0;">
72 122
 				<form id="ITP_FORM_MPOMNG08010_POP_WISH_LIST_SEARCH" class="form-horizontal" onsubmit="return false;">
73 123
 					<label style="float:left; top:5px; position:relative;">위시리스트명</label>
74
-					<input type="hidden" id="ITP_FORM_MPOMNG08010_POP_WISH_LIST_ITEM_BRAND_ID" name="sbrandId" value="">
75
-					<input type="hidden" id="ITP_FORM_MPOMNG08010_POP_WISH_LIST_ITEM_STORE_ID" name="sstoreId" value="">
76
-					<input style="float:right; width:190px; height:26px; left:27px;" id="ITP_FORM_MPOMNG08010_POP_WISH_LIST_KEYWORD" type="text" name="sspplyNm" placeholder="공급업체명">
124
+					<input type="hidden" id="ITP_FORM_MPOMNG08010_POP_WISH_LIST_ITEM_STORE_ID" name="storeId" value="">
125
+					<input style="float:right; width:190px; height:26px; left:27px;" id="ITP_FORM_MPOMNG08010_POP_WISH_LIST_KEYWORD" type="text" name="wishlistNm" placeholder="위시리스트명">
77 126
 				</form>
78 127
 			</div>
79 128
 			<div class="button_bar">
80 129
 				<button type="button" id="ITP_BTN_MPOMNG08010_POP_WISH_LIST_SAVE" class="btn_col_6 btn-m-orange">저장</button>
81
-				<button type="button" id="ITP_BTN_MPOMNG08010_POP_WISH_LIST_CLOSE" class="btn_col_3 btn-w-gray">취소</button>
130
+				<button type="button" id="ITP_BTN_MPOMNG08010_POP_BOTTOM_CLOSE" class="btn_col_3 btn-w-gray">취소</button>
82 131
 			</div>
83 132
 		</div>
84 133
 	</div>

+ 14 - 4
src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG04011.js

@@ -9,6 +9,7 @@ require(['config'], function() {
9 9
 const API_MOBILE_GRID_LIST 			= '/api/pomng/po-streamline-grid-list';	// 목록
10 10
 const API_MOBILE_INFO 				= '/api/pomng/po/info-pchOdr';		// 상세
11 11
 const API_POP_SEARCH_LIST			= '/api/whs/mng/pop-whs-search';
12
+const API_MOBILE_SAVE				= '/api/pomng/po/save-pchSteamlinePo';
12 13
 
13 14
 let mobPageObj = {
14 15
 	init: function () {
@@ -65,10 +66,6 @@ let mobContObj = {
65 66
 			// this.search();
66 67
 		},
67 68
 		search: function() {
68
-			// if($('#ITP_FORM_MPOMNG04011_DETAIL #ITP_FORM_MPOMNG04011_DETAIL_WHS_ID').val() === '') {
69
-			// 	itp_fn_modal_alert('납품장소를 선택하세요.');
70
-			// 	return;
71
-			// }
72 69
 			this.rows.length = 0;
73 70
 			$('#ITP_LIST_MPOMNG04011_DETAIL_ROWS').empty();
74 71
 			setTimeout(function() {
@@ -109,6 +106,19 @@ let mobContObj = {
109 106
 		},
110 107
 		save: function(item) {
111 108
 			console.log(item);
109
+			var callbackFn = function(result) {
110
+				mobContObj.list.search();
111
+			};
112
+			var gridInsertData = [];
113
+			$.each(this.rows, function (i, row) {
114
+				if(item.pchReqUnqNo === row.pchReqUnqNo) {
115
+					gridInsertData.push({ 'pchReqUnqNo' : row.pchReqUnqNo})
116
+				}
117
+			});
118
+			let param = { 'viewCd' :'C', 'brandId' : fn_make_user_info.get('brandId') };
119
+			param['gridInsertData'] = gridInsertData;
120
+			console.log(param);
121
+			fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), callbackFn, 'POST');
112 122
 		}
113 123
 	}
114 124
 };

+ 451 - 0
src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG08010.js

@@ -0,0 +1,451 @@
1
+require(['config'], function() {
2
+	require([
3
+	], function($) {
4
+		mobPageObj.init();
5
+	});
6
+});
7
+
8
+/*API URL*/
9
+const API_POP_ITEM_LIST 				= '/api/item/pop-grid-list';
10
+const API_MOBILE_BARCODE				= '/api/item/info-barcode-item';	// 바코드
11
+const API_MOBILE_WISH_LIST 				= '/api/pomng/select-wishlist';
12
+const API_MOBILE_WISH_LIST_ITEM			= '/api/pomng/select-wishlist-item';
13
+const API_MOBILE_SAVE_WISH_LIST 		= '/api/pomng/save-wishlist';
14
+const API_MOBILE_SAVE_WISH_LIST_ITEM	= '/api/pomng/save-wishlist-item';
15
+
16
+let mobPageObj = {
17
+	isPrevPage: false,
18
+	pageParam: null,
19
+	init: function () {
20
+		this.ui.init();
21
+		this.event.init();
22
+		this.ready();
23
+	},
24
+	ui: {
25
+		init: function () {
26
+			this.info();
27
+		},
28
+		info: function() {
29
+			$('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
30
+			$('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
31
+		}
32
+	},
33
+	event: {
34
+		init: function() {
35
+			this.button();
36
+		},
37
+		button: function() {
38
+			$('button[id^="ITP_BTN_MPOMNG08010_DETAIL"]').on('click', function() {
39
+				if($(this).is('[data-call-popup]')) {
40
+					mobPopObj.show($(this).data('call-popup'), $(this).attr('id'));
41
+				} else {
42
+					var id = $(this).attr('id');
43
+					switch (id) {
44
+						case 'ITP_BTN_MPOMNG08010_DETAIL_DELROW'		: mobContObj.list.delRow(); 		break;
45
+						case 'ITP_BTN_MPOMNG08010_DETAIL_SAVE'			: mobContObj.save(); 				break;
46
+						case 'ITP_BTN_MPOMNG08010_DETAIL_CANCEL'		: mobContObj.cancel();				break;
47
+						case 'ITP_BTN_MPOMNG08010_DETAIL_SCAN'			: mobContObj.barcode.callApp();		break;
48
+					}
49
+				}
50
+				return false;
51
+			});
52
+
53
+		}
54
+	},
55
+	ready: function() {
56
+		mobContObj.init();
57
+	}
58
+};
59
+
60
+let mobContObj = {
61
+	init: function() {
62
+		this.data.init();
63
+	},
64
+	data: {
65
+		init: function() {
66
+			this.action();
67
+			this.load();
68
+		},
69
+		action: function() {
70
+			$('#ITP_FORM_MPOMNG08010_LIST_WISH_LIST_MGNT_NO').on('change', function() {
71
+				var val = $(this).val();
72
+				var changeFn = {
73
+					callBack: function(args) {
74
+						mobContObj.list.rows.length = 0;
75
+						mobContObj.list.originRows.length = 0;
76
+						$('#ITP_LIST_MPOMNG08010_LIST_ITEM_ROWS').children().remove();
77
+						if(val !== '') {
78
+							mobContObj.list.search(val);
79
+						}
80
+					}
81
+				};
82
+				var isChange = false;
83
+				if($('#ITP_LIST_MPOMNG08010_LIST_ITEM_ROWS li').length !== mobContObj.list.originRows.length) {
84
+					isChange = true;
85
+				}
86
+				if(!isChange) {
87
+					$('#ITP_LIST_MPOMNG08010_LIST_ITEM_ROWS li').each(function() {
88
+						var brandUnitUnqNo = $(this).find('.fnBrandUnitUnqNo').val();
89
+						var isExist = mobContObj.list.originRows.some(item => item.brandUnitUnqNo === brandUnitUnqNo);
90
+						if(!isExist) {
91
+							isChange = true;
92
+							return false;
93
+						}
94
+					});
95
+					// $.each(mobContObj.list.originRows, function (i, item) {
96
+					// 	var isExist = false;
97
+					// 	$('#ITP_LIST_MPOMNG08010_LIST_ITEM_ROWS li').each(function() {
98
+					// 		var brandUnitUnqNo = $(this).find('.fnBrandUnitUnqNo').val();
99
+					// 		if(brandUnitUnqNo === item.brandUnitUnqNo) {
100
+					// 			isExist = true;
101
+					// 			return false;
102
+					// 		}
103
+					// 	});
104
+					// 	if(!isExist) {
105
+					// 		isChange = true;
106
+					// 		return false;
107
+					// 	}
108
+					// });
109
+				}
110
+				isChange ? itp_fn_modal_confirm('변경된 작업이 있습니다. 조회하시겠습니까', changeFn) : changeFn.callBack();
111
+			});
112
+		},
113
+		load: function() {
114
+			var callbackFn = function(result) {
115
+				console.log(result);
116
+				if(result.selectRows.length > 0) {
117
+					fn_make_select_wish_list(result.selectRows, 'ITP_FORM_MPOMNG08010_LIST_WISH_LIST_MGNT_NO');
118
+					mobContObj.list.search(result.selectRows[0].wishListMgntNo);
119
+				}
120
+			};
121
+			var param = { 'brandId' : fn_make_user_info.get('brandId'), 'storeId' : fn_make_user_info.get('storeId') };
122
+			fn_ajax_call(API_MOBILE_WISH_LIST, $.param(param), callbackFn, 'GET');
123
+		}
124
+	},
125
+	list: {
126
+		rows: [],
127
+		originRows: [],
128
+		search: function(wishListMgntNo) {
129
+			$('#ITP_LIST_MPOMNG08010_POP_WISH_LIST_ROWS').children().remove();
130
+			var callbackFn = function(result) {
131
+				console.log(result);
132
+				$.merge(mobContObj.list.originRows, result.selectRows);
133
+				mobContObj.list.attachRow(result.selectRows);
134
+			};
135
+			let param = {
136
+				'brandId' : fn_make_user_info.get('brandId'),
137
+				'storeId' : fn_make_user_info.get('storeId'),
138
+				'wishListMgntNo' : wishListMgntNo
139
+			};
140
+			fn_ajax_call(API_MOBILE_WISH_LIST_ITEM, $.param(param), callbackFn, 'GET');
141
+		},
142
+		delRow: function() {
143
+			this.detachRow();
144
+		},
145
+		attachRow: function (items) {
146
+			var _this = this;
147
+			var fnIsNotExist = function(rows, item) {
148
+				var isPushRow = true;
149
+				var isAddItem = true;
150
+				$.each(rows, function(i, row) {
151
+					if(row.brandUnitUnqNo === item.brandUnitUnqNo) {
152
+						if(row.viewCd === 'D') {
153
+							row.viewCd = 'U';
154
+							row.pchReqQty = item.pchReqQty;
155
+						} else {
156
+							isAddItem = false;
157
+						}
158
+						isPushRow = false;
159
+						return false;
160
+					}
161
+				});
162
+				if(isPushRow) mobContObj.list.rows.push(item);
163
+				console.log(isAddItem);
164
+				return isAddItem;
165
+			};
166
+			$.each(items, function(i, item) {
167
+				if(fnIsNotExist(_this.rows, item)) {
168
+					$('#ITP_LIST_MPOMNG08010_LIST_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG08010_LIST_ITEM_ROWCOPY').html());
169
+					var $li = $('#ITP_LIST_MPOMNG08010_LIST_ITEM_AREA .panel-group > .item-row:last');
170
+					$li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
171
+					$li.find('.fnItemId').val(item.itemId);
172
+					$li.find('.fnItemNm').text(item.itemNm);
173
+					$li.find('.fnStoreUnitUnqNo').text(item.storeUnitUnqNo);
174
+					$li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
175
+				}
176
+			});
177
+			this.empty();
178
+		},
179
+		detachRow: function () {
180
+			if($('#ITP_LIST_MPOMNG08010_LIST_ITEM_AREA input:checkbox[name=brandUnitUnqNo]:checked').length > 0) {
181
+				var _this = this;
182
+				$('#ITP_LIST_MPOMNG08010_LIST_ITEM_ROWS li').each(function(index, elem) {
183
+					var __this = this;
184
+					var isChecked = $(this).find('input[type="checkbox"]').is(':checked');
185
+					if(isChecked) {
186
+						if(_this.rows[index].viewCd === 'U') {
187
+							_this.rows[index].viewCd = 'D';
188
+						} else {
189
+							$.each(_this.rows, function(i, row){
190
+								if(row.brandUnitUnqNo === $(__this).find('input[type="checkbox"]').val()) {
191
+									_this.rows.splice(i, 1);
192
+									return false;
193
+								}
194
+							});
195
+						}
196
+						$(this).remove();
197
+					}
198
+				});
199
+			}
200
+			this.empty();
201
+		},
202
+		empty: function() {
203
+			($('#ITP_LIST_MPOMNG08010_LIST_ITEM_ROWS li').length > 0) ? $('.itp_non_data').hide() :  $('.itp_non_data').show();
204
+		}
205
+	},
206
+	cancel: function () {
207
+		$(location).attr('href', MOBILE_CONTEXTPATH + '/app/main.html');
208
+	},
209
+	barcode: {
210
+		callApp: function() {
211
+			location.replace('app:scan');
212
+		}
213
+	},
214
+	addWishList: function(wishList) {
215
+		console.log(wishList);
216
+		fn_make_select_wish_list([wishList], 'ITP_FORM_MPOMNG08010_LIST_WISH_LIST_MGNT_NO');
217
+		$('#ITP_FORM_MPOMNG08010_LIST_WISH_LIST_MGNT_NO').val(wishList.wishListMgntNo);
218
+		$('#ITP_FORM_MPOMNG08010_LIST_WISH_LIST_MGNT_NO').trigger('change');
219
+	},
220
+	save: function () {
221
+		var wishListMgntNo = $('#ITP_FORM_MPOMNG08010_LIST_WISH_LIST_MGNT_NO option:selected').val();
222
+		var wishListMgntNm = $('#ITP_FORM_MPOMNG08010_LIST_WISH_LIST_MGNT_NO option:selected').text();
223
+		if(wishListMgntNo === '') {
224
+			itp_fn_modal_alert('위시리스트를 선택하세요.');
225
+			return;
226
+		}
227
+		var callbackFn = function(result) {
228
+			console.log(result);
229
+			mobContObj.list.search(wishListMgntNo);
230
+		};
231
+		var gridInsertData = [];
232
+		var gridUpdateData = [];
233
+		var gridDeleteData = [];
234
+		$.each(mobContObj.list.rows, function(index, row) {
235
+			var item = {
236
+				'delYn' : 'N',
237
+				'itemId' : row.itemId,
238
+				'itemNm' : row.itemNm
239
+			};
240
+			if(row.viewCd === 'C') {
241
+				gridInsertData.push(item);
242
+			} else if(row.viewCd === 'U') {
243
+				gridUpdateData.push(item);
244
+			} else if(row.viewCd === 'D') {
245
+				gridDeleteData.push(item);
246
+			}
247
+		});
248
+		let param = {
249
+			'viewCd' : 'U',
250
+			'wishListMgntNo' : wishListMgntNo,
251
+			'gridInsertData' : gridInsertData,
252
+			'gridUpdateData' : gridUpdateData,
253
+			'gridDeleteData' : gridDeleteData
254
+		};
255
+		console.log(JSON.stringify(param));
256
+		fn_ajax_call(API_MOBILE_SAVE_WISH_LIST_ITEM, JSON.stringify(param), callbackFn, 'POST');
257
+	}
258
+};
259
+
260
+function appCallFnBarcode(barcode) {
261
+	var infoFn = function(result) {
262
+		// console.log(JSON.stringify(result));
263
+		if(result) {
264
+			mobContObj.list.attachRow([result]);
265
+		}
266
+	};
267
+	const param = {
268
+		'sBrandId': fn_make_user_info.get('brandId'),
269
+		'sStoreId': fn_make_user_info.get('storeId'),
270
+		'sBarcode': barcode
271
+	};
272
+	fn_ajax_call(API_MOBILE_BARCODE, param, infoFn, 'GET');
273
+}
274
+
275
+let mobPopObj = {
276
+	init: function(popId) {
277
+		switch (popId) {
278
+			case 'ITP_POP_MPOMNG08010_ITEM_AREA'		: this.popItem.init();					break;
279
+			case 'ITP_POP_MPOMNG08010_WISH_LIST_AREA'	: this.popWishList.init();				break;
280
+		}
281
+	},
282
+	popItem: {
283
+		// rows: null,
284
+		init: function() {
285
+			$('#ITP_POP_MPOMNG08010_ITEM_AREA #ITP_FORM_MPOMNG08010_POP_ITEM_KEYWORD').val('');
286
+			this.search();
287
+		},
288
+		search: function() {
289
+			$('#ITP_LIST_MPOMNG08010_POP_ITEM_AREA .panel-group').empty();
290
+			var callbackFn = function(result) {
291
+				console.log(result);
292
+				mobPopObj.popItem.rows = result.gridRows;
293
+				$.each(mobPopObj.popItem.rows, function (i, item) {
294
+					$('#ITP_LIST_MPOMNG08010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG08010_POP_ITEM_ROWCOPY').html());
295
+					var $li = $('#ITP_LIST_MPOMNG08010_POP_ITEM_AREA .panel-group > .row_2:last');
296
+					$li.find('#ITP_FORM_MPOMNG08010_POP_ITEM_CHECKBOX').val(item.itemId);
297
+					$li.find('.fnItemNm').text(item.itemNm);
298
+					$li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
299
+					$li.find('.fnOrdAmt').text(CommonObj.currency.add(item.unitAmt));
300
+				});
301
+				mobPopObj.popItem.addRow.init();
302
+			};
303
+			let param = $('#ITP_FORM_MPOMNG08010_POPUP_ITEM').serializeObject();
304
+			fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
305
+		},
306
+		addRow: {
307
+			init: function() {
308
+				this.button.init();
309
+			},
310
+			button: {
311
+				init: function() {
312
+					var _this = this;
313
+					$('button[id^="ITP_BTN_MPOMNG08010_POP_ITEM_"]').off('click').on('click', function() {
314
+						var id = $(this).attr('id');
315
+						switch (id) {
316
+							case 'ITP_BTN_MPOMNG08010_POP_ITEM_PLUS'	: _this.actPlus($(this)); 		break;
317
+							case 'ITP_BTN_MPOMNG08010_POP_ITEM_MINUS'	: _this.actMinus($(this)); 		break;
318
+							case 'ITP_BTN_MPOMNG08010_POP_ITEM_ADD'		: _this.addItems(); 			break;
319
+							// case 'ITP_BTN_MPOMNG08010_POP_ITEM_ADD'		: _this.actItemAdd($(this)); 	break;
320
+							case 'ITP_BTN_MPOMNG08010_POP_ITEM_SEARCH'	: mobPopObj.popItem.search(); 	break;
321
+							case 'ITP_BTN_MPOMNG08010_POP_ITEM_CLOSE'	: mobPopObj.hide(id); 			break;
322
+						}
323
+						return false;
324
+					});
325
+					$('input[id="ITP_MPOMNG08010_POP_NUM"]').off('input').on('input', function() {
326
+						var _this = this;
327
+						CommonObj.chkMaxLength(this, function(qty) { mobPopObj.popItem.addRow.button.reqAmtUnit(_this, qty) });
328
+					});
329
+				},
330
+				actPlus: function(elem) {
331
+					var elQty = $(elem).prev();
332
+					var num = Number($(elQty).val());
333
+					if(num < 100000) {
334
+						var calcNum = num + 1;
335
+						$(elQty).val(calcNum.toString());
336
+						this.reqAmtUnit(elem, calcNum);
337
+					}
338
+				},
339
+				actMinus: function(elem) {
340
+					var elQty = $(elem).next();
341
+					var num = Number($(elQty).val());
342
+					if(num > 1) {
343
+						var calcNum = num - 1;
344
+						$(elQty).val(calcNum.toString());
345
+						this.reqAmtUnit(elem, calcNum);
346
+					}
347
+				},
348
+				reqAmtUnit: function(elem, qty) {
349
+					var $li = $(elem).closest('li');
350
+					var unitAmt = CommonObj.onlyNumber($li.find('.fnUnitAmt').text());
351
+					$li.find('.fnOrdAmt').text(CommonObj.currency.add(Number(unitAmt ? unitAmt : 0) * Number(qty)));
352
+				},
353
+				actItemAdd: function(elem) {
354
+					var $li = $(elem).closest('li');
355
+					var item = mobPopObj.popItem.rows[$li.index()];
356
+					item['pchReqQty'] = $li.find('.fnPchReqQty').html();
357
+					// var index = $(elem).closest('li').index();
358
+					// var item = mobPopObj.popItem.rows[index];
359
+					// item['pchReqQty'] = $(elem).closest('li').find('.fnPchReqQty').html();
360
+					mobContObj.list.attachRow(item);
361
+				},
362
+				addItems: function() {
363
+					var items = [];
364
+					var chkMsg = '';
365
+					$('#ITP_LIST_MPOMNG08010_POP_ITEM_ROWS').find('input:checkbox').each(function() {
366
+						if($(this).is(':checked')) {
367
+							var val = $(this).closest('li').find('#ITP_MPOMNG08010_POP_NUM').val();
368
+							if(val === '') {
369
+								chkMsg = '수량을 입력하세요.';
370
+								return false;
371
+							}
372
+							var index = $(this).closest('li').index();
373
+							var item = mobPopObj.popItem.rows[index];
374
+							item['viewCd'] = 'C';
375
+							item['pchReqQty'] = val;
376
+							items.push(item);
377
+						}
378
+					});
379
+					if(chkMsg !== '') {
380
+						itp_fn_modal_alert(chkMsg);
381
+						return;
382
+					}
383
+					if(items.length < 1) {
384
+						itp_fn_modal_alert('품목을 선택하세요.');
385
+						return;
386
+					}
387
+					mobContObj.list.attachRow(items);
388
+					mobPopObj.popItem.close();
389
+				}
390
+			}
391
+		},
392
+		delRow: function() {
393
+
394
+		},
395
+		close: function() {
396
+			this.rows.length = 0;
397
+			$('#ITP_LIST_MPOMNG08010_POP_ITEM_ROWS').children().remove();
398
+			mobPopObj.hide('ITP_POP_MPOMNG08010_ITEM_AREA');
399
+		}
400
+	},
401
+	popWishList: {
402
+		listPage: 1,
403
+		init: function () {
404
+			$('#ITP_FORM_MPOMNG08010_POP_WISH_LIST_KEYWORD').val('');
405
+			this.action();
406
+		},
407
+		action: function() {
408
+			var _this = this;
409
+			$('#ITP_BTN_MPOMNG08010_POP_WISH_LIST_SAVE').off('click').on('click', function() {
410
+				_this.save();
411
+			});
412
+			$('#ITP_POP_MPOMNG08010_WISH_LIST_AREA button[id$="_CLOSE"]').off('click').on('click', function() {
413
+				$('#ITP_POP_MPOMNG08010_WISH_LIST_AREA').hide();
414
+			});
415
+		},
416
+		save: function() {
417
+			var wishListNm = $('#ITP_FORM_MPOMNG08010_POP_WISH_LIST_KEYWORD').val();
418
+			if(wishListNm === '') {
419
+				itp_fn_modal_alert('위시리스트명을 입력해 주세요.');
420
+				return;
421
+			}
422
+			var callbackFn = function(result) {
423
+				console.log(result);
424
+				var wishList = { 'wishListMgntNo':result.wishlistMgntNo, 'wishListNm':wishlistNm };
425
+				mobContObj.addWishList(wishList);
426
+				$('#ITP_POP_MPOMNG08010_WISH_LIST_AREA').hide();
427
+			};
428
+			let param = {
429
+				'delYn' : 'N',
430
+				'storeId' : fn_make_user_info.get('storeId'),
431
+				'wishListNm' : wishListNm
432
+			};
433
+			console.log( $.param(param));
434
+			fn_ajax_call(API_MOBILE_SAVE_WISH_LIST, $.param(param), callbackFn, 'GET');
435
+		}
436
+	},
437
+	show: function(popId, parentId) {
438
+		var _this = this;
439
+		$('button[id$="CLOSE"]').off('click').on('click', function() {
440
+			var id = $(this).attr('id');
441
+			if($(this).hasClass('btn-pop-close')) {
442
+				_this.hide(id);
443
+			}
444
+		});
445
+		$('#' + popId).show();
446
+		mobPopObj.init(popId, parentId);
447
+	},
448
+	hide: function(id) {
449
+		$('#' + id).closest('.mobile-pop-close').hide();
450
+	}
451
+};

+ 14 - 0
src/main/webapp/mobile/js/app/mrtnmng/ITP_MRTNMNG04011.js

@@ -9,6 +9,7 @@ require(['config'], function() {
9 9
 const API_MOBILE_GRID_LIST 			= '/api/rtnmng/rtn-streamline-grid-list';	// 목록
10 10
 const API_MOBILE_INFO 				= '/api/pomng/po/info-pchOdr';		// 상세
11 11
 const API_POP_SEARCH_LIST			= '/api/whs/mng/pop-whs-search';
12
+const API_MOBILE_SAVE				= '/api/rtnmng/rtn/save-rtnSteamlinePo';
12 13
 
13 14
 let mobPageObj = {
14 15
 	init: function () {
@@ -103,6 +104,19 @@ let mobContObj = {
103 104
 		},
104 105
 		save: function(item) {
105 106
 			console.log(item);
107
+			var callbackFn = function(result) {
108
+				mobContObj.list.search();
109
+			};
110
+			var gridInsertData = [];
111
+			$.each(this.rows, function (i, row) {
112
+				if(item.rtnReqUnqNo === row.rtnReqUnqNo) {
113
+					gridInsertData.push({ 'rtnReqUnqNo' : row.rtnReqUnqNo})
114
+				}
115
+			});
116
+			let param = { 'viewCd' :'C', 'brandId' : fn_make_user_info.get('brandId') };
117
+			param['gridInsertData'] = gridInsertData;
118
+			console.log(param);
119
+			fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), callbackFn, 'POST');
106 120
 		}
107 121
 	}
108 122
 };