Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loveisland
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘小敏
loveisland
Commits
a61eaaf8
Commit
a61eaaf8
authored
May 20, 2026
by
刘小敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户标签后台展示修改
parent
113b0263
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
4 deletions
+131
-4
User.php
application/admin/controller/shopro/user/User.php
+49
-3
ShoproUserTag.php
application/admin/model/shopro/ShoproUserTag.php
+12
-0
User.php
application/admin/model/shopro/user/User.php
+6
-0
detail.html
application/admin/view/shopro/user/user/detail.html
+31
-0
index.html
application/admin/view/shopro/user/user/index.html
+9
-0
user.js
public/assets/js/backend/shopro/user/user.js
+24
-1
No files found.
application/admin/controller/shopro/user/User.php
View file @
a61eaaf8
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
app\admin\controller\shopro\user
;
namespace
app\admin\controller\shopro\user
;
use
app\admin\model\shopro\ShoproUserTag
;
use
think\Db
;
use
think\Db
;
use
app\admin\controller\shopro\Common
;
use
app\admin\controller\shopro\Common
;
use
addons\shopro\service\Wallet
as
WalletService
;
use
addons\shopro\service\Wallet
as
WalletService
;
...
@@ -30,7 +31,7 @@ class User extends Common
...
@@ -30,7 +31,7 @@ class User extends Common
return
$this
->
view
->
fetch
();
return
$this
->
view
->
fetch
();
}
}
$data
=
$this
->
model
->
sheepFilter
()
->
paginate
(
$this
->
request
->
param
(
'list_rows'
,
10
));
$data
=
$this
->
model
::
with
([
'shopro_user_tag'
])
->
sheepFilter
()
->
paginate
(
$this
->
request
->
param
(
'list_rows'
,
10
));
$this
->
success
(
'获取成功'
,
null
,
$data
);
$this
->
success
(
'获取成功'
,
null
,
$data
);
}
}
...
@@ -46,7 +47,7 @@ class User extends Common
...
@@ -46,7 +47,7 @@ class User extends Common
return
$this
->
view
->
fetch
();
return
$this
->
view
->
fetch
();
}
}
$user
=
$this
->
model
->
with
([
'third_oauth'
,
'parent_user'
])
->
where
(
'id'
,
$id
)
->
find
();
$user
=
$this
->
model
->
with
([
'third_oauth'
,
'parent_user'
,
'shopro_user_tag'
])
->
where
(
'id'
,
$id
)
->
find
();
if
(
!
$user
)
{
if
(
!
$user
)
{
$this
->
error
(
__
(
'No Results were found'
));
$this
->
error
(
__
(
'No Results were found'
));
}
}
...
@@ -151,7 +152,52 @@ class User extends Common
...
@@ -151,7 +152,52 @@ class User extends Common
}
}
$data
=
$this
->
model
->
sheepFilter
()
->
paginate
(
$this
->
request
->
param
(
'list_rows'
,
10
));
$data
=
$this
->
model
->
sheepFilter
()
->
paginate
(
$this
->
request
->
param
(
'list_rows'
,
10
));
$this
->
success
(
'获取成功'
,
null
,
$data
);
$this
->
success
(
'获取成功'
,
null
,
$data
);
}
}
/**
* 保存用户标签
*/
public
function
saveTags
()
{
operate_filter
();
$userId
=
$this
->
request
->
param
(
'user_id'
);
$tags
=
$this
->
request
->
param
(
'tags/a'
,
[]);
if
(
!
$userId
)
{
$this
->
error
(
'用户ID不能为空'
);
}
// 删除旧标签
Db
::
name
(
'shopro_user_tag'
)
->
where
(
'user_id'
,
$userId
)
->
delete
();
// 插入新标签
if
(
!
empty
(
$tags
))
{
$tagMap
=
[
'active'
=>
'活跃用户'
,
'valuable'
=>
'高价值用户'
,
'silent'
=>
'沉默用户'
,
'new'
=>
'新用户'
,
'vip'
=>
'VIP用户'
,
'wholesale'
=>
'批发客户'
,
];
$data
=
[];
$now
=
time
();
foreach
(
$tags
as
$tagCode
)
{
if
(
isset
(
$tagMap
[
$tagCode
]))
{
$data
[]
=
[
'user_id'
=>
$userId
,
'tag_code'
=>
$tagCode
,
'tag_name'
=>
$tagMap
[
$tagCode
],
'create_time'
=>
$now
,
'update_time'
=>
$now
,
];
}
}
if
(
!
empty
(
$data
))
{
Db
::
name
(
'shopro_user_tag'
)
->
insertAll
(
$data
);
}
}
$this
->
success
(
'保存成功'
);
}
}
}
application/admin/model/shopro/ShoproUserTag.php
0 → 100644
View file @
a61eaaf8
<?php
namespace
app\admin\model\shopro
;
use
app\admin\model\shopro\Common
;
class
ShoproUserTag
extends
Common
{
protected
$name
=
'shopro_user_tag'
;
}
application/admin/model/shopro/user/User.php
View file @
a61eaaf8
...
@@ -4,6 +4,7 @@ namespace app\admin\model\shopro\user;
...
@@ -4,6 +4,7 @@ namespace app\admin\model\shopro\user;
use
app\admin\model\shopro\Common
;
use
app\admin\model\shopro\Common
;
use
app\admin\model\shopro\Coupon
as
CouponModel
;
use
app\admin\model\shopro\Coupon
as
CouponModel
;
use
app\admin\model\shopro\ShoproUserTag
;
use
app\admin\model\shopro\ThirdOauth
;
use
app\admin\model\shopro\ThirdOauth
;
use
addons\shopro\library\notify\traits\Notifiable
;
use
addons\shopro\library\notify\traits\Notifiable
;
use
fast\Random
;
use
fast\Random
;
...
@@ -136,4 +137,9 @@ class User extends Common
...
@@ -136,4 +137,9 @@ class User extends Common
return
$this
->
hasOne
(
\app\admin\model\shopro\commission\Agent
::
class
,
'user_id'
,
'id'
);
return
$this
->
hasOne
(
\app\admin\model\shopro\commission\Agent
::
class
,
'user_id'
,
'id'
);
}
}
// -- commission code end --
// -- commission code end --
public
function
shoproUserTag
()
{
return
$this
->
hasMany
(
ShoproUserTag
::
class
,
'user_id'
,
'id'
);
}
}
}
application/admin/view/shopro/user/user/detail.html
View file @
a61eaaf8
...
@@ -64,6 +64,15 @@
...
@@ -64,6 +64,15 @@
.user-detail
.third-oauth
.provider-item
:last-of-type
{
.user-detail
.third-oauth
.provider-item
:last-of-type
{
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
/* 新增标签选择器样式 */
.user-detail
.tag-selector
{
width
:
100%
;
}
.user-detail
.tag-selector
.el-select__tags
{
flex-wrap
:
wrap
;
}
</style>
</style>
<div
id=
"detail"
class=
"user-detail"
v-cloak
>
<div
id=
"detail"
class=
"user-detail"
v-cloak
>
...
@@ -144,6 +153,28 @@
...
@@ -144,6 +153,28 @@
</el-input>
</el-input>
</div>
</div>
</el-col>
</el-col>
<!-- 新增用户标签选择器 -->
<el-col
:xs=
"24"
:sm=
"12"
:md=
"24"
:lg=
"24"
:xl=
"24"
>
<div
class=
"left"
>
用户标签
</div>
<div
class=
"right"
>
<el-select
v-model=
"state.tags"
multiple
class=
"tag-selector"
placeholder=
"请选择用户标签"
@
change=
"onTagsChange"
>
<el-option
v-for=
"tag in state.tagOptions"
:key=
"tag.code"
:label=
"tag.name"
:value=
"tag.code"
></el-option>
</el-select>
</div>
</el-col>
<el-col
:xs=
"24"
:sm=
"12"
:md=
"24"
:lg=
"24"
:xl=
"24"
>
<el-col
:xs=
"24"
:sm=
"12"
:md=
"24"
:lg=
"24"
:xl=
"24"
>
<div
class=
"left"
>
状态
</div>
<div
class=
"left"
>
状态
</div>
<div
class=
"right"
>
<div
class=
"right"
>
...
...
application/admin/view/shopro/user/user/index.html
View file @
a61eaaf8
...
@@ -37,6 +37,15 @@
...
@@ -37,6 +37,15 @@
</el-table-column>
</el-table-column>
<el-table-column
sortable=
"custom"
prop=
"createtime"
label=
"注册时间"
min-width=
"172"
></el-table-column>
<el-table-column
sortable=
"custom"
prop=
"createtime"
label=
"注册时间"
min-width=
"172"
></el-table-column>
<el-table-column
sortable=
"custom"
prop=
"logintime"
label=
"上次登录"
min-width=
"172"
></el-table-column>
<el-table-column
sortable=
"custom"
prop=
"logintime"
label=
"上次登录"
min-width=
"172"
></el-table-column>
<el-table-column
label=
"用户标签"
min-width=
"100"
>
<template
#
default=
"scope"
>
<div
v-for=
"item in scope.row.shopro_user_tag"
:key=
"item.tag_code"
>
<span
v-if=
"item.tag_code == 'active'"
class=
"label label-success"
>
{{item.tag_name}}
</span>
<span
v-if=
"item.tag_code == 'valuable'"
class=
"label label-danger"
>
{{item.tag_name}}
</span>
<span
v-if=
"item.tag_code == 'silent'"
class=
"label label-primary"
>
{{item.tag_name}}
</span>
</div>
</template>
</el-table-column>
<el-table-column
fixed=
"right"
label=
"操作"
min-width=
"120"
>
<el-table-column
fixed=
"right"
label=
"操作"
min-width=
"120"
>
<template
#
default=
"scope"
>
<template
#
default=
"scope"
>
{if $auth->check('shopro/user/user/detail')}
{if $auth->check('shopro/user/user/detail')}
...
...
public/assets/js/backend/shopro/user/user.js
View file @
a61eaaf8
...
@@ -175,7 +175,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
...
@@ -175,7 +175,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
const
state
=
reactive
({
const
state
=
reactive
({
type
:
new
URLSearchParams
(
location
.
search
).
get
(
'type'
),
type
:
new
URLSearchParams
(
location
.
search
).
get
(
'type'
),
id
:
new
URLSearchParams
(
location
.
search
).
get
(
'id'
),
id
:
new
URLSearchParams
(
location
.
search
).
get
(
'id'
),
detail
:
{}
detail
:
{},
tags
:
[],
tagOptions
:
[
{
code
:
'active'
,
name
:
'活跃用户'
},
{
code
:
'valuable'
,
name
:
'高价值用户'
},
{
code
:
'silent'
,
name
:
'沉默用户'
}
],
})
})
function
getDetail
()
{
function
getDetail
()
{
...
@@ -184,6 +190,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
...
@@ -184,6 +190,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
type
:
'GET'
,
type
:
'GET'
,
},
function
(
ret
,
res
)
{
},
function
(
ret
,
res
)
{
state
.
detail
=
res
.
data
;
state
.
detail
=
res
.
data
;
state
.
tags
=
res
.
data
?.
shopro_user_tag
?.
map
(
item
=>
item
.
tag_code
)
console
.
log
(
state
.
tags
)
return
false
},
function
(
ret
,
res
)
{
})
}
function
onTagsChange
()
{
Fast
.
api
.
ajax
({
url
:
`shopro/user/user/saveTags`
,
type
:
'POST'
,
data
:
{
user_id
:
state
.
id
,
tags
:
state
.
tags
},
},
function
(
ret
,
res
)
{
return
false
return
false
},
function
(
ret
,
res
)
{
})
},
function
(
ret
,
res
)
{
})
}
}
...
@@ -314,6 +335,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
...
@@ -314,6 +335,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
getLog
,
getLog
,
pagination
,
pagination
,
onChangeTab
,
onChangeTab
,
// getTags,
onTagsChange
,
}
}
}
}
}
}
...
...
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