From 83078e70c7a22e409658042644aab30858ba3ed0 Mon Sep 17 00:00:00 2001 From: lzhizhao <790086754@qq.com> Date: Thu, 11 Sep 2025 10:36:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E6=88=B7=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/merchant.js | 17 + .../permission/merchant-account/index.vue | 321 +++++++++++++++++- .../permission/sub-operator/index.vue | 44 ++- 3 files changed, 371 insertions(+), 11 deletions(-) create mode 100644 src/api/modules/merchant.js diff --git a/src/api/modules/merchant.js b/src/api/modules/merchant.js new file mode 100644 index 0000000..7a9dd02 --- /dev/null +++ b/src/api/modules/merchant.js @@ -0,0 +1,17 @@ +import request from '@/utils/httpRequest' + +export function inviteJoin(data) { + return request({ + url: '/merchant-api/merchant/invite_join', + method: 'post', + data + }) +} + +export function setMerchantPermissions(data) { + return request({ + url: '/merchant-api/subaccount/set-merchant-permissions', + method: 'post', + data + }) +} diff --git a/src/views/modules/operation-management/permission/merchant-account/index.vue b/src/views/modules/operation-management/permission/merchant-account/index.vue index 194048e..277bd34 100644 --- a/src/views/modules/operation-management/permission/merchant-account/index.vue +++ b/src/views/modules/operation-management/permission/merchant-account/index.vue @@ -1,13 +1,326 @@ +.app-container { + padding: 20px; +} + \ No newline at end of file diff --git a/src/views/modules/operation-management/permission/sub-operator/index.vue b/src/views/modules/operation-management/permission/sub-operator/index.vue index b57967a..e6e3ed4 100644 --- a/src/views/modules/operation-management/permission/sub-operator/index.vue +++ b/src/views/modules/operation-management/permission/sub-operator/index.vue @@ -8,6 +8,17 @@ :rules="rules" style="max-width: 600px" > + + + + + + @@ -100,6 +111,7 @@ import { resetPassword } from '@/api/modules/subaccount' import routerConfig from '@/router/full-routers' +import { mapState } from 'vuex' // Function to filter the full menu tree based on available permissions const filterTreeByPerms = (tree, availablePerms) => { @@ -143,7 +155,7 @@ export default { if (!value) { return callback(new Error('请输入账号')); } - checkUsername(value).then(res => { + checkUsername(value, this.form.selectedMarketId || this.marketId).then(res => { if (res && res.data && res.data.data && res.data.data.available === true) { callback(); } else { @@ -166,7 +178,8 @@ export default { permissionCodes: [], remark: '', accountId: null, - enable: true + enable: true, + selectedMarketId: '' }, subAccountList: [], permissionList: [], @@ -199,6 +212,16 @@ export default { }, }; }, + computed: { + ...mapState("userData", [ + "isMerchant", + "marketList", + "storeList", + "marketId", + "shopId", + "markets" + ]) + }, watch: { 'form.operationType'(newType) { // Manually reset form fields to avoid resetting the operationType @@ -249,7 +272,7 @@ export default { this.$message.error('请输入新密码'); return; } - resetPassword(this.form.accountId, this.newPassword).then(() => { + resetPassword(this.form.accountId, this.newPassword, this.form.selectedMarketId || this.marketId).then(() => { this.$message.success('密码重置成功'); this.resetPasswordDialogVisible = false; }); @@ -259,13 +282,13 @@ export default { this.form.permissionCodes = this.$refs.permissionTree.getCheckedKeys(true); }, loadSubAccountList() { - getSubAccountList().then(res => { + getSubAccountList(this.form.selectedMarketId || this.marketId).then(res => { this.subAccountList = res.data.data.data || []; }); }, handleAccountChange(accountId) { if (!accountId) return; - getSubAccountDetail(accountId).then(res => { + getSubAccountDetail(accountId, this.form.selectedMarketId || this.marketId).then(res => { const accountDetails = res.data.data; this.form.name = accountDetails.name; this.form.mobile = accountDetails.mobile; @@ -280,8 +303,14 @@ export default { save() { this.$refs.ruleFormRef.validate((valid) => { if (valid) { + const marketId = this.form.selectedMarketId || this.marketId; + if (!marketId) { + this.$message.error('请选择市场'); + return; + } + if (this.form.operationType === 'create') { - const createData = { ...this.form }; + const createData = { ...this.form, marketId }; if (createData.accountId === null) { delete createData.accountId; } @@ -300,7 +329,8 @@ export default { mobile: this.form.mobile, permissionCodes: this.form.permissionCodes, remark: this.form.remark, - enabled: this.form.enable + enabled: this.form.enable, + marketId }; updateSubAccount(updateData).then(() => { this.$message.success('更新成功');