Merge pull request 'dev' (#453) from dev into main

Reviewed-on: #453
This commit is contained in:
mkm 2025-01-09 15:13:52 +08:00
commit 0590791bd9
6 changed files with 116 additions and 6 deletions

View File

@ -292,4 +292,35 @@ class BeforehandOrderController extends BaseAdminController
$file_path = BeforehandOrderLogic::ReturnSupplier($params);
return $this->success('导出成功', ['url' => $file_path]);
}
public function settle()
{
$params = $this->request->post();
BeforehandOrderLogic::settleOrder($params);
return $this->success('确认成功');
}
public function logList()
{
$params = $this->request->get();
$result = BeforehandOrderLogic::logList($params);
return $this->data($result);
}
public function saveLog()
{
$params = $this->request->post();
$params['submit_admin_id'] = $this->adminId;
BeforehandOrderLogic::saveLog($params);
return $this->success('保存成功');
}
public function confirmLog()
{
$params = $this->request->post();
$params['confirm_admin_id'] = $this->adminId;
BeforehandOrderLogic::confirmLog($params);
return $this->success('确认成功');
}
}

View File

@ -81,7 +81,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
$oid=WarehouseOrder::where('financial_pm',0)->where('code','like','%'.$order_ck)->column('id');
$this->searchWhere[] = ['outbound_id','in',$oid];
}
$file=['id','uid', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data'];
$file=['id','uid', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data', 'audit_status'];
return BeforehandOrder::where($this->searchWhere)
->field($file)
->limit($this->limitOffset, $this->limitLength)

View File

@ -44,11 +44,11 @@ class StoreProductGroupPriceLists extends BaseAdminDataLists implements ListsSea
public function lists(): array
{
$query = StoreProduct::field('id,store_name,purchase,cost,vip_price,price,unit');
if ($this->params['product_id']) {
$query->where('id|store_name', $this->params['product_id']);
$store_name=$this->request->get('store_name','');
if ($store_name!='') {
$query->where('store_name', 'like', '%'.$store_name.'%');
}
return $query->limit($this->limitOffset, $this->limitLength)
->field('id,store_name,purchase,cost,vip_price,price,unit')
->order(['id' => 'desc'])
->select()->each(function ($item) {
$item['lists'] =StoreProductGroupPrice::where('product_id',$item['id'])->field('id,group_id,price')
@ -75,8 +75,9 @@ class StoreProductGroupPriceLists extends BaseAdminDataLists implements ListsSea
public function count(): int
{
$query = StoreProduct::field('id,store_name,purchase,cost,vip_price,price,unit');
if ($this->params['product_id']) {
$query->where('id|store_name', $this->params['product_id']);
$store_name=$this->request->get('store_name','');
if ($store_name!='') {
$query->where('store_name', 'like', '%'.$store_name.'%');
}
return $query->count();
}

View File

@ -9,6 +9,7 @@ use app\api\logic\order\OrderLogic;
use app\common\model\beforehand_order\BeforehandOrder;
use app\common\logic\BaseLogic;
use app\common\model\auth\Admin;
use app\common\model\beforehand_order\BeforehandOrderLog;
use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo;
use app\common\model\beforehand_order_record\BeforehandOrderRecord;
use app\common\model\purchase_product_offer\PurchaseProductOffer;
@ -909,4 +910,42 @@ class BeforehandOrderLogic extends BaseLogic
$file_path = $order_info->export($data, $order, $other_data, 2);
return $file_path;
}
public static function settleOrder($params)
{
$order = BeforehandOrder::where('id', $params['id'])->find();
if ($order->status != 0) {
throw new BusinessException('该订单已完结');
}
$order->audit_status = 1;
$order->save();
}
public static function logList($params)
{
$auditStatus = BeforehandOrder::where('id', $params['order_id'])->value('audit_status');
$list = BeforehandOrderLog::with('admin')->where('order_id', $params['order_id'])->select()->toArray();
return [
'audit_status' => $auditStatus,
'list' => $list,
];
}
public static function saveLog($params)
{
$model = new BeforehandOrderLog();
$model->setAttrs($params);
$model->save();
}
public static function confirmLog($params)
{
$model = BeforehandOrderLog::where('id', $params['id'])->find();
if ($model->status != 0) {
throw new BusinessException('该审核已完成');
}
$model->status = 1;
$model->save();
}
}

View File

@ -9,11 +9,13 @@ use app\admin\logic\store_product\StoreProductLogic;
use app\admin\validate\tools\GenerateTableValidate;
use app\admin\logic\tools\GeneratorLogic;
use app\api\lists\purchase_product_offer\PurchaseProductOfferListsTwo;
use app\api\logic\DemoLogic;
use app\api\logic\order\OrderLogic as OrderOrderLogic;
use app\common\cache\ExportCache;
use app\common\logic\ChangeLogLogic;
use app\common\logic\PayNotifyLogic;
use app\common\logic\store_order\StoreOrderLogic;
use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo;
use app\common\model\beforehand_order_record\BeforehandOrderRecord;
use app\common\model\Config as ModelConfig;
use app\common\model\purchase_product_offer\PurchaseProductOffer;
@ -59,6 +61,14 @@ class IndexController extends BaseApiController
public function index()
{
// $arr=BeforehandOrderCartInfo::where('bhoid',1284)->select();
// foreach ($arr as $k=>$v){
// $product_id=StoreBranchProduct::where('id',$v['product_id'])->value('product_id');
// BeforehandOrderCartInfo::where('id',$v['id'])->update(['product_id'=>$product_id]);
// }
// $a=StoreOrderCartInfo::where('store_id',2)->whereBetweenTime('create_time','2025-01-01','2025-01-8')->select()->toArray();
// d($a);
// DemoLogic::test();
d(1);
$arr = Db::name('ceshi_copy')->select();
foreach ($arr as $k => $v) {

View File

@ -0,0 +1,29 @@
<?php
namespace app\common\model\beforehand_order;
use app\common\model\auth\Admin;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 预订单表模型
* Class BeforehandOrderLog
* @package app\common\model\beforehand_order
*/
class BeforehandOrderLog extends BaseModel
{
use SoftDelete;
protected $name = 'beforehand_order_log';
protected $deleteTime = 'delete_time';
protected $json = ['images'];
protected $jsonAssoc = true;
// 不生成该表的日志
public $doNotRecordLog = true;
public function admin()
{
return $this->hasOne(Admin::class, 'id', 'admin_id')->field('id,name');
}
}