- 新增售后详情页面 aftersale-detail.vue - 优化售后列表 UI 样式,增加加载/空态/错误状态处理 - 修复售后列表跳转逻辑,新增下拉刷新功能 - 修复师傅入驻接口数组参数 500 崩溃问题 - 优化竞价单选定报价流程,修复订单状态错误问题 - 新增订单售后相关展示逻辑,包括售后状态、操作入口等 - 更新版本号至 1.0.88,配置微信小程序 AppID
78 行
3.2 KiB
PHP
78 行
3.2 KiB
PHP
<?php
|
||
namespace app\common\library;
|
||
|
||
class OrderDetailDisplay
|
||
{
|
||
public static function groupPaymentRecords(array $records)
|
||
{
|
||
$groups = ['settled' => [], 'attempts' => [], 'needs_review' => 0];
|
||
foreach ($records as $record) {
|
||
$status = (string)($record['status'] ?? '');
|
||
if (in_array($status, ['paid', 'refunding', 'refunded', 'refund_failed'], true)) {
|
||
$groups['settled'][] = $record;
|
||
} else {
|
||
$groups['attempts'][] = $record;
|
||
if (!in_array($status, ['closed', 'pay_failed'], true)) $groups['needs_review']++;
|
||
}
|
||
}
|
||
return $groups;
|
||
}
|
||
|
||
public static function paymentRecordType(array $record)
|
||
{
|
||
$openid = trim((string)($record['openid'] ?? ''));
|
||
$number = (string)($record['out_trade_no'] ?? '');
|
||
if ($openid === 'BALANCE' || strpos($number, 'BAL') === 0) return '余额支付';
|
||
if ($openid !== '') return '微信支付';
|
||
return '未记录';
|
||
}
|
||
|
||
public static function paymentType($value)
|
||
{
|
||
$value = trim((string)$value);
|
||
$labels = ['wechat' => '微信支付', 'balance' => '余额支付', 'coupon' => '优惠券支付'];
|
||
return $value === '' ? '未记录' : ($labels[$value] ?? ('其他(' . $value . ')'));
|
||
}
|
||
|
||
public static function operator($value)
|
||
{
|
||
$labels = ['user' => '用户', 'admin' => '管理员', 'master' => '师傅', 'merchant' => '商家', 'system' => '系统'];
|
||
return $labels[(string)$value] ?? '未知';
|
||
}
|
||
|
||
public static function amountLabel(array $order)
|
||
{
|
||
$status = (int)($order['pay_status'] ?? 0);
|
||
if ($status === 1 || $status === 2) {
|
||
return $status === 2 || (float)($order['refund_amount'] ?? 0) > 0 ? '已付金额(退款前)' : '已付金额';
|
||
}
|
||
return (int)($order['status'] ?? 0) === 0 ? '订单应付金额' : '订单金额';
|
||
}
|
||
|
||
public static function services($value, array $snapshot)
|
||
{
|
||
$value = trim((string)$value);
|
||
if ($value === '') $value = '[]';
|
||
if ($value[0] !== '[' && $value[0] !== '{') return $value;
|
||
$items = json_decode($value, true);
|
||
if (!is_array($items) || json_last_error() !== JSON_ERROR_NONE) return '';
|
||
$parts = [];
|
||
$name = trim((string)($snapshot['service_type_name'] ?? ''));
|
||
$num = $snapshot['num'] ?? ($snapshot['goods_num'] ?? null);
|
||
if ($name !== '' && is_numeric($num) && $num > 0) $parts[] = $name . 'x' . $num;
|
||
foreach ($items as $item) {
|
||
if (!is_array($item) || empty($item['name'])) continue;
|
||
$count = $item['num'] ?? ($item['count'] ?? null);
|
||
if ($count !== null && (!is_numeric($count) || $count <= 0)) continue;
|
||
$parts[] = trim((string)$item['name']) . ($count === null ? '' : 'x' . $count);
|
||
}
|
||
return implode(';', $parts);
|
||
}
|
||
|
||
public static function quoteStatus($value)
|
||
{
|
||
$labels = ['wait' => '待确认', 'selected' => '已选定', 'accept' => '已选定', 'reject' => '未选定', 'expired' => '已过期'];
|
||
return $labels[(string)$value] ?? '未知状态';
|
||
}
|
||
}
|