Authored by 陈轩

Merge remote-tracking branch 'origin/feature/seckill' into feature/seckill

@@ -121,7 +121,6 @@ const index = (req, res, next) => { @@ -121,7 +121,6 @@ const index = (req, res, next) => {
121 times: 12 121 times: 12
122 }, result, hbsHelper)); 122 }, result, hbsHelper));
123 }); 123 });
124 -  
125 }); 124 });
126 }; 125 };
127 126
@@ -986,7 +986,11 @@ const getSeckillData = (productSkn) => { @@ -986,7 +986,11 @@ const getSeckillData = (productSkn) => {
986 986
987 return api.get('', params, { 987 return api.get('', params, {
988 code: 200 988 code: 200
989 - }).then(result => { 989 + })
  990 +
  991 + //mock
  992 + .catch()
  993 + .then(result => {
990 let data = {}; 994 let data = {};
991 995
992 if (result.data) { 996 if (result.data) {
@@ -995,9 +999,9 @@ const getSeckillData = (productSkn) => { @@ -995,9 +999,9 @@ const getSeckillData = (productSkn) => {
995 999
996 data = { 1000 data = {
997 activityId: 4, 1001 activityId: 4,
998 - startTime: 1465194254,  
999 - endTime: 1475294254,  
1000 - formatSecKillPrice: '¥133.00', 1002 + startTime: 1475892120,
  1003 + endTime: 1476892120,
  1004 + formatSecKillPrice: '¥1234.00',
1001 id: 4, 1005 id: 4,
1002 orderBy: 0, 1006 orderBy: 0,
1003 productSkn: 512581470, 1007 productSkn: 512581470,
@@ -1029,7 +1033,21 @@ const getSeckillData = (productSkn) => { @@ -1029,7 +1033,21 @@ const getSeckillData = (productSkn) => {
1029 id: 2, 1033 id: 2,
1030 productSkn: 512581470, 1034 productSkn: 512581470,
1031 productSku: 1384444, 1035 productSku: 1384444,
1032 - storageNum: 0 1036 + storageNum: 4
  1037 + },
  1038 + {
  1039 + activityId: 4,
  1040 + id: 2,
  1041 + productSkn: 512581470,
  1042 + productSku: 138555,
  1043 + storageNum: 3
  1044 + },
  1045 + {
  1046 + activityId: 4,
  1047 + id: 2,
  1048 + productSkn: 512581470,
  1049 + productSku: 138666,
  1050 + storageNum: 3
1033 } 1051 }
1034 ], 1052 ],
1035 secKillStatus: 0, 1053 secKillStatus: 0,
@@ -1135,7 +1153,7 @@ let getProductData = (data) => { @@ -1135,7 +1153,7 @@ let getProductData = (data) => {
1135 1153
1136 // 秒杀详情页 1154 // 秒杀详情页
1137 1155
1138 - if (isSecKills && leftCount && info[5]) { 1156 + if (isSecKills && info[5]) {
1139 1157
1140 let end = info[5].status === 3 ? true : false; 1158 let end = info[5].status === 3 ? true : false;
1141 1159
@@ -1177,7 +1195,6 @@ let getProductData = (data) => { @@ -1177,7 +1195,6 @@ let getProductData = (data) => {
1177 consults: _.take(info[3], 2) 1195 consults: _.take(info[3], 2)
1178 }); 1196 });
1179 } 1197 }
1180 -  
1181 return finalResult; 1198 return finalResult;
1182 }); 1199 });
1183 1200
1 exports.activities = { 1 exports.activities = {
2 - "alg": "SALT_MD5",  
3 - "code": 200,  
4 - "data": {  
5 - "currentTime": 1473839306925,  
6 - "secKillProductVoList": [{  
7 - "activityId": 1,  
8 - "endTime": 1473739200,  
9 - "secKillStatus": 0,  
10 - "startTime": 1475096193,  
11 - "status": 0,  
12 - "storageSum": 0 2 + 'alg': 'SALT_MD5',
  3 + 'code': 200,
  4 + 'data': {
  5 + 'currentTime': 1473839306925,
  6 + 'secKillProductVoList': [{
  7 + 'activityId': 1,
  8 + 'endTime': 1473739200,
  9 + 'secKillStatus': 0,
  10 + 'startTime': 1475096193,
  11 + 'status': 0,
  12 + 'storageSum': 0
13 }, { 13 }, {
14 - "activityId": 2,  
15 - "endTime": 1473746400,  
16 - "secKillStatus": 0,  
17 - "startTime": 1475096193,  
18 - "status": 0,  
19 - "storageSum": 0 14 + 'activityId': 2,
  15 + 'endTime': 1473746400,
  16 + 'secKillStatus': 0,
  17 + 'startTime': 1475096193,
  18 + 'status': 0,
  19 + 'storageSum': 0
20 }, { 20 }, {
21 - "activityId": 3,  
22 - "endTime": Math.round((Date.now() + 1000 * 60 * 60 * 8) / 1000),  
23 - "secKillStatus": 0,  
24 - "startTime": Math.round((Date.now() + 1000 * 60 * 60) / 1000),  
25 - "status": 0,  
26 - "storageSum": 0 21 + 'activityId': 3,
  22 + 'endTime': Math.round((Date.now() + 1000 * 60 * 60 * 8) / 1000),
  23 + 'secKillStatus': 0,
  24 + 'startTime': Math.round((Date.now() + 1000 * 60 * 60) / 1000),
  25 + 'status': 0,
  26 + 'storageSum': 0
27 }] 27 }]
28 }, 28 },
29 - "md5": "b291f2aa3015749f676f50de0d513437",  
30 - "message": "query secKillActivity info" 29 + 'md5': 'b291f2aa3015749f676f50de0d513437',
  30 + 'message': 'query secKillActivity info'
31 }; 31 };
32 32
33 // 未开抢 mock 数据 33 // 未开抢 mock 数据
34 exports.waitData = { 34 exports.waitData = {
35 - "alg": "SALT_MD5",  
36 - "code": 200,  
37 - "data": [{  
38 - "activityId": 3,  
39 - "defaultImages": "http://img11.static.yhbimg.com/goodsimg/2016/09/12/14/018aea16153cec3ad0c677a106b5d95c53.png?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70",  
40 - "endTime": Math.round((Date.now() + 1000 * 60 * 60 * 7) / 1000),  
41 - "marketPrice": 100,  
42 - "productName": "blkheimei男休闲/运动鞋南京艾尚仅门店可售",  
43 - "productSkn": 512581470,  
44 - "secKillPrice": 40,  
45 - "secKillSku": [{  
46 - "productSkn": 512581470,  
47 - "productSku": 1384138,  
48 - "storageNum": 5 35 + 'alg': 'SALT_MD5',
  36 + 'code': 200,
  37 + 'data': [{
  38 + 'activityId': 3,
  39 + 'defaultImages': 'http://img11.static.yhbimg.com/goodsimg/2016/09/12/14/018aea16153cec3ad0c677a106b5d95c53.png?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70',
  40 + 'endTime': Math.round((Date.now() + 1000 * 60 * 60 * 7) / 1000),
  41 + 'marketPrice': 100,
  42 + 'productName': 'blkheimei男休闲/运动鞋南京艾尚仅门店可售',
  43 + 'productSkn': 512581470,
  44 + 'secKillPrice': 40,
  45 + 'secKillSku': [{
  46 + 'productSkn': 512581470,
  47 + 'productSku': 1384138,
  48 + 'storageNum': 5
49 }, { 49 }, {
50 - "productSkn": 512581470,  
51 - "productSku": 1384140,  
52 - "storageNum": 5 50 + 'productSkn': 512581470,
  51 + 'productSku': 1384140,
  52 + 'storageNum': 5
53 }, { 53 }, {
54 - "productSkn": 512581470,  
55 - "productSku": 1384140,  
56 - "storageNum": 5 54 + 'productSkn': 512581470,
  55 + 'productSku': 1384140,
  56 + 'storageNum': 5
57 }], 57 }],
58 - "secKillStatus": 1,  
59 - "startTime": Math.round((Date.now() + 1000 * 60 * 60) / 1000),  
60 - "status": 0,  
61 - "storageSum": 10, 58 + 'secKillStatus': 1,
  59 + 'startTime': Math.round((Date.now() + 1000 * 60 * 60) / 1000),
  60 + 'status': 0,
  61 + 'storageSum': 10,
62 remindFlag: false 62 remindFlag: false
63 }, { 63 }, {
64 - "activityId": 3,  
65 - "defaultImages": "http://img11.static.yhbimg.com/goodsimg/2016/09/12/14/018aea16153cec3ad0c677a106b5d95c53.png?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70",  
66 - "endTime": Math.round((Date.now() + 1000 * 60 * 60 * 7) / 1000),  
67 - "marketPrice": 100,  
68 - "productName": "blkheimei男休闲/运动鞋南京艾尚仅门店可售",  
69 - "productSkn": 512581470,  
70 - "secKillPrice": 40,  
71 - "secKillSku": [{  
72 - "productSkn": 512581470,  
73 - "productSku": 1384138,  
74 - "storageNum": 5 64 + 'activityId': 3,
  65 + 'defaultImages': 'http://img11.static.yhbimg.com/goodsimg/2016/09/12/14/018aea16153cec3ad0c677a106b5d95c53.png?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70',
  66 + 'endTime': Math.round((Date.now() + 1000 * 60 * 60 * 7) / 1000),
  67 + 'marketPrice': 100,
  68 + 'productName': 'blkheimei男休闲/运动鞋南京艾尚仅门店可售',
  69 + 'productSkn': 512581470,
  70 + 'secKillPrice': 40,
  71 + 'secKillSku': [{
  72 + 'productSkn': 512581470,
  73 + 'productSku': 1384138,
  74 + 'storageNum': 5
75 }, { 75 }, {
76 - "productSkn": 512581470,  
77 - "productSku": 1384140,  
78 - "storageNum": 5 76 + 'productSkn': 512581470,
  77 + 'productSku': 1384140,
  78 + 'storageNum': 5
79 }, { 79 }, {
80 - "productSkn": 512581470,  
81 - "productSku": 1384140,  
82 - "storageNum": 5 80 + 'productSkn': 512581470,
  81 + 'productSku': 1384140,
  82 + 'storageNum': 5
83 }], 83 }],
84 - "secKillStatus": 1,  
85 - "startTime": Math.round((Date.now() + 1000 * 60 * 60) / 1000),  
86 - "status": 0,  
87 - "storageSum": 10, 84 + 'secKillStatus': 1,
  85 + 'startTime': Math.round((Date.now() + 1000 * 60 * 60) / 1000),
  86 + 'status': 0,
  87 + 'storageSum': 10,
88 remindFlag: true 88 remindFlag: true
89 }], 89 }],
90 - "md5": "f09659c22f275fbd23d8999c58aba994",  
91 - "message": "query secKillProductList info" 90 + 'md5': 'f09659c22f275fbd23d8999c58aba994',
  91 + 'message': 'query secKillProductList info'
92 }; 92 };
93 93
94 exports.inActivityData = { 94 exports.inActivityData = {
95 - "alg": "SALT_MD5",  
96 - "code": 200,  
97 - "data": [{  
98 - "activityId": 3,  
99 - "defaultImages": "http://img11.static.yhbimg.com/goodsimg/2016/09/12/14/018aea16153cec3ad0c677a106b5d95c53.png?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70",  
100 - "endTime": Math.round((Date.now() + 1000 * 60 * 60 * 7) / 1000),  
101 - "marketPrice": 100,  
102 - "productName": "blkheimei男休闲/运动鞋南京艾尚仅门店可售",  
103 - "productSkn": 512581470,  
104 - "secKillPrice": 40,  
105 - "secKillSku": [{  
106 - "productSkn": 512581470,  
107 - "productSku": 1384138,  
108 - "storageNum": 5 95 + 'alg': 'SALT_MD5',
  96 + 'code': 200,
  97 + 'data': [{
  98 + 'activityId': 3,
  99 + 'defaultImages': 'http://img11.static.yhbimg.com/goodsimg/2016/09/12/14/018aea16153cec3ad0c677a106b5d95c53.png?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70',
  100 + 'endTime': Math.round((Date.now() + 1000 * 60 * 60 * 7) / 1000),
  101 + 'marketPrice': 100,
  102 + 'productName': 'blkheimei男休闲/运动鞋南京艾尚仅门店可售',
  103 + 'productSkn': 512581470,
  104 + 'secKillPrice': 40,
  105 + 'secKillSku': [{
  106 + 'productSkn': 512581470,
  107 + 'productSku': 1384138,
  108 + 'storageNum': 5
109 }, { 109 }, {
110 - "productSkn": 512581470,  
111 - "productSku": 1384140,  
112 - "storageNum": 5 110 + 'productSkn': 512581470,
  111 + 'productSku': 1384140,
  112 + 'storageNum': 5
113 }, { 113 }, {
114 - "productSkn": 512581470,  
115 - "productSku": 1384140,  
116 - "storageNum": 5 114 + 'productSkn': 512581470,
  115 + 'productSku': 1384140,
  116 + 'storageNum': 5
117 }], 117 }],
118 - "secKillStatus": 1,  
119 - "startTime": Math.round(Date.now() / 1000),  
120 - "status": 0,  
121 - "storageSum": 10, 118 + 'secKillStatus': 1,
  119 + 'startTime': Math.round(Date.now() / 1000),
  120 + 'status': 0,
  121 + 'storageSum': 10,
122 remind: false 122 remind: false
123 }, { 123 }, {
124 - "activityId": 3,  
125 - "defaultImages": "http://img11.static.yhbimg.com/goodsimg/2016/09/12/14/018aea16153cec3ad0c677a106b5d95c53.png?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70",  
126 - "endTime": Math.round((Date.now() + 1000 * 60 * 60 * 7) / 1000),  
127 - "marketPrice": 100,  
128 - "productName": "blkheimei男休闲/运动鞋南京艾尚仅门店可售",  
129 - "productSkn": 512581470,  
130 - "secKillPrice": 40,  
131 - "secKillSku": [{  
132 - "productSkn": 512581470,  
133 - "productSku": 1384138,  
134 - "storageNum": 5 124 + 'activityId': 3,
  125 + 'defaultImages': 'http://img11.static.yhbimg.com/goodsimg/2016/09/12/14/018aea16153cec3ad0c677a106b5d95c53.png?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70',
  126 + 'endTime': Math.round((Date.now() + 1000 * 60 * 60 * 7) / 1000),
  127 + 'marketPrice': 100,
  128 + 'productName': 'blkheimei男休闲/运动鞋南京艾尚仅门店可售',
  129 + 'productSkn': 512581470,
  130 + 'secKillPrice': 40,
  131 + 'secKillSku': [{
  132 + 'productSkn': 512581470,
  133 + 'productSku': 1384138,
  134 + 'storageNum': 5
135 }, { 135 }, {
136 - "productSkn": 512581470,  
137 - "productSku": 1384140,  
138 - "storageNum": 5 136 + 'productSkn': 512581470,
  137 + 'productSku': 1384140,
  138 + 'storageNum': 5
139 }, { 139 }, {
140 - "productSkn": 512581470,  
141 - "productSku": 1384140,  
142 - "storageNum": 5 140 + 'productSkn': 512581470,
  141 + 'productSku': 1384140,
  142 + 'storageNum': 5
143 }], 143 }],
144 - "secKillStatus": 1,  
145 - "startTime": Math.round(Date.now() / 1000),  
146 - "status": 0,  
147 - "storageSum": 10, 144 + 'secKillStatus': 1,
  145 + 'startTime': Math.round(Date.now() / 1000),
  146 + 'status': 0,
  147 + 'storageSum': 10,
148 remind: true 148 remind: true
149 }], 149 }],
150 - "md5": "f09659c22f275fbd23d8999c58aba994",  
151 - "message": "query secKillProductList info" 150 + 'md5': 'f09659c22f275fbd23d8999c58aba994',
  151 + 'message': 'query secKillProductList info'
152 }; 152 };
@@ -685,15 +685,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -685,15 +685,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
685 function() { 685 function() {
686 var thisSkn = $('#productSkn').val(); 686 var thisSkn = $('#productSkn').val();
687 var thisSku = ''; 687 var thisSku = '';
688 - $('.size-row').each(  
689 - function() {  
690 - if ($(this).hasClass('hide')) {  
691 - return false;  
692 - } else {  
693 - thisSku = $(this).find('.chosed').attr('data-skuid');  
694 - }  
695 - }  
696 - ); 688 +
  689 + thisSku = $('.size-row:last').find('.chosed').attr('data-skuid');
697 690
698 window.location.href = '/cart/seckill?skn=' + thisSkn + '&sku=' + thisSku; 691 window.location.href = '/cart/seckill?skn=' + thisSkn + '&sku=' + thisSku;
699 } 692 }
@@ -35,7 +35,7 @@ try { @@ -35,7 +35,7 @@ try {
35 info = JSON.parse(info); 35 info = JSON.parse(info);
36 36
37 // 2015/12/31 hf: fixes bug to 购物车页面调用该JS, 会导致有有货币,值却没有传给服务端. 因此需要再设置一下 37 // 2015/12/31 hf: fixes bug to 购物车页面调用该JS, 会导致有有货币,值却没有传给服务端. 因此需要再设置一下
38 - //info['yohoCoin'] = $('.coin').data('yoho-coin') || 0; 38 + // info['yohoCoin'] = $('.coin').data('yoho-coin') || 0;
39 } catch (e) { 39 } catch (e) {
40 init(); 40 init();
41 } 41 }
@@ -84,7 +84,7 @@ $( @@ -84,7 +84,7 @@ $(
84 seckillObj.startTick(timeObj, offsetTime); 84 seckillObj.startTick(timeObj, offsetTime);
85 }, 85 },
86 error: function() { 86 error: function() {
87 - // alert('err'); 87 + tip.show('网络异常~');
88 } 88 }
89 }); 89 });
90 90