Authored by 陈轩

结算-选择地址页面

@@ -148,3 +148,37 @@ exports.couponSearch = (req, res, next) => { @@ -148,3 +148,37 @@ exports.couponSearch = (req, res, next) => {
148 })(); 148 })();
149 }; 149 };
150 150
  151 +exports.selectAddress = (req, res, next) => {
  152 + let uid = req.user.uid;
  153 +
  154 + return addressModel.addressData(uid)
  155 + .then(address => {
  156 + let moreUrl = req.get('Referer') || '/cart/index/orderEnsure'; // 取跳过来的url
  157 +
  158 + address = address.data;
  159 +
  160 + // 购物车订单进来,秒杀进来
  161 + if (
  162 + moreUrl.indexOf('/cart/index/new/orderEnsure') !== -1 ||
  163 + moreUrl.indexOf('/cart/index/seckill') !== -1
  164 + ) {
  165 + req.session.addressMore = moreUrl; // TODO: 注意cookie-session
  166 + }
  167 +
  168 + moreUrl = req.session.addressMore;
  169 +
  170 + let headerData = headerModel.setNav({
  171 + navTitle: '选择地址',
  172 + navBtn: false,
  173 + backUrl: moreUrl
  174 + });
  175 +
  176 + res.render('select-address', {
  177 + pageHeader: headerData,
  178 + pageFooter: true,
  179 + moreUrl,
  180 + address
  181 + });
  182 + });
  183 +};
  184 +
@@ -27,10 +27,10 @@ router.get('/paySuccess/payCod', payController.payCod);// 支付成功,货到 @@ -27,10 +27,10 @@ router.get('/paySuccess/payCod', payController.payCod);// 支付成功,货到
27 router.get('/shopping/pay/aliwapreturn', payController.payAli);// 支付成功,支付宝付款 27 router.get('/shopping/pay/aliwapreturn', payController.payAli);// 支付成功,支付宝付款
28 28
29 router.get('/index/new/orderEnsure', authMW, order.orderEnsure); // 订单结算 29 router.get('/index/new/orderEnsure', authMW, order.orderEnsure); // 订单结算
30 -router.get('/index/new/selectAddress', authMW, order.selectAddress); // 选择地址  
31 router.get('/index/new/selectCoupon', authMW, order.selectCoupon); // 选择优惠券 页面 30 router.get('/index/new/selectCoupon', authMW, order.selectCoupon); // 选择优惠券 页面
32 router.get('/index/new/couponList', order.couponList); // [ajax]获取优惠券列表 31 router.get('/index/new/couponList', order.couponList); // [ajax]获取优惠券列表
33 router.post('/index/new/couponSearch', order.couponSearch); // [ajax]购物车输入优惠券码使用优惠券 32 router.post('/index/new/couponSearch', order.couponSearch); // [ajax]购物车输入优惠券码使用优惠券
  33 +router.get('/index/new/selectAddress', authMW, order.selectAddress); // 选择地址
34 34
35 35
36 module.exports = router; 36 module.exports = router;
  1 +<div class="my-address-page select-address-page yoho-page">
  2 + <div class="page-wrap clearfix">
  3 + {{# address}}
  4 + <div class="address-item" data-address-id="{{address_id}}" data-is-support="{{is_support}}" data-href="{{../moreUrl}}">
  5 + <span class="name">{{consignee}}</span>
  6 + <span class="tel">{{mobile}}</span>
  7 + <p class="address-info">{{area}} {{address}}</p>
  8 + <div class="action iconfont">
  9 + <span class="edit" data-href="/home/addressAct?id={{address_id}}&refer=shopping">&#xe61e;</span>
  10 + <span class="del" data-id="{{address_id}}">&#xe621;</span>
  11 + </div>
  12 + </div>
  13 + {{/ address}}
  14 +
  15 + <a class="add-address" data-href="/home/addressAct?refer=shopping">
  16 + 添加新地址
  17 + </a>
  18 +
  19 + <div class="confim-mask hide">
  20 + <div class="confim-box">
  21 + <div class="content">
  22 + 您确定要删除地址?
  23 + </div>
  24 + <div class="action">
  25 + <span class="cancel">
  26 + 取消
  27 + </span>
  28 + <span class="confim">
  29 + 确认
  30 + </span>
  31 + </div>
  32 + </div>
  33 + </div>
  34 + </div>
  35 +</div>