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
7a2f9d2f
authored
May 25, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
b3f76148
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
6 deletions
app/Http/Controllers/Api/SupplierAccountApiController.php
app/Http/Controllers/Filter/SupplierAccountFilter.php
app/Http/Transformers/SupplierAccountTransformer.php
app/Http/Validators/SupplierAccountValidator.php
resources/views/script/SupplierAccountListScript.blade.php
resources/views/web/SupplierAccountList.blade.php
app/Http/Controllers/Api/SupplierAccountApiController.php
View file @
7a2f9d2f
...
...
@@ -75,7 +75,7 @@ class SupplierAccountApiController extends Controller
]);
$validator
=
new
SupplierAccountValidator
();
$check
=
$validator
->
checkSave
(
$request
);
if
(
!
$check
)
{
if
(
$check
!==
true
)
{
$this
->
response
(
-
1
,
$check
);
}
$supplierModel
=
new
SupplierChannelModel
();
...
...
@@ -96,6 +96,20 @@ class SupplierAccountApiController extends Controller
$this
->
response
(
-
1
,
'修改失败'
,
$result
);
}
//启用
public
function
EnableSupplierAccount
(
$request
)
{
$id
=
$request
->
get
(
'id'
);
$model
=
new
SupplierAccountModel
();
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
);
$data
[
'a_status'
]
=
1
;
$result
=
$model
->
where
(
'id'
,
$id
)
->
update
(
$data
);
if
(
$result
)
{
$this
->
response
(
0
,
'启用成功'
);
}
$this
->
response
(
-
1
,
'启用失败'
,
$result
);
}
//禁用
public
function
DisableSupplierAccount
(
$request
)
{
...
...
app/Http/Controllers/Filter/SupplierAccountFilter.php
View file @
7a2f9d2f
...
...
@@ -23,7 +23,7 @@ class SupplierAccountFilter
}
if
(
!
empty
(
$map
[
'supplier_code'
]))
{
$query
->
where
Like
(
'supplier_cod
e'
,
"%${map['supplier_code']}%"
);
$query
->
where
(
'supplier_code'
,
'lik
e'
,
"%${map['supplier_code']}%"
);
}
if
((
isset
(
$map
[
'status'
])
&&
$map
[
'status'
]
===
'0'
)
||
!
empty
(
$map
[
'status'
]))
{
...
...
@@ -31,7 +31,11 @@ class SupplierAccountFilter
}
if
(
!
empty
(
$map
[
'mobile'
]))
{
$query
->
whereLike
(
'mobile'
,
"%${map['mobile']}%"
);
$query
->
where
(
'mobile'
,
'like'
,
"%${map['mobile']}%"
);
}
if
((
isset
(
$map
[
'a_type'
])
&&
$map
[
'a_type'
]
===
'0'
)
||
!
empty
(
$map
[
'a_type'
]))
{
$query
->
where
(
'a_type'
,
$map
[
'a_type'
]);
}
if
(
!
empty
(
$map
[
'create_time'
]))
{
...
...
app/Http/Transformers/SupplierAccountTransformer.php
View file @
7a2f9d2f
...
...
@@ -17,8 +17,8 @@ class SupplierAccountTransformer
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'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'create_time'
])
;
$item
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'update_time'
])
;
$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'
])
:
''
;
}
unset
(
$item
);
...
...
app/Http/Validators/SupplierAccountValidator.php
View file @
7a2f9d2f
...
...
@@ -19,10 +19,10 @@ class SupplierAccountValidator
"supplier_code"
=>
"required"
,
"mobile"
=>
"required|regex:/^1[0-9][0-9]
{
9
}
$/"
,
"password_raw"
=>
"required"
,
"a_type"
=>
"required"
,
];
$messages
=
$this
->
messages
();
$validator
=
Validator
::
make
(
$account
,
$rules
,
$messages
);
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
return
$validator
->
errors
()
->
first
();
...
...
@@ -55,6 +55,7 @@ class SupplierAccountValidator
{
return
[
'supplier_code.required'
=>
'请选择一个供应商'
,
'a_type.required'
=>
'类型必须勾选为云芯商家'
,
'mobile.required'
=>
'登陆账号不能为空'
,
'mobile.regex'
=>
'账号格式必须为手机号'
,
'password_raw.required'
=>
'账号密码不能为空'
,
...
...
resources/views/script/SupplierAccountListScript.blade.php
View file @
7a2f9d2f
...
...
@@ -51,6 +51,27 @@
}
});
//启用
$
(
"#enable_supplier_account"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'supplierAccountList'
);
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/EnableSupplierAccount'
,
{
id
:
id
})
if
(
res
.
err_code
===
0
)
{
table
.
reload
(
'supplierAccountList'
);
layer
.
closeAll
();
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
})
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
})
}
});
}
});
//禁用
$
(
"#disable_supplier_account"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'supplierAccountList'
);
...
...
resources/views/web/SupplierAccountList.blade.php
View file @
7a2f9d2f
...
...
@@ -50,6 +50,7 @@
<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>
...
...
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