{echo:JS::import('dialog?skin=brief');}
{echo:JS::import('dialogtools');}
<form action="" method="post">
<div class="tools_bar clearfix">
    <a class="icon-checkbox-checked icon-checkbox-unchecked" href="javascript:;" onclick="tools_select('id[]',this)" title="全选" data="true"> 全选 </a>
    <a  class="icon-remove-2" href="javascript:;" onclick="tools_submit({action:'{url:/order/ship_del}',msg:'删除后无法恢复，你真的删除吗？'})" title="删除"> 删除</a>
    <a href='{url:/order/ship_edit}' class="icon-plus" > 添加</a>
</div>
<table class="default" >
    <tr>
        <th width="30">选择</th>
        <th width="70">操作</th>
        <th >模板名称</th>
        <th>联系人</th>
        <th>地址</th>
        <th>邮编</th>
        <th>电话</th>
        <th>手机</th>
        <th width="60">是否默认 </th>
    </tr>
    {query:name=ship id=$obj page=1 desc }
        <tr><td width="30"><input type="checkbox" name="id[]" value="{$item['id']}"></td>
            <td width="70" class="btn_min"><div class="operat hidden"><a  class="icon-cog action" href="javascript:;"> 处理</a><div class="menu_select"><ul>
                        <li><a href="{url:/order/ship_edit/id/$item[id]}"> 编辑</a></li>
                        <li><a href="javascript:confirm_action('{url:/order/ship_del/id/$item[id]}')" > 删除</a></li>
                    </ul></div></div> </td>
            <td >{$item['ship_name']}</td>
            <td>{$item['ship_user_name']}</td>
            <td>{$item['addr']}</td>
            <td>{$item['zip']}</td>
            <td>{$item['phone']}</td>
            <td>{$item['mobile']}</td>
            <td width="60">{if:$item['is_default']}<span class="icon-checkmark"></span>{/if}</td></tr>
    {/query}
</table>
</form>
<div class="page_nav">
{echo:$obj->pageBar()}
</div>
<div id="status_dialog" style="display: none; position: relative;" class="form2">
    <h3 id="order_title">备注信息：</h3>
        <input type="hidden" name="id" id="order_id" value="">
        <input type="hidden" name="status" id="order_status" value="">
        <input type="hidden" name="op" id="order_op" value="">
        <textarea id="order_remark" name="remark"></textarea>
    <div class="tc"><button class="focus_button" onclick="submit_status()">保存</button></div>
</div>
<script type="text/javascript">
    function edit(id){
        art.dialog.open("{url:/order/order_edit/id/}"+id,{id:'edit_dialog',title:'订单编辑',resize:false,width:900,height:450});
    }
    function send(id){
        art.dialog.open("{url:/order/order_send/id/}"+id,{id:'send_dialog',title:'发货',resize:false,width:900,height:450});
    }
    function change_status(id,status,op){
        var title = '';
        if(status==null){
            if(op=='del') title = '删除订单';
            else if(op=='note') title = '备注订单';
        }else{
            if(status == 3) title = '审核订单';
            else if(status == 4) title = '完成订单';
            else if(status == 6) title = '作废订单';
        }
        $("#order_id").val(id);
        $("#order_status").val(status);
        $("#order_op").val(op);
        art.dialog({id:'status_dialog',title:title,resize:false,width:500,height:250,content:document.getElementById('status_dialog')});
    }
    function submit_status(){
        var remark= $("#order_remark").val();
        var id = $("#order_id").val();
        var status = $("#order_status").val();
        var op = $("#order_op").val();
        if(remark != ''){
            $.post('{url:/order/order_status}',{id:id,status:status,op:op,remark:remark},function(data){
                art.dialog({id:'status_dialog'}).close();
                if(data['status']=='success'){
                     alert(data['msg']+"成功！");
                }else{
                     alert(data['msg']+"失败！");
                }
                tools_reload();
            },'json');
        }else{
            art.dialog.tips("<p class='warning'>备注信息不能为空!</p>");
        }
        
    }
    function send_close(){
        art.dialog({id:'send_dialog'}).close();
        art.dialog.tips("<p class='sucess'>发货成功！</p>");
    }
    function close(){
        art.dialog({id:'edit_dialog'}).close();
        art.dialog.tips("<p class='sucess'>订单编辑成功！</p>");
    }
    $("#condition").on("click",function(){
  $("body").Condition({input:"#condition_input",data:{user_id:{name:'用户编号'},real_name:{name:'真实姓名'},mobile:{name:'电话'},sex:{name:'性别',values:{0:"女",1:'男'}}}});
})
</script>