feat: 修改订单逻辑以支持新字段rose

This commit is contained in:
mkm 2024-07-27 14:52:46 +08:00
parent 22c89d8ddd
commit 10fbddf295

View File

@ -18,6 +18,7 @@ use app\common\model\order\Cart;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_category\StoreCategory;
use app\common\model\store_finance_flow\StoreFinanceFlow;
use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\store_product\StoreProduct;
@ -82,13 +83,13 @@ class OrderLogic extends BaseLogic
self::$fresh_price = 0; //生鲜金额
/** 计算价格 */
$off_activity = Config::where('name', 'off_activity')->value('value');
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info';
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info,rose';
foreach ($cart_select as $k => $v) {
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
if (!$find) {
// unset($cart_select[$k]);
// continue;
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id,cate_id,store_info';
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id,cate_id,store_info,rose';
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
if ($find) {
$cate_id = StoreCategory::where('id', $find['cate_id'])->value('pid');
@ -135,6 +136,7 @@ class OrderLogic extends BaseLogic
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
$cart_select[$k]['vip_frozen_price'] = 0;
$cart_select[$k]['store_info'] = $find['store_info'];
$cart_select[$k]['rose'] = $find['rose'];
//会员待返回金额
// if ($user && $off_activity == 0) {
// if ($user['user_ship'] == 4) {
@ -575,12 +577,7 @@ class OrderLogic extends BaseLogic
'staff_id' => $params['staff_id'] ?? 0,
], ['id' => $order['id']]);
//修改商品统计记录标识
(new StoreProductLog())->update(
[
'store_id' => $params['store_id']
],
['oid' => $order['id']]
);
(new StoreProductLog())->where('oid',$order['id'])->update(['store_id' => $params['store_id']]);
(new StoreOrderCartInfo())->update([
'verify_code' => $params['verify_code'] . '-1',
'writeoff_time' => time(),
@ -590,6 +587,10 @@ class OrderLogic extends BaseLogic
'update_time' => time(),
], ['oid' => $order['id']]);
$financeFlow = new StoreFinanceFlow();
$res=$financeFlow->where('order_id',$order['id'])->update(['store_id'=>$params['store_id'],'staff_id'=>$params['staff_id']]);
if($res){
$order['store_id']=$params['store_id'];
}
$financeFlowLogic = new StoreFinanceFlowLogic();
$select_1 = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => ['in' => 14, 15, 16]])->select();
foreach ($select_1 as $k => $v) {