feat(OrderLogic): 重构订单逻辑,支持新活动状态与库存计算,优化利润计算方式
This commit is contained in:
parent
a329c7ef5b
commit
fa055acdea
@ -367,15 +367,18 @@ class OrderLogic extends BaseLogic
|
|||||||
if ($find) {
|
if ($find) {
|
||||||
|
|
||||||
$find['goods_list'] = StoreOrderCartInfo::where('oid', $find['id'])
|
$find['goods_list'] = StoreOrderCartInfo::where('oid', $find['id'])
|
||||||
->with('goodsName')
|
->field('product_id,cart_num nums,store_id')->select()->each(function ($item) use($find) {
|
||||||
->field('product_id,cart_num nums')->select()->each(function ($item) {
|
$find = StoreBranchProduct::where('product_id', $item['product_id'])->where('store_id', $find['store_id'])->find();
|
||||||
|
$item['store_name'] = $find['store_name'];
|
||||||
|
$item['image'] = $find['image'];
|
||||||
|
$item['price'] = $find['price'];
|
||||||
|
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name') ?? '';
|
||||||
$item['msg'] = '预计48小时发货';
|
$item['msg'] = '预计48小时发货';
|
||||||
$item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name');
|
return $item;
|
||||||
});
|
});
|
||||||
|
|
||||||
$store = SystemStore::where('id', $find['store_id'])->field('id,name,phone,address,detailed_address')->find();
|
$store = SystemStore::where('id', $find['store_id'])->field('id,name,phone,address,detailed_address')->find();
|
||||||
$find['store_info'] = $store;
|
$find['store_info'] = $store;
|
||||||
|
|
||||||
}
|
}
|
||||||
return $find;
|
return $find;
|
||||||
}
|
}
|
||||||
@ -390,8 +393,6 @@ class OrderLogic extends BaseLogic
|
|||||||
'refund_cancle_time' => date('Y-m-d H:i:s', time())
|
'refund_cancle_time' => date('Y-m-d H:i:s', time())
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -438,7 +439,6 @@ class OrderLogic extends BaseLogic
|
|||||||
self::setError($e->getMessage());
|
self::setError($e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -478,7 +478,6 @@ class OrderLogic extends BaseLogic
|
|||||||
'no_send' => $no_send,
|
'no_send' => $no_send,
|
||||||
'send' => $send
|
'send' => $send
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getOne($code)
|
public static function getOne($code)
|
||||||
@ -490,7 +489,6 @@ class OrderLogic extends BaseLogic
|
|||||||
return $item; //返回处理后的数据。
|
return $item; //返回处理后的数据。
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function write_list($info, $status, $params)
|
public static function write_list($info, $status, $params)
|
||||||
@ -595,7 +593,6 @@ class OrderLogic extends BaseLogic
|
|||||||
Db::rollback();
|
Db::rollback();
|
||||||
throw new BusinessException($e->getMessage());
|
throw new BusinessException($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -697,7 +694,6 @@ class OrderLogic extends BaseLogic
|
|||||||
$order['update_time'] = null;
|
$order['update_time'] = null;
|
||||||
$order['delete_time'] = null;
|
$order['delete_time'] = null;
|
||||||
return StoreOrder::create($order);
|
return StoreOrder::create($order);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -736,8 +732,5 @@ class OrderLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $pay_price;
|
return $pay_price;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user