门店账户多账号
This commit is contained in:
@@ -429,12 +429,6 @@ async function main() {
|
||||
|
||||
closeTime: '22:00',
|
||||
|
||||
bankAccountName: def.name,
|
||||
|
||||
bankAccountNo: '6222029876543210',
|
||||
|
||||
bankBranch: '建设银行郑州分行',
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
@@ -443,20 +437,41 @@ async function main() {
|
||||
|
||||
await prisma.store.update({ where: { id: store.id }, data: { coverResourceId: cover.id } });
|
||||
|
||||
if (def.withAccount) {
|
||||
|
||||
await prisma.storeAccount.create({
|
||||
|
||||
data: { storeId: store.id, phone: def.phone, name: def.name },
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
createdStores.push({ id: store.id, name: def.name });
|
||||
|
||||
}
|
||||
|
||||
// 一号两店:主账号 13910000001 绑定老城店 + 美食城店,便于测选店
|
||||
const multiStorePrimary = await prisma.storeAccount.create({
|
||||
data: {
|
||||
phone: '13910000001',
|
||||
name: '郑州老城店主',
|
||||
isPrimary: 1,
|
||||
bankAccountName: '郑州老城店主',
|
||||
bankAccountNo: '6222029876543210',
|
||||
bankBranch: '建设银行郑州分行',
|
||||
bindings: {
|
||||
create: createdStores.map((s) => ({ storeId: s.id })),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// 子账号样例:仅绑定第一家店
|
||||
await prisma.storeAccount.create({
|
||||
data: {
|
||||
phone: '13910000011',
|
||||
name: '老城店收银员',
|
||||
isPrimary: 0,
|
||||
parentAccountId: multiStorePrimary.id,
|
||||
staffRole: 'CASHIER',
|
||||
permissions: ['redeem', 'records'],
|
||||
status: 'ACTIVE',
|
||||
bindings: {
|
||||
create: [{ storeId: createdStores[0].id }],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
const weekStart = (() => {
|
||||
@@ -511,12 +526,6 @@ async function main() {
|
||||
|
||||
closeTime: '22:00',
|
||||
|
||||
bankAccountName: '本周新签体验店',
|
||||
|
||||
bankAccountNo: '6222029876543211',
|
||||
|
||||
bankBranch: '农业银行郑州分行',
|
||||
|
||||
createdAt: new Date(weekStart.getTime() + 2 * 24 * 60 * 60 * 1000),
|
||||
|
||||
},
|
||||
@@ -525,6 +534,18 @@ async function main() {
|
||||
|
||||
createdStores.push({ id: newWeekStore.id, name: newWeekStore.name });
|
||||
|
||||
await prisma.storeAccount.create({
|
||||
data: {
|
||||
phone: '13910000003',
|
||||
name: '本周新签体验店',
|
||||
isPrimary: 1,
|
||||
bankAccountName: '本周新签体验店',
|
||||
bankAccountNo: '6222029876543211',
|
||||
bankBranch: '农业银行郑州分行',
|
||||
bindings: { create: [{ storeId: newWeekStore.id }] },
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
await prisma.user.create({
|
||||
|
||||
Reference in New Issue
Block a user