作者 Cool
1 个管道 的构建 通过 耗费 7 秒

我的订单渲染

... ... @@ -8,6 +8,7 @@ use app\admin\model\Feedback;
use app\admin\model\Vipdesc;
use app\common\controller\Frontend;
use app\index\model\Goodscollect;
use app\index\model\OrderInfo;
use app\index\model\Price;
use app\index\model\Store;
use app\index\model\Storecollect;
... ... @@ -77,6 +78,39 @@ class Member extends Frontend
return $this->view->fetch();
}
// 订单列表
public function order_list() {
if($this->request->isAjax()) {
$param = $this->request->param();
$order_detail_model = new \app\index\model\OrderDetail();
$order_info_model = new OrderInfo();
$store_model = new Store();
$where = [
'user_id' => $this->auth->id
];
if($param['status']) {
$where['status'] = $param['status'];
}
$order = $order_detail_model
->where($where)
->order('createtime','DESC')
->paginate($param['pageNum'],false,['page'=>$param['page']]);
$list = $order->items();
foreach ($list as $k=>$v) {
$order[$k]['store_name'] = $store_model->where('id',$v['store_id'])->value('name');
$order[$k]['goods'] = $order_info_model->where('order_id',$v['id'])->select();
}
$return = [
'list' => $list,
'totalSize' => $order->total(),
'current_page' => $order->currentPage(),
'totalPage' => $order->lastPage(),
'pageNum' => $param['pageNum'],
];
$this->success('成功','',$return);
}
}
// 我的会员
public function member()
{
... ...