提交 ea05584a authored 作者: huaxinzhu's avatar huaxinzhu

添加商品bug修复;拦截器 统一message

上级 77569b97
......@@ -58,7 +58,7 @@ service.interceptors.response.use(res => {
// 返回所有数据的统一处理
const data = res.data;
// 获取错误信息
const message = errorCode[code] || res.data.msg || errorCode['default'];
const message = errorCode[code] || res.data.message || errorCode['default'];
// 200,1意味着成功返回数据
if(code === 200 || code === 1) {
if( res.data ) {
......
......@@ -115,6 +115,7 @@
<script>
import { NewGetCategory, GetFreight, UploadImg } from '@/api/module/goods'
import { getBrandsInf } from '@/api/module/brand/brand'
import { getAreaList } from '@/api/module/retreat/address'
export default {
name: 'goods',
props: {
......@@ -224,7 +225,7 @@
this.goodsInfoForm.categoryList = this.goodsinfodata.categoryList;
}
// 获取 省
//this.getArea();
this.getArea();
// 获取 商品品牌
this.getBrands();
},
......@@ -235,24 +236,18 @@
this.goodsImgFileList = [];
},
// 获取 省
// getArea() {
// let limboNode = {
// pid: 0
// };
// NewGetCategory(limboNode).then( res=> {
// if(res.data && res.data.length > 0) {
// res.data.forEach( item => {
// let obj = { value: '', label: '' };
// obj.value = item.id;
// obj.label = item.label;
// this.areaOptions.push(obj);
// });
// //this.areaOptions = res.data;
// }else {
// this.areaOptions = [];
// }
// });
// },
getArea() {
let limboNode = {
pid: 0
};
getAreaList(limboNode).then( res => {
if( res.data && res.data.length > 0) {
this.areaOptions = res.data;
}else {
this.areaOptions = [];
}
});
},
// 获取 商品品牌
getBrands() {
getBrandsInf().then( res => {
......
......@@ -260,6 +260,13 @@ export default {
};
let localArr = [];
let localJSON = '';
// 去 首尾空格
this.specName_sm = this.specName_sm.trim();
if( !this.specName_sm ) {
this.$message({ type:'error',message: '规格名称不能为空' });
return
}
if(this.speOptions.length === 0) {
let localObj = {
......
......@@ -181,6 +181,9 @@
imgs: res.data.imgs // 商品图片
}
this.goodsinfodata.categoryStr = res.data.category_first_name + '/' + res.data.category_first_name + '/' + res.data.category_three_name;
// 产地 和 发货地 需要 处理
this.goodsinfodata.producing_area = this.goodsinfodata.producing_area === 0 ? '' : this.goodsinfodata.producing_area;
this.goodsinfodata.deliver_area = this.goodsinfodata.deliver_area === 0 ? '' : this.goodsinfodata.deliver_area;
let arr = [];
arr[0] = res.data.category_first_id;
arr[0] = res.data.category_second_id;
......@@ -376,6 +379,7 @@
// 保存/提交
save() {
//debugger
// 此处变量 有顺序 校验时,电梯至某处
// 商品信息 是否填写完整
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论