mirror of
https://gitee.com/gz-yami/mall4v.git
synced 2026-03-22 08:07:17 +08:00
补充代码
This commit is contained in:
@@ -152,9 +152,7 @@ const destroyTinymce = () => {
|
|||||||
const resourcesUrl = import.meta.env.VITE_APP_RESOURCES_URL
|
const resourcesUrl = import.meta.env.VITE_APP_RESOURCES_URL
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const imageSuccessCBK = (response, file, fileList) => {
|
const imageSuccessCBK = (response, file, fileList) => {
|
||||||
fileList.forEach(v => {
|
window.tinymce.get(props.id).insertContent(`<img alt="" src="${resourcesUrl + file.response.data}" >`)
|
||||||
window.tinymce.get(props.id).insertContent(`<img alt="" src="${resourcesUrl + v.response.data}" >`)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const scoreProdStore = defineStore('prod', {
|
|||||||
removeSkuTag (tagIndex) {
|
removeSkuTag (tagIndex) {
|
||||||
this.skuTags.splice(tagIndex, 1)
|
this.skuTags.splice(tagIndex, 1)
|
||||||
},
|
},
|
||||||
removeSkuTagItem ({ tagIndex, tagItemIndex }) {
|
removeSkuTagItem (tagIndex, tagItemIndex) {
|
||||||
this.skuTags[tagIndex].tagItems.splice(tagItemIndex, 1)
|
this.skuTags[tagIndex].tagItems.splice(tagItemIndex, 1)
|
||||||
},
|
},
|
||||||
addSkuTagItem ({ tagIndex, tagItem }) {
|
addSkuTagItem ({ tagIndex, tagItem }) {
|
||||||
|
|||||||
@@ -512,4 +512,7 @@ const changeOrder = (orderNumber) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
:deep(.el-steps--horizontal) {
|
||||||
|
flex: 25% 1 1;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ let initing = false
|
|||||||
|
|
||||||
const tableLeftTitles = computed(() => {
|
const tableLeftTitles = computed(() => {
|
||||||
const res = []
|
const res = []
|
||||||
for (let i = 0; i < skuTags.length; i++) {
|
for (let i = 0; i < skuTags.value.length; i++) {
|
||||||
const skuTag = skuTags[i]
|
const skuTag = skuTags.value[i]
|
||||||
res.push(skuTag.tagName)
|
res.push(skuTag.tagName)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -126,9 +126,10 @@ const type = ref(0)
|
|||||||
const tagItemName = ref('')
|
const tagItemName = ref('')
|
||||||
const tagItemInputs = ref([])
|
const tagItemInputs = ref([])
|
||||||
const dbTagValues = ref([]) // 根据选定的规格所查询出来的规格值
|
const dbTagValues = ref([]) // 根据选定的规格所查询出来的规格值
|
||||||
|
const dbTags = ref([]) // 数据库中的规格
|
||||||
|
|
||||||
let tagName = ''
|
let tagName = ''
|
||||||
let tagNameIndex = 0
|
let tagNameIndex = 0
|
||||||
let dbTags = [] // 数据库中的规格
|
|
||||||
let maxValueId = 0 // 规格值id最大
|
let maxValueId = 0 // 规格值id最大
|
||||||
let maxPropId = 0 // 规格id 最大
|
let maxPropId = 0 // 规格id 最大
|
||||||
let initing = false
|
let initing = false
|
||||||
@@ -138,7 +139,20 @@ const skuTags = computed({
|
|||||||
set (val) { prod.updateSkuTags(val) }
|
set (val) { prod.updateSkuTags(val) }
|
||||||
})
|
})
|
||||||
|
|
||||||
const unUseTags = ref([])
|
/**
|
||||||
|
* 未使用的规格, 通过计算属性计算
|
||||||
|
*/
|
||||||
|
const unUseTags = computed(() => {
|
||||||
|
const res = []
|
||||||
|
for (let i = 0; i < dbTags.value.length; i++) {
|
||||||
|
const dbTag = dbTags.value[i]
|
||||||
|
const specIndex = skuTags.value?.findIndex(tag => tag.tagName === dbTag.propName)
|
||||||
|
if (specIndex === -1) {
|
||||||
|
res.push(dbTag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
|
||||||
const defalutSku = computed(() => {
|
const defalutSku = computed(() => {
|
||||||
return prod.defalutSku
|
return prod.defalutSku
|
||||||
@@ -245,18 +259,9 @@ onMounted(() => {
|
|||||||
params: http.adornParams()
|
params: http.adornParams()
|
||||||
})
|
})
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
dbTags = data
|
dbTags.value = data
|
||||||
if (data) {
|
if (data) {
|
||||||
maxPropId = Math.max.apply(Math, data.map(item => item.propId))
|
maxPropId = Math.max.apply(Math, data.map(item => item.propId))
|
||||||
const res = []
|
|
||||||
for (let i = 0; i < dbTags.length; i++) {
|
|
||||||
const dbTag = dbTags[i]
|
|
||||||
const specIndex = skuTags.value?.findIndex(tag => tag.tagName === dbTag.propName)
|
|
||||||
if (specIndex === -1) {
|
|
||||||
res.push(dbTag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unUseTags.value = res
|
|
||||||
} else {
|
} else {
|
||||||
maxPropId = 0
|
maxPropId = 0
|
||||||
}
|
}
|
||||||
@@ -310,7 +315,7 @@ defineExpose({ init })
|
|||||||
* 显示规格名、规格值输入框
|
* 显示规格名、规格值输入框
|
||||||
*/
|
*/
|
||||||
const shopTagInput = () => {
|
const shopTagInput = () => {
|
||||||
isShowTagInput.value = !isShowTagInput.value
|
isShowTagInput.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -378,12 +383,12 @@ const handleTagClick = () => {
|
|||||||
dbTagValues.value = []
|
dbTagValues.value = []
|
||||||
addTagInput.value.selectValues = []
|
addTagInput.value.selectValues = []
|
||||||
// 判断规格名输入的值是否为数据库中已有的值
|
// 判断规格名输入的值是否为数据库中已有的值
|
||||||
const specsIndex = dbTags.findIndex(spec => spec.propName === addTagInput.value.propName)
|
const specsIndex = dbTags.value?.findIndex(spec => spec.propName === addTagInput.value.propName)
|
||||||
// 如果不是,则说明为用户随便输入
|
// 如果不是,则说明为用户随便输入
|
||||||
if (specsIndex === -1) return
|
if (specsIndex === -1) return
|
||||||
// 如果数据库已有该规格名,则获取根据id获取该规格名称含有的规格值
|
// 如果数据库已有该规格名,则获取根据id获取该规格名称含有的规格值
|
||||||
http({
|
http({
|
||||||
url: http.adornUrl(`/prod/spec/listSpecValue/${dbTags[specsIndex].propId}`),
|
url: http.adornUrl(`/prod/spec/listSpecValue/${dbTags.value[specsIndex].propId}`),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: http.adornParams()
|
params: http.adornParams()
|
||||||
}).then(({ data }) => {
|
}).then(({ data }) => {
|
||||||
@@ -523,4 +528,7 @@ const checkTagItem = (tagIndex) => {
|
|||||||
margin-left: 18px;
|
margin-left: 18px;
|
||||||
padding-bottom:8px;
|
padding-bottom:8px;
|
||||||
}
|
}
|
||||||
|
.el-form-item__content div {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -268,7 +268,9 @@ const onSubmit = Debounce(() => {
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
router.push({ name: 'prod-prodList' })
|
router.push({
|
||||||
|
path: '/prod/prodList'
|
||||||
|
})
|
||||||
emit('refreshDataList')
|
emit('refreshDataList')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
:expand-on-click-node="false"
|
:expand-on-click-node="false"
|
||||||
>
|
>
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<span>{{ node.label }}</span>
|
<span class="addr-name">{{ node.label }}</span>
|
||||||
<span>
|
<span>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
@@ -159,4 +159,7 @@ const filterNode = (value, data) => {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
:deep(.el-tree-node) .addr-name {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user