feat(user): 补充开发者审核通过时添加店员记录功能

- 引入 addShopStoreUser 接口用于新增门店店员记录
- 新增 clerkStoreId 和 clerkTenantId 状态,保存当前审核店员的门店和租户信息
- 在审核通过后调用 addShopStoreUser,添加申请人为当前门店店员
- 保证只有当 clerkStoreId 存在时才执行新增操作
- 更新工作记录文档,补充审核通过流程中新添加的店员记录步骤
- 保持原有升级开发者逻辑和接口调用不变
This commit is contained in:
2026-07-23 17:59:22 +08:00
parent a703dcad90
commit babcf36439
4 changed files with 40 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ import Taro, { useDidShow } from '@tarojs/taro'
import { listShopDealerApply, updateShopDealerApply } from '@/api/shop/shopDealerApply'
import type { ShopDealerApply } from '@/api/shop/shopDealerApply/model'
import { setUserDeveloper } from '@/api/system/user'
import { getMyClerk } from '@/api/shop/shopStoreUser'
import { getMyClerk, addShopStoreUser } from '@/api/shop/shopStoreUser'
definePageConfig({
navigationBarTitleText: '开发者审核',
@@ -44,6 +44,8 @@ const VipReviewPage: React.FC = () => {
const [loading, setLoading] = useState(false)
const [submitting, setSubmitting] = useState(false)
const [isClerk, setIsClerk] = useState(false)
const [clerkStoreId, setClerkStoreId] = useState<number>()
const [clerkTenantId, setClerkTenantId] = useState<number>()
const loadingRef = useRef(false)
// 验证当前用户是否为店员
@@ -52,6 +54,9 @@ const VipReviewPage: React.FC = () => {
.then(data => {
if (data) {
setIsClerk(true)
// 记录当前店员所属门店与租户,审核通过时用于给申请人添加店员记录
setClerkStoreId(data.storeId)
setClerkTenantId(data.tenantId)
} else {
setIsClerk(false)
Taro.showToast({ title: '仅门店店员可访问', icon: 'none' })
@@ -132,6 +137,17 @@ const VipReviewPage: React.FC = () => {
// 审核通过:升级为开发者(后端 markAsDeveloper 会置 is_developer=1 并把角色替换为 developer
await setUserDeveloper(item.userId!)
// 审核通过在当前门店下给申请人添加一条店员shop_store_user记录
if (clerkStoreId) {
await addShopStoreUser({
userId: item.userId!,
storeId: clerkStoreId,
tenantId: clerkTenantId,
isDelete: 0,
comments: '开发者审核通过自动添加',
})
}
Taro.showToast({ title: '已通过', icon: 'success' })
loadList(activeTab)
} catch (e: any) {