Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-08-27 15:44:42 +08:00
commit 8b4af2d868
18 files changed
+728 -401

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
import request from "/@/utils/request"
export function fetchList(query?: Object) {
return request({
url: "/admin/sysUserCar/page",
method: "get",
params: query,
})
}
export function addObj(obj?: Object) {
return request({
url: "/admin/sysUserCar",
method: "post",
data: obj,
})
}
export function getObj(id?: string) {
return request({
url: "/admin/sysUserCar/" + id,
method: "get",
})
}
export function delObjs(ids?: Object) {
return request({
url: "/admin/sysUserCar",
method: "delete",
data: ids,
})
}
export function putObj(obj?: Object) {
return request({
url: "/admin/sysUserCar",
method: "put",
data: obj,
})
}
+8 -17
View File
@@ -1,20 +1,10 @@
<!-- excel 导入组件 -->
<template>
<el-dialog :title="prop.title" v-model="state.upload.open" :close-on-click-modal="false" draggable>
<el-upload
v-loading="state.upload.isUploading"
ref="uploadRef"
:limit="1"
accept=".xlsx, .xls"
:headers="headers"
:action="baseURL + other.adaptationUrl(url)"
:disabled="state.upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileError"
:auto-upload="false"
drag
>
<el-upload v-loading="state.upload.isUploading" ref="uploadRef" :limit="1" accept=".xlsx, .xls"
:headers="headers" :action="baseURL + other.adaptationUrl(url)" :disabled="state.upload.isUploading"
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :on-error="handleFileError"
:auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
{{ $t("excel.operationNotice") }}
@@ -23,8 +13,8 @@
<template #tip>
<div class="el-upload__tip text-center">
<span>{{ $t("excel.fileFormat") }}</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="downExcelTemp" v-if="tempUrl"
>{{ $t("excel.downloadTemplate") }}
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
@click="downExcelTemp" v-if="tempUrl">{{ $t("excel.downloadTemplate") }}
</el-link>
</div>
</template>
@@ -38,7 +28,8 @@
</el-dialog>
<!--校验失败错误数据-->
<el-dialog :title="$t('excel.validationFailureData')" v-model="state.errorVisible" :close-on-click-modal="false" draggable>
<el-dialog :title="$t('excel.validationFailureData')" v-model="state.errorVisible" :close-on-click-modal="false"
draggable>
<el-table :data="state.errorData">
<el-table-column property="lineNum" align="center" :label="$t('excel.lineNumbers')" width="100" />
<el-table-column property="errors" align="center" :label="$t('excel.misDescription')" show-overflow-tooltip>
+114
View File
@@ -0,0 +1,114 @@
<template>
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="用户" prop="userId">
<select-user v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="车牌号" prop="carNumber">
<el-input v-model="form.carNumber" placeholder="请输入车牌号" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="车辆类型" prop="carType">
<dict-select v-model="form.carType" dict-code="car_type" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="SysUserCarDialog">
import { useDict } from '/@/hooks/dict';
import { useMessage } from "/@/hooks/message";
import { getObj, addObj, putObj } from '/@/api/admin/sysUserCar'
import { rule } from '/@/utils/validate';
const emit = defineEmits(['refresh']);
// 定义变量内容
const dataFormRef = ref();
const visible = ref(false)
const loading = ref(false)
// 定义字典
const { car_type } = useDict("car_type")
// 提交表单数据
const form = reactive({
id: '',
userId: '',
carNumber: '',
carType: '',
enableStatus: '',
});
// 定义校验规则
const dataRules = ref({
userId: [{ required: true, message: '请选择用户', trigger: 'change' }],
carNumber: [{ required: true, message: '请输入车牌号', trigger: 'blur' }],
carType: [{ required: true, message: '请选择车辆类型', trigger: 'change' }],
})
// 打开弹窗
const openDialog = (id: string) => {
visible.value = true
form.id = ''
// 重置表单数据
nextTick(() => {
dataFormRef.value?.resetFields();
});
// 获取sysUserCar信息
if (id) {
form.id = id
getsysUserCarData(id)
}
};
// 提交
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => { });
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(form.id ? '修改成功' : '添加成功');
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
// 初始化表单数据
const getsysUserCarData = (id: string) => {
// 获取数据
loading.value = true
getObj(id).then((res: any) => {
Object.assign(form, res.data)
}).finally(() => {
loading.value = false
})
};
// 暴露变量
defineExpose({
openDialog
});
</script>
+161
View File
@@ -0,0 +1,161 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<el-row v-show="showSearch">
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-form-item style="width: 250px" label="用户" prop="userId">
<select-user v-model="state.queryForm.userId" clearable />
</el-form-item>
<el-form-item style="width: 250px" label="车牌号" prop="carNumber">
<el-input v-model="state.queryForm.carNumber" placeholder="请输入车牌号" />
</el-form-item>
<el-form-item style="width: 250px" label="车辆类型" prop="carType">
<dict-select v-model="state.queryForm.carType" dict-code="car_type" />
</el-form-item>
<el-form-item style="width: 250px" label="是否启用" prop="enableStatus">
<dict-select v-model="state.queryForm.enableStatus" dict-code="yes_no_type" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">查询</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<div class="mb8" style="width: 100%">
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
v-auth="'admin_sysUserCar_add'">
新 增
</el-button>
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'admin_sysUserCar_del'"
@click="handleDelete(selectObjs)">
删除
</el-button>
<right-toolbar v-model:showSearch="showSearch" :export="'admin_sysUserCar_export'" @exportExcel="exportExcel"
class="ml10 mr20" style="float: right;" @queryTable="getDataList"></right-toolbar>
</div>
</el-row>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
@sort-change="sortChangeHandle">
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="80" />
<el-table-column prop="username" label="用户名" />
<el-table-column prop="userDeptName" label="部门" />
<el-table-column prop="carNumber" label="车牌号">
<template #default="{ row }">
<el-tag type="primary">{{ row.carNumber }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="carType" label="车辆类型">
<template #default="{ row }">
<dict-tag :options="car_type" :value="row.carType" />
</template>
</el-table-column>
<el-table-column prop="enableStatus" label="是否启用">
<template #default="{ row }">
<el-switch active-value="1" inactive-value="0" v-model="row.enableStatus"
@change="enableStatusChange(row)" />
</template>
</el-table-column>
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button icon="edit-pen" text type="primary" v-auth="'admin_sysUserCar_edit'"
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
<el-button icon="delete" text type="primary" v-auth="'admin_sysUserCar_del'"
@click="handleDelete([scope.row.id])">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
</div>
</template>
<script setup lang="ts" name="systemSysUserCar">
import { BasicTableProps, useTable } from "/@/hooks/table";
import * as sysUserCarApi from "/@/api/admin/sysUserCar";
import { useMessage, useMessageBox } from "/@/hooks/message";
import { useDict } from '/@/hooks/dict';
// 引入组件
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
// 定义查询字典
const { car_type } = useDict("car_type")
// 定义变量内容
const formDialogRef = ref()
// 搜索变量
const queryRef = ref()
const showSearch = ref(true)
// 多选变量
const selectObjs = ref([]) as any
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {},
pageList: sysUserCarApi.fetchList
})
// table hook
const {
getDataList,
currentChangeHandle,
sizeChangeHandle,
sortChangeHandle,
downBlobFile,
tableStyle
} = useTable(state)
// 清空搜索条件
const resetQuery = () => {
// 清空搜索条件
queryRef.value?.resetFields()
// 清空多选
selectObjs.value = []
getDataList()
}
// 导出excel
const exportExcel = () => {
downBlobFile('/admin/sysUserCar/export', Object.assign(state.queryForm, { ids: selectObjs }), 'sysUserCar.xlsx')
}
// 多选事件
const selectionChangHandle = (objs: { id: string }[]) => {
selectObjs.value = objs.map(({ id }) => id);
multiple.value = !objs.length;
};
// 删除操作
const handleDelete = async (ids: string[]) => {
try {
await useMessageBox().confirm('此操作将永久删除');
} catch {
return;
}
try {
await sysUserCarApi.delObjs(ids);
getDataList();
useMessage().success('删除成功');
} catch (err: any) {
useMessage().error(err.msg);
}
};
// 修改启用状态
async function enableStatusChange(row: any) {
try {
await sysUserCarApi.putObj(row)
getDataList()
useMessage().success("操作成功")
} catch (e) {
useMessage().error("操作错误")
}
}
</script>
@@ -54,6 +54,11 @@
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="40" />
<el-table-column prop="merchantId" label="商户" show-overflow-tooltip min-width="100">
<template #default="{ row }">
{{ merchantOptions.find((item: any) => item.id === row.merchantId)?.name }}
</template>
</el-table-column>
<el-table-column prop="name" label="分类名称" show-overflow-tooltip />
<el-table-column prop="categoryType" label="餐段类型" show-overflow-tooltip width="180">
<template #default="scope">
@@ -98,6 +103,7 @@ import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchList, delObjs } from "/@/api/canteen/canteenOnlineCategory"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { select } from "/@/api/wallet/mch-manage"
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
@@ -112,12 +118,26 @@ const showSearch = ref(true)
// 多选变量
const selectObjs = ref([]) as any
const multiple = ref(true)
const merchantOptions = ref<any>([]) // 商户
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {},
pageList: fetchList,
})
onMounted(async () => {
await getCanteenMerchant()
})
const getCanteenMerchant = async () => {
try {
const res = await select({ current: 1, size: 9999, types: 1 })
merchantOptions.value = res.data.records
} catch (error) {
merchantOptions.value = []
}
}
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
@@ -128,6 +128,7 @@ const openDialog = async () => {
dialogVisible.value = true
merchantId.value = ""
getDataList(false)
tableRef.value.clearSelection()
}
// 获取商品数据并且勾选
@@ -166,10 +167,11 @@ const resetQuery = () => {
// 商品选择对话框确认
const dialogConfirm = async () => {
if (!merchantId.value) return useMessage().error("请选择商户")
const $table = tableRef.value
if ($table) {
const currentSelectedRows = $table.getSelectionRows()
if (!currentSelectedRows.length) return useMessage().error("请勾选菜品")
if (!merchantId.value) return useMessage().error("请选择商户")
const items = currentSelectedRows.map((item: any) => {
return {
+30 -18
View File
@@ -66,6 +66,11 @@
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column prop="merchantId" label="商户" show-overflow-tooltip min-width="100">
<template #default="{ row }">
{{ merchantOptions.find((item: any) => item.id === row.merchantId)?.name }}
</template>
</el-table-column>
<el-table-column prop="name" label="商品名称" show-overflow-tooltip min-width="100" />
<el-table-column prop="categoryId" label="商品分类" show-overflow-tooltip min-width="100">
<template #default="{ row }">
@@ -77,30 +82,25 @@
<preview-image :src="scope.row.picUrl" />
</template>
</el-table-column>
<el-table-column prop="sort" label="排序字段" show-overflow-tooltip min-width="100" />
<el-table-column prop="status" label="商品上下架" show-overflow-tooltip min-width="100">
<template #default="scope">
<dict-tag :options="spu_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="dishTypeName" label="上架类型" show-overflow-tooltip min-width="100">
<template #default="scope">
<el-tag v-show="scope.row.dishType == 1" type="success">{{ scope.row.dishTypeName}}</el-tag>
<el-tag v-show="scope.row.dishType == 2" type="primary">{{ scope.row.dishTypeName}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="price" label="商品价格" show-overflow-tooltip min-width="100">
<template #default="scope">
{{ displayPrice(scope.row.price) }}
</template>
</el-table-column>
<!-- <el-table-column prop="marketPrice" label="市场价" show-overflow-tooltip min-width="100">-->
<!-- <template #default="scope">-->
<!-- {{ displayPrice(scope.row.marketPrice) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="stock" label="库存" show-overflow-tooltip min-width="100" />
<el-table-column prop="salesCount" label="商品销量" show-overflow-tooltip min-width="100" />
<el-table-column prop="dishTypeName" label="上架类型" show-overflow-tooltip min-width="100">
<template #default="scope">
<el-tag v-show="scope.row.dishType == 1" type="success">{{ scope.row.dishTypeName }}</el-tag>
<el-tag v-show="scope.row.dishType == 2" type="primary">{{ scope.row.dishTypeName }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="salesCount" label="销量" show-overflow-tooltip min-width="100" />
<el-table-column prop="status" label="商品上下架" show-overflow-tooltip min-width="100">
<template #default="scope">
<dict-tag :options="spu_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="sort" label="排序字段" show-overflow-tooltip min-width="100" />
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip min-width="160" />
<el-table-column label="操作" width="150" fixed="right">
<template #default="scope">
@@ -136,6 +136,7 @@ import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
import { fetchList as getCanteenOnlineCategory } from "/@/api/canteen/canteenOnlineCategory"
import { select } from "/@/api/wallet/mch-manage"
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const ExportFormDialog = defineAsyncComponent(() => import("./export-form.vue"))
@@ -151,12 +152,14 @@ const showSearch = ref(true)
const selectObjs = ref([]) as any
const multiple = ref(true)
const categoryOptions = ref<any>([]) // 商品分类选项
const merchantOptions = ref<any>([]) // 商户
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {},
pageList: fetchList,
})
onMounted(async () => {
await getCanteenMerchant()
await getCanteenOnlineCategoryAll()
})
@@ -169,6 +172,15 @@ const getCanteenOnlineCategoryAll = async () => {
}
}
const getCanteenMerchant = async () => {
try {
const res = await select({ current: 1, size: 9999, types: 1 })
merchantOptions.value = res.data.records
} catch (error) {
merchantOptions.value = []
}
}
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
// 清空搜索条件
+15 -113
View File
@@ -39,17 +39,14 @@
<div class="w-full">
<div class="w-full flex flex-wrap items-center justify-center" v-for="(hourType, index) in foodData" :key="index">
<div v-for="dish in hourType" :key="dish.id" class="w-60 p-2">
<div class="h-32 overflow-hidden">
<!-- <div class="absolute inset-0 bg-gradient-to-b from-transparent"></div> -->
<div class="relative h-32 overflow-hidden">
<img :src="imageBaseUrl + dish.picUrl" :alt="dish.name" class="h-full w-full object-cover" />
<!-- <div class="absolute left-2 top-2 rounded-lg">
<el-tag type="primary">午餐</el-tag>
</div> -->
<!-- <div class="absolute right-1 top-2 rounded-lg px-2 py-0.5 text-sm">
<el-tag type="primary">
{{ canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.name }}
</el-tag>
</div> -->
<div class="absolute left-1 top-1">
<star-medal text="午餐" />
</div>
<div class="absolute left-1 top-1">
<star-medal :text="canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.name" />
</div>
</div>
<div
class="w-full flex items-center justify-between bg-[#AEBBF9]/40 px-2 pb-4 backdrop-blur-sm rounded-bl-[50%] rounded-br-[50%]"
@@ -68,8 +65,14 @@
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from "vue"
import { selectTimeFoodApi } from "/@/api/canteen/canteenDailyMenu"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { displayPrice } from "/@/utils/formatMoney"
import { useMessage } from "/@/hooks/message"
import { ElTooltip } from "element-plus"
import dayjs from "dayjs"
import StarMedal from "./star-medal.vue"
const containerRef = ref<HTMLElement | null>(null)
const currentDate = ref(dayjs().format("YYYY/MM/DD"))
@@ -96,7 +99,7 @@ const foodData = reactive<{
dinner: [],
})
const canteenCategoryOption = ref<any>()
let timer: number
let timer: number | null = null
onMounted(async () => {
timer = setInterval(() => (currentTime.value = dayjs().format("HH:mm:ss")), 1000)
@@ -182,6 +185,7 @@ const getDishByType = async () => {
}
})
}
// 获取食堂菜品分类
const getCanteenDishesCategory = async () => {
try {
@@ -193,108 +197,6 @@ const getCanteenDishesCategory = async () => {
canteenCategoryOption.value = []
}
}
// =====================================
import { ref, onMounted, onUnmounted, computed, watch, nextTick } from "vue"
import { selectTimeFoodApi } from "/@/api/canteen/canteenDailyMenu"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { displayPrice } from "/@/utils/formatMoney"
import { useMessage } from "/@/hooks/message"
const scrollContainerRef = ref<HTMLElement | null>(null)
let scrollOffset = ref(0)
let isScrolling = ref(true)
let lastTimestamp = 0
const SCROLL_SPEED = 0.5
let animationFrame: number | null = null
// 添加一个计算属性来判断是否需要滚动
const needScroll = ref(false)
// 优化后的滚动处理函数
const handleScroll = (timestamp: number) => {
if (!isScrolling.value) return
if (!lastTimestamp) {
lastTimestamp = timestamp
}
const deltaTime = timestamp - lastTimestamp
lastTimestamp = timestamp
const container = scrollContainerRef.value
if (!container) return
// 计算新的滚动偏移量
scrollOffset.value += SCROLL_SPEED * (deltaTime / 16)
const contentHeight = container.scrollHeight / 2 // 单个内容的高度
// 当滚动超过一个内容高度时,减去一个内容高度,造成无缝衔接的效果
if (scrollOffset.value >= contentHeight) {
scrollOffset.value -= contentHeight
}
animationFrame = requestAnimationFrame(handleScroll)
}
// 开始滚动
const startScroll = () => {
if (!isScrolling.value || !needScroll.value) return
lastTimestamp = 0
animationFrame = requestAnimationFrame(handleScroll)
}
// 停止滚动
const stopScroll = () => {
if (animationFrame) {
cancelAnimationFrame(animationFrame)
animationFrame = null
}
}
// 切换滚动状态
const toggleScroll = () => {
isScrolling.value = !isScrolling.value
if (isScrolling.value) {
startScroll()
} else {
stopScroll()
}
}
// 修改检查是否需要滚动的函数
const checkNeedScroll = () => {
const container = scrollContainerRef.value
if (!container) return false
// 获取内容的实际高度(不包括克隆的内容)
const contentHeight = container.querySelector(".grid")?.getBoundingClientRect().height || 0
// 获取容器的可视高度
const containerHeight = container.clientHeight
// 更新是否需要滚动的状态
needScroll.value = contentHeight > containerHeight
// 如果不需要滚动,确保停止滚动并重置位置
if (!needScroll.value) {
stopScroll()
isScrolling.value = false
scrollOffset.value = 0
}
return needScroll.value
}
// 防抖函数
function debounce(fn: Function, delay: number) {
let timer: number | null = null
return function (this: any, ...args: any[]) {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this, args)
}, delay)
}
}
</script>
<style scoped lang="scss">
@@ -0,0 +1,29 @@
<template>
<div class="star-medal">{{ text }}</div>
</template>
<script setup lang="ts">
defineProps({
text: {
type: String,
default: "未知",
},
})
</script>
<style scoped>
.star-medal {
width: 30px;
height: 30px;
z-index: 100;
text-align: center;
line-height: 20px;
font-size: 12px;
border-radius: 4px;
background-color: #436df7;
color: #fff;
font-weight: bold;
-webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 75% 75%, 75% 100%, 50% 75%, 0% 75%);
clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 75% 75%, 75% 100%, 50% 75%, 0% 75%);
}
</style>
+4 -10
View File
@@ -1,19 +1,13 @@
<template>
<el-dialog title="购物车" v-model="visible" :close-on-click-modal="false" draggable>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@sort-change="sortChangeHandle"
show-summary
:summary-method="getSummaries"
>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle" show-summary
:summary-method="getSummaries">
<el-table-column label="商品名" align="center" prop="productName" />
<el-table-column label="商品图片" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
<div v-else class="w-[50px] h-[50px]" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="productPrice">
+8 -6
View File
@@ -66,7 +66,7 @@
</el-descriptions>
<el-descriptions :column="3" title="货柜信息" border>
<template #extra>
<template v-if="state.deviceDetail" #extra>
<el-space>
<el-button icon="RefreshRight" type="primary" @click="refreshCabinetQrCode">刷新货柜二维码</el-button>
<el-button icon="CircleCheck" type="primary" @click="checkOpenAccess" :disabled="checkCloseLoading" :loading="checkOpenLoading">
@@ -84,7 +84,7 @@
</el-space>
</template>
</el-descriptions>
<el-tabs type="border-card" @tab-click="doorTabClick">
<el-tabs v-if="state.deviceDetail" type="border-card" @tab-click="doorTabClick">
<el-tab-pane
v-if="state.deviceDetail.cabinetList?.length"
:label="state.deviceDetail.deviceCode + '-' + item.cabinetNo"
@@ -130,6 +130,7 @@
</el-descriptions>
</el-tab-pane>
</el-tabs>
<el-empty v-else description="无货柜信息" />
<el-descriptions :column="0" title="货柜商品" border>
<!-- <template #extra>
@@ -137,7 +138,7 @@
</template> -->
</el-descriptions>
<el-tabs type="border-card" @tab-click="tabClick">
<el-tabs v-if="state.deviceDetail" type="border-card" @tab-click="tabClick">
<el-tab-pane
v-if="state.deviceDetail.cabinetList?.length"
:label="state.deviceDetail.deviceCode + '-' + item.cabinetNo"
@@ -150,12 +151,12 @@
<div class="text-center w-24 text-lg font-bold">第 {{ floorIndex + 1 }} 层:</div>
<div class="flex flex-wrap">
<div class="flex flex-col items-center justify-start" v-for="(v, indexNo) in floorItem[floorIndex + 1]" :key="indexNo">
<div v-if="v.spuId && v.spuDetail" class="w-20 mx-4 my-1 flex flex-col items-center">
<div v-if="v.spuId && v.spuDetail" class="w-24 mx-4 my-1 flex flex-col items-center">
<div class="relative">
<el-icon @click.stop="deleteGoods(v)" class="absolute right-[-8px] top-[-8px] text-xl text-blue-600 z-50">
<CircleClose />
</el-icon>
<preview-image width="86px" height="86px" :src="v.spuDetail.pic" @click.stop />
<preview-image width="96px" height="86px" :src="v.spuDetail.pic" @click.stop />
</div>
<el-tooltip effect="dark" :content="v.spuDetail?.name">
<div class="line-clamp-1">{{ v.spuDetail?.name }}</div>
@@ -179,7 +180,7 @@
</div>
<div
v-else
class="bg-blue-50 w-20 h-20 border border-black mx-4 my-1 flex items-center justify-center cursor-pointer rounded-lg"
class="bg-blue-50 w-24 h-20 border border-black mx-4 my-1 flex items-center justify-center cursor-pointer rounded-lg"
@click="clickPutaway(v.id)"
>
点击上架
@@ -190,6 +191,7 @@
</div>
</el-tab-pane>
</el-tabs>
<el-empty v-else description="无货柜商品" />
</div>
<!-- 柜子设置 -->
@@ -1,129 +0,0 @@
<template>
<el-dialog title="后台退款" v-model="visible" width="30%" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="120px" v-loading="loading">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="售后方式" prop="way">
<dict-select disabled v-model="form.way" dict-code="hard_after_sale_way" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="退款原因" prop="applyReason">
<el-select v-model="form.applyReason">
<el-option v-for="reason in state.setting.afterSaleRefundReasons" :key="reason" :label="reason" :value="reason" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="补充凭证图片" prop="applyPicUrls">
<upload-imgs v-model="form.applyPicUrls" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="相关描述" prop="applyDescription">
<el-input v-model="form.applyDescription" placeholder="请输入备注" type="textarea" :autosize="{ minRows: 6 }" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="admin-refund-dialog">
import { useMessage } from "/@/hooks/message"
import * as hardAfterSaleApi from "/@/api/hard/hard-after-sale"
import * as walletSettingApi from "/@/api/wallet/wallet-setting"
const emit = defineEmits(["refresh"])
// 定义变量内容
const dataFormRef = ref()
const visible = ref(false)
const loading = ref(false)
// 定义字典
// 提交表单数据
const form = reactive({
orderId: "",
way: "10",
applyReason: "",
applyPicUrls: "",
applyDescription: "",
})
const state = reactive<any>({
setting: {},
})
// 定义校验规则
const dataRules = ref({
way: [{ required: true, message: "请选择售后方式", trigger: "change" }],
applyReason: [{ required: true, message: "请选择退款原因", trigger: "change" }],
})
// 打开弹窗
const openDialog = (id: string) => {
visible.value = true
form.orderId = ""
// 重置表单数据
nextTick(() => {
dataFormRef.value?.resetFields()
})
// 获取hardwareOrder信息
if (id) {
form.orderId = id
gethardwareOrderData(id)
}
}
// 初始化表单数据
const gethardwareOrderData = async (id: string) => {
// 获取数据
loading.value = true
try {
const { data } = await walletSettingApi.getObj()
if (data.afterSaleRefundReasons) {
data.afterSaleRefundReasons = data.afterSaleRefundReasons?.split(",")
}
if (data.afterSaleReturnReasons) {
data.afterSaleReturnReasons = data.afterSaleReturnReasons?.split(",")
}
state.setting = data
} finally {
loading.value = false
}
}
// 提交
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => {})
if (!valid) return false
try {
loading.value = true
await hardAfterSaleApi.adminRefund(form)
useMessage().success("退款成功")
visible.value = false
emit("refresh")
} catch (err: any) {
useMessage().error(err.msg)
} finally {
loading.value = false
}
}
// 暴露变量
defineExpose({
openDialog,
})
</script>
@@ -0,0 +1,90 @@
<template>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="120px">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="售后方式" prop="way">
<dict-select disabled v-model="form.way" dict-code="hard_after_sale_way" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="退款原因" prop="applyReason">
<el-select v-model="form.applyReason">
<el-option v-for="reason in state.setting.afterSaleRefundReasons" :key="reason" :label="reason"
:value="reason" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="补充凭证图片" prop="applyPicUrls">
<upload-imgs v-model="form.applyPicUrls" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="相关描述" prop="applyDescription">
<el-input v-model="form.applyDescription" placeholder="请输入备注" type="textarea"
:autosize="{ minRows: 6 }" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script setup lang="ts">
import * as walletSettingApi from "/@/api/wallet/wallet-setting"
// 定义变量内容
const dataFormRef = ref()
// 提交表单数据
const form = reactive({
orderId: "",
way: "10",
applyReason: "",
applyPicUrls: "",
applyDescription: "",
})
const state = reactive<any>({
setting: {},
})
onMounted(() => {
getSetting()
})
// 定义校验规则
const dataRules = ref({
way: [{ required: true, message: "请选择售后方式", trigger: "change" }],
applyReason: [{ required: true, message: "请选择退款原因", trigger: "change" }],
})
// 初始化表单数据
const getSetting = async () => {
try {
const { data } = await walletSettingApi.getObj()
if (data.afterSaleRefundReasons) {
data.afterSaleRefundReasons = data.afterSaleRefundReasons?.split(",")
}
if (data.afterSaleReturnReasons) {
data.afterSaleReturnReasons = data.afterSaleReturnReasons?.split(",")
}
state.setting = data
} catch (error: any) {
console.log(error);
}
}
// 提交
const validate = async () => {
const valid = await dataFormRef.value.validate().catch(() => { })
if (!valid) return false
return form
}
defineExpose({
validate,
})
</script>
@@ -0,0 +1,108 @@
<template>
<el-dialog title="后台退款" v-model="visible" width="50%" :close-on-click-modal="false" draggable>
<el-tabs v-model="state.currentTab" class="demo-tabs" @tab-click="tabClick">
<el-tab-pane v-for="(v) in data.tabs" :key="v.name" :label="v.label" :name="v.name" />
</el-tabs>
<div class="container" v-loading="loading">
<refund-form ref="refundFormRef" v-if="state.currentTab === 'INFO'" />
<refund-table ref="refundTableRef" v-if="state.currentTab === 'CAR'" />
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="admin-refund-dialog">
import { useMessage } from "/@/hooks/message"
import * as hardAfterSaleApi from "/@/api/hard/hard-after-sale"
const RefundForm = defineAsyncComponent(() => import("./form.vue"))
const RefundTable = defineAsyncComponent(() => import("./table.vue"))
const emit = defineEmits(["refresh"])
const data = {
tabs: [
{
label: "退款信息",
name: "INFO",
},
{
label: "退款购物车",
name: "CAR",
},
]
}
const refundTableRef = ref()
const refundFormRef = ref()
// 定义变量内容
const visible = ref(false)
const loading = ref(false)
const state = reactive<any>({
currentTab: data.tabs[0].name,
setting: {},
orderId: "",
})
// 打开弹窗
const openDialog = (id: string) => {
visible.value = true
state.orderId = id
}
function tabClick(e: any) {
console.log("tabClick", e);
nextTick(async () => {
loading.value = true
try {
await new Promise((resolve) => setTimeout(() => resolve(true), 250))
switch (e.paneName) {
case "CAR":
refundTableRef.value?.getCarList(state.orderId)
break
}
await new Promise((resolve) => setTimeout(() => resolve(true), 250))
} catch (error: any) {
console.log(error);
} finally {
loading.value = false
}
})
}
// 提交
const onSubmit = async () => {
try {
loading.value = true
const _data = {}
await hardAfterSaleApi.adminRefund(_data)
useMessage().success("退款成功")
visible.value = false
emit("refresh")
} catch (err: any) {
useMessage().error(err.msg)
} finally {
loading.value = false
}
}
// 暴露变量
defineExpose({
openDialog,
})
</script>
<style>
.container {
min-height: 450px;
}
</style>
@@ -0,0 +1,51 @@
<template>
<el-table :data="state.dataList" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle" show-summary
:summary-method="getSummaries">
<el-table-column label="商品名" align="center" prop="productName" />
<el-table-column label="商品图片" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
<div v-else class="w-[50px] h-[50px]" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="productPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.productPrice) }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" align="center" prop="productCount" />
<el-table-column label="商品总额" align="center" prop="totalPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.totalPrice) }}</span>
</template>
</el-table-column>
</el-table>
</template>
<script setup lang="ts">
import { BasicTableProps, useTable } from "/@/hooks/table"
import { displayPrice } from "/@/utils/formatMoney"
import * as hardCar from "/@/api/hard/hard-car"
const state: BasicTableProps = reactive<BasicTableProps>({
createdIsNeed: false,
queryForm: {},
pageList: hardCar.getCarByOrderId,
})
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
const getCarList = (orderId: string) => {
state.queryForm.orderId = orderId
getDataList()
}
// 暴露变量
defineExpose({
getCarList,
})
</script>
+1 -1
View File
@@ -266,7 +266,7 @@ const { push } = useRouter()
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const AdminRefundDialog = defineAsyncComponent(() => import("./admin-refund-dialog.vue"))
const AdminRefundDialog = defineAsyncComponent(() => import("./components/admin-refund-dialog/index.vue"))
const ShopCar = defineAsyncComponent(() => import("../components/shop-car.vue"))
const TransactionList = defineAsyncComponent(() => import("/@/views/wallet/components/transaction-list.vue"))
// 定义查询字典
+45 -105
View File
@@ -1,7 +1,8 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<el-form v-show="showSearch" ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-form v-show="showSearch" ref="queryRef" :inline="true" :model="state.queryForm"
@keyup.enter="getDataList">
<el-row>
<el-form-item style="width: 300px" label="用户" prop="userIds">
<select-user v-model="state.queryForm.userIds" placeholder="用户" />
@@ -10,69 +11,51 @@
<select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型" clearable />
</el-form-item>
<el-form-item style="width: 200px" label="充值类型" prop="bizType">
<dict-select v-model="state.queryForm.bizType" dict-code="wallet_biz_recharge" placeholder="充值类型" />
<dict-select v-model="state.queryForm.bizType" dict-code="wallet_biz_recharge"
placeholder="充值类型" />
</el-form-item>
<el-form-item style="width: 450px" label="创建时间" prop="createTimeList">
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item>
<el-form-item style="width: 450px" label="审核时间" prop="processTimeList">
<el-date-picker v-model="state.queryForm.processTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
<el-date-picker v-model="state.queryForm.processTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn")
}}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
</el-form-item>
</el-row>
</el-form>
<el-row>
<div class="mb8" style="width: 100%">
<el-button icon="folder-add" type="primary" class="ml10" @click="uploadExcelRef.show()" v-auth="'wallet_walletRechargeApply_add'">
<el-button icon="folder-add" type="primary" class="ml10" @click="uploadExcelRef.show()"
v-auth="'wallet_walletRechargeApply_add'">
导 入
</el-button>
<el-button
icon="folder-add"
type="primary"
class="ml10"
@click="uploadExcelUnbindRef.show()"
v-auth="'wallet_walletRechargeApply_unbind'"
>
<el-button icon="folder-add" type="primary" class="ml10" @click="uploadExcelUnbindRef.show()"
v-auth="'wallet_walletRechargeApply_unbind'">
导 入(不绑定发票)
</el-button>
<el-button
v-if="false"
plain
:disabled="multiple"
icon="Delete"
type="primary"
v-auth="'wallet_walletRechargeApply_del'"
@click="handleDelete(selectObjs)"
>
<el-button v-if="false" plain :disabled="multiple" icon="Delete" type="primary"
v-auth="'wallet_walletRechargeApply_del'" @click="handleDelete(selectObjs)">
删除
</el-button>
<div class="flex justify-between items-center">
<el-tabs class="flex-1" v-model="activeName" @tab-click="handleClickTabItem">
<el-tab-pane v-for="v in tabItems" :key="v.id" :label="v.label" :name="v.value" />
</el-tabs>
<right-toolbar
v-model:showSearch="showSearch"
:export="'wallet_walletRechargeApply_export'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
/>
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletRechargeApply_export'"
@exportExcel="exportExcel" class="ml10 mr20" style="float: right"
@queryTable="getDataList" />
</div>
</div>
</el-row>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
@sort-change="sortChangeHandle">
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="80" />
<el-table-column prop="username" label="申请人" />
@@ -124,93 +107,50 @@
</div>
</template>
</el-table-column>
<el-table-column
label="操作"
v-auths="[
'wallet_walletRechargeApply_view',
'wallet_walletRechargeApply_apply',
'wallet_walletRechargeApply_edit',
'wallet_walletRechargeApply_del',
'wallet_walletRechargeApply_check',
]"
width="300"
fixed="right"
>
<el-table-column label="操作" v-auths="[
'wallet_walletRechargeApply_view',
'wallet_walletRechargeApply_apply',
'wallet_walletRechargeApply_edit',
'wallet_walletRechargeApply_del',
'wallet_walletRechargeApply_check',
]" width="300" fixed="right">
<template #default="{ row }">
<el-button
v-if="row.importTime"
icon="Document"
text
type="primary"
v-auth="'wallet_walletRechargeApply_view'"
@click="doInfo(row)"
>
<el-button v-if="row.importTime" icon="Document" text type="primary"
v-auth="'wallet_walletRechargeApply_view'" @click="doInfo(row)">
数据
</el-button>
<el-button
v-if="row.importTime && !row.processId"
icon="Connection"
text
type="primary"
v-auth="'wallet_walletRechargeApply_apply'"
@click="doApply(row)"
>
<el-button v-if="row.importTime && !row.processId" icon="Connection" text type="primary"
v-auth="'wallet_walletRechargeApply_apply'" @click="doApply(row)">
申请
</el-button>
<el-button
v-if="!row.processId"
icon="edit-pen"
text
type="primary"
v-auth="'wallet_walletRechargeApply_edit'"
@click="formDialogRef.openDialog(row.id)"
>
<el-button v-if="!row.processId" icon="edit-pen" text type="primary"
v-auth="'wallet_walletRechargeApply_edit'" @click="formDialogRef.openDialog(row.id)">
编辑
</el-button>
<el-button
v-if="row.isCheckUser && row.processStatus == '1'"
type="primary"
size="small"
link
icon="VideoPlay"
@click="deal(row)"
v-auth="'wallet_walletRechargeApply_check'"
>
<el-button v-if="row.isCheckUser && row.processStatus == '1'" type="primary" size="small" link
icon="VideoPlay" @click="deal(row)" v-auth="'wallet_walletRechargeApply_check'">
开始处理
</el-button>
<el-button
v-if="row.userId == userInfos?.user?.userId && [null, '1'].includes(row.processStatus)"
icon="delete"
text
type="primary"
v-auth="'wallet_walletRechargeApply_del'"
@click="handleDelete([row.id])"
>
icon="delete" text type="primary" v-auth="'wallet_walletRechargeApply_del'"
@click="handleDelete([row.id])">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
<upload-excel
ref="uploadExcelRef"
title="充值导入"
url="/wallet/wallet-recharge-apply/read-excel"
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx"
@refreshDataList="getDataList(false)"
/>
<upload-excel-unbind
ref="uploadExcelUnbindRef"
title="充值导入"
url="/wallet/wallet-recharge-apply/read-excel"
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx"
@refreshDataList="getDataList(false)"
/>
<upload-excel ref="uploadExcelRef" title="充值导入" url="/wallet/wallet-recharge-apply/read-excel"
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx" @refreshDataList="getDataList(false)" />
<upload-excel-unbind ref="uploadExcelUnbindRef" title="充值导入" url="/wallet/wallet-recharge-apply/read-excel"
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx" @refreshDataList="getDataList(false)" />
<!-- 审批抽屉 -->
<process-drawer ref="processDrawerRef" @task-submit-event="taskSubmitEvent" />