This commit is contained in:
zmj 2024-05-10 17:32:12 +08:00
commit a7a79b6004
7 changed files with 404 additions and 299 deletions

View File

@ -1,5 +1,5 @@
NODE_ENV = 'production'
VITE_NOW_TYPE = 'build'
VITE_NOW_TYPE = 'build/admin'
# Base API
VITE_APP_BASE_URL='https://erp.lihaink.cn'
# VITE_APP_BASE_URL=''

3
build/打包须知.md Normal file
View File

@ -0,0 +1,3 @@
## 注意注意!
# 需要将打包后的文件移入admin/目录下, 否则无法正常访问

View File

@ -8,21 +8,44 @@
@confirm="handleSubmit"
@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-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 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 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 label="图片" prop="pic">
<material-picker v-model="formData.pic" />
</el-form-item>
<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>
</popup>
@ -30,52 +53,82 @@
</template>
<script lang="ts" setup name="goodsclassEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiGoodsclassAdd, apiGoodsclassEdit, apiGoodsclassDetail } from '@/api/goodsclass'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
import type { FormInstance } from "element-plus";
import Popup from "@/components/popup/index.vue";
import {
apiGoodsclassAdd,
apiGoodsclassEdit,
apiGoodsclassDetail,
apiGoodsclassLists,
} from "@/api/goodsclass";
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')
default: () => ({}),
},
});
const emit = defineEmits(["success", "close"]);
const formRef = shallowRef<FormInstance>();
const popupRef = shallowRef<InstanceType<typeof Popup>>();
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(() => {
return mode.value == 'edit' ? '编辑商品分类表' : '新增商品分类表'
})
return mode.value == "edit" ? "编辑商品分类表" : "新增商品分类表";
});
//
const formData = reactive({
id: '',
pid: '',
name: '',
data: '',
pic: '',
sort: '',
})
id: "",
pid: 0,
name: "",
data: "",
pic: "",
sort: "",
});
//
const formRules = reactive<any>({
pid: [{
// pid: [
// {
// required: true,
// message: "ID",
// trigger: ["blur"],
// },
// ],
name: [
{
required: true,
message: '请输入所属ID',
trigger: ['blur']
}],
name: [{
required: true,
message: '请输入分类名称',
trigger: ['blur']
}]
})
message: "请输入分类名称",
trigger: ["blur"],
},
],
});
//
@ -83,48 +136,44 @@ 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]
formData[key] = data[key];
}
}
}
};
const getDetail = async (row: Record<string, any>) => {
const data = await apiGoodsclassDetail({
id: row.id
})
setFormData(data)
}
id: row.id,
});
setFormData(data);
};
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
await formRef.value?.validate();
let data = { ...formData };
mode.value == "edit"
? await apiGoodsclassEdit(data)
: await apiGoodsclassAdd(data)
popupRef.value?.close()
emit('success')
}
: await apiGoodsclassAdd(data);
popupRef.value?.close();
emit("success");
};
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
const open = (type = "add") => {
mode.value = type;
popupRef.value?.open();
};
//
const handleClose = () => {
emit('close')
}
emit("close");
};
defineExpose({
open,
setFormData,
getDetail
})
getDetail,
});
</script>

View File

@ -1,22 +1,38 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form
class="mb-[-16px] disabledEdit"
:model="queryParams"
inline
>
<el-form class="mb-[-16px] disabledEdit" :model="queryParams" inline>
<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 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 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 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-button type="primary" @click="resetPage">查询</el-button>
@ -25,7 +41,11 @@
</el-form>
</el-card>
<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>
<icon name="el-icon-Plus" />
</template>
@ -39,15 +59,19 @@
删除
</el-button>
<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 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="分类名称" prop="name" show-overflow-tooltip />
<el-table-column label="备注信息" prop="data" show-overflow-tooltip />
<el-table-column label="图片" prop="pic">
<template #default="{ row }">
<el-image style="width:50px;height:50px;" :src="row.pic" />
<el-image style="width: 50px; height: 50px" :src="row.pic" />
</template>
</el-table-column>
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
@ -57,7 +81,7 @@
v-perms="['goods.goodsclass/edit']"
type="primary"
link
@click="handleEdit(row)"
@click.stop="handleEdit(row)"
>
编辑
</el-button>
@ -65,7 +89,7 @@
v-perms="['goods.goodsclass/delete']"
type="danger"
link
@click="handleDelete(row.id)"
@click.stop="handleDelete(row.id)"
>
删除
</el-button>
@ -77,71 +101,91 @@
<pagination v-model="pager" @change="getLists" />
</div>
</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>
</template>
<script lang="ts" setup name="goodsclassLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiGoodsclassLists, apiGoodsclassDelete } from '@/api/goodsclass'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import { usePaging } from "@/hooks/usePaging";
import { useDictData } from "@/hooks/useDictOptions";
import { apiGoodsclassLists, apiGoodsclassDelete } from "@/api/goodsclass";
import { timeFormat } from "@/utils/util";
import { useRoute, useRouter } from "vue-router";
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({
pid: '',
name: '',
data: '',
pic: '',
sort: ''
})
pid: route.query?.pid || 0,
name: "",
data: "",
pic: "",
sort: "",
});
//
const selectData = ref<any[]>([])
const selectData = ref<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({
fetchFun: apiGoodsclassLists,
params: queryParams
})
params: queryParams,
});
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
showEdit.value = true;
await nextTick();
editRef.value?.open("add");
};
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
showEdit.value = true;
await nextTick();
editRef.value?.open("edit");
editRef.value?.setFormData(data);
};
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiGoodsclassDelete({ id })
getLists()
}
await feedback.confirm("确定要删除?");
await apiGoodsclassDelete({ id });
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>

View File

@ -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>

View File

@ -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>

View File

@ -22,7 +22,7 @@
</el-form>
</el-card>
<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>
<icon name="el-icon-Plus" />
</template>
@ -34,15 +34,15 @@
@click="handleDelete(selectData)"
>
删除
</el-button>
</el-button> -->
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<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="零售订单id" prop="order_arr" 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="deduction_price" show-overflow-tooltip />
<el-table-column label="实际金额" prop="actual" show-overflow-tooltip />
@ -51,6 +51,13 @@
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
type="primary"
link
@click="handleDetail(row)"
>
详情
</el-button>
<!-- <el-button
v-perms="['operation.opurchaseclass/edit']"
type="primary"
link
@ -65,7 +72,7 @@
@click="handleDelete(row.id)"
>
删除
</el-button>
</el-button> -->
</template>
</el-table-column>
</el-table>
@ -85,6 +92,9 @@ import { apiOpurchaseclassLists, apiOpurchaseclassDelete } from '@/api/opurchase
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
@ -122,6 +132,17 @@ const handleAdd = async () => {
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) => {
showEdit.value = true