This commit is contained in:
scout 2025-01-20 22:20:45 +08:00
parent 4da5eb6ba2
commit ae4e18319f
21 changed files with 2247 additions and 0 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
VITE_API_URL=https://warehouse.szjixun.cn

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>购物卡审核</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

1393
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

23
package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "shop-card-approval",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"amfe-flexible": "^2.2.1",
"axios": "^1.6.8",
"element-plus": "^2.6.1",
"postcss": "^8.4.35",
"postcss-pxtorem": "^6.1.0",
"vue": "^3.4.21",
"vue-router": "^4.5.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"vite": "^5.1.6"
}
}

9
postcss.config.cjs Normal file
View File

@ -0,0 +1,9 @@
module.exports = {
plugins: {
'postcss-pxtorem': {
rootValue: 37.5,
propList: ['*'],
selectorBlackList: ['.norem']
}
}
}

1
public/vite.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

9
src/App.vue Normal file
View File

@ -0,0 +1,9 @@
<template>
<router-view></router-view>
</template>
<style scoped>
</style>

28
src/api/approval.js Normal file
View File

@ -0,0 +1,28 @@
import request from '@/utils/request'
// 获取审批详情
export function getApprovalDetail(data) {
return request({
url: '/api/user/inventory/info',
method: 'post',
data
})
}
// 审批通过
export function approveRequest(data) {
return request({
url: '/api/user/inventory/approve',
method: 'post',
data
})
}
// 审批驳回
export function rejectRequest(data) {
return request({
url: '/api/user/inventory/approve',
method: 'post',
data
})
}

BIN
src/assets/bgpic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

1
src/assets/vue.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

BIN
src/assets/yes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,43 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String,
})
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Learn more about IDE Support for Vue in the
<a
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
target="_blank"
>Vue Docs Scaling up Guide</a
>.
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>

12
src/main.js Normal file
View File

@ -0,0 +1,12 @@
import { createApp } from 'vue'
import './style.css'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'amfe-flexible'
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(ElementPlus)
app.use(router)
app.mount('#app')

View File

