add
This commit is contained in:
commit
a7a79b6004
|
@ -1,5 +1,5 @@
|
||||||
NODE_ENV = 'production'
|
NODE_ENV = 'production'
|
||||||
VITE_NOW_TYPE = 'build'
|
VITE_NOW_TYPE = 'build/admin'
|
||||||
# Base API
|
# Base API
|
||||||
VITE_APP_BASE_URL='https://erp.lihaink.cn'
|
VITE_APP_BASE_URL='https://erp.lihaink.cn'
|
||||||
# VITE_APP_BASE_URL=''
|
# VITE_APP_BASE_URL=''
|
|
@ -0,0 +1,3 @@
|
||||||
|
## 注意注意!
|
||||||
|
|
||||||
|
# 需要将打包后的文件移入admin/目录下, 否则无法正常访问
|
|
@ -8,21 +8,44 @@
|
||||||
@confirm="handleSubmit"
|
@confirm="handleSubmit"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
label-width="90px"
|
||||||
|
:rules="formRules"
|
||||||
|
>
|
||||||
<el-form-item label="所属ID" prop="pid">
|
<el-form-item label="所属ID" prop="pid">
|
||||||
<el-input v-model="formData.pid" clearable placeholder="请输入所属ID" />
|
<!-- <el-input v-model="formData.pid" clearable placeholder="请输入所属ID" /> -->
|
||||||
|
<el-cascader
|
||||||
|
v-model="formData.pid"
|
||||||
|
:props="props"
|
||||||
|
:show-all-levels="false"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分类名称" prop="name">
|
<el-form-item label="分类名称" prop="name">
|
||||||
<el-input v-model="formData.name" clearable placeholder="请输入分类名称" />
|
<el-input
|
||||||
|
v-model="formData.name"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入分类名称"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注信息" prop="data">
|
<el-form-item label="备注信息" prop="data">
|
||||||
<el-input v-model="formData.data" clearable placeholder="请输入备注信息" />
|
<el-input
|
||||||
|
v-model="formData.data"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入备注信息"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="图片" prop="pic">
|
<el-form-item label="图片" prop="pic">
|
||||||
<material-picker v-model="formData.pic" />
|
<material-picker v-model="formData.pic" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="排序" prop="sort">
|
||||||
<el-input v-model="formData.sort" clearable placeholder="请输入排序" />
|
<el-input
|
||||||
|
v-model="formData.sort"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入排序"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</popup>
|
</popup>
|
||||||
|
@ -30,52 +53,82 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="goodsclassEdit">
|
<script lang="ts" setup name="goodsclassEdit">
|
||||||
import type { FormInstance } from 'element-plus'
|
import type { FormInstance } from "element-plus";
|
||||||
import Popup from '@/components/popup/index.vue'
|
import Popup from "@/components/popup/index.vue";
|
||||||
import { apiGoodsclassAdd, apiGoodsclassEdit, apiGoodsclassDetail } from '@/api/goodsclass'
|
import {
|
||||||
import { timeFormat } from '@/utils/util'
|
apiGoodsclassAdd,
|
||||||
import type { PropType } from 'vue'
|
apiGoodsclassEdit,
|
||||||
|
apiGoodsclassDetail,
|
||||||
|
apiGoodsclassLists,
|
||||||
|
} from "@/api/goodsclass";
|
||||||
|
import { timeFormat } from "@/utils/util";
|
||||||
|
import type { PropType } from "vue";
|
||||||
defineProps({
|
defineProps({
|
||||||
dictData: {
|
dictData: {
|
||||||
type: Object as PropType<Record<string, any[]>>,
|
type: Object as PropType<Record<string, any[]>>,
|
||||||
default: () => ({})
|
default: () => ({}),
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
const emit = defineEmits(['success', 'close'])
|
const emit = defineEmits(["success", "close"]);
|
||||||
const formRef = shallowRef<FormInstance>()
|
const formRef = shallowRef<FormInstance>();
|
||||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
const popupRef = shallowRef<InstanceType<typeof Popup>>();
|
||||||
const mode = ref('add')
|
const mode = ref("add");
|
||||||
|
|
||||||
|
|
||||||
|
const props = {
|
||||||
|
value: "id",
|
||||||
|
label: "name",
|
||||||
|
checkStrictly: true,
|
||||||
|
emitPath: false,
|
||||||
|
lazy: true,
|
||||||
|
lazyLoad(node, resolve) {
|
||||||
|
let pid = node.value || 0;
|
||||||
|
apiGoodsclassLists({
|
||||||
|
pid: pid,
|
||||||
|
page_size: 10000,
|
||||||
|
}).then((res) => {
|
||||||
|
resolve(
|
||||||
|
res.lists.map((item: any) => {
|
||||||
|
item.leaf = item.pid > 0;
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// 弹窗标题
|
// 弹窗标题
|
||||||
const popupTitle = computed(() => {
|
const popupTitle = computed(() => {
|
||||||
return mode.value == 'edit' ? '编辑商品分类表' : '新增商品分类表'
|
return mode.value == "edit" ? "编辑商品分类表" : "新增商品分类表";
|
||||||
})
|
});
|
||||||
|
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: "",
|
||||||
pid: '',
|
pid: 0,
|
||||||
name: '',
|
name: "",
|
||||||
data: '',
|
data: "",
|
||||||
pic: '',
|
pic: "",
|
||||||
sort: '',
|
sort: "",
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
// 表单验证
|
// 表单验证
|
||||||
const formRules = reactive<any>({
|
const formRules = reactive<any>({
|
||||||
pid: [{
|
// pid: [
|
||||||
|
// {
|
||||||
|
// required: true,
|
||||||
|
// message: "请输入所属ID",
|
||||||
|
// trigger: ["blur"],
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
name: [
|
||||||
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入所属ID',
|
message: "请输入分类名称",
|
||||||
trigger: ['blur']
|
trigger: ["blur"],
|
||||||
}],
|
},
|
||||||
name: [{
|
],
|
||||||
required: true,
|
});
|
||||||
message: '请输入分类名称',
|
|
||||||
trigger: ['blur']
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 获取详情
|
// 获取详情
|
||||||
|
@ -83,48 +136,44 @@ const setFormData = async (data: Record<any, any>) => {
|
||||||
for (const key in formData) {
|
for (const key in formData) {
|
||||||
if (data[key] != null && data[key] != undefined) {
|
if (data[key] != null && data[key] != undefined) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
formData[key] = data[key]
|
formData[key] = data[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const getDetail = async (row: Record<string, any>) => {
|
const getDetail = async (row: Record<string, any>) => {
|
||||||
const data = await apiGoodsclassDetail({
|
const data = await apiGoodsclassDetail({
|
||||||
id: row.id
|
id: row.id,
|
||||||
})
|
});
|
||||||
setFormData(data)
|
setFormData(data);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await formRef.value?.validate()
|
await formRef.value?.validate();
|
||||||
const data = { ...formData, }
|
let data = { ...formData };
|
||||||
mode.value == 'edit'
|
|
||||||
|
mode.value == "edit"
|
||||||
? await apiGoodsclassEdit(data)
|
? await apiGoodsclassEdit(data)
|
||||||
: await apiGoodsclassAdd(data)
|
: await apiGoodsclassAdd(data);
|
||||||
popupRef.value?.close()
|
popupRef.value?.close();
|
||||||
emit('success')
|
emit("success");
|
||||||
}
|
};
|
||||||
|
|
||||||
//打开弹窗
|
//打开弹窗
|
||||||
const open = (type = 'add') => {
|
const open = (type = "add") => {
|
||||||
mode.value = type
|
mode.value = type;
|
||||||
popupRef.value?.open()
|
popupRef.value?.open();
|
||||||
}
|
};
|
||||||
|
|
||||||
// 关闭回调
|
// 关闭回调
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
emit('close')
|
emit("close");
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open,
|
open,
|
||||||
setFormData,
|
setFormData,
|
||||||
getDetail
|
getDetail,
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,22 +1,38 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-card class="!border-none mb-4" shadow="never">
|
<el-card class="!border-none mb-4" shadow="never">
|
||||||
<el-form
|
<el-form class="mb-[-16px] disabledEdit" :model="queryParams" inline>
|
||||||
class="mb-[-16px] disabledEdit"
|
|
||||||
:model="queryParams"
|
|
||||||
inline
|
|
||||||
>
|
|
||||||
<el-form-item label="所属ID" prop="pid">
|
<el-form-item label="所属ID" prop="pid">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.pid" clearable placeholder="请输入所属ID" />
|
<el-input
|
||||||
|
class="w-[280px]"
|
||||||
|
v-model="queryParams.pid"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入所属ID"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分类名称" prop="name">
|
<el-form-item label="分类名称" prop="name">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入分类名称" />
|
<el-input
|
||||||
|
class="w-[280px]"
|
||||||
|
v-model="queryParams.name"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入分类名称"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注信息" prop="data">
|
<el-form-item label="备注信息" prop="data">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.data" clearable placeholder="请输入备注信息" />
|
<el-input
|
||||||
|
class="w-[280px]"
|
||||||
|
v-model="queryParams.data"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入备注信息"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="排序" prop="sort">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.sort" clearable placeholder="请输入排序" />
|
<el-input
|
||||||
|
class="w-[280px]"
|
||||||
|
v-model="queryParams.sort"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入排序"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||||
|
@ -25,7 +41,11 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||||
<el-button v-perms="['goods.goodsclass/add']" type="primary" @click="handleAdd">
|
<el-button
|
||||||
|
v-perms="['goods.goodsclass/add']"
|
||||||
|
type="primary"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon name="el-icon-Plus" />
|
<icon name="el-icon-Plus" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -39,15 +59,19 @@
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
:data="pager.lists"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
@cell-click="cellClick"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="ID" prop="id" width="55" />
|
<el-table-column label="ID" prop="id" width="120" />
|
||||||
<el-table-column label="所属ID" prop="pid" show-overflow-tooltip />
|
<el-table-column label="所属ID" prop="pid" show-overflow-tooltip />
|
||||||
<el-table-column label="分类名称" prop="name" show-overflow-tooltip />
|
<el-table-column label="分类名称" prop="name" show-overflow-tooltip />
|
||||||
<el-table-column label="备注信息" prop="data" show-overflow-tooltip />
|
<el-table-column label="备注信息" prop="data" show-overflow-tooltip />
|
||||||
<el-table-column label="图片" prop="pic">
|
<el-table-column label="图片" prop="pic">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-image style="width:50px;height:50px;" :src="row.pic" />
|
<el-image style="width: 50px; height: 50px" :src="row.pic" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
|
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
|
||||||
|
@ -57,7 +81,7 @@
|
||||||
v-perms="['goods.goodsclass/edit']"
|
v-perms="['goods.goodsclass/edit']"
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
@click="handleEdit(row)"
|
@click.stop="handleEdit(row)"
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -65,7 +89,7 @@
|
||||||
v-perms="['goods.goodsclass/delete']"
|
v-perms="['goods.goodsclass/delete']"
|
||||||
type="danger"
|
type="danger"
|
||||||
link
|
link
|
||||||
@click="handleDelete(row.id)"
|
@click.stop="handleDelete(row.id)"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -77,71 +101,91 @@
|
||||||
<pagination v-model="pager" @change="getLists" />
|
<pagination v-model="pager" @change="getLists" />
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
<edit-popup
|
||||||
|
v-if="showEdit"
|
||||||
|
ref="editRef"
|
||||||
|
:dict-data="dictData"
|
||||||
|
@success="getLists"
|
||||||
|
@close="showEdit = false"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="goodsclassLists">
|
<script lang="ts" setup name="goodsclassLists">
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from "@/hooks/usePaging";
|
||||||
import { useDictData } from '@/hooks/useDictOptions'
|
import { useDictData } from "@/hooks/useDictOptions";
|
||||||
import { apiGoodsclassLists, apiGoodsclassDelete } from '@/api/goodsclass'
|
import { apiGoodsclassLists, apiGoodsclassDelete } from "@/api/goodsclass";
|
||||||
import { timeFormat } from '@/utils/util'
|
import { timeFormat } from "@/utils/util";
|
||||||
import feedback from '@/utils/feedback'
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import EditPopup from './edit.vue'
|
import feedback from "@/utils/feedback";
|
||||||
|
import EditPopup from "./edit.vue";
|
||||||
|
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>();
|
||||||
// 是否显示编辑框
|
// 是否显示编辑框
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false);
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
// 查询条件
|
// 查询条件
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pid: '',
|
pid: route.query?.pid || 0,
|
||||||
name: '',
|
name: "",
|
||||||
data: '',
|
data: "",
|
||||||
pic: '',
|
pic: "",
|
||||||
sort: ''
|
sort: "",
|
||||||
})
|
});
|
||||||
|
|
||||||
// 选中数据
|
// 选中数据
|
||||||
const selectData = ref<any[]>([])
|
const selectData = ref<any[]>([]);
|
||||||
|
|
||||||
// 表格选择后回调事件
|
// 表格选择后回调事件
|
||||||
const handleSelectionChange = (val: any[]) => {
|
const handleSelectionChange = (val: any[]) => {
|
||||||
selectData.value = val.map(({ id }) => id)
|
selectData.value = val.map(({ id }) => id);
|
||||||
}
|
};
|
||||||
|
|
||||||
// 获取字典数据
|
// 获取字典数据
|
||||||
const { dictData } = useDictData('')
|
const { dictData } = useDictData("");
|
||||||
|
|
||||||
// 分页相关
|
// 分页相关
|
||||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||||
fetchFun: apiGoodsclassLists,
|
fetchFun: apiGoodsclassLists,
|
||||||
params: queryParams
|
params: queryParams,
|
||||||
})
|
});
|
||||||
|
|
||||||
// 添加
|
// 添加
|
||||||
const handleAdd = async () => {
|
const handleAdd = async () => {
|
||||||
showEdit.value = true
|
showEdit.value = true;
|
||||||
await nextTick()
|
await nextTick();
|
||||||
editRef.value?.open('add')
|
editRef.value?.open("add");
|
||||||
}
|
};
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const handleEdit = async (data: any) => {
|
const handleEdit = async (data: any) => {
|
||||||
showEdit.value = true
|
showEdit.value = true;
|
||||||
await nextTick()
|
await nextTick();
|
||||||
editRef.value?.open('edit')
|
editRef.value?.open("edit");
|
||||||
editRef.value?.setFormData(data)
|
editRef.value?.setFormData(data);
|
||||||
}
|
};
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const handleDelete = async (id: number | any[]) => {
|
const handleDelete = async (id: number | any[]) => {
|
||||||
await feedback.confirm('确定要删除?')
|
await feedback.confirm("确定要删除?");
|
||||||
await apiGoodsclassDelete({ id })
|
await apiGoodsclassDelete({ id });
|
||||||
getLists()
|
getLists();
|
||||||
}
|
};
|
||||||
|
|
||||||
getLists()
|
getLists();
|
||||||
|
|
||||||
|
// 跳转子级分类
|
||||||
|
const cellClick = (row: any, column: any) => {
|
||||||
|
if (column.no == 7) return console.log("无效点击");
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
path: "/goods/goodsclass",
|
||||||
|
query: {
|
||||||
|
pid: row.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card class="!border-none mb-4" shadow="never">
|
||||||
|
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
||||||
|
<el-tab-pane label="概况" name="first">
|
||||||
|
<el-descriptions class="margin-top" :column="4" border>
|
||||||
|
<!-- <template #extra>
|
||||||
|
<el-button type="primary">Operation</el-button>
|
||||||
|
</template> -->
|
||||||
|
<el-descriptions-item :span="4" label="单据编号">
|
||||||
|
{{form.number}}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item :span="2" label="单据金额">
|
||||||
|
{{form.total}}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item :span="2" label="抵扣金额">
|
||||||
|
{{form.deduction_price}}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item :span="2" label="实际金额">
|
||||||
|
{{form.actual}}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item :span="2" label="实收金额">
|
||||||
|
{{form.money}}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="所属商户">
|
||||||
|
{{form.merchant}}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="ID">
|
||||||
|
{{form.id}}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="订单" name="second">订单列表</el-tab-pane>
|
||||||
|
<el-tab-pane label="报价信息" name="third">报价信息</el-tab-pane>
|
||||||
|
<!-- <el-tab-pane label="详情3" name="fourth">Task</el-tab-pane> -->
|
||||||
|
</el-tabs>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup name="opurchaseclassLists">
|
||||||
|
import { usePaging } from "@/hooks/usePaging";
|
||||||
|
import { useDictData } from "@/hooks/useDictOptions";
|
||||||
|
import {
|
||||||
|
apiOpurchaseclassLists,
|
||||||
|
apiOpurchaseclassDelete,
|
||||||
|
apiOpurchaseclassDetail,
|
||||||
|
} from "@/api/opurchaseclass";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
import type { TabsPaneContext } from "element-plus";
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const form = ref({});
|
||||||
|
|
||||||
|
const activeName = ref("first");
|
||||||
|
|
||||||
|
const handleClick = (tab: TabsPaneContext, event: Event) => {
|
||||||
|
console.log(tab, event);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getDetail = async () => {
|
||||||
|
const data = await apiOpurchaseclassDetail({
|
||||||
|
id: route.query.id,
|
||||||
|
});
|
||||||
|
console.log(data);
|
||||||
|
form.value = data;
|
||||||
|
};
|
||||||
|
getDetail();
|
||||||
|
</script>
|
|
@ -1,81 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="edit-popup">
|
|
||||||
<popup
|
|
||||||
ref="popupRef"
|
|
||||||
title="详情"
|
|
||||||
:async="true"
|
|
||||||
width="550px"
|
|
||||||
:cancelButtonText="false"
|
|
||||||
:confirmButtonText="false"
|
|
||||||
>
|
|
||||||
<el-form ref="formRef" :model="formData" label-width="90px">
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</popup>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup name="opurchaseclassDETAILS">
|
|
||||||
import type { FormInstance } from 'element-plus'
|
|
||||||
import Popup from '@/components/popup/index.vue'
|
|
||||||
import { apiOpurchaseclassAdd, apiOpurchaseclassEdit, apiOpurchaseclassDetail } from '@/api/opurchaseclass'
|
|
||||||
import { timeFormat } from '@/utils/util'
|
|
||||||
import type { PropType } from 'vue'
|
|
||||||
defineProps({
|
|
||||||
dictData: {
|
|
||||||
type: Object as PropType<Record<string, any[]>>,
|
|
||||||
default: () => ({})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const emit = defineEmits(['success', 'close'])
|
|
||||||
const formRef = shallowRef<FormInstance>()
|
|
||||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
|
||||||
const mode = ref('add')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const formData = reactive({
|
|
||||||
id: '',
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取详情
|
|
||||||
const setFormData = async (data: Record<any, any>) => {
|
|
||||||
for (const key in formData) {
|
|
||||||
if (data[key] != null && data[key] != undefined) {
|
|
||||||
//@ts-ignore
|
|
||||||
formData[key] = data[key]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const getDetail = async (row: Record<string, any>) => {
|
|
||||||
const data = await apiOpurchaseclassDetail({
|
|
||||||
id: row.id
|
|
||||||
})
|
|
||||||
setFormData(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
//打开弹窗
|
|
||||||
const open = () => {
|
|
||||||
popupRef.value?.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 关闭回调
|
|
||||||
const handleClose = () => {
|
|
||||||
emit('close')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
open,
|
|
||||||
setFormData,
|
|
||||||
getDetail
|
|
||||||
})
|
|
||||||
</script>
|
|
|
@ -22,7 +22,7 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||||
<el-button v-perms="['operation.opurchaseclass/add']" type="primary" @click="handleAdd">
|
<!-- <el-button v-perms="['operation.opurchaseclass/add']" type="primary" @click="handleAdd">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon name="el-icon-Plus" />
|
<icon name="el-icon-Plus" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -34,15 +34,15 @@
|
||||||
@click="handleDelete(selectData)"
|
@click="handleDelete(selectData)"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button> -->
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
<el-table-column label="ID" prop="id" show-overflow-tooltip />
|
||||||
<el-table-column label="所属商户" prop="merchant" show-overflow-tooltip />
|
<el-table-column label="所属商户" prop="merchant" show-overflow-tooltip />
|
||||||
<el-table-column label="零售订单id" prop="order_arr" show-overflow-tooltip />
|
<el-table-column label="零售订单id" prop="order_arr" show-overflow-tooltip />
|
||||||
<el-table-column label="购物车id" prop="cart_id" show-overflow-tooltip />
|
<el-table-column label="购物车id" prop="cart_id" show-overflow-tooltip />
|
||||||
<el-table-column label="单据编号" prop="number" show-overflow-tooltip />
|
<el-table-column label="单据编号" prop="number" width="220" show-overflow-tooltip />
|
||||||
<el-table-column label="单据金额" prop="total" show-overflow-tooltip />
|
<el-table-column label="单据金额" prop="total" show-overflow-tooltip />
|
||||||
<el-table-column label="抵扣金额" prop="deduction_price" show-overflow-tooltip />
|
<el-table-column label="抵扣金额" prop="deduction_price" show-overflow-tooltip />
|
||||||
<el-table-column label="实际金额" prop="actual" show-overflow-tooltip />
|
<el-table-column label="实际金额" prop="actual" show-overflow-tooltip />
|
||||||
|
@ -51,6 +51,13 @@
|
||||||
<el-table-column label="操作" width="120" fixed="right">
|
<el-table-column label="操作" width="120" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleDetail(row)"
|
||||||
|
>
|
||||||
|
详情
|
||||||
|
</el-button>
|
||||||
|
<!-- <el-button
|
||||||
v-perms="['operation.opurchaseclass/edit']"
|
v-perms="['operation.opurchaseclass/edit']"
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
|
@ -65,7 +72,7 @@
|
||||||
@click="handleDelete(row.id)"
|
@click="handleDelete(row.id)"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -85,6 +92,9 @@ import { apiOpurchaseclassLists, apiOpurchaseclassDelete } from '@/api/opurchase
|
||||||
import { timeFormat } from '@/utils/util'
|
import { timeFormat } from '@/utils/util'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
// 是否显示编辑框
|
// 是否显示编辑框
|
||||||
|
@ -122,6 +132,17 @@ const handleAdd = async () => {
|
||||||
editRef.value?.open('add')
|
editRef.value?.open('add')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
const handleDetail = async (data: any) => {
|
||||||
|
console.log(data);
|
||||||
|
router.push({
|
||||||
|
path: 'detail',
|
||||||
|
query:{
|
||||||
|
id: data.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const handleEdit = async (data: any) => {
|
const handleEdit = async (data: any) => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
|
|
Loading…
Reference in New Issue