if ($type == 'WAITPAY') {
$where['a.pay_status'] = 0;
$where['a.order_status'] = 0;
}

//待抢 order_status = 0 && waimai_status = 0
//待取货 order_status = 1 && waimai_status = 1;
//配送中 order_status = 1 && shipping_status = 0 && waimai_status = 2
//配送完成 order_status = 1 && shipping_status = 1

//待取货
if ($type == 'WAITRECEIVE') {
$where['a.order_status'] = 1;
$where['a.pay_status'] = 1;
$where['a.waimai_status'] = 1;
$where['a.shipping_status'] = 0;
$where['ps.receiver'] = ['neq', 0];
}

//待配送
if ($type == 'WAITDELIVERY') {
$where['a.order_status'] = 1;
$where['pay_status'] = 1;
$where['a.waimai_status'] = 2;
$where['a.shipping_status'] = 0;
$where['ps.receiver'] = ['neq', 0];
}

//已完成
if ($type == 'FINISH') {
$where['a.pay_status'] = 1;
$where['a.order_status'] = 1;
$where['a.shipping_status'] = 1;
}

//已取消
if ($type == 'CANCEL') {
$where['a.order_status'] = 3;
}