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(`

渠道商列表

`); 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)} `); 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(`

${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(`
建一个绑定本渠道商的「渠道商」角色登录账号,只能看到自己渠道的数据与结算单。 用户名/密码留空则自动生成,创建后凭据会邮件发给上面填的联系邮箱。 `); if (form.createAccount) { _push(`
`); if (!form.contactmails.trim()) { _push(`

没填联系邮箱,凭据将无法邮件送达,只会在创建后弹窗显示一次。

`); } else { _push(``); } _push(`
`); } else { _push(``); } _push(`
`); } else { _push(``); } _push(`
`); if (!isEditing.value && !canAudit.value) { _push(`

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

`); } else { _push(``); } _push(`
`); _push(ssrRenderComponent(_component_AccountCredentialDialog, { info: cred.value, onClose: ($event) => cred.value = null }, null, _parent)); _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-CyBvzjOe.mjs.map