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

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

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