feat: 商品列表-报损-售罄-库存预警
This commit is contained in:
@@ -25,10 +25,26 @@
|
||||
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
||||
@click="handleSwitchChange(scope.row)"></el-switch>
|
||||
</template>
|
||||
<template #sellOut="scope">
|
||||
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
||||
@click="handleSwitchChangeTwo(scope.row)"></el-switch>
|
||||
</template>
|
||||
<template #mobile="scope">
|
||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
|
||||
</template>
|
||||
<template #consumables="scope">
|
||||
<span style="color: #4080ff;" v-if="scope.row.consName">
|
||||
{{ scope.row.consName }}
|
||||
</span>
|
||||
<span v-else>
|
||||
绑定
|
||||
</span>
|
||||
<el-icon @click="editOpen" style="cursor: pointer;color: #4080ff;">
|
||||
<EditPen />
|
||||
</el-icon>
|
||||
</template>
|
||||
|
||||
</page-content>
|
||||
|
||||
<!-- 新增 -->
|
||||
@@ -49,7 +65,21 @@
|
||||
<MyDialog ref="myDialogRef" @confirm="confirm" title="修改库存预警">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="库存预警" label-width="">
|
||||
<el-input-number v-model="form.num" label="描述文字"></el-input-number>
|
||||
<el-input-number v-model="form.warnLine" label="描述文字"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</MyDialog>
|
||||
<!-- 报损 -->
|
||||
<MyDialog ref="myDialogRefbaosun" @confirm="confirmbaosun" title="修改库存预警">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="报损数量" label-width="">
|
||||
<el-input-number v-model="datas.number" label="描述文字"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="报损照片" label-width="">
|
||||
<MultiImageUpload v-model="datas.images" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" label-width="">
|
||||
<el-input v-model="datas.remark" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</MyDialog>
|
||||
@@ -63,12 +93,13 @@ import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import addModalConfig from "./indexconfig/add";
|
||||
import contentConfig from "./indexconfig/content";
|
||||
import MultiImageUpload from "@/components/Upload/MultiImageUpload.vue"
|
||||
import contentConfig2 from "./indexconfig/content2";
|
||||
import editModalConfig from "./indexconfig/edit";
|
||||
import searchConfig from "./indexconfig/search";
|
||||
import MyDialog from "@/components/mycomponents/myDialog.vue";
|
||||
import Statistics from "./indexconfig/statistics.vue";
|
||||
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
const {
|
||||
searchRef,
|
||||
contentRef,
|
||||
@@ -84,10 +115,18 @@ const {
|
||||
} = usePage();
|
||||
const router = useRouter();
|
||||
let gongjiData = ref({});
|
||||
let datas = reactive({
|
||||
number: 0,
|
||||
remark: "",
|
||||
images: []
|
||||
});
|
||||
function newHandleQueryClick(e: IObject | undefined) {
|
||||
const filterParams = contentRef.value?.getFilterParams();
|
||||
contentRef.value?.fetchPageData({ ...e, ...filterParams }, true);
|
||||
getTongji(e);
|
||||
}
|
||||
function editOpen() {
|
||||
|
||||
}
|
||||
// 重置
|
||||
function handleResetClick2(queryParams: IObject) {
|
||||
@@ -103,7 +142,7 @@ function getTongji(params: IObject | undefined) {
|
||||
});
|
||||
}
|
||||
const form = reactive({
|
||||
num: "",
|
||||
warnLine: "",
|
||||
});
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
@@ -123,11 +162,22 @@ function handleSwitchChange(data: any) {
|
||||
};
|
||||
UserAPI.onOff(obj);
|
||||
}
|
||||
// 售罄
|
||||
function handleSwitchChangeTwo(data: any) {
|
||||
let obj = {
|
||||
type: data.type == "sku" ? "sku" : "product",
|
||||
id: data.id,
|
||||
isSoldOut: data.isSoldStock,
|
||||
};
|
||||
UserAPI.markIsSoldOut(obj);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
async function handleEditClick(row: IObject) {
|
||||
router.push({ name: "addgoods", query: { goods_id: row.id } });
|
||||
}
|
||||
const myDialogRef = ref(null);
|
||||
const myDialogRefbaosun = ref(null);
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name: string) {
|
||||
console.log(name);
|
||||
@@ -136,8 +186,16 @@ function handleToolbarClick(name: string) {
|
||||
myDialogRef.value.open();
|
||||
}
|
||||
}
|
||||
function confirm() {
|
||||
console.log(form, "debug");
|
||||
async function confirm() {
|
||||
let res = await UserAPI.stockWarning(form.warnLine)
|
||||
ElMessage.success("成功");
|
||||
myDialogRef.value.close();
|
||||
|
||||
}
|
||||
async function confirmbaosun() {
|
||||
let res = await UserAPI.reportDamage(datas)
|
||||
ElMessage.success("成功");
|
||||
myDialogRefbaosun.value.close();
|
||||
}
|
||||
// 商品规格
|
||||
function typeFilter(item: any) {
|
||||
@@ -155,37 +213,9 @@ function typeFilter(item: any) {
|
||||
}
|
||||
// 其他操作列
|
||||
async function handleOperatClick(data: IOperatData) {
|
||||
console.log(data);
|
||||
// 重置密码
|
||||
if (data.name === "reset_pwd") {
|
||||
ElMessageBox.prompt("请输入用户「" + data.row.username + "」的新密码", "重置密码", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
}).then(({ value }) => {
|
||||
if (!value || value.length < 6) {
|
||||
ElMessage.warning("密码至少需要6位字符,请重新输入");
|
||||
return false;
|
||||
}
|
||||
// UserAPI.resetPassword(data.row.id, value).then(() => {
|
||||
// ElMessage.success("密码重置成功,新密码是:" + value);
|
||||
// });
|
||||
});
|
||||
} else if (data.name === "detail") {
|
||||
// 禁用表单编辑
|
||||
editModalRef.value?.handleDisabled(true);
|
||||
// 打开抽屉
|
||||
editModalRef.value?.setModalVisible();
|
||||
// 修改抽屉标题
|
||||
editModalConfig.drawer = { ...editModalConfig.drawer, title: "用户详情" };
|
||||
// 加载部门下拉数据源
|
||||
// editModalConfig.formItems[2]!.attrs!.data = await DeptAPI.getOptions();
|
||||
// 加载角色下拉数据源
|
||||
// editModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
|
||||
// 根据id获取数据进行填充
|
||||
// const formData = await UserAPI.getFormData(data.row.id);
|
||||
// 设置表单数据
|
||||
// editModalRef.value?.setFormData(formData);
|
||||
}
|
||||
datas.productId = data.row.id
|
||||
myDialogRefbaosun.value.open();
|
||||
|
||||
}
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
@@ -27,7 +27,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
obj.createEndTime = obj['1']
|
||||
const res = await UserAPI.getPage(obj);
|
||||
res.records.forEach((element: any) => {
|
||||
if (element.type == "single") {
|
||||
if (element.type != "sku") {
|
||||
delete element.skuList
|
||||
}
|
||||
});
|
||||
@@ -59,13 +59,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
// {
|
||||
// icon: "edit",
|
||||
// text: "库存预警",
|
||||
// type: "info",
|
||||
// name: "custom1",
|
||||
// auth: "import",
|
||||
// },
|
||||
{
|
||||
icon: "edit",
|
||||
text: "库存预警",
|
||||
type: "info",
|
||||
name: "custom1",
|
||||
auth: "import",
|
||||
},
|
||||
],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
@@ -77,7 +77,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
slotName: "type",
|
||||
},
|
||||
{ label: "库存", align: "center", prop: "stockNumber" },
|
||||
{ label: "耗材信息", align: "center", prop: "consName" },
|
||||
{ label: "耗材信息", align: "center", prop: "consName", slotName: "consumables", templet: "custom", },
|
||||
{
|
||||
label: "上架",
|
||||
align: "center",
|
||||
@@ -85,13 +85,20 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
templet: "custom",
|
||||
slotName: "shangjia",
|
||||
},
|
||||
{
|
||||
label: "售罄",
|
||||
align: "center",
|
||||
prop: "isSoldStock",
|
||||
templet: "custom",
|
||||
slotName: "sellOut",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit", "delete"],
|
||||
operat: [{ text: "报损" }, "edit", "delete"],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item v-for="(item, index) in datas.DialogForm.couponsList" :label="item.title">
|
||||
<el-input-number v-model="item.number" min="1" controls-position="right" placeholder="请输入数量" />
|
||||
<el-button type="" text @click="removegoods(index)">删除</el-button>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
@@ -96,6 +97,9 @@ onMounted(() => {
|
||||
getList(res)
|
||||
})
|
||||
})
|
||||
function removegoods(index) {
|
||||
datas.DialogForm.couponsList.splice(index, 1)
|
||||
}
|
||||
function selectShopRes(item) {
|
||||
item.forEach(ele => {
|
||||
ele.number = 1
|
||||
|
||||
Reference in New Issue
Block a user