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
dfefeafa
authored
Aug 11, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'ysx-芯链子母账号-20230802'
parents
58a3137e
9fd45750
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1107 additions
and
51 deletions
.env
app/Http/Controllers/Api/SupplierAccountApiController.php
app/Http/Controllers/Filter/SupplierAccountFilter.php
app/Http/Controllers/SupplierAccountController.php
app/Http/Controllers/SupplierApplyController.php
app/Http/Services/SupplierAccountService.php
app/Http/Services/SupplierApplyService.php
app/Http/Services/SupplierSubAccountService.php
app/Http/Transformers/SupplierAccountTransformer.php
app/Http/Transformers/SupplierTransformer.php
config/website.php
resources/views/script/SaveSupplierAccountMessagePermScript.blade.php
resources/views/script/SaveSupplierSubAccountScript.blade.php
resources/views/script/SupplierAccountListScript.blade.php
resources/views/script/SupplierSubAccountListScript.blade.php
resources/views/web/SaveSupplierAccountMessagePerm.blade.php
resources/views/web/SaveSupplierSubAccount.blade.php
resources/views/web/SupplierAccountList.blade.php
resources/views/web/SupplierSubAccountList.blade.php
.env
View file @
dfefeafa
...
...
@@ -125,6 +125,7 @@ RABBITMQ2_QUEUE=wms_service
ES_SKU_URL=http://so.liexin.net/search/Es/searchSku
ES_URL=http://so.liexin.net
CLOUD_URL=http://cloud.liexindev.net
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
...
...
@@ -146,4 +147,4 @@ MENU_ID=16
MENU_URL=http://data.liexin.net/api/config/
FOOTSTONE_URL=http://footstone.liexindev.net
#标签系统的地址
TAG_URL=http://192.168.1.18:32581
\ No newline at end of file
TAG_URL=http://192.168.1.18:32581
app/Http/Controllers/Api/SupplierAccountApiController.php
View file @
dfefeafa
...
...
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use
App\Http\Controllers\Filter\SupplierAccountFilter
;
use
App\Http\Services\LogService
;
use
App\Http\Services\SupplierAccountService
;
use
App\Http\Services\SupplierSubAccountService
;
use
App\Http\Transformers\SupplierLogTransformer
;
use
App\Http\Validators\SupplierAccountValidator
;
use
App\Model\LogModel
;
...
...
@@ -16,6 +17,7 @@ use App\Model\SupplierLogModel;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Redis
;
use
Illuminate\Support\Facades\Validator
;
use
PhpAmqpLib\Connection\AMQPStreamConnection
;
use
PhpAmqpLib\Message\AMQPMessage
;
...
...
@@ -133,6 +135,7 @@ class SupplierAccountApiController extends Controller
$this
->
response
(
-
1
,
'禁用失败'
,
$result
);
}
//获取芯链账号
public
function
GetSupplierAccount
(
$request
)
{
$id
=
$request
->
input
(
'id'
);
...
...
@@ -140,8 +143,91 @@ class SupplierAccountApiController extends Controller
$account
=
SupplierAccountModel
::
where
(
'id'
,
$id
)
->
first
()
->
toArray
();
$logService
=
new
LogService
();
$temp
=
(
$type
==
'mobile'
)
?
'账号'
:
'密码'
;
$content
=
$request
->
user
->
name
.
' 查看了
供应商
账号的'
.
$temp
;
$content
=
$request
->
user
->
name
.
' 查看了
芯链
账号的'
.
$temp
;
$logService
->
AddLog
(
$account
[
'supplier_id'
],
LogModel
::
VIEW_OPERATE
,
'查看供应商基本资料'
,
$content
);
$this
->
response
(
0
,
'ok'
,
$account
);
}
//子账号管理
public
function
GetSupplierSubAccountList
(
$request
)
{
$map
=
$request
->
all
();
$result
=
(
new
SupplierSubAccountService
())
->
getSupplierSubAccountList
(
$map
);
$this
->
response
(
0
,
'ok'
,
$result
[
'list'
],
$result
[
'total'
]);
}
public
function
SaveSupplierSubAccount
(
$request
)
{
$data
=
$request
->
only
([
'account_id'
,
'sbat_id'
,
'mobile'
,
'password_raw'
,
'name'
,
'email'
,
'user_rule'
,
'user_message_rule'
,
]);
$rules
=
[
"mobile"
=>
"required|regex:/^1[0-9][0-9]
{
9
}
$/"
,
"password_raw"
=>
"required"
,
"name"
=>
"required"
,
"email"
=>
"required|email"
,
];
$messages
=
[
'supplier_code.required'
=>
'请选择一个供应商'
,
'mobile.required'
=>
'登录账号不能为空'
,
'mobile.regex'
=>
'账号格式必须为手机号'
,
'email.email'
=>
'邮箱格式不对'
,
'password_raw.required'
=>
'账号密码不能为空'
,
];
$validator
=
Validator
::
make
(
$data
,
$rules
,
$messages
);
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
$this
->
response
(
-
1
,
$validator
->
errors
()
->
first
());
}
$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'
]
=
json_encode
(
$data
[
'user_message_rule'
]);
$accountId
=
$data
[
'account_id'
];
unset
(
$data
[
'account_id'
]);
if
(
empty
(
$data
[
'sbat_id'
]))
{
unset
(
$data
[
'sbat_id'
]);
$result
=
(
new
SupplierSubAccountService
())
->
addSupplierSubAccount
(
$accountId
,
$data
);
}
else
{
$result
=
(
new
SupplierSubAccountService
())
->
updateSupplierSubAccount
(
$accountId
,
$data
);
}
if
(
$result
===
true
)
{
$this
->
response
(
0
,
'操作成功'
);
}
else
{
$this
->
response
(
-
1
,
$result
);
}
}
//修改子账号状态
public
function
ChangeSupplierSubAccountStatus
(
$request
)
{
$accountId
=
$request
->
input
(
'account_id'
);
$sbatId
=
$request
->
input
(
'sbat_id'
);
$status
=
$request
->
input
(
'status'
);
$result
=
(
new
SupplierSubAccountService
())
->
changeSupplierSubAccountStatus
(
$accountId
,
$sbatId
,
$status
);
if
(
$result
===
true
)
{
$this
->
response
(
0
,
'操作成功'
);
}
$this
->
response
(
-
1
,
'操作失败'
,
$result
);
}
//保存消息菜单
public
function
SaveSupplierAccountMessagePerm
(
$request
)
{
$accountId
=
$request
->
get
(
'account_id'
);
$userMessageRule
=
$request
->
input
(
'user_message_rule'
);
$result
=
(
new
SupplierSubAccountService
())
->
saveMessageMenu
(
$accountId
,
$userMessageRule
);
if
(
$result
===
true
)
{
$this
->
response
(
0
,
'保存成功'
);
}
$this
->
response
(
-
1
,
'保存失败'
,
$result
);
}
}
app/Http/Controllers/Filter/SupplierAccountFilter.php
View file @
dfefeafa
...
...
@@ -3,8 +3,11 @@
namespace
App\Http\Controllers\Filter
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\DepartmentService
;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Support\Facades\DB
;
class
SupplierAccountFilter
{
...
...
@@ -13,7 +16,25 @@ class SupplierAccountFilter
{
$map
=
$request
->
all
();
$model
=
new
SupplierAccountModel
();
$query
=
$model
->
orderBy
(
'id'
,
'desc'
);
$query
=
$model
->
where
(
'parent_id'
,
0
)
->
orderBy
(
'id'
,
'desc'
);
if
(
!
checkPerm
(
'ViewAllSupplierAccount'
))
{
if
(
checkPerm
(
'ViewSubSupplierAccount'
))
{
$departmentService
=
new
DepartmentService
();
//下属用户id(结果包括自己的id)
$subordinateUserIds
=
$departmentService
->
getSubordinateUserIds
(
$request
->
user
->
userId
);
$adminUserService
=
new
AdminUserService
();
$subordinateCodeIds
=
$adminUserService
->
getCodeIdsByUserIds
(
$subordinateUserIds
);
$subordinateCodeIds
=
$subordinateCodeIds
->
toArray
();
$supplierIds
=
SupplierChannelModel
::
whereIn
(
'yunxin_channel_uid'
,
$subordinateCodeIds
)
->
pluck
(
'supplier_id'
)
->
toArray
();
$query
->
whereIn
(
'supplier_id'
,
$supplierIds
);
}
else
{
//否则只能查看自己的
$supplierIds
=
SupplierChannelModel
::
where
(
'yunxin_channel_uid'
,
$request
->
user
->
codeId
)
->
pluck
(
'supplier_id'
)
->
toArray
();
$query
->
whereIn
(
'supplier_id'
,
$supplierIds
);
}
}
if
(
!
empty
(
$map
[
'supplier_name'
]))
{
//先去供应商主表找出id
$supplierChannelModel
=
new
SupplierChannelModel
();
...
...
@@ -54,4 +75,4 @@ class SupplierAccountFilter
return
$query
;
}
}
\ No newline at end of file
}
app/Http/Controllers/SupplierAccountController.php
View file @
dfefeafa
...
...
@@ -3,8 +3,10 @@
namespace
App\Http\Controllers
;
use
App\Http\Services\RoleService
;
use
App\Http\Services\SupplierAccountService
;
use
App\Http\Services\SupplierContactService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierSubAccountService
;
use
App\Http\Services\ViewCheckService
;
use
App\Model\IntracodeModel
;
use
App\Model\SupplierAccountModel
;
...
...
@@ -42,8 +44,8 @@ class SupplierAccountController extends Controller
//操作日志列表
public
function
SupplierAccountList
(
$request
)
{
$this
->
data
[
'title'
]
=
'
供应商
账号列表'
;
return
$this
->
view
(
'
供应商
账号列表'
);
$this
->
data
[
'title'
]
=
'
芯链
账号列表'
;
return
$this
->
view
(
'
芯链
账号列表'
);
}
public
function
AddSupplierAccount
(
$request
)
...
...
@@ -60,8 +62,8 @@ class SupplierAccountController extends Controller
$supplierCodes
[
$supplier
[
'supplier_code'
]]
=
$supplier
[
'supplier_name'
]
.
'('
.
$supplier
[
'supplier_code'
]
.
')'
;
}
$this
->
data
[
'supplierCodes'
]
=
$supplierCodes
;
$this
->
data
[
'title'
]
=
'添加
供应商
账号'
;
return
$this
->
view
(
'添加
供应商
账号'
);
$this
->
data
[
'title'
]
=
'添加
芯链
账号'
;
return
$this
->
view
(
'添加
芯链
账号'
);
}
public
function
UpdateSupplierAccount
(
$request
)
...
...
@@ -81,9 +83,58 @@ class SupplierAccountController extends Controller
$supplierCodes
[
$supplier
[
'supplier_code'
]]
=
$supplier
[
'supplier_name'
]
.
'('
.
$supplier
[
'supplier_code'
]
.
')'
;
}
$this
->
data
[
'supplierCodes'
]
=
$supplierCodes
;
$this
->
data
[
'title'
]
=
'编辑
供应商
账号'
;
$this
->
data
[
'title'
]
=
'编辑
芯链
账号'
;
$this
->
data
[
'account'
]
=
$account
;
return
$this
->
view
(
'编辑
供应商
账号'
);
return
$this
->
view
(
'编辑
芯链
账号'
);
}
}
\ No newline at end of file
//子账号列表
public
function
SupplierSubAccountList
(
$request
)
{
$accountId
=
$request
->
input
(
'account_id'
);
if
(
!
$accountId
)
{
return
'账号id不能为空'
;
}
$supplierId
=
SupplierAccountModel
::
where
(
'id'
,
$accountId
)
->
value
(
'supplier_id'
);
$supplier
=
(
new
SupplierService
())
->
getSupplier
(
$supplierId
);
$supplierAccount
=
(
new
SupplierAccountService
())
->
getSupplierAccountBySupplierId
(
$supplierId
);
$this
->
data
[
'supplier'
]
=
$supplier
;
$this
->
data
[
'supplierAccount'
]
=
$supplierAccount
;
$this
->
data
[
'title'
]
=
'子账号管理'
;
return
$this
->
view
(
'子账号管理'
);
}
//新增修改子账号
public
function
SaveSupplierSubAccount
(
$request
)
{
$accountId
=
$request
->
input
(
'account_id'
);
$sbatId
=
$request
->
input
(
'sbat_id'
);
$ynatId
=
$request
->
input
(
'ynat_id'
);
if
(
!
empty
(
$sbatId
))
{
$account
=
(
new
SupplierSubAccountService
())
->
getSupplierSubAccount
(
$accountId
,
$sbatId
);
$this
->
data
[
'account'
]
=
$account
;
}
$menuPerms
=
(
new
SupplierSubAccountService
())
->
getSupplierAccountPermList
(
$accountId
,
$sbatId
);
//区分主账号还是子账号保存消息权限
if
(
$sbatId
)
{
$messagePerms
=
(
new
SupplierSubAccountService
())
->
getSupplierAccountMessagePermList
(
$accountId
,
$ynatId
);
}
else
{
$messagePerms
=
(
new
SupplierSubAccountService
())
->
getSupplierAccountMessagePermList
(
$accountId
,
$ynatId
);
}
$this
->
data
[
'menuPerms'
]
=
$menuPerms
;
$this
->
data
[
'messagePerms'
]
=
$messagePerms
;
$this
->
data
[
'title'
]
=
'子账号编辑'
;
return
$this
->
view
(
'子账号编辑'
);
}
//修改主账号的消息权限
//新增修改子账号
public
function
SaveSupplierAccountMessagePerm
(
$request
)
{
$accountId
=
$request
->
input
(
'account_id'
);
$messagePerms
=
(
new
SupplierSubAccountService
())
->
getSupplierAccountMessagePermList
(
$accountId
,
$accountId
);
$this
->
data
[
'messagePerms'
]
=
$messagePerms
;
$this
->
data
[
'title'
]
=
'子账号编辑'
;
return
$this
->
view
(
'子账号编辑'
);
}
}
app/Http/Controllers/SupplierApplyController.php
View file @
dfefeafa
...
...
@@ -43,8 +43,8 @@ class SupplierApplyController extends Controller
public
function
SupplierApplyList
(
$request
)
{
$this
->
data
[
'auditUidList'
]
=
SupplierApplyModel
::
pluck
(
'audit_name'
,
'audit_uid'
)
->
toArray
();
$this
->
data
[
'title'
]
=
'
供应商
账号列表'
;
return
$this
->
view
(
'
供应商
账号列表'
);
$this
->
data
[
'title'
]
=
'
芯链
账号列表'
;
return
$this
->
view
(
'
芯链
账号列表'
);
}
public
function
AuditSupplierApply
(
$request
)
...
...
@@ -56,4 +56,4 @@ class SupplierApplyController extends Controller
$this
->
data
[
'title'
]
=
'芯链入驻审核'
;
return
$this
->
view
(
'芯链入驻审核'
);
}
}
\ No newline at end of file
}
app/Http/Services/SupplierAccountService.php
View file @
dfefeafa
...
...
@@ -6,7 +6,9 @@ namespace App\Http\Services;
use
App\Http\Controllers\Filter\SupplierAccountFilter
;
use
App\Http\Transformers\SupplierAccountTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\LogModel
;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
Carbon\Carbon
;
...
...
@@ -48,4 +50,12 @@ class SupplierAccountService
$channel
->
close
();
$conn
->
close
();
}
}
\ No newline at end of file
//获取单个账号的信息
public
function
getSupplierAccountBySupplierId
(
$supplierId
)
{
$supplierAccount
=
SupplierAccountModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$supplierAccount
=
(
new
SupplierAccountTransformer
())
->
transformInfo
(
$supplierAccount
);
return
$supplierAccount
;
}
}
app/Http/Services/SupplierApplyService.php
View file @
dfefeafa
...
...
@@ -89,7 +89,7 @@ class SupplierApplyService
if
(
$result
)
{
if
(
$status
==
SupplierApplyModel
::
STATUS_PASS
)
{
$existAccount
=
SupplierAccountModel
::
where
(
'supplier_code'
,
$apply
[
'supplier_code'
])
->
exists
();
//如果没有
供应商账号,那么就要新增供应商
账号
//如果没有
芯链账号,那么就要新增芯链
账号
if
(
$existAccount
)
{
SupplierAccountModel
::
where
(
'supplier_code'
,
$apply
[
'supplier_code'
])
->
update
([
'mobile'
=>
$apply
[
'mobile'
],
...
...
@@ -131,4 +131,4 @@ class SupplierApplyService
}
return
$result
;
}
}
\ No newline at end of file
}
app/Http/Services/SupplierSubAccountService.php
0 → 100644
View file @
dfefeafa
<?php
namespace
App\Http\Services
;
use
App\Http\Controllers\Filter\SupplierAccountFilter
;
use
App\Http\Transformers\SupplierAccountTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\LogModel
;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
Carbon\Carbon
;
use
PhpAmqpLib\Connection\AMQPStreamConnection
;
use
PhpAmqpLib\Message\AMQPMessage
;
class
SupplierSubAccountService
{
public
function
generateRequestAuthData
(
$accountId
)
{
$supplierAccount
=
SupplierAccountModel
::
where
(
'id'
,
$accountId
)
->
first
()
->
toArray
();
return
[
'source_create_type'
=>
2
,
'password'
=>
$supplierAccount
[
'password'
],
'id'
=>
$accountId
,
];
}
public
function
getSupplierSubAccount
(
$accountId
,
$sbatId
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/getSubAccountInfo'
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
$params
[
'sbat_id'
]
=
$sbatId
;
unset
(
$params
[
'account_id'
]);
$result
=
json_decode
(
curl
(
$url
,
$params
),
true
);
if
(
isset
(
$result
[
'code'
])
&&
$result
[
'code'
]
==
0
)
{
return
$result
[
'data'
];
}
return
[];
}
public
function
getSupplierSubAccountList
(
$map
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/list'
;
$params
=
$this
->
generateRequestAuthData
(
$map
[
'account_id'
]);
$params
=
array_merge
(
$map
,
$params
);
unset
(
$params
[
'account_id'
]);
$result
=
json_decode
(
curl
(
$url
,
$params
),
true
);
if
(
isset
(
$result
[
'code'
])
&&
$result
[
'code'
]
==
0
)
{
return
$result
[
'data'
];
}
return
[];
}
//新增子账号
public
function
addSupplierSubAccount
(
$accountId
,
$data
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/create'
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
$params
=
array_merge
(
$data
,
$params
);
$result
=
json_decode
(
curl
(
$url
,
$params
,
true
),
true
);
if
(
isset
(
$result
[
'code'
]))
{
if
(
$result
[
'code'
]
==
0
)
{
return
true
;
}
else
{
return
$result
[
'msg'
];
}
}
return
false
;
}
public
function
updateSupplierSubAccount
(
$accountId
,
$data
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/edit'
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
$params
=
array_merge
(
$data
,
$params
);
$result
=
json_decode
(
curl
(
$url
,
$params
,
true
),
true
);
if
(
isset
(
$result
[
'code'
]))
{
if
(
$result
[
'code'
]
==
0
)
{
return
true
;
}
else
{
return
$result
[
'msg'
];
}
}
return
false
;
}
//获取用户的权限菜单
public
function
getSupplierAccountPermList
(
$accountId
,
$sbatId
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/getMenu'
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
if
(
$sbatId
)
{
$params
[
'sbat_id'
]
=
$sbatId
;
}
else
{
$params
[
'method'
]
=
'add'
;
}
// dump($params);
$result
=
json_decode
(
curl
(
$url
,
$params
),
true
);
if
(
isset
(
$result
[
'code'
])
&&
$result
[
'code'
]
==
0
)
{
$permList
=
$result
[
'data'
][
'data'
];
// dump($permList);
//还要转换成layui能用的格式
$list
=
[];
// dump($permList);
foreach
(
$permList
as
$perm
)
{
$children
=
!
empty
(
$perm
[
'children'
])
?
$this
->
getChildPermList
(
$perm
[
'children'
])
:
[];
$list
[]
=
[
'title'
=>
$perm
[
'name'
],
'checked'
=>
false
,
'disabled'
=>
$perm
[
'disabled'
],
'id'
=>
$perm
[
'id'
],
'spread'
=>
true
,
'children'
=>
$children
];
}
// dd($list);
return
$list
;
}
return
[];
}
public
function
getChildPermList
(
$perm
)
{
if
(
empty
(
$perm
))
{
return
[];
}
$childPermList
=
[];
foreach
(
$perm
as
$key
=>
$item
)
{
$childPermList
[]
=
[
'title'
=>
$item
[
'name'
],
'id'
=>
!
empty
(
$item
[
'id'
])
?
$item
[
'id'
]
:
str_random
(
100
),
'checked'
=>
$item
[
'checked'
],
'disabled'
=>
isset
(
$item
[
'disabled'
])
?
$item
[
'disabled'
]
:
false
,
'spread'
=>
true
,
];
}
return
$childPermList
;
}
public
function
getSupplierAccountMessagePermList
(
$accountId
,
$ynatId
=
0
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/getMessageMenu'
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
if
(
$ynatId
)
{
$params
[
'ynat_id'
]
=
$ynatId
;
}
else
{
$params
[
'method'
]
=
'add'
;
}
$result
=
json_decode
(
curl
(
$url
,
$params
),
true
);
if
(
isset
(
$result
[
'code'
])
&&
$result
[
'code'
]
==
0
)
{
$permList
=
$result
[
'data'
][
'data'
];
//还要转换成layui能用的格式
$list
=
[];
foreach
(
$permList
as
$perm
)
{
$list
[]
=
[
'id'
=>
$perm
[
'id'
],
'title'
=>
$perm
[
'name'
],
'checked'
=>
false
,
'spread'
=>
true
,
'children'
=>
!
empty
(
$perm
[
'children'
])
?
$this
->
getChildPermList
(
$perm
[
'children'
])
:
[],
];
}
return
$list
;
}
return
[];
}
//修改子账号状态
//1启动2禁用0删除
public
function
changeSupplierSubAccountStatus
(
$accountId
,
$sbatId
,
$status
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/changeStatus'
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
$params
[
'status'
]
=
$status
;
$params
[
'sbat_id'
]
=
$sbatId
;
$result
=
json_decode
(
curl
(
$url
,
$params
,
true
),
true
);
if
(
isset
(
$result
[
'code'
]))
{
if
(
$result
[
'code'
]
==
0
)
{
return
true
;
}
else
{
return
$result
[
'msg'
];
}
}
return
false
;
}
public
function
saveMessageMenu
(
$accountId
,
$userMessageRule
)
{
$url
=
config
(
'website.CloudUrl'
)
.
'/inner/subAccount/saveMessageMenu '
;
$params
=
$this
->
generateRequestAuthData
(
$accountId
);
$userMessageRule
=
$userMessageRule
?:
[];
$params
[
'user_message_rule'
]
=
is_array
(
$userMessageRule
)
?
json_encode
(
$userMessageRule
)
:
$userMessageRule
;
$result
=
json_decode
(
curl
(
$url
,
$params
,
true
),
true
);
if
(
isset
(
$result
[
'code'
]))
{
if
(
$result
[
'code'
]
==
0
)
{
return
true
;
}
else
{
return
$result
[
'msg'
];
}
}
return
false
;
}
}
app/Http/Transformers/SupplierAccountTransformer.php
View file @
dfefeafa
...
...
@@ -16,18 +16,36 @@ class SupplierAccountTransformer
$suppliers
=
$supplierModel
->
whereIn
(
'supplier_id'
,
$supplierIds
)
->
pluck
(
'supplier_name'
,
'supplier_id'
);
foreach
(
$list
as
&
$item
)
{
$item
[
'supplier_name'
]
=
array_get
(
$suppliers
,
$item
[
'supplier_id'
]);
$item
[
'type_name'
]
=
array_get
(
config
(
'field.SupplierAccountType'
),
$item
[
'a_type'
]);
$item
[
'create_time'
]
=
$item
[
'create_time'
]
?
date
(
'Y-m-d H:i:s'
,
$item
[
'create_time'
])
:
''
;
$item
[
'update_time'
]
=
$item
[
'update_time'
]
?
date
(
'Y-m-d H:i:s'
,
$item
[
'update_time'
])
:
''
;
if
(
!
empty
(
$item
[
'mobile'
]))
{
$item
[
'mobile'
]
=
substr
(
$item
[
'mobile'
],
0
,
3
)
.
'****'
.
substr
(
$item
[
'mobile'
],
7
);
}
$replace
=
str_pad
(
'*'
,
strlen
(
$item
[
'password_raw'
]),
'*'
);
$item
[
'password_raw'
]
=
str_replace
(
$item
[
'password_raw'
],
$replace
,
$item
[
'password_raw'
]);
$item
=
$this
->
transformInfo
(
$item
);
}
unset
(
$item
);
return
$list
;
}
}
\ No newline at end of file
public
function
transformInfo
(
$item
)
{
$item
[
'type_name'
]
=
array_get
(
config
(
'field.SupplierAccountType'
),
$item
[
'a_type'
]);
$item
[
'create_time'
]
=
$item
[
'create_time'
]
?
date
(
'Y-m-d H:i:s'
,
$item
[
'create_time'
])
:
''
;
$item
[
'update_time'
]
=
$item
[
'update_time'
]
?
date
(
'Y-m-d H:i:s'
,
$item
[
'update_time'
])
:
''
;
if
(
!
empty
(
$item
[
'mobile'
]))
{
$item
[
'mobile'
]
=
substr
(
$item
[
'mobile'
],
0
,
3
)
.
'****'
.
substr
(
$item
[
'mobile'
],
7
);
}
if
(
!
empty
(
$item
[
'email'
]))
{
$emailTemp
=
explode
(
'@'
,
$item
[
'email'
])[
0
];
$replace
=
str_pad
(
'*'
,
strlen
(
$emailTemp
),
'*'
);
$emailTemp
=
str_replace
(
$emailTemp
,
$replace
,
$emailTemp
);
if
(
count
(
explode
(
'@'
,
$item
[
'email'
]))
>
1
)
{
$item
[
'email'
]
=
$emailTemp
.
'@'
.
explode
(
'@'
,
$item
[
'email'
])[
1
];
}
else
{
$item
[
'email'
]
=
$emailTemp
;
}
}
$replace
=
str_pad
(
'*'
,
strlen
(
$item
[
'password_raw'
]),
'*'
);
$item
[
'password_raw'
]
=
str_replace
(
$item
[
'password_raw'
],
$replace
,
$item
[
'password_raw'
]);
return
$item
;
}
}
app/Http/Transformers/SupplierTransformer.php
View file @
dfefeafa
...
...
@@ -204,8 +204,9 @@ class SupplierTransformer
array_get
(
$supplier
,
'has_certification'
,
''
),
''
);
$supplier
[
'sku_tag_name'
]
=
array_get
(
config
(
'field.SkuTag'
),
array_get
(
$supplier
,
'sku_tag'
,
''
),
'无'
);
$supplier
[
'sku_mode_name'
]
=
array_get
(
config
(
'field.SkuMode'
),
array_get
(
$supplier
,
'sku_mode'
,
''
),
'无'
);
// $supplier['purchase_type'] = array_get(config('field.PurchaseType'), array_get($supplier, 'purchase_type', ''), '无');
$supplier
[
'purchase_type_name'
]
=
array_get
(
config
(
'field.PurchaseType'
),
$supplier
[
'purchase_type'
],
'无'
);
$supplier
[
'cp_time_format'
]
=
(
'现货 : '
.
(
$supplier
[
'cp_time_day'
]
==
-
1
?
'无限制'
:
$supplier
[
'cp_time_day'
]
.
'天'
))
.
' | '
.
(
'期货 : '
.
(
$supplier
[
'futures_cp_time_day'
]
==
-
1
?
'无限制'
:
$supplier
[
'futures_cp_time_day'
]
.
'天'
));
return
$supplier
;
}
...
...
@@ -364,4 +365,4 @@ class SupplierTransformer
return
$supplier
;
}
}
\ No newline at end of file
}
config/website.php
View file @
dfefeafa
...
...
@@ -40,4 +40,6 @@ return [
'templet'
=>
'http://footstone.liexin.net/footstone/templet?'
,
// 专卖商品批量导出
],
'TagUrl'
=>
env
(
'TAG_URL'
),
'CloudUrl'
=>
env
(
'CLOUD_URL'
),
];
resources/views/script/SaveSupplierAccountMessagePermScript.blade.php
0 → 100644
View file @
dfefeafa
<script>
layui
.
use
([
'table'
,
'form'
,
'tree'
,
'element'
,
'table'
,
'layer'
,
'admin'
,
'xmSelect'
],
function
()
{
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
let
tree
=
layui
.
tree
;
form
.
on
(
'submit(saveSupplierAccountMessageMenu)'
,
function
(
data
)
{
let
userMessageRule
=
[];
$
(
'#messagePermTree'
).
find
(
'.layui-form-checked'
).
next
(
'span'
).
each
(
function
(
index
,
item
)
{
userMessageRule
.
push
(
$
(
item
).
text
());
});
data
.
field
.
account_id
=
getQueryVariable
(
'account_id'
);
data
.
field
.
user_message_rule
=
userMessageRule
;
let
url
=
'/api/supplier_account/SaveSupplierAccountMessagePerm'
;
let
res
=
ajax
(
url
,
data
.
field
);
if
(
!
res
)
{
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
if
(
res
.
err_code
===
0
)
{
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
}
return
false
;
});
form
.
on
(
'submit(cancel)'
,
function
(
data
)
{
admin
.
closeThisDialog
();
});
let
messagePermTreeData
=
{
!!
json_encode
(
$messagePerms
)
!!
};
console
.
log
(
messagePermTreeData
);
// 渲染树形组件
let
messagePermTree
=
tree
.
render
({
elem
:
'#messagePermTree'
,
id
:
'messagePermTree'
,
showCheckbox
:
true
,
data
:
messagePermTreeData
,
click
:
function
(
obj
)
{
tree
.
reload
(
'messagePermTree'
);
}
});
function
allSelect
(
data
)
{
$
.
each
(
data
,
function
(
index
,
item
)
{
item
.
checked
=
true
;
if
(
item
.
children
.
length
)
{
$
.
each
(
item
.
children
,
function
(
index2
,
item2
)
{
if
(
!
item2
.
checked
)
{
item2
.
checked
=
true
;
}
})
}
})
}
$
(
'#selectAllMessagePerm'
).
click
(
function
()
{
allSelect
(
messagePermTreeData
);
tree
.
reload
(
'messagePermTree'
);
});
});
</script>
resources/views/script/SaveSupplierSubAccountScript.blade.php
0 → 100644
View file @
dfefeafa
<script>
layui
.
use
([
'table'
,
'form'
,
'tree'
,
'element'
,
'table'
,
'layer'
,
'admin'
,
'xmSelect'
],
function
()
{
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
let
tree
=
layui
.
tree
;
form
.
on
(
'submit(saveSupplierSubAccount)'
,
function
(
data
)
{
let
userRule
=
[];
$
(
'#permTree'
).
find
(
'.layui-form-checked'
).
next
(
'span'
).
each
(
function
(
index
,
item
)
{
userRule
.
push
(
$
(
item
).
text
());
});
let
userMessageRule
=
[];
$
(
'#messagePermTree'
).
find
(
'.layui-form-checked'
).
next
(
'span'
).
each
(
function
(
index
,
item
)
{
userMessageRule
.
push
(
$
(
item
).
text
());
});
data
.
field
.
user_rule
=
userRule
;
data
.
field
.
user_message_rule
=
userMessageRule
;
let
url
=
'/api/supplier_account/SaveSupplierSubAccount'
;
let
res
=
ajax
(
url
,
data
.
field
);
if
(
!
res
)
{
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
if
(
res
.
err_code
===
0
)
{
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
}
return
false
;
});
form
.
on
(
'submit(cancel)'
,
function
(
data
)
{
admin
.
closeThisDialog
();
});
let
permTreeData
=
{
!!
json_encode
(
$menuPerms
)
!!
};
// 渲染树形组件
let
permTree
=
tree
.
render
({
elem
:
'#permTree'
,
id
:
'permTree'
,
showCheckbox
:
true
,
data
:
permTreeData
,
oncheck
:
function
(
obj
)
{
$
(
'#permTree .layui-checkbox-disbaled'
).
addClass
(
'layui-form-checked'
);
}
});
let
messagePermTreeData
=
{
!!
json_encode
(
$messagePerms
)
!!
};
// 渲染树形组件
let
messagePermTree
=
tree
.
render
({
elem
:
'#messagePermTree'
,
id
:
'messagePermTree'
,
showCheckbox
:
true
,
data
:
messagePermTreeData
,
oncheck
:
function
(
obj
)
{
}
});
let
isAllSelectPem
=
false
;
let
isAllSelectMessagePem
=
false
;
function
allSelect
(
data
)
{
$
.
each
(
data
,
function
(
index
,
item
)
{
item
.
checked
=
true
;
if
(
item
.
children
.
length
)
{
$
.
each
(
item
.
children
,
function
(
index2
,
item2
)
{
if
(
!
item2
.
checked
)
{
item2
.
checked
=
true
;
}
})
}
});
return
data
;
}
function
excludeAllSelect
(
data
)
{
$
.
each
(
data
,
function
(
index
,
item
)
{
if
(
!
item
.
disabled
)
{
item
.
checked
=
false
;
}
if
(
item
.
children
.
length
)
{
$
.
each
(
item
.
children
,
function
(
index2
,
item2
)
{
if
(
item2
.
checked
)
{
item2
.
checked
=
false
;
}
})
}
});
return
data
;
}
$
(
'#selectAllPerm'
).
click
(
function
()
{
if
(
!
isAllSelectPem
)
{
allSelect
(
permTreeData
);
}
else
{
excludeAllSelect
(
permTreeData
);
}
isAllSelectPem
=
!
isAllSelectPem
;
tree
.
reload
(
'permTree'
,
{
data
:
permTreeData
});
$
(
'#permTree .layui-checkbox-disbaled'
).
addClass
(
'layui-form-checked'
);
});
$
(
'#selectAllMessagePerm'
).
click
(
function
()
{
if
(
!
isAllSelectMessagePem
)
{
messagePermTreeData
=
allSelect
(
messagePermTreeData
);
}
else
{
messagePermTreeData
=
excludeAllSelect
(
messagePermTreeData
);
}
isAllSelectMessagePem
=
!
isAllSelectMessagePem
;
tree
.
reload
(
'messagePermTree'
,
{
data
:
messagePermTreeData
});
});
$
(
function
()
{
$
(
'#permTree .layui-checkbox-disbaled'
).
addClass
(
'layui-form-checked'
);
});
});
</script>
resources/views/script/SupplierAccountListScript.blade.php
View file @
dfefeafa
...
...
@@ -11,19 +11,29 @@
let
whereCondition
=
initCondition
;
let
type
=
'all'
;
let
canViewAccountInfo
=
{{
checkPerm
(
"ViewSupplierAccountInfo"
)?
1
:
0
}};
let
cols
=
[
{
type
:
'radio'
},
{
field
:
'id'
,
title
:
'ID'
,
align
:
'center'
,
width
:
80
},
{
field
:
'mobile'
,
title
:
'账号'
,
align
:
'center'
,
width
:
170
,
templet
:
function
(
data
)
{
return
'
<
span
>
' + data.mobile + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="mobile" id="' + data.id + '">查看</
span
>
'
let
text
=
canViewAccountInfo
?
'查看'
:
''
;
return
'
<
span
>
' + data.mobile + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="mobile" id="' + data.id + '">' + text + '</
span
>
';
}
},
{
field: '
password_raw
', title: '
密码
', align: '
center
', width: 170,
templet: function (data) {
return '
<
span
>
' + data.password_raw + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="password_raw" id="' + data.id + '">查看</
span
>
'
let text = canViewAccountInfo ? '
查看
' : '';
return '
<
span
>
' + data.password_raw + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="password_raw" id="' + data.id + '">' + text + '</
span
>
';
}
},
{
field: '
manage_sub_account
', title: '
子账号
', align: '
center
'
,
width
:
110
,
templet
:
function
(
data
)
{
return
"
<
a
ew
-
href
=
'/supplier_account/SupplierSubAccountList?view=iframe&account_id=" + data.id + "'
class
=
'list-href'
ew
-
title
=
'子账号管理 - " + data.supplier_code + "'
>
" + "
管理
" + "
<
/a>
"
}
},
{
...
...
@@ -64,9 +74,9 @@
let
checkStatus
=
table
.
checkStatus
(
'supplierAccountList'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的
供应商
账号'
,
{
icon
:
5
})
layer
.
msg
(
'请先选择要操作的
芯链
账号'
,
{
icon
:
5
})
}
else
{
layer
.
confirm
(
'确定要启用该
供应商
账号吗?'
,
function
(
index
)
{
layer
.
confirm
(
'确定要启用该
芯链
账号吗?'
,
function
(
index
)
{
let
id
=
data
[
0
].
id
;
let
res
=
ajax
(
'/api/supplier_account/EnableSupplierAccount'
,
{
id
:
id
})
if
(
res
.
err_code
===
0
)
{
...
...
@@ -85,9 +95,9 @@
let
checkStatus
=
table
.
checkStatus
(
'supplierAccountList'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的
供应商
账号'
,
{
icon
:
5
})
layer
.
msg
(
'请先选择要操作的
芯链
账号'
,
{
icon
:
5
})
}
else
{
layer
.
confirm
(
'确定要禁用该
供应商
账号吗?'
,
function
(
index
)
{
layer
.
confirm
(
'确定要禁用该
芯链
账号吗?'
,
function
(
index
)
{
let
id
=
data
[
0
].
id
;
let
res
=
ajax
(
'/api/supplier_account/DisableSupplierAccount'
,
{
id
:
id
})
if
(
res
.
err_code
===
0
)
{
...
...
@@ -107,7 +117,7 @@
type
:
2
,
content
:
'/supplier_account/AddSupplierAccount?view=iframe'
,
area
:
[
'800px'
,
'600px'
],
title
:
'添加
供应商
账号'
,
title
:
'添加
芯链
账号'
,
end
:
function
()
{
table
.
reload
(
'supplierAccountList'
);
// supplierStatistics();
...
...
@@ -194,4 +204,4 @@
});
});
</script>
\ No newline at end of file
</script>
resources/views/script/SupplierSubAccountListScript.blade.php
0 → 100644
View file @
dfefeafa
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'Split'
,
'admin'
,
'xmSelect'
],
function
()
{
let
$
=
layui
.
jquery
;
let
table
=
layui
.
table
;
let
form
=
layui
.
form
;
let
admin
=
layui
.
admin
;
let
initCondition
=
{};
let
whereCondition
=
initCondition
;
whereCondition
.
account_id
=
getQueryVariable
(
'account_id'
);
let
cols
=
[
{
field
:
'mobile'
,
title
:
'子账号'
,
align
:
'center'
,
width
:
300
,
templet
:
function
(
data
)
{
return
'
<
span
>
' + data.mobile + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="mobile" id="' + data.id + '"></
span
>
'
}
},
{
field: '
password_raw
', title: '
密码
', align: '
center
', width: 300,
templet: function (data) {
return '
<
span
>
' + '
**********
' + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="password_raw" id="' + data.id + '"></
span
>
'
}
},
{field: '
name
', title: '
联系人
', align: '
center
', width: 100},
{field: '
status_cn
', title: '
状态
', align: '
center
', width: 80},
{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({
elem: '
#
supplierSubAccountList
'
, url: '
/
api
/
supplier_account
/
GetSupplierSubAccountList
'
, method: '
post
'
, size: '
sm
'
, limit: 20
, cellMinWidth: 50 //全局定义常规单元格的最小宽度
, where: whereCondition
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [cols]
, id: '
supplierSubAccountList
'
, page: {}
, done: function (res, curr, count) {
currentPage = curr;
}
});
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
') {
let confirmHtml = '
<
p
>
确定
<
span
style
=
"color: red"
>
删除
<
/span>当前子账号吗?</
p
><
p
style
=
"color: #7f7f7f"
>
' + '
PS
:删除后,该子账号从系统清除,无法再登录芯链系统!
<
/p>
'
layer
.
confirm
(
confirmHtml
,
{
btn
:
[
'确定'
,
'取消'
],
//按钮
title
:
'删除'
},
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'
)
{
let
confirmHtml
=
'
<
p
>
确定
<
span
style
=
"color: #00bfbf"
>
启用
<
/span>当前子账号吗?</
p
><
p
style
=
"color: #7f7f7f"
>
' + '
PS
:启用后,该子账号可登录芯链系统,操作对应权限页面!
<
/p>
'
layer
.
confirm
(
confirmHtml
,
{
btn
:
[
'确定'
,
'取消'
],
//按钮
title
:
'启用'
},
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
});
}
});
});
}
if
(
event
===
'disable'
)
{
let
confirmHtml
=
'
<
p
>
确定
<
span
style
=
"color: orange"
>
禁用
<
/span>当前子账号吗?</
p
><
p
style
=
"color: #7f7f7f"
>
' + '
PS
:禁用后,该子账号无法再登录芯链系统!
<
/p>
'
layer
.
confirm
(
confirmHtml
,
{
btn
:
[
'确定'
,
'取消'
],
title
:
'禁用'
},
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'
),
area
:
[
'70%'
,
'80%'
],
title
:
'添加芯链账号'
,
end
:
function
()
{
table
.
reload
(
'supplierSubAccountList'
);
}
});
});
$
(
'#saveSupplierAccountMessagePerm'
).
click
(
function
()
{
let
accountId
=
getQueryVariable
(
'account_id'
);
layer
.
open
({
type
:
2
,
area
:
[
'75%'
,
'75%'
],
fixed
:
false
,
title
:
'详情'
,
content
:
'/supplier_account/SaveSupplierAccountMessagePerm?view=iframe&account_id='
+
accountId
,
end
:
function
()
{
table
.
reload
(
'supplierSubAccountList'
,
{
page
:
{
curr
:
1
//重新从第 1 页开始
},
});
}
});
});
form
.
on
(
'submit(load)'
,
function
(
data
)
{
whereCondition
=
$
.
extend
(
false
,
initCondition
,
data
.
field
);
//执行重载
table
.
reload
(
'supplierSubAccountList'
,
{
page
:
{
curr
:
1
}
,
where
:
whereCondition
});
return
false
;
});
form
.
on
(
'submit(reset)'
,
function
(
data
)
{
layer
.
load
(
1
);
location
.
reload
();
});
$
(
document
).
on
(
'click'
,
'.viewAccount'
,
function
()
{
if
(
$
(
this
).
text
()
===
'隐藏'
)
{
$
(
this
).
prev
().
text
(
$
(
this
).
attr
(
'prev_text'
));
$
(
this
).
text
(
'查看'
);
}
else
{
let
id
=
$
(
this
).
attr
(
'id'
);
let
type
=
$
(
this
).
attr
(
'type'
);
let
resp
=
ajax
(
'/api/supplier_account/GetSupplierAccount'
,
{
id
:
id
,
type
:
type
});
if
(
!
resp
)
{
layer
.
msg
(
'网络连接失败'
,
{
'icon'
:
5
});
return
false
;
}
let
prevText
=
$
(
this
).
prev
().
text
();
$
(
this
).
attr
(
'prev_text'
,
prevText
);
if
(
resp
.
err_code
===
0
)
{
switch
(
type
)
{
case
'mobile'
:
$
(
this
).
prev
().
text
(
resp
.
data
.
mobile
);
break
;
case
'email'
:
$
(
this
).
prev
().
text
(
resp
.
data
.
email
);
break
;
}
console
.
log
(
resp
);
$
.
get
(
getLogDomain
()
+
"/api/addSensitiveClick"
,
{
uid
:
getCookie
(
"oa_user_id"
)
||
0
,
sys_id
:
4
,
mask_type
:
type
||
0
,
origin_id
:
id
||
0
,
source_from
:
window
.
location
.
href
});
$
(
this
).
text
(
'隐藏'
);
}
else
{
layer
.
msg
(
resp
.
err_msg
,
{
'icon'
:
5
});
return
false
;
}
}
});
});
</script>
resources/views/web/SaveSupplierAccountMessagePerm.blade.php
0 → 100644
View file @
dfefeafa
<style>
.layui-form-item
{
margin-bottom
:
5px
;
}
.layui-tree
.layui-tree-set
{
display
:
inline-block
;
margin-right
:
10px
;
/* 控制节点之间的水平间距 */
vertical-align
:
top
;
/* 将节点对齐到顶部 */
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-body"
>
<form
class=
"layui-form"
action=
""
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
消息推送配置
</b>
</blockquote>
<div
class=
"layui-form-item"
>
<button
class=
"layui-btn layui-btn-sm"
type=
"button"
id=
"selectAllMessagePerm"
>
全选
</button>
<br>
<div
id=
"messagePermTree"
></div>
</div>
<div
class=
"layui-form-item"
>
<div
align=
"center"
style=
"margin-top: 20px;text-align: right"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-info submit-loading"
lay-submit
lay-filter=
"saveSupplierAccountMessageMenu"
>
确定
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-primary"
lay-submit
lay-filter=
"cancel"
>
取消
</button>
</div>
</div>
</form>
</div>
</div>
resources/views/web/SaveSupplierSubAccount.blade.php
0 → 100644
View file @
dfefeafa
<style>
.layui-form-item
{
margin-bottom
:
5px
;
}
.layui-tree
.layui-tree-set
{
display
:
inline-block
;
margin-right
:
10px
;
/* 控制节点之间的水平间距 */
vertical-align
:
top
;
/* 将节点对齐到顶部 */
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-body"
>
<form
class=
"layui-form"
action=
""
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
子账号信息
</b>
</blockquote>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-form-item"
>
<input
type=
"hidden"
name=
"sbat_id"
value=
"{{$account['sbat_id'] or ''}}"
>
<input
type=
"hidden"
name=
"ynat_id"
value=
"{{$account['ynat_id'] or ''}}"
>
<input
type=
"hidden"
name=
"account_id"
value=
"{{request()->input('account_id')}}"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
账号 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"mobile"
id=
"mobile"
placeholder=
"请输入登录账号"
class=
"layui-input"
value=
"{{$account['mobile'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
密码 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"password_raw"
id=
"password_raw"
placeholder=
"请输入密码"
class=
"layui-input"
value=
"{{$account['password_raw'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
联系人 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"name"
id=
"name"
placeholder=
"请输入名称"
class=
"layui-input"
value=
"{{$account['name'] or ''}}"
>
</div>
</div>
</div>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
邮箱 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"email"
id=
"email"
placeholder=
"请输入邮箱"
class=
"layui-input"
value=
"{{$account['email'] or ''}}"
>
</div>
</div>
</div>
</div>
<blockquote
class=
"layui-elem-quote layui-text"
>
<span><b>
子账号权限配置
</b>
<span
style=
"margin-left: 10px;"
>
<i
class=
"layui-icon layui-icon-note"
style=
"color: orange;font-size: 16px"
></i>
勾选以下页面后,子账号可以看到对应的页面内容并进行操作;没有勾选的页面,子账号则无权查看;
</span>
</span>
</blockquote>
<div
class=
"layui-form-item"
>
<button
class=
"layui-btn layui-btn-sm"
type=
"button"
id=
"selectAllPerm"
>
全选
</button>
<br>
<div
id=
"permTree"
></div>
</div>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
子账号消息推送配置
</b>
</blockquote>
<div
class=
"layui-form-item"
>
<button
class=
"layui-btn layui-btn-sm"
type=
"button"
id=
"selectAllMessagePerm"
>
全选
</button>
<br>
<div
id=
"messagePermTree"
></div>
</div>
<div
class=
"layui-form-item"
>
<div
align=
"center"
style=
"margin-top: 20px;text-align: right"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-info submit-loading"
lay-submit
lay-filter=
"saveSupplierSubAccount"
>
确定
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-primary"
lay-submit
lay-filter=
"cancel"
>
取消
</button>
</div>
</div>
</form>
</div>
</div>
resources/views/web/SupplierAccountList.blade.php
View file @
dfefeafa
...
...
@@ -47,12 +47,15 @@
</form>
</div>
<div
style=
"margin-left: 20px;margin-right: 20px"
>
<div
class=
"layui-btn-group demoTable"
style=
"margin-top: 15px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"add_supplier_account"
>
新增账号
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"update_supplier_account"
>
修改
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"enable_supplier_account"
>
启用
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"disable_supplier_account"
>
禁用
</button>
</div>
@if(checkPerm('OperateSupplierAccount'))
<div
class=
"layui-btn-group demoTable"
style=
"margin-top: 15px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"add_supplier_account"
>
新增账号
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"update_supplier_account"
>
修改
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"enable_supplier_account"
>
启用
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"disable_supplier_account"
>
禁用
</button>
</div>
@endif
<table
class=
"layui-table"
id=
"supplierAccountList"
lay-filter=
"supplierAccountList"
></table>
</div>
...
...
resources/views/web/SupplierSubAccountList.blade.php
0 → 100644
View file @
dfefeafa
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
供应商信息
</b>
</blockquote>
<table
class=
"layui-table"
>
<colgroup>
<col
width=
"150"
>
<col
width=
"300"
>
<col>
</colgroup>
<thead>
<tr>
<th>
供应商编码
</th>
<th>
供应商名称
</th>
<th>
供应商性质
</th>
<th>
有效期最高天数
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{$supplier['supplier_code']}}
</td>
<td>
{{$supplier['supplier_name']}}
</td>
<td>
{{$supplier['supplier_group_name']}}
</td>
<td>
{{$supplier['cp_time_format']}}
</td>
</tr>
</tbody>
</table>
<br>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
芯链主账号信息
</b>
</blockquote>
<table
class=
"layui-table"
>
<colgroup>
<col
width=
"150"
>
<col
width=
"200"
>
<col>
</colgroup>
<thead>
<tr>
<th>
联系人
</th>
<th>
联系电话
</th>
<th>
邮箱
</th>
<th>
创建时间
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{$supplierAccount['contacts_name']}}
</td>
<td>
<span>
{{$supplierAccount['mobile']}}
</span>
@if(checkPerm('ViewSupplierAccountInfo')
&&
!empty($supplierAccount['mobile']))
<span
style=
"color: dodgerblue;margin-left: 10px"
class=
"viewAccount"
type=
"mobile"
id=
"{{$supplierAccount['id']}}"
>
查看
</span>
@endif
</td>
<td>
<span>
{{$supplierAccount['email']}}
</span>
@if(checkPerm('ViewSupplierAccountInfo')
&&
!empty($supplierAccount['email']))
<span
style=
"color: dodgerblue;margin-left: 10px"
class=
"viewAccount"
type=
"email"
id=
"{{$supplierAccount['id']}}"
>
查看
</span>
@endif
</td>
<td>
{{$supplierAccount['create_time']}}
</td>
<td>
<button
class=
"layui-btn layui-btn-sm"
id=
"saveSupplierAccountMessagePerm"
>
详情
</button>
</td>
</tr>
</tbody>
</table>
<br>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
芯链子账号信息
</b>
</blockquote>
<div
style=
"margin-left: 20px;margin-right: 20px"
>
<div
class=
"layui-btn-group demoTable"
style=
"margin-top: 15px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"add_supplier_sub_account"
>
创建子账号
</button>
</div>
<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