import { defineComponent, computed, ref, reactive, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderStyle, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrInterpolate, ssrRenderClass } from 'vue/server-renderer'; import { u as useApi } from './useApi-B-E5eLsI.mjs'; import { u as useToast } from './useToast-CS21XT61.mjs'; import { a as useAuthStore } from './server.mjs'; import './useLoading-D4zrSa2m.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 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: "" }); 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) => { _push(`

渠道商列表

`); if (!unref(auth).isDealer) { _push(``); } else { _push(``); } _push(`
`); if (!unref(auth).isBrandAccount && !unref(auth).isDealer) { _push(`
`); } else { _push(``); } _push(`
`); if (loading.value) { _push(``); } else if (!rows.value.length) { _push(``); } else { _push(``); } _push(``); ssrRenderList(rows.value, (ch) => { _push(``); }); _push(`
渠道商ID名称所属品牌商分成比例联系方式状态创建时间操作
暂无数据
${ssrInterpolate(ch.id)}${ssrInterpolate(ch.name)}${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) { _push(``); } else { _push(``); } _push(`

`); if (unref(auth).isBrandAccount) { _push(` 这里只显示贵品牌商名下的渠道商。新增后为「待审核」,需平台审核通过(状态=启用)才能用于生产授权码;分成比例由平台设置。 `); } else { _push(` 渠道商新增后需超管/管理员审核通过(状态=启用)才能用于生产授权码;已有生产批次的渠道商不能删除,只能停用。 `); } _push(`

${ssrInterpolate(isEditing.value ? "编辑渠道商" : "新增渠道商")}

`); if (isEditing.value) { _push(`
短码由系统生成,创建后不可修改
`); } else { _push(``); } _push(`
`); if (!unref(auth).isBrandAccount) { _push(`
`); if (isEditing.value) { _push(`归属品牌商创建后不可修改`); } else { _push(``); } _push(`
`); } else { _push(``); } _push(`
从所属品牌商的分成里再切;仅超管/管理员可设置。
`); if (!isEditing.value && !canAudit.value) { _push(`

提交后为「待审核」状态,须超管/管理员通过后才能用于生产。

`); } else { _push(``); } _push(`
`); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/dealers.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=dealers-D0gf3N66.mjs.map