提交 29977bce 编写于 作者: shuang.zhou's avatar shuang.zhou

获取全部商品分类

上级 e18787c2
...@@ -201,3 +201,14 @@ export const saveMedList = (data) => { ...@@ -201,3 +201,14 @@ export const saveMedList = (data) => {
}); });
}; };
// 获取商品分类 / store / commodity / categorys / cascade / listAll;
export const getGoodsListAll = (params) => {
return fetch({
headers,
url: getBaseUrl(`store/commodity/categorys/cascade/listAll`),
method: "get",
params,
description: "查询商品类别",
});
};
\ No newline at end of file
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<el-cascader <el-cascader
size="small" size="small"
ref="cascader" ref="cascader"
:options="goodsCategoryList"
:props="cascaderProps" :props="cascaderProps"
clearable clearable
filterable filterable
...@@ -691,7 +692,7 @@ ...@@ -691,7 +692,7 @@
import { openLoading, closeLoading, signFigures } from "@/utils/utils"; import { openLoading, closeLoading, signFigures } from "@/utils/utils";
import { isEmptyUtils } from "@/utils/index"; import { isEmptyUtils } from "@/utils/index";
import { doUpload, getFilePath, createFilePath } from "@/utils/qiniu-util"; import { doUpload, getFilePath, createFilePath } from "@/utils/qiniu-util";
import { updateGoods ,updateStock,getGoodsList, getGoodDetails, updateGoodsV2,getContractList, getCooperationProjectList, getGoodsCascadeList,getMedList,getCategorysList,saveMedList} from '@/utils/goods'; import { updateGoods ,updateStock,getGoodsList, getGoodDetails, updateGoodsV2,getContractList, getCooperationProjectList,getMedList,getCategorysList,saveMedList,getGoodsListAll} from '@/utils/goods';
import { getStoreAdressRepot } from "@/utils/shop"; import { getStoreAdressRepot } from "@/utils/shop";
import Cropper from '@/components/common/cropper.vue' import Cropper from '@/components/common/cropper.vue'
import { originRules1, originRules, originRules3 } from './common/rules'; import { originRules1, originRules, originRules3 } from './common/rules';
...@@ -715,36 +716,10 @@ ...@@ -715,36 +716,10 @@
goodsCategoryIdList: [], goodsCategoryIdList: [],
cascaderProps: { cascaderProps: {
multiple: true, multiple: true,
lazy: true, value: 'id',
checkStrictly: true, label: 'categoryName',
lazyLoad: (node, resolve) => { children:'children'
console.log('lazyLoad', node); // checkStrictly: true
const { level, root, value } = node;
console.log('lazyLoad', node);
const caLevel = level + 1;
const params = {
parentId: 0,
categoryLevel: caLevel
};
if (!root) {
params.parentId = value;
params.categoryLevel = caLevel;
}
getGoodsCascadeList(params.parentId,params.categoryLevel).then((res) => {
const {code} = res;
const {data} = res;
if (code !== '000000') {
resolve([]);
return;
}
const nodes = data.map(item => ({
value: item.id,
label: item.categoryName
}));
// 通过调用resolve将子节点数据返回,通知组件数据加载完成
resolve(nodes);
});
}
}, },
isNewMeddialog: false, // 新增药品弹窗 isNewMeddialog: false, // 新增药品弹窗
isSelectGoods: false, // 是否选择了添加药品 isSelectGoods: false, // 是否选择了添加药品
...@@ -842,7 +817,8 @@ ...@@ -842,7 +817,8 @@
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
totalRows: 0, totalRows: 0,
isAddServe: false// 新增药品时 添加的是否为服务类 || 虚拟商品 isAddServe: false, // 新增药品时 添加的是否为服务类 || 虚拟商品
goodsCategoryList: []
} }
}, },
computed: { computed: {
...@@ -884,8 +860,18 @@ ...@@ -884,8 +860,18 @@
if (this.formData.incrType == null || this.formData.incrType === '') { if (this.formData.incrType == null || this.formData.incrType === '') {
this.formData.incrType = 2; this.formData.incrType = 2;
} }
this.getGoodsListAll();
}, },
methods: { methods: {
getGoodsListAll() {
getGoodsListAll().then(res => {
if (res.code == '000000') {
this.goodsCategoryList = res.data;
console.log(this.goodsCategoryList, 'goodsCategoryListgoodsCategoryList')
}
console.log(res, 'getGoodsListAll')
})
},
// 取消 // 取消
cancelComplete() { cancelComplete() {
this.$confirm('取消后您填写的信息将不会被保存', '确认取消吗?', { this.$confirm('取消后您填写的信息将不会被保存', '确认取消吗?', {
...@@ -1130,7 +1116,7 @@ ...@@ -1130,7 +1116,7 @@
}); });
} }
const {goodsList, hasRepoFlag } = res.data; const {goodsList, hasRepoFlag } = res.data;
const { goodsName, goodsDescription, goodsType,expressLimitFlag, goodsHeaderImages=[], goodsVideoList=[],contractId, cooperationProjectId, medicationId,goodsCategoryIdArr:goodsCategoryIdList } = goodsList[0]; const { goodsName, goodsDescription, goodsType,expressLimitFlag, goodsHeaderImages=[], goodsVideoList=[],contractId, cooperationProjectId, medicationId,goodsCategoryIdArr } = goodsList[0];
const goodDet = goodsList[0]; const goodDet = goodsList[0];
goodDet.otc1 = goodDet.otc ? '1' : '0'; goodDet.otc1 = goodDet.otc ? '1' : '0';
// 查询药品列表 // 查询药品列表
...@@ -1140,7 +1126,10 @@ ...@@ -1140,7 +1126,10 @@
this.isContract = Boolean(contractId); this.isContract = Boolean(contractId);
// this.formData1 = goodDet; // this.formData1 = goodDet;
this.formData = goodDet; this.formData = goodDet;
this.formData3 = { goodsName, goodsDescription, goodsHeaderImages, goodsVideoList, goodsType, expressLimitFlag,contractId, cooperationProjectId,goodsCategoryIdList }; this.formData3 = { goodsName, goodsDescription, goodsHeaderImages, goodsVideoList, goodsType, expressLimitFlag,contractId, cooperationProjectId, };
const arr = [[40116],[40117, 40118, 40119, ]]
this.formData3.goodsCategoryIdList = arr;
console.log(this.formData3.goodsCategoryIdList, 'this.formData3.goodsCategoryIdListthis.formData3.goodsCategoryIdList')
this.hasRepoFlag = hasRepoFlag; this.hasRepoFlag = hasRepoFlag;
this.buyLimitDtoList = this.formData.buyLimitDtoList; this.buyLimitDtoList = this.formData.buyLimitDtoList;
this.formData.optPrice = this.formData.costPrice/100; this.formData.optPrice = this.formData.costPrice/100;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册