Authored by htoooth

fix express

@@ -17,7 +17,7 @@ router.get('/index/getProductInfo', cart.getProductInfo); @@ -17,7 +17,7 @@ router.get('/index/getProductInfo', cart.getProductInfo);
17 17
18 router.get('/coupon/list', cart.getCoupons); // 优惠券列表 18 router.get('/coupon/list', cart.getCoupons); // 优惠券列表
19 19
20 -router.get('/address/list', address.getList); // 用户的地址列表信息 20 +router.get('/address/list', address.getList); // 省市区列表信息
21 router.get('/address/area', address.getArea); // 省市区列表信息 21 router.get('/address/area', address.getArea); // 省市区列表信息
22 router.post('/address/delete', address.delAddress); // 删除地址 22 router.post('/address/delete', address.delAddress); // 删除地址
23 router.post('/address/save', address.saveAddress); // 新增地址/更新地址 23 router.post('/address/save', address.saveAddress); // 新增地址/更新地址
@@ -124,7 +124,21 @@ const detail = (req, res, next) => { @@ -124,7 +124,21 @@ const detail = (req, res, next) => {
124 }; 124 };
125 125
126 const express = (req, res, next) => { 126 const express = (req, res, next) => {
  127 + let orderId = req.query.orderId || '';
  128 + let uid = req.user.uid;
  129 + let payType = req.query.payType;
  130 + let time = req.query.time;
127 131
  132 + if (!orderId) {
  133 + return res.json({
  134 + code: 400,
  135 + message: '参数出错'
  136 + });
  137 + }
  138 +
  139 + ordersService.express(orderId, uid, payType, time).then((result) => {
  140 + return res.json(result);
  141 + }).catch(next);
128 }; 142 };
129 143
130 module.exports = { 144 module.exports = {
@@ -333,6 +333,8 @@ const getOrders = (uid, page, limit, type, isPage)=> { @@ -333,6 +333,8 @@ const getOrders = (uid, page, limit, type, isPage)=> {
333 333
334 newOrder.orderNum = order.order_code; // 订单标识 334 newOrder.orderNum = order.order_code; // 订单标识
335 newOrder.orderTime = moment.unix(_.get(order, 'create_time')).format('YYYY-MM-DD HH:mm:ss'); 335 newOrder.orderTime = moment.unix(_.get(order, 'create_time')).format('YYYY-MM-DD HH:mm:ss');
  336 + newOrder.time = _.get(order, 'create_time');
  337 + newOrder.payType = _.get(order, 'payment_type');
336 338
337 if (order.is_cancel === 'Y' || order.status === 6) { 339 if (order.is_cancel === 'Y' || order.status === 6) {
338 newOrder.canDelete = true; // 删除订单 340 newOrder.canDelete = true; // 删除订单
@@ -353,7 +355,8 @@ const getOrders = (uid, page, limit, type, isPage)=> { @@ -353,7 +355,8 @@ const getOrders = (uid, page, limit, type, isPage)=> {
353 if (statusInfo.keyName === 'shipped') { 355 if (statusInfo.keyName === 'shipped') {
354 let expressInfo = yield _getExpressInfo( 356 let expressInfo = yield _getExpressInfo(
355 order.order_code, uid, 357 order.order_code, uid,
356 - order.payment_type, order.create_time 358 + order.payment_type, order.create_time,
  359 + false
357 ); 360 );
358 361
359 newOrder.logistics = expressInfo.logistics; 362 newOrder.logistics = expressInfo.logistics;
@@ -405,7 +408,7 @@ const getOrders = (uid, page, limit, type, isPage)=> { @@ -405,7 +408,7 @@ const getOrders = (uid, page, limit, type, isPage)=> {
405 return newOrder; 408 return newOrder;
406 }); 409 });
407 410
408 - result.list = yield Promise.map(orderInfo.order_list, handleOrder); 411 + result.list = yield Promise.map(_.get(orderInfo, 'order_list', []), handleOrder);
409 412
410 if (isPage) { 413 if (isPage) {
411 result.pager = { 414 result.pager = {
@@ -789,6 +792,8 @@ const detail = co(function * (uid, orderId) { @@ -789,6 +792,8 @@ const detail = co(function * (uid, orderId) {
789 }; 792 };
790 }); 793 });
791 794
  795 +const express = _.partial(_getExpressInfo, _, _, _, _, true);
  796 +
792 module.exports = { 797 module.exports = {
793 index, 798 index,
794 ORDER_TYPE, 799 ORDER_TYPE,
@@ -799,5 +804,6 @@ module.exports = { @@ -799,5 +804,6 @@ module.exports = {
799 cancel, 804 cancel,
800 detail, 805 detail,
801 getOrders, 806 getOrders,
802 - closeReason 807 + closeReason,
  808 + express
803 }; 809 };
@@ -284,6 +284,9 @@ router.post('/orders/cancelOrder', ordersController.cancel); @@ -284,6 +284,9 @@ router.post('/orders/cancelOrder', ordersController.cancel);
284 // 订单详情 284 // 订单详情
285 router.get('/orders/detail', [getCommonHeader, getHomeNav], ordersController.detail); 285 router.get('/orders/detail', [getCommonHeader, getHomeNav], ordersController.detail);
286 286
  287 +// 物流信息
  288 +router.get('/orders/express', ordersController.express);
  289 +
287 /********************************* 我的订单结束 *****************************************/ 290 /********************************* 我的订单结束 *****************************************/
288 291
289 292
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 {{/with}} 14 {{/with}}
15 {{^}} 15 {{^}}
16 {{# orders.list}} 16 {{# orders.list}}
17 - <div class="order" data-id="{{orderNum}}"> 17 + <div class="order" data-id="{{orderNum}}" data-time="{{time}}" data-paytype="{{payType}}">
18 <p class="order-title"> 18 <p class="order-title">
19 订单编号:{{orderNum}} 19 订单编号:{{orderNum}}
20 <span class="order-time">下单时间:{{orderTime}}</span> 20 <span class="order-time">下单时间:{{orderTime}}</span>
@@ -17,14 +17,14 @@ module.exports = { @@ -17,14 +17,14 @@ module.exports = {
17 cookieDomain: '.yohobuy.com', 17 cookieDomain: '.yohobuy.com',
18 domains: { 18 domains: {
19 // test3 19 // test3
20 - // singleApi: 'http://api-test3.yohops.com:9999/',  
21 - // api: 'http://api-test3.yohops.com:9999/',  
22 - // service: 'http://service-test3.yohops.com:9999/', 20 + singleApi: 'http://api-test3.yohops.com:9999/',
  21 + api: 'http://api-test3.yohops.com:9999/',
  22 + service: 'http://service-test3.yohops.com:9999/',
23 23
24 // prod 24 // prod
25 - singleApi: 'http://single.yoho.cn/',  
26 - api: 'http://api.yoho.cn/',  
27 - service: 'http://service.yoho.cn/', 25 + //singleApi: 'http://single.yoho.cn/',
  26 + //api: 'http://api.yoho.cn/',
  27 + //service: 'http://service.yoho.cn/',
28 28
29 // gray 29 // gray
30 // singleApi: 'http://single.gray.yohops.com/', 30 // singleApi: 'http://single.gray.yohops.com/',