调整砍价判断
parent
d98d31487b
commit
704287d550
|
|
@ -83,28 +83,15 @@ class BargainOrderController extends AdminController
|
||||||
*/
|
*/
|
||||||
protected function detail($id)
|
protected function detail($id)
|
||||||
{
|
{
|
||||||
// return Show::make($id, new BargainOrder(), function (Show $show) {
|
|
||||||
// $show->field('id');
|
|
||||||
// $show->field('activity_id');
|
|
||||||
// $show->field('user_id');
|
|
||||||
// $show->field('sku_id');
|
|
||||||
// $show->field('sku_price');
|
|
||||||
// $show->field('bargain_price');
|
|
||||||
// $show->field('status');
|
|
||||||
// $show->field('expire_at');
|
|
||||||
// $show->field('order_id');
|
|
||||||
// $show->field('remark');
|
|
||||||
// $show->field('created_at');
|
|
||||||
// $show->field('updated_at');
|
|
||||||
// });
|
|
||||||
|
|
||||||
return function (Row $row) use ($id) {
|
return function (Row $row) use ($id) {
|
||||||
$order = BargainOrderModel::with(['activity', 'user', 'userInfo', 'mallOrder', 'sku'])->find($id);
|
$order = BargainOrderModel::with(['activity', 'user', 'userInfo', 'mallOrder', 'sku'])->find($id);
|
||||||
$row->column(6, function ($column) use ($order) {
|
$row->column(6, function ($column) use ($order) {
|
||||||
$column->row(Show::make($order, function (Show $show) {
|
$column->row(Show::make($order, function (Show $show) {
|
||||||
$show->row(function (Show\Row $show) {
|
$show->row(function (Show\Row $show) {
|
||||||
$show->field('id')->width(10, 1);
|
$show->field('id')->width(10, 1);
|
||||||
$show->width(6)->field('activity.name');
|
$show->width(6)->field('user.phone');
|
||||||
|
$show->field('user_info.nickname', '昵称');
|
||||||
|
$show->field('activity.name');
|
||||||
$show->field('sku.name');
|
$show->field('sku.name');
|
||||||
$show->field('sku_price')->as(function ($v) {
|
$show->field('sku_price')->as(function ($v) {
|
||||||
return bcdiv($v, 100, 2);
|
return bcdiv($v, 100, 2);
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ class OrderService
|
||||||
if ($res === 0) {
|
if ($res === 0) {
|
||||||
throw new BizException('订单已发生改变');
|
throw new BizException('订单已发生改变');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新订单商品优惠金额-todo
|
||||||
|
|
||||||
OrderLog::create([
|
OrderLog::create([
|
||||||
'order_id'=>$order->id,
|
'order_id'=>$order->id,
|
||||||
'content'=> '调整订单支付价格为:¥'.bcdiv($reduceAmount, 100, 2),
|
'content'=> '调整订单支付价格为:¥'.bcdiv($reduceAmount, 100, 2),
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,9 @@ class BargainService
|
||||||
|
|
||||||
$order->logs()->save($log);
|
$order->logs()->save($log);
|
||||||
$order->bargain_price += $log->bargain_amount;
|
$order->bargain_price += $log->bargain_amount;
|
||||||
if ($activity->times > 0 && $activity->times <= ($nowBargainCount ++)) {
|
$nowBargainCount ++;
|
||||||
|
|
||||||
|
if ($activity->times > 0 && $nowBargainCount >= $activity->times) {
|
||||||
$order->status = BargainOrder::ORDER_STATUS_FINISHED;
|
$order->status = BargainOrder::ORDER_STATUS_FINISHED;
|
||||||
}
|
}
|
||||||
$order->save();
|
$order->save();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue