提交 1a95fb7f 编写于 作者: G gongfuxiang

购买判断顺序优化

上级 d98b7fe6
...@@ -2909,58 +2909,60 @@ class GoodsService ...@@ -2909,58 +2909,60 @@ class GoodsService
]; ];
$error = '仅展示'; $error = '仅展示';
} else { } else {
// web端class // 还有库存
$class_name = (APPLICATION == 'web') ? 'buy-event login-event' : ''; if($goods['inventory'] <= 0)
{
// 购买 $error = '没货了';
$buy = [ }
'color' => 'main', if(empty($error))
'type' => 'buy', {
'title' => '点此按钮到下一步确认购买信息', // web端class
'name' => (MyC('common_order_is_booking', 0, true) == 1) ? '立即预约' : '立即购买', $class_name = (APPLICATION == 'web') ? 'buy-event login-event' : '';
'class' => $class_name,
'icon' => '',
];
// 商品类型是否和当前站点类型一致 // 购买
$cart = []; $buy = [
$ret = self::IsGoodsSiteTypeConsistent($goods['id'], $goods['site_type']); 'color' => 'main',
if($ret['code'] == 0) 'type' => 'buy',
{ 'title' => '点此按钮到下一步确认购买信息',
// 加入购物车 'name' => (MyC('common_order_is_booking', 0, true) == 1) ? '立即预约' : '立即购买',
$cart = [
'color' => 'second',
'type' => 'cart',
'title' => '加入购物车',
'name' => '加入购物车',
'class' => $class_name, 'class' => $class_name,
'icon' => 'am-icon-opencart', 'icon' => '',
]; ];
} else {
$error = $ret['msg'];
}
// 主按钮顺序处理,手机端立即购买放在最后面 // 商品类型是否和当前站点类型一致
if(APPLICATION == 'app') $cart = [];
{ $ret = self::IsGoodsSiteTypeConsistent($goods['id'], $goods['site_type']);
if(!empty($cart)) if($ret['code'] == 0)
{ {
$data[] = $cart; // 加入购物车
$cart = [
'color' => 'second',
'type' => 'cart',
'title' => '加入购物车',
'name' => '加入购物车',
'class' => $class_name,
'icon' => 'am-icon-opencart',
];
} else {
$error = $ret['msg'];
} }
$data[] = $buy;
} else { // 主按钮顺序处理,手机端立即购买放在最后面
$data[] = $buy; if(APPLICATION == 'app')
if(!empty($cart))
{ {
$data[] = $cart; if(!empty($cart))
{
$data[] = $cart;
}
$data[] = $buy;
} else {
$data[] = $buy;
if(!empty($cart))
{
$data[] = $cart;
}
} }
} }
// 还有库存
if($goods['inventory'] <= 0)
{
$error = '没货了';
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册