Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
37f7d9ef4e
@ -4,6 +4,7 @@ namespace app\api\controller\store;
|
||||
|
||||
use app\api\lists\store\SystemStoreLists;
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\logic\store\StoreLogic;
|
||||
use app\common\service\pay\PayService;
|
||||
use Webman\Config;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
@ -11,11 +12,26 @@ use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
class StoreController extends BaseApiController
|
||||
{
|
||||
|
||||
public $notNeedLogin = ['detail'];
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new SystemStoreLists());
|
||||
}
|
||||
|
||||
|
||||
public function detail()
|
||||
{
|
||||
$store_id = (int)$this->request->get('store_id');
|
||||
$where = [
|
||||
'id' => $store_id
|
||||
];
|
||||
$info = StoreLogic::search($where);
|
||||
if ($info) {
|
||||
return $this->data($info);
|
||||
} else {
|
||||
return $this->fail('店铺不存在');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
27
app/api/logic/store/StoreLogic.php
Normal file
27
app/api/logic/store/StoreLogic.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\logic\store;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use think\facade\Db;
|
||||
|
||||
class StoreLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
public static function search($param)
|
||||
{
|
||||
return SystemStore::where($param)
|
||||
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show',
|
||||
'day_time', 'is_store', 'latitude', 'longitude', 'day_start', 'day_end', 'is_store'
|
||||
, 'is_send'
|
||||
])
|
||||
->find()
|
||||
->toArray();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -85,6 +85,8 @@ class OrderEnum
|
||||
const PAY = 1;
|
||||
const BACK = 0;
|
||||
|
||||
/**小程序下单**/
|
||||
const ONLINE = [1,2];
|
||||
/**
|
||||
* 账户类型
|
||||
* @USER 用户
|
||||
|
@ -202,6 +202,33 @@ class StoreOrderLogic extends BaseLogic
|
||||
return $order->toArray();
|
||||
}
|
||||
|
||||
//核销列表
|
||||
public function writeList($params)
|
||||
{
|
||||
$pageNo = $params['page_no'];
|
||||
$pageSize = $params['page_size'];
|
||||
unset($params['page_no'],$params['page_size']);
|
||||
$params['paid'] = YesNoEnum::YES;
|
||||
$params['is_writeoff'] = YesNoEnum::YES;
|
||||
$order = StoreOrder::with(['user', 'staff', 'product' => function ($query) {
|
||||
$query->field(['id', 'oid', 'product_id', 'cart_info']);
|
||||
}])->where($params)->whereIn('shipping_type',OrderEnum::ONLINE)
|
||||
->page($pageNo, $pageSize)
|
||||
->select()->toArray();
|
||||
|
||||
foreach ($order as &$value){
|
||||
$value['pay_time'] = $value['pay_time'] > 0 ? date('Y-m-d H:i:s', $value['pay_time']) : '';
|
||||
$value['status_name'] = OrderEnum::getOrderType($value['status']) ?? '';
|
||||
$value['refund_status_name'] = OrderEnum::refundStatus($value['refund_status']) ?? '';
|
||||
$value['refund_type_name'] = OrderEnum::refundType($value['refund_type']) ?? '';
|
||||
$value['pay_type_name'] =PayEnum::getPaySceneDesc($value['pay_type']) ?? '';
|
||||
}
|
||||
return $order;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单统计
|
||||
* @param $storeId
|
||||
|
@ -251,4 +251,42 @@ class StoreOrderController extends BaseAdminController
|
||||
}
|
||||
return $this->fail('核销失败' . OrderLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单已核销列表'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/writeoff_list'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(name: 'page_no', type: 'int', require: false, desc: '页数 默认1'),
|
||||
ApiDoc\Query(name: 'page_size', type: 'int', require: false, desc: '每页条数 默认15'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
public function writeoff_list(StoreOrderLogic $orderLogic)
|
||||
{
|
||||
$page_no = (int)$this->request->post('page_no', 1);
|
||||
$page_size = (int)$this->request->post('page_size', 15);
|
||||
$params = $this->request->post();
|
||||
$params['page_no'] = $page_no;
|
||||
$params['page_size'] = $page_size;
|
||||
if (empty($page_no) || empty($page_size)) {
|
||||
$params['page_no'] = 1;
|
||||
$params['page_size'] = 15;
|
||||
}
|
||||
$params['store_id'] =$this->request->adminInfo['store_id'];
|
||||
$result = $orderLogic->writeList($params);
|
||||
|
||||
$data = [
|
||||
'lists' => $result,
|
||||
'count' => count($result),
|
||||
'page_no' => $params['page_no'],
|
||||
'page_size' =>$params['page_size'],
|
||||
];
|
||||
return $this->success('ok',$data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user