|
@@ -30,13 +30,9 @@
|
|
|
<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
|
|
|
- >
|
|
|
- <el-option :label="item.name" :value="item.categoryId" v-for="(item, index) in goodsCategoryItemsList" :key="index" />
|
|
|
- </el-select>
|
|
|
+ <el-cascader
|
|
|
+ v-model="addData.categoryId" clearable
|
|
|
+ :options="goodsCategoryItemsList" :props="{ expandTrigger: 'hover', value: 'categoryId',label: 'name', children: 'goodsCategoryList', }"></el-cascader>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -183,7 +179,7 @@ import WangEditor from '@/components/WangEditor'
|
|
|
import Spec from './components/spec'
|
|
|
import TinyEditor from '@/components/TinyEditor'
|
|
|
import { getGoodsDetail, addGoods } from '@/api/business/goods'
|
|
|
-import { goodsCategoryItems } from '@/api/business/category'
|
|
|
+import { goodsCategoryListTree } from '@/api/business/category'
|
|
|
import { getSupplierList } from '@/api/business/supplier'
|
|
|
import { goodsTagItems } from '@/api/business/tag'
|
|
|
import { publicFileGetUrl } from "@/api/common"
|
|
@@ -297,8 +293,8 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
getGoodsCategoryItems(){
|
|
|
- goodsCategoryItems({}).then(res => {
|
|
|
- this.goodsCategoryItemsList = res && res.data
|
|
|
+ goodsCategoryListTree("",{}).then(res => {
|
|
|
+ this.goodsCategoryItemsList = res && res.rows
|
|
|
})
|
|
|
},
|
|
|
//获取供应商
|
|
@@ -330,12 +326,13 @@ export default {
|
|
|
this.$refs.addItem.validate((valid, items) => {
|
|
|
if (valid) {
|
|
|
this.addData.skuList = skuList
|
|
|
- const { value, cost,exchangePrice, description, ...rest } = this.addData
|
|
|
+ const { value, categoryId, cost,exchangePrice, description, ...rest } = this.addData
|
|
|
addGoods({...rest, ...{
|
|
|
value: accMul(value, 100),
|
|
|
cost: cost == '' || cost == null ? '' : accMul(cost, 100),
|
|
|
exchangePrice: accMul(exchangePrice, 1),
|
|
|
- description: encodeURI(description)
|
|
|
+ description: encodeURI(description),
|
|
|
+ categoryId:categoryId[1],
|
|
|
}}).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
this.$message({
|