```
feat(shopro_wechat_trade): 微信同步页面优化及数据格式化功能 - 新增formatListItem方法对同步记录数据进行格式化处理, 包括同步类型、状态、发货模式和错误信息的中文映射 - 实现统计项点击筛选功能,添加高亮状态指示器 - 重构前端JavaScript代码,使用预格式化数据字段提升显示性能 - 添加详情弹窗功能,支持查看完整的同步请求响应内容 - 优化重试按钮交互,增加确认提示防止误操作 - 更新页面布局样式,改善用户界面体验 ```
这个提交包含在:
@@ -40,6 +40,49 @@ class Sync extends Backend
|
||||
return $stats;
|
||||
}
|
||||
|
||||
protected function formatListItem(array $row)
|
||||
{
|
||||
$typeMap = [
|
||||
'shipping' => '发货同步',
|
||||
'confirm' => '确认收货同步',
|
||||
];
|
||||
$row['sync_type_text'] = $typeMap[$row['sync_type'] ?? ''] ?? ($row['sync_type'] ?? '-');
|
||||
|
||||
$status = $row['status'] ?? '';
|
||||
$retryCount = intval($row['retry_count'] ?? 0);
|
||||
if ($status === 'success') {
|
||||
$row['status_text'] = '成功';
|
||||
} elseif ($status === 'failed') {
|
||||
$row['status_text'] = '失败';
|
||||
} elseif ($status === 'pending') {
|
||||
$row['status_text'] = $retryCount > 0 ? '待重试' : '处理中';
|
||||
} else {
|
||||
$row['status_text'] = $status ?: '-';
|
||||
}
|
||||
|
||||
if (($row['sync_type'] ?? '') !== 'shipping') {
|
||||
$row['delivery_mode_text'] = '-';
|
||||
} else {
|
||||
$modeMap = [1 => '统一发货', 2 => '分拆发货'];
|
||||
$row['delivery_mode_text'] = $modeMap[intval($row['delivery_mode'] ?? 0)] ?? ('模式' . $row['delivery_mode']);
|
||||
}
|
||||
|
||||
if ($status === 'success') {
|
||||
$row['error_text'] = '-';
|
||||
} else {
|
||||
$parts = [];
|
||||
if ($row['errcode'] !== null && $row['errcode'] !== '') {
|
||||
$parts[] = '[' . $row['errcode'] . ']';
|
||||
}
|
||||
if (!empty($row['errmsg'])) {
|
||||
$parts[] = $row['errmsg'];
|
||||
}
|
||||
$row['error_text'] = $parts ? implode(' ', $parts) : '-';
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
@@ -52,6 +95,9 @@ class Sync extends Backend
|
||||
$query = $this->buildQuery($status, $syncType, $orderSn)->order('id', 'desc');
|
||||
$total = (clone $query)->count();
|
||||
$list = $query->page($page, $limit)->select();
|
||||
foreach ($list as $key => $row) {
|
||||
$list[$key] = $this->formatListItem($row);
|
||||
}
|
||||
|
||||
return json(['total' => $total, 'rows' => $list]);
|
||||
}
|
||||
@@ -67,7 +113,7 @@ class Sync extends Backend
|
||||
if (!$row) {
|
||||
$this->error('记录不存在');
|
||||
}
|
||||
$this->success('', null, $row);
|
||||
$this->success('', null, $this->formatListItem($row));
|
||||
}
|
||||
|
||||
public function retry()
|
||||
|
||||
在新工单中引用
屏蔽一个用户