feat: 商户账号创建接口对接

This commit is contained in:
lzhizhao 2025-09-13 23:00:12 +08:00
parent 09e7735391
commit c7343e485a
4 changed files with 29 additions and 51 deletions

View File

@ -41,10 +41,4 @@ export function getMerchantList(params) {
})
}
export function updatePassword(data) {
return request({
url: '/merchant-api/auth/update_password',
method: 'put',
data
})
}

View File

@ -59,3 +59,12 @@ export function resetPassword (subAccountId, newPassword) {
data: httpRequest.adornData({ newPassword })
})
}
// 重置商户密码
export function resetMerchantPassword (data) {
return httpRequest({
url: httpRequest.adornUrl('/merchant-api/subaccount/reset-merchant-password'),
method: 'post',
data: httpRequest.adornData(data)
})
}

View File

@ -195,46 +195,6 @@ export default {
open: null,
list: []
},
{
menuId: getUUID(),
parentId: 0,
parentName: null,
name: "权限管理",
url: "operation-management/permission",
perms: "operation-management:permission",
type: 0,
elIcon: "el-icon-lock",
orderNum: 0,
open: null,
list: [
{
menuId: getUUID(),
parentId: 0,
parentName: null,
name: "子经营者管理",
url: "operation-management/permission/sub-operator/index",
perms: "operation-management:permission:sub-operator:index",
type: 1,
elIcon: "el-icon-user",
orderNum: 0,
open: null,
list: []
},
{
menuId: getUUID(),
parentId: 0,
parentName: null,
name: "商户账号管理",
url: "operation-management/permission/merchant-account/index",
perms: "operation-management:permission:merchant-account:index",
type: 1,
elIcon: "el-icon-user-solid",
orderNum: 0,
open: null,
list: []
}
]
},
// {
// menuId: getUUID(),
// parentId: 0,

View File

@ -247,15 +247,15 @@
<script>
import {
getAvailablePermissions,
checkUsername
checkUsername,
resetMerchantPassword
} from '@/api/modules/subaccount' // Assuming some APIs can be reused
import {
inviteJoin,
setMerchantPermissions,
shopBaseConfig,
listPlatformCategory,
getMerchantList,
updatePassword
getMerchantList
} from '@/api/modules/merchant' // New merchant API
import { mer_admin } from '@/api/modules/mer_admin'
import routerConfig from '@/router/full-routers'
@ -492,7 +492,18 @@ export default {
this.$message.error('请输入新密码')
return
}
updatePassword({ password: this.newPassword }).then(() => {
const selectedAccount = this.merchantAccountList.find(
item => item.merchantId === this.form.merchantId
)
if (!selectedAccount) {
this.$message.error('无法找到所选商户的详细信息')
return
}
resetMerchantPassword({
merchantAccountId: selectedAccount.merchantAccountId,
newPassword: this.newPassword,
marketId: this.form.selectedMarketId || this.marketId
}).then(() => {
this.$message.success('密码重置成功')
this.resetPasswordDialogVisible = false
})
@ -570,6 +581,7 @@ export default {
}
inviteJoin(createData).then(res => {
const merchantAccountId = res.data.data.merchantAccountId // Assuming this is the merchant ID
const merchantId = res.data.data.merchantId;
const shopId = res.data.data.shopId // Assuming this is the shop ID
const permissionsData = {
merchantAccountId,
@ -579,6 +591,8 @@ export default {
setMerchantPermissions(permissionsData).then(() => {
const shopData = {
...this.form,
merchantAccountId,
merchantId,
imgs: this.form.fileList.map(f => f.url).join(','),
permits: this.form.permits.map(f => f.url).join(','),
startBusinessTime:
@ -588,6 +602,7 @@ export default {
this.businessHours[1].getHours() * 60 +
this.businessHours[1].getMinutes()
}
debugger
shopBaseConfig({ shopId }, shopData).then(() => {
this.$message.success('商户创建成功,权限及店铺信息已设置')
this.$refs.ruleFormRef.resetFields()