From 1be3aac263ffe9ee9e2a95e618ea16daebc5149a Mon Sep 17 00:00:00 2001 From: lzhizhao <790086754@qq.com> Date: Wed, 29 Oct 2025 16:38:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8F=9C=E5=B8=82=E5=9C=BA=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=91=8A=E4=BD=8D=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/config/index.js | 2 +- src/api/modules/mer_admin.js | 153 +- src/components/form/InputMap/index.vue | 613 ++--- src/router/index.js | 297 ++- src/views/modules/market/stall/index.vue | 1987 ++++++++++++++++- .../operation-management/commodity/index.vue | 6 +- .../permission/sub-operator/index.vue | 317 +-- 7 files changed, 2768 insertions(+), 607 deletions(-) diff --git a/public/config/index.js b/public/config/index.js index 415da64..6476044 100644 --- a/public/config/index.js +++ b/public/config/index.js @@ -12,7 +12,7 @@ (function () { window.SITE_CONFIG = {}; // api接口请求地址 - window.SITE_CONFIG["baseUrl"] = "https://admin-test.damajishi.cn/"; + window.SITE_CONFIG["baseUrl"] = "http://60.204.138.3:8899"; // 在线api接口请求地址 // window.SITE_CONFIG['baseUrl'] = 'http://119.29.103.250:8082/red-memory'; // 在线api接口请求地址 diff --git a/src/api/modules/mer_admin.js b/src/api/modules/mer_admin.js index 6fdfbce..996da60 100644 --- a/src/api/modules/mer_admin.js +++ b/src/api/modules/mer_admin.js @@ -78,10 +78,10 @@ export const mer_admin = { //商品详情 productDetail: data => { return $http.request({ - method: 'get', - url: '/merchant-api/product/detail', + method: "get", + url: "/merchant-api/product/detail", params: data - }) + }); }, //商户商品分类 getProductCategory: data => { @@ -411,5 +411,152 @@ export const mer_admin = { url: `/merchant-api/backend/order/v2/overview`, params: data }); + }, + + // ==================== 摊位管理相关接口 ==================== + + /** + * 经营者模式-摊位概览 + * @param {object} data 查询参数 + * @returns {Promise} + */ + overviewShop: data => { + return $http.request({ + method: "get", + url: `/merchant-api/manager/shop/overview`, + params: data + }); + }, + + /** + * 绑定收益人 + * @param {object} data 绑定参数 + * @param {number} data.marketId 市场ID + * @param {number} data.beneficiaryOperationType 操作类型(1:市场经营者,2:创建新收益人,3:绑定已有供应商账号) + * @param {string} data.beneficiaryName 收益人姓名 + * @param {string} data.beneficiaryMobile 收益人账号 + * @param {string} data.password 登录密码 + * @param {string} data.remark 备注 + * @param {number} data.shopId 店铺ID + * @returns {Promise} + */ + bindShopBeneficiary: data => { + return $http.post(`/merchant-api/shop/bind/beneficiary`, data); + }, + + /** + * 新增经营者店铺 + * @param {object} data 店铺参数 + * @returns {Promise} + */ + addShop: data => { + return $http.post(`/merchant-api/shop/add`, data); + }, + + /** + * 经营者模式-摊位列表 + * @param {object} data 查询参数 + * @param {number} data.pageNumber 页码 + * @param {number} data.pageSize 每页数量 + * @param {number} data.marketId 市场ID + * @param {string} data.shopName 摊位名称 + * @param {number} data.status 业务状态(-1:未配置 0:休息 1:营业) + * @returns {Promise} + */ + pageShop: data => { + return $http.request({ + method: "get", + url: `/merchant-api/manager/shop/page`, + params: data + }); + }, + + /** + * 邀请摊主入驻 + * @param {object} data 邀请参数 + * @param {number} data.marketId 市场ID + * @param {number} data.beneficiaryOperationType 操作类型(1:市场经营者,2:创建新收益人,3:绑定已有供应商账号) + * @param {string} data.beneficiaryName 收益人姓名 + * @param {string} data.beneficiaryMobile 收益人账号 + * @param {string} data.password 登录密码 + * @returns {Promise} + */ + inviteJoin: data => { + return $http.post(`/merchant-api/manager/shop/invite_join`, data); + }, + + /** + * 删除摊位 + * @param {object} query 删除参数 + * @param {number} query.shopId 摊位ID + * @returns {Promise} + */ + deleteShop: query => { + return $http.delete(`/merchant-api/manager/shop/delete`, { params: query }); + }, + + /** + * 更新摊位状态 + * @param {object} data 更新参数 + * @param {number} data.shopId 摊位ID + * @param {number} data.status 状态 + * @returns {Promise} + */ + updateShopStatus: data => { + return $http.put(`/merchant-api/manager/shop/status`, data); + }, + + /** + * 更新摊位信息 + * @param {object} data 更新参数 + * @param {number} data.shopId 摊位ID + * @returns {Promise} + */ + updateShop: data => { + return $http.put(`/merchant-api/manager/shop/update`, data); + }, + + /** + * 获取摊位详情(经营者模式) + * @param {object} query 查询参数 + * @param {number} query.shopId 摊位ID + * @returns {Promise} + */ + getShopDetail: query => { + return $http.request({ + method: "get", + url: `/merchant-api/manager/shop/detail`, + params: query + }); + }, + + /** + * 获取摊位基础配置(摊主模式) + * @param {object} query 查询参数 + * @param {string} query.shopId 摊位ID + * @returns {Promise} + */ + getShopBaseConfig: query => { + return $http.request({ + method: "get", + url: `/merchant-api/shop/base_config`, + params: query + }); + }, + + /** + * 更新摊位基础配置(摊主模式) + * @param {object} query 查询参数 + * @param {string} query.shopId 摊位ID + * @param {object} data 更新数据 + * @returns {Promise} + */ + updateShopBaseConfig: (query, data) => { + return $http.request({ + method: "put", + url: `/merchant-api/shop/base_config`, + params: query, + data: data + }); } }; diff --git a/src/components/form/InputMap/index.vue b/src/components/form/InputMap/index.vue index 6a545bf..0ecf77e 100644 --- a/src/components/form/InputMap/index.vue +++ b/src/components/form/InputMap/index.vue @@ -1,322 +1,335 @@ + diff --git a/src/views/modules/operation-management/commodity/index.vue b/src/views/modules/operation-management/commodity/index.vue index c5e03f9..8383b07 100644 --- a/src/views/modules/operation-management/commodity/index.vue +++ b/src/views/modules/operation-management/commodity/index.vue @@ -9,7 +9,7 @@ - + @@ -74,7 +74,7 @@
添加商品 - 批量删除 + 批量删除
\ 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 8b690a7..a7e9a46 100644 --- a/src/views/modules/operation-management/permission/sub-operator/index.vue +++ b/src/views/modules/operation-management/permission/sub-operator/index.vue @@ -8,10 +8,18 @@ :rules="rules" style="max-width: 600px" > - - + + - + @@ -31,13 +43,22 @@ - + @@ -61,7 +88,11 @@ - + @@ -89,7 +120,11 @@ > - + @@ -116,55 +151,64 @@ import { mapState } from 'vuex' // Function to filter the full menu tree based on available permissions const filterTreeByPerms = (tree, availablePerms) => { if (!Array.isArray(tree)) { - return []; // Return empty array if tree is not an array + return [] // Return empty array if tree is not an array } return tree.reduce((acc, node) => { // Recursively filter children - const children = node.list && node.list.length > 0 - ? filterTreeByPerms(node.list, availablePerms) - : []; + const children = + node.list && node.list.length > 0 + ? filterTreeByPerms(node.list, availablePerms) + : [] // A node is kept if its permission is in the available list, // or if it has children that are kept. if (availablePerms.includes(node.perms) || children.length > 0) { acc.push({ ...node, - list: children, // Use the filtered list of children - }); + list: children // Use the filtered list of children + }) } - return acc; - }, []); -}; + return acc + }, []) +} // Function to map the filtered tree to the format required by el-tree -const mapTreeForElTree = (tree) => { - return tree.map((item) => ({ +const mapTreeForElTree = tree => { + return tree.map(item => ({ id: item.perms, // Use perms as the id label: item.name, - children: item.list && item.list.length > 0 ? mapTreeForElTree(item.list) : [], - })); -}; + children: + item.list && item.list.length > 0 ? mapTreeForElTree(item.list) : [] + })) +} export default { name: 'SubOperator', data() { const validateUsername = (rule, value, callback) => { if (this.form.operationType !== 'create') { - return callback(); + return callback() } if (!value) { - return callback(new Error('请输入账号')); + return callback(new Error('请输入账号')) } - checkUsername(value, this.form.selectedMarketId || this.marketId).then(res => { - if (res && res.data && res.data.data && res.data.data.available === true) { - callback(); - } else { - callback(new Error('账号已被占用')); - } - }).catch(() => { - callback(new Error('账号校验失败')); - }); - }; + checkUsername(value, this.form.selectedMarketId || this.marketId) + .then(res => { + if ( + res && + res.data && + res.data.data && + res.data.data.available === true + ) { + callback() + } else { + callback(new Error('账号已被占用')) + } + }) + .catch(() => { + callback(new Error('账号校验失败')) + }) + } return { resetPasswordDialogVisible: false, @@ -189,121 +233,132 @@ export default { }, rules: { operationType: [ - { required: true, message: "请选择操作类型", trigger: "change" }, + { required: true, message: '请选择操作类型', trigger: 'change' } ], username: [ - { required: true, validator: validateUsername, trigger: "blur" }, - ], - password: [ - { required: true, message: "请输入密码", trigger: "blur" }, - ], - name: [ - { required: true, message: "请输入姓名", trigger: "blur" }, - ], - mobile: [ - { required: true, message: "请输入手机号", trigger: "blur" }, + { required: true, validator: validateUsername, trigger: 'blur' } ], + password: [{ required: true, message: '请输入密码', trigger: 'blur' }], + name: [{ required: true, message: '请输入姓名', trigger: 'blur' }], + mobile: [{ required: true, message: '请输入手机号', trigger: 'blur' }], permissionCodes: [ - { required: true, message: "请选择菜单权限", trigger: "change", type: 'array' }, + { + required: true, + message: '请选择菜单权限', + trigger: 'change', + type: 'array' + } ], accountId: [ - { required: true, message: "请选择要更新的账号", trigger: "change" }, - ], - }, - }; + { required: true, message: '请选择要更新的账号', trigger: 'change' } + ] + } + } }, computed: { - ...mapState("userData", [ - "isMerchant", - "marketList", - "storeList", - "marketId", - "shopId", - "markets" + ...mapState('userData', [ + 'isMerchant', + 'marketList', + 'storeList', + 'marketId', + 'shopId' ]) }, watch: { 'form.operationType'(newType) { // Manually reset form fields to avoid resetting the operationType - this.form.username = ''; - this.form.password = ''; - this.form.name = ''; - this.form.mobile = ''; - this.form.permissionCodes = []; - this.form.remark = ''; - this.form.accountId = null; + this.form.username = '' + this.form.password = '' + this.form.name = '' + this.form.mobile = '' + this.form.permissionCodes = [] + this.form.remark = '' + this.form.accountId = null // Clear validation messages after the DOM has updated this.$nextTick(() => { - this.$refs.ruleFormRef.clearValidate(); - }); + this.$refs.ruleFormRef.clearValidate() + }) // Reset the tree's visual state if (this.$refs.permissionTree) { - this.$refs.permissionTree.setCheckedKeys([]); + this.$refs.permissionTree.setCheckedKeys([]) } if (newType === 'update') { - this.loadSubAccountList(); + this.loadSubAccountList() } } }, created() { - this.getPermissions(); + this.getPermissions() }, methods: { getPermissions() { - getAvailablePermissions().then((res) => { - const availablePerms = (res && res.data && Array.isArray(res.data.data)) ? res.data.data : []; - const menuList = (routerConfig && Array.isArray(routerConfig.menuList)) ? routerConfig.menuList : []; - const filteredTree = filterTreeByPerms(menuList, availablePerms); - this.permissionList = mapTreeForElTree(filteredTree); - }); + getAvailablePermissions().then(res => { + const availablePerms = + res && res.data && Array.isArray(res.data.data) ? res.data.data : [] + const menuList = + routerConfig && Array.isArray(routerConfig.menuList) + ? routerConfig.menuList + : [] + const filteredTree = filterTreeByPerms(menuList, availablePerms) + this.permissionList = mapTreeForElTree(filteredTree) + }) }, openResetPasswordDialog() { if (!this.form.accountId) { - this.$message.error('请先选择要更新的账号'); - return; + this.$message.error('请先选择要更新的账号') + return } - this.resetPasswordDialogVisible = true; + this.resetPasswordDialogVisible = true }, handleResetPassword() { if (!this.newPassword) { - this.$message.error('请输入新密码'); - return; + this.$message.error('请输入新密码') + return } - resetPassword(this.form.accountId, this.newPassword, this.form.selectedMarketId || this.marketId).then(() => { - this.$message.success('密码重置成功'); - this.resetPasswordDialogVisible = false; - }); + resetPassword( + this.form.accountId, + this.newPassword, + this.form.selectedMarketId || this.marketId + ).then(() => { + this.$message.success('密码重置成功') + this.resetPasswordDialogVisible = false + }) }, handleTreeCheck() { // getCheckedKeys(true) will return an array of keys of the currently checked leaf nodes. - this.form.permissionCodes = this.$refs.permissionTree.getCheckedKeys(true); + this.form.permissionCodes = this.$refs.permissionTree.getCheckedKeys(true) }, loadSubAccountList() { - getSubAccountList(this.form.selectedMarketId || this.marketId).then(res => { - this.subAccountList = res.data.data.data || []; - }); + getSubAccountList(this.form.selectedMarketId || this.marketId).then( + res => { + this.subAccountList = res.data.data.data || [] + } + ) }, handleAccountChange(accountId) { - if (!accountId) return; - getSubAccountDetail(accountId, this.form.selectedMarketId || this.marketId).then(res => { - const accountDetails = res.data.data; - this.form.name = accountDetails.name; - this.form.mobile = accountDetails.mobile; - this.form.remark = accountDetails.remark; - this.form.permissionCodes = accountDetails.permissionCodes || []; - this.form.enable = accountDetails.enabled; + if (!accountId) return + getSubAccountDetail( + accountId, + this.form.selectedMarketId || this.marketId + ).then(res => { + const accountDetails = res.data.data + this.form.name = accountDetails.name + this.form.mobile = accountDetails.mobile + this.form.remark = accountDetails.remark + this.form.permissionCodes = accountDetails.permissionCodes || [] + this.form.enable = accountDetails.enabled this.$nextTick(() => { - this.$refs.permissionTree.setCheckedKeys(this.form.permissionCodes); - }); - }); + this.$refs.permissionTree.setCheckedKeys(this.form.permissionCodes) + }) + }) }, save() { - this.$refs.ruleFormRef.validate((valid) => { + this.$refs.ruleFormRef.validate(valid => { if (valid) { - const marketId = this.form.selectedMarketId || this.marketId; + const marketId = this.form.selectedMarketId || this.marketId // if (!marketId) { // this.$message.error('请选择市场'); // return; @@ -311,32 +366,32 @@ export default { console.log(this.form.operationType) if (this.form.operationType === 'create') { - const createData = { ...this.form, marketId: marketId }; + const createData = { ...this.form, marketId: marketId } if (createData.accountId === null) { - delete createData.accountId; + delete createData.accountId } createSubAccount(createData).then(() => { - this.$message.success('创建成功'); + this.$message.success('创建成功') // 保留操作类型,只重置其他字段 - const operationType = this.form.operationType; - this.form.username = ''; - this.form.password = ''; - this.form.name = ''; - this.form.mobile = ''; - this.form.remark = ''; - this.form.permissionCodes = []; - this.form.accountId = null; - this.form.enable = true; - this.form.operationType = operationType; // 保留操作类型 + const operationType = this.form.operationType + this.form.username = '' + this.form.password = '' + this.form.name = '' + this.form.mobile = '' + this.form.remark = '' + this.form.permissionCodes = [] + this.form.accountId = null + this.form.enable = true + this.form.operationType = operationType // 保留操作类型 // 重置权限树的勾选状态 if (this.$refs.permissionTree) { - this.$refs.permissionTree.setCheckedKeys([]); + this.$refs.permissionTree.setCheckedKeys([]) } - }); + }) } else if (this.form.operationType === 'update') { if (!this.form.accountId) { - this.$message.error('请先选择要更新的账号'); - return; + this.$message.error('请先选择要更新的账号') + return } const updateData = { subAccountId: this.form.accountId, @@ -346,25 +401,25 @@ export default { remark: this.form.remark, enabled: this.form.enable, marketId - }; + } updateSubAccount(updateData).then(() => { - this.$message.success('更新成功'); + this.$message.success('更新成功') // 只重置部分字段,保留accountId和operationType - this.form.name = ''; - this.form.mobile = ''; - this.form.remark = ''; - this.form.permissionCodes = []; - this.form.enable = true; + this.form.name = '' + this.form.mobile = '' + this.form.remark = '' + this.form.permissionCodes = [] + this.form.enable = true // 重置权限树的勾选状态 if (this.$refs.permissionTree) { - this.$refs.permissionTree.setCheckedKeys([]); + this.$refs.permissionTree.setCheckedKeys([]) } - }); + }) } } - }); + }) } - }, + } }