/**
 * 确认收货
 * @param order_id  订单id
 */
function confirm(order_id){
	$.showConfirm("您确定要收货并入库吗？",function(){    
        var number = '';
        var og_id = '';        
        $("input[name='number[]']").each(function(index,item){ 
            var num = parseInt($(this).val());
            if(num<0){
                $.showErr('请正确填写收货数量',1,'hc');return false;
            }
            number += num+',';
        });
        $("input[name='og_id[]']").each(function(index,item){
            og_id += $(this).val()+',';
        });
		var query = new Object;
		query.order_id=order_id;
        query.number=number;
        query.og_id=og_id;
		$.ajax({
			type:'post',
			data:query,
			url:APP+"Shop/PurOrder/confirm_order",
			success:function(data){
				if(data.status==1){
					$.showSuccess(data.msg,1,'hc');
					window.location.reload();
				}else{
					$.showErr(data.msg,1,'hc');
				}
			}
		});
	},'hc')
}
/**
 * 取消订单
 * @param order_id  订单ID
 */
function cancel_order(order_id){
    $.showConfirm("您确定要取消订单吗？",function(){
        var query = new Object;
        query.order_id=order_id;
        $.ajax({
            type:'post',
            data:query,
            url:APP+"Mobile/PurOrderInfo/cancel_order",
            success:function(data){
                if(data.status==1){
                    $.showSuccess(data.msg,1,'hc');
                    window.location.reload();
                }else{
                    $.showErr(data.msg,1,'hc');
                }
            }
        });
    },'hc')
}
/**
 * 退款
 * @param order_goods   订单商品id
 */
function refund_money(order_goods,order_id,score){
	if(score=='th'){
		$.showConfirm("您确定要进行退货操作吗？",function(){
			// window.location.href=APP+"Shop/PurOrder/refund_content/order_id/"+order_id+"/order_goods/"+order_goods+"/score/"+score;
			$.openUrl(APP+"Shop/PurOrder/refund_content/order_id/"+order_id+"/order_goods/"+order_goods+"/score/"+score+"/.html",'退款审核',order_id, '300', function () {
			return false;
			}, function () {
				return false;
			});
		},'hc')

	}else if(score=='tk'){
		$.showConfirm("您确定要进行退款操作吗？",function(){
			// window.location.href=APP+"Shop/PurOrder/refund_content/order_id/"+order_id+"/order_goods/"+order_goods+"/score/"+score;
			$.openUrl(APP+"Shop/PurOrder/refund_content/order_id/"+order_id+"/order_goods/"+order_goods+"/score/"+score+"/.html",'退款审核',order_id, '300', function () {
			return false;
			}, function () {
				return false;
			});
		},'hc')
	}
}
/**
 * 删除订单
 * @param order_id  订单ID
 */
function del_order(order_id){
    $.showConfirm("您确定要删除订单吗？",function(){
        var query = new Object;
        query.order_id=order_id;
        $.ajax({
            type:'post',
            data:query,
            url:APP+"Mobile/PurOrderInfo/del_order",
            success:function(data){
                if(data.status==1){
                    $.showSuccess(data.msg,1,'hc');
                    window.location.reload();
                }else{
                    $.showErr(data.msg,1,'hc');
                }
            }
        });
    },'hc')
}