<?//로그인확인
include_once $_SERVER[DOCUMENT_ROOT] . "/module/member/auth.php";

//DB연결
$dblink = SetConn($_conf_db["main_db"]);

$arrMyInfo = getUserInfo($_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"]); //회원정보

$arrOrderList = getOrderList($_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"], 5, 0);  //구매정보

$arrWishList = getWishList($_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"], 4, 0);	 //찜목록

$arrList = getCartList($_SESSION[$_SITE["DOMAIN"]]["SESSIONID"], $_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"],$tp); //장바구니

$nowPoint = getNowPoint($_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"]); //포인트

$totalOrder = getMyOrderTotal($_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"]);
?>

<div class="location">
    	<p><img src="../images/home.gif" alt="" /> HOME &gt; 마이페이지</p>
    </div>

	<? include $_SERVER[DOCUMENT_ROOT] . "/include/menu_mypage.php"; ?>
    
    <div id="contents">
    	<div id="mypageInfoArea">
        	<div class="memberInfo">
            	<p><strong><?=$_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["NAME"]?> 회원님</strong> 오피스픽을 방문해주셔서 감사합니다. 오늘도 좋은 하루 되세요~</p>
                <p>
                	<img src="../images/member/dot.gif" alt="" /> <strong>연락처</strong> : <?=$arrMyInfo["list"][0]["phone"]?><br />
                    <img src="../images/member/dot.gif" alt="" /> <strong>기본배송지 주소</strong> : (<?=$arrMyInfo["list"][0]["zip"]?>) <?=$arrMyInfo["list"][0]["address"]?> <?=$arrMyInfo["list"][0]["address_ext"]?>
                </p>
                <p><a href="javascript:GoMenu('myinfo');"><img src="../images/member/btn_myinfo.gif" alt="회원정보 수정" /></a></p>
            </div>
            <div class="total_price">
            	<span class="hide"><strong>나의 총 구매금액은?</strong></span> <strong><?=number_format($totalOrder['list'][pay_amount])?>원</strong>
            </div>
            <div class="mypageInfo">
            	<p class="mypageInfo1">
                	<span class="hide"><strong>회원구분</strong></span> <strong>개인회원</strong>
                </p>
                <p class="mypageInfo2">
                	<span class="hide"><strong>이달의 회원등급</strong></span> <strong>일반회원</strong>
                </p>
                <p class="mypageInfo3">
                	<span class="hide"><strong>나의 포인트 현황</strong></span> <strong><?=number_format($nowPoint[nowpoint])?>원</strong>
                </p>
            </div>
        </div>
        
        
        
        
    	<h4 class="mgb5"><img src="../images/member/mypage_tt1.gif" alt="최근 주문정보" /></h4>
        <div class="OrderTable">
            <table>
                <thead>
                    <tr>
                        <th>주문일자</th>
                        <th>상품명</th>
                        <th>주문총액</th>
                        <th>결제수단</th>
                        <th>주문상태</th>
                        <th>송장번호</th>
                        <!-- <th>주문취소</th> -->
                    </tr>
                </thead>
                <tbody>
                    <?
					if($arrOrderList["total"]>0){
						for($i=0;$i<$arrOrderList["list"]["total"];$i++){
							//합계금액 계산
							$totalPrice = $arrOrderList["list"][$i][total_amount]+$arrOrderList["list"][$i][ship_amount];
					?>
					<tr>
                        <td><?=substr($arrOrderList["list"][$i][order_date],0,10)?></td>
                        <td><p class="prd_tit"><a href="/shop.php?goPage=OrderInfo&order_no=<?=$arrOrderList["list"][$i][order_no]?>&listURL=<?=urlencode($_SERVER[REQUEST_URI])?>"><?=stripslashes($arrOrderList["list"][$i][order_summary])?></a></p></td>
                        <td><p class="prd_price"><?=number_format($arrOrderList["list"][$i][total_amount])?>원</p></td>
                        <td><?=$_SITE["SHOP"]["PAY_TYPE"][$arrOrderList["list"][$i][pay_type]]?></td>
                        <td><?=$_SITE["SHOP"]["ORDER_STATE"][$arrOrderList["list"][$i][order_state]]?></td>
                        <td><p class="prd_num"><a href="#">376665241</a></p></td>
                        <!-- <td><img src="../images/member/icon_x.gif" alt="X" /></td> -->
                    </tr>
                    <?	
						}
					?>
					<?
					}else{
					?>
					<tr height="100">
						<td colspan="7" align="center">주문내역이 없습니다.</td>
					</tr>
					<?}?>
                </tbody>
            </table>
        </div>
        
        
        
        
        
        <h4 class="mgb5"><img src="../images/member/mypage_tt2.gif" alt="관심상품정보" /></h4>
        <div class="mypageInterest">
        <!-- // 장바구니상품 -->
        <div id="interestProduct1">
            <ul class="interestTab">
                <li><img src="../images/member/mypage_tab1_on.gif" alt="장바구니 상품" onmouseover="interestProduct(1);" class="pointer" /></li>
                <li><img src="../images/member/mypage_tab2_off.gif" alt="찜한 상품" onmouseover="interestProduct(2);" class="pointer" /></li>
                <li><img src="../images/member/mypage_tab3_off.gif" alt="최근 본 상품" onmouseover="interestProduct(3);" class="pointer" /></li>
            </ul>
            <div id="interestList">
                <ul>
                    <?
					if($arrList["total"]>0){
						for($i=0;$i<$arrList["total"];$i++){
					?>
					<li>
                        <a href="<?=$_SERVER[PHP_SELF]?>?goPage=GoodDetail&g_code=<?=$arrList["list"][$i][g_code]?>">
                        <p><img src="/uploaded/shop_good/<?=$arrList["list"][$i][idx]?>/<?=$arrList["list"][$i][image_s]?>" width="120" height="120" alt="" /></p>
                        <p><strong>[<?=stripslashes($arrList["list"][$i][vendor])?>]</strong></p>
                        <p><?=stripslashes($arrList["list"][$i][g_name])?></p>
                        <p class="price"><?=number_format($arrList["list"][$i][price])?>원</p>
                        </a>
                    </li>
                    <?	
						}
					}else{
					?>
					<li>장바구니가 비었습니다.</li>
					<?}?>	
                </ul>
            </div>

        </div>
        <!-- 장바구니 상품 // -->
        
        <!-- // 찜한 상품 -->
        <div id="interestProduct2" style="display:none;">
            <ul class="interestTab">
                <li><img src="../images/member/mypage_tab1_off2.gif" alt="장바구니 상품" onmouseover="interestProduct(1);" class="pointer" /></li>
                <li><img src="../images/member/mypage_tab2_on.gif" alt="찜한 상품" onmouseover="interestProduct(2);" class="pointer" /></li>
                <li><img src="../images/member/mypage_tab3_off.gif" alt="최근 본 상품" onmouseover="interestProduct(3);" class="pointer" /></li>
            </ul>
            <div id="interestList">
                <ul>
                    <?
					if($arrWishList["total"]>0){
						for($i=0;$i<$arrWishList["list"]["total"];$i++){
					?>
					<li>
                        <a href="/shop.php?goPage=GoodDetail&g_code=<?=$arrWishList["list"][$i][g_code]?>">
                        <p><img src="/uploaded/shop_good/<?=$arrWishList["list"][$i][idx]?>/<?=$arrWishList["list"][$i][image_s]?>" width="120" height="120" alt="" /></p>
                        <p><strong>[<?=stripslashes($arrWishList["list"][$i][vendor])?>]</strong></p>
                        <p><?=stripslashes($arrWishList["list"][$i][g_name])?></p>
                        <p class="price"><?=number_format($arrWishList["list"][$i][price])?>원</p>
                        </a>
                    </li>
                    <?	
						}
					?>
					<?
					}else{
					?>
					<li>관심상품이 없습니다.</li>
					<?}?>
                </ul>
            </div>
        </div>
        <!-- 찜한 상품 // -->
        
        <!-- // 최근 본 상품 -->
        <div id="interestProduct3" style="display:none;">
            <ul class="interestTab">
                <li><img src="../images/member/mypage_tab1_off.gif" alt="장바구니 상품" onmouseover="interestProduct(1);" class="pointer" /></li>
                <li><img src="../images/member/mypage_tab2_off2.gif" alt="찜한 상품" onmouseover="interestProduct(2);" class="pointer" /></li>
                <li><img src="../images/member/mypage_tab3_on.gif" alt="최근 본 상품" onmouseover="interestProduct(3);" class="pointer" /></li>
            </ul>
            <div id="interestList">
                <ul>
                    <?
					if(is_array($_SESSION[$_SITE["DOMAIN"]]["SHOP"]["VIEW"])){
					foreach($_SESSION[$_SITE["DOMAIN"]]["SHOP"]["VIEW"] AS $key => $val){
						$arrInfo = getGoodInfo(mysql_real_escape_string($val[0]));
					?>
					<li>
                        <a href="/shop.php?goPage=GoodDetail&idx=<?=$val[0]?>">
                        <p><img src="/uploaded/shop_good/<?=$val[0]?>/<?=$val[1]?>" width="120" height="120" alt="" /></p>
                        <p><strong>[<?=stripslashes($arrInfo["list"][0][vendor])?>]</strong></p>
                        <p><?=stripslashes($arrInfo["list"][0][g_name])?></p>
                        <p class="price"><?=number_format($arrInfo["list"][0][price])?>원</p>
                        </a>
                    </li>
                    <?} } else {?>
					<li>최근 본 상품이 없습니다.</li>
					<?}
					//DB해제
					SetDisConn($dblink);
					?>
                </ul>
            </div>
        </div>
        <!-- 최근 본 상품 // -->
    </div>

