Parcourir la source

모바일 구매요청 위시리스트 추가

juney il y a 2 ans
Parent
commit
2ac99dd92e

+ 1 - 0
src/main/webapp/mobile/js/app/main.js

@@ -50,6 +50,7 @@ var mobMainObj = {
50 50
 		var _this = this;
51 51
 		var getURL = function(id) {
52 52
 			var rtnURL = '';
53
+			console.log(id);
53 54
 			$.each(AUTH_MENU_LIST, function(key, value) {
54 55
 				if(value.menuId === id) {
55 56
 					rtnURL = value.connUrl;

+ 39 - 14
src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG01010.js

@@ -6,11 +6,13 @@ require(['config'], function() {
6 6
 });
7 7
 
8 8
 /*API URL*/
9
-const API_MOBILE_INIT_INFO	= '/api/pomng/init-pchReq';
10
-const API_MOBILE_SAVE		= '/api/pomng/save-pchReq';
11
-const API_POP_SEARCH_LIST	= '/api/whs/mng/pop-whs-search';
12
-const API_POP_ITEM_LIST 	= '/api/item/pop-grid-list';
13
-const API_MOBILE_BARCODE	= '/api/item/info-barcode-item';	// 바코드
9
+const API_MOBILE_INIT_INFO		= '/api/pomng/init-pchReq';
10
+const API_MOBILE_SAVE			= '/api/pomng/save-pchReq';
11
+const API_POP_SEARCH_LIST		= '/api/whs/mng/pop-whs-search';
12
+const API_POP_ITEM_LIST 		= '/api/item/pop-grid-list';
13
+const API_MOBILE_BARCODE		= '/api/item/info-barcode-item';	// 바코드
14
+const API_POP_WISH_LIST 		= '/api/item/wish-list';
15
+const API_POP_SEARCH_WISH_LIST 	= '/api/item/pop-grid-wishlist';
14 16
 
15 17
 const ID_ITP_POP_MPOMNG01010_REQ_AREA 	= "ITP_POP_MPOMNG01010_REQ_AREA";
16 18
 const ID_ITP_POP_MPOMNG01010_WHS_AREA 	= "ITP_POP_MPOMNG01010_WHS_AREA";
@@ -38,6 +40,7 @@ let mobPageObj = {
38 40
 			$('#ITP_MOBILE_MPOMNG01010 .itp_input.date').datepicker(ITP_DATE_LANGUAGE);
39 41
 			$('#ITP_FORM_MPOMNG01010_DETAIL_DLV_REQ_DT').datepicker('setDate', itp_fn_date_add('D', 5));
40 42
 
43
+			(fn_make_user_info.get('authTpCd') === '50') ? $('#ITP_BTN_MPOMNG01010_DETAIL_WISH').show() : $('#ITP_BTN_MPOMNG01010_DETAIL_WISH').hide();
41 44
 			// if(fn_make_user_info.get('authTpCd') === '50') {
42 45
 			// 	$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').attr('readonly', true);
43 46
 			// 	$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_BTN_MPOMNG01010_DETAIL_SEARCH_WHS_NM').attr('disabled', true);
@@ -376,28 +379,49 @@ let mobPopObj = {
376 379
 		}
377 380
 	},
378 381
 	popWishList: {
379
-		rows: [],
382
+		listPage: 1,
380 383
 		init: function () {
381 384
 			this.clear();
385
+			this.action();
382 386
 			this.load();
383 387
 		},
388
+		action: function() {
389
+			var _this = this;
390
+			$('#ITP_FORM_MPOMNG01010_POP_WISH_LIST_KEYWORD').on('change', function() {
391
+				if($(this).val() === '') {
392
+					_this.rows.length = 0;
393
+					$('#ITP_LIST_MPOMNG01010_POP_WISH_LIST_ROWS').children().remove();
394
+				} else {
395
+					_this.search($(this).val());
396
+				}
397
+			});
398
+			$('#ITP_BTN_MPOMNG01010_POP_WISH_LIST_ADD').off('click').on('click', function() {
399
+				_this.list.addItems();
400
+			});
401
+		},
384 402
 		load: function() {
385 403
 			var callbackFn = function(result) {
386 404
 				console.log(result);
405
+				fn_make_select_wish_list(result.wishList, 'ITP_FORM_MPOMNG01010_POP_WISH_LIST_KEYWORD', true, '선택');
387 406
 			};
388
-			let param = $('#ITP_FORM_MPOMNG01010_POPUP_ITEM').serializeObject();
389
-			fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
407
+			let param = { 'sStoreId' : fn_make_user_info.get('storeId') };
408
+			fn_ajax_call(API_POP_WISH_LIST, $.param(param), callbackFn, 'GET');
390 409
 		},
391
-		search: function() {
410
+		search: function(swishListMgntNo) {
392 411
 			$('#ITP_LIST_MPOMNG01010_POP_WISH_LIST_ROWS').children().remove();
393 412
 			var callbackFn = function(result) {
394 413
 				console.log(result);
395 414
 				mobPopObj.popWishList.list.addRows(result.gridRows);
396 415
 			};
397
-			let param = $('#ITP_FORM_MPOMNG01010_POPUP_ITEM').serializeObject();
398
-			fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
416
+			let param = {
417
+				'sbrandId' : fn_make_user_info.get('brandId'),
418
+				'sstoreId' : fn_make_user_info.get('storeId'),
419
+				'swishListMgntNo' : swishListMgntNo
420
+			};
421
+			fn_ajax_call(API_POP_SEARCH_WISH_LIST, JSON.stringify(param), callbackFn, 'POST');
399 422
 		},
400 423
 		list: {
424
+			rows: [],
401 425
 			addRows: function(rows) {
402 426
 				var _this = this;
403 427
 				$.each(rows, function (i, item) {
@@ -437,6 +461,7 @@ let mobPopObj = {
437 461
 				$li.find('.fnOrdAmt').text(CommonObj.currency.add(Number(unitAmt ? unitAmt : 0) * Number(qty)));
438 462
 			},
439 463
 			addItems: function() {
464
+				var _this = this;
440 465
 				var items = [];
441 466
 				var chkMsg = '';
442 467
 				$('#ITP_LIST_MPOMNG01010_POP_WISH_LIST_ROWS').find('input:checkbox').each(function() {
@@ -447,7 +472,7 @@ let mobPopObj = {
447 472
 							return false;
448 473
 						}
449 474
 						var index = $(this).closest('li').index();
450
-						var item = mobPopObj.popWishList.rows[index];
475
+						var item = _this.rows[index];
451 476
 						item['pchReqQty'] = val;
452 477
 						items.push(item);
453 478
 					}
@@ -461,11 +486,11 @@ let mobPopObj = {
461 486
 					return;
462 487
 				}
463 488
 				mobContObj.list.attachRow(items);
464
-				mobPopObj.hide(id);
489
+				mobPopObj.hide('ITP_POP_MPOMNG01010_WISH_LIST_AREA');
465 490
 			}
466 491
 		},
467 492
 		clear: function() {
468
-			this.rows.length = 0;
493
+			this.list.rows.length = 0;
469 494
 			$('#ITP_FORM_MPOMNG01010_POP_WISH_LIST_KEYWORD option').remove();
470 495
 			$('#ITP_LIST_MPOMNG01010_POP_WISH_LIST_ROWS').children().remove();
471 496
 		}

+ 14 - 0
src/main/webapp/mobile/js/config.js

@@ -366,6 +366,20 @@ function fn_make_select_location(options, select_id, all_show_yn, all_name) { //
366 366
 	});
367 367
 };
368 368
 
369
+function fn_make_select_wish_list(options, select_id, all_show_yn, all_name) { //위시리스트 셀렉트 박스 만들기
370
+	$select_id = $('#' + select_id);
371
+	$select_id.empty();
372
+	if(all_show_yn == true) {
373
+		$('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
374
+	}
375
+	$.each(options, function(key, value) {
376
+		$('<option/>', {
377
+			'value': value.wishListMgntNo,	// 위시리스트번호
378
+			'text': value.wishListNm	// 위시리스트명
379
+		}).appendTo($select_id);
380
+	});
381
+};
382
+
369 383
 function fnHashed(code) { //유니코드로 들어오는 해쉬키를 스트링으로 변환
370 384
 	return decodeURIComponent(JSON.parse('"' + code.replace(/\"/g, '\\"') + '"'));
371 385
 }