import { _ as __nuxt_component_0 } from './AccountCredentialDialog-D37zgaXm.mjs'; import { defineComponent, ref, reactive, computed, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderStyle, ssrRenderList, ssrInterpolate, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, 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 PLATFORM_MAIL = "358030594@qq.com"; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "factory", __ssrInlineRender: true, setup(__props) { useApi(); useToast(); const auth = useAuthStore(); const view = ref("list"); const rows = ref([]); const providers = ref([]); const loading = ref(false); const submitting = ref(false); const isEditing = ref(false); const emails = ref([]); const newEmail = ref(""); const form = reactive({ id: 0, brand: "", providerid: 0, description: "", sharepct: 0, // 仅新增时用:官方渠道名称 + 顺手开一个品牌商账号 officialChannelName: "", createAccount: false, accountUsername: "", accountPassword: "", accountRemark: "" }); const defaultOfficialName = computed(() => (form.brand.trim() || "品牌") + "官方渠道"); const credentialMails = computed( () => emails.value.filter((e) => e.toLowerCase() !== PLATFORM_MAIL) ); const cred = ref(null); function ratePct(rate) { return ((Number(rate) || 0) / 100).toFixed(2) + "%"; } function hexId(id) { return id ? Number(id).toString(16).toUpperCase() : ""; } function mailList(s) { return (s || "").split(",").map((e) => e.trim()).filter(Boolean); } function providerName(pid) { if (!pid) return "-"; const p = providers.value.find((x) => x.id === pid); return p ? p.name : "方案商#" + pid; } return (_ctx, _push, _parent, _attrs) => { const _component_AccountCredentialDialog = __nuxt_component_0; _push(`

品牌商列表

`); if (loading.value) { _push(``); } else if (!rows.value.length) { _push(``); } else { _push(``); } _push(``); ssrRenderList(rows.value, (b) => { _push(``); }); _push(`
ID品牌名称归属方案商分成比例联系邮箱产品操作
暂无数据
${ssrInterpolate(hexId(b.id))}${ssrInterpolate(b.brand)}${ssrInterpolate(providerName(b.providerid))}${ssrInterpolate(ratePct(b.sharerate))}`); if (mailList(b.contactmails).length) { _push(``); ssrRenderList(mailList(b.contactmails), (e, i) => { _push(`${ssrInterpolate(e)}`); }); _push(``); } else { _push(`-`); } _push(`${ssrInterpolate(b.productlists || "")}

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

平台从订单实付里分给该品牌商的总提成;其名下渠道商再从这份里切自己的比例。
`); if (!emails.value.length) { _push(`

暂无邮箱

`); } else { _push(``); } _push(``); ssrRenderList(emails.value, (e, i) => { _push(`
${ssrInterpolate(e)}
`); }); _push(`
`); if (!isEditing.value) { _push(`
新建品牌商时自动创建一条该品牌自己的渠道(直接启用、分成 0%、不创建渠道账号),用于品牌直销的授权码归属;留空则叫「${ssrInterpolate(defaultOfficialName.value)}」。
`); } else { _push(``); } if (!isEditing.value && unref(auth).isAdmin) { _push(`
建一个绑定本品牌商的「品牌商」角色登录账号,可见本品牌及名下全部渠道商的数据。 用户名/密码留空则自动生成,创建后凭据会邮件发给上面填的品牌商联系邮箱。 `); if (form.createAccount) { _push(`
`); if (!credentialMails.value.length) { _push(`

当前没有填品牌商自己的联系邮箱(平台默认邮箱不算),凭据将无法邮件送达,只会在创建后弹窗显示一次。

`); } else { _push(``); } _push(`
`); } else { _push(``); } _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/factory.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=factory-CAOmR9O2.mjs.map