Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
54833dee
authored
Aug 08, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
禁用启用删除子账号
parent
be171628
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
85 deletions
app/Http/Controllers/Api/SupplierAccountApiController.php
app/Http/Services/SupplierSubAccountService.php
resources/views/script/SupplierSubAccountListScript.blade.php
resources/views/web/SupplierSubAccountList.blade.php
app/Http/Controllers/Api/SupplierAccountApiController.php
View file @
54833dee
...
...
@@ -186,9 +186,9 @@ class SupplierAccountApiController extends Controller
if
(
$validator
->
fails
())
{
$this
->
response
(
-
1
,
$validator
->
errors
()
->
first
());
}
$data
[
'user_rule'
]
=
$data
[
'user_rule'
]
?:
[];
$data
[
'user_rule'
]
=
$data
[
'user_rule'
]
?:
[];
$data
[
'user_rule'
]
=
json_encode
(
$data
[
'user_rule'
]);
$data
[
'user_message_rule'
]
=
$data
[
'user_message_rule'
]
?:
[];
$data
[
'user_message_rule'
]
=
$data
[
'user_message_rule'
]
?:
[];
$data
[
'user_message_rule'
]
=
json_encode
(
$data
[
'user_message_rule'
]);
$accountId
=
$data
[
'account_id'
];
unset
(
$data
[
'account_id'
]);
...
...
@@ -205,18 +205,17 @@ class SupplierAccountApiController extends Controller
}
}
//
禁用子账号
public
function
DisableSupplierSubAccount
(
$request
)
//
修改子账号状态
public
function
ChangeSupplierSubAccountStatus
(
$request
)
{
$id
=
$request
->
get
(
'id'
);
$model
=
new
SupplierAccountModel
();
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
);
$data
[
'a_status'
]
=
0
;
$result
=
$model
->
where
(
'id'
,
$id
)
->
update
(
$data
);
$accountId
=
$request
->
input
(
'account_id'
);
$sbatId
=
$request
->
input
(
'sbat_id'
);
$status
=
$request
->
input
(
'status'
);
$result
=
(
new
SupplierSubAccountService
())
->
changeSupplierSubAccountStatus
(
$accountId
,
$sbatId
,
$status
);
if
(
$result
)
{
$this
->
response
(
0
,
'
禁用
成功'
);
$this
->
response
(
0
,
'
操作
成功'
);
}
$this
->
response
(
-
1
,
'
禁用
失败'
,
$result
);
$this
->
response
(
-
1
,
'
操作
失败'
,
$result
);
}
//删除子账号
...
...
app/Http/Services/SupplierSubAccountService.php
View file @
54833dee
...
...
@@ -87,11 +87,11 @@ class SupplierSubAccountService
public
function
getSupplierAccountPermList
(
$accountId
,
$sbatId
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/getMenu'
;
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/getMenu'
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
if
(
$sbatId
)
{
$params
[
'sbat_id'
]
=
$sbatId
;
}
else
{
}
else
{
$params
[
'method'
]
=
'add'
;
}
$result
=
json_decode
(
curl
(
$url
,
$params
),
true
);
...
...
@@ -158,11 +158,13 @@ class SupplierSubAccountService
//修改子账号状态
//1启动2禁用0删除
public
function
changeSupplierSubAccountStatus
(
$accountId
,
$status
)
public
function
changeSupplierSubAccountStatus
(
$accountId
,
$s
batId
,
$s
tatus
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/changeStatus'
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
$result
=
json_decode
(
curl
(
$url
,
$params
),
true
);
$params
[
'status'
]
=
$status
;
$params
[
'sbat_id'
]
=
$sbatId
;
$result
=
json_decode
(
curl
(
$url
,
$params
,
true
),
true
);
if
(
isset
(
$result
[
'code'
])
&&
$result
[
'code'
]
==
0
)
{
return
true
;
}
...
...
resources/views/script/SupplierSubAccountListScript.blade.php
View file @
54833dee
...
...
@@ -24,6 +24,7 @@
{field: '
create_type_cn
', title: '
创建人
', align: '
center
', width: 150},
{field: '
create_time_cn
', title: '
创建时间
', align: '
center
', width: 150},
{field: '
update_time_cn
', title: '
修改时间
', align: '
center
', width: 150},
{field: '
operate
', title: '
操作
', align: '
left
', templet: '
#
edit
'},
];
let currentPage = 0;
table.render({
...
...
@@ -45,95 +46,105 @@
}
});
//启用
$("#enable_supplier_sub_account").click(function () {
let checkStatus = table.checkStatus('
supplierSubAccountList
');
let data = checkStatus.data;
if (!data.length) {
layer.msg('
请先选择要操作的供应商账号
', {icon: 5})
} else {
layer.confirm('
确定要启用该供应商账号吗
?
', function (index) {
let id = data[0].id;
let res = ajax('
/
api
/
supplier_account
/
EnableSupplierSubAccount
', {id: id})
if (res.err_code === 0) {
table.reload('
supplierSubAccountList
');
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
table.on('
tool
(
supplierSubAccountList
)
', function (obj) {
let event = obj.event;
let sbatId = obj.data.sbat_id;
let ynatId = obj.data.ynat_id;
let accountId = getQueryVariable('
account_id
');
if (event === '
detail
') {
layer.open({
type: 2,
area: ['
95
%
', '
95
%
'],
fixed: false,
title: '
编辑子账号
',
content: '
/
supplier_account
/
SaveSupplierSubAccount
?
view
=
iframe
&
account_id
=
' + accountId + '
&
sbat_id
=
' + sbatId + '
&
ynat_id
=
' + ynatId,
end: function () {
table.reload('
supplierSubAccountList
', {
page: {
curr: 1 //重新从第 1 页开始
},
});
}
});
}
});
if (event === '
delete
') {
layer.confirm('
你确定要删除该子账号吗?
', {
btn: ['
确定
', '
取消
'] //按钮
}, function (index) {
const url = '
/
api
/
supplier_account
/
ChangeSupplierSubAccountStatus
';
const data = {
account_id: accountId,
sbat_id: sbatId,
status: 0,
};
layer.closeAll();
$.post(url, data, function (res) {
res = JSON.parse(res);
if (res.code === 0) {
table.reload('
supplierSubAccountList
');
layer.msg("删除成功", {icon: 6});
}
});
});
}
if (event === '
enable
') {
layer.confirm('
你确定要启用该子账号吗?
', {
btn: ['
确定
', '
取消
'] //按钮
}, function (index) {
const url = '
/
api
/
supplier_account
/
ChangeSupplierSubAccountStatus
';
const data = {
account_id: accountId,
sbat_id: sbatId,
status: 1,
};
layer.closeAll();
$.post(url, data, function (res) {
res = JSON.parse(res);
if (res.code === 0) {
table.reload('
supplierSubAccountList
');
layer.msg("启用成功", {icon: 6});
}
});
});
//禁用
$("#disable_supplier_sub_account").click(function () {
let checkStatus = table.checkStatus('
supplierSubAccountList
');
let data = checkStatus.data;
if (!data.length) {
layer.msg('
请先选择要操作的供应商账号
', {icon: 5})
} else {
layer.confirm('
确定要禁用该供应商账号吗
?
', function (index) {
let id = data[0].id;
let res = ajax('
/
api
/
supplier_account
/
DisableSupplierSubAccount
', {id: id})
if (res.err_code === 0) {
table.reload('
supplierSubAccountList
');
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
}
if (event === '
disable
') {
layer.confirm('
你确定要禁用该子账号吗?
', {
btn: ['
确定
', '
取消
'] //按钮
}, function (index) {
const url = '
/
api
/
supplier_account
/
ChangeSupplierSubAccountStatus
';
const data = {
account_id: accountId,
sbat_id: sbatId,
status: 2,
};
layer.closeAll();
$.post(url, data, function (res) {
res = JSON.parse(res);
if (res.code === 0) {
console.log(res.code);
table.reload('
supplierSubAccountList
');
layer.msg("禁用成功", {icon: 6});
}
});
});
}
});
//根据供应商编码已经品牌等去基石调用接口下架
$("#add_supplier_sub_account").click(function () {
layer.open({
type: 2,
content: '
/
supplier_account
/
SaveSupplierSubAccount
?
view
=
iframe
&
account_id
=
'
+
getQueryVariable('
account_id
'),
content: '
/
supplier_account
/
SaveSupplierSubAccount
?
view
=
iframe
&
account_id
=
'
+
getQueryVariable('
account_id
'),
area: ['
70
%
', '
80
%
'],
title: '
添加供应商账号
',
end: function () {
table.reload('
supplierSubAccountList
');
// supplierStatistics();
}
});
});
$("#updateSupplierAccountPerm").click(function () {
layer.open({
type: 2,
content: '
/
supplier_sub_account
/
AddSupplierSubAccount
?
view
=
iframe
',
area: ['
800
px
', '
600
px
'],
title: '
添加供应商账号
',
end: function () {
table.reload('
supplierSubAccountList
');
// supplierStatistics();
}
});
});
$("#update_supplier_sub_account").click(function () {
let checkStatus = table.checkStatus('
supplierSubAccountList
');
let data = checkStatus.data;
if (!data.length) {
layer.msg('
请先选择要操作的供应商
', {icon: 5})
} else {
let id = data[0].id;
layer.open({
type: 2,
content: '
/
supplier_sub_account
/
UpdateSupplierSubAccount
?
view
=
iframe
&
id
=
' + id,
area: ['
800
px
', '
600
px
'],
title: '
批量下架
SKU
',
end: function () {
table.reload('
supplierSubAccountList
');
// supplierStatistics();
}
});
}
});
form.on('
submit
(
load
)
', function (data) {
whereCondition = $.extend(false, initCondition, data.field);
...
...
resources/views/web/SupplierSubAccountList.blade.php
View file @
54833dee
...
...
@@ -73,5 +73,18 @@
<table
class=
"layui-table"
id=
"supplierSubAccountList"
lay-filter=
"supplierSubAccountList"
></table>
</div>
<script
type=
"text/html"
id=
"edit"
>
<
button
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"detail"
value
=
"@{{ d.id }}"
><
strong
>
详情
<
/strong></
button
>
@{{
#
if
(
d
.
status
==
1
){
}}
<
button
class
=
"layui-btn layui-btn-xs layui-btn-outline layui-btn-danger"
lay
-
event
=
"disable"
><
strong
>
禁用
<
/strong
>
<
/button
>
@{{
#
}
else
{
}}
<
button
class
=
"layui-btn layui-btn-xs layui-btn-outline"
lay
-
event
=
"enable"
><
strong
>
启用
<
/strong></
button
>
@{{
#
}
}}
<
button
class
=
"layui-btn layui-btn-xs layui-btn-danger delete"
lay
-
event
=
"delete"
value
=
"@{{ d.id }}"
>
<
strong
>
删除
<
/strong></
button
>
</script>
<script>
</script>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment