feat: 维护商户信息
This commit is contained in:
parent
5abb93d202
commit
66ba90718d
|
@ -32,3 +32,19 @@ export function listPlatformCategory(params) {
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getMerchantList(params) {
|
||||||
|
return request({
|
||||||
|
url: '/merchant-api/merchant/list',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updatePassword(data) {
|
||||||
|
return request({
|
||||||
|
url: '/merchant-api/auth/update_password',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -136,13 +136,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="form.operationType === 'update'">
|
<template v-if="form.operationType === 'update'">
|
||||||
<el-form-item label="选择商户账号" prop="accountId">
|
<el-form-item label="选择商户账号" prop="merchantId">
|
||||||
<el-select v-model="form.accountId" placeholder="请选择要更新的商户账号" @change="handleAccountChange" style="width: 100%">
|
<el-select v-model="form.merchantId" placeholder="请选择要更新的商户账号" @change="handleAccountChange" style="width: 100%">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in merchantAccountList"
|
v-for="item in merchantAccountList"
|
||||||
:key="item.accountId"
|
:key="item.merchantId"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.accountId"
|
:value="item.merchantId"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -194,9 +194,8 @@
|
||||||
import {
|
import {
|
||||||
getAvailablePermissions,
|
getAvailablePermissions,
|
||||||
checkUsername,
|
checkUsername,
|
||||||
resetPassword
|
|
||||||
} from '@/api/modules/subaccount' // Assuming some APIs can be reused
|
} from '@/api/modules/subaccount' // Assuming some APIs can be reused
|
||||||
import { inviteJoin, setMerchantPermissions, shopBaseConfig, listPlatformCategory } from '@/api/modules/merchant' // New merchant API
|
import { inviteJoin, setMerchantPermissions, shopBaseConfig, listPlatformCategory, getMerchantList, updatePassword } from '@/api/modules/merchant' // New merchant API
|
||||||
import { mer_admin } from '@/api/modules/mer_admin'
|
import { mer_admin } from '@/api/modules/mer_admin'
|
||||||
import routerConfig from '@/router/full-routers'
|
import routerConfig from '@/router/full-routers'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
@ -260,7 +259,7 @@ export default {
|
||||||
mobile: '',
|
mobile: '',
|
||||||
password: '',
|
password: '',
|
||||||
permissionCodes: [],
|
permissionCodes: [],
|
||||||
accountId: null,
|
merchantId: null,
|
||||||
enable: true,
|
enable: true,
|
||||||
selectedMarketId: '',
|
selectedMarketId: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -333,7 +332,7 @@ export default {
|
||||||
permissionCodes: [
|
permissionCodes: [
|
||||||
{ required: true, message: "请选择菜单权限", trigger: "change", type: 'array' },
|
{ required: true, message: "请选择菜单权限", trigger: "change", type: 'array' },
|
||||||
],
|
],
|
||||||
accountId: [
|
merchantId: [
|
||||||
{ required: true, message: "请选择要更新的商户账号", trigger: "change" },
|
{ required: true, message: "请选择要更新的商户账号", trigger: "change" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -362,7 +361,7 @@ export default {
|
||||||
this.form.mobile = '';
|
this.form.mobile = '';
|
||||||
this.form.password = '';
|
this.form.password = '';
|
||||||
this.form.permissionCodes = [];
|
this.form.permissionCodes = [];
|
||||||
this.form.accountId = null;
|
this.form.merchantId = null;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.ruleFormRef.clearValidate();
|
this.$refs.ruleFormRef.clearValidate();
|
||||||
|
@ -373,7 +372,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newType === 'update') {
|
if (newType === 'update') {
|
||||||
// this.loadMerchantAccountList(); // To be implemented
|
this.loadMerchantAccountList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -396,7 +395,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openResetPasswordDialog() {
|
openResetPasswordDialog() {
|
||||||
if (!this.form.accountId) {
|
if (!this.form.merchantId) {
|
||||||
this.$message.error('请先选择要更新的商户账号');
|
this.$message.error('请先选择要更新的商户账号');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +406,7 @@ export default {
|
||||||
this.$message.error('请输入新密码');
|
this.$message.error('请输入新密码');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
resetPassword(this.form.accountId, this.newPassword, this.form.selectedMarketId || this.marketId).then(() => {
|
updatePassword({ password: this.newPassword }).then(() => {
|
||||||
this.$message.success('密码重置成功');
|
this.$message.success('密码重置成功');
|
||||||
this.resetPasswordDialogVisible = false;
|
this.resetPasswordDialogVisible = false;
|
||||||
});
|
});
|
||||||
|
@ -445,22 +444,21 @@ export default {
|
||||||
handlePermitsRemove(file, fileList) {
|
handlePermitsRemove(file, fileList) {
|
||||||
this.form.permits = fileList;
|
this.form.permits = fileList;
|
||||||
},
|
},
|
||||||
// To be implemented
|
loadMerchantAccountList() {
|
||||||
// loadMerchantAccountList() {
|
getMerchantList({ marketId: this.form.selectedMarketId || this.marketId }).then(res => {
|
||||||
// getMerchantAccountList().then(res => {
|
this.merchantAccountList = res.data.data || [];
|
||||||
// this.merchantAccountList = res.data.data.data || [];
|
});
|
||||||
// });
|
},
|
||||||
// },
|
handleAccountChange(merchantId) {
|
||||||
handleAccountChange(accountId) {
|
if (!merchantId) return;
|
||||||
if (!accountId) return;
|
const accountDetails = this.merchantAccountList.find(item => item.merchantId === merchantId);
|
||||||
// getMerchantAccountDetail(accountId).then(res => {
|
if (accountDetails) {
|
||||||
// const accountDetails = res.data.data;
|
this.form.permissionCodes = accountDetails.permissionCodes || [];
|
||||||
// this.form.permissionCodes = accountDetails.permissionCodes || [];
|
this.form.enable = accountDetails.enabled;
|
||||||
// this.form.enable = accountDetails.enabled;
|
this.$nextTick(() => {
|
||||||
// this.$nextTick(() => {
|
this.$refs.permissionTree.setCheckedKeys(this.form.permissionCodes);
|
||||||
// this.$refs.permissionTree.setCheckedKeys(this.form.permissionCodes);
|
});
|
||||||
// });
|
}
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
this.$refs.ruleFormRef.validate((valid) => {
|
this.$refs.ruleFormRef.validate((valid) => {
|
||||||
|
@ -503,20 +501,19 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (this.form.operationType === 'update') {
|
} else if (this.form.operationType === 'update') {
|
||||||
if (!this.form.accountId) {
|
if (!this.form.merchantId) {
|
||||||
this.$message.error('请先选择要更新的商户账号');
|
this.$message.error('请先选择要更新的商户账号');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const updateData = {
|
const permissionsData = {
|
||||||
subAccountId: this.form.accountId,
|
merchantAccountId: this.form.merchantId,
|
||||||
permissionCodes: this.form.permissionCodes,
|
permissionCodes: this.form.permissionCodes,
|
||||||
enabled: this.form.enable,
|
|
||||||
marketId
|
marketId
|
||||||
};
|
};
|
||||||
// updateMerchantAccount(updateData).then(() => { // To be implemented
|
setMerchantPermissions(permissionsData).then(() => {
|
||||||
// this.$message.success('商户信息更新成功');
|
this.$message.success('商户信息更新成功');
|
||||||
// this.$refs.ruleFormRef.resetFields();
|
this.$refs.ruleFormRef.resetFields();
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -551,4 +548,4 @@ export default {
|
||||||
width: 178px;
|
width: 178px;
|
||||||
height: 178px;
|
height: 178px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue