<?php (!defined('IN_ADMIN') || !defined('IN_MUDDER')) && exit('Access Denied'); ?>
<script type="text/javascript">
var cardsort = new Array();
cardsort[0] = 'discount';
cardsort[1] = 'largess';

function selectdiscount(sort) {
	for(i=0;i<cardsort.length;i++) {
		if(sort == cardsort[i] || sort == 'both') {
			document.getElementById(cardsort[i]).style.display = "";
		} else {
			document.getElementById(cardsort[i]).style.display = "none";
		}
	}
}
window.onload = function(){
    document.getElementById('classcode').value = "<?=$shop['classcode']?>";
    document.getElementById('areacode').value = "<?=$shop['areacode']?>";
	<? if($action != 'upshopinfo' && $_membercard['enable'] && $shop['cardsort']) { ?>
		selectdiscount("<?=$shop['cardsort']?>");
	<? } ?>
}
</script>
<div id="body">
<form method="post" action="admincp.php?action=<?=$action?>&file=<?=$file?>&op=<?=$op?>&">
    <input type="hidden" name="shopid" value="<?=$shopid?>" />
    <?if($shop['uid']){?>
    <input type="hidden" name="uid" value="<?=$shop['uid']?>" />
    <?}?>
    <?if($op == 'itemupdate'){?>
    <input type="hidden" name="upid" value="<?=$upid?>" />
    <?}?>
    <div class="space">
        <?if($op == 'itemupdate'){?>
        <div class="subtitle">补充商铺信息</div>
        <?}else{?>
        <div class="subtitle">审核新增商铺</div>
        <?}?>
        <table class="maintable" border="0" cellspacing="0" cellpadding="0">
            <? if($op == 'itemupdate') { ?>
            <tr>
                <td class="altbg1" width="20%">补充类型:</td>
                <td><strong><?if($shop['upmappoint']){?>地图报错<?}else{?>信息补充<?}?></strong>&nbsp;&nbsp;[<span class="font_1"><?if($shop['disposal']==1){?>已处理<span class="font_2"><?=$shop['disposaltime']?></span><?}else{?>未处理<?}?></span>]</td>
            </tr>
            <?if($shop['uid'] && $shop['username']){?>
            <tr>
                <td class="altbg1">用户:</td>
                <td>
                    <input type="checkbox" name="addpoint" value="updateshop" checked="checked" /> 给会员 <strong><a href=<?=$_modules['space']['url']?>"index.php?suid=<?=$shop['uid']?>" target="_blank"><?=$shop['username']?></a></strong> 增加商铺更新积分
                    <?if($shop['disposal']==1){?>(<span class="font_2">本条补充信息已处理，可能已经给会员增加了积分</span>)<?}?>
                </td>
            </tr>
            <?}?>
            <?if($shop['upmappoint']){?>
            <tr>
                <td class="altbg1" valign="top">地图坐标:</td>
                <td><input type="text" name="upmappoint" value="<?=$shop['upmappoint']?>" class="txtbox" />&nbsp;&nbsp;<a href="#">查看具体位置</a><br />注意: 提交本表单，不会修改此处内容。</td>
            </tr>
            <?}?>
            <tr>
                <td width="20%" class="altbg1" valign="top">补充内容:</td>
                <td width="80%"><textarea name="upcontent" class="txtarea" rows="5" cols="55"><?=$shop['upcontent']?></textarea><br />注意: 提交本表单，不会修改此处内容。</td>
            </tr>
            <tr>
                <td class="altbg1" valign="top">更新备注:<br />管理员处理本条信息的备注。</td>
                <td><textarea name="upremark" class="txtarea"  rows="3" cols="55"><?=$shop['upremark']?></textarea></td>
            </tr>
            <tr>
                <td colspan="2" class="altbg2">以上内容为会员补充信息，请根据补充内容修改下面的商铺信息；<br >如补充类型未"地图报错"，<strong>则请将上面的地图坐标复制到最下方的地图坐标完成坐标更新。</strong></td>
            </tr>
            <? } ?>
            <tr>
                <td width="20%" class="altbg1">商铺名:</td>
                <td width="80%"><input type="text" name="shopname" value="<?=$shop['shopname']?>" class="txtbox2" />&nbsp;&nbsp;&nbsp;店主:&nbsp;<input type="text" name="owner" value="<?=$shop['owner']?>" class="txtbox2" /></td>
            </tr></td>
            </tr>
            <tr>
                <td class="altbg1">分店名:</td>
                <td><input type="text" name="subname" value="<?=$shop['subname']?>" class="txtbox2" /></td>
            </tr>
            <tr>
                <td class="altbg1">商铺风格:</td>
                <td><select name="item_styleid">
                    <option value="">==选择模板==</option>
                    <option value="0"<?if(empty($shop['templateid']))echo' selected';?>>不使用模板风格</option>
                    <?foreach($_templates['item'] as $tid => $val) {?>
                    <option value="<?=$tid?>"<?if($tid==$shop['templateid'])echo' selected';?>><?=$val['name']?></option>
                    <?}?>
                </select></td>
            </tr>
            <?if($op!='checkitem'){?>
            <tr>
                <td class="altbg1">商铺状态:</td>
                <td><select name="status">
                        <option value="">--选择状态--</option>
                        <option value="1"<?=$shop['status']==1?" selected='selected'":""?>>正常营业(已审核)</option>
                        <option value="3"<?=$shop['status']==3?" selected='selected'":""?>>停止营业</option>
                        <option value="4"<?=$shop['status']==4?" selected='selected'":""?>>暂停营业</option>
                        <option value="5"<?=$shop['status']==5?" selected='selected'":""?>>尚未开业</option>
                        <option value="6"<?=$shop['status']==6?" selected='selected'":""?>>隐藏显示</option>
                    </select></td>
            </tr>
            <? } ?>
            <tr>
                <td class="altbg1">板块分类:</td>
                <td><select name="classcode" id="classcode">
                        <option value="">==选择分类==</option>
                        <option value="">--选择分类--</option>
                        <?foreach($_panels as $key => $val) {?>
                            <option value="" style="color:#CC0000;">==<?=$val?>==</option>
                            <?=$_classcode_option[$key]?>
                        <?}?>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="altbg1">地区:</td>
                <td><select name="areacode" id="areacode">
                        <option value="">==选择地区==</option>
                        <?=$_areacode_option[$pad]?>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="altbg1">地址:</td>
                <td><input type="text" name="address" value="<?=$shop['address']?>" class="txtbox" /></td>
            </tr>
            <tr>
                <td class="altbg1">网址:</td>
                <td><input type="text" name="website" value="<?=$shop['website']?>" class="txtbox" /></td>
            </tr>
            <tr>
                <td class="altbg1">电话1:</td>
                <td><input type="text" name="tel1" value="<?=$shop['tel1']?>" class="txtbox2" /></td>
            </tr>
            <tr>
                <td class="altbg1">电话2:</td>
                <td><input type="text" name="tel2" value="<?=$shop['tel2']?>" class="txtbox2" /></td>
            </tr>
            <tr>
                <td class="altbg1">手机:</td>
                <td><input type="text" name="mobile" value="<?=$shop['mobile']?>" class="txtbox2" /></td>
            </tr>
            <tr>
                <td class="altbg1">封面:</td>
                <td><input type="text" name="thumb" id="thumb" value="<?=$shop['thumb']?>" class="txtbox2" />&nbsp;<input type="button" value="选择" onclick="SelectPicture('thumb',<?=$shop['sid']?>);" class="btn2" /></td>
            </tr>
            <tr>
                <td class="altbg1" valign="top">介绍:</td>
                <td><textarea name="content" rows="5" cols="55" class="txtarea"><?=$shop['content']?></textarea></td>
            </tr>
            <tr>
                <td class="altbg1">地图坐标:</td>
                <td><input type="text" name="mappoint" value="<?=$shop['mappoint']?>" class="txtbox2" /></td>
            </tr>
            <tr>
                <td class="altbg1">视频地址:</td>
                <td><input type="text" name="video" value="<?=$shop['video']?>" class="txtbox" /></td>
            </tr>
			<? if($_membercard['enable'] && $op != 'itemupdate') { ?>
            <tr><td colspan="2" class="altbg2"><strong>会员卡</strong></td></tr>
            <tr>
                <td class="altbg1">支持会员卡:</td>
                <td><input type="radio" name="membercard[enable]" value="1" <?if($shop['membercard']){?>checked="checked" <?}?> /> 是&nbsp;&nbsp;<input type="radio" name="membercard[enable]" value="0" <?if(!$shop['membercard']){?>checked="checked" <?}?>/> 否</td>
            </tr>
            <tr>
                <td class="altbg1">优惠形式:</td>
                <td><input type="radio" name="membercard[cardsort]" value='discount' onclick="selectdiscount(this.value);" <?if($shop['cardsort']=='discount'){?>checked="checked" <?}?>/> 打折&nbsp;&nbsp;<input type="radio" name="membercard[cardsort]" value='largess' onclick="selectdiscount(this.value);" <?if($shop['cardsort']=='largess'){?>checked="checked" <?}?>/> 赠送&nbsp;&nbsp;<input type="radio" name="membercard[cardsort]" value='both' onclick="selectdiscount(this.value);" <?if($shop['cardsort']=='both'){?>checked="checked" <?}?>/> 两者都有</td>
            </tr>
            <tr id='discount'>
                <td class="altbg1">折扣度:</td>
                <td><input type="text" name="membercard[discount]" value="<?=$shop['discount']?>" class="txtbox4" /> 折</td>
            </tr>
            <tr id='largess'>
                <td class="altbg1">赠送说明:</td>
                <td><input type="text" name="membercard[largess]" value="<?=$shop['largess']?>" class="txtbox" /></td>
            </tr>
            <tr>
                <td class="altbg1">优惠说明(不优惠的物品):</td>
                <td><input type="text" name="membercard[exception]" value="<?=$shop['exception']?>" class="txtbox" /> <span class="font_2">例如：烟酒、特价菜除外</span></td>
            </tr>
			<? } ?>
        </table>
        <center><input type="submit" name="dosubmit" <?if($op=='checkitem'){?>value=" 审核通过 "<?}else if($op=='itemupdate'){?>value=" 处理商铺补充 "<?}else{?>value=" 提交修改 "<?}?> class="btn" />&nbsp;&nbsp;<input type="button" name="" value=" 返回 " onclick="history.go(-1);" class="btn" /></center>
    </div>
</form>
</div>
<script type="text/javascript">
function SelectPicture(objId, shopid){
    var obj = document.getElementById(objId);
    window.open("<?=$_config['siteurl']?>admin/dlg_selectpicture.php?shopid="+shopid+"&objid="+objId,'newwindow',"height=500,width=300,depended=yes,resizable=no,scrollbars=yes");
}
</script>