Authored by Aiden Xu

商品详情

@@ -25,7 +25,7 @@ const component = { @@ -25,7 +25,7 @@ const component = {
25 const id = req.params[0]; 25 const id = req.params[0];
26 26
27 let params = { 27 let params = {
28 - // uid: req.user.uid || 8050378 // TODO: fix this hard coded uid 28 + uid: req.user.uid || 0,
29 article_id: id, 29 article_id: id,
30 client_type: 'h5' 30 client_type: 'h5'
31 }; 31 };
@@ -31,7 +31,7 @@ const component = { @@ -31,7 +31,7 @@ const component = {
31 31
32 let params = { 32 let params = {
33 productId: _.toString(pid), 33 productId: _.toString(pid),
34 - uid: req.user.uid || 8050378 // TODO: fix this hard coded uid 34 + uid: req.user.uid || 0
35 }; 35 };
36 36
37 model.product(params).then(result => { 37 model.product(params).then(result => {
@@ -61,7 +61,7 @@ const component = { @@ -61,7 +61,7 @@ const component = {
61 edit_product_sku: req.body.isEdit || 0, // 是否是编辑商品SKU,0表示不是编辑 61 edit_product_sku: req.body.isEdit || 0, // 是否是编辑商品SKU,0表示不是编辑
62 selected: 'Y', 62 selected: 'Y',
63 promotion_id: req.body.promotionId || null, // 促销id,默认null(加价购有关) 63 promotion_id: req.body.promotionId || null, // 促销id,默认null(加价购有关)
64 - uid: req.user.uid || null, // TODO: fix uid 64 + uid: req.user.uid || 0,
65 shopping_key: global.yoho.cookie.getShoppingKey(req) 65 shopping_key: global.yoho.cookie.getShoppingKey(req)
66 }; 66 };
67 67
@@ -83,7 +83,7 @@ const component = { @@ -83,7 +83,7 @@ const component = {
83 */ 83 */
84 favorite(req, res, next) { 84 favorite(req, res, next) {
85 let params = { 85 let params = {
86 - uid: req.user.uid || 8050378, // TODO: fix this hard coded uid 86 + uid: req.user.uid || 0,
87 type: 'product' 87 type: 'product'
88 }; 88 };
89 89
@@ -111,7 +111,7 @@ const component = { @@ -111,7 +111,7 @@ const component = {
111 let params = { 111 let params = {
112 method: 'app.Shopping.count', 112 method: 'app.Shopping.count',
113 shopping_key: global.yoho.cookie.getShoppingKey(req), 113 shopping_key: global.yoho.cookie.getShoppingKey(req),
114 - uid: req.user.uid || 0 // TODO fix uid 114 + uid: req.user.uid || 0
115 }; 115 };
116 116
117 api.get('', params).then(result => { 117 api.get('', params).then(result => {
@@ -388,6 +388,7 @@ @@ -388,6 +388,7 @@
388 const $ = require('yoho-jquery'); 388 const $ = require('yoho-jquery');
389 const app = $('#app'); 389 const app = $('#app');
390 const tip = require('common/tip'); 390 const tip = require('common/tip');
  391 + const yoho = require('yoho');
391 392
392 require('yoho-vue-swipe/dist/vue-swipe.css'); 393 require('yoho-vue-swipe/dist/vue-swipe.css');
393 394
@@ -406,6 +407,7 @@ @@ -406,6 +407,7 @@
406 }, 407 },
407 showFeatureSelector: false, 408 showFeatureSelector: false,
408 cartCount: 0, 409 cartCount: 0,
  410 + yoho: yoho,
409 411
410 /** 412 /**
411 * 加入购物车回调 413 * 加入购物车回调
@@ -417,6 +419,10 @@ @@ -417,6 +419,10 @@
417 productSku: selection.size, 419 productSku: selection.size,
418 buyNumber: 1 420 buyNumber: 1
419 }).then((result)=> { 421 }).then((result)=> {
  422 + if (yoho.goShopingKey && result.data.shopping_key) {
  423 + yoho.goShopingKey(result.data.shopping_key);
  424 + }
  425 +
420 // TODO: 库存不足 后台暂未实现 426 // TODO: 库存不足 后台暂未实现
421 // TODO: 商品已下架 后台暂未实现 427 // TODO: 商品已下架 后台暂未实现
422 if (result.code === 200) { 428 if (result.code === 200) {
1 <template> 1 <template>
2 <div class="top-nav"> 2 <div class="top-nav">
3 - <a class="left" href="javascript:alert('TODO');"> 3 + <a class="left" href="javascript:void(0);" @click="yoho.goBack()">
4 <span class="icon icon-left"></span> 4 <span class="icon icon-left"></span>
5 </a> 5 </a>
6 6
7 - <a class="right" href="javascript:alert('TODO');"> 7 + <a class="right" href="javascript:void(0);" @click="yoho.goShare()">
8 <span class="icon icon-right"></span> 8 <span class="icon icon-right"></span>
9 </a> 9 </a>
10 </div> 10 </div>
@@ -26,4 +26,12 @@ @@ -26,4 +26,12 @@
26 } 26 }
27 } 27 }
28 </style> 28 </style>
29 -<script></script> 29 +<script>
  30 + module.exports = {
  31 + data() {
  32 + return {
  33 + yoho: require('yoho')
  34 + };
  35 + }
  36 + };
  37 +</script>