feat:代码提交
This commit is contained in:
parent
816c67fe38
commit
13546eef8e
4
.env.development
Normal file
4
.env.development
Normal file
@ -0,0 +1,4 @@
|
||||
# 开发环境配置
|
||||
VITE_API_BASE_URL=
|
||||
VITE_APP_BASE_API=http://localhost:8089
|
||||
VITE_APP_TITLE=与书有行
|
||||
4
.env.production
Normal file
4
.env.production
Normal file
@ -0,0 +1,4 @@
|
||||
# 生产环境配置
|
||||
VITE_API_BASE_URL=https://api.buzhiyushu.cn
|
||||
VITE_APP_BASE_API=https://api.buzhiyushu.cn
|
||||
VITE_APP_TITLE=与书同行
|
||||
@ -71,7 +71,66 @@ const depotApi = {
|
||||
* 获取仓库名称列表
|
||||
* @returns {Promise} - 请求Promise
|
||||
*/
|
||||
getDepotNameList: () => instance.get('/depot/nameList')
|
||||
getDepotNameList: () => instance.get('/depot/nameList'),
|
||||
|
||||
/**
|
||||
* go查询货区列表
|
||||
* @param {Object} params - 查询参数
|
||||
* @returns {Promise} - 请求Promise
|
||||
*/
|
||||
goGetStorageList: (params) => instance.get('/depot/GetStorageListByGo', { params }),
|
||||
|
||||
/**
|
||||
* go创建货区
|
||||
* @param {Object} data - 货区信息
|
||||
* @returns {Promise} - 请求Promise
|
||||
*/
|
||||
goCreateDepot: (data) => {
|
||||
const formData = new FormData()
|
||||
Object.keys(data).forEach(key => {
|
||||
if (data[key] !== null && data[key] !== undefined) {
|
||||
formData.append(key, data[key])
|
||||
}
|
||||
})
|
||||
return instance.post('/depot/CreateByGo', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* go修改货区
|
||||
* @param {Object} data - 货区信息
|
||||
* @returns {Promise} - 请求Promise
|
||||
*/
|
||||
goUpdateDepot: (data) => {
|
||||
const formData = new FormData()
|
||||
Object.keys(data).forEach(key => {
|
||||
if (data[key] !== null && data[key] !== undefined) {
|
||||
formData.append(key, data[key])
|
||||
}
|
||||
})
|
||||
return instance.post('/depot/UpdateByGo', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* go删除货区
|
||||
* @param {Object} params - 删除参数
|
||||
* @returns {Promise} - 请求Promise
|
||||
*/
|
||||
goDeleteDepot: (params) => instance.get('/depot/DeleteByGo', { params }),
|
||||
|
||||
/**
|
||||
* go查询单条仓库数据
|
||||
* @param {Object} params - 查询参数
|
||||
* @returns {Promise} - 请求Promise
|
||||
*/
|
||||
goGetStorageInfo: (params) => instance.get('/depot/GetStorageInfoByGo', { params })
|
||||
}
|
||||
|
||||
// 导出模块
|
||||
|
||||
@ -17,6 +17,12 @@ const userApi = {
|
||||
// 删除用户
|
||||
deleteUser: (id) => instance.delete(`/user/delete/${id}`),
|
||||
|
||||
//查看店铺
|
||||
chenckShop: (id) => instance.get('/user/getUserShop', { params: { id } }),
|
||||
|
||||
// 开通会员
|
||||
openMember: (data) => instance.post('/user/openMember', data),
|
||||
|
||||
};
|
||||
|
||||
// 导出模块
|
||||
|
||||
@ -1,33 +1,27 @@
|
||||
<template>
|
||||
<div class="user-list-container">
|
||||
<div class="header-actions">
|
||||
<el-input
|
||||
v-model="searchKeyword"
|
||||
placeholder="请输入用户名或手机号搜索"
|
||||
clearable
|
||||
class="search-input"
|
||||
@clear="loadUserList"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
<el-input v-model="searchKeyword" placeholder="请输入用户名或手机号搜索" clearable class="search-input" @clear="loadUserList"
|
||||
@keyup.enter="handleSearch">
|
||||
<template #append>
|
||||
<el-button @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>
|
||||
<el-icon>
|
||||
<Search />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
<el-button type="primary" @click="openUserDialog()">
|
||||
<el-icon><Plus /></el-icon>新增用户
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>新增用户
|
||||
</el-button>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="userList"
|
||||
border
|
||||
style="width: 100%"
|
||||
row-key="userId"
|
||||
>
|
||||
<el-table v-loading="loading" :data="userList" border style="width: 100%" row-key="userId">
|
||||
<!-- <el-table-column prop="userId" label="用户ID" width="120" /> -->
|
||||
<el-table-column prop="userName" label="用户名" />
|
||||
<el-table-column prop="nickName" label="昵称" />
|
||||
@ -56,36 +50,25 @@
|
||||
<el-button type="danger" link @click="handleDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
<el-button type="success" link :loading="shopLoading" @click="checkShop(row)">
|
||||
查看店铺
|
||||
</el-button>
|
||||
<el-button type="warning" link @click="showMemberList(row)">
|
||||
会员管理
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</div>
|
||||
|
||||
<!-- 用户表单对话框 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="isEdit ? '编辑用户' : '新增用户'"
|
||||
width="500px"
|
||||
@closed="resetForm"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
class="user-form"
|
||||
>
|
||||
<el-dialog v-model="dialogVisible" :title="isEdit ? '编辑用户' : '新增用户'" width="500px" @closed="resetForm">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px" class="user-form">
|
||||
<el-form-item label="用户名" prop="userName">
|
||||
<el-input v-model="form.userName" placeholder="请输入用户名" />
|
||||
</el-form-item>
|
||||
@ -111,12 +94,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="角色" prop="roleIds">
|
||||
<el-select v-model="form.roleIds" placeholder="请选择角色" multiple collapse-tags>
|
||||
<el-option
|
||||
v-for="role in roleList"
|
||||
:key="role.id"
|
||||
:label="role.roleName"
|
||||
:value="role.id"
|
||||
/>
|
||||
<el-option v-for="role in roleList" :key="role.id" :label="role.roleName" :value="role.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -128,13 +106,255 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 店铺信息对话框 -->
|
||||
<el-dialog
|
||||
v-model="shopDialogVisible"
|
||||
:title="`${currentShopUser?.userName || currentShopUser?.nickName || currentShopUser?.userId || '用户'} - 店铺信息`"
|
||||
width="80%"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div v-loading="shopLoading">
|
||||
<!-- 切换卡片按钮 -->
|
||||
<div class="shop-tabs">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
:type="activeShopTab === 'all' ? 'primary' : ''"
|
||||
@click="activeShopTab = 'all'"
|
||||
>
|
||||
全部店铺 ({{ shopData.pddShops.length + shopData.kfzShops.length }})
|
||||
</el-button>
|
||||
<el-button
|
||||
:type="activeShopTab === 'pdd' ? 'primary' : ''"
|
||||
@click="activeShopTab = 'pdd'"
|
||||
:disabled="shopData.pddShops.length === 0"
|
||||
>
|
||||
拼多多店铺 ({{ shopData.pddShops.length }})
|
||||
</el-button>
|
||||
<el-button
|
||||
:type="activeShopTab === 'kfz' ? 'primary' : ''"
|
||||
@click="activeShopTab = 'kfz'"
|
||||
:disabled="shopData.kfzShops.length === 0"
|
||||
>
|
||||
孔夫子店铺 ({{ shopData.kfzShops.length }})
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
|
||||
<!-- 拼多多店铺 -->
|
||||
<div v-if="(activeShopTab === 'all' || activeShopTab === 'pdd') && shopData.pddShops.length > 0" class="shop-section">
|
||||
<h3 class="shop-type-title">
|
||||
<el-tag type="warning" size="large">拼多多店铺 ({{ shopData.pddShops.length }}个)</el-tag>
|
||||
</h3>
|
||||
<el-table :data="shopData.pddShops" border class="shop-table" style="width: 100%; margin-bottom: 20px;">
|
||||
<el-table-column prop="id" label="ID" />
|
||||
<el-table-column prop="shopName" label="店铺名称" width="150" />
|
||||
<el-table-column prop="shopAliasName" label="店铺别名" width="150" />
|
||||
<el-table-column prop="mallId" label="三方ID" width="120" />
|
||||
<el-table-column prop="account" label="平台账号" width="120" />
|
||||
<el-table-column prop="password" label="平台密码" width="120">
|
||||
<!-- <template #default="{ row }">
|
||||
<span v-if="row.password">******</span>
|
||||
<span v-else>-</span>
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
<el-table-column prop="statusText" label="状态" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === '0' ? 'success' : 'danger'">
|
||||
{{ row.statusText }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="authorizeText" label="授权状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getAuthorizeTagType(row.shopAuthorize)">
|
||||
{{ row.authorizeText }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="syncOrderText" label="同步订单" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.isSynOrder === 1 ? 'success' : 'info'">
|
||||
{{ row.syncOrderText }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="formattedAddTime" label="添加时间" width="150" />
|
||||
<el-table-column prop="formattedExpirationTime" label="过期时间" width="150" />
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 孔夫子店铺 -->
|
||||
<div v-if="(activeShopTab === 'all' || activeShopTab === 'kfz') && shopData.kfzShops.length > 0" class="shop-section">
|
||||
<h3 class="shop-type-title">
|
||||
<el-tag type="primary" size="large">孔夫子店铺 ({{ shopData.kfzShops.length }}个)</el-tag>
|
||||
</h3>
|
||||
<el-table :data="shopData.kfzShops" border class="shop-table" style="width: 100%;">
|
||||
<el-table-column prop="id" label="ID" />
|
||||
<el-table-column prop="shopName" label="店铺名称" />
|
||||
<el-table-column prop="shopAliasName" label="店铺别名" />
|
||||
<el-table-column prop="mallId" label="三方ID" />
|
||||
<el-table-column prop="account" label="平台账号" />
|
||||
<el-table-column prop="password" label="平台密码">
|
||||
<!-- <template #default="{ row }">
|
||||
<span v-if="row.password">******</span>
|
||||
<span v-else>-</span>
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
<el-table-column prop="statusText" label="状态" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === '0' ? 'success' : 'danger'">
|
||||
{{ row.statusText }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="authorizeText" label="授权状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getAuthorizeTagType(row.shopAuthorize)">
|
||||
{{ row.authorizeText }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="syncOrderText" label="同步订单" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.isSynOrder === 1 ? 'success' : 'info'">
|
||||
{{ row.syncOrderText }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="formattedAddTime" label="添加时间" width="150" />
|
||||
<el-table-column prop="formattedExpirationTime" label="过期时间" width="150" />
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 无数据提示 -->
|
||||
<div v-if="shopData.pddShops.length === 0 && shopData.kfzShops.length === 0" class="no-data">
|
||||
<el-empty description="该用户暂无店铺数据" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="shopDialogVisible = false">关闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 会员开通对话框 -->
|
||||
<el-dialog
|
||||
v-model="memberDialogVisible"
|
||||
:title="`为 ${currentMemberUser?.userName || currentMemberUser?.nickName || '用户'} 开通会员`"
|
||||
width="600px"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="memberFormRef" :model="memberForm" :rules="memberRules" label-width="120px">
|
||||
<el-form-item label="会员类型" prop="memberType">
|
||||
<el-select v-model="memberForm.memberType" placeholder="请选择会员类型" style="width: 100%" @change="handleMemberTypeChange">
|
||||
<el-option label="选品中心页面会员" value="centerBookPage" />
|
||||
<el-option label="选品中心高级搜索会员" value="centerBookSearch" />
|
||||
<el-option label="小程序上书会员" value="xcxLetter" />
|
||||
<el-option label="小程序翻新会员" value="xcxRenovate" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="时长单位" prop="unit">
|
||||
<el-select v-model="memberForm.unit" placeholder="请选择时长单位" style="width: 100%">
|
||||
<el-option label="天" value="日" />
|
||||
<el-option label="月" value="月" />
|
||||
<el-option label="年" value="年" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="时长" prop="length">
|
||||
<el-input-number
|
||||
v-model="memberForm.length"
|
||||
:min="1"
|
||||
placeholder="请输入时长"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="memberDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="memberLoading" @click="submitMemberForm">生成支付二维码</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 支付二维码对话框 -->
|
||||
<el-dialog
|
||||
v-model="qrCodeDialogVisible"
|
||||
title="扫码支付"
|
||||
width="400px"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="qr-code-container" style="text-align: center;">
|
||||
<div v-if="qrCodeData.img" class="qr-code-wrapper">
|
||||
<img :src="`data:image/png;base64,${qrCodeData.img}`" alt="支付二维码" style="width: 200px; height: 200px;" />
|
||||
<p style="margin-top: 10px; color: #666;">请使用微信扫码支付</p>
|
||||
<p style="color: #999; font-size: 12px;">支付金额:¥{{ memberForm.rechargPrice }}</p>
|
||||
</div>
|
||||
<div v-else style="padding: 50px 0;">
|
||||
<el-icon size="50" color="#ccc"><Loading /></el-icon>
|
||||
<p style="margin-top: 10px; color: #999;">正在生成二维码...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="qrCodeDialogVisible = false">关闭</el-button>
|
||||
<el-button type="primary" @click="checkPaymentStatus">检查支付状态</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 会员列表对话框 -->
|
||||
<el-dialog
|
||||
v-model="memberListVisible"
|
||||
:title="`${currentMemberListUser?.userName || currentMemberListUser?.nickName || '用户'} 的会员管理`"
|
||||
width="800px"
|
||||
@closed="closeMemberList"
|
||||
>
|
||||
<el-table :data="memberListData" border style="width: 100%">
|
||||
<el-table-column prop="title" label="会员类型" />
|
||||
<el-table-column prop="member" label="开通状态">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="row.member === 0 ? 'info' : row.member === 1 ? 'success' : 'warning'"
|
||||
>
|
||||
{{ row.member === 0 ? '未开通' : row.member === 1 ? '已开通' : '已过期' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" >
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="row.member === 1"
|
||||
@click="openMemberDialogFromList(row)"
|
||||
>
|
||||
{{ row.member === 1 ? '已开通' : '开通会员' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="memberListVisible = false">关闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Search, Plus } from '@element-plus/icons-vue'
|
||||
import { Search, Plus, Shop, Loading } from '@element-plus/icons-vue'
|
||||
import { userApi } from '@/api'
|
||||
import { getRoleList } from '@/api/role'
|
||||
|
||||
@ -153,6 +373,38 @@ const dialogVisible = ref(false)
|
||||
const isEdit = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const roleList = ref([])
|
||||
|
||||
// 店铺相关
|
||||
const shopDialogVisible = ref(false)
|
||||
const shopLoading = ref(false)
|
||||
const currentShopUser = ref(null) // 当前查看店铺的用户信息
|
||||
const shopData = ref({
|
||||
pddShops: [], // 拼多多店铺 (shopType = 1)
|
||||
kfzShops: [] // 孔夫子店铺 (shopType = 2)
|
||||
})
|
||||
// 切换卡片状态
|
||||
const activeShopTab = ref('all') // 'all', 'pdd', 'kfz'
|
||||
|
||||
// 会员相关
|
||||
const memberDialogVisible = ref(false)
|
||||
const qrCodeDialogVisible = ref(false)
|
||||
const memberLoading = ref(false)
|
||||
const currentMemberUser = ref(null)
|
||||
const memberFormRef = ref(null)
|
||||
|
||||
// 会员列表相关
|
||||
const memberListVisible = ref(false)
|
||||
const memberListData = ref([
|
||||
{ id: 1, title: '页面展示会员', member: 0 }, // 未开通
|
||||
{ id: 2, title: '高级搜索会员', member: 1 }, // 已开通
|
||||
{ id: 3, title: 'xcx上书会员', member: 2 }, // 已过期
|
||||
{ id: 4, title: 'xcx翻新会员', member: 0 } // 未开通
|
||||
])
|
||||
const currentMemberListUser = ref(null)
|
||||
const qrCodeData = ref({
|
||||
img: '',
|
||||
id: ''
|
||||
})
|
||||
// 表单数据
|
||||
const form = reactive({
|
||||
userId: null,
|
||||
@ -167,6 +419,16 @@ const form = reactive({
|
||||
roleIds: [] // 多角色ID数组
|
||||
})
|
||||
|
||||
// 会员表单数据
|
||||
const memberForm = reactive({
|
||||
id: null,
|
||||
memberType: '',
|
||||
title: '',
|
||||
rechargPrice: null,
|
||||
unit: '',
|
||||
length: null
|
||||
})
|
||||
|
||||
// 表单校验规则
|
||||
const validatePass = (rule, value, callback) => {
|
||||
if (!isEdit.value && !value) {
|
||||
@ -211,6 +473,19 @@ const rules = reactive({
|
||||
]
|
||||
})
|
||||
|
||||
// 会员表单验证规则
|
||||
const memberRules = reactive({
|
||||
memberType: [
|
||||
{ required: true, message: '请选择会员类型', trigger: 'change' }
|
||||
],
|
||||
unit: [
|
||||
{ required: true, message: '请选择时长单位', trigger: 'change' }
|
||||
],
|
||||
length: [
|
||||
{ required: true, message: '请输入时长', trigger: 'blur' }
|
||||
]
|
||||
})
|
||||
|
||||
// 表单引用
|
||||
const formRef = ref(null)
|
||||
|
||||
@ -479,6 +754,220 @@ const formatDate = (row, column) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 查看店铺信息
|
||||
const checkShop = async (row) => {
|
||||
try {
|
||||
console.log("row",row.id)
|
||||
shopLoading.value = true
|
||||
|
||||
// 重置切换状态为全部店铺
|
||||
activeShopTab.value = 'all'
|
||||
|
||||
// 设置当前查看店铺的用户信息
|
||||
currentShopUser.value = row
|
||||
|
||||
// 调用 userApi.chenckShop 接口,传递用户ID
|
||||
const response = await userApi.chenckShop(row.id)
|
||||
console.log("response",response)
|
||||
if (response.code === 200) {
|
||||
const data = response.data || {}
|
||||
|
||||
// 重置数据
|
||||
shopData.value.pddShops = []
|
||||
shopData.value.kfzShops = []
|
||||
|
||||
// 根据 data 中的 1 和 2 分类店铺
|
||||
if (data['1'] && Array.isArray(data['1'])) {
|
||||
shopData.value.pddShops = data['1'].map(shop => ({
|
||||
...shop,
|
||||
statusText: shop.status === '0' ? '正常' : '禁用',
|
||||
authorizeText: getAuthorizeText(shop.shopAuthorize),
|
||||
syncOrderText: shop.isSynOrder === 1 ? '是' : '否',
|
||||
formattedAddTime: formatShopDate(shop.addTime),
|
||||
formattedExpirationTime: formatShopDate(shop.expirationTime)
|
||||
}))
|
||||
}
|
||||
|
||||
if (data['2'] && Array.isArray(data['2'])) {
|
||||
shopData.value.kfzShops = data['2'].map(shop => ({
|
||||
...shop,
|
||||
statusText: shop.status === '0' ? '正常' : '禁用',
|
||||
authorizeText: getAuthorizeText(shop.shopAuthorize),
|
||||
syncOrderText: shop.isSynOrder === 1 ? '是' : '否',
|
||||
formattedAddTime: formatShopDate(shop.addTime),
|
||||
formattedExpirationTime: formatShopDate(shop.expirationTime)
|
||||
}))
|
||||
}
|
||||
|
||||
// 显示对话框
|
||||
shopDialogVisible.value = true
|
||||
|
||||
// 显示统计信息
|
||||
const totalShops = shopData.value.pddShops.length + shopData.value.kfzShops.length
|
||||
const userName = row.userName || row.nickName || row.userId
|
||||
ElMessage.success(`用户 "${userName}" 共有 ${totalShops} 个店铺(拼多多:${shopData.value.pddShops.length}个,孔夫子:${shopData.value.kfzShops.length}个)`)
|
||||
} else {
|
||||
ElMessage.error(response.message || '获取店铺数据失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('查询店铺失败:', error)
|
||||
ElMessage.error('查询店铺失败,请稍后重试')
|
||||
} finally {
|
||||
shopLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 获取授权状态文本
|
||||
const getAuthorizeText = (shopAuthorize) => {
|
||||
const authorizeMap = {
|
||||
'0': '未授权',
|
||||
'1': '已授权',
|
||||
'2': '已过期'
|
||||
}
|
||||
return authorizeMap[shopAuthorize] || '未知状态'
|
||||
}
|
||||
|
||||
// 获取授权状态标签类型
|
||||
const getAuthorizeTagType = (shopAuthorize) => {
|
||||
const tagTypeMap = {
|
||||
'0': 'danger', // 未授权 - 红色
|
||||
'1': 'success', // 已授权 - 绿色
|
||||
'2': 'warning' // 已过期 - 橙色
|
||||
}
|
||||
return tagTypeMap[shopAuthorize] || 'info'
|
||||
}
|
||||
|
||||
// 打开会员开通对话框
|
||||
const openMemberDialog = (row) => {
|
||||
currentMemberUser.value = row
|
||||
resetMemberForm()
|
||||
memberDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 处理会员类型变化
|
||||
const handleMemberTypeChange = (value) => {
|
||||
const titleMap = {
|
||||
'centerBookPage': '页面展示会员',
|
||||
'centerAdvancedSearch': '高级搜索会员',
|
||||
'xcxBookUpload': 'xcx上书会员',
|
||||
'xcxBookRenovation': 'xcx翻新会员'
|
||||
}
|
||||
memberForm.title = titleMap[value] || ''
|
||||
}
|
||||
|
||||
// 重置会员表单
|
||||
const resetMemberForm = () => {
|
||||
if (memberFormRef.value) {
|
||||
memberFormRef.value.resetFields()
|
||||
}
|
||||
|
||||
Object.keys(memberForm).forEach(key => {
|
||||
if (key === 'id') {
|
||||
memberForm[key] = currentMemberUser.value?.id || null
|
||||
} else if (key === 'rechargPrice') {
|
||||
memberForm[key] = 0.01
|
||||
} else if (key === 'length') {
|
||||
memberForm[key] = null
|
||||
} else {
|
||||
memberForm[key] = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 提交会员表单
|
||||
const submitMemberForm = async () => {
|
||||
if (!memberFormRef.value) return
|
||||
|
||||
await memberFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
memberLoading.value = true
|
||||
|
||||
// 准备提交数据,将价格转换为分(最小单位)
|
||||
const submitData = {
|
||||
...memberForm,
|
||||
rechargPrice: Math.round(memberForm.rechargPrice * 100) // 转换为分
|
||||
}
|
||||
console.log("submitData",submitData)
|
||||
const res = await userApi.openMember(submitData)
|
||||
console.log("res",res)
|
||||
if (res.code === 200) {
|
||||
qrCodeData.value = res.data
|
||||
memberDialogVisible.value = false
|
||||
qrCodeDialogVisible.value = true
|
||||
ElMessage.success('二维码生成成功,请扫码支付')
|
||||
} else {
|
||||
ElMessage.error(res.message || '生成支付二维码失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('生成支付二维码出错:', error)
|
||||
ElMessage.error(error.message || '生成支付二维码失败')
|
||||
} finally {
|
||||
memberLoading.value = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 检查支付状态(这里可以根据实际需求实现)
|
||||
const checkPaymentStatus = () => {
|
||||
ElMessage.info('支付状态检查功能待实现')
|
||||
// 这里可以调用后端接口检查支付状态
|
||||
// 如果支付成功,可以关闭对话框并刷新用户列表
|
||||
}
|
||||
|
||||
// 格式化店铺日期
|
||||
const formatShopDate = (dateStr) => {
|
||||
if (!dateStr) return '-'
|
||||
|
||||
try {
|
||||
const date = new Date(dateStr)
|
||||
return date.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})
|
||||
} catch (e) {
|
||||
return dateStr
|
||||
}
|
||||
}
|
||||
|
||||
// 显示会员列表
|
||||
const showMemberList = (row) => {
|
||||
currentMemberListUser.value = row
|
||||
memberListVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭会员列表
|
||||
const closeMemberList = () => {
|
||||
currentMemberListUser.value = null
|
||||
}
|
||||
|
||||
// 从会员列表中打开会员开通对话框
|
||||
const openMemberDialogFromList = (memberRow) => {
|
||||
// 设置当前用户
|
||||
currentMemberUser.value = currentMemberListUser.value
|
||||
|
||||
// 根据会员类型设置表单数据
|
||||
const memberTypeMap = {
|
||||
'页面展示会员': 'centerBookPage',
|
||||
'高级搜索会员': 'centerAdvancedSearch',
|
||||
'xcx上书会员': 'xcxBookUpload',
|
||||
'xcx翻新会员': 'xcxBookRenovation'
|
||||
}
|
||||
|
||||
// 重置并设置表单
|
||||
resetMemberForm()
|
||||
memberForm.memberType = memberTypeMap[memberRow.title] || ''
|
||||
memberForm.title = memberRow.title
|
||||
|
||||
// 关闭会员列表,打开会员开通对话框
|
||||
memberListVisible.value = false
|
||||
memberDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 组件挂载时加载数据
|
||||
onMounted(() => {
|
||||
loadUserList()
|
||||
@ -515,4 +1004,111 @@ onMounted(() => {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.shop-section {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.shop-type-title {
|
||||
margin-bottom: 15px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.no-data {
|
||||
text-align: center;
|
||||
padding: 40px 0;
|
||||
}
|
||||
|
||||
.shop-tabs {
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 15px;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.shop-tabs .el-button-group {
|
||||
/* display: inline-flex; */
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.shop-tabs .el-button {
|
||||
transition: all 0.3s ease;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.shop-tabs .el-button:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.shop-tabs .el-button:first-child {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.shop-tabs .el-button:last-child {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.shop-tabs .el-button:not(:first-child):not(:last-child) {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/* 表格样式 */
|
||||
.shop-table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__header-wrapper) {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__header) {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__header th) {
|
||||
background-color: #f5f7fa !important;
|
||||
color: #606266;
|
||||
font-weight: 600;
|
||||
border-right: 1px solid #ebeef5;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
padding: 12px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__header th:last-child) {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__body td) {
|
||||
border-right: 1px solid #ebeef5;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
padding: 12px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__body td:last-child) {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__row:hover > td) {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__border) {
|
||||
border: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__cell) {
|
||||
padding: 12px 8px;
|
||||
border-right: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.shop-table :deep(.el-table__cell:last-child) {
|
||||
border-right: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -73,9 +73,21 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<!-- 只在一级节点显示这些操作按钮 -->
|
||||
<!-- 一级货区操作按钮 -->
|
||||
<template v-if="!scope.row.level || scope.row.level === 1">
|
||||
<el-button type="primary" link :icon="Plus" @click="handleAddFreight(scope.row)"></el-button>
|
||||
<el-button type="primary" link :icon="Plus" @click="handleAddFreight(scope.row)" title="创建二级货区"></el-button>
|
||||
<el-button type="primary" link :icon="Edit" @click="handleEdit(scope.row)"></el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
:icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-if="scope.row.id && !scope.row.noData"
|
||||
></el-button>
|
||||
</template>
|
||||
<!-- 二级货区操作按钮 -->
|
||||
<template v-else-if="scope.row.level === 2">
|
||||
<el-button type="primary" link :icon="Plus" @click="handleAddThirdLevel(scope.row)" title="创建三级货区"></el-button>
|
||||
<el-button type="primary" link :icon="Edit" @click="handleEdit(scope.row)"></el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
@ -105,21 +117,36 @@
|
||||
<!-- 添加/编辑弹窗 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="dialogType === 'add' ? '创建货区' : '编辑货区'"
|
||||
width="500px"
|
||||
:title="dialogType === 'add' ? `创建${getLevelText(currentLevel)}级货区` : '编辑货区'"
|
||||
width="600px"
|
||||
>
|
||||
<el-form :model="form" label-width="120px" :rules="rules" ref="formRef">
|
||||
<el-form-item label="货区名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入货区名称"></el-input>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<el-input v-model="form.name" placeholder="请输入名称" style="flex: 1;"></el-input>
|
||||
<el-select v-model="form.unit" placeholder="请选择单位" style="width: 120px;">
|
||||
<el-option label="库" value="库"></el-option>
|
||||
<el-option label="区" value="区"></el-option>
|
||||
<el-option label="架" value="架"></el-option>
|
||||
<el-option label="层" value="层"></el-option>
|
||||
<el-option label="位" value="位"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="货区编号" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入货区编号"></el-input>
|
||||
<el-form-item label="货区编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入货区编码,格式示例:AA/A1/1A/,不能以0开头"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="书品类别" prop="categoryNumber">
|
||||
<el-input v-model="form.categoryNumber" placeholder="请输入书品类别"></el-input>
|
||||
<el-form-item label="货区数量" prop="sheQuanityMax">
|
||||
<el-input v-model="form.sheQuanityMax" placeholder="请输入最大货区数量(纯数字,不得以0开头,不得超过255)"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户ID"></el-input>
|
||||
<el-form-item label="货区地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入货区地址,例如:沈阳市和平区XXX街XX号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员" prop="manager">
|
||||
<el-input v-model="form.manager" placeholder="请输入管理员,不得超过8位"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="货区状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
@ -180,6 +207,7 @@ const multipleSelection = ref([])
|
||||
// 弹窗表单
|
||||
const dialogVisible = ref(false)
|
||||
const dialogType = ref('add')
|
||||
const currentLevel = ref(1) // 当前创建的货区级别
|
||||
const formRef = ref(null)
|
||||
const form = reactive({
|
||||
id: null,
|
||||
@ -187,7 +215,15 @@ const form = reactive({
|
||||
code: '',
|
||||
categoryNumber: '',
|
||||
userId: '',
|
||||
status: 0
|
||||
status: 0,
|
||||
unit: '库',
|
||||
sheQuanityMax: '',
|
||||
address: '',
|
||||
manager: '',
|
||||
remark: '',
|
||||
fid: null,
|
||||
storageType: '1',
|
||||
sheQuanityMax: ''
|
||||
})
|
||||
|
||||
// 运费模板相关
|
||||
@ -204,8 +240,29 @@ const currentDepot = ref(null)
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
name: [{ required: true, message: '请输入货区名称', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入货区编号', trigger: 'blur' }]
|
||||
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
||||
code: [
|
||||
{ required: true, message: '请输入货区编号', trigger: 'blur' },
|
||||
{ pattern: /^[a-zA-Z1-9][a-zA-Z0-9]*$/, message: '货区编号不能以0开头', trigger: 'blur' }
|
||||
],
|
||||
sheQuanityMax: [
|
||||
{ required: true, message: '请输入数量', trigger: 'blur' },
|
||||
{ pattern: /^[1-9]\d*$/, message: '数量必须为纯数字且不能以0开头', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (value && parseInt(value) > 255) {
|
||||
callback(new Error('数量不能超过255'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
manager: [
|
||||
{ required: true, message: '请输入管理员', trigger: 'blur' },
|
||||
{ max: 8, message: '管理员不能超过8位', trigger: 'blur' }
|
||||
]
|
||||
})
|
||||
|
||||
// 选择运费模板
|
||||
@ -237,6 +294,12 @@ const submitTemplateForm = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取级别文字
|
||||
const getLevelText = (level) => {
|
||||
const levelMap = { 1: '一', 2: '二', 3: '三', 4: '四', 5: '五' }
|
||||
return levelMap[level] || level
|
||||
}
|
||||
|
||||
// 初始化加载数据
|
||||
onMounted(() => {
|
||||
fetchDepotData()
|
||||
@ -247,19 +310,29 @@ const fetchDepotData = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const params = {
|
||||
pageNum: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
fid: '0',
|
||||
storageType: '1',
|
||||
page: currentPage.value.toString(),
|
||||
pageSize: pageSize.value.toString(),
|
||||
...searchForm
|
||||
}
|
||||
const res = await depotApi.getDepotList(params)
|
||||
const res = await depotApi.goGetStorageList(params)
|
||||
console.log("res",res)
|
||||
if (res.code === 200) {
|
||||
const depotList = res.data.list || []
|
||||
total.value = res.data.total || 0
|
||||
const depotList = res.data.data || []
|
||||
total.value = res.total || 0
|
||||
|
||||
// 为每个一级货区添加hasChildren标记和level属性
|
||||
// 为每个一级货区添加hasChildren标记和level属性,并映射字段
|
||||
depotList.forEach(depot => {
|
||||
depot.hasChildren = true // 默认都有子节点
|
||||
depot.level = 1 // 设置为一级节点
|
||||
// 映射字段以适配原有的表格显示
|
||||
depot.inventory = depot.count || 0
|
||||
depot.categoryNumber = depot.bookType || ''
|
||||
depot.templateName = depot.template_name || ''
|
||||
// 映射API字段到表单字段
|
||||
depot.sheQuanityMax = depot.she_quantity_max
|
||||
depot.storageType = depot.storage_type
|
||||
})
|
||||
|
||||
tableData.value = depotList
|
||||
@ -292,8 +365,19 @@ const handleReset = () => {
|
||||
// 添加货区
|
||||
const handleAdd = () => {
|
||||
dialogType.value = 'add'
|
||||
currentLevel.value = 1
|
||||
Object.keys(form).forEach(key => {
|
||||
form[key] = key === 'status' ? 0 : ''
|
||||
if (key === 'status') {
|
||||
form[key] = 0
|
||||
} else if (key === 'unit') {
|
||||
form[key] = '库'
|
||||
} else if (key === 'fid') {
|
||||
form[key] = null
|
||||
} else if (key === 'storageType') {
|
||||
form[key] = '1'
|
||||
} else {
|
||||
form[key] = ''
|
||||
}
|
||||
})
|
||||
dialogVisible.value = true
|
||||
}
|
||||
@ -301,8 +385,17 @@ const handleAdd = () => {
|
||||
// 编辑货区
|
||||
const handleEdit = (row) => {
|
||||
dialogType.value = 'edit'
|
||||
currentLevel.value = parseInt(row.storage_type || row.storageType) || 1
|
||||
Object.keys(form).forEach(key => {
|
||||
if (key === 'sheQuanityMax') {
|
||||
// API返回的字段是she_quantity_max,需要映射到表单的sheQuanityMax
|
||||
form[key] = row.she_quantity_max || row[key]
|
||||
} else if (key === 'storageType') {
|
||||
// API返回的字段是storage_type,需要映射到表单的storageType
|
||||
form[key] = row.storage_type || row[key]
|
||||
} else {
|
||||
form[key] = row[key]
|
||||
}
|
||||
})
|
||||
dialogVisible.value = true
|
||||
}
|
||||
@ -327,7 +420,11 @@ const handleDelete = (row) => {
|
||||
return
|
||||
}
|
||||
|
||||
const res = await depotApi.deleteDepot(row.id)
|
||||
const params = {
|
||||
id: row.id.toString(),
|
||||
}
|
||||
|
||||
const res = await depotApi.goDeleteDepot(params)
|
||||
if (res.code === 200) {
|
||||
ElMessage.success('删除成功')
|
||||
fetchDepotData()
|
||||
@ -341,9 +438,44 @@ const handleDelete = (row) => {
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
// 添加运费模板
|
||||
// 创建二级货区
|
||||
const handleAddFreight = (row) => {
|
||||
ElMessage.info('添加运费模板功能待实现')
|
||||
dialogType.value = 'add'
|
||||
currentLevel.value = 2
|
||||
// 先重置表单
|
||||
Object.keys(form).forEach(key => {
|
||||
if (key === 'status') {
|
||||
form[key] = 0
|
||||
} else if (key === 'unit') {
|
||||
form[key] = '区'
|
||||
} else {
|
||||
form[key] = ''
|
||||
}
|
||||
})
|
||||
// 然后设置特定字段
|
||||
form.fid = row.id
|
||||
form.storageType = '2'
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 创建三级货区
|
||||
const handleAddThirdLevel = (row) => {
|
||||
dialogType.value = 'add'
|
||||
currentLevel.value = 3
|
||||
// 先重置表单
|
||||
Object.keys(form).forEach(key => {
|
||||
if (key === 'status') {
|
||||
form[key] = 0
|
||||
} else if (key === 'unit') {
|
||||
form[key] = '架'
|
||||
} else {
|
||||
form[key] = ''
|
||||
}
|
||||
})
|
||||
// 然后设置特定字段
|
||||
form.fid = row.id
|
||||
form.storageType = '3'
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 仓库规则设置
|
||||
@ -365,10 +497,16 @@ const submitForm = async () => {
|
||||
if (valid) {
|
||||
try {
|
||||
let res
|
||||
const formData = {
|
||||
...form,
|
||||
fid: form.fid ,
|
||||
storageType: form.storageType
|
||||
}
|
||||
|
||||
if (dialogType.value === 'add') {
|
||||
res = await depotApi.createDepot(form)
|
||||
res = await depotApi.goCreateDepot(formData)
|
||||
} else {
|
||||
res = await depotApi.updateDepot(form)
|
||||
res = await depotApi.goUpdateDepot(formData)
|
||||
}
|
||||
|
||||
if (res.code === 200) {
|
||||
@ -407,9 +545,14 @@ const loadNode = async (row, treeNode, resolve) => {
|
||||
if (row.level === 1) {
|
||||
// 加载二级货架数据
|
||||
try {
|
||||
const res = await depotApi.getShelvesByDepotId(row.id)
|
||||
const params = {
|
||||
fid: row.id.toString(),
|
||||
storageType: '2',
|
||||
// userId: '11111'
|
||||
}
|
||||
const res = await depotApi.goGetStorageList(params)
|
||||
if (res.code === 200) {
|
||||
const shelves = res.data || []
|
||||
const shelves = res.data.data || []
|
||||
if (shelves.length === 0) {
|
||||
// 如果没有二级数据,返回一个特殊的空数据提示
|
||||
resolve([{ id: `empty-${row.id}`, name: '暂无数据', noData: true, hasChildren: false }])
|
||||
@ -417,6 +560,14 @@ const loadNode = async (row, treeNode, resolve) => {
|
||||
shelves.forEach(shelf => {
|
||||
shelf.hasChildren = true
|
||||
shelf.level = 2
|
||||
// 映射字段以适配原有的表格显示
|
||||
shelf.inventory = shelf.she_quantity_max || 0
|
||||
shelf.categoryNumber = shelf.bookType || ''
|
||||
shelf.templateName = shelf.template_name || ''
|
||||
shelf.userId = shelf.user_id || ''
|
||||
// 映射API字段到表单字段
|
||||
shelf.sheQuanityMax = shelf.she_quantity_max
|
||||
shelf.storageType = shelf.storage_type
|
||||
})
|
||||
resolve(shelves)
|
||||
}
|
||||
@ -432,9 +583,14 @@ const loadNode = async (row, treeNode, resolve) => {
|
||||
} else if (row.level === 2) {
|
||||
// 加载三级货位数据
|
||||
try {
|
||||
const res = await depotApi.getFreightByShelveId(row.id)
|
||||
const params = {
|
||||
fid: row.id.toString(),
|
||||
storageType: '3',
|
||||
// userId: '11111'
|
||||
}
|
||||
const res = await depotApi.goGetStorageList(params)
|
||||
if (res.code === 200) {
|
||||
const freights = res.data || []
|
||||
const freights = res.data.data || []
|
||||
if (freights.length === 0) {
|
||||
// 如果没有三级数据,返回一个特殊的空数据提示
|
||||
resolve([{ id: `empty-${row.id}`, name: '暂无数据', noData: true, hasChildren: false }])
|
||||
@ -442,6 +598,14 @@ const loadNode = async (row, treeNode, resolve) => {
|
||||
freights.forEach(freight => {
|
||||
freight.level = 3
|
||||
freight.hasChildren = false
|
||||
// 映射字段以适配原有的表格显示
|
||||
freight.inventory = freight.she_quantity_max || 0
|
||||
freight.categoryNumber = freight.bookType || ''
|
||||
freight.templateName = freight.template_name || ''
|
||||
freight.userId = freight.user_id || ''
|
||||
// 映射API字段到表单字段
|
||||
freight.sheQuanityMax = freight.she_quantity_max
|
||||
freight.storageType = freight.storage_type
|
||||
})
|
||||
resolve(freights)
|
||||
}
|
||||
|
||||
@ -22,16 +22,16 @@
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">搜索</el-button>
|
||||
<el-button type="primary" @click="exportData">导出</el-button>
|
||||
<el-button type="primary" @click="confirmTongBu">删除后拉取</el-button>
|
||||
<el-button type="primary" @click="tongBu1">拉取</el-button>
|
||||
<el-button type="danger" @click="handleAdd" v-hasPermi="['zhishu:pddGoods:tongbu']">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button type="primary" icon="Search" @click="exportData">导出</el-button>
|
||||
<el-button type="primary" icon="Search" @click="confirmTongBu">删除后拉取</el-button>
|
||||
<el-button type="primary" icon="Search" @click="tongBu1">拉取</el-button>
|
||||
<el-button type="danger" icon="Search" @click="handleAdd" v-hasPermi="['zhishu:pddGoods:tongbu']">
|
||||
拼多多专属详情同步 </el-button>
|
||||
<el-button type="primary" @click="editIsOnSale('1')">整店上架</el-button>
|
||||
<el-button type="primary" @click="editIsOnSale('0')">整店下架</el-button>
|
||||
<el-button type="primary" icon="Top" @click="editIsOnSale('1')">整店上架</el-button>
|
||||
<el-button type="primary" icon="Bottom" @click="editIsOnSale('0')">整店下架</el-button>
|
||||
<el-button type="danger" @click="repeatData">下架重复</el-button>
|
||||
<el-button type="success" @click="showRenovateDialog">翻新上架</el-button>
|
||||
<el-button type="success" icon="Upload" @click="showRenovateDialog">翻新上架</el-button>
|
||||
<el-button type="primary" @click="createVerifyPriceUrl">生成核价链接</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -436,10 +436,9 @@ const createVerifyPriceUrl = async () => {
|
||||
try {
|
||||
loadingVerifyUrl.value = true;
|
||||
const allNum = await getShopTaskAllNum(shopId.value, '1');
|
||||
console.log("res1",allNum)
|
||||
if (allNum.data > 0) {
|
||||
if (allNum > 0) {
|
||||
verifyPriceUrl.value = shopId.value;
|
||||
shopTotalCount.value = allNum.data;
|
||||
shopTotalCount.value = allNum;
|
||||
verifyPriceDialog.value = true;
|
||||
} else {
|
||||
ElMessage.error('请先同步店铺数据');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user