@ -0,0 +1,319 @@
<template>
<div class="approval-container">
<div class="bg-container">
<div style="padding: 20px; padding-bottom: 100px;">
<div class="content-card">
<div class="info-list">
<div class="info-item">
<span class="label">申请人</span>
<span class="value">{{ detail.userName }}</span>
</div>
<div class="info-item">
<span class="label">序号</span>
<span class="value">{{ detail.ID }}</span>
</div>
<div class="info-item">
<span class="label">商品</span>
<span class="value">{{ detail.productName }}</span>
</div>
<div class="info-item">
<span class="label">出库数量</span>
<span class="value">{{ detail.quantity }}</span>
</div>
<div class="info-item">
<span class="label">备注</span>
<span class="value">{{ detail.remark }}</span>
</div>
<div class="info-item">
<span class="label">提交时间</span>
<span class="value">{{ detail.createdAt }}</span>
</div>
</div>
</div>
</div>
</div>
<div class="button-group" v-if="detail.status === '出库申请中'">
<el-button class="reject-btn" :loading="loading" @click="showReject">驳回</el-button>
<el-button type="primary" class="approve-btn" :loading="loading" @click="showConfirm">通过</el-button>
</div>
<!-- 确认弹窗 -->
<el-dialog
v-model="confirmVisible"
:show-close="false"
width="80%"
align-center
class="confirm-dialog"
>
<div class="dialog-content">
<div class="dialog-text">确认要审核通过</div>
</div>
<div class="dialog-footer">
<div class="dialog-btn-group">
<div class="dialog-btn cancel" @click="confirmVisible = false">取消</div>
<div class="dialog-btn confirm" @click="handleApprove">确定</div>
</div>
</div>
</el-dialog>
<!-- 驳回弹窗 -->
<el-dialog
v-model="rejectVisible"
:show-close="false"
width="80%"
align-center
class="reject-dialog"
>
<div class="dialog-content">
<div class="dialog-text">确认要驳回</div>
</div>
<div class="dialog-footer">
<div class="dialog-btn-group">
<div class="dialog-btn cancel" @click="rejectVisible = false">取消</div>
<div class="dialog-btn confirm" style="color: #CF3050;" @click="handleReject">确定</div>
</div>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { getApprovalDetail, approveRequest, rejectRequest } from '@/api/approval'
const route = useRoute()
const router = useRouter()
const loading = ref(false)
const confirmVisible = ref(false)
const rejectVisible = ref(false)
const detail = ref({
status: '',
userName: '',
ID: '',
productName: '',
quantity: '',
remark: '',
approvalTime: ''
})
// urlID
const approvalID = ref(route.query.id?JSON.parse(route.query.id):null)
//
const getDetail = async () => {
try {
loading.value = true
const res = await getApprovalDetail(
{
id: approvalID.value,
domain: 'fontree'
}
)
if (res.status === 0) {
detail.value = res.data
}else {
ElMessage.error(res.msg)
}
} catch (error) {
console.error('获取详情失败:', error)
ElMessage.error('获取详情失败')
} finally {
loading.value = false
}
}
const showConfirm = () => {
confirmVisible.value = true
}
const showReject = () => {
rejectVisible.value = true
}
//
const handleApprove = async () => {
try {
loading.value = true
confirmVisible.value = false
const res = await approveRequest({
id: approvalID.value,
status: true
})
if (res.status === 0) {
ElMessage.success('审批通过')
getDetail()
}else {
console.log(res)
ElMessage.error(res.msg)
}
} catch (error) {
console.error('审批失败:', error)
} finally {
loading.value = false
}
}
//
const handleReject = async () => {
try {
loading.value = true
rejectVisible.value = false
const res = await rejectRequest({
id: approvalID.value,
status: false
})
if (res.status === 0) {
ElMessage.success('已驳回')
getDetail()
}else {
ElMessage.error(res.msg)
}
} catch (error) {
console.error('驳回失败:', error)
} finally {
loading.value = false
}
}
onMounted(() => {
getDetail()
})
</script>
<style scoped>
.approval-container {
min-height: 100vh;
height: 100%;
display: flex;
flex-direction: column;
background-image: url('../assets/bgpic.png');
background-size: 100% 100%;
background-repeat: no-repeat;
position: relative;
}
.bg-container {
flex: 1;
display: flex;
flex-direction: column;
box-sizing: border-box;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.content-card {
background: white;
border-radius: 4px;
padding: 0px 20px 0px 20px;
margin-top: 180px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}
.info-list {
display: flex;
flex-direction: column;
}
.info-item {
display: flex;
justify-content: space-between;
padding: 12px 0;
border-bottom: 1px solid #eee;
}
.info-item:last-child {
border-bottom: none;
}
.label {
color: #333;
font-size: 14px;
}
.value {
color: #333;
font-size: 14px;
font-weight: 500;
}
.button-group {
position: fixed;
left: 0;
right: 0;
bottom: 0;
display: flex;
gap: 12px;
padding: 12px 20px;
background-color: #fff;
padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.reject-btn {
flex: 1;
height: 44px;
font-size: 16px;
border: none;
background: #E6E6E6;
color: #1936C9;
}
.approve-btn {
flex: 1;
height: 44px;
font-size: 16px;
border: none;
background: #1936C9;
color: #fff;
}
/* 弹窗样式 */
:deep(.el-dialog) {
border-radius: 8px;
margin-top: 40vh !important;
padding: 0 !important;
}
:deep(.el-dialog__body) {
padding: 0;
}
.confirm-dialog {
}
.dialog-content {
padding: 40px;
}
.dialog-text {
font-size: 16px;
color: #333;
text-align: center;
}
.dialog-footer {
border-top: 1px solid #eee;
}
.dialog-btn-group {
display: flex;
width: 100%;
}
.dialog-btn {
flex: 1;
text-align: center;
padding: 12px 0;
font-size: 16px;
cursor: pointer;
}
.dialog-btn.cancel {
color: #666;
border-right: 1px solid #eee;
}
.dialog-btn.confirm {
color: #1936C9;
}
</style>

View File

@ -0,0 +1,190 @@
<template>
<div class="approval-container">
<div class="bg-container">
<div style="padding: 20px; padding-bottom: 100px;">
<div class="content-card" style="">
<div class="info-list">
<div class="info-item">
<span class="label">申请人</span>
<span class="value">{{detail.userName}}</span>
</div>
<div class="info-item">
<span class="label">序号</span>
<span class="value">{{detail.ID}}</span>
</div>
<div class="info-item">
<span class="label">商品</span>
<span class="value">{{detail.productName}}</span>
</div>
<div class="info-item">
<span class="label">出库数量</span>
<span class="value">{{detail.quantity}}</span>
</div>
<div class="info-item">
<span class="label">备注</span>
<span class="value">{{detail.remark}}</span>
</div>
<div class="info-item">
<span class="label">提交时间</span>
<span class="value">{{detail.createdAt}}</span>
</div>
</div>
</div>
<div class="content-card" style="margin-top: 12px;">
<div class="info-list">
<div class="info-item" style="border-bottom: none;">
<span class="label" >审批人</span>
</div>
<div class="info-item" style="align-items: center;">
<span class="label">
<div class="label-text">{{detail.approveUser}}</div>
<div class="label-text">{{detail.approvalTime}}</div>
</span>
<span v-if="detail.status === '已出库'" class="value"><img src="../assets/yes.png" style="width: 20px; height: 20px;" /></span>
<!-- <span v-else class="value"><img src="../assets/no.png" style="width: 20px; height: 20px;" /></span> -->
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { getApprovalDetail } from '@/api/approval'
const route = useRoute()
const router = useRouter()
const loading = ref(false)
const confirmVisible = ref(false)
const rejectVisible = ref(false)
const detail = ref({
status: '',
userName: '',
ID: '',
productName: '',
quantity: '',
remark: '',
approvalTime: ''
})
// urlID
const approvalID = ref(JSON.parse(route.query.id))
//
const getDetail = async () => {
try {
loading.value = true
const res = await getApprovalDetail(
{
id: approvalID.value,
domain: 'fontree'
}
)
if (res.status === 0) {
detail.value = res.data
}else {
ElMessage.error(res.msg)
}
} catch (error) {
console.error('获取详情失败:', error)
ElMessage.error('获取详情失败')
} finally {
loading.value = false
}
}
onMounted(() => {
getDetail()
})
</script>
<style scoped>
.approval-container {
min-height: 100vh;
height: 100%;
display: flex;
flex-direction: column;
background-image: url('../assets/bgpic.png');
background-size: 100% 100%;
background-repeat: no-repeat;
position: relative;
}
.bg-container {
flex: 1;
display: flex;
flex-direction: column;
box-sizing: border-box;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.content-card {
background: white;
border-radius: 4px;
padding: 0px 20px 0px 20px;
margin-top: 180px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}
.info-list {
display: flex;
flex-direction: column;
}
.info-item {
display: flex;
justify-content: space-between;
padding: 12px 0;
border-bottom: 1px solid #eee;
}
.info-item:last-child {
border-bottom: none;
}
.label {
color: #333;
font-size: 14px;
}
.value {
color: #333;
font-size: 14px;
font-weight: 500;
}
.button-group {
position: fixed;
left: 0;
right: 0;
bottom: 0;
display: flex;
gap: 12px;
padding: 12px 20px;
background-color: #fff;
padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.reject-btn {
flex: 1;
height: 44px;
font-size: 16px;
border: none;
background: #E6E6E6;
color: #1936C9;
}
.approve-btn {
flex: 1;
height: 44px;
font-size: 16px;
border: none;
background: #1936C9;
color: #fff;
}
</style>

25
src/router/index.js Normal file
View File

@ -0,0 +1,25 @@
import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
{
path: '/',
redirect: '/approval-detail'
},
{
path: '/approval-detail',
name: 'ApprovalDetail',
component: () => import('../pages/ApprovalDetail.vue')
},
{
path: '/approval-result',
name: 'ApprovalResult',
component: () => import('../pages/ApprovalResult.vue')
}
]
const router = createRouter({
history: createWebHashHistory(),
routes
})
export default router

84
src/style.css Normal file
View File

@ -0,0 +1,84 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
* {
margin: 0;
padding: 0;
}
html,
body {
width: 100%;
height: 100%;
overflow: inherit;
}
#app {
/* text-align: center; */
color: #2c3e50;
font-size: 14px;
font-weight: Regular;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.card {
padding: 2em;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

44
src/utils/request.js Normal file
View File

@ -0,0 +1,44 @@
import axios from 'axios'
import { ElMessage } from 'element-plus'
const service = axios.create({
baseURL: import.meta.env.VITE_API_URL,
timeout: 15000
})
// Request interceptor
service.interceptors.request.use(
config => {
// Add token if needed
// const token = localStorage.getItem('token')
// if (token) {
// config.headers['Authorization'] = `Bearer ${token}`
// }
config.headers['Content-Type'] = config.method === 'get' ? 'application/x-www-form-urlencoded' : 'application/json'
return config
},
error => {
console.error(error)
return Promise.reject(error)
}
)
// Response interceptor
service.interceptors.response.use(
response => {
const res = response.data
if (res.status === 1) {
// ElMessage.error(res.message || 'Error')
// return Promise.reject(new Error(res.msg || 'Error'))
}
return res
},
error => {
console.error('err' + error)
// ElMessage.error(error.message || 'Request Error')
return Promise.reject(error)
}
)
export default service

25
vite.config.js Normal file
View File

@ -0,0 +1,25 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path"
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
base: './',
server: {
host: true,
open: true,
hmr: true,
},
resolve: {
alias: [
{
find: "@",
replacement: resolve(__dirname, 'src')
},
{
find: "@/static",
replacement: resolve(__dirname, 'src/static')
}
]
},
})