|
@@ -28,6 +28,35 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
+ <el-row :gutter="40" style="width: 500px">
|
|
|
|
+ <el-col :span="23">
|
|
|
|
+ <el-form-item label="商品分类" prop="categoryId">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="addData.categoryId"
|
|
|
|
+ placeholder="请选择商品分类"
|
|
|
|
+ clearable
|
|
|
|
+ size="small"
|
|
|
|
+ >
|
|
|
|
+ <el-option :label="item.name" :value="item.categoryId" v-for="(item, index) in goodsCategoryItemsList" :key="index" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row :gutter="40" style="width: 500px">
|
|
|
|
+ <el-col :span="23">
|
|
|
|
+ <el-form-item label="商品标签">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="addData.tagIds"
|
|
|
|
+ placeholder="请选择商品标签"
|
|
|
|
+ multiple
|
|
|
|
+ clearable
|
|
|
|
+ size="small"
|
|
|
|
+ >
|
|
|
|
+ <el-option :label="item.name" :value="item.tagId" v-for="(item, index) in goodsTagItemsList" :key="index" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
<el-divider content-position="left">价格库存</el-divider>
|
|
<el-divider content-position="left">价格库存</el-divider>
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="23">
|
|
<el-col :span="23">
|
|
@@ -101,6 +130,8 @@ import Upload from '@/components/DragImageUpload'
|
|
import Spec from './components/spec'
|
|
import Spec from './components/spec'
|
|
import TinyEditor from '@/components/TinyEditor'
|
|
import TinyEditor from '@/components/TinyEditor'
|
|
import { getGoodsDetail, addGoods } from '@/api/business/goods'
|
|
import { getGoodsDetail, addGoods } from '@/api/business/goods'
|
|
|
|
+import { goodsCategoryItems } from '@/api/business/category'
|
|
|
|
+import { goodsTagItems } from '@/api/business/tag'
|
|
import { publicFileGetUrl } from "@/api/common"
|
|
import { publicFileGetUrl } from "@/api/common"
|
|
import { accDiv, accMul } from '@/utils/util'
|
|
import { accDiv, accMul } from '@/utils/util'
|
|
export default {
|
|
export default {
|
|
@@ -113,6 +144,8 @@ export default {
|
|
return {
|
|
return {
|
|
IMG_URL: publicFileGetUrl,
|
|
IMG_URL: publicFileGetUrl,
|
|
id: this.$route.query.id,
|
|
id: this.$route.query.id,
|
|
|
|
+ goodsCategoryItemsList: [],
|
|
|
|
+ goodsTagItemsList: [],
|
|
addData: {
|
|
addData: {
|
|
multiSku: 0,
|
|
multiSku: 0,
|
|
description: ''
|
|
description: ''
|
|
@@ -120,6 +153,7 @@ export default {
|
|
rules: {
|
|
rules: {
|
|
title: [{ required: true, message: '请输入商品名称', trigger: 'blur' }],
|
|
title: [{ required: true, message: '请输入商品名称', trigger: 'blur' }],
|
|
picUrl: [{ required: true, message: '请上传商品图片', trigger: 'change' }],
|
|
picUrl: [{ required: true, message: '请上传商品图片', trigger: 'change' }],
|
|
|
|
+ categoryId: [{ required: true, message: '请选择商品分类', trigger: 'change' }],
|
|
exchangeShow: [{ required: true, message: '请选择是否支持盲豆兑换', trigger: 'change' }],
|
|
exchangeShow: [{ required: true, message: '请选择是否支持盲豆兑换', trigger: 'change' }],
|
|
multiSku: [{ required: true, message: '请选择SKU类型', trigger: 'change' }],
|
|
multiSku: [{ required: true, message: '请选择SKU类型', trigger: 'change' }],
|
|
value: [
|
|
value: [
|
|
@@ -157,13 +191,15 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
|
|
+ this.getGoodsCategoryItems()
|
|
|
|
+ this.getGoodsTagItems()
|
|
if (this.id) {
|
|
if (this.id) {
|
|
getGoodsDetail(this.id).then(res => {
|
|
getGoodsDetail(this.id).then(res => {
|
|
- const { goodsId, title, picUrl, exchangeShow, multiSku, value, exchangePrice, cost, quantity, description, skuList } = res.data
|
|
|
|
|
|
+ const { goodsId, title, picUrl, exchangeShow, multiSku, value, exchangePrice, cost, quantity, description, skuList, categoryId, tagIds } = res.data
|
|
this.addData = {
|
|
this.addData = {
|
|
value: accDiv(value, 100),
|
|
value: accDiv(value, 100),
|
|
cost: cost == '' || cost == null ? '' : accDiv(cost, 100),
|
|
cost: cost == '' || cost == null ? '' : accDiv(cost, 100),
|
|
- goodsId, title, picUrl, exchangeShow, multiSku, exchangePrice, quantity, description, skuList
|
|
|
|
|
|
+ goodsId, title, picUrl, exchangeShow, multiSku, exchangePrice, quantity, description, skuList, categoryId, tagIds
|
|
}
|
|
}
|
|
if (multiSku && skuList instanceof Array && skuList.length > 0) {
|
|
if (multiSku && skuList instanceof Array && skuList.length > 0) {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -174,6 +210,16 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getGoodsCategoryItems(){
|
|
|
|
+ goodsCategoryItems({}).then(res => {
|
|
|
|
+ this.goodsCategoryItemsList = res && res.data
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ getGoodsTagItems(){
|
|
|
|
+ goodsTagItems({}).then(res => {
|
|
|
|
+ this.goodsTagItemsList = res && res.data
|
|
|
|
+ })
|
|
|
|
+ },
|
|
updateItem() {
|
|
updateItem() {
|
|
if (this.addData.multiSku == 1) {
|
|
if (this.addData.multiSku == 1) {
|
|
this.$refs.spec.getSkuList()
|
|
this.$refs.spec.getSkuList()
|