import { _ as __nuxt_component_0 } from './AccountCredentialDialog-D37zgaXm.mjs'; import { defineComponent, computed, ref, reactive, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderStyle, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrInterpolate, ssrRenderClass, ssrRenderComponent } from 'vue/server-renderer'; import { u as useApi } from './useApi-BNSkSrat.mjs'; import { u as useToast } from './useToast-MBvLaNjH.mjs'; import { a as useAuthStore } from './server.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'pinia'; import 'perfect-debounce'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "dealers", __ssrInlineRender: true, setup(__props) { useApi(); useToast(); const auth = useAuthStore(); const canAudit = computed(() => auth.isAdmin); const cred = ref(null); const view = ref("list"); const rows = ref([]); const brands = ref([]); const loading = ref(false); const submitting = ref(false); const isEditing = ref(false); const filters = reactive({ brandid: 0, status: -1, keyword: "" }); const form = reactive({ id: "", name: "", brandid: 0, sharepct: 0, contact: "", contactmails: "", remark: "", // 仅新增时用:顺手开一个绑定本渠道商的渠道账号 createAccount: false, accountUsername: "", accountPassword: "", accountRemark: "" }); const STATUS_LABELS = { 0: "待审核", 1: "启用", 2: "停用", 3: "驳回" }; const STATUS_CLASS = { 0: "badge-warning", 1: "badge-success", 2: "badge-ghost", 3: "badge-error" }; function statusLabel(s) { return STATUS_LABELS[s] ?? String(s); } function statusClass(s) { return STATUS_CLASS[s] ?? "badge-ghost"; } function ratePct(rate) { return ((Number(rate) || 0) / 100).toFixed(2) + "%"; } function brandName(id) { const b = brands.value.find((x) => x.id === id); return b ? b.brand : id ? "品牌商#" + Number(id).toString(16).toUpperCase() : "-"; } function fmtTime(ts) { if (!ts) return "-"; const d = new Date(ts * 1e3); const p = (n) => ("0" + n).slice(-2); return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`; } return (_ctx, _push, _parent, _attrs) => { const _component_AccountCredentialDialog = __nuxt_component_0; _push(`
| 渠道商ID | 名称 | 所属品牌商 | 分成比例 | 联系方式 | 状态 | 创建时间 | 操作 |
|---|---|---|---|---|---|---|---|
| 暂无数据 | |||||||
| ${ssrInterpolate(ch.id)} | ${ssrInterpolate(ch.name)} `); if (ch.official) { _push(`官方`); } else { _push(``); } _push(` | ${ssrInterpolate(brandName(ch.brandid))} | ${ssrInterpolate(ratePct(ch.sharerate))} | `);
if (ch.contact) {
_push(` ${ssrInterpolate(ch.contact)} `);
} else {
_push(``);
}
if (ch.contactmails) {
_push(`${ssrInterpolate(ch.contactmails)} `);
} else {
_push(``);
}
if (!ch.contact && !ch.contactmails) {
_push(`-`);
} else {
_push(``);
}
_push(` | ${ssrInterpolate(statusLabel(ch.status))}`);
if (ch.status === 3 && ch.auditremark) {
_push(` ${ssrInterpolate(ch.auditremark)} `);
} else {
_push(``);
}
_push(` | ${ssrInterpolate(fmtTime(ch.createtime))} | `);
if (canAudit.value) {
_push(``);
if (ch.status !== 1) {
_push(``);
} else {
_push(``);
}
if (ch.status === 1) {
_push(``);
} else {
_push(``);
}
if (ch.status === 0) {
_push(``);
} else {
_push(``);
}
_push(``);
} else {
_push(``);
}
if (!unref(auth).isDealer && !ch.official) {
_push(``);
} else {
_push(``);
}
_push(` |
`); if (unref(auth).isBrandAccount) { _push(` 这里只显示贵品牌商名下的渠道商。新增后为「待审核」,需平台审核通过(状态=启用)才能用于生产授权码;分成比例由平台设置。 `); } else { _push(` 渠道商新增后需超管/管理员审核通过(状态=启用)才能用于生产授权码;已有生产批次的渠道商不能删除,只能停用。 标「官方」的是品牌自营渠道,随品牌商自动创建、直接启用、不可删除。 `); } _push(`