<?php namespace Goods\Lib;
use Dever;
use Place;
class Order
{
    # 获取某个订单的详情
    public function getDetail($id)
    {
        $result = Dever::db('order_detail', 'place')->select(array('type' => 3, 'order_id' => $id), array('col' => 'id,name,pic,sku_name,sku_id,cash,num'));
        if ($result) {
            foreach ($result as &$v) {
                $v['cash'] = Dever::load('price', 'place')->getText($v['cash'], 3);
            }
        }
        return $result;
    }

    # 获取订单详情
    public function getView($info)
    {
        if ($info) {
            $info['yun'] = Dever::load('price', 'place')->getText(0, 3);
            $info['status_list'] = array
            (
                1 => array
                (
                    'selected' => false,
                    'name' => '已拍下',
                ),
                2 => array
                (
                    'selected' => false,
                    'name' => '待付款',
                ),
                3 => array
                (
                    'selected' => false,
                    'name' => '待发货',
                ),
                4 => array
                (
                    'selected' => false,
                    'name' => '待收货',
                ),
            );
            foreach ($info['status_list'] as $k => &$v) {
                if ($info['status'] >= $k) {
                    $v['selected'] = true;
                }
            }
        }
        return $info;
    }
}