feat(user): 重构后台会员列表与详情为全屏选项卡并补齐二开权益资产中心

这个提交包含在:
chen
2026-09-17 16:55:19 +08:00
父节点 c3f5b3d4b5
当前提交 289adf5c36
共有 7 个文件被更改,包括 1453 次插入 和 330 次删除

查看文件

@@ -125,7 +125,18 @@ const SaUserProfile = {
});
function onOpenUserDetail(id) {
Fast.api.open(`shopro/user/user/detail?id=${id}`, "会员详情")
const url = `shopro/user/user/detail?id=${id}`;
const name = (userData.value && (userData.value.nickname || userData.value.username)) ? userData.value.nickname || userData.value.username : '';
const title = name ? `会员详情 - ${name} (#${id})` : `会员详情 #${id}`;
if (typeof Backend !== 'undefined' && Backend.api && typeof Backend.api.addtabs === 'function') {
Backend.api.addtabs(url, title);
} else if (top && top.Backend && top.Backend.api && typeof top.Backend.api.addtabs === 'function') {
top.Backend.api.addtabs(url, title);
} else if (Fast && Fast.api && typeof Fast.api.addtabs === 'function') {
Fast.api.addtabs(url, title);
} else {
Fast.api.open(url, title);
}
}
return {
Fast,

查看文件

@@ -9,10 +9,23 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
data: [],
order: '',
sort: '',
stats: {
total_users: 0,
maker_count: 0,
venue_count: 0,
county_count: 0,
partner_count: 0,
active_count: 0,
},
filter: {
drawer: false,
data: {
user: { field: 'id', value: '' },
identity: '',
maker_level: '',
active_30d: '',
has_agent: '',
parent_user: '',
createtime: [],
logintime: [],
},
@@ -48,6 +61,63 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}],
}
},
identity: {
type: 'tselect',
label: '业务身份',
value: '',
options: {
data: [
{ value: 'taster', label: '品酒师' },
{ value: 'maker', label: '创客 (V1~V6)' },
{ value: 'venue', label: '酒道馆' },
{ value: 'county', label: '区县代理' },
{ value: 'partner', label: '合伙股东' },
]
}
},
maker_level: {
type: 'tselect',
label: '创客等级',
value: '',
options: {
data: [
{ value: '1', label: '创客 V1' },
{ value: '2', label: '创客 V2' },
{ value: '3', label: '创客 V3' },
{ value: '4', label: '创客 V4' },
{ value: '5', label: '创客 V5' },
{ value: '6', label: '创客 V6' },
]
}
},
active_30d: {
type: 'tselect',
label: '30日活跃',
value: '',
options: {
data: [
{ value: '1', label: '有自购(正常领奖)' },
{ value: '0', label: '已暂停(无自购)' },
]
}
},
has_agent: {
type: 'tselect',
label: '收益档案',
value: '',
options: {
data: [
{ value: '1', label: '具备分销/收益档案' },
{ value: '0', label: '普通注册会员' },
]
}
},
parent_user: {
type: 'tinput',
label: '推荐人',
placeholder: '请输入推荐人ID/手机号/昵称',
value: '',
},
createtime: {
type: 'tdatetimerange',
label: '注册时间',
@@ -70,6 +140,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
nickname: 'like',
mobile: 'like',
email: 'like',
identity: '=',
maker_level: '=',
active_30d: '=',
has_agent: '=',
parent_user: '=',
createtime: 'range',
logintime: 'range',
});
@@ -86,6 +161,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}, function (ret, res) {
state.data = res.data.data
pagination.total = res.data.total
if (res.data.stats) {
state.stats = res.data.stats;
}
return false
}, function (ret, res) { })
}
@@ -110,13 +188,44 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
total: 0,
})
function onDetail(id) {
Fast.api.open(`shopro/user/user/detail?id=${id}`, "详情", {
callback() {
getData()
}
})
function onDetail(id, row) {
const url = `shopro/user/user/detail?id=${id}`;
const name = (row && (row.nickname || row.username)) ? (row.nickname || row.username) : '';
const title = name ? `会员详情 - ${name} (#${id})` : `会员详情 #${id}`;
if (typeof Backend !== 'undefined' && Backend.api && typeof Backend.api.addtabs === 'function') {
Backend.api.addtabs(url, title);
} else if (top && top.Backend && top.Backend.api && typeof top.Backend.api.addtabs === 'function') {
top.Backend.api.addtabs(url, title);
} else if (Fast && Fast.api && typeof Fast.api.addtabs === 'function') {
Fast.api.addtabs(url, title);
} else {
window.location.href = Fast.api.fixurl(url);
}
}
function onOpenAgentDetail(id) {
const url = `shopro/commission/agent/detail/id/${id}?id=${id}`;
const title = `分销商详情 #${id}`;
if (typeof Backend !== 'undefined' && Backend.api && typeof Backend.api.addtabs === 'function') {
Backend.api.addtabs(url, title);
} else if (top && top.Backend && top.Backend.api && typeof top.Backend.api.addtabs === 'function') {
top.Backend.api.addtabs(url, title);
} else if (Fast && Fast.api && typeof Fast.api.addtabs === 'function') {
Fast.api.addtabs(url, title);
} else {
window.location.href = Fast.api.fixurl(url);
}
}
function onRecharge(type, row) {
const id = typeof row === 'object' ? row.id : row;
Fast.api.open(`shopro/user/user/recharge?type=${type}&id=${id}`, "账户充值", {
callback: function () {
getData();
}
});
}
function onDelete(id) {
Fast.api.ajax({
url: `shopro/user/user/delete/id/${id}`,
@@ -138,6 +247,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
onChangeFilter,
pagination,
onDetail,
onOpenAgentDetail,
onRecharge,
onDelete
}
}
@@ -148,12 +259,37 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
const { reactive, onMounted } = Vue
const detail = {
setup() {
const queryUserId = (typeof Config !== 'undefined' && (Config.id || Config.user_id))
? (Config.id || Config.user_id)
: (new URLSearchParams(location.search).get('id') || (location.pathname.match(/\/id\/(\d+)/i) || [])[1] || Fast.api.query('id'));
const state = reactive({
type: new URLSearchParams(location.search).get('type'),
id: new URLSearchParams(location.search).get('id'),
id: queryUserId,
detail: {}
})
function onBack() {
if (parent && parent.Layer && typeof parent.Layer.getFrameIndex === 'function') {
try {
var index = parent.Layer.getFrameIndex(window.name);
if (index) {
parent.Layer.close(index);
return;
}
} catch (e) {}
}
if (top && top.Backend && top.Backend.api && typeof top.Backend.api.closetabs === 'function') {
top.Backend.api.closetabs();
return;
}
if (typeof Backend !== 'undefined' && Backend.api && typeof Backend.api.closetabs === 'function') {
Backend.api.closetabs();
return;
}
window.history.back();
}
function getDetail() {
Fast.api.ajax({
url: `shopro/user/user/detail/id/${state.id}`,
@@ -206,7 +342,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
function onRecharge(type) {
Fast.api.open(`shopro/user/user/recharge?type=${type}&id=${state.detail.id}`, "充值", {
Fast.api.open(`shopro/user/user/recharge?type=${type}&id=${state.detail.id}`, "账户充值", {
callback: function () {
getDetail();
getLog()
@@ -228,33 +364,66 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
}
function onOpenUserDetail(id) {
if (!id) return;
const url = `shopro/user/user/detail?id=${id}`;
const title = `会员详情 #${id}`;
if (typeof Backend !== 'undefined' && Backend.api && typeof Backend.api.addtabs === 'function') {
Backend.api.addtabs(url, title);
} else if (top && top.Backend && top.Backend.api && typeof top.Backend.api.addtabs === 'function') {
top.Backend.api.addtabs(url, title);
} else if (Fast && Fast.api && typeof Fast.api.addtabs === 'function') {
Fast.api.addtabs(url, title);
} else {
window.location.href = Fast.api.fixurl(url);
}
}
const formulaDialog = reactive({
visible: false,
row: null,
})
function onShowFormula(row) {
formulaDialog.row = row;
formulaDialog.visible = true;
}
const log = reactive({
tabActive: 'money',
tabActive: 'partner_reward',
showSkip: false,
data: [],
})
function getLog() {
let url
let url = ''
let search = {}
if (log.tabActive == 'money' || log.tabActive == 'score' || log.tabActive == 'commission') {
if (log.tabActive == 'partner_reward') {
url = `shopro/user/user/rewards/id/${state.id}`
search = {
show_skip: log.showSkip ? 1 : 0
}
} else if (log.tabActive == 'voucher_plan') {
url = `shopro/user/user/voucherPlans/id/${state.id}`
} else if (log.tabActive == 'team') {
url = `shopro/user/user/team/id/${state.id}`
} else if (log.tabActive == 'money' || log.tabActive == 'score' || log.tabActive == 'commission') {
url = `shopro/user/wallet_log/${log.tabActive}/id/${state.id}`
}
if (log.tabActive == 'order') {
} else if (log.tabActive == 'order') {
url = `shopro/order/order`
search = {
search: JSON.stringify({
user_id: state.id
})
}
}
if (log.tabActive == 'share') {
} else if (log.tabActive == 'share') {
url = `shopro/share`
search = {
id: state.id
}
}
if (log.tabActive == 'coupon') {
} else if (log.tabActive == 'coupon') {
url = `shopro/user/user/coupon/id/${state.id}`
}
if (!url) return;
Fast.api.ajax({
url: url,
type: 'GET',
@@ -265,11 +434,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
}, function (ret, res) {
if (log.tabActive == 'order') {
log.data = res.data.orders.data
pagination.total = res.data.orders.total
log.data = res.data?.orders?.data || []
pagination.total = res.data?.orders?.total || 0
} else {
log.data = res.data.data
pagination.total = res.data.total
log.data = res.data?.data || []
pagination.total = res.data?.total || 0
}
return false
}, function (ret, res) { })
@@ -294,6 +463,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return {
state,
getDetail,
onBack,
platform,
statusStyle,
onSelectAvatar,
@@ -301,6 +471,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
onChangeParentUser,
onRecharge,
onOpenAgentDetail,
onOpenUserDetail,
formulaDialog,
onShowFormula,
log,
getLog,
pagination,