From 625568eb414b33face0dd47e6d1fd0d883d63bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Mon, 23 Sep 2024 01:08:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=9B=BE=E5=BD=A2?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E5=A4=A7=E5=86=99=E4=B8=8D=E8=AF=86?= =?UTF-8?q?=E5=88=AB=20=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=8C=89=E5=95=86?= =?UTF-8?q?=E6=88=B7ID=E6=9F=A5=E8=AF=A2=E8=AE=A2=E5=8D=95=E3=80=81?= =?UTF-8?q?=E5=95=86=E5=93=81=E3=80=81=E5=88=86=E7=B1=BB=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- src/api/shop/merchant/model/index.ts | 1 + src/api/shop/order/model/index.ts | 6 + src/api/user/index.ts | 6 +- src/api/user/model/index.ts | 4 + src/layout/components/header-tools.vue | 50 +- src/layout/index.vue | 10 +- src/utils/merchant.ts | 16 + src/views/passport/login/index.vue | 7 +- src/views/shop/goods/components/search.vue | 9 +- src/views/shop/goods/index.vue | 13 +- .../shop/goodsCategory/components/search.vue | 25 +- src/views/shop/goodsCategory/index.vue | 5 +- src/views/shop/merchant/index.vue | 3 +- .../merchant/user/components/org-select.vue | 39 ++ .../merchant/user/components/role-select.vue | 71 +++ .../shop/merchant/user/components/search.vue | 42 ++ .../merchant/user/components/sex-select.vue | 45 ++ .../merchant/user/components/user-edit.vue | 361 +++++++++++ .../merchant/user/components/user-import.vue | 88 +++ .../merchant/user/components/user-info.vue | 143 +++++ .../merchant/user/components/user-search.vue | 111 ++++ .../merchant/user/components/userEdit.vue | 274 +++++++++ .../shop/merchant/user/details/index.vue | 130 ++++ src/views/shop/merchant/user/index.vue | 562 ++++++++++++++++++ .../components/merchantAccountEdit.vue | 93 ++- src/views/shop/merchantAccount/index.vue | 9 +- src/views/shop/merchantApply/index.vue | 17 +- src/views/shop/order/components/search.vue | 13 +- src/views/shop/order/index.vue | 30 +- 30 files changed, 2069 insertions(+), 118 deletions(-) create mode 100644 src/views/shop/merchant/user/components/org-select.vue create mode 100644 src/views/shop/merchant/user/components/role-select.vue create mode 100644 src/views/shop/merchant/user/components/search.vue create mode 100644 src/views/shop/merchant/user/components/sex-select.vue create mode 100644 src/views/shop/merchant/user/components/user-edit.vue create mode 100644 src/views/shop/merchant/user/components/user-import.vue create mode 100644 src/views/shop/merchant/user/components/user-info.vue create mode 100644 src/views/shop/merchant/user/components/user-search.vue create mode 100644 src/views/shop/merchant/user/components/userEdit.vue create mode 100644 src/views/shop/merchant/user/details/index.vue create mode 100644 src/views/shop/merchant/user/index.vue diff --git a/.env.development b/.env.development index 013ec41..aa39b41 100644 --- a/.env.development +++ b/.env.development @@ -1,11 +1,11 @@ VITE_APP_NAME=后台管理系统 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_API_URL=https://modules.gxwebsoft.com/api -VITE_SERVER_URL=http://127.0.0.1:9090/api +#VITE_SERVER_URL=http://127.0.0.1:9090/api VITE_API_URL=http://127.0.0.1:9001/api #VITE_THINK_URL=http://127.0.0.1:9099/api #/booking/bookingItem diff --git a/src/api/shop/merchant/model/index.ts b/src/api/shop/merchant/model/index.ts index cc41b7d..cbc282b 100644 --- a/src/api/shop/merchant/model/index.ts +++ b/src/api/shop/merchant/model/index.ts @@ -78,6 +78,7 @@ export interface Merchant { export interface MerchantParam extends PageParam { merchantId?: number; merchantIds?: string; + phone?: string; merchantCodes?: string; keywords?: string; } diff --git a/src/api/shop/order/model/index.ts b/src/api/shop/order/model/index.ts index e421c71..49f82f6 100644 --- a/src/api/shop/order/model/index.ts +++ b/src/api/shop/order/model/index.ts @@ -115,5 +115,11 @@ export interface Order { */ export interface OrderParam extends PageParam { orderId?: number; + type?: number; + payStatus?: string; + week?: number; + payType?: string; + isInvoice?: string; + orderStatus?: string; keywords?: string; } diff --git a/src/api/user/index.ts b/src/api/user/index.ts index df7b5db..7f5b610 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -1,12 +1,16 @@ import request from '@/utils/request'; import type { ApiResult } from '@/api'; import type { User } from './model'; +import { SERVER_API_URL } from '@/config/setting'; /** * 修改当前登录用户信息 */ export async function authUser(data: User) { - const res = await request.put>('/auth/user', data); + const res = await request.put>( + SERVER_API_URL + '/auth/user', + data + ); if (res.data.code === 0) { return res.data.message; } diff --git a/src/api/user/model/index.ts b/src/api/user/model/index.ts index b46b136..f73f212 100644 --- a/src/api/user/model/index.ts +++ b/src/api/user/model/index.ts @@ -34,6 +34,10 @@ export interface User { sexName?: string; // 机构名称 organizationName?: string; + // 商户ID + merchantId?: number; + // 商户名称 + merchantName?: string; // 创建时间 createTime?: string; } diff --git a/src/layout/components/header-tools.vue b/src/layout/components/header-tools.vue index 612efc8..2c8b4b5 100644 --- a/src/layout/components/header-tools.vue +++ b/src/layout/components/header-tools.vue @@ -117,11 +117,11 @@ - - - - - + +
+
偏好设置
+
+
@@ -180,6 +180,11 @@ import { Merchant } from '@/api/shop/merchant/model'; import { listMerchant } from '@/api/shop/merchant'; import MerchantSelect from './merchant-select.vue'; + import { hasRole } from '@/utils/permission'; + import { message } from 'ant-design-vue'; + import { updateUser } from '@/api/system/user'; + import { authUser } from '@/api/user'; + import { listRoles } from '@/api/system/role'; // 是否开启响应式布局 const themeStore = useThemeStore(); @@ -219,7 +224,7 @@ if (key === 'password') { passwordVisible.value = true; } else if (key === 'profile') { - push('/user-center'); + push('/user/profile'); } else if (key === 'accessKey') { push('/system/access-key'); } else if (key === 'taskAdd') { @@ -299,6 +304,39 @@ } }); } + // 更新商户ID和名称 + if (hasRole('merchent') && loginUser.value.merchantId == null) { + listMerchant({ phone: loginUser.value.phone }).then((res) => { + if (res.length > 0) { + const item = res[0]; + authUser({ + userId: loginUser.value.userId, + merchantName: item.merchantName, + merchantId: item.merchantId + }); + } + }); + } + // 写入缓存 + if (loginUser.value.merchantId) { + localStorage.setItem('MerchantId', `${loginUser.value.merchantId}`); + localStorage.setItem('MerchantName', `${loginUser.value.merchantName}`); + merchants.value.push({ + label: loginUser.value.merchantName, + value: loginUser.value.merchantId + }); + } + // 查询商户角色的roleId + if (!localStorage.getItem('RoleIdByMerchant')) { + listRoles({ roleCode: 'merchent' }).then((res) => { + if (res.length > 0) { + const item = res[0]; + localStorage.setItem('RoleIdByMerchant', `${item.roleId}`); + localStorage.setItem('RoleNameByMerchant', `${item.roleName}`); + } + }); + } + merchantName.value = getMerchantName(); if (loginUser.value.merchants) { listMerchant({ merchantIds: loginUser.value.merchants }).then((res) => { diff --git a/src/layout/index.vue b/src/layout/index.vue index ba61ce8..009df17 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -55,7 +55,6 @@ :preview="false" :size="28" :src="logoPath" - @click.stop="push(`/system/profile`)" alt="logo" />
@@ -86,7 +85,7 @@ diff --git a/src/views/shop/merchant/user/components/role-select.vue b/src/views/shop/merchant/user/components/role-select.vue new file mode 100644 index 0000000..04534b9 --- /dev/null +++ b/src/views/shop/merchant/user/components/role-select.vue @@ -0,0 +1,71 @@ + + + + diff --git a/src/views/shop/merchant/user/components/search.vue b/src/views/shop/merchant/user/components/search.vue new file mode 100644 index 0000000..82fea9d --- /dev/null +++ b/src/views/shop/merchant/user/components/search.vue @@ -0,0 +1,42 @@ + + + + diff --git a/src/views/shop/merchant/user/components/sex-select.vue b/src/views/shop/merchant/user/components/sex-select.vue new file mode 100644 index 0000000..1497ad5 --- /dev/null +++ b/src/views/shop/merchant/user/components/sex-select.vue @@ -0,0 +1,45 @@ + + + + diff --git a/src/views/shop/merchant/user/components/user-edit.vue b/src/views/shop/merchant/user/components/user-edit.vue new file mode 100644 index 0000000..13f807d --- /dev/null +++ b/src/views/shop/merchant/user/components/user-edit.vue @@ -0,0 +1,361 @@ + + + + diff --git a/src/views/shop/merchant/user/components/user-import.vue b/src/views/shop/merchant/user/components/user-import.vue new file mode 100644 index 0000000..0d8cbcb --- /dev/null +++ b/src/views/shop/merchant/user/components/user-import.vue @@ -0,0 +1,88 @@ + + + + diff --git a/src/views/shop/merchant/user/components/user-info.vue b/src/views/shop/merchant/user/components/user-info.vue new file mode 100644 index 0000000..a737d2f --- /dev/null +++ b/src/views/shop/merchant/user/components/user-info.vue @@ -0,0 +1,143 @@ + + + + diff --git a/src/views/shop/merchant/user/components/user-search.vue b/src/views/shop/merchant/user/components/user-search.vue new file mode 100644 index 0000000..b68abad --- /dev/null +++ b/src/views/shop/merchant/user/components/user-search.vue @@ -0,0 +1,111 @@ + + + + diff --git a/src/views/shop/merchant/user/components/userEdit.vue b/src/views/shop/merchant/user/components/userEdit.vue new file mode 100644 index 0000000..3a59597 --- /dev/null +++ b/src/views/shop/merchant/user/components/userEdit.vue @@ -0,0 +1,274 @@ + + + + diff --git a/src/views/shop/merchant/user/details/index.vue b/src/views/shop/merchant/user/details/index.vue new file mode 100644 index 0000000..9e535df --- /dev/null +++ b/src/views/shop/merchant/user/details/index.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/src/views/shop/merchant/user/index.vue b/src/views/shop/merchant/user/index.vue new file mode 100644 index 0000000..6597a2a --- /dev/null +++ b/src/views/shop/merchant/user/index.vue @@ -0,0 +1,562 @@ + + + + + + + diff --git a/src/views/shop/merchantAccount/components/merchantAccountEdit.vue b/src/views/shop/merchantAccount/components/merchantAccountEdit.vue index 5e2d589..bb5360f 100644 --- a/src/views/shop/merchantAccount/components/merchantAccountEdit.vue +++ b/src/views/shop/merchantAccount/components/merchantAccountEdit.vue @@ -4,7 +4,7 @@ :width="600" :visible="visible" :maskClosable="false" - :title="isUpdate ? '编辑商户账号' : '添加商户账号'" + :title="isUpdate ? '编辑商户职员' : '添加商户职员'" :body-style="{ paddingBottom: '28px' }" @update:visible="updateVisible" @ok="save" @@ -18,54 +18,30 @@ styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' } " > - - - - - - - - - - - - - - - - + + + + + + + import { ref, reactive, watch } from 'vue'; import { Form, message } from 'ant-design-vue'; - import { assignObject, uuid } from 'ele-admin-pro'; + import { assignObject, isPhone, uuid } from 'ele-admin-pro'; import { addMerchantAccount, updateMerchantAccount @@ -90,12 +66,16 @@ import { useThemeStore } from '@/store/modules/theme'; import { storeToRefs } from 'pinia'; import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types'; - import { FormInstance } from 'ant-design-vue/es/form'; - import { FileRecord } from '@/api/system/file/model'; - import { DictData } from '@/api/system/dict-data/model'; + import { FormInstance, RuleObject } from 'ant-design-vue/es/form'; import { Merchant } from '@/api/shop/merchant/model'; import { Role } from '@/api/system/role/model'; import { User } from '@/api/system/user/model'; + import { getMerchantId } from '@/utils/common'; + import { + getMerchantName, + getRoleIdByMerchant, + getRoleNameByMerchant + } from '@/utils/merchant'; // 是否是修改 const isUpdate = ref(false); @@ -155,7 +135,7 @@ { required: true, type: 'string', - message: '请填写商户账号名称', + message: '请填写商户职员名称', trigger: 'blur' } ], @@ -178,9 +158,15 @@ phone: [ { required: true, + message: '请输入正确的手机号码', type: 'string', - message: '请填写手机号码', - trigger: 'blur' + trigger: 'blur', + validator: async (_rule: RuleObject, value: string) => { + if (!isPhone(value)) { + return Promise.reject('请输入正确的手机号码'); + } + return Promise.resolve(); + } } ], password: [ @@ -240,9 +226,10 @@ loading.value = true; const formData = { ...form, - merchantId: Number(props.merchantId) - ? props.merchantId - : form.merchantId + merchantId: getMerchantId(), + merchantName: getMerchantName(), + roleId: getRoleIdByMerchant(), + roleName: getRoleNameByMerchant() }; const saveOrUpdate = isUpdate.value ? updateMerchantAccount diff --git a/src/views/shop/merchantAccount/index.vue b/src/views/shop/merchantAccount/index.vue index eb08666..a2c0c1d 100644 --- a/src/views/shop/merchantAccount/index.vue +++ b/src/views/shop/merchantAccount/index.vue @@ -75,6 +75,7 @@ MerchantAccountParam } from '@/api/shop/merchantAccount/model'; import router from '@/router'; + import { getMerchantId } from '@/utils/common'; // 表格实例 const tableRef = ref | null>(null); @@ -103,9 +104,7 @@ if (filters) { where.status = filters.status; } - if (merchantId.value > 0) { - where.merchantId = merchantId.value; - } + where.merchantId = getMerchantId(); return pageMerchantAccount({ ...where, ...orders, @@ -124,13 +123,13 @@ width: 90 }, { - title: '店铺名称', + title: '门店名称', dataIndex: 'merchantName', key: 'merchantName', align: 'center' }, { - title: '账号', + title: '登录账号', dataIndex: 'phone', key: 'phone', align: 'center' diff --git a/src/views/shop/merchantApply/index.vue b/src/views/shop/merchantApply/index.vue index b8e0bba..f023ae8 100644 --- a/src/views/shop/merchantApply/index.vue +++ b/src/views/shop/merchantApply/index.vue @@ -44,12 +44,15 @@ > + 删除 + - 删除 - @@ -200,7 +203,7 @@ /* 删除单个 */ const remove = (row: MerchantApply) => { const hide = message.loading('请求中..', 0); - removeMerchantApply(row.merchantApplyId) + removeMerchantApply(row.applyId) .then((msg) => { hide(); message.success(msg); @@ -225,7 +228,7 @@ maskClosable: true, onOk: () => { const hide = message.loading('请求中..', 0); - removeBatchMerchantApply(selection.value.map((d) => d.merchantApplyId)) + removeBatchMerchantApply(selection.value.map((d) => d.applyId)) .then((msg) => { hide(); message.success(msg); diff --git a/src/views/shop/order/components/search.vue b/src/views/shop/order/components/search.vue index 499e3b9..af7b64f 100644 --- a/src/views/shop/order/components/search.vue +++ b/src/views/shop/order/components/search.vue @@ -7,6 +7,11 @@ 未付款 已付款 + 订单类型 + + 商城订单 + 外面订单 + 付款方式 现金 @@ -34,6 +39,7 @@ @@ -70,6 +76,7 @@ import { Merchant } from '@/api/shop/merchant/model'; import { listOrder } from '@/api/shop/order'; import { Order, OrderParam } from '@/api/shop/order/model'; + import { getMerchantId } from "@/utils/merchant"; const props = withDefaults( defineProps<{ @@ -88,10 +95,13 @@ // 表单数据 const { where, resetFields } = useSearch({ - type: 1, + type: undefined, + payStatus: undefined, createTimeStart: undefined, createTimeEnd: undefined, categoryId: undefined, + payType: undefined, + isInvoice: undefined, week: undefined, keywords: undefined }); @@ -101,6 +111,7 @@ const dateRange = ref<[string, string]>(['', '']); const orders = ref(); const xlsFileName = ref(); + const merchantId = getMerchantId(); /* 搜索 */ const search = () => { diff --git a/src/views/shop/order/index.vue b/src/views/shop/order/index.vue index 28b73e5..6714080 100644 --- a/src/views/shop/order/index.vue +++ b/src/views/shop/order/index.vue @@ -1,7 +1,20 @@