修复商户账号添加功能
This commit is contained in:
+2
-2
@@ -2,10 +2,10 @@ VITE_APP_NAME=后台管理系统
|
|||||||
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
||||||
VITE_SERVER_URL=https://server.gxwebsoft.com/api
|
VITE_SERVER_URL=https://server.gxwebsoft.com/api
|
||||||
VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
|
VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
|
||||||
VITE_API_URL=https://modules.gxwebsoft.com/api
|
#VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||||
|
|
||||||
|
|
||||||
#VITE_SERVER_URL=http://127.0.0.1:30000/api
|
#VITE_SERVER_URL=http://127.0.0.1:30000/api
|
||||||
#VITE_API_URL=http://127.0.0.1:9001/api
|
VITE_API_URL=http://127.0.0.1:9002/api
|
||||||
#VITE_THINK_URL=http://127.0.0.1:9099/api
|
#VITE_THINK_URL=http://127.0.0.1:9099/api
|
||||||
#/booking/bookingItem
|
#/booking/bookingItem
|
||||||
|
|||||||
@@ -27,13 +27,16 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'image'">
|
<template v-if="column.key === 'merchantName'">
|
||||||
<a-image
|
<a-space>
|
||||||
v-if="record.image"
|
<a-avatar
|
||||||
:src="record.image"
|
v-if="record.image"
|
||||||
:preview="false"
|
:src="record.image"
|
||||||
:width="45"
|
:preview="false"
|
||||||
/>
|
:width="45"
|
||||||
|
/>
|
||||||
|
{{ record.merchantName }}
|
||||||
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'shopType'">
|
<template v-if="column.key === 'shopType'">
|
||||||
<a-tag v-if="record.shopType === 10">企业</a-tag>
|
<a-tag v-if="record.shopType === 10">企业</a-tag>
|
||||||
@@ -86,12 +89,6 @@
|
|||||||
|
|
||||||
// 表格配置
|
// 表格配置
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
|
||||||
title: 'LOGO',
|
|
||||||
dataIndex: 'image',
|
|
||||||
key: 'image',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '商户名称',
|
title: '商户名称',
|
||||||
dataIndex: 'merchantName'
|
dataIndex: 'merchantName'
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
SearchOutlined
|
SearchOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { copyText, openNew, openUrl } from '@/utils/common';
|
import { copyText, getMerchantId, openNew, openUrl } from "@/utils/common";
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import HeaderNotice from './header-notice.vue';
|
import HeaderNotice from './header-notice.vue';
|
||||||
import PasswordModal from './password-modal.vue';
|
import PasswordModal from './password-modal.vue';
|
||||||
@@ -331,8 +331,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新商户ID和名称
|
// 更新商户ID和名称
|
||||||
if (hasRole('merchant') && loginUser.value.merchantId == null) {
|
if (!getMerchantId() && loginUser.value.merchantId == null) {
|
||||||
listMerchant({ phone: loginUser.value.phone }).then((res) => {
|
listMerchantAccount({ phone: loginUser.value.phone }).then((res) => {
|
||||||
|
console.log(res);
|
||||||
if (res.length > 0) {
|
if (res.length > 0) {
|
||||||
const item = res[0];
|
const item = res[0];
|
||||||
authUser({
|
authUser({
|
||||||
@@ -342,7 +343,6 @@
|
|||||||
});
|
});
|
||||||
localStorage.setItem('MerchantId', `${item.merchantId}`);
|
localStorage.setItem('MerchantId', `${item.merchantId}`);
|
||||||
localStorage.setItem('MerchantName', `${item.merchantName}`);
|
localStorage.setItem('MerchantName', `${item.merchantName}`);
|
||||||
localStorage.setItem('MerchantLogo', `${item.image}`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<a-form-item label="商户图标" name="image">
|
<a-form-item label="店铺图标" name="image">
|
||||||
<SelectFile
|
<SelectFile
|
||||||
:placeholder="`请选择图片`"
|
:placeholder="`请选择图片`"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
|
|||||||
@@ -7,24 +7,24 @@
|
|||||||
</template>
|
</template>
|
||||||
<span>添加</span>
|
<span>添加</span>
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/index`)">
|
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/shop/index`)">-->
|
||||||
<span>店铺管理</span>
|
<!-- <span>店铺管理</span>-->
|
||||||
</a-button>
|
<!-- </a-button>-->
|
||||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/index`)">
|
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/shop/index`)">-->
|
||||||
<span>门店职员</span>
|
<!-- <span>门店职员</span>-->
|
||||||
</a-button>
|
<!-- </a-button>-->
|
||||||
<a-button class="ele-btn-icon" @click="openUrl(`/goods/category/:id`)">
|
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/goods/category/:id`)">-->
|
||||||
<span>商品分类</span>
|
<!-- <span>商品分类</span>-->
|
||||||
</a-button>
|
<!-- </a-button>-->
|
||||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/apply`)">
|
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/shop/apply`)">-->
|
||||||
<span>入驻申请</span>
|
<!-- <span>入驻申请</span>-->
|
||||||
</a-button>
|
<!-- </a-button>-->
|
||||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/desk`)">
|
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/shop/desk`)">-->
|
||||||
<span>桌号管理</span>
|
<!-- <span>桌号管理</span>-->
|
||||||
</a-button>
|
<!-- </a-button>-->
|
||||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/type`)">
|
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/shop/type`)">-->
|
||||||
<span>店铺类型</span>
|
<!-- <span>店铺类型</span>-->
|
||||||
</a-button>
|
<!-- </a-button>-->
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@
|
|||||||
import { openUrl } from '@/utils/common';
|
import { openUrl } from '@/utils/common';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import { getMerchant } from '@/api/shop/merchant';
|
import { getMerchant } from '@/api/shop/merchant';
|
||||||
import merchant from "@/views/shop/merchant/index.vue";
|
import merchant from '@/views/shop/merchant/index.vue';
|
||||||
import { getMerchantId } from "@/utils/merchant";
|
import { getMerchantId } from '@/utils/merchant';
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
|
|||||||
@@ -127,13 +127,13 @@
|
|||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '商户姓名',
|
title: '姓名',
|
||||||
dataIndex: 'realName',
|
dataIndex: 'realName',
|
||||||
key: 'realName',
|
key: 'realName',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '商户手机号',
|
title: '登录账号',
|
||||||
dataIndex: 'phone',
|
dataIndex: 'phone',
|
||||||
key: 'phone',
|
key: 'phone',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
:width="600"
|
:width="600"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:title="isUpdate ? '编辑商户职员' : '添加商户职员'"
|
:title="isUpdate ? '编辑账号' : '添加账号'"
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
@update:visible="updateVisible"
|
@update:visible="updateVisible"
|
||||||
@ok="save"
|
@ok="save"
|
||||||
@@ -18,30 +18,34 @@
|
|||||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<a-form-item label="职员名称" name="realName">
|
<a-form-item label="选择商户" name="merchantId">
|
||||||
|
<SelectMerchant
|
||||||
|
:placeholder="`选择商户`"
|
||||||
|
v-model:value="form.merchantName"
|
||||||
|
@done="chooseMerchantId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="选择用户" name="userId">
|
||||||
|
<SelectUser
|
||||||
|
:placeholder="`选择用户`"
|
||||||
|
v-model:value="form.phone"
|
||||||
|
@done="chooseUserId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="选择角色" name="roleId">
|
||||||
|
<SelectRole
|
||||||
|
:placeholder="`选择角色`"
|
||||||
|
v-model:value="form.roleName"
|
||||||
|
@done="chooseRoleId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="真实名称" name="realName">
|
||||||
<a-input
|
<a-input
|
||||||
allow-clear
|
allow-clear
|
||||||
placeholder="请输入真实姓名"
|
placeholder="请输入真实姓名"
|
||||||
v-model:value="form.realName"
|
v-model:value="form.realName"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="登录账号" name="phone">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入手机号码"
|
|
||||||
:maxlength="11"
|
|
||||||
:disabled="isUpdate && form.phone"
|
|
||||||
v-model:value="form.phone"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="密码" name="password" v-if="!isUpdate">
|
|
||||||
<a-input-password
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入登录密码"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
v-model:value="form.password"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="备注" name="comments">
|
<a-form-item label="备注" name="comments">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
:rows="4"
|
:rows="4"
|
||||||
@@ -74,6 +78,9 @@
|
|||||||
getRoleIdByMerchant,
|
getRoleIdByMerchant,
|
||||||
getRoleNameByMerchant
|
getRoleNameByMerchant
|
||||||
} from '@/utils/merchant';
|
} from '@/utils/merchant';
|
||||||
|
import { User } from '@/api/system/user/model';
|
||||||
|
import { Role } from '@/api/system/role/model';
|
||||||
|
import { Merchant } from '@/api/shop/merchant/model';
|
||||||
|
|
||||||
// 是否是修改
|
// 是否是修改
|
||||||
const isUpdate = ref(false);
|
const isUpdate = ref(false);
|
||||||
@@ -191,6 +198,22 @@
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const chooseUserId = (user: User) => {
|
||||||
|
form.userId = user.userId;
|
||||||
|
form.realName = user.realName;
|
||||||
|
form.phone = user.phone;
|
||||||
|
};
|
||||||
|
|
||||||
|
const chooseMerchantId = (data: Merchant) => {
|
||||||
|
form.merchantId = data.merchantId;
|
||||||
|
form.merchantName = data.merchantName;
|
||||||
|
};
|
||||||
|
|
||||||
|
const chooseRoleId = (data: Role) => {
|
||||||
|
form.roleId = data.roleId;
|
||||||
|
form.roleName = data.roleName;
|
||||||
|
};
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
/* 保存编辑 */
|
/* 保存编辑 */
|
||||||
@@ -203,12 +226,12 @@
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const formData = {
|
const formData = {
|
||||||
...form,
|
...form
|
||||||
merchantId: getMerchantId(),
|
// merchantId: getMerchantId(),
|
||||||
merchantName: getMerchantName(),
|
// merchantName: getMerchantName(),
|
||||||
merchantAvatar: getMerchantAvatar(),
|
// merchantAvatar: getMerchantAvatar(),
|
||||||
roleId: getRoleIdByMerchant(),
|
// roleId: getRoleIdByMerchant(),
|
||||||
roleName: getRoleNameByMerchant()
|
// roleName: getRoleNameByMerchant()
|
||||||
};
|
};
|
||||||
const saveOrUpdate = isUpdate.value
|
const saveOrUpdate = isUpdate.value
|
||||||
? updateMerchantAccount
|
? updateMerchantAccount
|
||||||
|
|||||||
@@ -30,10 +30,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-popconfirm
|
<a-popconfirm title="确定要移除吗?" @confirm="remove(record)">
|
||||||
title="确定要移除该门店用户吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">移除</a>
|
<a class="ele-text-danger">移除</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</a-space>
|
</a-space>
|
||||||
@@ -122,7 +119,7 @@
|
|||||||
width: 90
|
width: 90
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '门店名称',
|
title: '店铺名称',
|
||||||
dataIndex: 'merchantName',
|
dataIndex: 'merchantName',
|
||||||
key: 'merchantName',
|
key: 'merchantName',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
|
|||||||
Reference in New Issue
Block a user