feat: pad点单设置修复
This commit is contained in:
@@ -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: "请选择分类",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user