fix(order): 修复订单详情分成明细报错并将弹窗改为独立选项卡打开

这个提交包含在:
chen
2026-09-17 08:10:24 +08:00
父节点 251d62296e
当前提交 23fe197bff
共有 9 个文件被更改,包括 408 次插入 和 164 次删除

查看文件

@@ -145,6 +145,7 @@ class Order extends Common
public function detail($id)
{
if (!$this->request->isAjax()) {
$this->assignconfig('order_id', $id);
return $this->view->fetch();
}
@@ -177,10 +178,15 @@ class Order extends Common
$item->suggest_refund_fee = $item->suggest_refund_fee;
}
// 处理未支付订单 item status_code
// 处理未支付订单 item status_code(此方法会将 $order 转为数组)
$order = $order->setOrderItemStatusByOrder($order);
$order->partner_split = $this->buildPartnerSplit($order);
$partnerSplit = $this->buildPartnerSplit($order);
if (is_array($order)) {
$order['partner_split'] = $partnerSplit;
} else {
$order->partner_split = $partnerSplit;
}
$this->success('获取成功', null, $order);
}
@@ -190,128 +196,237 @@ class Order extends Common
*/
protected function buildPartnerSplit($order)
{
$orderId = intval($order->id ?? 0);
$shareTypes = ['venue_share', 'county_share', 'madow_share'];
$items = [];
$totalCash = 0;
$rows = \app\admin\model\shopro\partner\Reward::with(['user'])
->where('order_id', $orderId)
->order('id', 'asc')
->select();
foreach ($rows as $row) {
$type = (string) ($row->reward_type ?? '');
if (in_array($type, $shareTypes, true)) {
continue;
try {
$orderId = intval(is_array($order) ? ($order['id'] ?? 0) : ($order->id ?? 0));
if ($orderId <= 0) {
return [
'items' => [],
'total_cash' => '0.00',
'total_voucher' => '0.00',
'settle_date' => null,
'has_data' => false,
];
}
$amount = round((float) $row->amount, 2);
$madow = (float) ($row->madow ?? 0);
if (intval($row->status) === 1 && $amount > 0) {
$totalCash = round($totalCash + $amount, 2);
}
$items[] = [
'display' => 'user',
'id' => intval($row->id),
'reward_type' => $type,
'reward_type_text' => $row->reward_type_text,
'role_text' => $row->role_text ?? '',
'user_id' => intval($row->user_id),
'user' => $row->user,
'amount' => number_format($amount, 2, '.', ''),
'madow' => \addons\shopro\service\partner\IdentityService::formatMadow($madow),
'status' => intval($row->status),
'status_text' => $row->status_text,
'formula' => $row->formula,
'skip_reason_text' => $row->skip_reason_text,
];
}
$settleDate = null;
$paidRaw = $order->getData('paid_time') ?? ($order['paid_time'] ?? null);
if ($paidRaw) {
$paidTs = is_numeric($paidRaw) ? intval($paidRaw) : strtotime((string) $paidRaw);
if ($paidTs > 0) {
$settleDate = date('Y-m-d', $paidTs);
}
}
$shareTypes = ['venue_share', 'county_share', 'madow_share'];
$items = [];
$totalCash = 0;
$totalVoucher = 0;
if ($settleDate) {
foreach ($shareTypes as $type) {
$shareRows = \app\admin\model\shopro\partner\Reward::where('settle_date', $settleDate)
->where('reward_type', $type)
->where('status', 1)
->where('user_id', '>', 0)
->select();
$userCount = count($shareRows);
if ($userCount <= 0) {
// 分母为 0 进平台的记录
$platform = \app\admin\model\shopro\partner\Reward::where('settle_date', $settleDate)
->where('reward_type', $type)
->where('status', 1)
->where('user_id', 0)
->find();
if (!$platform) {
continue;
}
$items[] = [
'display' => 'share',
'reward_type' => $type,
'reward_type_text' => \addons\shopro\service\partner\PartnerConfig::rewardTypeText($type),
'user_count' => 0,
'each_amount' => '0.00',
'each_madow' => '0.00000000',
'total_amount' => number_format((float) $platform->amount, 2, '.', ''),
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($platform->madow ?? 0),
'settle_date' => $settleDate,
'status_text' => '已入账',
'unit' => $type === 'madow_share' ? '马豆' : '元',
'formula' => $platform->formula,
'tip' => '付款日日结均分:当日无人参与,奖池进平台',
];
// 1. 查询合伙股东即时收益流水
$rows = \app\admin\model\shopro\partner\Reward::with(['user'])
->where('order_id', $orderId)
->order('id', 'asc')
->select();
foreach ($rows as $row) {
$type = (string) ($row->reward_type ?? '');
if (in_array($type, $shareTypes, true)) {
continue;
}
$amount = round((float) ($row->amount ?? 0), 2);
$baseAmount = round((float) ($row->base_amount ?? 0), 2);
$madow = (float) ($row->madow ?? 0);
$status = intval($row->status ?? 0);
$totalAmount = 0;
$totalMadow = 0;
foreach ($shareRows as $sr) {
$totalAmount = round($totalAmount + (float) $sr->amount, 2);
$totalMadow = function_exists('bcadd')
? (float) bcadd((string) $totalMadow, (string) ($sr->madow ?? 0), 8)
: ($totalMadow + (float) ($sr->madow ?? 0));
if ($status === 1 && $amount > 0) {
$totalCash = round($totalCash + $amount, 2);
}
$first = $shareRows[0];
$eachAmount = number_format((float) $first->amount, 2, '.', '');
$eachMadow = \addons\shopro\service\partner\IdentityService::formatMadow($first->madow ?? 0);
$ext = is_array($first->ext) ? $first->ext : [];
if (!empty($ext['share_user_count'])) {
$userCount = intval($ext['share_user_count']);
if ($type === 'voucher_grant' && $status === 1 && $baseAmount > 0) {
$totalVoucher = round($totalVoucher + $baseAmount, 2);
}
// 友好展示金额
if ($type === 'voucher_grant') {
$amountText = number_format($baseAmount, 2, '.', '') . ' 兑换券';
} elseif ($madow > 0) {
$amountText = \addons\shopro\service\partner\IdentityService::formatMadow($madow) . ' 马豆';
} elseif ($amount > 0) {
$amountText = '¥' . number_format($amount, 2, '.', '');
} else {
$amountText = '¥0.00';
}
$items[] = [
'display' => 'share',
'display' => 'user',
'id' => intval($row->id),
'reward_type' => $type,
'reward_type_text' => \addons\shopro\service\partner\PartnerConfig::rewardTypeText($type),
'user_count' => $userCount,
'each_amount' => $eachAmount,
'each_madow' => $eachMadow,
'total_amount' => number_format($totalAmount, 2, '.', ''),
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($totalMadow),
'settle_date' => $settleDate,
'status_text' => '已入账',
'unit' => $type === 'madow_share' ? '马豆' : '元',
'formula' => $first->formula,
'tip' => '付款日日结均分(不列出参与用户名单)',
'reward_type_text' => (string) ($row->reward_type_text ?: \addons\shopro\service\partner\PartnerConfig::rewardTypeText($type)),
'role' => (string) ($row->role ?? ''),
'role_text' => (string) ($row->role_text ?? ''),
'user_id' => intval($row->user_id),
'user' => $row->user ? (is_object($row->user) ? $row->user->toArray() : $row->user) : null,
'amount' => number_format($amount, 2, '.', ''),
'base_amount' => number_format($baseAmount, 2, '.', ''),
'amount_text' => $amountText,
'madow' => \addons\shopro\service\partner\IdentityService::formatMadow($madow),
'status' => $status,
'status_text' => (string) ($row->status_text ?: (
$status === 1 ? '已入账' : ($status === 0 ? '待入账' : ($status === -1 ? '已取消' : '已退回'))
)),
'formula' => (string) ($row->formula ?? ''),
'skip_reason_text' => (string) ($row->skip_reason_text ?? ''),
];
}
}
return [
'items' => $items,
'total_cash' => number_format($totalCash, 2, '.', ''),
'settle_date' => $settleDate,
'has_data' => count($items) > 0,
];
// 2. 兼容传统分销佣金记录(如存在)
try {
$commRows = \app\admin\model\shopro\commission\Reward::with(['agent.user'])
->where('order_id', $orderId)
->order('id', 'asc')
->select();
if ($commRows) {
foreach ($commRows as $crow) {
$cCommission = round((float) ($crow->commission ?? 0), 2);
$cStatus = intval($crow->status ?? 0);
if ($cStatus === 1 && $cCommission > 0) {
$totalCash = round($totalCash + $cCommission, 2);
}
$items[] = [
'display' => 'user',
'id' => intval($crow->id),
'reward_type' => 'commission',
'reward_type_text' => '分销佣金',
'role' => 'commission',
'role_text' => '分销商',
'user_id' => intval($crow->agent ? ($crow->agent->user_id ?? 0) : 0),
'user' => ($crow->agent && $crow->agent->user) ? (is_object($crow->agent->user) ? $crow->agent->user->toArray() : $crow->agent->user) : null,
'amount' => number_format($cCommission, 2, '.', ''),
'base_amount' => '0.00',
'amount_text' => '¥' . number_format($cCommission, 2, '.', ''),
'madow' => '0.00000000',
'status' => $cStatus,
'status_text' => (string) ($crow->status_text ?: ($cStatus === 1 ? '已入账' : '待入账')),
'formula' => '分销规则佣金',
'skip_reason_text' => '',
];
}
}
} catch (\Throwable $ce) {
// 忽略非核心分销查询异常
}
// 3. 统计支付日日结均分奖池概况
$settleDate = null;
$paidRaw = is_array($order)
? ($order['paid_time'] ?? null)
: ($order->getData('paid_time') ?? ($order['paid_time'] ?? null));
if ($paidRaw) {
$paidTs = is_numeric($paidRaw) ? intval($paidRaw) : strtotime((string) $paidRaw);
if ($paidTs > 0) {
$settleDate = date('Y-m-d', $paidTs);
}
}
if ($settleDate) {
foreach ($shareTypes as $type) {
$shareRows = \app\admin\model\shopro\partner\Reward::where('settle_date', $settleDate)
->where('reward_type', $type)
->where('status', 1)
->where('user_id', '>', 0)
->select();
$userCount = count($shareRows);
if ($userCount <= 0) {
// 分母为 0 进平台的记录
$platform = \app\admin\model\shopro\partner\Reward::where('settle_date', $settleDate)
->where('reward_type', $type)
->where('status', 1)
->where('user_id', 0)
->find();
if (!$platform) {
continue;
}
$platAmount = (float) ($platform->amount ?? 0);
$platMadow = (float) ($platform->madow ?? 0);
$amountText = $type === 'madow_share'
? \addons\shopro\service\partner\IdentityService::formatMadow($platMadow) . ' 马豆'
: '¥' . number_format($platAmount, 2, '.', '');
$items[] = [
'display' => 'share',
'id' => intval($platform->id ?? 0),
'reward_type' => $type,
'reward_type_text' => \addons\shopro\service\partner\PartnerConfig::rewardTypeText($type),
'role' => 'system',
'role_text' => '平台',
'user_id' => 0,
'user' => null,
'user_count' => 0,
'each_amount' => '0.00',
'each_madow' => '0.00000000',
'total_amount' => number_format($platAmount, 2, '.', ''),
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($platMadow),
'amount_text' => $amountText,
'settle_date' => $settleDate,
'status' => 1,
'status_text' => '已入账',
'unit' => $type === 'madow_share' ? '马豆' : '元',
'formula' => (string) ($platform->formula ?? ''),
'skip_reason_text' => '',
'tip' => '付款日日结均分:当日无人参与,奖池进平台',
];
continue;
}
$totalAmount = 0;
$totalMadow = 0;
foreach ($shareRows as $sr) {
$totalAmount = round($totalAmount + (float) ($sr->amount ?? 0), 2);
$totalMadow = function_exists('bcadd')
? (float) bcadd((string) $totalMadow, (string) ($sr->madow ?? 0), 8)
: ($totalMadow + (float) ($sr->madow ?? 0));
}
$first = $shareRows[0];
$eachAmount = number_format((float) ($first->amount ?? 0), 2, '.', '');
$eachMadow = \addons\shopro\service\partner\IdentityService::formatMadow($first->madow ?? 0);
$ext = is_array($first->ext) ? $first->ext : [];
if (!empty($ext['share_user_count'])) {
$userCount = intval($ext['share_user_count']);
}
$items[] = [
'display' => 'share',
'id' => intval($first->id ?? 0),
'reward_type' => $type,
'reward_type_text' => \addons\shopro\service\partner\PartnerConfig::rewardTypeText($type),
'role' => '',
'role_text' => '',
'user_id' => 0,
'user' => null,
'user_count' => $userCount,
'each_amount' => $eachAmount,
'each_madow' => $eachMadow,
'total_amount' => number_format($totalAmount, 2, '.', ''),
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($totalMadow),
'amount_text' => $type === 'madow_share' ? ($eachMadow . ' 马豆/人') : ('¥' . $eachAmount . '/人'),
'settle_date' => $settleDate,
'status' => 1,
'status_text' => '已入账',
'unit' => $type === 'madow_share' ? '马豆' : '元',
'formula' => (string) ($first->formula ?? ''),
'skip_reason_text' => '',
'tip' => '付款日日结均分(不列出参与用户名单)',
];
}
}
return [
'items' => $items,
'total_cash' => number_format($totalCash, 2, '.', ''),
'total_voucher' => number_format($totalVoucher, 2, '.', ''),
'settle_date' => $settleDate,
'has_data' => count($items) > 0,
];
} catch (\Throwable $e) {
\think\Log::error('buildPartnerSplit error: ' . $e->getMessage());
return [
'items' => [],
'total_cash' => '0.00',
'total_voucher' => '0.00',
'settle_date' => null,
'has_data' => false,
];
}
}

查看文件

@@ -1,6 +1,40 @@
{include file="/shopro/common/script" /}
<style>
.order-detail {
background: var(--sa-background-hex);
min-height: 100%;
}
.order-detail .panel-block {
height: calc(100vh - 40px);
}
.is-dialog .order-detail .panel-block {
height: 100vh;
}
.order-detail .detail-header-bar {
height: 46px;
padding: 0 16px;
background: var(--sa-table-header-bg);
border-radius: 8px;
margin-bottom: 14px;
}
.order-detail .detail-header-bar .title-text {
font-size: 16px;
font-weight: 700;
color: var(--sa-title);
margin-left: 10px;
}
.order-detail .detail-header-bar .order-sn-tag {
font-size: 13px;
color: var(--sa-subfont);
margin-left: 10px;
}
.order-detail .partner-split-content {
border-radius: 8px;
padding: var(--sa-padding);
@@ -384,6 +418,18 @@
<el-container class="panel-block">
<el-main>
<el-scrollbar height="100%">
<div class="detail-header-bar sa-flex sa-row-between">
<div class="sa-flex">
<el-button icon="Back" size="small" @click="onBack">返回</el-button>
<span class="title-text">订单详情 #{{ state.id }}</span>
<span v-if="state.detail.order_sn" class="order-sn-tag">
订单号: {{ state.detail.order_sn }}
</span>
</div>
<div class="sa-flex">
<el-button icon="RefreshRight" size="small" circle @click="getDetail" title="刷新"></el-button>
</div>
</div>
<div class="tip">
<div>温馨提示</div>
<div>1、如果无法发货,请及时与买家联系并说明情况后主动退款;</div>
@@ -833,31 +879,40 @@
</el-tabs>
<div class="partner-split-content order-content">
<div class="title sa-flex sa-row-between">
<span>合伙股东分成明细</span>
<span v-if="state.detail.partner_split?.total_cash" style="font-size:13px;font-weight:400;color:var(--sa-subfont)">
本单即时现金合计 ¥{{ state.detail.partner_split.total_cash }}
<template v-if="state.detail.partner_split.settle_date">
· 均分日 {{ state.detail.partner_split.settle_date }}
</template>
</span>
<div class="sa-flex">
<span>合伙股东分成明细</span>
<el-tag v-if="state.detail.partner_split && state.detail.partner_split.has_data" size="small" type="success" style="margin-left: 10px;">有分成记录</el-tag>
<el-tag v-else size="small" type="info" style="margin-left: 10px;">暂无分成记录</el-tag>
</div>
<div v-if="state.detail.partner_split" style="font-size:13px;font-weight:400;color:var(--sa-subfont)">
<span v-if="Number(state.detail.partner_split.total_cash) > 0" style="margin-right: 14px;">
本单现金合计 <strong style="color:#ff4d4f;font-size:14px">¥{{ state.detail.partner_split.total_cash }}</strong>
</span>
<span v-if="Number(state.detail.partner_split.total_voucher) > 0" style="margin-right: 14px;">
兑换券释放额度 <strong style="color:#e6a23c;font-size:14px">{{ state.detail.partner_split.total_voucher }}</strong>
</span>
<span v-if="state.detail.partner_split.settle_date">
均分日 {{ state.detail.partner_split.settle_date }}
</span>
</div>
</div>
<el-table
v-if="state.detail.partner_split?.has_data"
v-if="state.detail.partner_split && state.detail.partner_split.has_data && state.detail.partner_split.items && state.detail.partner_split.items.length > 0"
class="sa-table"
:data="state.detail.partner_split.items"
stripe
>
<el-table-column label="收益种类" min-width="140">
<template #default="scope">
<div>{{ scope.row.reward_type_text || scope.row.reward_type }}</div>
<div v-if="scope.row.role_text" style="font-size:12px;color:#999">{{ scope.row.role_text }}</div>
<div style="font-weight: 600;">{{ scope.row.reward_type_text || scope.row.reward_type }}</div>
<div v-if="scope.row.role_text" style="font-size:12px;color:var(--sa-subfont)">身份: {{ scope.row.role_text }}</div>
</template>
</el-table-column>
<el-table-column label="受益人 / 参与概况" min-width="220">
<template #default="scope">
<template v-if="scope.row.display === 'share'">
<div>参与用户 {{ scope.row.user_count }} 人</div>
<div style="font-size:12px;color:#999">{{ scope.row.tip || '均分不列出名单' }}</div>
<div style="font-weight: 500;">参与用户 {{ scope.row.user_count }} 人</div>
<div style="font-size:12px;color:var(--sa-subfont)">{{ scope.row.tip || '均分不列出名单' }}</div>
</template>
<template v-else>
<sa-user-profile
@@ -869,49 +924,58 @@
</template>
</template>
</el-table-column>
<el-table-column label="金额" min-width="160">
<el-table-column label="分成金额 / 数量" min-width="160">
<template #default="scope">
<template v-if="scope.row.display === 'share'">
<div v-if="scope.row.unit === '马豆'">
每人 {{ scope.row.each_madow }} 马豆
<div style="font-weight: 600; color: var(--el-color-primary);">
{{ scope.row.amount_text || (scope.row.unit === '马豆' ? (scope.row.each_madow + ' 马豆/人') : ('¥' + scope.row.each_amount + '/人')) }}
</div>
<div v-else>
每人 ¥{{ scope.row.each_amount }}
</div>
<div style="font-size:12px;color:#999">
<div style="font-size:12px;color:var(--sa-subfont)">
<template v-if="scope.row.unit === '马豆'">
合计 {{ scope.row.total_madow }} 马豆
奖池合计: {{ scope.row.total_madow }} 马豆
</template>
<template v-else>
合计 ¥{{ scope.row.total_amount }}
奖池合计: ¥{{ scope.row.total_amount }}
</template>
</div>
</template>
<template v-else>
<span v-if="Number(scope.row.amount) > 0">¥{{ scope.row.amount }}</span>
<span v-else-if="Number(scope.row.madow) > 0">{{ scope.row.madow }} 马豆</span>
<span v-else>¥0.00</span>
<div v-if="scope.row.reward_type === 'voucher_grant'" style="font-weight: 600; color: #e6a23c;">
{{ scope.row.amount_text || (scope.row.base_amount + ' 兑换券') }}
</div>
<div v-else-if="Number(scope.row.amount) > 0" style="font-weight: 600; color: #ff4d4f;">
¥{{ scope.row.amount }}
</div>
<div v-else-if="Number(scope.row.madow) > 0" style="font-weight: 600; color: #67c23a;">
{{ scope.row.madow }} 马豆
</div>
<div v-else style="color: var(--sa-subfont);">
¥0.00
</div>
</template>
</template>
</el-table-column>
<el-table-column label="状态" min-width="90">
<el-table-column label="状态" min-width="100">
<template #default="scope">
<span :class="`sa-color--${partnerStatusStyle[scope.row.status] || 'info'}`">
<el-tag
size="small"
:type="partnerStatusTagType(scope.row.status)"
>
{{ scope.row.status_text || '-' }}
</span>
</el-tag>
</template>
</el-table-column>
<el-table-column label="说明" min-width="220">
<el-table-column label="计算公式与说明" min-width="240">
<template #default="scope">
<div>{{ scope.row.formula || '-' }}</div>
<div v-if="scope.row.skip_reason_text" class="sa-color--warning" style="font-size:12px">
{{ scope.row.skip_reason_text }}
<div v-if="scope.row.skip_reason_text" class="sa-color--warning" style="font-size:12px; margin-top: 2px;">
未满足条件:{{ scope.row.skip_reason_text }}
</div>
</template>
</el-table-column>
</el-table>
<div v-else style="padding:16px 0;color:#999;font-size:13px">
暂无合伙股东分成记录(未计奖、未支付或尚未日结)
<div v-else style="padding:16px 0;color:var(--sa-subfont);font-size:13px;text-align:center;">
暂无合伙股东分成记录(未产生分成、未支付或尚未日结)
</div>
</div>
<div class="goods-content">

查看文件

@@ -1006,7 +1006,17 @@ define(['io', 'moment', 'moment/locale/zh-cn'], function (io, Moment) {
}
function onOpenOrderDetail(id) {
Fast.api.open(`shopro/order/order/detail?id=${id}`, "订单详情")
const url = `shopro/order/order/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 scrollBottom() {

查看文件

@@ -328,11 +328,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
function onOpenOrderDetail(id) {
Fast.api.open(`shopro/order/order/detail?id=${id}`, "订单详情", {
callback() {
getData()
}
})
const url = `shopro/order/order/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);
}
}
const exportLoading = ref(false);

查看文件

@@ -194,11 +194,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
function onOpenOrderDetail(id) {
Fast.api.open(`shopro/order/order/detail?id=${id}`, "订单详情", {
callback() {
getData()
}
})
const url = `shopro/order/order/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);
}
}
onMounted(() => {

查看文件

@@ -197,11 +197,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
function onOpenOrderDetail(id) {
Fast.api.open(`shopro/order/order/detail?id=${id}`, "订单详情", {
callback() {
getData()
}
})
const url = `shopro/order/order/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);
}
}
onMounted(() => {

查看文件

@@ -514,11 +514,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
function onDetail(id) {
Fast.api.open(`shopro/order/order/detail/id/${id}?id=${id}`, "详情", {
callback() {
getData()
}
})
const url = `shopro/order/order/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 onAction(id) {
@@ -572,8 +578,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
setup() {
const { proxy } = getCurrentInstance();
const queryOrderId = (typeof Config !== 'undefined' && Config.order_id)
? Config.order_id
: (new URLSearchParams(location.search).get('id') || (location.pathname.match(/\/id\/(\d+)/i) || [])[1] || Fast.api.query('id'));
const state = reactive({
id: new URLSearchParams(location.search).get('id'),
id: queryOrderId,
detail: {},
stepActive: 1,
})
@@ -873,6 +883,31 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}, function (ret, res) { })
}
});
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();
} else {
window.history.back();
}
}
function partnerStatusTagType(status) {
const map = {
'-2': 'danger',
'-1': 'info',
'0': 'warning',
'1': 'success',
};
return map[String(status)] || 'info';
}
onMounted(() => {
@@ -883,6 +918,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
...Controller.data(),
state,
getDetail,
onBack,
partnerStatusTagType,
onDispatch,
onFullRefund,
memo,