调整商品规格

This commit is contained in:
2023-01-30 10:53:48 +08:00
parent a10311b618
commit ee394e1ac8
3 changed files with 36 additions and 13 deletions

View File

@@ -182,6 +182,12 @@ class GoodsController extends AdminController
->default(0)
->setWidth(2)
->required();
$form->radio('unit', '单位')
->options([
'瓶' => '瓶',
'箱' => '箱',
])
->required();
});
})
->when(Goods::TYPE_MULTIPLE, function ($form) {

View File

@@ -77,6 +77,10 @@ class OrderBuyController extends Controller
$type = OrderModel::TYPE_NORMAL;
info($goods_sku->goods->channel);
info($goods_sku->goods->id);
info($goods_sku->id);
if ($goods_sku->goods->channel == Goods::CHANNEL_FREE) {
$type = OrderModel::TYPE_SAMPLE;
}
@@ -85,14 +89,21 @@ class OrderBuyController extends Controller
$type = OrderModel::TYPE_SCORE;
}
$areaCode = $user->info->areaCode;
if (! $areaCode && $type == OrderModel::TYPE_SAMPLE) {
return $this->failed('您没有提货码不可参与此活动');
}
if ($areaCode->status != AreaCode::STATUS_INIT && $type == OrderModel::TYPE_SAMPLE) {
return $this->failed('提货码已被使用,不可重复使用');
if ($type == OrderModel::TYPE_SAMPLE) {
if (! $user->info->areaCode) {
return $this->failed('您没有提货码不可参与此活动');
}
$areaCode = AreaCode::where('code', $user->info->areaCode)->first();
if (! $areaCode) {
return $this->failed('您绑定的提货码不正确');
}
if ($areaCode->status != AreaCode::STATUS_INIT) {
return $this->failed('提货码已被使用,不可重复使用');
}
}
$freight = $item->freight();
$amount = $item->total();
$weight = $item->weight();
@@ -179,12 +190,18 @@ class OrderBuyController extends Controller
$type = OrderModel::TYPE_SCORE;
}
$areaCode = $user->info->areaCode;
if (! $areaCode && $type == OrderModel::TYPE_SAMPLE) {
return $this->failed('您没有提货码不可参与此活动');
}
if ($areaCode->status != AreaCode::STATUS_INIT && $type == OrderModel::TYPE_SAMPLE) {
return $this->failed('提货码已被使用,不可重复使用');
if ($type == OrderModel::TYPE_SAMPLE) {
if (! $user->info->areaCode) {
return $this->failed('您没有提货码不可参与此活动');
}
$areaCode = AreaCode::where('code', $user->info->areaCode)->first();
if (! $areaCode) {
return $this->failed('您绑定的提货码不正确');
}
if ($areaCode->status != AreaCode::STATUS_INIT) {
return $this->failed('提货码已被使用,不可重复使用');
}
}
$address = Address::where('user_id', $user->id)->where('id', $address_id)->first();