修复分类锁的bug
This commit is contained in:
parent
26e42dd2a4
commit
5abb8277e3
@ -92,13 +92,26 @@ class GoodsGroupController extends AdminController
|
|||||||
{
|
{
|
||||||
return Form::make(new GoodsGroup(), function (Form $form) {
|
return Form::make(new GoodsGroup(), function (Form $form) {
|
||||||
$form->display('id');
|
$form->display('id');
|
||||||
$form->text('gp_name');
|
$form->text('gp_name', admin_trans('goods-group.fields.gp_name'));
|
||||||
$form->switch('is_open')->default(GoodsGroupModel::STATUS_OPEN);
|
$form->switch('is_open', admin_trans('goods-group.fields.is_open'))->default(GoodsGroupModel::STATUS_OPEN);
|
||||||
$form->switch('is_open_group_pwd')->default(GoodsGroupModel::STATUS_CLOSE);
|
|
||||||
$form->text('group_pwd')->help(admin_trans('goods-group.fields.group_pwd_help'));
|
$form->divider('分类密码访问');
|
||||||
$form->number('ord')->default(1)->help(admin_trans('dujiaoka.ord'));
|
$form->switch('is_open_group_pwd', admin_trans('goods-group.fields.is_open_group_pwd'))->default(GoodsGroupModel::STATUS_CLOSE);
|
||||||
|
$form->text('group_pwd', admin_trans('goods-group.fields.group_pwd'))
|
||||||
|
->help(admin_trans('goods-group.fields.group_pwd_help'));
|
||||||
|
|
||||||
|
$form->number('ord', admin_trans('goods-group.fields.ord'))->default(1)->help(admin_trans('dujiaoka.ord'));
|
||||||
$form->display('created_at');
|
$form->display('created_at');
|
||||||
$form->display('updated_at');
|
$form->display('updated_at');
|
||||||
|
|
||||||
|
$form->saving(function (Form $form) {
|
||||||
|
if ((int) $form->is_open_group_pwd !== GoodsGroupModel::STATUS_OPEN) {
|
||||||
|
$form->group_pwd = null;
|
||||||
|
} elseif ($form->isEditing() && $form->group_pwd === null) {
|
||||||
|
$form->deleteInput('group_pwd');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$form->disableViewButton();
|
$form->disableViewButton();
|
||||||
$form->footer(function ($footer) {
|
$form->footer(function ($footer) {
|
||||||
// 去掉`查看`checkbox
|
// 去掉`查看`checkbox
|
||||||
|
|||||||
@ -46,6 +46,9 @@ class HomeController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
|
// 每次打开/刷新首页都重新要求输入分类访问密码
|
||||||
|
session()->forget('dujiaoka_group_pwd_access');
|
||||||
|
|
||||||
$goods = $this->goodsService->withGroup();
|
$goods = $this->goodsService->withGroup();
|
||||||
return $this->render('static_pages/home', ['data' => $goods], __('dujiaoka.page-title.home'));
|
return $this->render('static_pages/home', ['data' => $goods], __('dujiaoka.page-title.home'));
|
||||||
}
|
}
|
||||||
@ -97,13 +100,34 @@ class HomeController extends BaseController
|
|||||||
'group_id' => 'required|integer',
|
'group_id' => 'required|integer',
|
||||||
'password' => 'required|string',
|
'password' => 'required|string',
|
||||||
]);
|
]);
|
||||||
$this->goodsService->verifyGroupPassword((int) $request->input('group_id'), (string) $request->input('password'));
|
$group = $this->goodsService->verifyGroupPassword((int) $request->input('group_id'), (string) $request->input('password'));
|
||||||
return response()->json(['code' => 200, 'msg' => __('dujiaoka.prompt.goods_group_password_success')]);
|
return response()->json([
|
||||||
|
'code' => 200,
|
||||||
|
'msg' => __('dujiaoka.prompt.goods_group_password_success'),
|
||||||
|
'data' => $group,
|
||||||
|
]);
|
||||||
} catch (RuleValidationException $ruleValidationException) {
|
} catch (RuleValidationException $ruleValidationException) {
|
||||||
return response()->json(['code' => 400, 'msg' => $ruleValidationException->getMessage()]);
|
return response()->json(['code' => 400, 'msg' => $ruleValidationException->getMessage()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消商品分类密码访问授权
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function forgetGroupPasswordAccess(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'group_id' => 'required|integer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->goodsService->forgetGroupAccess((int) $request->input('group_id'));
|
||||||
|
|
||||||
|
return response()->json(['code' => 200, 'msg' => 'ok']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 极验行为验证
|
* 极验行为验证
|
||||||
*
|
*
|
||||||
|
|||||||
@ -17,10 +17,6 @@ class GoodsGroup extends BaseModel
|
|||||||
'deleted' => GoodsGroupDeleted::class
|
'deleted' => GoodsGroupDeleted::class
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
|
||||||
'group_pwd',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'is_open_group_pwd' => 'integer',
|
'is_open_group_pwd' => 'integer',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -112,11 +112,16 @@ class GoodsService
|
|||||||
*
|
*
|
||||||
* @param int $groupID 分类id
|
* @param int $groupID 分类id
|
||||||
* @param string $password 访问密码
|
* @param string $password 访问密码
|
||||||
* @return bool
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function verifyGroupPassword(int $groupID, string $password): bool
|
public function verifyGroupPassword(int $groupID, string $password): array
|
||||||
{
|
{
|
||||||
$group = GoodsGroup::query()
|
$group = GoodsGroup::query()
|
||||||
|
->with(['goods' => function($query) {
|
||||||
|
$query->withCount(['carmis' => function($query) {
|
||||||
|
$query->where('status', Carmis::STATUS_UNSOLD);
|
||||||
|
}])->where('is_open', Goods::STATUS_OPEN)->orderBy('ord', 'DESC');
|
||||||
|
}])
|
||||||
->where('is_open', GoodsGroup::STATUS_OPEN)
|
->where('is_open', GoodsGroup::STATUS_OPEN)
|
||||||
->where('id', $groupID)
|
->where('id', $groupID)
|
||||||
->first();
|
->first();
|
||||||
@ -127,7 +132,7 @@ class GoodsService
|
|||||||
|
|
||||||
if (!$this->isGroupPasswordProtected($group)) {
|
if (!$this->isGroupPasswordProtected($group)) {
|
||||||
$this->grantGroupAccess($group->id);
|
$this->grantGroupAccess($group->id);
|
||||||
return true;
|
return $this->formatGroupForResponse($group);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hash_equals((string) $group->group_pwd, (string) $password)) {
|
if (!hash_equals((string) $group->group_pwd, (string) $password)) {
|
||||||
@ -135,7 +140,24 @@ class GoodsService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->grantGroupAccess($group->id);
|
$this->grantGroupAccess($group->id);
|
||||||
return true;
|
return $this->formatGroupForResponse($group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化分类接口返回数据
|
||||||
|
*
|
||||||
|
* @param GoodsGroup $group 分类模型
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function formatGroupForResponse(GoodsGroup $group): array
|
||||||
|
{
|
||||||
|
$data = $group->toArray();
|
||||||
|
foreach ($data['goods'] as &$goods) {
|
||||||
|
$goods['picture_url'] = picture_ulr($goods['picture']);
|
||||||
|
}
|
||||||
|
unset($goods);
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,6 +174,22 @@ class GoodsService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消当前会话访问指定分类的授权
|
||||||
|
*
|
||||||
|
* @param int $groupID 分类id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function forgetGroupAccess(int $groupID): void
|
||||||
|
{
|
||||||
|
$groupIDs = session('dujiaoka_group_pwd_access', []);
|
||||||
|
$groupIDs = array_values(array_filter($groupIDs, function ($id) use ($groupID) {
|
||||||
|
return (int) $id !== $groupID;
|
||||||
|
}));
|
||||||
|
|
||||||
|
session(['dujiaoka_group_pwd_access' => $groupIDs]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权当前会话访问分类
|
* 授权当前会话访问分类
|
||||||
*
|
*
|
||||||
|
|||||||
10
public/assets/luna/main.js
vendored
10
public/assets/luna/main.js
vendored
@ -64,7 +64,15 @@
|
|||||||
}, function (res) {
|
}, function (res) {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
window.location.reload();
|
|
||||||
|
res.data.key = group.key;
|
||||||
|
res.data.is_group_locked = 0;
|
||||||
|
goodsMsg[group.key] = res.data;
|
||||||
|
|
||||||
|
laytpl(cateTpl).render(res.data, function (html) {
|
||||||
|
$('.cate-box').eq(group.key).replaceWith(html);
|
||||||
|
});
|
||||||
|
changeCate(group.key, true);
|
||||||
} else {
|
} else {
|
||||||
layer.msg(res.msg);
|
layer.msg(res.msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,11 +14,11 @@
|
|||||||
<div class="text-error mt-4">error</div>
|
<div class="text-error mt-4">error</div>
|
||||||
<h1 class="text-uppercase text-danger mt-3">{{ $content }}</h1>
|
<h1 class="text-uppercase text-danger mt-3">{{ $content }}</h1>
|
||||||
@if(!$url)
|
@if(!$url)
|
||||||
<a class="btn btn-info mt-3" href="javascript:history.back(-1);"><i class="mdi mdi-reply"></i> {{ __('hyper.error_back_btn') }}</a>
|
<a class="btn btn-info mt-3" href="{{ url('/') }}"><i class="mdi mdi-reply"></i> {{ __('hyper.error_back_btn') }}</a>
|
||||||
@else
|
@else
|
||||||
<a class="btn btn-info mt-3" href="{{ $url }}"><i class="mdi mdi-reply"></i> {{ __('hyper.error_back_btn') }}</a>
|
<a class="btn btn-info mt-3" href="{{ $url }}"><i class="mdi mdi-reply"></i> {{ __('hyper.error_back_btn') }}</a>
|
||||||
@endif
|
@endif
|
||||||
</div> <!-- end /.text-center-->
|
</div> <!-- end /.text-center-->
|
||||||
</div> <!-- end col-->
|
</div> <!-- end col-->
|
||||||
</div>
|
</div>
|
||||||
@stop
|
@stop
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<div class="page-title-right">
|
<div class="page-title-right">
|
||||||
<div class="app-search">
|
<div class="app-search">
|
||||||
<div class="position-relative">
|
<div class="position-relative">
|
||||||
<input type="text" class="form-control" id="search" placeholder="{{ __('hyper.home_search_box') }}">
|
<input type="text" class="form-control" id="search" name="goods_search_{{ time() }}" value="" autocomplete="off" placeholder="{{ __('hyper.home_search_box') }}">
|
||||||
<span class="uil-search"></span>
|
<span class="uil-search"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -142,6 +142,11 @@
|
|||||||
$('#notice-open').click(function() {
|
$('#notice-open').click(function() {
|
||||||
$('#notice-modal').modal();
|
$('#notice-modal').modal();
|
||||||
});
|
});
|
||||||
|
var groupPasswordPassed = false;
|
||||||
|
|
||||||
|
clearSearchInput();
|
||||||
|
setTimeout(clearSearchInput, 300);
|
||||||
|
|
||||||
$("#search").on("input",function(e){
|
$("#search").on("input",function(e){
|
||||||
var txt = $("#search").val();
|
var txt = $("#search").val();
|
||||||
if($.trim(txt)!="") {
|
if($.trim(txt)!="") {
|
||||||
@ -150,27 +155,110 @@
|
|||||||
$(".category").show();
|
$(".category").show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.group-password-link').click(function() {
|
|
||||||
|
$('.tab-link:not(.group-password-link)').click(function() {
|
||||||
|
resetPasswordGroups();
|
||||||
|
forgetAllPasswordGroupAccess();
|
||||||
|
clearSearchInput();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.group-password-link', function() {
|
||||||
$('#group-password-id').val($(this).data('group-id'));
|
$('#group-password-id').val($(this).data('group-id'));
|
||||||
$('#group-password-name').text($(this).data('group-name'));
|
$('#group-password-name').text($(this).data('group-name'));
|
||||||
$('#group-password-input').val('');
|
$('#group-password-input').val('');
|
||||||
$('#group-password-modal').modal();
|
$('#group-password-modal').modal();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#group-password-modal').on('hidden.bs.modal', function() {
|
||||||
|
if (!groupPasswordPassed) {
|
||||||
|
resetPasswordGroups();
|
||||||
|
forgetAllPasswordGroupAccess();
|
||||||
|
clearSearchInput();
|
||||||
|
showAllGroup();
|
||||||
|
}
|
||||||
|
groupPasswordPassed = false;
|
||||||
|
});
|
||||||
|
|
||||||
$('#group-password-submit').click(function() {
|
$('#group-password-submit').click(function() {
|
||||||
|
var groupId = $('#group-password-id').val();
|
||||||
|
|
||||||
$.post("{{ url('verify-group-password') }}", {
|
$.post("{{ url('verify-group-password') }}", {
|
||||||
_token: "{{ csrf_token() }}",
|
_token: "{{ csrf_token() }}",
|
||||||
group_id: $('#group-password-id').val(),
|
group_id: groupId,
|
||||||
password: $('#group-password-input').val()
|
password: $('#group-password-input').val()
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
window.location.reload();
|
groupPasswordPassed = true;
|
||||||
|
unlockGroup(groupId, res.data);
|
||||||
|
clearSearchInput();
|
||||||
|
$('#group-password-modal').modal('hide');
|
||||||
} else {
|
} else {
|
||||||
$.NotificationApp.send("{{ __('hyper.home_tip') }}", res.msg, "top-center", "rgba(0,0,0,0.2)", "error");
|
$.NotificationApp.send("{{ __('hyper.home_tip') }}", res.msg, "top-center", "rgba(0,0,0,0.2)", "error");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function unlockGroup(groupId, group) {
|
||||||
|
resetPasswordGroups(groupId);
|
||||||
|
|
||||||
|
var $link = $('.group-password-link[data-group-id="' + groupId + '"]');
|
||||||
|
$('#group-' + groupId + ' .hyper-wrapper').html(renderGroupGoods(group.goods || []));
|
||||||
|
|
||||||
|
$('.tab-link').removeClass('active');
|
||||||
|
$('.tab-pane').removeClass('active show');
|
||||||
|
$link.addClass('active');
|
||||||
|
$('#group-' + groupId).addClass('active show');
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetPasswordGroups(exceptGroupId) {
|
||||||
|
$('.group-password-link').each(function() {
|
||||||
|
var groupId = String($(this).data('group-id'));
|
||||||
|
if (exceptGroupId && groupId === String(exceptGroupId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#group-' + groupId + ' .hyper-wrapper').empty();
|
||||||
|
$(this).removeClass('active');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function forgetAllPasswordGroupAccess() {
|
||||||
|
$('.group-password-link').each(function() {
|
||||||
|
$.post("{{ url('forget-group-password-access') }}", {
|
||||||
|
_token: "{{ csrf_token() }}",
|
||||||
|
group_id: $(this).data('group-id')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showAllGroup() {
|
||||||
|
$('.tab-link').removeClass('active');
|
||||||
|
$('.tab-pane').removeClass('active show');
|
||||||
|
$('.tab-link[href="#group-all"]').addClass('active');
|
||||||
|
$('#group-all').addClass('active show');
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearSearchInput() {
|
||||||
|
$('#search').val('');
|
||||||
|
$('.category').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderGroupGoods(goodsList) {
|
||||||
|
var html = '';
|
||||||
|
$.each(goodsList, function(index, goods) {
|
||||||
|
if (parseInt(goods.in_stock) > 0) {
|
||||||
|
html += '<a href="/buy/' + goods.id + '" class="home-card category">';
|
||||||
|
} else {
|
||||||
|
html += '<a href="javascript:void(0);" onclick="sell_out_tip()" class="home-card category ribbon-box">';
|
||||||
|
html += '<div class="ribbon-two ribbon-two-danger"><span>{{ __('hyper.home_out_of_stock') }}</span></div>';
|
||||||
|
}
|
||||||
|
html += '<img class="home-img" src="' + goods.picture_url + '">';
|
||||||
|
html += '<div class="flex"><p class="name">' + goods.gd_name + '</p>';
|
||||||
|
html += '<div class="price">{{ __('hyper.global_currency') }}<b>' + goods.actual_price + '</b></div></div></a>';
|
||||||
|
});
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
function sell_out_tip() {
|
function sell_out_tip() {
|
||||||
$.NotificationApp.send("{{ __('hyper.home_tip') }}","{{ __('hyper.home_sell_out_tip') }}","top-center","rgba(0,0,0,0.2)","info");
|
$.NotificationApp.send("{{ __('hyper.home_tip') }}","{{ __('hyper.home_sell_out_tip') }}","top-center","rgba(0,0,0,0.2)","info");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<div class="err_content">{{ $content }}</div>
|
<div class="err_content">{{ $content }}</div>
|
||||||
@if(!$url)
|
@if(!$url)
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<a href="javascript:history.back(-1);">
|
<a href="{{ url('/') }}">
|
||||||
<span>{{ __('dujiaoka.callback') }}</span>
|
<span>{{ __('dujiaoka.callback') }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -48,5 +48,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-12 mt-3 text-center">
|
<div class="col-12 mt-3 text-center">
|
||||||
@if(!$url)
|
@if(!$url)
|
||||||
<a href="javascript:history.back(-1);" class="btn btn-outline-dark">{{ __('dujiaoka.callback') }}</a>
|
<a href="{{ url('/') }}" class="btn btn-outline-dark">{{ __('dujiaoka.callback') }}</a>
|
||||||
@else
|
@else
|
||||||
<a href="{{ $url }}" class="btn btn-outline-dark">{{ __('dujiaoka.callback') }}</a>
|
<a href="{{ $url }}" class="btn btn-outline-dark">{{ __('dujiaoka.callback') }}</a>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@ -226,17 +226,73 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#group-password-submit').click(function() {
|
$('#group-password-submit').click(function() {
|
||||||
|
var groupId = $('#group-password-id').val();
|
||||||
|
|
||||||
$.post("{{ url('verify-group-password') }}", {
|
$.post("{{ url('verify-group-password') }}", {
|
||||||
_token: "{{ csrf_token() }}",
|
_token: "{{ csrf_token() }}",
|
||||||
group_id: $('#group-password-id').val(),
|
group_id: groupId,
|
||||||
password: $('#group-password-input').val()
|
password: $('#group-password-input').val()
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
window.location.reload();
|
unlockGroup(groupId, res.data);
|
||||||
|
hideGroupPasswordModal();
|
||||||
} else {
|
} else {
|
||||||
alert(res.msg);
|
alert(res.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function hideGroupPasswordModal() {
|
||||||
|
var modalEl = document.getElementById('group-password-modal');
|
||||||
|
if (typeof bootstrap !== 'undefined' && bootstrap.Modal) {
|
||||||
|
bootstrap.Modal.getOrCreateInstance(modalEl).hide();
|
||||||
|
} else {
|
||||||
|
$('#group-password-modal').modal('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function unlockGroup(groupId, group) {
|
||||||
|
var $link = $('.group-password-link[data-group-id="' + groupId + '"]');
|
||||||
|
$link.removeClass('group-password-link')
|
||||||
|
.attr('href', '#group-' + groupId)
|
||||||
|
.attr('data-bs-toggle', 'tab')
|
||||||
|
.find('.ali-icon')
|
||||||
|
.remove();
|
||||||
|
|
||||||
|
$('#group-' + groupId + ' .row').html(renderGroupGoods(group.goods || []));
|
||||||
|
|
||||||
|
if (typeof bootstrap !== 'undefined' && bootstrap.Tab) {
|
||||||
|
bootstrap.Tab.getOrCreateInstance($link[0]).show();
|
||||||
|
} else if (typeof $link.tab === 'function') {
|
||||||
|
$link.tab('show');
|
||||||
|
} else {
|
||||||
|
$('.category-menus a').removeClass('active');
|
||||||
|
$('.tab-pane').removeClass('active show');
|
||||||
|
$link.addClass('active');
|
||||||
|
$('#group-' + groupId).addClass('active show');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderGroupGoods(goodsList) {
|
||||||
|
var html = '';
|
||||||
|
$.each(goodsList, function(index, goods) {
|
||||||
|
html += '<div class="col"><div class="card position-relative">';
|
||||||
|
if (parseInt(goods.type) === {{ \App\Models\Goods::AUTOMATIC_DELIVERY }}) {
|
||||||
|
html += '<span class="badge bg-success position-absolute top-0 start-0"><i class="ali-icon"></i> {{ __('goods.fields.automatic_delivery') }}</span>';
|
||||||
|
} else {
|
||||||
|
html += '<span class="badge bg-warning position-absolute top-0 start-0"><i class="ali-icon"></i> {{ __('goods.fields.manual_processing') }}</span>';
|
||||||
|
}
|
||||||
|
html += '<img src="' + goods.picture_url + '" class="card-img-top" alt="' + goods.gd_name + '">';
|
||||||
|
html += '<div class="card-body"><h6 class="card-title text-truncate">' + goods.gd_name + '</h6>';
|
||||||
|
html += '<button type="button" class="btn btn-sm btn-outline-success"><i class="ali-icon"></i> <strong>' + goods.actual_price + '</strong></button>';
|
||||||
|
if (goods.wholesale_price_cnf) {
|
||||||
|
html += ' <button type="button" class="btn btn-sm btn-outline-warning"><i class="ali-icon"></i> {{ __('dujiaoka.home_discount') }}</button>';
|
||||||
|
}
|
||||||
|
html += '<h6 class="mt-2"><small class="text-muted">{{ __('goods.fields.in_stock') }}:' + goods.in_stock + '</small></h6>';
|
||||||
|
html += '<a href="/buy/' + goods.id + '" class="btn btn-primary fr"><i class="ali-icon"></i> {{ __('dujiaoka.order_now') }}</a>';
|
||||||
|
html += '</div></div></div>';
|
||||||
|
});
|
||||||
|
return html;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@stop
|
@stop
|
||||||
|
|||||||
@ -18,6 +18,8 @@ Route::group(['middleware' => ['dujiaoka.boot'],'namespace' => 'Home'], function
|
|||||||
Route::get('buy/{id}', 'HomeController@buy');
|
Route::get('buy/{id}', 'HomeController@buy');
|
||||||
// 验证商品分类访问密码
|
// 验证商品分类访问密码
|
||||||
Route::post('verify-group-password', 'HomeController@verifyGroupPassword');
|
Route::post('verify-group-password', 'HomeController@verifyGroupPassword');
|
||||||
|
// 取消商品分类密码访问授权
|
||||||
|
Route::post('forget-group-password-access', 'HomeController@forgetGroupPasswordAccess');
|
||||||
// 提交订单
|
// 提交订单
|
||||||
Route::post('create-order', 'OrderController@createOrder');
|
Route::post('create-order', 'OrderController@createOrder');
|
||||||
// 结算页
|
// 结算页
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user