feat: 增加订单状态名称和支付时间获取功能
This commit is contained in:
parent
f4e3f1bf43
commit
ed150ce99b
@ -4,6 +4,7 @@ namespace app\admin\lists\store_order;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
@ -52,6 +53,9 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
$item['pay_type_name']=PayEnum::getPaySceneDesc($item['pay_type']);
|
||||
$item['pay_time']=$item['pay_time']>0?date('Y-m-d H:i:s',$item['pay_time']):'';
|
||||
$item['status_name']= OrderEnum::getOrderType($item['status'])??'';
|
||||
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
@ -6,7 +6,9 @@ namespace app\admin\lists\store_order_cart_info;
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
|
||||
/**
|
||||
* 订单购物详情列表
|
||||
@ -43,10 +45,17 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
|
||||
public function lists(): array
|
||||
{
|
||||
return StoreOrderCartInfo::where($this->searchWhere)
|
||||
->field('cart_info')->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->field('cart_info,product_id')->limit($this->limitOffset, $this->limitLength)
|
||||
->select()->each(function ($item) {
|
||||
$item['cart_info'] = json_decode($item['cart_info'], true); //将json字符串转换为数组,方便使用其中的数据。
|
||||
$find=StoreBranchProduct::where('id',$item['product_id'])->field('image,store_name')->find();
|
||||
if($find){
|
||||
$item['image']=$find['image'];//商品图片
|
||||
$item['store_name']=$find['store_name'];//商品名称
|
||||
}else{
|
||||
$item['image']='';//商品图片
|
||||
$item['store_name']='';//商品名称
|
||||
}
|
||||
return $item; //返回处理后的数据。
|
||||
})
|
||||
->toArray();
|
||||
|
@ -92,7 +92,8 @@ class StoreOrderLogic extends BaseLogic
|
||||
{
|
||||
$data= StoreOrder::findOrEmpty($params['id']);
|
||||
if($data){
|
||||
$data['status_name']=$data->status_name_Text;
|
||||
$data['status_name']=$data->status_name_text;
|
||||
$data['pay_time']=date('Y-m-d H:i:s',$data['pay_time']);
|
||||
}
|
||||
return $data?->toArray();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user