141 lines
5.5 KiB
PHP
141 lines
5.5 KiB
PHP
<?php
|
|
namespace addon\alipay\shop\controller;
|
|
use app\model\order\OrderCommon as OrderCommonModel;
|
|
use app\model\web\Config as WebConfig;
|
|
use app\shop\controller\BaseShop;
|
|
|
|
class Order extends BaseShop
|
|
{
|
|
public function lists()
|
|
{
|
|
$order_label_list = array (
|
|
'order_no' => '订单号',
|
|
'out_trade_no' => '交易流水号',
|
|
'name' => '收货人姓名',
|
|
'order_name' => '商品名称',
|
|
'mobile' => '收货人电话',
|
|
'nick_name' => '会员昵称',
|
|
);
|
|
$order_status = input('order_status', '');//订单状态
|
|
$order_name = input('order_name', '');
|
|
$pay_type = input('pay_type', '');
|
|
$order_from = input('order_from', '');
|
|
$start_time = input('start_time', '');
|
|
$end_time = input('end_time', '');
|
|
$order_label = !empty($order_label_list[ input('order_label') ]) ? input('order_label') : '';
|
|
$search_text = input('search', '');
|
|
$promotion_type = input('promotion_type', '');//订单类型
|
|
$is_verify = input('is_verify', 'all');
|
|
$order_common_model = new OrderCommonModel();
|
|
if (request()->isAjax()) {
|
|
$page_index = input('page', 1);
|
|
$page_size = input('page_size', PAGE_LIST_ROWS);
|
|
$alias = 'a';
|
|
$join = null;
|
|
$condition = [
|
|
[ 'a.site_id', '=', $this->site_id ],
|
|
[ 'a.is_delete', '=', 0 ],
|
|
[ 'a.pay_type', '=', 'zmxxpay' ],
|
|
];
|
|
//订单状态
|
|
if ($order_status != '') {
|
|
if ($order_status == 2) {
|
|
//待提货
|
|
$condition[] = [ 'a.order_status', '=', $order_status ];
|
|
} else {
|
|
//待提货
|
|
$condition[] = [ 'order_status', 'not in', '0,-1,2' ];
|
|
}
|
|
} else {
|
|
$condition[] = [ 'order_status', 'not in', '0,-1' ];
|
|
}
|
|
$order = 'a.create_time desc';
|
|
if ($is_verify != 'all') {
|
|
$join[] = [
|
|
'verify v',
|
|
'v.verify_code = a.virtual_code',
|
|
'right'
|
|
];
|
|
$condition[] = [ 'v.is_verify', '=', $is_verify ];
|
|
$order = 'a.create_time desc';
|
|
}
|
|
|
|
//订单内容 模糊查询
|
|
if ($order_name != '') {
|
|
$condition[] = [ 'a.order_name', 'like', '%' . $order_name . '%' ];
|
|
}
|
|
//订单来源
|
|
if ($order_from != '') {
|
|
$condition[] = [ 'a.order_from', '=', $order_from ];
|
|
}
|
|
//订单支付
|
|
if ($pay_type != '') {
|
|
$condition[] = [ 'a.pay_type', '=', $pay_type ];
|
|
}
|
|
//营销类型
|
|
if ($promotion_type != '') {
|
|
if ($promotion_type == 'empty') {
|
|
$condition[] = [ 'a.promotion_type', '=', '' ];
|
|
} else {
|
|
$condition[] = [ 'a.promotion_type', '=', $promotion_type ];
|
|
}
|
|
}
|
|
if (!empty($start_time) && empty($end_time)) {
|
|
$condition[] = [ 'a.create_time', '>=', date_to_time($start_time) ];
|
|
} elseif (empty($start_time) && !empty($end_time)) {
|
|
$condition[] = [ 'a.create_time', '<=', date_to_time($end_time) ];
|
|
} elseif (!empty($start_time) && !empty($end_time)) {
|
|
$condition[] = [ 'a.create_time', 'between', [ date_to_time($start_time), date_to_time($end_time) ] ];
|
|
}
|
|
if ($order_label == 'nick_name') {
|
|
$join[] = [
|
|
'member m',
|
|
'm.member_id = a.member_id',
|
|
'right'
|
|
];
|
|
$condition[] = [ 'm.nickname', 'like', '%' . $search_text . '%' ];
|
|
} else {
|
|
if ($search_text != '') {
|
|
$condition[] = [ 'a.' . $order_label, 'like', '%' . $search_text . '%' ];
|
|
}
|
|
}
|
|
$join[] = [
|
|
'store s',
|
|
's.store_id = a.delivery_store_id',
|
|
'inner'
|
|
];
|
|
$list = $order_common_model->getOrderPageList($condition, $page_index, $page_size, $order, $field = 'a.*,s.address,s.full_address', $alias, $join);
|
|
return $list;
|
|
} else {
|
|
$order_type_list = array (
|
|
2 => [
|
|
'status' => [
|
|
2 => '签约订单',
|
|
4 => '已完成'
|
|
]
|
|
]
|
|
);
|
|
$this->assign('order_type_list', $order_type_list);
|
|
$this->assign('order_label_list', $order_label_list);
|
|
|
|
//订单来源 (支持端口)
|
|
$order_from = $order_common_model->getOrderFromList();
|
|
$this->assign('order_from_list', $order_from);
|
|
|
|
$pay_type = $order_common_model->getPayType();
|
|
$this->assign('pay_type_list', $pay_type);
|
|
|
|
//营销活动类型
|
|
$order_promotion_type = event('OrderPromotionType');
|
|
$this->assign('promotion_type', $order_promotion_type);
|
|
$this->assign('http_type', get_http_type());
|
|
|
|
$config_model = new WebConfig();
|
|
$mp_config = $config_model->getMapConfig($this->site_id);
|
|
$this->assign('tencent_map_key', $mp_config[ 'data' ][ 'value' ][ 'tencent_map_key' ]);
|
|
|
|
return $this->fetch('order/lists');
|
|
}
|
|
}
|
|
|
|
} |