backup: 紫色UI换肤前完整备份(当前橙色逍遥梦主题)
保留改造前全部页面样式与功能代码,便于回滚。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
99
pages/merchant-staff-audit/merchant-staff-audit.js
Normal file
99
pages/merchant-staff-audit/merchant-staff-audit.js
Normal file
@@ -0,0 +1,99 @@
|
||||
import request from '../../utils/request.js';
|
||||
import { STAFF_API } from '../../utils/staff-api.js';
|
||||
|
||||
const ORDER_AUDIT_ACTIONS = [
|
||||
'DISPATCH', 'LINK_GENERATE', 'SETTLE', 'CANCEL', 'REFUND_APPLY',
|
||||
'CHANGE_PLAYER', 'PENALTY_APPLY', 'PENALTY_MANAGE',
|
||||
];
|
||||
|
||||
Page({
|
||||
data: {
|
||||
tab: 'audit',
|
||||
auditList: [],
|
||||
rankList: [],
|
||||
page: 1,
|
||||
hasMore: true,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
if (options.tab === 'rank') this.setData({ tab: 'rank' });
|
||||
wx.setNavigationBarTitle({
|
||||
title: options.tab === 'rank' ? '客服排行' : '操作日志',
|
||||
});
|
||||
this.loadData(true);
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
this.loadData(true).finally(() => wx.stopPullDownRefresh());
|
||||
},
|
||||
|
||||
onReachBottom() {
|
||||
if (this.data.tab === 'audit' && this.data.hasMore && !this.data.loading) {
|
||||
this.loadAudit(false);
|
||||
}
|
||||
},
|
||||
|
||||
switchTab(e) {
|
||||
const tab = e.currentTarget.dataset.tab;
|
||||
wx.setNavigationBarTitle({ title: tab === 'rank' ? '客服排行' : '操作日志' });
|
||||
this.setData({ tab, page: 1, hasMore: true }, () => this.loadData(true));
|
||||
},
|
||||
|
||||
loadData(reset) {
|
||||
if (this.data.tab === 'audit') return this.loadAudit(reset);
|
||||
return this.loadRank();
|
||||
},
|
||||
|
||||
async loadAudit(reset) {
|
||||
if (this.data.loading) return;
|
||||
const page = reset ? 1 : this.data.page;
|
||||
this.setData({ loading: true });
|
||||
try {
|
||||
const res = await request({
|
||||
url: STAFF_API.auditList,
|
||||
method: 'POST',
|
||||
data: { page, page_size: 20 },
|
||||
});
|
||||
if (res.data && res.data.code === 0) {
|
||||
const d = res.data.data || {};
|
||||
const list = (d.list || []).map((item) => ({
|
||||
...item,
|
||||
canJumpOrder: ORDER_AUDIT_ACTIONS.indexOf(item.action) >= 0 && !!item.resource_id,
|
||||
}));
|
||||
this.setData({
|
||||
auditList: reset ? list : [...this.data.auditList, ...list],
|
||||
page: page + 1,
|
||||
hasMore: !!d.has_more,
|
||||
total: d.total || 0,
|
||||
loading: false,
|
||||
});
|
||||
} else {
|
||||
this.setData({ loading: false });
|
||||
wx.showToast({ title: res.data?.msg || '加载失败', icon: 'none' });
|
||||
}
|
||||
} catch (e) {
|
||||
this.setData({ loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
async loadRank() {
|
||||
const res = await request({
|
||||
url: STAFF_API.rank,
|
||||
method: 'POST',
|
||||
data: { period: 'month', sort_by: 'dispatch_count' },
|
||||
});
|
||||
if (res.data && res.data.code === 0) {
|
||||
this.setData({ rankList: (res.data.data && res.data.data.list) || [] });
|
||||
}
|
||||
},
|
||||
|
||||
goOrderDetail(e) {
|
||||
const item = e.currentTarget.dataset.item;
|
||||
if (!item || !item.canJumpOrder || !item.resource_id) return;
|
||||
wx.navigateTo({
|
||||
url: `/pages/merchant-order-detail/merchant-order-detail?dingdan_id=${encodeURIComponent(item.resource_id)}`,
|
||||
});
|
||||
},
|
||||
});
|
||||
5
pages/merchant-staff-audit/merchant-staff-audit.json
Normal file
5
pages/merchant-staff-audit/merchant-staff-audit.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"navigationBarTitleText": "操作日志",
|
||||
"enablePullDownRefresh": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
39
pages/merchant-staff-audit/merchant-staff-audit.wxml
Normal file
39
pages/merchant-staff-audit/merchant-staff-audit.wxml
Normal file
@@ -0,0 +1,39 @@
|
||||
<view class="page">
|
||||
<view class="head-tip">仅记录派单、退款、模板等重要操作,不含普通查看</view>
|
||||
<view class="tabs">
|
||||
<view class="tab {{tab === 'audit' ? 'on' : ''}}" data-tab="audit" bindtap="switchTab">操作日志</view>
|
||||
<view class="tab {{tab === 'rank' ? 'on' : ''}}" data-tab="rank" bindtap="switchTab">客服排行</view>
|
||||
</view>
|
||||
<block wx:if="{{tab === 'audit'}}">
|
||||
<view class="summary" wx:if="{{total > 0}}">共 {{total}} 条重要操作</view>
|
||||
<view class="item {{item.canJumpOrder ? 'item-link' : ''}}" wx:for="{{auditList}}" wx:key="id"
|
||||
bindtap="goOrderDetail" data-item="{{item}}">
|
||||
<view class="item-hd flexb">
|
||||
<text class="act">{{item.action_label || item.action}}</text>
|
||||
<text class="amount" wx:if="{{item.amount}}">¥{{item.amount}}</text>
|
||||
</view>
|
||||
<view class="operator">
|
||||
<text class="tag {{item.operator_type === 'STAFF' ? 'tag-staff' : 'tag-owner'}}">
|
||||
{{item.role_name || (item.operator_type === 'STAFF' ? '客服' : '老板')}}
|
||||
</text>
|
||||
<text class="name">{{item.operator_name}}</text>
|
||||
<text class="uid">ID:{{item.operator_user_id}}</text>
|
||||
</view>
|
||||
<text class="meta">{{item.time}}</text>
|
||||
<text class="res" wx:if="{{item.resource_id}}">订单:{{item.resource_id}}</text>
|
||||
<text class="jump-tip" wx:if="{{item.canJumpOrder}}">点击查看订单详情 ›</text>
|
||||
<text class="remark" wx:if="{{item.remark}}">{{item.remark}}</text>
|
||||
</view>
|
||||
<view class="load-tip" wx:if="{{loading}}">加载中...</view>
|
||||
<view class="load-tip" wx:elif="{{hasMore && auditList.length}}">上拉加载更多</view>
|
||||
<view class="empty" wx:if="{{!loading && auditList.length === 0}}">暂无操作日志</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view class="item" wx:for="{{rankList}}" wx:key="member_id">
|
||||
<text class="rank">#{{item.rank}} {{item.display_name}}</text>
|
||||
<text class="meta">派单 {{item.dispatch_count}} 单 · ¥{{item.dispatch_amount}}</text>
|
||||
<text class="meta">结单 {{item.settle_count}} 单 · ¥{{item.settle_amount}}</text>
|
||||
</view>
|
||||
<view class="empty" wx:if="{{rankList.length === 0}}">暂无排行数据</view>
|
||||
</block>
|
||||
</view>
|
||||
25
pages/merchant-staff-audit/merchant-staff-audit.wxss
Normal file
25
pages/merchant-staff-audit/merchant-staff-audit.wxss
Normal file
@@ -0,0 +1,25 @@
|
||||
.page { padding: 24rpx; background: #f5f5f5; min-height: 100vh; box-sizing: border-box; }
|
||||
.head-tip { font-size: 24rpx; color: #888; margin-bottom: 16rpx; line-height: 1.5; }
|
||||
.tabs { display: flex; margin-bottom: 24rpx; }
|
||||
.tab { flex: 1; text-align: center; padding: 20rpx; background: #fff; margin-right: 8rpx; border-radius: 8rpx; font-size: 28rpx; }
|
||||
.tab.on { background: #C9A962; color: #fff; }
|
||||
.summary { font-size: 24rpx; color: #666; margin-bottom: 16rpx; }
|
||||
.item { background: #fff; padding: 24rpx; margin-bottom: 16rpx; border-radius: 12rpx; }
|
||||
.item-hd { margin-bottom: 12rpx; }
|
||||
.act { font-size: 30rpx; color: #333; font-weight: 600; }
|
||||
.amount { font-size: 28rpx; color: #C9A962; }
|
||||
.operator { display: flex; align-items: center; flex-wrap: wrap; gap: 12rpx; margin-bottom: 8rpx; }
|
||||
.tag { font-size: 22rpx; padding: 4rpx 12rpx; border-radius: 6rpx; }
|
||||
.tag-staff { background: #e8f4ff; color: #1976d2; }
|
||||
.tag-owner { background: #fff3e0; color: #e65100; }
|
||||
.name { font-size: 26rpx; color: #333; }
|
||||
.uid { font-size: 22rpx; color: #999; }
|
||||
.meta { display: block; font-size: 24rpx; color: #999; margin-top: 6rpx; }
|
||||
.res { display: block; font-size: 24rpx; color: #666; margin-top: 8rpx; word-break: break-all; }
|
||||
.remark { display: block; font-size: 24rpx; color: #888; margin-top: 6rpx; }
|
||||
.rank { font-weight: 600; font-size: 28rpx; display: block; }
|
||||
.load-tip { text-align: center; color: #999; padding: 24rpx; font-size: 24rpx; }
|
||||
.empty { text-align: center; color: #999; padding: 80rpx; }
|
||||
.item-link { border-left: 6rpx solid #C9A962; }
|
||||
.jump-tip { display: block; font-size: 24rpx; color: #C9A962; margin-top: 8rpx; }
|
||||
.flexb { display: flex; justify-content: space-between; align-items: center; }
|
||||
Reference in New Issue
Block a user