This commit is contained in:
parent
64794aa8b8
commit
41648aa4c5
|
|
@ -790,7 +790,7 @@ export default {
|
||||||
this.form.selectSpec = JSON.stringify(this.selectSpec);
|
this.form.selectSpec = JSON.stringify(this.selectSpec);
|
||||||
this.form.specTableHeaders = JSON.stringify(this.specTableHeaders);
|
this.form.specTableHeaders = JSON.stringify(this.specTableHeaders);
|
||||||
this.form.specInfo = JSON.stringify(this.form.skuList);
|
this.form.specInfo = JSON.stringify(this.form.skuList);
|
||||||
this.form.skuList[0].costPrice = 0
|
// this.form.skuList[0].costPrice = 0
|
||||||
this.form.skuList[0].originPrice = this.form.skuList[0].salePrice
|
this.form.skuList[0].originPrice = this.form.skuList[0].salePrice
|
||||||
if (this.form.id) {
|
if (this.form.id) {
|
||||||
await tbProductPut(this.form);
|
await tbProductPut(this.form);
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,18 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="btn_wrap">
|
<div class="btn_wrap" v-if="!form.list.length">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<el-button>一键生成菜单</el-button>
|
<el-button @click="oneClick">一键生成菜单</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="goods_list" v-else>
|
||||||
|
<div class="btn_wrap" :class="[`div${index + 1}`]" v-for="(item, index) in form.list"
|
||||||
|
:key="index" @click="selectGoods(item)">
|
||||||
|
<div class="info" :class="{ active: item.active }">
|
||||||
|
<span class="t1">{{ item.name }}</span>
|
||||||
|
<span class="t1">¥{{ item.lowPrice }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -43,6 +52,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import shopList from '@/components/shopList/index.vue'
|
import shopList from '@/components/shopList/index.vue'
|
||||||
|
import { tbProduct } from '@/api/shop.js'
|
||||||
import { layoutlist, productGroup, productCategoryDetail, productGroupPut } from '@/api/pad.js'
|
import { layoutlist, productGroup, productCategoryDetail, productGroupPut } from '@/api/pad.js'
|
||||||
export default {
|
export default {
|
||||||
components: { shopList },
|
components: { shopList },
|
||||||
|
|
@ -71,9 +81,58 @@ export default {
|
||||||
this.layoutlist()
|
this.layoutlist()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 选中菜品
|
||||||
|
selectGoods(item) {
|
||||||
|
item.active = !item.active
|
||||||
|
},
|
||||||
|
// 一键生成菜单
|
||||||
|
async oneClick() {
|
||||||
|
try {
|
||||||
|
const res = await tbProduct({
|
||||||
|
categoryId: this.category,
|
||||||
|
page: 0,
|
||||||
|
size: 20,
|
||||||
|
sort: "id",
|
||||||
|
shopId: localStorage.getItem('shopId')
|
||||||
|
})
|
||||||
|
this.form.list = res.content.map((item, index) => {
|
||||||
|
if (index == 0 || index == 12) {
|
||||||
|
item.active = true
|
||||||
|
} else {
|
||||||
|
item.active = false
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
// 提交
|
// 提交
|
||||||
async submitHandle() {
|
async submitHandle() {
|
||||||
try {
|
try {
|
||||||
|
if (this.typeList.find(item => item.id == this.typeListActive).code == 'text-menu') {
|
||||||
|
if (!this.form.list.length) {
|
||||||
|
this.$notify.error({
|
||||||
|
title: '错误',
|
||||||
|
message: '请生成菜单'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let isEmpty = true
|
||||||
|
this.form.list.map(item => {
|
||||||
|
if (!item.id) isEmpty = false
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!isEmpty) {
|
||||||
|
this.$notify.error({
|
||||||
|
title: '错误',
|
||||||
|
message: '请添加商品'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.loading = true
|
this.loading = true
|
||||||
let res = null
|
let res = null
|
||||||
if (this.form.id) {
|
if (this.form.id) {
|
||||||
|
|
@ -99,7 +158,17 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.$message.success(this.form.id ? '编辑成功' : '添加成功')
|
if (this.form.id) {
|
||||||
|
this.$notify.success({
|
||||||
|
title: '提示',
|
||||||
|
message: '编辑成功'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$notify.success({
|
||||||
|
title: '提示',
|
||||||
|
message: '添加成功'
|
||||||
|
})
|
||||||
|
}
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
this.$emit('success')
|
this.$emit('success')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -264,9 +333,139 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.type6 {
|
||||||
|
.goods_list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
grid-template-rows: repeat(10, 1fr);
|
||||||
|
grid-column-gap: 20px;
|
||||||
|
grid-row-gap: 0px;
|
||||||
|
|
||||||
|
.div1 {
|
||||||
|
grid-area: 1 / 1 / 2 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div2 {
|
||||||
|
grid-area: 2 / 1 / 3 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div3 {
|
||||||
|
grid-area: 3 / 1 / 4 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div4 {
|
||||||
|
grid-area: 4 / 1 / 5 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div5 {
|
||||||
|
grid-area: 5 / 1 / 6 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div6 {
|
||||||
|
grid-area: 6 / 1 / 7 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div7 {
|
||||||
|
grid-area: 7 / 1 / 8 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div8 {
|
||||||
|
grid-area: 8 / 1 / 9 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div9 {
|
||||||
|
grid-area: 9 / 1 / 10 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div10 {
|
||||||
|
grid-area: 10 / 1 / 11 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div11 {
|
||||||
|
grid-area: 1 / 2 / 2 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div12 {
|
||||||
|
grid-area: 2 / 2 / 3 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div13 {
|
||||||
|
grid-area: 3 / 2 / 4 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div14 {
|
||||||
|
grid-area: 4 / 2 / 5 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div15 {
|
||||||
|
grid-area: 5 / 2 / 6 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div16 {
|
||||||
|
grid-area: 6 / 2 / 7 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div17 {
|
||||||
|
grid-area: 7 / 2 / 8 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div18 {
|
||||||
|
grid-area: 8 / 2 / 9 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div19 {
|
||||||
|
grid-area: 9 / 2 / 10 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div20 {
|
||||||
|
grid-area: 10 / 2 / 11 / 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods_list {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.btn_wrap {
|
.btn_wrap {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.info {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
padding: 0 20px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background-color: #BC1414;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
width: 120px;
|
||||||
|
height: 60px;
|
||||||
|
border: 22px solid #fff;
|
||||||
|
border-top: none;
|
||||||
|
border-right: none;
|
||||||
|
opacity: .3;
|
||||||
|
position: absolute;
|
||||||
|
top: -20px;
|
||||||
|
right: 10%;
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,10 @@ export default {
|
||||||
if (this.selectCatory.id) {
|
if (this.selectCatory.id) {
|
||||||
this.$refs.AddPadPage.show()
|
this.$refs.AddPadPage.show()
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning('请选择分类')
|
this.$notify.error({
|
||||||
|
title: '错误',
|
||||||
|
message: '请选择分类'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 分类被点击
|
// 分类被点击
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue