2025-06-20 16:16:17 +08:00
|
|
|
|
interface EnterpriseInfo {
|
|
|
|
|
|
id: number;
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
update_name_quota: number;
|
|
|
|
|
|
used_update_name_count: number;
|
|
|
|
|
|
sub_account_quota: number;
|
|
|
|
|
|
used_sub_account_count: number;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-20 16:58:03 +08:00
|
|
|
|
interface EnterpriseState {
|
|
|
|
|
|
enterpriseInfo: EnterpriseInfo | null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-20 16:16:17 +08:00
|
|
|
|
export const useEnterpriseStore = defineStore('enterprise', {
|
2025-06-20 16:58:03 +08:00
|
|
|
|
state: (): EnterpriseState => ({
|
2025-06-20 16:16:17 +08:00
|
|
|
|
// todo 暂时写死,登录功能完成后记得重置为null哦
|
|
|
|
|
|
enterpriseInfo: {
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
name: '企业1',
|
|
|
|
|
|
update_name_quota: 2,
|
|
|
|
|
|
used_update_name_count: 1,
|
|
|
|
|
|
sub_account_quota: 2,
|
|
|
|
|
|
used_sub_account_count: 2,
|
|
|
|
|
|
},
|
|
|
|
|
|
}),
|
|
|
|
|
|
actions: {
|
|
|
|
|
|
setEnterpriseInfo(enterpriseInfo: EnterpriseInfo) {
|
|
|
|
|
|
this.enterpriseInfo = enterpriseInfo;
|
|
|
|
|
|
},
|
|
|
|
|
|
setEnterpriseName(name: string) {
|
2025-06-20 16:58:03 +08:00
|
|
|
|
if (this.enterpriseInfo) {
|
|
|
|
|
|
this.enterpriseInfo.name = name;
|
|
|
|
|
|
}
|
2025-06-20 16:16:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
incUsedUpdateNameCount() {
|
2025-06-20 16:58:03 +08:00
|
|
|
|
if (this.enterpriseInfo) {
|
|
|
|
|
|
this.enterpriseInfo.used_update_name_count++;
|
|
|
|
|
|
}
|
2025-06-20 16:16:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
incUsedSubAccountCount() {
|
2025-06-20 16:58:03 +08:00
|
|
|
|
if (this.enterpriseInfo) {
|
|
|
|
|
|
this.enterpriseInfo.used_sub_account_count++;
|
|
|
|
|
|
}
|
2025-06-20 16:16:17 +08:00
|
|
|
|
},
|
2025-06-20 16:58:03 +08:00
|
|
|
|
getEnterpriseInfo(): EnterpriseInfo | null {
|
2025-06-20 16:16:17 +08:00
|
|
|
|
return this.enterpriseInfo;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|