作者 王智

222

... ... @@ -25,7 +25,6 @@ class Order extends Backend
$this->model = new \app\admin\model\Order;
$this->view->assign("orderStatusList", $this->model->getOrderStatusList());
$this->view->assign("invoiceStatusList", $this->model->getInvoiceStatusList());
$this->view->assign("isPayList", $this->model->getIsPay());
}
/**
... ...
... ... @@ -9,6 +9,9 @@ class Order extends Model
{
// 表名
protected $name = 'order';
... ... @@ -27,6 +30,7 @@ class Order extends Model
];
public function getOrderStatusList()
{
return ['0' => __('Order_status 0'), '1' => __('Order_status 1'), '2' => __('Order_status 2'), '3' => __('Order_status 3')];
... ... @@ -37,16 +41,9 @@ class Order extends Model
return ['0' => __('Invoice_status 0'), '1' => __('Invoice_status 1'), '2' => __('Invoice_status 2'), '3' => __('Invoice_status 3')];
}
public function getIsPay()
{
return ['0' => __('Is_pay 0'), '1' => __('Is_pay 1')];
}
public function getIsPayTextAttr($value, $data)
public function getIspay()
{
$value = $value ? $value : (isset($data['is_pay']) ? $data['is_pay'] : '');
$list = $this->getIsPay();
return isset($list[$value]) ? $list[$value] : '';
return ['0' => __('Ispay 0'), '1' => __('Ispay 1')];
}
public function getOrderStatusTextAttr($value, $data)
... ... @@ -65,6 +62,8 @@ class Order extends Model
}
public function user()
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
... ...