商品标签

This commit is contained in:
@fawn-nine
2023-09-22 11:39:25 +08:00
parent 7a283e7859
commit 036ca42ae9
2 changed files with 40 additions and 7 deletions

View File

@@ -93,11 +93,11 @@
trigger: 'blur'
}],
productImages: [{
required: true,
message: '商品图不能为空',
trigger: 'blur'
}],
// productImages: [{
// required: true,
// message: '商品图不能为空',
// trigger: 'blur'
// }],
},
// 富文本编辑器配置

View File

@@ -14,6 +14,11 @@
<el-form-item label="商品名称" prop="productName">
<el-input v-model="dataForm.productName" placeholder="商品名称"></el-input>
</el-form-item>
<el-form-item label="商品标签" prop="tags">
<el-checkbox-group v-model="dataForm.tags" @change="handleCheckedCitiesChange">
<el-checkbox v-for="item in tagList" :label="item.splId" :key="item.splId">{{item.labelName}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<!-- 关联的图书ids -->
<el-form-item label="关联图书" prop="Books">
<el-table
@@ -175,6 +180,7 @@
checkStrictly: true
},
dataForm: {
tags:[], // 商品标签
hDprice: 0, // 活动价
productId: 0,
limitCountImg: 1, // 图片数量
@@ -306,14 +312,37 @@
['image', 'video'] // 链接、图片、视频
]
},
placeholder: '请输入正文'
placeholder: '请输入正文',
},
tagList:[]
}
},
created() {
this.getTreeList()
this.getTags()
},
methods: {
handleCheckedCitiesChange(value) {
console.log(value, 'value')
this.dataForm.tagList = value
},
// 获取商品标签
getTags() {
this.$http({
url: this.$http.adornUrl('/book/label/getLabels'),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
this.tagList = data.result.labels
// this.totalPage = data.page.totalCount
} else {
this.tagList = []
// this.totalPage = 0
}
})
},
showChooseBook() {
// 显示图书列表
this.$emit("showchooseBookf", { 'bookIds': this.dataForm.Books });
@@ -334,6 +363,8 @@
data
}) => {
if (data && data.code === 0) {
this.dataForm.tags = data.labels
console.log('收到的值', this.dataForm.tags)
this.dataForm.productName = data.shopProduct.productName
this.dataForm.price = data.shopProduct.price
this.dataForm.goodsType = data.shopProduct.goodsType
@@ -455,6 +486,7 @@
'author': this.dataForm.author,
'publisher': this.dataForm.publisher,
'pubDate': this.dataForm.pubDate,
'shoproudLabels': this.dataForm.tagList,
// 'format': this.dataForm.format, // 开本
'isFreeMail': this.dataForm.isFreeMail,
// 'pageNum': this.dataForm.pageNum,
@@ -556,8 +588,9 @@
this.dataForm.noneBtnImg = fileList.length >= this.dataForm.limitCountImg;
},
handlereset() {
this.fileList = [],
this.fileList = [],
this.visible = false
this.dataForm.tagList = []
this.dataForm.Books = []
this.swiperfileList = []
this.$refs['dataForm'].resetFields()