feat: pad点单设置修复
This commit is contained in:
parent
9cab42401a
commit
2763ee2a7a
|
|
@ -37,7 +37,15 @@ const API = {
|
|||
method: "delete",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
},
|
||||
// pad布局列表
|
||||
getLayout() {
|
||||
return request<any>({
|
||||
url: `${baseURL}/layout`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
export default API;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
<template>
|
||||
<el-dialog title="选择商品" top="5vh" v-model="dialogVisible">
|
||||
<el-dialog title="选择商品" top="5vh" v-model="dialogVisible" @close="resetHandle">
|
||||
<el-form :model="searhForm" inline>
|
||||
<el-form-item>
|
||||
<el-input v-model="searhForm.name" placeholder="商品名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searhForm.category" placeholder="商品分类" :disabled="disableCategory">
|
||||
<el-select
|
||||
style="width: 200px"
|
||||
v-model="searhForm.category"
|
||||
placeholder="商品分类"
|
||||
:disabled="disableCategory"
|
||||
>
|
||||
<el-option
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
|
|
@ -110,7 +115,7 @@ export default {
|
|||
},
|
||||
categoryList: [],
|
||||
tableData: {
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
loading: false,
|
||||
|
|
@ -131,14 +136,14 @@ export default {
|
|||
this.$emit("success", res);
|
||||
this.close();
|
||||
},
|
||||
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.searhForm.name = "";
|
||||
this.searhForm.category = "";
|
||||
this.tableData.page = 0;
|
||||
this.tableData.page = 1;
|
||||
this.tableData.size = 10;
|
||||
this.tableData.list = [];
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
|
|
@ -147,7 +152,7 @@ export default {
|
|||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1;
|
||||
this.tableData.page = e;
|
||||
this.getTableData();
|
||||
},
|
||||
// 商品列表
|
||||
|
|
@ -160,8 +165,8 @@ export default {
|
|||
name: this.searhForm.name,
|
||||
categoryId: this.searhForm.category,
|
||||
});
|
||||
this.tableData.list = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
this.tableData.list = res.records;
|
||||
this.tableData.total = res.totalRow;
|
||||
|
||||
if (this.goods.length) {
|
||||
this.$nextTick(() => {
|
||||
|
|
@ -179,10 +184,10 @@ export default {
|
|||
async tbShopCategoryGet() {
|
||||
try {
|
||||
const res = await paoductCategoryApi.getPage({
|
||||
page: 0,
|
||||
size: 100,
|
||||
page: 1,
|
||||
size: 600,
|
||||
});
|
||||
this.categoryList = res.content;
|
||||
this.categoryList = res.records;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
@ -194,17 +199,12 @@ export default {
|
|||
} else {
|
||||
this.goods = [];
|
||||
}
|
||||
this.resetHandle();
|
||||
|
||||
console.log(categoryId);
|
||||
|
||||
if (categoryId) {
|
||||
this.searhForm.category = categoryId;
|
||||
}
|
||||
|
||||
console.log(this.searhForm);
|
||||
|
||||
await this.tbShopCategoryGet();
|
||||
|
||||
await this.getTableData();
|
||||
},
|
||||
close() {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
<div class="tab" v-if="!preview">
|
||||
<el-radio-group v-model="typeListActive" @change="tabChange">
|
||||
<el-radio-button :label="item.id" v-for="item in typeList" :key="item.id">
|
||||
<el-radio-button :value="item.id" v-for="item in typeList" :key="item.id">
|
||||
{{ item.name }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
|
@ -61,16 +61,19 @@
|
|||
<el-button type="primary" :loading="loading" @click="submitHandle">保 存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<GoodsSelect ref="refSelGoods"></GoodsSelect>
|
||||
<GoodsSelect
|
||||
ref="refSelGoods"
|
||||
radio
|
||||
disableCategory
|
||||
@success="selectConfirmGoods"
|
||||
></GoodsSelect>
|
||||
<!-- <shopList ref="shopList" disableCategory radio @success="selectConfirmGoods" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { layoutList } from "./layout.js";
|
||||
// import shopList from "@/components/shopList/index.vue";
|
||||
// import { tbProduct } from "@/api/shop.js";
|
||||
// import { layoutlist, productGroup, productCategoryDetail, productGroupPut } from "@/api/pad.js";
|
||||
import { ElNotification } from "element-plus";
|
||||
import padApi from "@/api/account/padProd";
|
||||
export default {
|
||||
props: {
|
||||
category: {
|
||||
|
|
@ -88,7 +91,7 @@ export default {
|
|||
id: "",
|
||||
list: [],
|
||||
},
|
||||
typeListActive: 1,
|
||||
typeListActive: "1",
|
||||
typeList: [],
|
||||
preview: false,
|
||||
};
|
||||
|
|
@ -128,7 +131,7 @@ export default {
|
|||
try {
|
||||
if (this.typeList.find((item) => item.id == this.typeListActive).code == "text-menu") {
|
||||
if (!this.form.list.length) {
|
||||
this.$notify.error({
|
||||
ElNotification.error({
|
||||
title: "错误",
|
||||
message: "请生成菜单",
|
||||
});
|
||||
|
|
@ -142,7 +145,7 @@ export default {
|
|||
});
|
||||
|
||||
if (!isEmpty) {
|
||||
this.$notify.error({
|
||||
ElNotification.error({
|
||||
title: "错误",
|
||||
message: "请添加商品",
|
||||
});
|
||||
|
|
@ -152,35 +155,27 @@ export default {
|
|||
this.loading = true;
|
||||
let res = null;
|
||||
if (this.form.id) {
|
||||
await productGroupPut({
|
||||
await padApi.edit({
|
||||
id: this.form.id,
|
||||
padLayoutId: this.typeListActive,
|
||||
customName: "",
|
||||
productCategoryId: this.category || this.form.list[0].categoryId,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
sort: 1,
|
||||
remark: "",
|
||||
productIdList: this.form.list.map((item) => item.id),
|
||||
});
|
||||
} else {
|
||||
res = await productGroup({
|
||||
res = await padApi.add({
|
||||
padLayoutId: this.typeListActive,
|
||||
customName: "",
|
||||
productCategoryId: this.category,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
sort: 1,
|
||||
remark: "",
|
||||
productIdList: this.form.list.map((item) => item.id),
|
||||
});
|
||||
}
|
||||
this.loading = false;
|
||||
if (this.form.id) {
|
||||
this.$notify.success({
|
||||
ElNotification.success({
|
||||
title: "提示",
|
||||
message: "编辑成功",
|
||||
});
|
||||
} else {
|
||||
this.$notify.success({
|
||||
ElNotification.success({
|
||||
title: "提示",
|
||||
message: "添加成功",
|
||||
});
|
||||
|
|
@ -194,11 +189,9 @@ export default {
|
|||
},
|
||||
// 获取
|
||||
async layoutlist() {
|
||||
this.typeList = layoutList;
|
||||
return;
|
||||
try {
|
||||
const res = await layoutlist();
|
||||
this.typeList = res;
|
||||
const res = await padApi.getLayout();
|
||||
this.typeList = res.records;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
@ -212,15 +205,16 @@ export default {
|
|||
selectConfirmGoods(res) {
|
||||
// this.form.list = res
|
||||
const flag = this.form.list.filter((item) => item.id == res[0].id);
|
||||
this.form.list[this.activeItem] = { ...res[0] };
|
||||
|
||||
if (flag.length) {
|
||||
this.$notify({
|
||||
ElNotification({
|
||||
title: "注意",
|
||||
message: "请勿重复添加",
|
||||
type: "error",
|
||||
});
|
||||
} else {
|
||||
this.$set(this.form.list, this.activeItem, { ...res[0] });
|
||||
this.form.list[this.activeItem] = { ...res[0] };
|
||||
}
|
||||
},
|
||||
// 切换tab
|
||||
|
|
@ -241,7 +235,7 @@ export default {
|
|||
async productCategoryDetail(id) {
|
||||
try {
|
||||
this.pageLoading = true;
|
||||
const res = await productCategoryDetail(id);
|
||||
const res = await padApi.get({ id });
|
||||
this.pageLoading = false;
|
||||
this.typeListActive = res.padLayoutId;
|
||||
this.form.id = res.id;
|
||||
|
|
@ -259,7 +253,7 @@ export default {
|
|||
// 显示 type=1 编辑 type=2预览
|
||||
async show(id = "", type = 1) {
|
||||
this.reset();
|
||||
this.typeListActive = 1;
|
||||
this.typeListActive = "1";
|
||||
this.dialogVisible = true;
|
||||
this.tabChange();
|
||||
if (id) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
<el-table-column label="自定义分类" prop="customName"></el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" v-if="isPcBowser">拖动排序</el-button>
|
||||
<el-button type="text" @click="editorHandle(scope.row, 1)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle(scope.row.id)">
|
||||
<template #reference>
|
||||
|
|
@ -76,7 +75,7 @@ import AddPadPage from "./components/addPadPage.vue";
|
|||
import paoductCategoryApi from "@/api/product/productclassification";
|
||||
import padProdApi from "@/api/account/padProd";
|
||||
import { swapArrayEle } from "@/utils/tools.js";
|
||||
|
||||
import { ElMessage, ElNotification } from "element-plus";
|
||||
export default {
|
||||
components: {
|
||||
AddPadPage,
|
||||
|
|
@ -101,11 +100,6 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
this.tbShopCategoryGet();
|
||||
if (this.isPcBowser) {
|
||||
this.$nextTick(() => {
|
||||
this.tableDrag();
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 搜索分类
|
||||
|
|
@ -150,8 +144,8 @@ export default {
|
|||
// 删除
|
||||
async delTableHandle(id) {
|
||||
try {
|
||||
await padProdApi.delete(id);
|
||||
this.$message.success("已删除");
|
||||
await padProdApi.delete({ id });
|
||||
ElMessage.success("已删除");
|
||||
this.getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
@ -171,7 +165,7 @@ export default {
|
|||
if (this.selectCatory.id) {
|
||||
this.$refs.AddPadPage.show();
|
||||
} else {
|
||||
this.$notify.error({
|
||||
ElNotification.error({
|
||||
title: "错误",
|
||||
message: "请选择分类",
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue