Authored by htoooth

fix

@@ -133,7 +133,7 @@ export default { @@ -133,7 +133,7 @@ export default {
133 from: { 133 from: {
134 type: String, 134 type: String,
135 default() { 135 default() {
136 - return 'offsale'; 136 + return 'product.offsale';
137 } 137 }
138 } 138 }
139 }, 139 },
@@ -167,6 +167,8 @@ export default { @@ -167,6 +167,8 @@ export default {
167 }; 167 };
168 }, 168 },
169 created() { 169 created() {
  170 + this.from = this.$route.query.from || 'product.offsale';
  171 +
170 service.getProduct(this.$route.params.id).then((result) => { 172 service.getProduct(this.$route.params.id).then((result) => {
171 _.update(result, 'goodsSeason', (s) => `${s}`); 173 _.update(result, 'goodsSeason', (s) => `${s}`);
172 if (!_.has(result, 'materialList')) { 174 if (!_.has(result, 'materialList')) {
@@ -501,12 +503,7 @@ export default { @@ -501,12 +503,7 @@ export default {
501 desc: '该商品保存成功!' 503 desc: '该商品保存成功!'
502 }); 504 });
503 505
504 - if (this.from === 'offsale') {  
505 - this.goOffSale();  
506 - } else {  
507 - this.goOnlineSale();  
508 - }  
509 - 506 + this.go(this.from);
510 } else { 507 } else {
511 this.$Notice.error({ 508 this.$Notice.error({
512 title: '保存错误', 509 title: '保存错误',
@@ -516,11 +513,8 @@ export default { @@ -516,11 +513,8 @@ export default {
516 } 513 }
517 }); 514 });
518 }, 515 },
519 - goOffSale() {  
520 - this.$router.push({ name: 'product.offsale' });  
521 - },  
522 - goOnlineSale() {  
523 - this.$router.push({ name: 'product.online' }); 516 + go(from) {
  517 + this.$router.push({ name: from });
524 }, 518 },
525 submit() { 519 submit() {
526 this.validate() 520 this.validate()
@@ -296,7 +296,9 @@ @@ -296,7 +296,9 @@
296 name: 'product.edit', 296 name: 'product.edit',
297 params: { 297 params: {
298 id: skn, 298 id: skn,
299 - from: 'offsale' 299 + },
  300 + query: {
  301 + from: 'product.offsale'
300 } 302 }
301 }); 303 });
302 }, 304 },
@@ -272,8 +272,10 @@ @@ -272,8 +272,10 @@
272 this.$router.push({ 272 this.$router.push({
273 name: 'product.edit', 273 name: 'product.edit',
274 params: { 274 params: {
275 - id: skn,  
276 - from: 'onsale' 275 + id: skn
  276 + },
  277 + query: {
  278 + from: 'product.onsale'
277 } 279 }
278 }); 280 });
279 }, 281 },