Merge branch 'main' of https://gitea.lihaink.cn/mkm/multi-store
This commit is contained in:
commit
6e20a3a833
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\store_order_cart_info;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoLists;
|
||||
|
||||
/**
|
||||
* 订单购物详情控制器
|
||||
* Class StoreOrderCartInfoController
|
||||
* @package app\admin\controller\store_order_cart_info
|
||||
*/
|
||||
class StoreOrderCartInfoController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取订单购物详情列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreOrderCartInfoLists());
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
|
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 订单购物详情列表
|
||||
* Class StoreOrderCartInfoLists
|
||||
* @package app\admin\store_order_cart_info
|
||||
*/
|
||||
class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['oid'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取订单购物详情列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return StoreOrderCartInfo::where($this->searchWhere)
|
||||
->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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取订单购物详情数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return StoreOrderCartInfo::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
@ -90,14 +90,11 @@ class StoreOrderLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data= StoreOrder::findOrEmpty($params['id'])->toArray();
|
||||
$data= StoreOrder::findOrEmpty($params['id']);
|
||||
if($data){
|
||||
$data['_info']=StoreOrderCartInfo::where('oid',$data['id'])->field('cart_info')
|
||||
->select()->each(function ($item){
|
||||
$item['cart_info']=json_decode($item['cart_info'],true);//将json字符串转换为数组,方便使用其中的数据。
|
||||
return $item;//返回处理后的数据。
|
||||
});
|
||||
$data['status_name']=$data->status_name_text;
|
||||
$data['pay_time']=date('Y-m-d H:i:s',$data['pay_time']);
|
||||
}
|
||||
return $data;
|
||||
return $data?->toArray();
|
||||
}
|
||||
}
|
@ -36,16 +36,36 @@ class OrderEnum
|
||||
* @EXPENDITURE 支出
|
||||
* @INCOME 收入
|
||||
*/
|
||||
const EXPENDITURE =0;
|
||||
const INCOME =1;
|
||||
|
||||
const EXPENDITURE = 0;
|
||||
const INCOME = 1;
|
||||
|
||||
//-----------------------物流状态-----------------------//
|
||||
/**
|
||||
* 状态
|
||||
* @RECEIVED_GOODS 已收货
|
||||
*/
|
||||
const RECEIVED_GOODS = 2;
|
||||
|
||||
/**
|
||||
* @WAIT_EVALUATION 待评价
|
||||
*/
|
||||
const WAIT_EVALUATION = 3;
|
||||
/**
|
||||
* @WAIT_DELIVERY 待发货
|
||||
*/
|
||||
const WAIT_DELIVERY = 0;
|
||||
/**
|
||||
* @WAIT_RECEIVING 待收货
|
||||
*/
|
||||
const WAIT_RECEIVING = 1;
|
||||
/**
|
||||
* @ALREADY_REFUND 申请退款
|
||||
*/
|
||||
const ALREADY_REFUND = -1;
|
||||
|
||||
/**
|
||||
* @RETURN_SUCCESS 退款成功
|
||||
*/
|
||||
const RETURN_SUCCESS = -2;
|
||||
|
||||
/**
|
||||
* 核销
|
||||
@ -61,11 +81,11 @@ class OrderEnum
|
||||
* @SUPPLIER 供应链
|
||||
* @SYSTEM 系统
|
||||
*/
|
||||
const USER =0;
|
||||
const MERCHANT =1;
|
||||
const PLATFORM =2;
|
||||
const SUPPLIER =3;
|
||||
const SYSTEM=4;
|
||||
const USER = 0;
|
||||
const MERCHANT = 1;
|
||||
const PLATFORM = 2;
|
||||
const SUPPLIER = 3;
|
||||
const SYSTEM = 4;
|
||||
|
||||
/**
|
||||
* @notes 获取支付类型
|
||||
@ -77,14 +97,14 @@ class OrderEnum
|
||||
public static function getFinancialType($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::USER_ORDER_PAY=>'用户订单支付',
|
||||
self::MERCHANT_ORDER_PAY=>'商户订单支付',
|
||||
self::PLATFORM_ORDER_PAY=>'平台订单支付',
|
||||
self::MERCHANT_ORDER_OBTAINS=>'商户订单获得',
|
||||
self::ORDER_HANDLING_FEES=>'订单手续费',
|
||||
self::PLATFORM_ORDER_OBTAINS=>'平台订单获得',
|
||||
self::SUPPLIER_ORDER_OBTAINS=>'供应商订单获得',
|
||||
self::SYSTEM_SET=>'平台设置',
|
||||
self::USER_ORDER_PAY => '用户订单支付',
|
||||
self::MERCHANT_ORDER_PAY => '商户订单支付',
|
||||
self::PLATFORM_ORDER_PAY => '平台订单支付',
|
||||
self::MERCHANT_ORDER_OBTAINS => '商户订单获得',
|
||||
self::ORDER_HANDLING_FEES => '订单手续费',
|
||||
self::PLATFORM_ORDER_OBTAINS => '平台订单获得',
|
||||
self::SUPPLIER_ORDER_OBTAINS => '供应商订单获得',
|
||||
self::SYSTEM_SET => '平台设置',
|
||||
|
||||
|
||||
];
|
||||
@ -94,5 +114,22 @@ class OrderEnum
|
||||
return $data[$value] ?? '';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* @notes 获取订单状态类型
|
||||
*/
|
||||
public static function getOrderType($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::RECEIVED_GOODS => '已收货',
|
||||
self::WAIT_EVALUATION => '待评价',
|
||||
self::WAIT_DELIVERY => '待发货',
|
||||
self::WAIT_RECEIVING => '待收货',
|
||||
self::RETURN_SUCCESS => '退货成功',
|
||||
self::ALREADY_REFUND => '已退款',
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value] ?? '';
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
namespace app\common\model\store_order;
|
||||
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use think\model\concern\SoftDelete;
|
||||
@ -24,4 +25,15 @@ class StoreOrder extends BaseModel
|
||||
return $this->hasOne(SystemStore::class, 'id','store_id');
|
||||
}
|
||||
|
||||
public function getPayTypeAttr($value, $data)
|
||||
{
|
||||
$status = PayEnum::getPaySceneDesc($value)??'';
|
||||
return $status;
|
||||
}
|
||||
|
||||
public function getStatusNameTextAttr($value, $data)
|
||||
{
|
||||
$status = OrderEnum::getOrderType($data['status'])??'';
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user